[hdf-eos5] 01/04: Snapshot hdf-eos5-5.1.15

Alastair McKinstry mckinstry at moszumanska.debian.org
Tue Aug 18 15:48:14 UTC 2015


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch debian/master
in repository hdf-eos5.

commit a412134313fe124ad98a703cf27bf6a2e94a42f8
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Mon Mar 2 20:55:13 2015 +0000

    Snapshot hdf-eos5-5.1.15
---
 CMakeLists.txt                                  |   807 +
 CTestConfig.cmake                               |    26 +
 Makefile                                        |   436 +
 Makefile.am                                     |    21 +
 Makefile.in                                     |   617 +
 aclocal.m4                                      |  7009 +++++
 bin/INSTALL                                     |  2966 ++
 bin/INSTALL-HDFEOS                              |  1931 ++
 bin/INSTALL-Scripts/INSTALL-HDF                 |  1778 ++
 bin/INSTALL-Scripts/INSTALL-HDF4.2r10           |  1194 +
 bin/INSTALL-Scripts/INSTALL-HDF4.2r6            |  1193 +
 bin/INSTALL-Scripts/INSTALL-HDF5                |  1541 ++
 bin/INSTALL-Scripts/INSTALL-HDF5-1.8.12         |  1172 +
 bin/INSTALL-Scripts/INSTALL-HDF5-1.8.8          |  1171 +
 bin/INSTALL-Scripts/INSTALL-HDFEOS-Wrap         |   760 +
 bin/INSTALL-Scripts/INSTALL-HDFEOS5-Wrap        |   677 +
 bin/INSTALL-Scripts/INSTALL-JPEG                |  1377 +
 bin/INSTALL-Scripts/INSTALL-JPEGSRC.v6b         |   595 +
 bin/INSTALL-Scripts/INSTALL-SZIP                |  1389 +
 bin/INSTALL-Scripts/INSTALL-SZIP2.1             |   581 +
 bin/INSTALL-Scripts/INSTALL-ZLIB                |  1431 +
 bin/INSTALL-Scripts/INSTALL-ZLIB-1.2.5          |   620 +
 bin/INSTALL-Scripts/INSTALL-ZLIB-1.2.8          |   621 +
 bin/tmp/hdfeos_env.csh.tmp                      |   728 +
 bin/tmp/hdfeos_env.ksh.tmp                      |   706 +
 config/cmake/CPack.cmake                        |   583 +
 config/cmake/CTestCustom.cmake                  |    13 +
 config/cmake/CheckTypeSize.cmake                |    48 +
 config/cmake/ConfigureChecks.cmake              |   340 +
 config/cmake/EOSMacros.cmake                    |   140 +
 config/cmake/EOSTests.c                         |   512 +
 config/cmake/FindHDF5.cmake                     |    85 +
 config/cmake/FindHDFEOS5.cmake.in               |    77 +
 config/cmake/FindMPI.cmake                      |   628 +
 config/cmake/FindSZIP.cmake                     |   179 +
 config/cmake/HDF5Macros.cmake                   |   135 +
 config/cmake/HDF5UseFortran.cmake               |   121 +
 config/cmake/HDFEOSMacros.cmake                 |    33 +
 config/cmake/HE5_config.h.in                    |   150 +
 config/cmake/NSIS.InstallOptions.ini.in         |    37 +
 config/cmake/NSIS.template.in                   |   949 +
 config/cmake/cacheinit.cmake                    |    53 +
 config/cmake/hdfeos5-config-version.cmake.in    |    27 +
 config/cmake/hdfeos5-config.cmake.build.in      |    39 +
 config/cmake/hdfeos5-config.cmake.install.in    |    54 +
 config/cmake/runTest.cmake                      |   108 +
 config/cmake/xlatefile.c                        |    56 +
 config/config.guess                             |  1463 +
 config/config.sub                               |  1579 ++
 config/depcomp                                  |   530 +
 config/include.am                               |     8 +
 config/install-sh                               |   323 +
 config/ltmain.sh                                |  6402 +++++
 config/missing                                  |   360 +
 configure                                       | 26642 ++++++++++++++++++
 configure.ac                                    |   609 +
 doc/AUTOCONF_INSTALL                            |   227 +
 doc/Building_EOS5.doc                           |   Bin 0 -> 38400 bytes
 doc/Compile_WIN.readme.txt                      |   139 +
 doc/HDFEOS-DEFINITION.TXT                       |   169 +
 doc/Install_HDFEOS5_WIN.readme.txt              |   252 +
 doc/README                                      |   525 +
 include/HE5_GctpFunc.h                          |   281 +
 include/HE5_HdfEosDef.h                         |   981 +
 include/HE5_config.h.in                         |   144 +
 include/Makefile.am                             |     9 +
 include/Makefile.in                             |   442 +
 include/cfortHdf.h                              |  1800 ++
 include/cproj.h                                 |    38 +
 include/ease.h                                  |    18 +
 include/hdfeos5.inc                             |   411 +
 include/hdfeos5_64.inc                          |    16 +
 include/isin.h                                  |   108 +
 include/proj.h                                  |    93 +
 include/tutils.h                                |    62 +
 lib/tmp/geolibCYGWIN.a                          |   Bin 0 -> 256026 bytes
 lib/tmp/geolibDEC.a                             |   Bin 0 -> 1214426 bytes
 lib/tmp/geolibHP.a                              |   Bin 0 -> 1259564 bytes
 lib/tmp/geolibHP11.a                            |   Bin 0 -> 1157820 bytes
 lib/tmp/geolibIBM.a                             |   Bin 0 -> 472113 bytes
 lib/tmp/geolibIRIX53.a                          |   Bin 0 -> 597480 bytes
 lib/tmp/geolibIRIX62-64.a                       |   Bin 0 -> 817668 bytes
 lib/tmp/geolibIRIX62-64mips3.a                  |   Bin 0 -> 603700 bytes
 lib/tmp/geolibIRIX62-n32.a                      |   Bin 0 -> 617764 bytes
 lib/tmp/geolibIRIX65-64.a                       |   Bin 0 -> 645844 bytes
 lib/tmp/geolibIRIX65-n32.a                      |   Bin 0 -> 482404 bytes
 lib/tmp/geolibLINUX.a                           |   Bin 0 -> 279438 bytes
 lib/tmp/geolibLINUX64.a                         |   Bin 0 -> 505298 bytes
 lib/tmp/geolibLINUXIA64.a                       |   Bin 0 -> 1517930 bytes
 lib/tmp/geolibMAC.a                             |   Bin 0 -> 501376 bytes
 lib/tmp/geolibMACIntel.a                        |   Bin 0 -> 351520 bytes
 lib/tmp/geolibMACIntel64.a                      |   Bin 0 -> 343536 bytes
 lib/tmp/geolibSOL210.a                          |   Bin 0 -> 455760 bytes
 lib/tmp/geolibSOL24.a                           |   Bin 0 -> 1111960 bytes
 lib/tmp/geolibSOL28.a                           |   Bin 0 -> 1111960 bytes
 lib/tmp/geolibSOL29.a                           |   Bin 0 -> 434688 bytes
 make/CLSInstall.sh                              |    21 +
 make/Makefile.instr                             |   146 +
 make/Makefile.template                          |    73 +
 make/make.options                               |   513 +
 make/make.targets                               |    76 +
 make/makeidl.include                            |   103 +
 make/makeidlxx.include                          |   107 +
 make/makerec.include                            |    71 +
 make/makerec.template                           |    23 +
 samples/CMakeLists.txt                          |   409 +
 samples/Makefile.am                             |   293 +
 samples/Makefile.in                             |  1904 ++
 samples/README                                  |   395 +
 samples/external_1.data                         |   Bin 0 -> 400 bytes
 samples/external_1g.data                        |   Bin 0 -> 400 bytes
 samples/external_2.data                         |   Bin 0 -> 400 bytes
 samples/external_2g.data                        |   Bin 0 -> 400 bytes
 samples/external_3.data                         |   Bin 0 -> 400 bytes
 samples/external_3g.data                        |   Bin 0 -> 400 bytes
 samples/fixedBuoy0.txt                          |     3 +
 samples/fixedBuoy1.txt                          |    20 +
 samples/fixedBuoy1s.txt                         |    20 +
 samples/floatBuoy0.txt                          |     3 +
 samples/floatBuoy1.txt                          |    25 +
 samples/hdfeos5.inc                             |   411 +
 samples/hdfeos5_64.inc                          |    16 +
 samples/he5_eh_readglobalattr.c                 |   309 +
 samples/he5_gd_datainfo.c                       |    91 +
 samples/he5_gd_defexternalfld.c                 |    70 +
 samples/he5_gd_definefields.c                   |   127 +
 samples/he5_gd_definefieldsF_32.f               |   120 +
 samples/he5_gd_definefieldsF_64.f               |   105 +
 samples/he5_gd_defunlimfld.c                    |   128 +
 samples/he5_gd_info.c                           |   206 +
 samples/he5_gd_infoF_32.f                       |   348 +
 samples/he5_gd_infoF_64.f                       |   348 +
 samples/he5_gd_rdexternaldata.c                 |   147 +
 samples/he5_gd_readdata.c                       |    80 +
 samples/he5_gd_readdataF_32.f                   |    77 +
 samples/he5_gd_readdataF_64.f                   |    76 +
 samples/he5_gd_readdimscale.c                   |   189 +
 samples/he5_gd_readdimscaleF_32.f               |   185 +
 samples/he5_gd_setup.c                          |   169 +
 samples/he5_gd_setupF_32.f                      |   173 +
 samples/he5_gd_setupF_64.f                      |   172 +
 samples/he5_gd_subset.c                         |    84 +
 samples/he5_gd_subsetF_32.f                     |    95 +
 samples/he5_gd_subsetF_64.f                     |    90 +
 samples/he5_gd_wrexternaldata.c                 |   121 +
 samples/he5_gd_writeAlldimscale.c               |   322 +
 samples/he5_gd_writedata.c                      |   111 +
 samples/he5_gd_writedataF_32.f                  |   148 +
 samples/he5_gd_writedataF_64.f                  |   142 +
 samples/he5_gd_writedimscale.c                  |   322 +
 samples/he5_gd_writedimscaleF_32.f              |   385 +
 samples/he5_gd_wrunlimfld.c                     |   118 +
 samples/he5_pt_datainfo.c                       |    86 +
 samples/he5_pt_datainfoF_32.f                   |   101 +
 samples/he5_pt_datainfoF_64.f                   |   101 +
 samples/he5_pt_definelevels.c                   |   395 +
 samples/he5_pt_definelevelsF_32.f               |   271 +
 samples/he5_pt_definelevelsF_64.f               |   271 +
 samples/he5_pt_readattrs.c                      |   116 +
 samples/he5_pt_readattrsF_32.f                  |   150 +
 samples/he5_pt_readattrsF_64.f                  |   152 +
 samples/he5_pt_readdata.c                       |   197 +
 samples/he5_pt_readdataF_32.f                   |   174 +
 samples/he5_pt_readdataF_64.f                   |   175 +
 samples/he5_pt_setup.c                          |    57 +
 samples/he5_pt_setupF_32.f                      |    64 +
 samples/he5_pt_setupF_64.f                      |    63 +
 samples/he5_pt_updatelevels.c                   |    73 +
 samples/he5_pt_updatelevelsF_32.f               |   100 +
 samples/he5_pt_updatelevelsF_32_a.f             |   180 +
 samples/he5_pt_updatelevelsF_64.f               |    99 +
 samples/he5_pt_writeattrs.c                     |    73 +
 samples/he5_pt_writeattrsF_32.f                 |   109 +
 samples/he5_pt_writeattrsF_64.f                 |   109 +
 samples/he5_pt_writedata.c                      |   314 +
 samples/he5_pt_writedataF_32.f                  |   441 +
 samples/he5_pt_writedataF_64.f                  |   450 +
 samples/he5_sw_datainfo.c                       |   170 +
 samples/he5_sw_defexternalfld.c                 |    73 +
 samples/he5_sw_defexternalfldF_32.f             |    73 +
 samples/he5_sw_defexternalfldF_64.f             |    78 +
 samples/he5_sw_definefields.c                   |   214 +
 samples/he5_sw_definefieldsF_32.f               |   134 +
 samples/he5_sw_definefieldsF_64.f               |   135 +
 samples/he5_sw_definefields_and_all_dimscales.c |   316 +
 samples/he5_sw_definefields_szipF_32.f          |   142 +
 samples/he5_sw_definefields_szipF_64.f          |   145 +
 samples/he5_sw_defunlimfld.c                    |   111 +
 samples/he5_sw_info.c                           |   279 +
 samples/he5_sw_infoF_32.f                       |   207 +
 samples/he5_sw_infoF_64.f                       |   211 +
 samples/he5_sw_rdexternaldata.c                 |   140 +
 samples/he5_sw_rdexternaldataF_32.f             |   148 +
 samples/he5_sw_rdexternaldataF_64.f             |   142 +
 samples/he5_sw_readdata.c                       |   177 +
 samples/he5_sw_readdataF_32.f                   |   183 +
 samples/he5_sw_readdataF_64.f                   |   169 +
 samples/he5_sw_readdimscale.c                   |   187 +
 samples/he5_sw_readdimscaleF_32.f               |   180 +
 samples/he5_sw_setup.c                          |   120 +
 samples/he5_sw_setupF_32.f                      |   177 +
 samples/he5_sw_setupF_64.f                      |   144 +
 samples/he5_sw_subset.c                         |   109 +
 samples/he5_sw_subsetF_32.f                     |   134 +
 samples/he5_sw_subsetF_64.f                     |   127 +
 samples/he5_sw_wrextendrd.c                     |   121 +
 samples/he5_sw_wrexternaldata.c                 |   119 +
 samples/he5_sw_wrexternaldataF_32.f             |   125 +
 samples/he5_sw_wrexternaldataF_64.f             |   125 +
 samples/he5_sw_writedata.c                      |   244 +
 samples/he5_sw_writedataF_32.f                  |   251 +
 samples/he5_sw_writedataF_64.f                  |   209 +
 samples/he5_sw_writedimscale.c                  |   137 +
 samples/he5_sw_writedimscaleF_32.f              |   168 +
 samples/he5_sw_wrunlimfld.c                     |   205 +
 samples/he5_za_datainfo.c                       |   106 +
 samples/he5_za_defexternalfld.c                 |    73 +
 samples/he5_za_defexternalfldF_32.f             |    73 +
 samples/he5_za_defexternalfldF_64.f             |    78 +
 samples/he5_za_definefields.c                   |   172 +
 samples/he5_za_definefieldsF_32.f               |    93 +
 samples/he5_za_definefieldsF_64.f               |    89 +
 samples/he5_za_info.c                           |   162 +
 samples/he5_za_infoF_32.f                       |   124 +
 samples/he5_za_infoF_64.f                       |   123 +
 samples/he5_za_rdexternaldata.c                 |   140 +
 samples/he5_za_rdexternaldataF_32.f             |   148 +
 samples/he5_za_rdexternaldataF_64.f             |   142 +
 samples/he5_za_readdata.c                       |   142 +
 samples/he5_za_readdataF_32.f                   |   105 +
 samples/he5_za_readdataF_64.f                   |    99 +
 samples/he5_za_readdimscale.c                   |   187 +
 samples/he5_za_readdimscaleF_32.f               |   180 +
 samples/he5_za_setup.c                          |    83 +
 samples/he5_za_setupF_32.f                      |   123 +
 samples/he5_za_setupF_64.f                      |    90 +
 samples/he5_za_wrexternaldata.c                 |   120 +
 samples/he5_za_wrexternaldataF_32.f             |   125 +
 samples/he5_za_wrexternaldataF_64.f             |   125 +
 samples/he5_za_writeAlldimscale.c               |   135 +
 samples/he5_za_writedata.c                      |   140 +
 samples/he5_za_writedataF_32.f                  |   109 +
 samples/he5_za_writedataF_64.f                  |   100 +
 samples/he5_za_writedimscale.c                  |   135 +
 samples/he5_za_writedimscaleF_32.f              |   168 +
 samples/makefile_me                             |    76 +
 samples/simple.txt                              |    15 +
 src/CMakeLists.txt                              |    80 +
 src/EHapi.c                                     | 11565 ++++++++
 src/GDapi.c                                     | 28031 +++++++++++++++++++
 src/Makefile                                    |    92 +
 src/Makefile.am                                 |    19 +
 src/Makefile.in                                 |   497 +
 src/Makefile_CM                                 |    79 +
 src/Makefile_alt                                |    97 +
 src/PTapi.c                                     | 13307 +++++++++
 src/SWapi.c                                     | 31628 ++++++++++++++++++++++
 src/TSapi.c                                     |   340 +
 src/ZAapi.c                                     | 16954 ++++++++++++
 src/make_IT/makeDEC4.0r1                        |    26 +
 src/make_IT/makeHP4.0r1                         |    24 +
 src/make_IT/makeIBM4.0r1                        |    24 +
 src/make_IT/makeSGI4.0r1                        |    24 +
 src/make_IT/makeSUN4.0r1                        |    26 +
 src/make_IT/makeinc                             |   145 +
 src/make_exclude_list                           |    17 +
 testdrivers/CMakeLists.txt                      |    10 +
 testdrivers/Make_Test                           |   179 +
 testdrivers/Makefile.am                         |    13 +
 testdrivers/Makefile.in                         |   476 +
 testdrivers/README                              |   114 +
 testdrivers/grid/CMakeLists.txt                 |    56 +
 testdrivers/grid/Makefile.am                    |    58 +
 testdrivers/grid/Makefile.in                    |   524 +
 testdrivers/grid/Makefile.sgi32                 |    58 +
 testdrivers/grid/TestAlias.c                    |   272 +
 testdrivers/grid/TestGrid.c                     |  6429 +++++
 testdrivers/grid/hdfeos5.inc                    |   411 +
 testdrivers/grid/hdfeos5_64.inc                 |    16 +
 testdrivers/grid/testgrid32.f                   |  2535 ++
 testdrivers/grid/testgrid64.f                   |  2560 ++
 testdrivers/grid/testgrid_szip32.f              |  4240 +++
 testdrivers/grid/testgrid_szip64.f              |  4284 +++
 testdrivers/grid/tutils.h                       |    62 +
 testdrivers/make.com                            |    75 +
 testdrivers/point/CMakeLists.txt                |    64 +
 testdrivers/point/Makefile.am                   |    49 +
 testdrivers/point/Makefile.in                   |   519 +
 testdrivers/point/Makefile.sgi32                |    59 +
 testdrivers/point/TestPoint.c                   |  2862 ++
 testdrivers/point/fixedBuoy0.txt                |     3 +
 testdrivers/point/fixedBuoy1.txt                |    20 +
 testdrivers/point/fixedBuoy1s.txt               |    20 +
 testdrivers/point/floatBuoy0.txt                |     3 +
 testdrivers/point/floatBuoy1.txt                |    25 +
 testdrivers/point/hdfeos5.inc                   |   411 +
 testdrivers/point/hdfeos5_64.inc                |    16 +
 testdrivers/point/simple.txt                    |    15 +
 testdrivers/point/testpoint32.f                 |  3666 +++
 testdrivers/point/testpoint64.f                 |  3668 +++
 testdrivers/point/tutils.h                      |    62 +
 testdrivers/swath/CMakeLists.txt                |    41 +
 testdrivers/swath/Makefile.am                   |    49 +
 testdrivers/swath/Makefile.in                   |   518 +
 testdrivers/swath/Makefile.sgi32                |    58 +
 testdrivers/swath/TestAlias.c                   |   304 +
 testdrivers/swath/TestProfile.c                 |   400 +
 testdrivers/swath/TestSwath.c                   |  5479 ++++
 testdrivers/swath/hdfeos5.inc                   |   411 +
 testdrivers/swath/hdfeos5_64.inc                |    16 +
 testdrivers/swath/testswath32.f                 |  2675 ++
 testdrivers/swath/testswath64.f                 |  2771 ++
 testdrivers/swath/tutils.h                      |    62 +
 testdrivers/threads/CMakeLists.txt              |    30 +
 testdrivers/threads/Makefile.am                 |    19 +
 testdrivers/threads/Makefile.in                 |   585 +
 testdrivers/threads/Makefile.sgi32              |    58 +
 testdrivers/threads/he5_gd_threads-1.c          |   212 +
 testdrivers/threads/he5_gd_threads-2.c          |   171 +
 testdrivers/threads/he5_pt_threads-1.c          |   214 +
 testdrivers/threads/he5_pt_threads-2.c          |   234 +
 testdrivers/threads/he5_sw_threads-1.c          |   215 +
 testdrivers/threads/he5_sw_threads-2.c          |   171 +
 testdrivers/za/CMakeLists.txt                   |    45 +
 testdrivers/za/Makefile.am                      |    44 +
 testdrivers/za/Makefile.in                      |   522 +
 testdrivers/za/Makefile.sgi32                   |    59 +
 testdrivers/za/TestAlias.c                      |   305 +
 testdrivers/za/TestZa.c                         |  1953 ++
 testdrivers/za/hdfeos5.inc                      |   411 +
 testdrivers/za/hdfeos5_64.inc                   |    16 +
 testdrivers/za/testza32.f                       |  1743 ++
 testdrivers/za/testza64.f                       |  1793 ++
 util/HE5_GDconvert_ij2ll.c                      |   883 +
 util/make.com                                   |    20 +
 util/makefile                                   |   183 +
 336 files changed, 262744 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..94a70d1
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,807 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDFEOS5 C CXX)
+
+#-----------------------------------------------------------------------------
+# Instructions for use : Normal Build
+#
+# For standard build of HDFEOS5 libraries,tests and tools. 
+# Run cmake using the HDFEOS5 source tree to generate a build tree.
+# Enable/Disable options according to requirements and
+# set CMAKE_INSTALL_PREFIX to the required install path.
+# Make install can be used to install all components for system-wide use.
+#
+#-----------------------------------------------------------------------------
+# Instructions for use : Sub-Project Build
+#
+# To include HDFEOS5 as a sub-project within another project. 
+# Set HDFEOS5_EXTERNALLY_CONFIGURED to 1 in the parent project and
+# supply values for the following variables...
+#
+# HDFEOS_EXPORTED_TARGETS :
+#   Set this to the name of the targets variable which controls exports
+#   If unset (because parent project does not support/use the 
+#   INSTALL (EXPORT target...) syntax), then targets are not configured 
+#   for export during install.
+#
+# HDFEOS5_LIB_DEPENDENCIES :
+#   If the build of HDFEOS5 libs is being customized, then rules for the
+#   dependencies of the HDFEOS5 libs may be 'incomplete', add additional
+#   dependencies to this variable so that external projects pick them up
+#
+# HDFEOS5_EXTERNAL_LIB_PREFIX :
+#   If the pa5rent project needs to install hdf libraries, but avoid 
+#   name conflicts with system versions, then a prefix may be added
+#   to ensure that the correct versions configured are used.
+#
+# Consider this example, it builds its own zlib
+# library and tells HDFEOS5 to add it as a dependency - this ensures that
+# any project making use of this build of HDFEOS5 will use the correct zlib
+#
+#   # Tell HDFEOS5 that we are manually overriding certain settings
+#   SET (HDFEOS5_EXTERNALLY_CONFIGURED 1)
+#   # Avoid duplicating names of installed libraries
+#   SET (HDFEOS5_EXTERNAL_LIB_PREFIX "prj")
+#   # Targets linking to the HDFEOS5 libs need to know their names
+#   # if they are changed in the sub project, they should be here too
+#   SET (HDFEOS5_LIB_NAME "prjHDFEOS5")
+#   SET (HDFEOS5_MF_LIB_NAME "prjHDFEOS5_mf")
+#   SET (HDFEOS5_LIBRARY "${HDFEOS5_LIB_NAME};${HDFEOS5_MF_LIB_NAME}")
+#   # Export configuration to this export variable
+#   SET (HDFEOS_EXPORTED_TARGETS "project-targets")
+#
+#   # Setup all necessary overrides for zlib so that HDFEOS5 uses our
+#   # internally compiled zlib rather than any other version
+#   IF (HDF_ENABLE_Z_LIB_SUPPORT)
+#    # We must tell the main HDFEOS library that it depends on our zlib 
+#     SET (HDFEOS5_LIB_DEPENDENCIES prjzlib)    
+#     # Override the zlib header file
+#     IF (PRJ_USE_SYSTEM_ZLIB)
+#       SET (HEOS_ZLIB_HEADER "zlib.h")
+#     ELSE (PRJ_USE_SYSTEM_ZLIB)
+#      SET (HEOS_ZLIB_HEADER "prj_zlib.h")
+#       # Set vars that FindZlib would have set if used in sub project
+#       SET (ZLIB_INCLUDE_DIRS "${PRJ_ZLIB_INCLUDE_DIRS}")
+#       SET (ZLIB_LIBRARIES prjzlib)
+#     ENDIF (PRJ_USE_SYSTEM_ZLIB)
+#  ENDIF (HDF_ENABLE_Z_LIB_SUPPORT)
+#   
+#   # Add the sub project
+#   ADD_SUBDIRECTORY (Utilities/HDFEOS-1.2)
+#   # Add the HDFEOS dirs to our include path
+#   SET (HDFEOS5_INCLUDE_DIR 
+#       ${PROJECT_SOURCE_DIR}/Utilities/HDFEOS-1.2/src
+#       ${PROJECT_BINARY_DIR}/Utilities/HDFEOS-1.2
+#   )
+#
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Allow Visual Studio solution directories
+#-----------------------------------------------------------------------------
+# Provide a way for Visual Studio Express users to turn OFF the new FOLDER
+# organization feature. Default to ON for non-Express users. Express users must
+# explicitly turn off this option to build HDFEOS in the Express IDE...
+#
+OPTION (HDFEOS5_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON)
+MARK_AS_ADVANCED (HDFEOS5_USE_FOLDERS)
+IF (HDFEOS5_USE_FOLDERS)
+  SET_PROPERTY (GLOBAL PROPERTY USE_FOLDERS ON)
+ENDIF (HDFEOS5_USE_FOLDERS)
+OPTION (HDFEOS5_NO_PACKAGES "CPACK - Disable packaging" OFF)
+MARK_AS_ADVANCED (HDFEOS5_NO_PACKAGES)
+
+#-----------------------------------------------------------------------------
+# Set the core names of all the libraries
+#-----------------------------------------------------------------------------
+SET (HDFEOS_GCTP_SRC_LIB_CORENAME     "Gctp")
+SET (HDFEOS_SRC_LIB_CORENAME          "he5_hdfeos")
+
+#-----------------------------------------------------------------------------
+# Set the true names of all the libraries if customized by external project
+#-----------------------------------------------------------------------------
+SET (HDFEOS_GCTP_SRC_LIB_NAME     "${HDFEOS5_EXTERNAL_LIB_PREFIX}${HDFEOS_GCTP_SRC_LIB_CORENAME}")
+SET (HDFEOS_SRC_LIB_NAME          "${HDFEOS5_EXTERNAL_LIB_PREFIX}${HDFEOS_SRC_LIB_CORENAME}")
+
+#-----------------------------------------------------------------------------
+# Set the target names of all the libraries
+#-----------------------------------------------------------------------------
+SET (HDFEOS_GCTP_SRC_LIB_TARGET     ${HDFEOS_GCTP_SRC_LIB_NAME})
+SET (HDFEOS_SRC_LIB_TARGET          ${HDFEOS_SRC_LIB_NAME})
+
+#-----------------------------------------------------------------------------
+# Define some CMake variables for use later in the project
+#-----------------------------------------------------------------------------
+SET (EOS_RESOURCES_DIR          ${HDFEOS5_SOURCE_DIR}/config/cmake)
+SET (HDFEOS_GCTP_SRC_DIR        ${HDFEOS5_SOURCE_DIR}/gctp/src)
+SET (HDFEOS_GCTP_INC_DIR        ${HDFEOS5_SOURCE_DIR}/gctp/include)
+SET (HDFEOS_SRC_DIR             ${HDFEOS5_SOURCE_DIR}/src)
+SET (HDFEOS_INC_DIR             ${HDFEOS5_SOURCE_DIR}/include)
+SET (HDFEOS_SAMPLES_SRC_DIR     ${HDFEOS5_SOURCE_DIR}/samples)
+
+IF (NOT HDFEOS_INSTALL_BIN_DIR)
+  SET (HDFEOS_INSTALL_BIN_DIR bin)
+ENDIF (NOT HDFEOS_INSTALL_BIN_DIR)
+IF (NOT HDFEOS_INSTALL_LIB_DIR)
+  SET (HDFEOS_INSTALL_LIB_DIR lib)
+ENDIF (NOT HDFEOS_INSTALL_LIB_DIR)
+IF (NOT HDFEOS_INSTALL_INCLUDE_DIR)
+  SET (HDFEOS_INSTALL_INCLUDE_DIR include)
+ENDIF (NOT HDFEOS_INSTALL_INCLUDE_DIR)
+IF (NOT HDFEOS_INSTALL_DATA_DIR)
+  IF (NOT WIN32)
+    SET (HDFEOS_INSTALL_DATA_DIR share)
+    SET (HDFEOS_INSTALL_CMAKE_DIR share/cmake)
+  ELSE (NOT WIN32)
+    SET (HDFEOS_INSTALL_DATA_DIR ".")
+    SET (HDFEOS_INSTALL_CMAKE_DIR cmake)
+  ENDIF (NOT WIN32)
+ENDIF (NOT HDFEOS_INSTALL_DATA_DIR)
+
+#-----------------------------------------------------------------------------
+# parse the full version number
+#-----------------------------------------------------------------------------
+FILE (READ ${HDFEOS_INC_DIR}/HE5_HdfEosDef.h _he5_hdfeosdef_h_contents)
+STRING (REGEX REPLACE ".*#define[ \t]+HE5_HDFEOSVERSION[ \t]+\"([0-9]*.[0-9]*)\".*"
+    "\\1" HDFEOS5_FULL_VERSION ${_he5_hdfeosdef_h_contents})
+STRING (REGEX REPLACE ".*#define[ \t]+HE5_HDFEOSVERSION[ \t]+\"([0-9]*).*$"
+    "\\1" HDFEOS5_VERS_MAJOR ${_he5_hdfeosdef_h_contents})
+STRING (REGEX REPLACE ".*#define[ \t]+HE5_HDFEOSVERSION[ \t]+\"[0-9]*.([0-9]*).*$"
+    "\\1" HDFEOS5_VERS_MINOR ${_he5_hdfeosdef_h_contents})
+STRING (REGEX REPLACE ".*#define[ \t]+HE5_HDFEOSVERSION[ \t]+\"[0-9]*.[0-9]*.([0-9]*)\".*$"
+    "\\1" HDFEOS5_VERS_RELEASE ${_he5_hdfeosdef_h_contents})
+MESSAGE (STATUS "VERSION: ${HDFEOS5_VERSION}")
+#SET (HDFEOS5_VERS_MAJOR 1)
+#SET (HDFEOS5_VERS_MINOR 0)
+#SET (HDFEOS5_VERS_RELEASE 0)
+#MESSAGE (STATUS "VERSION: ${HDFEOS5_VERSION}")
+
+#-----------------------------------------------------------------------------
+# Basic HDFEOS stuff here
+#-----------------------------------------------------------------------------
+SET (HDFEOS5_PACKAGE "hdf-eos5")
+SET (HDFEOS5_PACKAGE_NAME "hdf-eos5")
+SET (HDFEOS5_PACKAGE_VERSION "${HDFEOS5_VERS_MAJOR}.${HDFEOS5_VERS_MINOR}.${HDFEOS5_VERS_RELEASE}")
+SET (HDFEOS5_PACKAGE_VERSION_MAJOR "${HDFEOS5_VERS_MAJOR}.${HDFEOS5_VERS_MINOR}")
+SET (HDFEOS5_PACKAGE_VERSION_MINOR "${HDFEOS5_VERS_RELEASE}")
+SET (HDFEOS5_PACKAGE_STRING "${HDFEOS5_PACKAGE_NAME} ${HDFEOS5_PACKAGE_VERSION}")
+SET (HDFEOS5_PACKAGE_TARNAME "hdf-eos5")
+SET (HDFEOS5_PACKAGE_URL "http://www.hdfgroup.org")
+SET (HDFEOS5_PACKAGE_BUGREPORT "help at hdfgroup.org")
+
+#-----------------------------------------------------------------------------
+# Include some macros for reusable code
+#-----------------------------------------------------------------------------
+INCLUDE (${EOS_RESOURCES_DIR}/EOSMacros.cmake)
+INCLUDE (${EOS_RESOURCES_DIR}/HDFEOSMacros.cmake)
+INCLUDE (${EOS_RESOURCES_DIR}/HDF5Macros.cmake)
+
+#-----------------------------------------------------------------------------
+# Setup output Directories
+#-----------------------------------------------------------------------------
+IF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+  SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY
+      ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Executables."
+  )
+  SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY
+      ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Libraries"
+  )
+  SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
+      ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all static libraries."
+  )
+ELSE (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+  # if we are externally configured, but the project uses old cmake scripts
+  # this may not be set and utilities like Hdetect will fail
+  IF (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
+    SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
+  ENDIF (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
+ENDIF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+
+#-----------------------------------------------------------------------------
+# Targets built within this project are exported at Install time for use
+# by other projects using FindEOS5.
+#-----------------------------------------------------------------------------
+IF (NOT HDFEOS_EXPORTED_TARGETS)
+  SET (HDFEOS_EXPORTED_TARGETS "hdfeos5-targets")
+ENDIF (NOT HDFEOS_EXPORTED_TARGETS)
+
+#-----------------------------------------------------------------------------
+# To include a library in the list exported by the project AT BUILD TIME,
+# add it to this variable. This is NOT used by Make Install, but for projects
+# which include HDFEOS as a sub-project within their build tree
+#-----------------------------------------------------------------------------
+SET_GLOBAL_VARIABLE (HDFEOS_LIBRARIES_TO_EXPORT "")
+SET_GLOBAL_VARIABLE (HDFEOS_APPS_TO_EXPORT "")
+SET (EXTERNAL_HEADER_LIST "")
+SET (EXTERNAL_LIBRARY_LIST "")
+SET (EXTERNAL_LIBRARYDLL_LIST "")
+
+#-----------------------------------------------------------------------------
+# Run all the CMake configuration tests for our build environment
+#-----------------------------------------------------------------------------
+INCLUDE (${EOS_RESOURCES_DIR}/ConfigureChecks.cmake)
+
+#-----------------------------------------------------------------------------
+# Option to use legacy naming for windows libs/programs, default is legacy
+#-----------------------------------------------------------------------------
+IF (WIN32 AND NOT CYGWIN)
+  OPTION (HDFEOS5_LEGACY_NAMING "Use Legacy Names for Libraries and Programs" ON)
+ENDIF (WIN32 AND NOT CYGWIN)
+
+#-----------------------------------------------------------------------------
+# Option to Build Shared/Static libs, default is static
+#-----------------------------------------------------------------------------
+OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
+SET (LIB_TYPE STATIC)
+IF (BUILD_SHARED_LIBS)
+  SET (LIB_TYPE SHARED)
+  SET (HDFEOS5_BUILT_AS_DYNAMIC_LIB 1)
+  ADD_DEFINITIONS (-DHDFEOS5_BUILT_AS_DYNAMIC_LIB)
+  ADD_DEFINITIONS (-DH5_BUILT_AS_DYNAMIC_LIB)
+ELSE (BUILD_SHARED_LIBS)
+  SET (HDFEOS5_BUILT_AS_STATIC_LIB 1)
+  ADD_DEFINITIONS (-DHDFEOS5_BUILT_AS_STATIC_LIB)
+  ADD_DEFINITIONS (-DH5_BUILT_AS_STATIC_LIB)
+  IF (NOT WIN32)
+    # should this be a user setting : Everyone uses it anyway ?
+    ADD_DEFINITIONS (-DPIC)
+  ENDIF (NOT WIN32)
+ENDIF (BUILD_SHARED_LIBS)
+
+IF (NOT USE_SHARED_LIBS)
+  SET (HDFEOS5_USE_STATIC_LIBRARIES 1)
+ENDIF (NOT USE_SHARED_LIBS)
+
+ADD_DEFINITIONS (-DBIG_LONGS -DSWAP)
+ADD_DEFINITIONS (-DHAVE_CONFIG_H)
+IF (MSVC)
+  ADD_DEFINITIONS (-DVISUAL_CPLUSPLUS)
+ENDIF (MSVC)
+IF (EOS_HAVE_F2CFORTRAN_MACRO)
+  ADD_DEFINITIONS (-Df2cFortran)
+ENDIF (EOS_HAVE_F2CFORTRAN_MACRO)
+
+#-----------------------------------------------------------------------------
+# Option to use code coverage
+#-----------------------------------------------------------------------------
+OPTION (HDF_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" OFF)
+IF (HDF_ENABLE_COVERAGE)
+    SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
+    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
+    SET (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage")   
+ENDIF (HDF_ENABLE_COVERAGE)
+
+#-----------------------------------------------------------------------------
+# Include the main src and config directories
+#-----------------------------------------------------------------------------
+SET (HDFEOS_INCLUDE_DIRECTORIES
+    ${HDFEOS_GCTP_INC_DIR} 
+    ${HDFEOS_INC_DIR} 
+    ${HDFEOS5_BINARY_DIR}
+    ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+)
+INCLUDE_DIRECTORIES (${HDFEOS_INCLUDE_DIRECTORIES} )
+
+#-----------------------------------------------------------------------------
+# When building utility executables that generate other (source) files :
+# we make use of the following variables defined in the root CMakeLists.
+# Certain systems may add /Debug or /Release to output paths
+# and we need to call the executable from inside the CMake configuration
+#-----------------------------------------------------------------------------
+SET (EXE_EXT "")
+IF (WIN32)
+  SET (EXE_EXT ".exe")
+  IF (NOT CYGWIN)
+    ADD_DEFINITIONS (-DBIND_TO_CURRENT_VCLIBS_VERSION=1)
+    ADD_DEFINITIONS (-D_CRT_SECURE_NO_WARNINGS)
+    ADD_DEFINITIONS (-D_CONSOLE)
+  ENDIF (NOT CYGWIN)
+ENDIF (WIN32)
+
+IF (MSVC)
+  SET (CMAKE_MFC_FLAG 0)
+ENDIF (MSVC)
+
+SET (MAKE_SYSTEM)
+IF (CMAKE_BUILD_TOOL MATCHES "make")
+  SET (MAKE_SYSTEM 1)
+ENDIF (CMAKE_BUILD_TOOL MATCHES "make")
+
+SET (CFG_INIT "/${CMAKE_CFG_INTDIR}")
+IF (MAKE_SYSTEM)
+  SET (CFG_INIT "")
+ENDIF (MAKE_SYSTEM)
+
+#-----------------------------------------------------------------------------
+# Add some definitions for Debug Builds
+#-----------------------------------------------------------------------------
+IF (CMAKE_BUILD_TYPE MATCHES Debug)
+  #-- NMake Makefiles will overwhelm the console with warnings if -Wall is used.
+  IF (NOT WIN32)
+    ADD_DEFINITIONS (-Wall)
+  ENDIF (NOT WIN32)
+ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
+
+#-----------------------------------------------------------------------------
+# Compiler specific flags : Shouldn't there be compiler tests for these
+#-----------------------------------------------------------------------------
+IF (CMAKE_COMPILER_IS_GNUCC)
+  IF (CMAKE_BUILD_TYPE MATCHES Debug)
+    SET (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99 -finline-functions -fno-common")
+  ELSE (CMAKE_BUILD_TYPE MATCHES Debug)
+    SET (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99 -fomit-frame-pointer -finline-functions -fno-common")
+  ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
+ENDIF (CMAKE_COMPILER_IS_GNUCC)
+IF (CMAKE_COMPILER_IS_GNUCXX)
+  IF (CMAKE_BUILD_TYPE MATCHES Debug)
+    SET (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -finline-functions -fno-common")
+  ELSE (CMAKE_BUILD_TYPE MATCHES Debug)
+    SET (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -fomit-frame-pointer -finline-functions -fno-common")
+  ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
+ENDIF (CMAKE_COMPILER_IS_GNUCXX)
+
+#-----------------------------------------------------------------------------
+# Option to use 1.6.x API
+#-----------------------------------------------------------------------------
+OPTION (USE_HDF5_16_API_DEFAULT "Use the HDF5 1.6.x API by default" ON)
+SET (H5_USE_16_API_DEFAULT 0)
+IF (USE_HDF5_16_API_DEFAULT)
+  SET (H5_USE_16_API_DEFAULT 1)
+ENDIF (USE_HDF5_16_API_DEFAULT)
+
+#-----------------------------------------------------------------------------
+# Option to allow the user to disable compiler warnings
+#-----------------------------------------------------------------------------
+OPTION (HDFEOS5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF)
+IF (HDFEOS5_DISABLE_COMPILER_WARNINGS)
+  # MSVC uses /w to suppress warnings.  It also complains if another
+  # warning level is given, so remove it.
+  IF (MSVC)
+    SET (HDFEOS5_WARNINGS_BLOCKED 1)
+    STRING (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+    SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w")
+    STRING (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w")
+  ENDIF (MSVC)
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_DEFINITIONS (-D_CRT_SECURE_NO_WARNINGS)
+  ENDIF (WIN32 AND NOT CYGWIN)
+  # Borland uses -w- to suppress warnings.
+  IF (BORLAND)
+    SET (HDFEOS5_WARNINGS_BLOCKED 1)
+    SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-")
+  ENDIF (BORLAND)
+
+  # Most compilers use -w to suppress warnings.
+  IF (NOT HDFEOS5_WARNINGS_BLOCKED)
+    SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
+    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
+  ENDIF (NOT HDFEOS5_WARNINGS_BLOCKED)
+ENDIF (HDFEOS5_DISABLE_COMPILER_WARNINGS)
+
+#-----------------------------------------------------------------------------
+# This is in here to help some of the GCC based IDES like Eclipse
+# and code blocks parse the compiler errors and warnings better.
+#-----------------------------------------------------------------------------
+IF (CMAKE_COMPILER_IS_GNUCC)
+  SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
+ENDIF (CMAKE_COMPILER_IS_GNUCC)
+IF (CMAKE_COMPILER_IS_GNUCXX)
+  SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0")
+ENDIF (CMAKE_COMPILER_IS_GNUCXX)
+
+#-----------------------------------------------------------------------------
+# Option to Enable MPI Parallel
+#-----------------------------------------------------------------------------
+SET (CMAKE_MODULE_PATH ${EOS_RESOURCES_DIR} ${CMAKE_MODULE_PATH})
+OPTION (HDFEOS5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF)
+IF (HDFEOS5_ENABLE_PARALLEL)
+  INCLUDE (FindMPI)
+  INCLUDE_DIRECTORIES (${MPI_C_INCLUDE_PATH})
+  IF (MPI_C_FOUND)
+    SET (HDFEOS5_HAVE_PARALLEL 1)
+    # MPI checks, only do these if MPI_C_FOUND is true, otherwise they always fail
+    # and once set, they are cached as false and not regenerated
+    SET (CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}" )
+    CHECK_FUNCTION_EXISTS (MPI_File_get_size HDFEOS5_HAVE_MPI_GET_SIZE) 
+    # Used by Fortran + MPI
+    CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_PATH}/mpi.h"  HDFEOS5_HAVE_MPI_MULTI_LANG_Comm)
+    CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_PATH}/mpi.h"  HDFEOS5_HAVE_MPI_MULTI_LANG_Info)
+  ENDIF (MPI_C_FOUND)
+ENDIF (HDFEOS5_ENABLE_PARALLEL)
+
+# Parallel IO usage requires MPI to be Linked and Included
+IF (HDFEOS5_HAVE_PARALLEL)
+  SET (LINK_LIBS ${LINK_LIBS} ${MPI_C_LIBRARIES})
+  IF (MPI_C_LINK_FLAGS)
+    SET (CMAKE_EXE_LINKER_FLAGS ${MPI_C_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS})
+  ENDIF (MPI_C_LINK_FLAGS)
+ENDIF (HDFEOS5_HAVE_PARALLEL)
+
+INCLUDE (ExternalProject)
+OPTION (HDFEOS5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building" "NO")
+OPTION (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 0)
+OPTION (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 0)
+OPTION (HDF5_USE_EXTERNAL "Use External Library Building for HDF5" 0)
+IF (HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+  SET (ZLIB_USE_EXTERNAL 1)
+  SET (SZIP_USE_EXTERNAL 1)
+  SET (HDF5_USE_EXTERNAL 1)
+  IF (HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
+    SET (ZLIB_URL ${ZLIB_SVN_URL})
+    SET (SZIP_URL ${SZIP_SVN_URL})
+    SET (HDF5_URL ${HDF5_SVN_URL})
+  ELSEIF (HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+    IF (NOT TGZ_PATH)
+      SET (TGZ_PATH ${HDFEOS5_SOURCE_DIR})
+    ENDIF (NOT TGZ_PATH)
+    SET (ZLIB_URL ${TGZ_PATH}/${ZLIB_TGZ_NAME})
+    SET (SZIP_URL ${TGZ_PATH}/${SZIP_TGZ_NAME})
+    SET (HDF5_URL ${TGZ_PATH}/${HDF5_TGZ_NAME})
+  ENDIF (HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
+ENDIF (HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+
+#-----------------------------------------------------------------------------
+# Option for ZLib support
+#-----------------------------------------------------------------------------
+OPTION (HDFEOS5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" ON)
+
+#-----------------------------------------------------------------------------
+# Option for SzLib support
+#-----------------------------------------------------------------------------
+OPTION (HDFEOS5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF)
+IF (HDFEOS5_ENABLE_SZIP_SUPPORT)
+  OPTION (HDFEOS5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF)
+ENDIF (HDFEOS5_ENABLE_SZIP_SUPPORT)
+
+#-----------------------------------------------------------------------------
+# HDF5 support
+#-----------------------------------------------------------------------------
+IF (NOT BUILD_SHARED_LIBS)
+  SET (HDF5_USE_STATIC_LIBRARIES 1)
+ENDIF (NOT BUILD_SHARED_LIBS)
+IF (NOT HEOS_HDF5_HEADER)
+  IF (NOT HDF5_USE_EXTERNAL)
+    FIND_PACKAGE (HDF5 NAMES ${HDF5_PACKAGE_NAME}${HDFEOS5_PACKAGE_EXT})
+    IF (NOT HDF5_FOUND)
+      FIND_PACKAGE (HDF5) # Legacy find
+    ENDIF (NOT HDF5_FOUND)
+  ENDIF (NOT HDF5_USE_EXTERNAL)
+  IF (HDF5_FOUND)
+    MESSAGE (STATUS "HDF5 found: INC=${HDF5_INCLUDE_DIR} TOOLS=${HDF5_TOOLS_DIR}")
+    IF ((NOT USE_SHARED_LIBS AND HDF5_BUILD_SHARED_LIBS) OR (USE_SHARED_LIBS AND NOT HDF5_BUILD_SHARED_LIBS))
+      MESSAGE (STATUS "HDF5 build type does match requested type")
+    ENDIF ((NOT USE_SHARED_LIBS AND HDF5_BUILD_SHARED_LIBS) OR (USE_SHARED_LIBS AND NOT HDF5_BUILD_SHARED_LIBS))
+    IF (HDF5_BUILD_SHARED_LIBS)
+      ADD_DEFINITIONS (-DH5_BUILT_AS_DYNAMIC_LIB)
+    ELSE (HDF5_BUILD_SHARED_LIBS)
+      ADD_DEFINITIONS (-DH5_BUILT_AS_STATIC_LIB)
+    ENDIF (HDF5_BUILD_SHARED_LIBS)
+    SET (HEOS_HAVE_H5PUBCONF_H 1)
+    SET (HEOS_HAVE_HDF5 1)
+    SET (HEOS_HDF5_HEADER "h5pubconf.h")
+    SET (HDF5_INCLUDE_DIR_GEN ${HDF5_INCLUDE_DIR})
+    SET (HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
+  ELSE (HDF5_FOUND)
+    IF (HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+      EXTERNAL_HDF5_LIBRARY (${HDFEOS5_ALLOW_EXTERNAL_SUPPORT} ${LIB_TYPE})
+      SET (HEOS_HAVE_H5PUBCONF_H 1)
+      SET (HEOS_HAVE_HDF5 1)
+      SET (HEOS_HDF5_HEADER "h5pubconf.h")
+      MESSAGE (STATUS "HDF5 is built")
+      IF (BUILD_SHARED_LIBS)
+        ADD_DEFINITIONS (-DH5_BUILT_AS_DYNAMIC_LIB)
+      ELSE (BUILD_SHARED_LIBS)
+        ADD_DEFINITIONS (-DH5_BUILT_AS_STATIC_LIB)
+      ENDIF (BUILD_SHARED_LIBS)
+    ELSE (HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+      MESSAGE (FATAL_ERROR " HDF5 is Required for  HDFEOS")
+    ENDIF (HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+  ENDIF (HDF5_FOUND)
+ELSE (NOT HEOS_HDF5_HEADER)
+  # This project is being called from within another and HDF5 is already configured
+  SET (HEOS_HAVE_H5PUBCONF_H 1)
+  SET (HEOS_HAVE_HDF5 1)
+ENDIF (NOT HEOS_HDF5_HEADER)
+IF (NOT TARGET "h5diff")
+  ADD_EXECUTABLE (h5diff IMPORTED)
+  IF (USE_SHARED_LIBS AND WIN32)
+    SET_PROPERTY (TARGET h5diff PROPERTY IMPORTED_LOCATION "${HDF5_TOOLS_DIR}/h5diffdll")
+  ELSE (USE_SHARED_LIBS AND WIN32)
+    SET_PROPERTY (TARGET h5diff PROPERTY IMPORTED_LOCATION "${HDF5_TOOLS_DIR}/h5diff")
+  ENDIF (USE_SHARED_LIBS AND WIN32)
+  SET (HDF5_DIFF_EXECUTABLE $<TARGET_FILE:h5diff>)
+ENDIF (NOT TARGET "h5diff")
+SET (LINK_LIBS ${LINK_LIBS} ${HDF5_LIBRARIES})
+INCLUDE_DIRECTORIES (${HDF5_INCLUDE_DIRS})
+
+#-----------------------------------------------------------------------------
+# Option for external libraries
+#-----------------------------------------------------------------------------
+OPTION (HDFEOS5_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF)
+IF (HDFEOS5_PACKAGE_EXTLIBS)
+  IF (HDF5_FOUND)
+    PACKAGE_HDF5_LIBRARY (${HDFEOS5_ALLOW_EXTERNAL_SUPPORT})
+  ENDIF (HDF5_FOUND)
+ENDIF (HDFEOS5_PACKAGE_EXTLIBS)
+
+#-----------------------------------------------------------------------------
+# Build utility to copy and strip X lines of file
+#-----------------------------------------------------------------------------
+IF (BUILD_TESTING)
+  SET (XLATE_UTILITY "xlatefile")
+  ADD_EXECUTABLE(${XLATE_UTILITY} ${EOS_RESOURCES_DIR}/xlatefile.c)
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Dashboard and Testing Settings
+#-----------------------------------------------------------------------------
+OPTION (BUILD_TESTING "Build HDFEOS Unit Testing" OFF)
+IF (BUILD_TESTING)
+  SET (DART_TESTING_TIMEOUT 1200
+      CACHE INTEGER
+      "Timeout in seconds for each test (default 1200=20minutes)"
+  )
+  ENABLE_TESTING ()
+  INCLUDE (CTest)
+  INCLUDE (${HDFEOS5_SOURCE_DIR}/CTestConfig.cmake)
+  CONFIGURE_FILE (${EOS_RESOURCES_DIR}/CTestCustom.cmake ${HDFEOS5_BINARY_DIR}/CTestCustom.ctest @ONLY)
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Add the HDFEOS Library Target to the build
+#-----------------------------------------------------------------------------
+ADD_SUBDIRECTORY (${HDFEOS5_SOURCE_DIR}/gctp ${PROJECT_BINARY_DIR}/gctp)
+ADD_SUBDIRECTORY (${HDFEOS5_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src)
+
+IF (HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+  IF (HDF5_FOUND AND HDF5_USE_EXTERNAL)
+    ADD_DEPENDENCIES (${HDFEOS_SRC_LIB_TARGET} HDF5)
+  ENDIF (HDF5_FOUND AND HDF5_USE_EXTERNAL)
+ENDIF (HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+
+#-----------------------------------------------------------------------------
+# Option to build Fortran bindings/tests/samples
+#-----------------------------------------------------------------------------
+OPTION (HDFEOS_BUILD_FORTRAN "Build FORTRAN support" ON)
+IF (HDFEOS_BUILD_FORTRAN AND HDF5_BUILD_FORTRAN)
+  INCLUDE (${EOS_RESOURCES_DIR}/HDF5UseFortran.cmake)
+ENDIF (HDFEOS_BUILD_FORTRAN AND HDF5_BUILD_FORTRAN)
+
+#-----------------------------------------------------------------------------
+# Add the samples tests to the build
+#-----------------------------------------------------------------------------
+OPTION (HDFEOS5_BUILD_SAMPLES  "Build HDFEOS5 Testdrivers" OFF)
+IF (HDFEOS5_BUILD_SAMPLES)
+  IF (BUILD_TESTING)
+    IF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+      ADD_SUBDIRECTORY(${HDFEOS5_SOURCE_DIR}/samples ${PROJECT_BINARY_DIR}/samples)
+    ENDIF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+  ENDIF (BUILD_TESTING)
+ENDIF (HDFEOS5_BUILD_SAMPLES)
+
+#-----------------------------------------------------------------------------
+# Option to build HDFEOS Testdrivers
+#-----------------------------------------------------------------------------
+OPTION (HDFEOS5_BUILD_TESTDRIVERS  "Build HDFEOS5 Testdrivers" OFF)
+IF (HDFEOS5_BUILD_TESTDRIVERS)
+  IF (BUILD_TESTING)
+    IF (EXISTS "${HDFEOS5_SOURCE_DIR}/testdrivers" AND IS_DIRECTORY "${HDFEOS5_SOURCE_DIR}/testdrivers")
+      ADD_SUBDIRECTORY (${HDFEOS5_SOURCE_DIR}/testdrivers ${PROJECT_BINARY_DIR}/testdrivers)
+    ENDIF (EXISTS "${HDFEOS5_SOURCE_DIR}/testdrivers" AND IS_DIRECTORY "${HDFEOS5_SOURCE_DIR}/testdrivers")
+  ENDIF (BUILD_TESTING)
+ENDIF (HDFEOS5_BUILD_TESTDRIVERS)
+
+#-----------------------------------------------------------------------------
+# Generate the HE5_config.h file containing user settings needed by compilation
+#-----------------------------------------------------------------------------
+CONFIGURE_FILE (${EOS_RESOURCES_DIR}/HE5_config.h.in      ${PROJECT_BINARY_DIR}/HE5_config.h @ONLY)
+
+#-----------------------------------------------------------------------------
+# Add Target(s) to CMake Install for import into other projects
+#-----------------------------------------------------------------------------
+IF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+  INSTALL (
+      EXPORT ${HDFEOS_EXPORTED_TARGETS}
+      DESTINATION ${HDFEOS_INSTALL_CMAKE_DIR}/${HDFEOS5_PACKAGE}
+      FILE ${HDFEOS5_PACKAGE}${HDFEOS5_PACKAGE_EXT}-targets.cmake
+      COMPONENT configinstall
+  )
+ENDIF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+
+#-----------------------------------------------------------------------------
+# Export all exported targets to the build tree for use by parent project
+#-----------------------------------------------------------------------------
+IF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+  EXPORT (
+      TARGETS ${HDFEOS_LIBRARIES_TO_EXPORT} ${HDFEOS5_LIB_DEPENDENCIES}
+      FILE ${HDFEOS5_PACKAGE}${HDFEOS5_PACKAGE_EXT}-targets.cmake
+  )
+ENDIF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+
+#-----------------------------------------------------------------------------
+# Configure the hdfeos-config.cmake file for the build directory
+#-----------------------------------------------------------------------------
+SET (HDFEOS5_INCLUDES_BUILD_TIME
+    ${HDFEOS_INC_DIR}
+    ${HDFEOS5_BINARY_DIR}
+)
+SET (HDFEOS5_VERSION_STRING @HDFEOS5_PACKAGE_VERSION@)
+SET (HDFEOS5_VERSION_MAJOR  @HDFEOS5_PACKAGE_VERSION_MAJOR@)
+SET (HDFEOS5_VERSION_MINOR  @HDFEOS5_PACKAGE_VERSION_MINOR@)
+
+CONFIGURE_FILE (
+    ${EOS_RESOURCES_DIR}/hdfeos5-config.cmake.build.in 
+    ${HDFEOS5_BINARY_DIR}/${HDFEOS5_PACKAGE}${HDFEOS5_PACKAGE_EXT}-config.cmake @ONLY
+)
+
+#-----------------------------------------------------------------------------
+# Configure the FindHDFEOS.cmake file for the install directory
+#-----------------------------------------------------------------------------
+IF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+  CONFIGURE_FILE (
+      ${EOS_RESOURCES_DIR}/FindHDFEOS5.cmake.in 
+      ${HDFEOS5_BINARY_DIR}/CMakeFiles/FindHDFEOS5${HDFEOS5_PACKAGE_EXT}.cmake @ONLY
+  )
+  INSTALL (
+      FILES ${HDFEOS5_BINARY_DIR}/CMakeFiles/FindHDFEOS5${HDFEOS5_PACKAGE_EXT}.cmake
+      DESTINATION ${HDFEOS_INSTALL_CMAKE_DIR}/${HDFEOS5_PACKAGE}
+      COMPONENT configinstall
+  )
+ENDIF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+
+#-----------------------------------------------------------------------------
+# Configure the hdfeos-config.cmake file for the install directory
+#-----------------------------------------------------------------------------
+IF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+  CONFIGURE_FILE (
+      ${EOS_RESOURCES_DIR}/hdfeos5-config.cmake.install.in
+      ${HDFEOS5_BINARY_DIR}/CMakeFiles/${HDFEOS5_PACKAGE}${HDFEOS5_PACKAGE_EXT}-config.cmake @ONLY
+  )
+  INSTALL (
+      FILES ${HDFEOS5_BINARY_DIR}/CMakeFiles/${HDFEOS5_PACKAGE}${HDFEOS5_PACKAGE_EXT}-config.cmake
+      DESTINATION ${HDFEOS_INSTALL_CMAKE_DIR}/${HDFEOS5_PACKAGE}
+      COMPONENT configinstall
+  )
+ENDIF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+
+#-----------------------------------------------------------------------------
+# Configure the hdfeos-config-version .cmake file for the install directory
+#-----------------------------------------------------------------------------
+IF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+  CONFIGURE_FILE (
+      ${EOS_RESOURCES_DIR}/hdfeos5-config-version.cmake.in
+      ${HDFEOS5_BINARY_DIR}/CMakeFiles/${HDFEOS5_PACKAGE}${HDFEOS5_PACKAGE_EXT}-config-version.cmake @ONLY
+  )
+  INSTALL (
+      FILES ${HDFEOS5_BINARY_DIR}/CMakeFiles/${HDFEOS5_PACKAGE}${HDFEOS5_PACKAGE_EXT}-config-version.cmake
+      DESTINATION ${HDFEOS_INSTALL_CMAKE_DIR}/cmake/${HDFEOS5_PACKAGE}
+      COMPONENT configinstall
+  )
+ENDIF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+
+#-----------------------------------------------------------------------------
+# Add Document File(s) to CMake Install
+#-----------------------------------------------------------------------------
+IF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+  IF (EXISTS "${HDFEOS5_SOURCE_DIR}/doc" AND IS_DIRECTORY "${HDFEOS5_SOURCE_DIR}/doc")
+    SET (doc_files
+        ${HDFEOS5_SOURCE_DIR}/doc/README
+    )
+    INSTALL (
+        FILES ${doc_files}
+        DESTINATION ${HDFEOS_INSTALL_DATA_DIR}/release_docs
+        COMPONENT hdfeosdocuments
+    )
+  ENDIF (EXISTS "${HDFEOS5_SOURCE_DIR}/doc" AND IS_DIRECTORY "${HDFEOS5_SOURCE_DIR}/doc")
+ENDIF (NOT HDFEOS5_EXTERNALLY_CONFIGURED)
+
+#-----------------------------------------------------------------------------
+# Set the cpack variables
+#-----------------------------------------------------------------------------
+SET (CPACK_PACKAGE_VENDOR "HDF_Group")
+SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "HDFEOS5 Installation")
+SET (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/doc/README")
+SET (CPACK_PACKAGE_NAME "${HDFEOS5_PACKAGE_NAME}")
+SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${HDFEOS5_PACKAGE_NAME}")
+SET (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${HDFEOS5_PACKAGE_NAME}-${HDFEOS5_PACKAGE_VERSION}-${LIB_TYPE}")
+SET (CPACK_PACKAGE_VERSION "${HDFEOS5_PACKAGE_VERSION}")
+SET (CPACK_PACKAGE_VERSION_MAJOR "${HDFEOS5_PACKAGE_VERSION_MAJOR}")
+SET (CPACK_PACKAGE_VERSION_MINOR "${HDFEOS5_PACKAGE_VERSION_MINOR}")
+SET (CPACK_PACKAGE_VERSION_PATCH "")
+SET (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/doc/README")
+SET (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/doc/README")
+SET (CPACK_PACKAGE_RELOCATABLE TRUE)
+
+IF (WIN32)
+  SET (CPACK_MONOLITHIC_INSTALL ON)
+  SET (CPACK_NSIS_CONTACT "${HDFEOS5_PACKAGE_BUGREPORT}")
+  SET (CPACK_NSIS_MODIFY_PATH ON)
+  SET (CPACK_NSIS_PACKAGE_NAME "HDFEOS ${HDFEOS5_PACKAGE_VERSION}")
+ELSE (WIN32)
+  SET (CPACK_PACKAGING_INSTALL_PREFIX "/usr")
+  SET (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON)
+
+  SET (CPACK_DEBIAN_PACKAGE_SECTION "Libraries")
+  SET (CPACK_DEBIAN_PACKAGE_MAINTAINER "${HDFEOS5_PACKAGE_BUGREPORT}")
+    
+  SET (CPACK_RPM_COMPONENT_INSTALL ON)
+  SET (CPACK_RPM_PACKAGE_GROUP "Development/Tools")
+  SET (CPACK_RPM_PACKAGE_LICENSE "BSD-style")
+  SET (CPACK_RPM_PACKAGE_URL "${HDFEOS5_PACKAGE_URL}")
+  SET (CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "/sbin/ldconfig")
+  SET (CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "/sbin/ldconfig")
+  SET (CPACK_RPM_POST_INSTALL_SCRIPT_FILE "/sbin/ldconfig")
+  SET (CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "/sbin/ldconfig")
+  SET (CPACK_STRIP_FILES "${HDFEOS_LIBRARIES_TO_EXPORT};${HDFEOS_APPS_TO_EXPORT};${EXTERNAL_LIBRARY_LIST}")
+ENDIF (WIN32)
+
+INCLUDE(InstallRequiredSystemLibraries)
+
+  SET (CPACK_INSTALL_CMAKE_PROJECTS "${HDFEOS5_BINARY_DIR};HDFEOS;ALL;/")
+  
+  IF (HDFEOS5_PACKAGE_EXTLIBS)
+    IF (HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+      IF (HDF5_FOUND AND HDF5_USE_EXTERNAL)
+        SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${HDF5_INCLUDE_DIR_GEN};HDF5;libraries;/")
+        SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${HDF5_INCLUDE_DIR_GEN};HDF5;headers;/")
+        SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${HDF5_INCLUDE_DIR_GEN};HDF5;configinstall;/")
+        IF (ZLIB_USE_EXTERNAL)
+          SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};zlib;libraries;/")
+          SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};zlib;headers;/")
+          SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};zlib;configinstall;/")
+        ENDIF (ZLIB_USE_EXTERNAL)
+        IF (SZIP_USE_EXTERNAL)
+          SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};szip;libraries;/")
+          SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};szip;headers;/")
+          SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};szip;configinstall;/")
+        ENDIF (SZIP_USE_EXTERNAL)
+      ENDIF (HDF5_FOUND AND HDF5_USE_EXTERNAL)
+    ENDIF (HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDFEOS5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+  ENDIF (HDFEOS5_PACKAGE_EXTLIBS)
+
+INCLUDE (CPack)
+
+#-----------------------------------------------------------------------------
+# Now list the cpack commands
+#-----------------------------------------------------------------------------
+CPACK_ADD_COMPONENT (applications 
+    DISPLAY_NAME "HDFEOS5 Applications" 
+    DEPENDS libraries
+    GROUP Applications
+)
+CPACK_ADD_COMPONENT (libraries 
+    DISPLAY_NAME "HDFEOS5 Libraries"
+    GROUP Runtime
+)
+CPACK_ADD_COMPONENT (headers 
+    DISPLAY_NAME "HDFEOS5 Headers" 
+    DEPENDS libraries
+    GROUP Development
+)
+CPACK_ADD_COMPONENT (hdfeosdocuments 
+    DISPLAY_NAME "HDFEOS5 Documents"
+    GROUP Documents
+)
+CPACK_ADD_COMPONENT (configinstall 
+    DISPLAY_NAME "HDFEOS5 CMake files" 
+    DEPENDS libraries
+    GROUP Development
+)
+
+IF (HDFEOS5_BUILD_TESTDRIVERS)
+  CPACK_ADD_COMPONENT (toolsapplications 
+      DISPLAY_NAME "HDFEOS5 TESTDRIVERS Applications" 
+      DEPENDS toolslibraries
+      GROUP Applications
+  )
+  CPACK_ADD_COMPONENT (toolslibraries 
+      DISPLAY_NAME "HDFEOS5 TESTDRIVERS Libraries" 
+      DEPENDS libraries
+      GROUP Runtime
+  )
+  CPACK_ADD_COMPONENT (toolsheaders 
+      DISPLAY_NAME "HDFEOS5 TESTDRIVERS Headers" 
+      DEPENDS toolslibraries
+      GROUP Development
+  )
+ENDIF (HDFEOS5_BUILD_TESTDRIVERS)
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
new file mode 100644
index 0000000..729d1ba
--- /dev/null
+++ b/CTestConfig.cmake
@@ -0,0 +1,26 @@
+## This file should be placed in the root directory of your project.
+## Then modify the CMakeLists.txt file in the root directory of your
+## project to incorporate the testing dashboard.
+## # The following are required to uses Dart and the Cdash dashboard
+##   ENABLE_TESTING()
+##   INCLUDE(CTest)
+SET (CTEST_PROJECT_NAME "HDFEOS")
+SET (CTEST_NIGHTLY_START_TIME "18:00:00 CST")
+
+SET (CTEST_DROP_METHOD "http")
+SET (CTEST_DROP_SITE "nei.hdfgroup.uiuc.edu")
+SET (CTEST_DROP_LOCATION "/cdash/submit.php?project=HDFEOS")
+SET (CTEST_DROP_SITE_CDASH TRUE)
+
+SET (UPDATE_TYPE svn)
+
+SET (VALGRIND_COMMAND "/usr/bin/valgrind")
+SET (VALGRIND_COMMAND_OPTIONS "-v --tool=memcheck --leak-check=full --track-fds=yes --num-callers=50 --show-reachable=yes --track-origins=yes --malloc-fill=0xff --free-fill=0xfe")
+
+SET (CTEST_TEST_TIMEOUT 3600 CACHE STRING 
+    "Maximum time allowed before CTest will kill the test.") 
+SET (DART_TESTING_TIMEOUT 3600 CACHE STRING 
+    "Maximum time allowed before CTest will kill the test." FORCE)
+
+SET(CTEST_SUBMIT_RETRY_DELAY 20 CACHE STRING
+    "How long to wait between timed-out CTest submissions.")
diff --git a/Makefile b/Makefile
new file mode 100755
index 0000000..494a978
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,436 @@
+#----------------------------------------------------------------------------
+# file:         makefile for HDF-EOS5 (for internal ECS usage only)
+#
+# environment:  requires environment established by the ECS .buildrc file
+# 
+# environment variables dependencies:
+#   MAKECMD  make command to be run on make files
+#   ARCH     architecture (i.e. hardware/os type)
+#
+#
+# author:  Guru Tej S. Khalsa / Space Applications Corp.
+#          Abe Taaheri / Emergent Information Technologies, Inc.
+#
+# history:
+#       10-Nov-1997 GTSK Initital version
+#       11-Apr-2001 AT   modified for HDFEOS5 and HDF5
+#       19-Jul-2001 DaW  Modified because it broke the Build
+#       05-Apr-2004 AT   Modified for DAAC Linux Delivery
+#       02-Feb-2013 AT   Modified for Toolkit Linux64 build in clearcase
+#
+#
+# notes:
+#       1) This file is only for use by ECS Configuration Management (CM)
+#	   personnel and software.  This file should not be distributed
+#	   as part of the standard HDF-EOS5 delivery.
+#----------------------------------------------------------------------------
+
+# define shell to be used (use ksh so we can use the "." command)
+
+SHELL=/bin/ksh
+
+# define MAKE to be equivalant to $(MAKECMD)
+
+MAKE=$(MAKECMD)
+
+# define the location of the HDF-EOS5 STAGE area
+
+HE_STAGE=/ecs/formal/STAGE/hdfeos5
+
+# define the location of the standard HDF-EOS5 development area
+
+HE_HOME=/ecs/hdfeos5
+
+# define HDF5 base directory
+
+#HE_ENV=$(ARCH)
+
+# define the location of tar files
+
+TAR_HOME=$(HE_HOME)/install
+
+HDF_BASE=/ecs/cots/hdf
+
+# define current HDF version
+
+CURRENT_HDF4=HDF4.2.6
+CURRENT_HDF=hdf5-1.8.8
+CURRENT_SZIP=szip-2.1
+
+# define SDP Toolkit home directory
+
+TK_HOME=/ecs/formal/TOOLKIT
+
+# name of tar files for delivery
+HDFEOS5_SOURCE_TAR=HDF-EOS5.1.15.tar
+HDFEOS5_TESTDRIVERS_TAR=HDF-EOS5.1.15_TESTDRIVERS.tar
+
+# define the default compiler optimization level
+OPT_LVL=-g
+
+# define default target
+
+default:
+	@echo "This file is for use by ECS Configuration Management processes only."
+
+# define a target to build BOTH variations (or "flavors") of HDF-EOS5
+# for a given "brand" (i.e. architecture type)
+
+full: opt debug
+
+# define a target to build the "debug" variation (or "flavor") of HDF-EOS5
+# for a given "brand" (i.e. architecture type) ("debug" means the library
+# will be compiled for use in a souce code debugger)
+
+debug:
+	@$(MAKE) flavor_dir FLAVOR=$@
+	@export use_flavor=1; $(MAKE) $(TARGET) OPT_LVL=-g FLAVOR=$@
+
+# define a target to build the "optimized" variation (or "flavor") of
+# HDF-EOS5 for a given "brand" (i.e. architecture type) ("optimized" means the
+# library will be optimized for execution speed by the compiler)
+
+opt:
+	@$(MAKE) flavor_dir FLAVOR=$@
+	@export use_flavor=1; $(MAKE) $(TARGET) OPT_LVL=-O FLAVOR=$@
+
+# define standard CM targets
+
+# NOTE: The standard targets defined by ECS CM are:
+#       BuildImake, ProductHs, ProductLibs, LastPass, Deliver
+#
+#       Here the above targets are shadowed by the targets:
+#       BuildImake2, ProductHs2, ProductLibs2, LastPass2, Deliver2
+#       respectively.  The original targets only call the target
+#       HE_ENV which sets up the HDF-EOS5 environment and then
+#       builds the shadow target.
+#       For SGI 32 Falvor build or linux 12 Falvor build these targets
+#       renamed to FL_......
+
+
+BuildImake:
+	@$(MAKE) $(MFLAGS) HE_ENV TARGET=$@2
+
+BuildImake2:
+	@echo "No Imakefile to build."
+
+ProductHs:
+	@$(MAKE) $(MFLAGS) HE_ENV TARGET=$@2
+
+ProductHs2:
+	@echo "No header files to generate or promote."
+
+ProductLibs: ProductLibs32 ProductLibs64
+
+ProductLibs32:
+	@$(MAKE) $(MFLAGS) HE_ENV TARGET=$@2
+
+ProductLibs322:
+	@if [ ! -e $(HDFEOS5_HOME)/lib/$(ARCH) ] ; then	\
+		cd $(HDFEOS5_HOME)/lib;			\
+		ln -s `basename $(HDFEOS5_LIB)` $(ARCH);\
+	fi
+	@cd $(HDFEOS5_HOME)/src; $(MAKE) $(MFLAGS) all
+	@cd $(TK_HOME)/src/GCT/freeware; $(MAKE) $(MFLAGS) gctp5
+
+ProductLibs64:
+	@$(MAKE) $(MFLAGS) HE_ENV64 TARGET=$@2
+
+ProductLibs642:
+	@if [ ! -e $(HDFEOS5_HOME)/lib/$(ARCH)64 ] ; then	\
+		cd $(HDFEOS5_HOME)/lib;			\
+		ln -s `basename $(HDFEOS5_LIB)` $(ARCH)64;\
+	fi
+	@cd $(HDFEOS5_HOME)/src; $(MAKE) $(MFLAGS) all
+	@cd $(TK_HOME)/src/GCT/freeware; $(MAKE) $(MFLAGS) gctp5
+
+LastPass:LastPass32 LastPass64
+
+LastPass32:
+	@$(MAKE) $(MFLAGS) HE_ENV TARGET=$@2
+
+LastPass322:
+	@if [ ! -e $(HDFEOS5_HOME)/bin/$(ARCH) ] ; then	\
+		cd $(HDFEOS5_HOME)/bin;			\
+		ln -s `basename $(HDFEOS5_BIN)` $(ARCH);\
+	fi
+	@cd $(HDFEOS5_HOME)/util; $(MAKE) $(MFLAGS) all
+
+LastPass64:
+	@$(MAKE) $(MFLAGS) HE_ENV64 TARGET=$@2
+
+LastPass642:
+	@if [ ! -e $(HDFEOS5_HOME)/bin/$(ARCH)64 ] ; then	\
+		cd $(HDFEOS5_HOME)/bin;			\
+		ln -s `basename $(HDFEOS5_BIN)` $(ARCH)64;\
+	fi
+	@cd $(HDFEOS5_HOME)/util; $(MAKE) $(MFLAGS) all
+
+#	@echo "No utilites to build."
+
+FL_BuildImake:
+	@$(MAKE) $(MFLAGS) FL_HE_ENV TARGET=$@2
+
+FL_BuildImake2:
+	@echo "No Imakefile to build."
+
+FL_ProductHs:
+	@$(MAKE) $(MFLAGS) FL_HE_ENV TARGET=$@2
+
+FL_ProductHs2:
+	@echo "No header files to generate or promote."
+
+FL_ProductLibs:
+	@$(MAKE) $(MFLAGS) FL_HE_ENV TARGET=$@2
+
+FL_ProductLibs2:
+	@if [ ! -e $(HDFEOS5_HOME)/lib/$(ARCH) ] ; then	\
+		cd $(HDFEOS5_HOME)/lib;			\
+		ln -s `basename $(HDFEOS5_LIB)` $(ARCH);\
+	fi
+	@cd $(HDFEOS5_HOME)/src; $(MAKE) $(MFLAGS) all
+	@cd $(TK_HOME)/src/GCT/freeware; $(MAKE) $(MFLAGS) gctp5
+
+FL_LastPass:
+	@$(MAKE) $(MFLAGS) FL_HE_ENV TARGET=$@2
+
+FL_LastPass2:
+	@if [ ! -e $(HDFEOS5_HOME)/bin/$(ARCH) ] ; then	\
+		cd $(HDFEOS5_HOME)/bin;			\
+		ln -s `basename $(HDFEOS5_BIN)` $(ARCH);\
+	fi
+	@cd $(HDFEOS5_HOME)/util; $(MAKE) $(MFLAGS) all
+
+#	@echo "No utilites to build."
+
+
+
+Deliver:
+	@$(MAKE) $(MFLAGS) HE_ENV TARGET=$@2
+
+Deliver2:
+#	cp -rf /ecs/hdfeos/gctp .
+#	chmod 0755 gctp/src/* gctp/include/*
+	tar cvfX $(TAR_HOME)/$(HDFEOS5_SOURCE_TAR) $(HE_HOME)/make_exclude_list -C /ecs hdfeos5
+	tar cvfX $(TAR_HOME)/$(HDFEOS5_TESTDRIVERS_TAR)  $(HE_HOME)/testdrivers/make_exclude_list -C /ecs  hdfeos5/testdrivers
+
+DaacDeliver:
+	@if [ $(ARCH) = "sgi6n32" ] ; then				    \
+		for arch in sgi6n32 sgi6 ; do			    	    \
+			for targ in FL_ProductHs FL_ProductLibs FL_LastPass ; do	    \
+				$(MAKECMD) full TARGET=$$targ ARCH=$$arch;  \
+			done;						    \
+		done;							    \
+	elif [ $(ARCH) = "irix65" ] ; then				    \
+		for arch in sgi6n32 sgi6 ; do			            \
+			for targ in FL_ProductHs FL_ProductLibs FL_LastPass ; do	    \
+				$(MAKECMD) full TARGET=$$targ ARCH=$$arch;  \
+			done;						    \
+		done;                                                       \
+	else								    \
+		for targ in FL_ProductHs FL_ProductLibs FL_LastPass ; do		    \
+			$(MAKECMD) full TARGET=$$targ;			    \
+		done;							    \
+	fi
+
+LinuxDaacDeliver:  
+	@if [ $(ARCH) = "linux" ] ; then				\
+		for arch in linux ; do					\
+			for targ in FL_ProductHs FL_ProductLibs FL_LastPass ; do	\
+			$(MAKECMD) full TARGET=$$targ ARCH=$$arch;	\
+		done ;							\
+		done ;							\
+	fi
+
+
+
+# this is a special target used to establish the HDF-EOS5 environment
+
+FL_HE_ENV:
+	@case $(ARCH) in					\
+		hp10)    brand=hp;      ;;			\
+		sgi6n32) brand=sgi32; sgi_mode=n32;  ;;		\
+		irix65)  brand=irix65; sgi_mode=65   ;;         \
+		sgi6)    brand=sgi64; sgi_mode=64;  ;;		\
+		sun5.5)  brand=sun5;    ;;			\
+		sun5.8)  brand=sun5.8;    ;;			\
+		linux)   LINUX_BRAND=linux; brand=$(ARCH) ;;  \
+		*)       brand=$(ARCH); ;;			\
+	esac;							\
+	postfix=""; 						\
+	opt_flag=-O;						\
+	case $(FLAVOR) in					\
+		*debug)						\
+			opt_flag=-g;				\
+			postfix=_debug;				\
+		;;						\
+	esac;							\
+	HDFEOS5_HOME=$(HE_HOME);				\
+	LNX_COMP_FLAG="-m32";					\
+	export LNX_COMP_FLAG;					\
+	opt_flag=$(OPT_LVL);					\
+	export HDFEOS5_HOME sgi_mode opt_flag LINUX_BRAND;	\
+	. $(HE_HOME)/bin/$${brand}$$postfix/hdfeos_env.ksh;	\
+	MAKE="$(MAKECMD)";					\
+	AR='ar r';						\
+	HDF5INC=$(HDF_BASE)/$$brand/$(CURRENT_HDF)/include;	\
+	HDF5LIB=$(HDF_BASE)/$$brand/$(CURRENT_HDF)/lib		\
+	PGSINC=$(TK_HOME)/include;				\
+	SZIPLIB=$(HDF_BASE)/$${brand}/$(CURRENT_SZIP)/lib;	\
+	SZIPINC=$(HDF_BASE)/$${brand}/$(CURRENT_SZIP)/include;	\
+	export MAKE AR HDF5INC PGSINC SZIPINC SZIPLIB HDF5LIB;	\
+	HDFINC=$(HDF_BASE)/$$brand/$(CURRENT_HDF4)/include;	\
+	HDFLIB=$(HDF_BASE)/$$brand/$(CURRENT_HDF4)/lib		\
+	export HDFINC HDFLIB;					\
+	$(MAKE) $(MFLAGS) $(TARGET)
+
+
+HE_ENV:
+	@case $(ARCH) in					\
+		hp10)    brand=hp;      ;;			\
+		sgi6n32) brand=sgi32; sgi_mode=n32;  ;;		\
+		irix65)  brand=irix65; sgi_mode=65   ;;         \
+		sgi6)    brand=sgi64; sgi_mode=64;  ;;		\
+		sun5.5)  brand=sun5;    ;;			\
+		sun5.8)  brand=sun5.8;    ;;			\
+		linux)   LINUX_BRAND=linux; brand=$(ARCH) ;;    \
+		*)       brand=$(ARCH); ;;			\
+	esac;							\
+	HDFEOS5_HOME=$(HE_HOME);				\
+	opt_flag=$(OPT_LVL);					\
+	export HDFEOS5_HOME sgi_mode opt_flag LINUX_BRAND;	\
+	. $(HE_HOME)/bin/tmp/hdfeos_env.ksh.tmp;		\
+	if [ $(ARCH) = "linux" ] ; then				\
+	CC="gcc -m32";						\
+	export CC;						\
+	LNX_COMP_FLAG="-m32";					\
+	export LNX_COMP_FLAG;					\
+	fi;							\
+	MAKE="$(MAKECMD)";					\
+	AR='ar r';						\
+	HDF5INC=$(HDF_BASE)/$$brand/$(CURRENT_HDF)/include;	\
+	HDF5LIB=$(HDF_BASE)/$$brand/$(CURRENT_HDF)/lib		\
+	PGSINC=$(TK_HOME)/include;				\
+	SZIPLIB=$(HDF_BASE)/$${brand}/$(CURRENT_SZIP)/lib;	\
+	SZIPINC=$(HDF_BASE)/$${brand}/$(CURRENT_SZIP)/include;	\
+	export MAKE AR HDF5INC PGSINC SZIPINC SZIPLIB HDF5LIB;	\
+	HDFINC=$(HDF_BASE)/$$brand/$(CURRENT_HDF4)/include;	\
+	HDFLIB=$(HDF_BASE)/$$brand/$(CURRENT_HDF4)/lib		\
+	export HDFINC HDFLIB;					\
+	$(MAKE) $(MFLAGS) $(TARGET)
+
+HE_ENV64:
+	@case $(ARCH) in					\
+		hp10)    brand=hp;      ;;			\
+		sgi6n32) brand=sgi32; sgi_mode=n32;  ;;		\
+		irix65)  brand=irix65; sgi_mode=65   ;;         \
+		sgi6)    brand=sgi64; sgi_mode=64;  ;;		\
+		sun5.5)  brand=sun5;    ;;			\
+		sun5.8)  brand=sun5.8;    ;;			\
+		linux)   LINUX_BRAND=linux64; brand=$(ARCH)64 ;;\
+		*)       brand=$(ARCH); ;;			\
+	esac;							\
+	HDFEOS5_HOME=$(HE_HOME);				\
+	opt_flag=$(OPT_LVL);					\
+	export HDFEOS5_HOME sgi_mode opt_flag LINUX_BRAND;	\
+	. $(HE_HOME)/bin/tmp/hdfeos_env.ksh.tmp;		\
+	if [ $(ARCH) = "linux" ] ; then				\
+	CC="gcc";						\
+	export CC;						\
+	LNX_COMP_FLAG="";					\
+	export LNX_COMP_FLAG;					\
+	fi;							\
+	MAKE="$(MAKECMD)";					\
+	AR='ar r';						\
+	HDF5INC=$(HDF_BASE)/$$brand/$(CURRENT_HDF)/include;	\
+	HDF5LIB=$(HDF_BASE)/$$brand/$(CURRENT_HDF)/lib		\
+	PGSINC=$(TK_HOME)/include;				\
+	SZIPLIB=$(HDF_BASE)/$${brand}/$(CURRENT_SZIP)/lib;	\
+	SZIPINC=$(HDF_BASE)/$${brand}/$(CURRENT_SZIP)/include;	\
+	export MAKE AR HDF5INC PGSINC SZIPINC SZIPLIB HDF5LIB;	\
+	HDFINC=$(HDF_BASE)/$$brand/$(CURRENT_HDF4)/include;	\
+	HDFLIB=$(HDF_BASE)/$$brand/$(CURRENT_HDF4)/lib		\
+	export HDFINC HDFLIB;					\
+	$(MAKE) $(MFLAGS) $(TARGET)
+
+flavor_dir:
+	@sgi_mode=sgi32;					\
+	LNX_COMP_FLAG="-m32";			                \
+	export LNX_COMP_FLAG;					\
+	opt_flag=-O;						\
+	postfix="";						\
+	case $(FLAVOR) in					\
+		*debug)						\
+			opt_flag=-g;				\
+			postfix=_debug;				\
+		;;						\
+	esac;							\
+	case $(ARCH) in						\
+		hp10)						\
+			brand=hp;				\
+		;;						\
+		sgi6n32)					\
+			brand=sgi32;				\
+			sgi_mode=n32;				\
+		;;						\
+		irix65)                                         \
+			brand=irix65;				\
+			sgi_mode=65;				\
+		;;						\
+		sgi6)						\
+			brand=sgi64;				\
+			sgi_mode=64;				\
+		;;						\
+		sun5.5)						\
+			brand=sun5;				\
+		;;						\
+		sun5.8)						\
+			brand=sun5.8;				\
+		;;						\
+		*)						\
+			brand=$(ARCH);				\
+		;;						\
+	esac;							\
+	he_obj=$(HE_HOME)/obj/$${brand}$$postfix;		\
+	he_lib=$(HE_HOME)/lib/$${brand}$$postfix;		\
+	he_bin=$(HE_HOME)/bin/$${brand}$$postfix;		\
+	tmpdir=$(HE_HOME)/bin/tmp;				\
+	if [ ! -d $$he_obj ] ; then				\
+		mkdir $$he_obj;					\
+	fi;							\
+	if [ ! -d $$he_lib ] ; then				\
+		mkdir $$he_lib;					\
+	fi;							\
+	if [ ! -d $$he_bin ] ; then				\
+		mkdir $$he_bin;					\
+	fi;							\
+	hdf5lib=$(HDF_BASE)/$${brand}/$(CURRENT_HDF)/lib;	\
+	hdf5inc=$(HDF_BASE)/$${brand}/$(CURRENT_HDF)/include;	\
+	sziplib=$(HDF_BASE)/$${brand}/$(CURRENT_SZIP)/lib;	\
+	szipinc=$(HDF_BASE)/$${brand}/$(CURRENT_SZIP)/include;	\
+	if [ ! -f $$he_bin/hdfeos_env.csh ] ; then			\
+		cd $$he_bin;						\
+		echo "setenv HDFEOS5_HOME $(HE_HOME)" > hdfeos_env.csh;	\
+		echo "setenv HDF5LIB $$hdf5lib" >> hdfeos_env.csh;	\
+		echo "setenv HDF5INC $$hdf5inc" >> hdfeos_env.csh;	\
+		echo "setenv SZIPLIB $$sziplib" >> hdfeos_env.csh;	\
+		echo "setenv SZIPINC $$szipinc" >> hdfeos_env.csh;	\
+		echo "set sgi_mode=$$sgi_mode" >> hdfeos_env.csh;	\
+		echo "set opt_flag=$$opt_flag" >> hdfeos_env.csh;	\
+		echo "set use_flavor=1" >> hdfeos_env.csh;		\
+		sed "s^LNX_CMP_FLAG^$$LNX_COMP_FLAG^" 			\
+		$$tmpdir/hdfeos_env.csh.tmp >> hdfeos_env.csh;		\
+	fi;								\
+	if [ ! -f $$he_bin/hdfeos_env.ksh ] ; then			\
+		cd $$he_bin;						\
+		echo "HDFEOS5_HOME=$(HE_HOME)" > hdfeos_env.ksh;	\
+		echo "HDF5LIB=$$hdf5lib" >> hdfeos_env.ksh;		\
+		echo "HDF5INC=$$hdf5inc" >> hdfeos_env.ksh;		\
+		echo "SZIPLIB=$$sziplib" >> hdfeos_env.ksh;		\
+		echo "SZIPINC=$$szipinc" >> hdfeos_env.ksh;		\
+		echo "sgi_mode=$$sgi_mode" >> hdfeos_env.ksh;		\
+		echo "opt_flag=$$opt_flag" >> hdfeos_env.ksh;		\
+		echo "use_flavor=1" >> hdfeos_env.ksh;			\
+		sed "s^LNX_CMP_FLAG^$$LNX_COMP_FLAG^" 			\
+		$$tmpdir/hdfeos_env.ksh.tmp >> hdfeos_env.ksh;		\
+	fi
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..363bcfb
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,21 @@
+# Top-level Makefile for HDF-EOS5
+
+# Include boilerplate
+include $(top_srcdir)/config/include.am
+
+# List of subdirectories.
+# Only build the testdrivers directory if configure detected that it's present.
+if TESTDRIVERS_CONDITIONAL
+TESTDRIVERS=testdrivers
+else
+TESTDRIVERS=
+endif
+
+if INSTALL_INCLUDE_CONDITIONAL
+INCLUDE=include
+else
+INCLUDE=
+endif
+
+SUBDIRS=gctp src $(INCLUDE) samples $(TESTDRIVERS)
+
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..f160d0d
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,617 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+# Top-level Makefile for HDF-EOS5
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(top_srcdir)/config/include.am \
+	$(top_srcdir)/configure config/config.guess config/config.sub \
+	config/depcomp config/install-sh config/ltmain.sh \
+	config/missing
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/HE5_config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-exec-recursive install-info-recursive \
+	install-recursive installcheck-recursive installdirs-recursive \
+	pdf-recursive ps-recursive uninstall-info-recursive \
+	uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = gctp src include samples testdrivers
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  { test ! -d $(distdir) \
+    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F2CFORTRAN_32PTR_CONDITIONAL_FALSE = @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@
+F2CFORTRAN_32PTR_CONDITIONAL_TRUE = @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@
+F2CFORTRAN_90_CONDITIONAL_FALSE = @F2CFORTRAN_90_CONDITIONAL_FALSE@
+F2CFORTRAN_90_CONDITIONAL_TRUE = @F2CFORTRAN_90_CONDITIONAL_TRUE@
+F2CFORTRAN_CONDITIONAL_FALSE = @F2CFORTRAN_CONDITIONAL_FALSE@
+F2CFORTRAN_CONDITIONAL_TRUE = @F2CFORTRAN_CONDITIONAL_TRUE@
+F77 = @F77@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_INCLUDE_CONDITIONAL_FALSE = @INSTALL_INCLUDE_CONDITIONAL_FALSE@
+INSTALL_INCLUDE_CONDITIONAL_TRUE = @INSTALL_INCLUDE_CONDITIONAL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SZIP_ENCODER_CONDITIONAL_FALSE = @SZIP_ENCODER_CONDITIONAL_FALSE@
+SZIP_ENCODER_CONDITIONAL_TRUE = @SZIP_ENCODER_CONDITIONAL_TRUE@
+TESTDRIVERS_CONDITIONAL_FALSE = @TESTDRIVERS_CONDITIONAL_FALSE@
+TESTDRIVERS_CONDITIONAL_TRUE = @TESTDRIVERS_CONDITIONAL_TRUE@
+THREADSAFE_CONDITIONAL_FALSE = @THREADSAFE_CONDITIONAL_FALSE@
+THREADSAFE_CONDITIONAL_TRUE = @THREADSAFE_CONDITIONAL_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la
+LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
+ at TESTDRIVERS_CONDITIONAL_FALSE@TESTDRIVERS = 
+
+# Include boilerplate
+
+# List of subdirectories.
+# Only build the testdrivers directory if configure detected that it's present.
+ at TESTDRIVERS_CONDITIONAL_TRUE@TESTDRIVERS = testdrivers
+ at INSTALL_INCLUDE_CONDITIONAL_FALSE@INCLUDE = 
+ at INSTALL_INCLUDE_CONDITIONAL_TRUE@INCLUDE = include
+SUBDIRS = gctp src $(INCLUDE) samples $(TESTDRIVERS)
+all: all-recursive
+
+.SUFFIXES:
+am--refresh:
+	@:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+	      cd $(srcdir) && $(AUTOMAKE) --foreign  \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    echo ' $(SHELL) ./config.status'; \
+	    $(SHELL) ./config.status;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	$(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(am__remove_distdir)
+	mkdir $(distdir)
+	$(mkdir_p) $(distdir)/config
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+	|| chmod -R a+r $(distdir)
+dist-gzip: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
+
+dist-bzip2: distdir
+	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+	$(am__remove_distdir)
+
+dist-tarZ: distdir
+	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+	$(am__remove_distdir)
+
+dist-shar: distdir
+	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+	$(am__remove_distdir)
+
+dist-zip: distdir
+	-rm -f $(distdir).zip
+	zip -rq $(distdir).zip $(distdir)
+	$(am__remove_distdir)
+
+dist dist-all: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+	case '$(DIST_ARCHIVES)' in \
+	*.tar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+	*.tar.bz2*) \
+	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.Z*) \
+	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+	*.shar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+	*.zip*) \
+	  unzip $(distdir).zip ;;\
+	esac
+	chmod -R a-w $(distdir); chmod a+w $(distdir)
+	mkdir $(distdir)/_build
+	mkdir $(distdir)/_inst
+	chmod a-w $(distdir)
+	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+	  && cd $(distdir)/_build \
+	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	    $(DISTCHECK_CONFIGURE_FLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+	  && $(MAKE) $(AM_MAKEFLAGS) check \
+	  && $(MAKE) $(AM_MAKEFLAGS) install \
+	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+	        distuninstallcheck \
+	  && chmod -R a-w "$$dc_install_base" \
+	  && ({ \
+	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
+	  && rm -rf "$$dc_destdir" \
+	  && $(MAKE) $(AM_MAKEFLAGS) dist \
+	  && rm -rf $(DIST_ARCHIVES) \
+	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+	$(am__remove_distdir)
+	@(echo "$(distdir) archives ready for distribution: "; \
+	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+	  sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+	@cd $(distuninstallcheck_dir) \
+	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+	   || { echo "ERROR: files left after uninstall:" ; \
+	        if test -n "$(DESTDIR)"; then \
+	          echo "  (check DESTDIR support)"; \
+	        fi ; \
+	        $(distuninstallcheck_listfiles) ; \
+	        exit 1; } >&2
+distcleancheck: distclean
+	@if test '$(srcdir)' = . ; then \
+	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+	  exit 1 ; \
+	fi
+	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+	  || { echo "ERROR: files left in build directory after distclean:" ; \
+	       $(distcleancheck_listfiles) ; \
+	       exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf $(top_srcdir)/autom4te.cache
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+	check-am clean clean-generic clean-libtool clean-recursive \
+	ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
+	dist-shar dist-tarZ dist-zip distcheck distclean \
+	distclean-generic distclean-libtool distclean-recursive \
+	distclean-tags distcleancheck distdir distuninstallcheck dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs installdirs-am \
+	maintainer-clean maintainer-clean-generic \
+	maintainer-clean-recursive mostlyclean mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+	tags tags-recursive uninstall uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..260c1f8
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,7009 @@
+# generated automatically by aclocal 1.9.2 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+
+# serial 47 AC_PROG_LIBTOOL
+
+
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+         [],
+         [m4_define([AC_PROVIDE_IFELSE],
+	         [m4_ifdef([AC_PROVIDE_$1],
+		           [$2], [$3])])])
+
+
+# AC_PROG_LIBTOOL
+# ---------------
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+  AC_PROVIDE_IFELSE([AC_PROG_CXX],
+    [AC_LIBTOOL_CXX],
+    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+  ])])
+dnl And a similar setup for Fortran 77 support
+  AC_PROVIDE_IFELSE([AC_PROG_F77],
+    [AC_LIBTOOL_F77],
+    [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+    [AC_LIBTOOL_GCJ],
+    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+      [AC_LIBTOOL_GCJ],
+      [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+	[AC_LIBTOOL_GCJ],
+      [ifdef([AC_PROG_GCJ],
+	     [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([A][M_PROG_GCJ],
+	     [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([LT_AC_PROG_GCJ],
+	     [define([LT_AC_PROG_GCJ],
+		defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])# _AC_PROG_LIBTOOL
+
+
+# AC_LIBTOOL_SETUP
+# ----------------
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.50)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
+
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+_LT_AC_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+    ;;
+  *)
+    old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    AC_PATH_MAGIC
+  fi
+  ;;
+esac
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+	[avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+AC_ARG_WITH([pic],
+    [AC_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+AC_LIBTOOL_LANG_C_CONFIG
+_LT_AC_TAGCONFIG
+])# AC_LIBTOOL_SETUP
+
+
+# _LT_AC_SYS_COMPILER
+# -------------------
+AC_DEFUN([_LT_AC_SYS_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_AC_SYS_COMPILER
+
+
+# _LT_AC_SYS_LIBPATH_AIX
+# ----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_AC_SYS_LIBPATH_AIX
+
+
+# _LT_AC_SHELL_INIT(ARG)
+# ----------------------
+AC_DEFUN([_LT_AC_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+	 [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_AC_SHELL_INIT
+
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[_LT_AC_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+[$]*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+       echo_test_string="`eval $cmd`" &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "[$]0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+	[avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case "`/usr/bin/file conftest.o`" in
+    *32-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+  ])
+esac
+
+need_locks="$enable_libtool_lock"
+
+])# _LT_AC_LOCK
+
+
+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+  ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$5], , :, [$5])
+else
+    ifelse([$6], , :, [$6])
+fi
+])# AC_LIBTOOL_COMPILER_OPTION
+
+
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                          [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+     else
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$4], , :, [$4])
+else
+    ifelse([$5], , :, [$5])
+fi
+])# AC_LIBTOOL_LINKER_OPTION
+
+
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+ *)
+    # If test is not a shell built-in, we'll probably end up computing a
+    # maximum length that is only half of the actual maximum length, but
+    # we can't tell.
+    while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+	       = "XX$teststring") >/dev/null 2>&1 &&
+	    new_result=`expr "X$teststring" : ".*" 2>&1` &&
+	    lt_cv_sys_max_cmd_len=$new_result &&
+	    test $i != 17 # 1/2 MB should be enough
+    do
+      i=`expr $i + 1`
+      teststring=$teststring$teststring
+    done
+    teststring=
+    # Add a significant safety factor because C++ compilers can tack on massive
+    # amounts of additional arguments before passing them to the linker.
+    # It appears as though 1/2 is a usable value.
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+])# AC_LIBTOOL_SYS_MAX_CMD_LEN
+
+
+# _LT_AC_CHECK_DLFCN
+# --------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)dnl
+])# _LT_AC_CHECK_DLFCN
+
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}]
+EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_unknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+
+# AC_LIBTOOL_DLOPEN_SELF
+# -------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+   ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+	  [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+    	  lt_cv_dlopen_self_static, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+
+# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
+# ---------------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler
+AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s out/conftest.err; then
+       _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w .
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+])
+])# AC_LIBTOOL_PROG_CC_C_O
+
+
+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+# -----------------------------------------
+# Check to see if we can do hard links to lock some files if needed
+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+[AC_REQUIRE([_LT_AC_LOCK])dnl
+
+hard_links="nottested"
+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
+
+
+# AC_LIBTOOL_OBJDIR
+# -----------------
+AC_DEFUN([AC_LIBTOOL_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+])# AC_LIBTOOL_OBJDIR
+
+
+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+# ----------------------------------------------
+# Check hardcoding attributes.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_AC_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+   test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \
+   test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_AC_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_AC_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
+
+
+# AC_LIBTOOL_SYS_LIB_STRIP
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+[striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         AC_MSG_RESULT([yes])
+       else
+  AC_MSG_RESULT([no])
+fi
+       ;;
+   *)
+  AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+])# AC_LIBTOOL_SYS_LIB_STRIP
+
+
+# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
+[AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  *) # from 3.2 on
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case "$host_cpu" in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # find out which ABI we are using
+  libsuff=
+  case "$host_cpu" in
+  x86_64*|s390x*|powerpc64*)
+    echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+    if AC_TRY_EVAL(ac_compile); then
+      case `/usr/bin/file conftest.$ac_objext` in
+      *64-bit*)
+        libsuff=64
+        sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+        ;;
+      esac
+    fi
+    rm -rf conftest*
+    ;;
+  esac
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=yes
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+
+
+# _LT_AC_TAGCONFIG
+# ----------------
+AC_DEFUN([_LT_AC_TAGCONFIG],
+[AC_ARG_WITH([tags],
+    [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
+        [include additional configurations @<:@automatic@:>@])],
+    [tagnames="$withval"])
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    AC_MSG_WARN([output file `$ofile' does not exist])
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+    else
+      AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+    fi
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+    "") ;;
+    *)  AC_MSG_ERROR([invalid tag name: $tagname])
+	;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      AC_MSG_ERROR([tag name \"$tagname\" already exists])
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+	if test -n "$CXX" && test "X$CXX" != "Xno"; then
+	  AC_LIBTOOL_LANG_CXX_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      F77)
+	if test -n "$F77" && test "X$F77" != "Xno"; then
+	  AC_LIBTOOL_LANG_F77_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      GCJ)
+	if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+	  AC_LIBTOOL_LANG_GCJ_CONFIG
+	else
+	  tagname=""
+	fi
+	;;
+
+      RC)
+	AC_LIBTOOL_LANG_RC_CONFIG
+	;;
+
+      *)
+	AC_MSG_ERROR([Unsupported tag name: $tagname])
+	;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    AC_MSG_ERROR([unable to update list of available tagged configurations.])
+  fi
+fi
+])# _LT_AC_TAGCONFIG
+
+
+# AC_LIBTOOL_DLOPEN
+# -----------------
+# enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN],
+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_DLOPEN
+
+
+# AC_LIBTOOL_WIN32_DLL
+# --------------------
+# declare package support for building win32 dll's
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_WIN32_DLL
+
+
+# AC_ENABLE_SHARED([DEFAULT])
+# ---------------------------
+# implement the --enable-shared flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([shared],
+    [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+])# AC_ENABLE_SHARED
+
+
+# AC_DISABLE_SHARED
+# -----------------
+#- set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)
+])# AC_DISABLE_SHARED
+
+
+# AC_ENABLE_STATIC([DEFAULT])
+# ---------------------------
+# implement the --enable-static flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([static],
+    [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+])# AC_ENABLE_STATIC
+
+
+# AC_DISABLE_STATIC
+# -----------------
+# set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)
+])# AC_DISABLE_STATIC
+
+
+# AC_ENABLE_FAST_INSTALL([DEFAULT])
+# ---------------------------------
+# implement the --enable-fast-install flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([fast-install],
+    [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+])# AC_ENABLE_FAST_INSTALL
+
+
+# AC_DISABLE_FAST_INSTALL
+# -----------------------
+# set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)
+])# AC_DISABLE_FAST_INSTALL
+
+
+# AC_LIBTOOL_PICMODE([MODE])
+# --------------------------
+# implement the --with-pic flag
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)
+])# AC_LIBTOOL_PICMODE
+
+
+# AC_PROG_EGREP
+# -------------
+# This is predefined starting with Autoconf 2.54, so this conditional
+# definition can be removed once we require Autoconf 2.54 or later.
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+   [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])])
+
+
+# AC_PATH_TOOL_PREFIX
+# -------------------
+# find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="ifelse([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+])# AC_PATH_TOOL_PREFIX
+
+
+# AC_PATH_MAGIC
+# -------------
+# find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# AC_PATH_MAGIC
+
+
+# AC_PROG_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+    [AC_HELP_STRING([--with-gnu-ld],
+	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])# AC_PROG_LD
+
+
+# AC_PROG_LD_GNU
+# --------------
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# AC_PROG_LD_GNU
+
+
+# AC_PROG_LD_RELOAD_FLAG
+# ----------------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+])# AC_PROG_LD_RELOAD_FLAG
+
+
+# AC_DEPLIBS_CHECK_METHOD
+# -----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | kfreebsd*-gnu)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case "$host_cpu" in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  case $host_cpu in
+  alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*)
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object'
+  else
+    lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+])# AC_DEPLIBS_CHECK_METHOD
+
+
+# AC_PROG_NM
+# ----------
+# find the pathname to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    tmp_nm="$ac_dir/${ac_tool_prefix}nm"
+    if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+      #   nm: unknown option "B" ignored
+      # Tru64's nm complains that /dev/null is an invalid object file
+      case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+      */dev/null* | *'Invalid file or object type'*)
+	lt_cv_path_NM="$tmp_nm -B"
+	break
+        ;;
+      *)
+	case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	*/dev/null*)
+	  lt_cv_path_NM="$tmp_nm -p"
+	  break
+	  ;;
+	*)
+	  lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	  continue # so that we can try to find one that supports BSD flags
+	  ;;
+	esac
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+])# AC_PROG_NM
+
+
+# AC_CHECK_LIBM
+# -------------
+# check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+])# AC_CHECK_LIBM
+
+
+# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl convenience library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-convenience to the configure arguments.  Note that LIBLTDL
+# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If
+# DIRECTORY is not provided, it is assumed to be `libltdl'.  LIBLTDL will
+# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!).  If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  case $enable_ltdl_convenience in
+  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+  "") enable_ltdl_convenience=yes
+      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+  esac
+  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_CONVENIENCE
+
+
+# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl installable library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments.  Note that LIBLTDL
+# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If
+# DIRECTORY is not provided and an installed libltdl is not found, it is
+# assumed to be `libltdl'.  LIBLTDL will be prefixed with '${top_builddir}/'
+# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single
+# quotes!).  If your package is not flat and you're not using automake,
+# define top_builddir and top_srcdir appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  AC_CHECK_LIB(ltdl, lt_dlinit,
+  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+  [if test x"$enable_ltdl_install" = xno; then
+     AC_MSG_WARN([libltdl not installed, but installation disabled])
+   else
+     enable_ltdl_install=yes
+   fi
+  ])
+  if test x"$enable_ltdl_install" = x"yes"; then
+    ac_configure_args="$ac_configure_args --enable-ltdl-install"
+    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  else
+    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+    LIBLTDL="-lltdl"
+    LTDLINCL=
+  fi
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_INSTALLABLE
+
+
+# AC_LIBTOOL_CXX
+# --------------
+# enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX],
+[AC_REQUIRE([_LT_AC_LANG_CXX])
+])# AC_LIBTOOL_CXX
+
+
+# _LT_AC_LANG_CXX
+# ---------------
+AC_DEFUN([_LT_AC_LANG_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([AC_PROG_CXXCPP])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+])# _LT_AC_LANG_CXX
+
+
+# AC_LIBTOOL_F77
+# --------------
+# enable support for Fortran 77 libraries
+AC_DEFUN([AC_LIBTOOL_F77],
+[AC_REQUIRE([_LT_AC_LANG_F77])
+])# AC_LIBTOOL_F77
+
+
+# _LT_AC_LANG_F77
+# ---------------
+AC_DEFUN([_LT_AC_LANG_F77],
+[AC_REQUIRE([AC_PROG_F77])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+])# _LT_AC_LANG_F77
+
+
+# AC_LIBTOOL_GCJ
+# --------------
+# enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],
+[AC_REQUIRE([_LT_AC_LANG_GCJ])
+])# AC_LIBTOOL_GCJ
+
+
+# _LT_AC_LANG_GCJ
+# ---------------
+AC_DEFUN([_LT_AC_LANG_GCJ],
+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+    [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+      [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+	 [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+	   [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+])# _LT_AC_LANG_GCJ
+
+
+# AC_LIBTOOL_RC
+# --------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([LT_AC_PROG_RC])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+])# AC_LIBTOOL_RC
+
+
+# AC_LIBTOOL_LANG_C_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+[lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+_LT_AC_SYS_COMPILER
+
+#
+# Check for any special shared library compilation flags.
+#
+_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)=
+if test "$GCC" = no; then
+  case $host_os in
+  sco3.2v5*)
+    _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf'
+    ;;
+  esac
+fi
+if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then
+  AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries])
+  if echo "$old_CC $old_CFLAGS " | grep "[[ 	]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ 	]]" >/dev/null; then :
+  else
+    AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure])
+    _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no
+  fi
+fi
+
+
+#
+# Check to make sure the static flag actually works.
+#
+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works],
+  _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
+  $_LT_AC_TAGVAR(lt_prog_compiler_static, $1),
+  [],
+  [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF($1)
+
+# Report which librarie types wil actually be built
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+  darwin* | rhapsody*)
+  if test "$GCC" = yes; then
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    case "$host_os" in
+    rhapsody* | darwin1.[[012]])
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+      	_LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[[012]])
+            _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+      ;;
+    esac
+    output_verbose_link_cmd='echo'
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
+    _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+    # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag  -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    _LT_AC_TAGVAR(hardcode_direct, $1)=no
+    _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+  else
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+  fi
+    ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_C_CONFIG
+
+
+# AC_LIBTOOL_LANG_CXX_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+[AC_LANG_PUSH(C++)
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([AC_PROG_CXXCPP])
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Dependencies to place before and after the object being linked:
+_LT_AC_TAGVAR(predep_objects, $1)=
+_LT_AC_TAGVAR(postdep_objects, $1)=
+_LT_AC_TAGVAR(predeps, $1)=
+_LT_AC_TAGVAR(postdeps, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+
+# Source file extension for C++ test sources.
+ac_ext=cc
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+else
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+  AC_PROG_LD
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+	grep 'no-whole-archive' > /dev/null; then
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	    ;;
+	  esac
+	done
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    _LT_AC_TAGVAR(archive_cmds, $1)=''
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.[012]|aix4.[012].*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	else
+	  # We have old collect2
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+	fi
+      esac
+      shared_flag='-shared'
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	shared_flag='-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      _LT_AC_SYS_LIBPATH_AIX
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+      else
+	# Determine the default libpath from the value encoded in an empty executable.
+	_LT_AC_SYS_LIBPATH_AIX
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	_LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	# -bexpall does not export symbols beginning with underscore (_)
+	_LT_AC_TAGVAR(always_export_symbols, $1)=yes
+	# Exported symbols can be pulled into shared objects from archives
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' '
+	_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+	# This is similar to how AIX traditionally builds it's shared libraries.
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+  chorus*)
+    case $cc_basename in
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+    # as there is no search path for DLLs.
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+    _LT_AC_TAGVAR(always_export_symbols, $1)=no
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname.def;
+      else
+	echo EXPORTS > $output_objdir/$soname.def;
+	cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+  ;;
+
+  darwin* | rhapsody*)
+  if test "$GXX" = yes; then
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    case "$host_os" in
+    rhapsody* | darwin1.[[012]])
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+      	_LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[[012]])
+            _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+      ;;
+    esac
+    lt_int_apple_cc_single_mod=no
+    output_verbose_link_cmd='echo'
+    if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+      lt_int_apple_cc_single_mod=yes
+    fi
+    if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+    else
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+    fi
+    _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+
+    # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+    if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    _LT_AC_TAGVAR(hardcode_direct, $1)=no
+    _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+  else
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+  fi
+    ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      ghcx)
+	# Green Hills C++ Compiler
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  freebsd[12]*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  freebsd-elf*)
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    ;;
+  freebsd* | kfreebsd*-gnu)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+				# but as the default
+				# location of the library.
+
+    case $cc_basename in
+    CC)
+      # FIXME: insert proper C++ library support
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    aCC)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      case "$host_cpu" in
+      hppa*64*)
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+        ;;
+      ia64*)
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+        ;;
+      *)
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        ;;
+      esac
+    fi
+    case "$host_cpu" in
+    hppa*64*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+    ia64*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+					      # but as the default
+					      # location of the library.
+      ;;
+    *)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+					      # but as the default
+					      # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      aCC)
+	case "$host_cpu" in
+	hppa*64*|ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	esac
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test $with_gnu_ld = no; then
+	    case "$host_cpu" in
+	    ia64*|hppa*64*)
+	      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
+	      ;;
+	    *)
+	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    esac
+	  fi
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC)
+	# SGI C++
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+
+	# Archives containing C++ object files must be created using
+	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test "$with_gnu_ld" = no; then
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+	  else
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+	  fi
+	fi
+	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+	;;
+    esac
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    ;;
+  linux*)
+    case $cc_basename in
+      KCC)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+	;;
+      icpc)
+	# Intel C++
+	with_gnu_ld=yes
+	_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	;;
+      cxx)
+	# Compaq C++
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	runpath_var=LD_RUN_PATH
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+
+	;;
+      RCC)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      cxx)
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Archives containing C++ object files must be created using
+	# the KAI C++ compiler.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
+	;;
+      RCC)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      cxx)
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	  echo "-hidden">> $lib.exp~
+	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry $objdir/so_locations -o $lib~
+	  $rm $lib.exp'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	 _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  sco*)
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    case $cc_basename in
+      CC)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC)
+	# Sun C++ 4.x
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      lcc)
+	# Lucid
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC)
+	# Sun C++ 4.2, 5.x and Centerline C++
+	_LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	$CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	case $host_os in
+	  solaris2.[0-5] | solaris2.[0-5].*) ;;
+	  *)
+	    # The C++ compiler is used as linker so we must use $wl
+	    # flag to pass the commands to the underlying system
+	    # linker.
+	    # Supported since Solaris 2.6 (maybe 2.5.1?)
+	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	    ;;
+	esac
+	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+	# Archives containing C++ object files must be created using
+	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	;;
+      gcx)
+	# Green Hills C++ Compiler
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	# The C++ compiler must be used to create the archive.
+	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	;;
+      *)
+	# GNU C++ compiler with Solaris linker
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+	  if $CC --version | grep -v '^2\.7' > /dev/null; then
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  else
+	    # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	    # platform.
+	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  fi
+
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	fi
+	;;
+    esac
+    ;;
+  sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*)
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC)
+	# NonStop-UX NCC 3.20
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+esac
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$GXX"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
+int a;
+void foo (void) { a = 0; }
+EOF
+],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+EOF
+],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+EOF
+],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`"
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+	  || test $p = "-R"; then
+	 prev=$p
+	 continue
+       else
+	 prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 case $p in
+	 -L* | -R*)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+	     _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+	   else
+	     _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
+	   _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
+	 else
+	   _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
+	 fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
+	   _LT_AC_TAGVAR(predep_objects, $1)="$p"
+	 else
+	   _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
+	 fi
+       else
+	 if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
+	   _LT_AC_TAGVAR(postdep_objects, $1)="$p"
+	 else
+	   _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$rm -f confest.$objext
+
+case " $_LT_AC_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+])# AC_LIBTOOL_POSTDEP_PREDEP
+
+# AC_LIBTOOL_LANG_F77_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+[AC_REQUIRE([AC_PROG_F77])
+AC_LANG_PUSH(Fortran 77)
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="      program t\n      end\n"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+aix4* | aix5*)
+  test "$enable_shared" = yes && enable_static=no
+  ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$G77"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_F77_CONFIG
+
+
+# AC_LIBTOOL_LANG_GCJ_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_GCJ_CONFIG
+
+
+# AC_LIBTOOL_LANG_RC_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
+# AC_LIBTOOL_CONFIG([TAGNAME])
+# ----------------------------
+# If TAGNAME is not passed, then create an initial libtool script
+# with a default configuration from the untagged config vars.  Otherwise
+# add code to config.status for appending the configuration named by
+# TAGNAME from the matching tagged config vars.
+AC_DEFUN([AC_LIBTOOL_CONFIG],
+[# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    _LT_AC_TAGVAR(compiler, $1) \
+    _LT_AC_TAGVAR(CC, $1) \
+    _LT_AC_TAGVAR(LD, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+    _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+    _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+    _LT_AC_TAGVAR(old_archive_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+    _LT_AC_TAGVAR(predep_objects, $1) \
+    _LT_AC_TAGVAR(postdep_objects, $1) \
+    _LT_AC_TAGVAR(predeps, $1) \
+    _LT_AC_TAGVAR(postdeps, $1) \
+    _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+    _LT_AC_TAGVAR(archive_cmds, $1) \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(postinstall_cmds, $1) \
+    _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+    _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+    _LT_AC_TAGVAR(no_undefined_flag, $1) \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+    _LT_AC_TAGVAR(hardcode_automatic, $1) \
+    _LT_AC_TAGVAR(module_cmds, $1) \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+    _LT_AC_TAGVAR(exclude_expsyms, $1) \
+    _LT_AC_TAGVAR(include_expsyms, $1); do
+
+    case $var in
+    _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(module_cmds, $1) | \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\[$]0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+    ;;
+  esac
+
+ifelse([$1], [],
+  [cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  AC_MSG_NOTICE([creating $ofile])],
+  [cfgfile="$ofile"])
+
+  cat <<__EOF__ >> "$cfgfile"
+ifelse([$1], [],
+[#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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 GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG],
+[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# A language-specific compiler.
+CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
+
+# Is the compiler the GNU C compiler?
+with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
+archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
+
+# Symbols that must always be exported.
+include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
+
+ifelse([$1],[],
+[# ### END LIBTOOL CONFIG],
+[# ### END LIBTOOL TAG CONFIG: $tagname])
+
+__EOF__
+
+ifelse([$1],[], [
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+])
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+])# AC_LIBTOOL_CONFIG
+
+
+# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+
+_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
+
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris* | sysv5*)
+  symcode='[[BDRT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ 	]]\($symcode$symcode*\)[[ 	]][[ 	]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+	if grep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+
+# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
+# ---------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
+[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+ ifelse([$1],[CXX],[
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	else
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68)
+	  # Green Hills C++ Compiler
+	  # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      dgux*)
+	case $cc_basename in
+	  ec++)
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  ghcx)
+	    # Green Hills C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | kfreebsd*-gnu)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+	    if test "$host_cpu" != ia64; then
+	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	    fi
+	    ;;
+	  aCC)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+	    case "$host_cpu" in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux*)
+	case $cc_basename in
+	  KCC)
+	    # KAI C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  icpc)
+	    # Intel C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  cxx)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx)
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd*)
+	;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC)
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    ;;
+	  RCC)
+	    # Rational C++ 2.4.1
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  cxx)
+	    # Digital/Compaq C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      sco*)
+	case $cc_basename in
+	  CC)
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	    ;;
+	  gcx)
+	    # Green Hills C++ Compiler
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC)
+	    # Sun C++ 4.x
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  lcc)
+	    # Lucid
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC)
+	    # NonStop-UX NCC 3.20
+	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      unixware*)
+	;;
+      vxworks*)
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+	;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    linux*)
+      case $CC in
+      icc* | ecc*)
+	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      ccc*)
+        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn'
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
+    _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
+    [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+case "$host_os" in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+])
+
+
+# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
+# ------------------------------------
+# See if the linker supports building shared libraries.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
+[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ifelse([$1],[CXX],[
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  *)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+],[
+  runpath_var=
+  _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+  _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_AC_TAGVAR(archive_cmds, $1)=
+  _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+  _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+  _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+  _LT_AC_TAGVAR(module_cmds, $1)=
+  _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(always_export_symbols, $1)=no
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_AC_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+
+      # Samuel A. Falvo II <kc5tja at dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=no
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000  ${wl}--out-implib,$lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris* | sysv5*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+	cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+  linux*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds"
+      supports_anon_versioning=no
+      case `$LD -v 2>/dev/null` in
+        *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+        *\ 2.11.*) ;; # other 2.11 versions
+        *) supports_anon_versioning=yes ;;
+      esac
+      if test $supports_anon_versioning = yes; then
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
+cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+$echo "local: *; };" >> $output_objdir/$libname.ver~
+        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+      else
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds"
+      fi
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+    ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then
+      runpath_var=LD_RUN_PATH
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ 	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+      fi
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$link_static_flag"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	_LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+	else
+	  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_AC_TAGVAR(archive_cmds, $1)=''
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	  else
+  	  # We have old collect2
+  	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+  	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+  	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+	esac
+	shared_flag='-shared'
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+  	if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+  	fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       _LT_AC_SYS_LIBPATH_AIX
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 _LT_AC_SYS_LIBPATH_AIX
+	 _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	  # -bexpall does not export symbols beginning with underscore (_)
+	  _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+	  # Exported symbols can be pulled into shared objects from archives
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' '
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  # This is similar to how AIX traditionally builds it's shared libraries.
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      # see comment about different semantics on the GNU ld section
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    bsdi4*)
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
+      # FIXME: Should let the user specify the lib program.
+      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
+    darwin* | rhapsody*)
+    if test "$GXX" = yes ; then
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      case "$host_os" in
+      rhapsody* | darwin1.[[012]])
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress'
+	;;
+      *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+      	_LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[[012]])
+            _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+	;;
+      esac
+    	lt_int_apple_cc_single_mod=no
+    	output_verbose_link_cmd='echo'
+    	if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+    	  lt_int_apple_cc_single_mod=yes
+    	fi
+    	if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+    	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+    	else
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      fi
+      _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+        if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        else
+          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        fi
+          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+      ;;
+
+    dgux*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    freebsd1*)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | kfreebsd*-gnu)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10* | hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case "$host_cpu" in
+	hppa*64*|ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case "$host_cpu" in
+	hppa*64*|ia64*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	case "$host_cpu" in
+	hppa*64*)
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+	  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  ;;
+	ia64*)
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+	  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	*)
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    openbsd*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      else
+       case $host_os in
+	 openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	   _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	   _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	   ;;
+	 *)
+	   _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	   _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	   ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    sco3.2v5*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
+      esac
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+        ;;
+	motorola)
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4.2uw2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      hardcode_runpath_var=yes
+      runpath_var=LD_RUN_PATH
+      ;;
+
+   sysv5OpenUNIX8* | sysv5UnixWare7* |  sysv5uw[[78]]* | unixware7*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text'
+      if test "$GCC" = yes; then
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      runpath_var='LD_RUN_PATH'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv5*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+      # $CC -shared without GNU ld will not create a library from C++
+      # object files and a static libstdc++, better avoid it by now
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_AC_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+        if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+        then
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+        else
+	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+        fi
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
+      ;;
+    esac
+  fi
+  ;;
+esac
+])# AC_LIBTOOL_PROG_LD_SHLIBS
+
+
+# _LT_AC_FILE_LTDLL_C
+# -------------------
+# Be careful that the start marker always follows a newline.
+AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+])# _LT_AC_FILE_LTDLL_C
+
+
+# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
+# ---------------------------------
+AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
+
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+  AC_SUBST(GCJFLAGS)
+])
+
+AC_DEFUN([LT_AC_PROG_RC],
+[AC_CHECK_TOOL(RC, windres, no)
+])
+
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && break
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+SED=$lt_cv_path_SED
+])
+AC_MSG_RESULT([$SED])
+])
+
+#                                                        -*- Autoconf -*-
+# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Generated from amversion.in; do not edit by hand.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+	 [AM_AUTOMAKE_VERSION([1.9.2])])
+
+# AM_AUX_DIR_EXPAND
+
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                              -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 6
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# serial 7						-*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking.   -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+#   Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+#serial 2
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`AS_DIRNAME(["$file"])`
+    AS_MKDIR_P([$dirpart/$fdir])
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 7
+
+# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Do all the work for Automake.                            -*- Autoconf -*-
+
+# This macro actually does too much some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 11
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+	      		     [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $1 | $1:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+#                                                          -*- Autoconf -*-
+# Copyright (C) 2003  Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Add --enable-maintainer-mode option to configure.
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
+
+AC_DEFUN([AM_MAINTAINER_MODE],
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+  dnl maintainer-mode is disabled by default
+  AC_ARG_ENABLE(maintainer-mode,
+[  --enable-maintainer-mode  enable make rules and dependencies not useful
+			  (and sometimes confusing) to the casual installer],
+      USE_MAINTAINER_MODE=$enableval,
+      USE_MAINTAINER_MODE=no)
+  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
+  MAINT=$MAINTAINER_MODE_TRUE
+  AC_SUBST(MAINT)dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Check to see how 'make' treats includes.	-*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+#  -*- Autoconf -*-
+
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+
+# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake.  There are at least two reasons why we must not
+# use `-m 0755':
+#   - it causes special bits like SGID to be ignored,
+#   - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out.  Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling.                    -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# AM_PROG_INSTALL_STRIP
+
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004  Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
+
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
diff --git a/bin/INSTALL b/bin/INSTALL
new file mode 100755
index 0000000..db35f24
--- /dev/null
+++ b/bin/INSTALL
@@ -0,0 +1,2966 @@
+#! /bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL
+#
+# description:
+#       Install script for the HDF-EOS and related software
+#
+# usage:
+# 	cd <HDFEOS-home-dir>
+# 	bin/INSTALL [-dbug] [-f90 [-NAG]] [-ABSOFT] [-fc_path <path/compiler_name>]
+#                   [-cc_path <path/compiler_name>]
+#                   [-no_ftn] [-sgi | -sgi32 | -sgi64]
+#                   [-log <log-file> [-append]] [-notext] [-batch]
+#                   [-pgshome <install_dir>] [-hdfhome <installed_hdf4_dir>]
+#                   [-hdf5home <installed_hdf5_dir>]
+#                   [-hdfeos_home <installed_hdfeos_dir>]
+#                   [-hdfeos5_home <installed_hdfeos5_dir>] [-cpp]
+#                   [-netcdfhome <installed_netcdf_dir>]
+#                   [-cpp_path <path>] [-c_rlib]
+#                   [-cc_flags "c flags"] [-fc_flags "fortran flags"] 
+#                   [-cpp_flags "cpp flags"]
+# 	bin/INSTALL [-h]
+#
+#         (where <HDFEOS-home-dir> is the full path of the HDFEOS of HDFEOS5  home directory)
+#
+# 	options:
+# 	  -dbug    : build debug version of hdfeos
+# 	  -f90     : build f90 version of the hdfeos
+# 	             optional flag -NAG specifies NAG f90
+# 	  -ABSOFT  : flag that specifies absoft f77 is used for 
+#                    fortran compilation
+# 	  -fc_path : set the path of the FORTRAN compiler to 
+#                    <path/compiler_name>
+# 	  -no_ftn  : build hdfeos without full FORTRAN support
+# 	  -cc_path : set the path of the C compiler to <path/compiler_name>
+# 	  -sgi     : build in -32  mode
+# 	  -sgi32   : build in -n32 mode (SGI Power Challenge only)
+# 	  -sgi64   : build in -64  mode (SGI Power Challenge only)
+# 	  -log     : send session output to new <log-file>
+# 	  -append  : append to existing <log-file>
+# 	  -notext  : skip long text messages
+# 	  -batch   : run script in batch (i.e. non-interactive) mode
+# 	  -pgshome : full path of HDF-EOS top level directory
+# 	             (e.g. /usr/local)
+# 	             NOTE: this does NOT allow you to install the HDF-EOS in a
+# 	             directory other than the one created from the HDF-EOS tar
+# 	             file.
+# 	  -hdfhome : full path to top level directory of installed HDF package
+# 	             package (e.g. /usr/local/hdf/sgi64/HDF4.2.6)
+# 	  -hdf5home: full path to top level directory of installed HDF5 package
+#                    package (e.g. /usr/localhdf/sgi64/hdf5-1.6.7)
+# 	  -hdfeos_home : full path to top level directory of installed HDF-EOS
+# 	                 package (e.g. /usr/local/hdfeos)
+# 	  -hdfeos5_home: full path to top level directory of installed HDF-EOS5
+#                        package (e.g. /usr/local/hdfeos5)
+# 	  -netcdfhome : full path to top level directory of installed netCDF 
+#                       package (e.g. /usr/local/NETCDF/sgi64/netcdf-3.6.1)
+# 	             package (e.g. /usr/local/hdf/sgi64/HDF4.2r6)
+# 	  -h       : display this help message and exit
+# 	  -cpp     : build C++ Version
+# 	  -cpp_path: set the path of the C++ compiler to <path> 
+# 	  -c_rlib  : build C threadsafe Version
+# 	  -cc_flags   : set some additional C flags (c flags)
+# 	  -fc_flags   : set some additional Fortran flags (f flags)
+# 	  -cpp_flags  : set some additional CPP flags (cpp flags)
+#
+#
+# notes:
+# 	1)  The -fc_path and -cc_path options tell the script where to find
+# 	    your compilers, in the event that they are in non-standard
+# 	    locations.  If the -NAG flag is specified, you should use the
+# 	    -fc_path option to specify the path where the NAG f90 compiler
+# 	    is located.
+#
+# 	    If you use -ABSOFT flag to specify that you are using absoft 
+# 	    Fortran compiler,  you should use the -fc_path option to specify 
+# 	    the path where the absoft f77 compiler is located.
+#
+# 	2)  The -pgshome switch allows you to explicity specify the top level
+# 	    directory.  This should be the full path upto and including
+# 	    the directory hdfeos or hdfeos5 created when you untarred the
+# 	    distribution file.  This switch CANNOT be used install the hdfeos/hdfeos5
+# 	    anywhere other than the aforementioned directory.
+#
+# 	    This switch may be useful when installing the hdfesoor hdeos5 in an
+# 	    automounted directory (in some cases the hdfeos will otherwise
+# 	    incorrectly set the value of the PGSHOME environment variable).
+#
+# 	3)  The -batch switch can be used to run this script in a non-
+# 	    interactive mode.  The script is not as flexible when run in this
+# 	    mode.  Namely, when using the script to install HDF and/or HDF-EOS,
+# 	    these packages will be installed under the hdfeos directory.  This
+# 	    behavior cannot be changed.  Also if you specify the -dbug switch
+# 	    the HDF and HDF-EOS will all be installed in debug mode.
+# 	    Finally if you attempt to install HDF and an installed HDF is found
+# 	    in the default location it will be deleted and the whole HDF 
+# 	    package will be reinstalled.  If you attempt to install HDF-EOS 
+# 	    and an hdfeos directory is found to exist in the default location
+# 	    it will be "re-used".
+#
+# 	4)  The -hdfhome, -hdf5home, -hdfeos_home, -hdfeos5_home and netcdfhome
+# 	    switches can be used to specify the location of previously
+# 	    installed HDF4, HDF5, HDF-EOS2, HDF-EOS5, and netCDF distributions
+# 	    (respectively).  These switches should ONLY be used when you do NOT
+# 	    intend to use this script to install HDF and/or HDF-EOS.
+# 	    The netcdf switch only used for renaming internal netCDF calls in
+# 	    HDF4 to avoid name symbol clashes if external netCDF package is 
+# 	    used with installed HDF4. 
+#
+# 	5)  The -cc_flags, -fc_flags, and cpp_flags options tell the script 
+# 	    to use some additional flags that are not default hdfeos flags. 
+# 	    Such flags may be needed when users try new compilers. For example 
+# 	    with gfortran which is not the default Fortran compiler for linux 
+# 	    user may need -ff2c and/or -fPIC.  In that case user should enter 
+# 	    -fc_flags "-ff2c -fPIC" on installation command line. Please note 
+# 	    that "" must be used around the entered flags as in the forementioned 
+# 	    gfortran example.
+#
+# author:
+# 	Mike Sucher / Applied Research Corp.
+# 	Guru Tej S. Khalsa / Applied Research Corp.
+#       Megan E. Donovan Spencer / Space Applications Corporation
+#       Abe Taaheri/Raytheon IIS
+#	Phuong T. Nguyen/EITI
+#
+# history:
+#       07-Dec-2011 AT  Used some part of Toolkit INSTALL script for this 
+#                       intial version
+#---------------------------------------------------------------------------------------
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+    if [ "$log_file" != "" ] ; then
+         echo "${this_script}: Error: $*" >> $log_file
+    fi
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    if [ "$1" = "-n" ] ; then		# -n: suppress leading blank line
+        shift
+    else
+        echo ""
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+        fi
+    fi
+
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+         echo "$*" >> $log_file
+    fi
+}
+
+#
+# Function to output long messages to logfile and console
+#
+
+NoteToLog()
+{
+    if [ "$1" = "-n" ] ; then		# -n: suppress leading blank line
+        shift
+    else
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+        fi
+    fi
+
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+         echo "$*" >> $log_file
+    fi
+}
+
+#
+# Function to output message to logfile only
+#
+
+Log()
+{
+    if [ "$1" = "-n" ] ; then		# -n: suppress leading blank line
+        shift
+    else
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+        fi
+    fi
+
+    if [ "$log_file" != "" ] ; then
+         echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function to prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $script_dir/INSTALL | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to silently emulate the 'which' command
+#
+
+Which()
+{
+    if [ "$1" = "" ] ; then
+        WriteError "Which() : Too few arguments."
+        exit 1
+    fi
+
+    saveifs="$IFS"
+    IFS=:
+    which_result=0
+    which_cmd=""
+
+    for dir in $PATH;  do
+        if [ -x $dir/$1 ] ; then
+            which_result=1
+            which_cmd=$dir/$1
+            break
+        fi
+    done
+
+    IFS="$saveifs"
+}
+
+#
+# Function to set up and export the following architecture-specific variables:
+#
+#         BRAND LOGNAME PATH USER
+#
+
+
+SetArchitecture()
+{
+    # set path to a base subset of directories, allowing startup on unknown host
+    # note: once the architecture has been determined the path is customized
+
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11
+
+
+    # get operating system type, login name
+    # special cases: SCO and Cray  - uname works differently,
+
+    pgs_machine=`uname -m | awk '{print $1}'`	# needed on Cray & SCO
+    pgs_temp_ostype=`uname`
+
+    case "$pgs_machine" in
+
+	i386 )        			# SCO box
+	    pgs_ostype=sco386
+	;;
+
+	CRAY )    				# CRAY
+	    pgs_ostype=UNICOS
+	;;
+
+	* )					# everybody else
+	    pgs_ostype=`uname`
+	;;
+
+    esac
+
+# Intel Macintosh is also i386 or i686 (?) machine
+
+    if [ "$pgs_machine" = "i386" ] ; then
+	if [ "$pgs_temp_ostype" = "Darwin" ] ; then 
+	    pgs_ostype=DarwinIntel
+	fi
+	if [ "`uname | awk -F_ '{print $1}'`" = "CYGWIN" ] ; then 
+	    pgs_ostype=Cygwin
+	fi
+    fi
+    if [ "$pgs_machine" = "i686" ] ; then
+	if [ "$pgs_temp_ostype" = "Darwin" ] ; then 
+	    pgs_ostype=DarwinIntel
+	fi
+	if [ "`uname | awk -F_ '{print $1}'`" = "CYGWIN" ] ; then 
+	    pgs_ostype=Cygwin
+	fi
+    fi
+
+    if [ "$pgs_machine" = "x86_64" ] ; then
+	if [ "$pgs_temp_ostype" = "Darwin" ] ; then 
+	    pgs_ostype=DarwinIntel
+	fi
+	if [ "`uname | awk -F_ '{print $1}'`" = "CYGWIN" ] ; then 
+	    pgs_ostype=Cygwin
+	fi
+    fi
+
+    if [ "$pgs_machine" = "ia64" ] ; then
+	if [ "$pgs_temp_ostype" = "Darwin" ] ; then 
+	    pgs_ostype=DarwinIntel
+	fi
+	if [ "`uname | awk -F_ '{print $1}'`" = "CYGWIN" ] ; then 
+	    pgs_ostype=Cygwin
+	fi
+    fi
+
+# For MAC Intel machines there is another way for determining 64-bit hardware
+    if [ "$pgs_temp_ostype" = "Darwin" ] ; then
+	if [ "$pgs_machine" = "ia64" ] ||  [ "$pgs_machine" = "i686" ] || [ "$pgs_machine" = "i386" ] || [ "$pgs_machine" = "x86_64" ] ; then
+	    pgs_ostype=DarwinIntel
+	else
+# if still we could not determine pgs_machine
+	    MACis64=`sysctl -n hw.cpu64bit_capable`
+	    if [ $MACis64 = 1 ] ; then
+# Machine is definitly 64-bit and is MacIntel type
+		pgs_ostype=DarwinIntel
+		pgs_machine=x86_64
+	    fi
+	fi
+    fi
+
+    pgs_user=`id | cut -d\( -f2 | cut -d\) -f1`
+    if [ "$LOGNAME" = "" ] ; then 		# make sure $LOGNAME is defined
+	LOGNAME=$pgs_user
+	export LOGNAME
+    fi
+    if [ "$USER" = "" ] ; then 		# make sure $LOGNAME is defined
+	USER=$LOGNAME
+	export USER
+    fi
+
+    # set machine-depdoneent environment variables:
+    # 	pgs_host  the host name of this machine
+    # 	   BRAND  used by other achitecture-specific code
+    #       PATH  the execution search path
+
+    case "$pgs_ostype" in
+
+	AIX )
+	    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/ccs/bin:/usr/sbin
+	    pgs_host=`hostname`
+	    BRAND=ibm
+	;;
+
+	HP-UX )
+	    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bin/X11
+	    pgs_host=`hostname`
+	    BRAND=hp
+	;;
+
+	IRIX )
+	    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bsd:/usr/bin/X11:/usr/sbin
+	    pgs_host=`hostname`
+	    BRAND=sgi
+	    sgi_mode=32
+	;;
+
+	IRIX64 )
+	    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bsd:/usr/bin/X11:/usr/sbin
+	    pgs_host=`hostname`
+	    case "$sgi_mode" in
+		n32 )
+		    BRAND=sgi32
+		;;
+		64 )
+		    BRAND=sgi64
+		;;
+		old32 )
+		    BRAND=sgi
+		    sgi_mode=32
+		;;
+		* )
+		    EchoAndLog "The default HDF-EOS SGI installation is now 64 bit (sgi64). Other"
+		    EchoAndLog "available HDF-EOS SGI installation modes are new 32 bit (sgi32) and"
+		    EchoAndLog "old 32 bit (sgi)."
+		    EchoAndLog ""
+		    BRAND=sgi64
+		    sgi_mode=64
+		    if [ $batch_mode = 0 ] ; then
+			UserPrompt "Which SGI installation mode would you like [sgi64]"
+		    else
+			user_response=sgi64
+		    fi
+		    case "$user_response" in
+			sgi64 | "" )
+			    EchoAndLog ""
+			    EchoAndLog "Installing in $BRAND (64 bit) mode..."
+			    EchoAndLog ""
+		        ;;
+			sgi32 )
+			    BRAND=$user_response
+			    sgi_mode=n32
+			    EchoAndLog ""
+			    EchoAndLog "Installing in $BRAND (new 32 bit) mode..."
+			    EchoAndLog ""
+		        ;;
+			sgi )
+			    BRAND=$user_response
+			    sgi_mode=32
+			    EchoAndLog ""
+			    EchoAndLog "Installing in $BRAND (old 32 bit) mode..."
+			    EchoAndLog ""
+		        ;;
+			* )
+			    EchoAndLog ""
+			    EchoAndLog "Unknown installation mode: $user_response."
+			    EchoAndLog "Installation cancelled."
+			    exit 1
+			;;
+		    esac
+		;;
+	    esac
+	;;
+
+	Linux )
+	    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/X11/bin
+	    pgs_host=`hostname`
+	    LNX_COMP_FLAG=""
+	    export LNX_COMP_FLAG
+
+	    case "$pgs_machine" in
+
+		i686 )
+		    # Machine is 32-bit and Installation will be in 32-bit Mode.
+		    EchoAndLog "The default HDF-EOS LINUX installation for this machine is 32 bit."
+		    EchoAndLog "HDF-EOS and other software will be installed in 32 bit Mode."
+		    EchoAndLog ""
+		    #in 32 bit machine no need for -m32 flag
+		    LNX_COMP_FLAG=""
+		    export LNX_COMP_FLAG
+		    BRAND=linux
+		    LINUX_BRAND=linux
+		;;
+		
+		x86_64 | ia64 )
+		    # Machine is 64-bit and Installation will be in 32-bit or 
+		    # 64-bit Mode.
+		    NoteToLog "Note: If your system is CentOS linux, you may need -fPIC compilation flag."
+		    NoteToLog "If that is the case you better quit here (using Ctrl-c) and re-start"
+		    NoteToLog "installation with additional arguments -cc_flags \"-fPIC\" and/or "
+		    NoteToLog "-cpp_flags \"-fPIC\" and -fc_flags \"-fPIC\" if you have not done so."
+		    NoteToLog "You may type bin/INSTALL -h to see notes on how to add additional"
+		    NoteToLog "compilation flags"
+		    NoteToLog "The default HDF-EOS LINUX installation for this machine is 64 bit. Other"
+		    NoteToLog "available HDF-EOS LINUX installation mode is 32 bit Mode"
+		    NoteToLog ""
+		    
+		    if [ $batch_mode = 0 ] ; then
+			UserPrompt "Which LINUX installation mode would you like? lnx32 or lnx64 ? [lnx64]"
+		    else
+			user_response=lnx64
+		    fi
+
+		    case "$user_response" in
+			lnx64 | "" )
+			    EchoAndLog ""
+			    EchoAndLog "Installing in $BRAND (64 bit) mode..."
+			    EchoAndLog ""
+			    #in 64 bit machine no need for any flag
+			    #for 64-bit installation
+			    LNX_COMP_FLAG=""
+			    export LNX_COMP_FLAG
+			    BRAND=linux64
+			    LINUX_BRAND=linux64
+			;;
+		    
+			lnx32 )
+			    EchoAndLog ""
+			    EchoAndLog "Installing in $BRAND (32 bit) mode..."
+			    EchoAndLog ""
+			    #in 64 bit machine we need -m32 flag
+			    #for 32-bit installation
+			    LNX_COMP_FLAG="-m32"
+			    export LNX_COMP_FLAG
+			    BRAND=linux32
+			    LINUX_BRAND=linux32
+			;;
+			
+			* )
+			    EchoAndLog ""
+			    EchoAndLog "Unknown installation mode: $user_response."
+			    EchoAndLog "Needed lnx32 or lnx64 responses."
+			    EchoAndLog "Installation cancelled."
+			    exit 1
+			;;
+		    esac
+		;;
+	    esac
+	;;
+
+        Darwin )
+            PATH=/bin:/sbin:/usr/bin:/usr/sbin
+            pgs_host=`hostname`
+            BRAND=macintosh
+        ;;
+
+        DarwinIntel )
+            PATH=/bin:/sbin:/usr/bin:/usr/sbin
+            pgs_host=`hostname`
+            BRAND=macintel
+	    MACINTEL_COMP_FLAG="-m32"
+	    export MACINTEL_COMP_FLAG
+
+	    case "$pgs_machine" in
+		
+		x86_64 | ia64 | i686 | i386)
+		    # Machine is 64-bit and Installation will be in 32-bit or 
+		    # 64-bit Mode.
+		    EchoAndLog "The default HDF-EOS MACINTEL installation for this machine is 32 bit. Other"
+		    EchoAndLog "available HDF-EOS MACINTEL installation mode is 64 bit Mode"
+		    EchoAndLog ""
+		    
+		    if [ $batch_mode = 0 ] ; then
+			UserPrompt "Which MAC installation mode would you like? mac32 or mac64 ? [mac64]"
+		    else
+			user_response=mac64
+		    fi
+
+		    case "$user_response" in
+			mac64 | "" )
+			    EchoAndLog ""
+			    EchoAndLog "Installing in $BRAND (64 bit) mode..."
+			    EchoAndLog ""
+			    #in 64 bit machine we need -fPIC flag
+			    #for 64-bit installation
+			    MACINTEL_COMP_FLAG="-mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk -fPIC"
+			    export MACINTEL_COMP_FLAG
+			    BRAND=macintel64
+			    MAC_BRAND=macintel64
+			;;
+		    
+			mac32 )
+			    EchoAndLog ""
+			    EchoAndLog "Installing in $BRAND (32 bit) mode..."
+			    EchoAndLog ""
+			    #in 64 bit machine we need -m32 flag
+			    #for 32-bit installation
+			    MACINTEL_COMP_FLAG="-m32"
+			    export MACINTEL_COMP_FLAG
+			    BRAND=macintel32
+			    MAC_BRAND=macintel32
+			;;
+			
+			* )
+			    EchoAndLog ""
+			    EchoAndLog "Unknown installation mode: $user_response."
+			    EchoAndLog "Needed mac32 or mac64 responses."
+			    EchoAndLog "Installation cancelled."
+			    exit 1
+			;;
+		    esac
+		;;
+	    esac
+        ;;
+
+        Cygwin )
+            PATH=/bin:/sbin:/usr/bin:/usr/sbin
+            pgs_host=`hostname`
+            BRAND=cygwin
+        ;;
+
+	OSF1 )
+	    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/ccs/bin:/usr/sbin
+	    pgs_host=`hostname -s`
+	    BRAND=dec
+	;;
+
+	sco386 )
+	    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bin/X11
+	    pgs_host=`hostname -s`
+	    BRAND=sco
+	;;
+
+	SunOS )
+	    # distinguish between SunOS 5.x and 4.x versions
+	    if [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 10" ] ; then
+		BRAND="sun5.10"			# release V5.10 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+	    elif [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 9" ] ; then
+		BRAND="sun5.9"			# release V5.9 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+	    elif [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 8" ] ; then
+		BRAND="sun5.8"			# release V5.8 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+	    else
+                BRAND="sun5"			# release V5.x SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/ccs/bin:/usr/sbin
+            fi
+            if [ "`uname -r | awk -F. '{print $1}'`" = "4" ] ; then
+		BRAND="sun4"			# release V4.x SunOS
+		PATH=/usr/local/bin:/usr/local/lang:/usr/lang:/usr/ucb:/bin:/usr/bin:/etc:/usr/etc:/usr/openwin/bin:/usr/openwin/demo
+	    fi
+	    pgs_host=`hostname`
+	;;
+
+	UNICOS )
+	    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/ucb:/usr/bin/X11
+	    pgs_host=`hostname`
+	    BRAND=cray
+	;;
+
+	* )
+	    WriteError "Operating system: $pgs_ostype not supported"
+	    WriteError "This release of the HDF-EOS supports: "
+	    WriteError "   Sun SGI Cygwin Darwin/Darwin Intel Linux IRIX/IRIX64 HP-9000 IBM-6000 DEC-Alpha and Cray/Unicos "
+	    exit 1
+	;;
+
+    esac
+
+
+    # export the architecture-specific variables
+
+    export LINUX_BRAND MAC_BRAND
+    export BRAND PATH
+}
+
+#
+# Function to install HDF (or get location of HDF installation)
+#
+
+InstallHdf()
+{
+    hdf_flags=""
+    hdf5_flags=""
+    current_zlib="zlib-1.2.8"
+    current_jpeg="jpeg-6b"
+    current_hdf="hdf-4.2.10"
+    current_hdf5="hdf5-1.8.12"
+    current_szip="szip-2.1"
+
+    if [ "$notext" = "0" -a "$batch_mode" = 0 ] ; then
+
+        more << EOF
+                    *        *        *
+
+The current releases of HDF to be installed:
+
+      $current_hdf   or    $current_hdf5
+
+If these release of HDF are already installed on your host, you may enter
+its location when prompted.  The installation procedure will then attempt
+to use your copy of HDF to build the hdfeos.   Note: this may not work if
+your HDF installation uses a non-standard directory structure for the
+installed library and header files.
+
+If the correct releases of HDF are not installed on your host, or you wish
+to re-install, you will have an opportunity to install them momentarily.  In
+order to do this, you must already have downloaded the HDF distribution
+files and szip tar file, if you wish to install HDF5 with szib.  It is 
+available on the same ftp server where the toolkit distribution files are 
+located.
+
+                    *        *        *
+
+HDF4 uses an internal netCDF library. If you are going to use your externally
+installed netCDF, then HDF4 will be installed with --disable-netcdf so that 
+netCDF function in HDF4 are renamed, avoiding clash between name symbols of 
+the internal and external netCDF packages.
+
+If you answer NO to the question below regarding the netCDF (HDF4 installation
+section), or if you already have installed HDF4 that has not been configured 
+with the  --disable-netcdf flag, then there is a possibility that you may not 
+be able to use your externally installed netCDF in applications that use the 
+installed HDF4, or  HDF-EOS here. 
+
+You may check your pre-installed libmfhdf.a library with 
+"strings libmfhdf.a|grep sd_ncopen", to see if it contains sd_ncopen. If yes, 
+then you can use external netCDF in your applications that also uses your HDF4.
+
+EOF
+
+        UserPrompt "Continue installation [yes]"
+	case  "$user_response" in
+	    n* | N* )
+		EchoAndLog "Installation cancelled."
+		exit 0
+	    ;;
+	esac
+    fi
+
+
+    #
+    # Select ZLIB installation option
+    #
+     
+    zlib_installed=0     # assume ZLIB is not installed
+
+    if [ $batch_mode = 0 -a "$zlibhome" = "" ] ; then
+        UserPrompt "Is $current_zlib installed at your site [no]"
+        case "$user_response" in
+            y* | Y* )
+                zlib_installed=1
+            ;;
+        esac
+    elif [ "$zlibhome" != "" ] ; then
+            zlib_installed=1
+    fi
+
+    if [ $zlib_installed = 1 ] ; then
+
+        #
+        # The user says ZLIB is installed: ask where it is located (if not in batch mode)
+        #
+
+
+        if [ $batch_mode = 0 -a "$zlibhome" = "" ] ; then
+            ZLIB_path="$PGSHOME/zlib/$BRAND/$current_zlib"
+            UserPrompt "Pathname where $current_zlib is installed [$ZLIB_path]"
+
+	    if [ "$user_response" != "" ] ; then
+                if [ -d "$user_response" ] ; then
+                    ZLIB_path="$user_response"
+                fi
+            fi
+        else
+            ZLIB_path=$zlibhome
+        fi
+
+        #
+        # Make sure it is really there.
+        #
+
+        if  [ -d ${ZLIB_path} ] ; then
+
+            if [ -d ${ZLIB_path}/${current_zlib} ] ; then
+                temp=`basename ${ZLIB_path}`
+                if [ "$temp" != "$current_zlib" ] ; then
+                    zlibdirs="${ZLIB_path}/${current_zlib} ${ZLIB_path} ${ZLIB_path}/${current_zlib}/NewZLIB ${ZLIB_path}/NewZLIB"
+                else
+                    zlibdirs="${ZLIB_path}  ${ZLIB_path}/NewZLIB ${ZLIB_path}/${current_zlib} ${ZLIB_path}/${current_zlib}/NewZLIB"
+                fi
+            else
+                zlibdirs="${ZLIB_path} ${ZLIB_path}/NewZLIB"
+            fi
+
+            #
+            # Check for critical ZLIB directories
+            #
+
+            found=0                     # check for lib directory
+            for dir in ${zlibdirs} ; do
+                if [ -d $dir/lib -a -d $dir/include ] ; then
+                    ZLIBHOME=${dir}
+                    export ZLIBHOME
+                    found=1
+                    break
+                fi
+            done
+
+            if [ $found = 0 ] ; then
+                Done "The ZLIB lib or include directory was not found."
+            fi
+
+
+            EchoAndLog "Setting ZLIB home directory to: $ZLIBHOME"
+
+ else
+
+            Done "Specified ZLIB directory ($ZLIB_path) does not exist"
+
+        fi
+
+        zlib_installed=1         # flag ZLIB as successfully installed
+
+    else
+
+        #
+        # The user says ZLIB is NOT installed: ask if it should be installed now
+        #
+        if [ $batch_mode = 0 ] ; then
+            UserPrompt "Do you wish to install $current_zlib now [yes]"
+        else
+            user_response=y
+        fi
+        case  "$user_response" in
+            n* | N* )
+            ;;
+            * )
+                # Run the ZLIB installation script
+                #
+                #
+
+                EchoAndLog "Running the ZLIB Installation Script ..."
+
+                # set installation flags
+
+                home_file=${PGSHOME}/.install-zlibhome
+                zlib_flags="-cleano -w_home $home_file"
+
+                if [ "$log_file" != "" ] ; then
+                    zlib_flags="$zlib_flags -log $log_file -append"
+                fi
+
+
+                if [ "$sgi_mode" = "n32" ] ; then       # set flag for SGI n32 mode
+                    zlib_flags="$zlib_flags -sgi32"
+                elif [ "$sgi_mode" = "64" ] ; then      # set flag for SGI 64-bit mode
+                    zlib_flags="$zlib_flags -sgi64"
+                fi
+
+                if [ "$f90_flag" = "1" ] ; then # set flag for f90 build
+
+                    zlib_flags="$zlib_flags -f90"
+
+                    if [ "$nag_flag" = "1" ] ; then     # using NAG f90
+                        zlib_flags="$zlib_flags -NAG"
+                    fi
+
+                fi
+
+		if [ "$absoft_flag" = "1" ] ; then     # using ABSOFT F77
+		    zlib_flags="$zlib_flags -ABSOFT"
+		fi
+
+                if [ "$fc_path" != "" ] ; then          # path for FORTRAN compiler
+                    zlib_flags="$zlib_flags -fc_path $fc_path"
+                fi
+
+                if [ "$cc_path" != "" ] ; then          # path for C compiler
+                    zlib_flags="$zlib_flags -cc_path $cc_path"
+                fi
+
+                if [ $batch_mode = 1 ] ; then           # batch mode
+                    zlib_flags="$zlib_flags -batch"
+                fi
+
+                # run the installation script
+
+                $script_dir/INSTALL-Scripts/INSTALL-ZLIB $zlib_flags -install_dir $PGSHOME/zlib/$BRAND
+                if [ "$?" != "0" ] ; then
+                    Done "The ZLIB Installation Script failed or had errors."
+                fi
+
+                # get ZLIB home directory from the ZLIB installation
+
+                ZLIBHOME="`cat $home_file`"
+                export ZLIBHOME
+                if [ "$?" != "0" ] ; then
+                    Done "Unable to get ZLIB home directory."
+                fi
+                if [ -f "$home_file" ] ; then
+                    \rm -f $home_file   # clean up the zlibhome file
+                fi
+                zlib_installed=1         # flag HDF as successfully installed
+            ;;
+        esac
+ fi
+
+    #
+    # Set ZLIB directories:
+    #
+    # - first look in $ZLIBHOME
+    # - if not found, default to $ZLIBHOME/zlib
+    #
+
+    if [ $?ZLIBHOME ] ; then
+
+
+        if [  -d $ZLIBHOME/include  ] ; then     # ZLIB header files
+            ZLIBINC=$ZLIBHOME/include
+        else
+            ZLIBINC=$ZLIBHOME/zlib/include
+        fi
+
+        if [  -d $ZLIBHOME/lib  ] ; then         # ZLIB libraries
+            ZLIBLIB=$ZLIBHOME/lib
+        else
+            ZLIBLIB=$ZLIBHOME/zlib/lib
+        fi
+
+        export ZLIBHOME ZLIBINC ZLIBLIB
+    fi
+
+    #
+    # Select JPEG installation option.
+    #
+
+   jpeg_installed=0     # assume JPEG is not installed
+
+    if [ $batch_mode = 0 -a "$jpeghome" = "" ] ; then
+        UserPrompt "Is $current_jpeg installed at your site [no]"
+        case "$user_response" in
+            y* | Y* )
+                jpeg_installed=1
+            ;;
+        esac
+    elif [ "$jpeghome" != "" ] ; then
+            jpeg_installed=1
+    fi
+
+    if [ $jpeg_installed = 1 ] ; then
+
+        #
+        # The user says JPEG is installed: ask where it is located (if not in batch mode)
+        #
+
+
+        if [ $batch_mode = 0 -a "$jpeghome" = "" ] ; then
+            JPEG_path="$PGSHOME/jpeg/$BRAND/$current_jpeg"
+            UserPrompt "Pathname where $current_jpeg is installed [$JPEG_path]"
+
+            if [ "$user_response" != "" ] ; then
+                if [ -d "$user_response" ] ; then
+                    JPEG_path="$user_response"
+                fi
+            fi
+        else
+            JPEG_path=$jpeghome
+        fi
+
+        #
+        # Make sure it is really there.
+        #
+if  [ -d ${JPEG_path} ] ; then
+
+            if [ -d ${JPEG_path}/${current_jpeg} ] ; then
+                temp=`basename ${JPEG_path}`
+                if [ "$temp" != "$current_jpeg" ] ; then
+                    hdfdirs="${JPEG_path}/${current_jpeg} ${JPEG_path} ${JPEG_path}/${current_jpeg}/NewJPEG ${JPEG_pa
+th}/NewJPEG"
+                else
+                    jpegdirs="${JPEG_path}  ${JPEG_path}/NewJPEG ${JPEG_path}/${current_jpeg} ${JPEG_path}/${current_
+jpeg}/NewJPEG"
+                fi
+            else
+                jpegdirs="${JPEG_path} ${JPEG_path}/NewJPEG"
+            fi
+
+            #
+            # Check for critical JPEG directories
+            #
+
+            found=0                     # check for lib directory
+            for dir in ${jpegdirs} ; do
+                if [ -d $dir/lib -a -d $dir/include ] ; then
+                    JPEGHOME=${dir}
+                    export JPEGHOME
+                    found=1
+                    break
+                fi
+            done
+
+            if [ $found = 0 ] ; then
+                Done "The JPEG lib or include directory was not found."
+            fi
+
+
+            EchoAndLog "Setting JPEG home directory to: $JPEGHOME"
+
+        else
+
+            Done "Specified JPEG directory ($JPEG_path) does not exist"
+
+        fi
+
+        jpeg_installed=1         # flag JPEG as successfully installed
+
+    else
+#
+        # The user says JPEG is NOT installed: ask if it should be installed now
+        #
+        if [ $batch_mode = 0 ] ; then
+            UserPrompt "Do you wish to install $current_jpeg now [yes]"
+        else
+            user_response=y
+        fi
+        case  "$user_response" in
+            n* | N* )
+            ;;
+            * )
+                # Run the JPEG installation script
+                #
+                #
+
+                EchoAndLog "Running the JPEG Installation Script ..."
+
+                # set installation flags
+
+                home_file=${PGSHOME}/.install-jpeghome
+                jpeg_flags="-cleano -w_home $home_file"
+
+                if [ "$log_file" != "" ] ; then
+                    jpeg_flags="$jpeg_flags -log $log_file -append"
+                fi
+
+          if [ "$sgi_mode" = "n32" ] ; then       # set flag for SGI n32 mode
+                    jpeg_flags="$jpeg_flags -sgi32"
+                elif [ "$sgi_mode" = "64" ] ; then      # set flag for SGI 64-bit mode
+                    jpeg_flags="$jpeg_flags -sgi64"
+                fi
+
+                if [ "$f90_flag" = "1" ] ; then # set flag for f90 build
+
+                    jpeg_flags="$jpeg_flags -f90"
+
+                    if [ "$nag_flag" = "1" ] ; then     # using NAG f90
+                        jpeg_flags="$jpeg_flags -NAG"
+                    fi
+
+                fi
+
+		if [ "$absoft_flag" = "1" ] ; then     # using ABSOFT F77
+		    jpeg_flags="$jpeg_flags -ABSOFT"
+		fi
+
+                if [ "$fc_path" != "" ] ; then          # path for FORTRAN compiler
+                    jpeg_flags="$jpeg_flags -fc_path $fc_path"
+                fi
+
+                if [ "$cc_path" != "" ] ; then          # path for C compiler
+                    jpeg_flags="$jpeg_flags -cc_path $cc_path"
+                fi
+
+                if [ $batch_mode = 1 ] ; then           # batch mode
+                    jpeg_flags="$jpeg_flags -batch"
+                fi
+
+                # run the installation script
+
+                $script_dir/INSTALL-Scripts/INSTALL-JPEG $jpeg_flags -install_dir $PGSHOME/jpeg/$BRAND
+                if [ "$?" != "0" ] ; then
+                    Done "The JPEG Installation Script failed or had errors."
+                fi
+
+                # get JPEG home directory from the JPEG installation
+
+                JPEGHOME="`cat $home_file`"
+                export JPEGHOME
+                if [ "$?" != "0" ] ; then
+                    Done "Unable to get JPEG home directory."
+                fi
+                if [ -f "$home_file" ] ; then
+                    \rm -f $home_file   # clean up the jpeghome file
+                fi
+                jpeg_installed=1         # flag JPEG as successfully installed
+            ;;
+        esac
+fi
+
+    #
+    # Set JPEG directories:
+    #
+    # - first look in $JPEGHOME
+    # - if not found, default to $JPEGHOME/jpeg
+    #
+
+    if [ $?JPEGHOME ] ; then
+
+        if [  -d $JPEGHOME/bin  ] ; then         # JPEG utilities
+            JPEGBIN=$JPEGHOME/bin
+        else
+            JPEGBIN=$JPEGHOME/jpeg/bin
+        fi
+
+        if [  -d $JPEGHOME/include  ] ; then         # JPEG headers 
+            JPEGINC=$JPEGHOME/include
+        else
+            JPEGINC=$JPEGHOME/jpeg/include
+        fi
+        
+        if [  -d $JPEGHOME/lib  ] ; then         # JPEG libraries 
+            JPEGLIB=$JPEGHOME/lib
+        else
+            JPEGLIB=$JPEGHOME/jpeg/lib
+        fi
+
+        export JPEGHOME JPEGBIN JPEGINC JPEGLIB
+    fi
+
+
+    #
+    # Select SZIP installation option.
+    #
+
+    szip_installed=0    # assume SZIP is not installed
+
+    if [ $batch_mode = 0 -a "$sziphome" = "" ] ; then
+        UserPrompt "Is $current_szip installed at your site [no]"
+        case "$user_response" in
+            y* | Y* )
+                szip_installed=1
+            ;;
+        esac
+    elif [ "$sziphome" != "" ] ; then
+            szip_installed=1
+    fi
+
+    if [ $szip_installed = 1 ] ; then
+
+        #
+        # The user says SZIP is installed: ask where it is located 
+        #(if not in batch mode)
+        #
+
+
+        if [ $batch_mode = 0 -a "$sziphome" = "" ] ; then
+            SZIP_path="$PGSHOME/szip/$BRAND/$current_szip"
+            UserPrompt "Pathname where $current_szip is installed [$SZIP_path]"
+
+            if [ "$user_response" != "" ] ; then
+                if [ -d "$user_response" ] ; then
+                    SZIP_path="$user_response"
+                fi
+            fi
+        else
+            SZIP_path=$sziphome
+        fi
+
+        #
+        # Make sure it is really there.
+        #
+
+        if  [ -d ${SZIP_path} ] ; then
+
+            if [ -d ${SZIP_path}/${current_szip} ] ; then
+                temp=`basename ${SZIP_path}`
+                if [ "$temp" != "$current_szip" ] ; then
+                    szipdirs="${SZIP_path}/${current_szip} ${SZIP_path} ${SZIP_path}/${current_szip}/NewSZIP ${SZIP_path}/NewSZIP"
+                else
+                    szipdirs="${SZIP_path}  ${SZIP_path}/NewSZIP ${SZIP_path}/${current_szip} ${SZIP_path}/${current_szip}/NewSZIP"
+                fi
+            else
+                szipdirs="${SZIP_path} ${SZIP_path}/NewSZIP"
+            fi
+
+            #
+            # Check for critical SZIP directories
+            #
+
+            found=0                     # check for lib directory
+            for dir in ${szipdirs} ; do
+                if [ -d $dir/lib -a -d $dir/include ] ; then
+                    SZIPHOME=${dir}
+                    export SZIPHOME
+                    found=1
+                    break
+                fi
+            done
+
+            if [ $found = 0 ] ; then
+                Done "The SZIP lib or include directory was not found."
+            fi
+
+
+            EchoAndLog "Setting SZIP home directory to: $SZIPHOME"
+
+        else
+
+            Done "Specified SZIP directory ($SZIP_path) does not exist"
+
+        fi
+
+        szip_installed=1                # flag SZIP as successfully installed
+
+    else
+
+        #
+        # The user says SZIP is NOT installed:ask if it should be installed now
+        #
+        if [ $batch_mode = 0 ] ; then
+	    EchoAndLog "WARNING: Commercial users should obtain szip license"
+	    EchoAndLog "if they intend to distribute their products with szip"
+	    EchoAndLog "encoder. The szip decoder does not require license."
+            UserPrompt "Do you wish to install full $current_szip (encoder + decoder) [yes]"
+        else
+            user_response=y
+        fi
+        case  "$user_response" in
+            n* | N* )
+		szip_encode=n
+		export szip_encode
+                EchoAndLog "Running the SZIP (without encoding) Installation Script  ..."
+            ;;
+            * )
+		szip_encode=y
+		export szip_encode
+                EchoAndLog "Running the SZIP (with encoding) Installation Script ..."
+	    ;;
+       esac
+	
+                # Run the SZIP installation script
+                #
+                #
+
+                # set installation flags
+
+                home_file=${PGSHOME}/.install-sziphome
+                szip_flags="-cleano -w_home $home_file"
+
+                if [ "$log_file" != "" ] ; then
+                    szip_flags="$szip_flags -log $log_file -append"
+                fi
+
+                if [ "$sgi_mode" = "n32" ] ; then       # set flag for SGI n32 mode
+                    szip_flags="$szip_flags -sgi32"
+                elif [ "$sgi_mode" = "64" ] ; then      # set flag for SGI 64-bit mode
+                    szip_flags="$szip_flags -sgi64"
+                fi
+
+                if [ "$f90_flag" = "1" ] ; then # set flag for f90 build
+
+                    szip_flags="$szip_flags -f90"
+
+                    if [ "$nag_flag" = "1" ] ; then     # using NAG f90
+                        szip_flags="$szip_flags -NAG"
+                    fi
+
+                fi
+
+		if [ "$absoft_flag" = "1" ] ; then     # using ABSOFT F77
+		    szip_flags="$szip_flags -ABSOFT"
+		fi
+
+                if [ "$fc_path" != "" ] ; then          # path for FORTRAN compiler
+                    szip_flags="$szip_flags -fc_path $fc_path"
+                fi
+
+                if [ "$cc_path" != "" ] ; then          # path for C compiler
+                    szip_flags="$szip_flags -cc_path $cc_path"
+                fi
+
+                if [ $batch_mode = 1 ] ; then           # batch mode
+                    szip_flags="$szip_flags -batch"
+                fi
+
+                # run the installation script
+
+                $script_dir/INSTALL-Scripts/INSTALL-SZIP $szip_flags -install_dir $PGSHOME/szip/$BRAND
+                if [ "$?" != "0" ] ; then
+                    Done "The SZIP Installation Script failed or had errors."
+                fi
+
+                # get SZIP home directory from the SZIP installation
+
+                SZIPHOME="`cat $home_file`"
+                export SZIPHOME
+                if [ "$?" != "0" ] ; then
+                    Done "Unable to get SZIP home directory."
+                fi
+                if [ -f "$home_file" ] ; then
+                    \rm -f $home_file   # clean up the sziphome file
+                fi
+                szip_installed=1                # flag SZIP as successfully installed
+
+    fi
+
+    #
+    # Set SZIP directories:
+    #
+    # - first look in $SZIPHOME
+    # - if not found, default to $SZIPHOME/szip
+    #
+
+    if [ $?SZIPHOME ] ; then
+
+        if [  -d $SZIPHOME/include  ] ; then    # SZIP header files
+            SZIPINC=$SZIPHOME/include
+        else
+            SZIPINC=$SZIPHOME/szip/include
+        fi
+
+        if [  -d $SZIPHOME/lib  ] ; then                # SZIP libraries
+	    SZIPLIB=$SZIPHOME/lib
+	    echo "Setting LD_LIBRARY_PATH to $SZIPLIB"
+	    LD_LIBRARY_PATH=$SZIPLIB                    # For SZIP Shared libs
+        else
+            SZIPLIB=$SZIPHOME/szip/lib
+	    echo "Setting LD_LIBRARY_PATH to $SZIPLIB"
+	    LD_LIBRARY_PATH=$SZIPLIB                    # For SZIP Shared libs
+        fi
+
+        export SZIPHOME SZIPINC SZIPLIB LD_LIBRARY_PATH
+    fi
+
+
+    #
+    # Select HDF installation option.
+    #
+
+    hdf_installed=0	# assume HDF is not installed
+
+    if [ $batch_mode = 0 -a "$hdfhome" = "" ] ; then
+	UserPrompt "Is $current_hdf installed at your site [no]"
+	case "$user_response" in
+	    y* | Y* )
+		hdf_installed=1
+	    ;;
+	esac
+    elif [ "$hdfhome" != "" ] ; then
+	    hdf_installed=1
+    fi
+
+    if [ $hdf_installed = 1 ] ; then
+
+	#
+	# The user says HDF is installed: ask where it is located (if not in batch mode)
+	#
+
+
+	if [ $batch_mode = 0 -a "$hdfhome" = "" ] ; then
+	    HDF_path="$PGSHOME/hdf/$BRAND/$current_hdf"
+	    UserPrompt "Pathname where $current_hdf is installed [$HDF_path]"
+
+	    if [ "$user_response" != "" ] ; then
+		if [ -d "$user_response" ] ; then
+		    HDF_path="$user_response"
+		fi
+	    fi
+        else
+	    HDF_path=$hdfhome
+	fi
+
+	#
+	# Make sure it is really there.
+	#
+
+	if  [ -d ${HDF_path} ] ; then
+
+	    if [ -d ${HDF_path}/${current_hdf} ] ; then
+		temp=`basename ${HDF_path}`
+		if [ "$temp" != "$current_hdf" ] ; then
+		    hdfdirs="${HDF_path}/${current_hdf} ${HDF_path} ${HDF_path}/${current_hdf}/NewHDF ${HDF_path}/NewHDF"
+		else
+		    hdfdirs="${HDF_path}  ${HDF_path}/NewHDF ${HDF_path}/${current_hdf} ${HDF_path}/${current_hdf}/NewHDF"
+		fi
+	    else
+		hdfdirs="${HDF_path} ${HDF_path}/NewHDF"
+	    fi
+
+	    #
+	    # Check for critical HDF directories
+	    #
+
+	    found=0			# check for lib directory
+	    for dir in ${hdfdirs} ; do
+		if [ -d $dir/lib -a -d $dir/include ] ; then
+	            HDFHOME=${dir}
+	            export HDFHOME
+		    found=1
+		    break
+		fi
+	    done
+
+	    if [ $found = 0 ] ; then
+		Done "The HDF lib or include directory was not found."
+	    fi
+
+
+	    EchoAndLog "Setting HDF home directory to: $HDFHOME"
+
+	else
+
+	    Done "Specified HDF directory ($HDF_path) does not exist"
+
+	fi
+
+	hdf_installed=1		# flag HDF as successfully installed
+
+    else
+
+	#
+	# The user says HDF is NOT installed: ask if it should be installed now
+	#
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "Do you wish to install $current_hdf now [yes]"
+	else
+	    user_response=y
+	fi
+	case  "$user_response" in
+	    n* | N* )
+	    ;;
+	    * )
+		# Run the HDF installation script
+		#
+		#
+		# set installation flags
+
+		home_file=${PGSHOME}/.install-hdfhome
+		hdf_flags="-cleano -w_home $home_file"
+
+		if [ "$log_file" != "" ] ; then
+		    hdf_flags="$hdf_flags -log $log_file -append"
+		fi
+
+		if [ "$dbug" != "" ] ; then
+		    if [ $batch_mode = 0 ] ; then
+			UserPrompt "Do you wish to install $current_hdf in debug mode [yes]"
+		    else
+			user_response=y
+		    fi
+		    case "$user_response" in
+		        n* | N*)
+		        ;;
+		        *)
+			    hdf_flags="$hdf_flags -dbug"
+		        ;;
+		    esac
+		fi
+
+		if [ "$sgi_mode" = "n32" ] ; then	# set flag for SGI n32 mode
+		    hdf_flags="$hdf_flags -sgi32"
+		elif [ "$sgi_mode" = "64" ] ; then 	# set flag for SGI 64-bit mode
+		    hdf_flags="$hdf_flags -sgi64"
+		fi
+
+		if [ "$f90_flag" = "1" ] ; then	# set flag for f90 build
+
+		    hdf_flags="$hdf_flags -f90"
+
+		    if [ "$nag_flag" = "1" ] ; then 	# using NAG f90
+			hdf_flags="$hdf_flags -NAG"
+		    fi
+
+		fi
+
+		if [ "$absoft_flag" = "1" ] ; then 	# using ABSOFT F77
+		    hdf_flags="$hdf_flags -ABSOFT"
+		fi
+
+		if [ "$fc_path" != "" ] ; then 		# path for FORTRAN compiler
+		    hdf_flags="$hdf_flags -fc_path $fc_path"
+		fi
+
+		if [ "$cc_path" != "" ] ; then 		# path for C compiler
+		    hdf_flags="$hdf_flags -cc_path $cc_path"
+		fi
+
+		if [ $batch_mode = 1 ] ; then		# batch mode
+		    hdf_flags="$hdf_flags -batch"
+		fi
+
+                #
+                # See if user will be using external netCDF
+                #
+     
+                User_has_external_netCDF=0     # assume external netCDF will not be used
+                if [ $batch_mode = 0  -a "$netcdfhome" = "" ] ; then
+                     UserPrompt "Are you going to use external netCDF with your HDF4 applications[no]"
+                     case "$user_response" in
+                         y* | Y* )
+                             User_has_external_netCDF=1
+                         ;;
+                     esac
+                elif [ "$netcdfhome" != "" ] ; then
+                      User_has_external_netCDF=1
+                fi
+		export User_has_external_netCDF
+
+
+
+		EchoAndLog "Running the HDF4 Installation Script ..."
+
+		# run the installation script
+
+		$script_dir/INSTALL-Scripts/INSTALL-HDF $hdf_flags -install_dir $PGSHOME/hdf/$BRAND
+		if [ "$?" != "0" ] ; then
+		    Done "The HDF Installation Script failed or had errors."
+		fi
+
+		# get HDF home directory from the HDF installation
+
+		HDFHOME="`cat $home_file`"
+		export HDFHOME
+		if [ "$?" != "0" ] ; then
+		    Done "Unable to get HDF home directory."
+		fi
+		if [ -f "$home_file" ] ; then
+		    \rm -f $home_file	# clean up the hdfhome file
+		fi
+		hdf_installed=1		# flag HDF as successfully installed
+	    ;;
+	esac
+
+    fi
+
+    #
+    # Set HDF directories:
+    #
+    # - first look in $HDFHOME
+    # - if not found, default to $HDFHOME/hdf
+    #
+
+    if [ $?HDFHOME ] ; then
+
+	if [  -d $HDFHOME/bin  ] ; then		# HDF utilities
+	    HDFBIN=$HDFHOME/bin
+	else
+	    HDFBIN=$HDFHOME/hdf/bin
+	fi
+
+	if [  -d $HDFHOME/include  ] ; then	# HDF header files
+	    HDFINC=$HDFHOME/include
+	else
+	    HDFINC=$HDFHOME/hdf/include
+	fi
+
+	if [  -d $HDFHOME/lib  ] ; then		# HDF libraries
+	    HDFLIB=$HDFHOME/lib
+	else
+	    HDFLIB=$HDFHOME/hdf/lib
+	fi
+
+	export HDFHOME HDFBIN HDFINC HDFLIB
+    fi
+
+#
+# To avoid requiring old HDF4 users to change their makefiles to include 
+# JPEGINC, JPEGLIB, ZLIBINC, and ZLIBLIB we copy header/library files to 
+# the HDF4 include and lib directories
+#
+
+if [  -d $HDFINC  ] ; then
+    if [ "$log_file" != "" ] ; then
+	echo "" >> $log_file
+	EchoAndLog "***** Copying JPEG, ZLIB, and SZIP header and library ********"
+	EchoAndLog "********** files to relevant directories in HDF.    **********"
+	echo ""
+    else
+	echo ""
+	EchoAndLog "***** Copying JPEG, ZLIB and SZIP header and library *********"
+	EchoAndLog "********** files to relevant directories in HDF.    **********"
+	echo ""
+    fi
+fi
+
+if [ $jpeg_installed = 1 ] ; then
+    if [  -d $HDFINC  ] ; then
+	cp $JPEGINC/*.h $HDFINC/.
+    fi
+    if [  -d $HDFLIB  ] ; then
+	cp $JPEGLIB/* $HDFLIB/.
+    fi
+fi
+if [ $zlib_installed = 1 ] ; then
+    if [  -d $HDFINC  ] ; then
+	cp $ZLIBINC/*.h $HDFINC/.
+    fi
+    if [  -d $HDFLIB  ] ; then
+	cp $ZLIBLIB/* $HDFLIB/.
+    fi
+fi
+if [ $szip_installed = 1 ] ; then
+    if [  -d $HDFINC  ] ; then
+	cp $SZIPINC/*.h $HDFINC/.
+    fi
+    if [  -d $HDFLIB  ] ; then
+	cp $SZIPLIB/* $HDFLIB/.
+    fi
+fi
+
+if [ "$BRAND" = "macintosh" ] || [ "$BRAND" = "macintel" ] ; then
+    EchoAndLog "**** Running ranlib on libjpeg.a in jpeg and hdf4 dirs. ****" 
+    ranlib $JPEGLIB/libjpeg.a
+    ranlib $HDFLIB/libjpeg.a
+fi
+
+    #
+    # Select HDF5 installation option.
+    #
+
+    hdf5_installed=0    # assume HDF5 is not installed
+
+    if [ $batch_mode = 0 -a "$hdf5home" = "" ] ; then
+        UserPrompt "Is $current_hdf5 installed at your site [no]"
+        case "$user_response" in
+            y* | Y* )
+                hdf5_installed=1
+            ;;
+        esac
+    elif [ "$hdf5home" != "" ] ; then
+            hdf5_installed=1
+    fi
+
+    if [ $hdf5_installed = 1 ] ; then
+
+        #
+        # The user says HDF5 is installed: ask where it is located 
+        #(if not in batch mode)
+        #
+
+
+        if [ $batch_mode = 0 -a "$hdf5home" = "" ] ; then
+            HDF5_path="$PGSHOME/hdf5/$BRAND/$current_hdf5"
+            UserPrompt "Pathname where $current_hdf5 is installed [$HDF5_path]"
+
+            if [ "$user_response" != "" ] ; then
+                if [ -d "$user_response" ] ; then
+                    HDF5_path="$user_response"
+                fi
+            fi
+        else
+            HDF5_path=$hdf5home
+        fi
+
+        #
+        # Make sure it is really there.
+        #
+
+        if  [ -d ${HDF5_path} ] ; then
+
+            if [ -d ${HDF5_path}/${current_hdf5} ] ; then
+                temp=`basename ${HDF5_path}`
+                if [ "$temp" != "$current_hdf5" ] ; then
+                    hdf5dirs="${HDF5_path}/${current_hdf5} ${HDF5_path} ${HDF5_path}/${current_hdf5}/NewHDF ${HDF5_path}/NewHDF"
+                else
+                    hdf5dirs="${HDF5_path}  ${HDF5_path}/NewHDF ${HDF5_path}/${current_hdf5} ${HDF5_path}/${current_hdf5}/NewHDF"
+                fi
+            else
+                hdf5dirs="${HDF5_path} ${HDF5_path}/NewHDF"
+            fi
+
+            #
+            # Check for critical HDF5 directories
+            #
+
+            found=0                     # check for lib directory
+            for dir in ${hdf5dirs} ; do
+                if [ -d $dir/lib -a -d $dir/include ] ; then
+                    HDF5HOME=${dir}
+                    export HDF5HOME
+                    found=1
+                    break
+                fi
+            done
+
+            if [ $found = 0 ] ; then
+                Done "The HDF5 lib or include directory was not found."
+            fi
+
+
+            EchoAndLog "Setting HDF5 home directory to: $HDF5HOME"
+
+        else
+
+            Done "Specified HDF5 directory ($HDF5_path) does not exist"
+
+        fi
+
+        hdf5_installed=1                # flag HDF5 as successfully installed
+
+    else
+
+        #
+        # The user says HDF5 is NOT installed:ask if it should be installed now
+        #
+        if [ $batch_mode = 0 ] ; then
+            UserPrompt "Do you wish to install $current_hdf5 now [yes]"
+        else
+            user_response=y
+        fi
+        case  "$user_response" in
+            n* | N* )
+            ;;
+            * )
+                # Run the HDF5 installation script
+                #
+                #
+
+                EchoAndLog "Running the HDF5 Installation Script ..."
+
+                # set installation flags
+
+                home_file=${PGSHOME}/.install-hdf5home
+                hdf5_flags="-cleano -w_home $home_file"
+
+                if [ "$log_file" != "" ] ; then
+                    hdf5_flags="$hdf5_flags -log $log_file -append"
+                fi
+
+                if [ "$dbug" != "" ] ; then
+                    if [ $batch_mode = 0 ] ; then
+                        UserPrompt "Do you wish to install $current_hdf5 in debug mode [yes]"
+                    else
+                        user_response=y
+                    fi
+                    case "$user_response" in
+                        n* | N*)
+                            if [ "$c_rlib" = "1" ] ; then  #set threadsafe flag
+				UserPrompt "Do you want Thread-safe HDF5 is installed at your site [no]"
+				case "$user_response" in
+				    y* | Y* )
+					PTHREAD_HOME=/usr
+					UserPrompt "Pathname where pthread lib and include directories are located [$PTHREAD_HOME]"
+					if [ "$user_response" != "" ] ; then
+					    if [ -d "$user_response" ] ; then
+						PTHREAD_HOME="$user_response"
+					    fi
+					else
+					    PTHREAD_HOME=/usr
+					fi
+					if [ -f "$PTHREAD_HOME/include/pthread.h" ] ; then
+					    export PTHREAD_HOME
+					    hdf5_flags="$hdf5_flags -c_rlib"
+					    EchoAndLog "Thread-Safe HDF5 will be Installed."
+					else
+					    hdf5_flags="$hdf5_flags"
+					    EchoAndLog "Thread-safe pthread.h not found. HDF5 will be Installed without thread-safty."
+					fi
+				    ;;
+				esac
+			    else
+				hdfeos5_flags="$hdf5_flags"
+			    fi
+                        ;;
+                        *)
+                            if [ "$c_rlib" = "1" ] ; then  #set threadsafe flag
+				UserPrompt "Do you want Thread-safe HDF5 is installed at your site [no]"
+				case "$user_response" in
+				    y* | Y* )
+					PTHREAD_HOME=/usr
+					UserPrompt "Pathname where pthread lib and include directories are located [$PTHREAD_HOME]"
+					if [ "$user_response" != "" ] ; then
+					    if [ -d "$user_response" ] ; then
+						PTHREAD_HOME="$user_response"
+					    fi
+					else
+					    PTHREAD_HOME=/usr
+					fi
+					if [ -f "$PTHREAD_HOME/include/pthread.h" ] ; then
+					    export PTHREAD_HOME
+					    hdf5_flags="$hdf5_flags  -dbug -c_rlib"
+					    EchoAndLog "Thread-Safe HDF5 will be Installed."
+					else
+					    hdf5_flags="$hdf5_flags -dbug "
+					    EchoAndLog "Thread-Safe pthread.h not found. HDF5 will be Installed without thread-safty."
+					fi
+				    ;;
+				esac
+			    else
+				hdf5_flags="$hdf5_flags -dbug"
+			    fi
+                        ;;
+                    esac
+		else
+                    if [ "$c_rlib" = "1" ] ; then  #set threadsafe flag
+			UserPrompt "Do you want Thread-safe HDF5 is installed at your site [no]"
+			case "$user_response" in
+			    y* | Y* )
+				PTHREAD_HOME=/usr
+				UserPrompt "Pathname where pthread lib and include directories are located [$PTHREAD_HOME]"
+				if [ "$user_response" != "" ] ; then
+				    if [ -d "$user_response" ] ; then
+					PTHREAD_HOME="$user_response"
+				    fi
+				else
+				    PTHREAD_HOME=/usr
+				fi
+				if [ -f "$PTHREAD_HOME/include/pthread.h" ] ; then
+				    export PTHREAD_HOME
+				    hdf5_flags="$hdf5_flags -c_rlib"
+				    EchoAndLog "Thread-Safe HDF5 will be Installed."
+				else
+				    hdf5_flags="$hdf5_flags"
+				    EchoAndLog "Thread-Safe pthread.h not found. HDF5 will be Installed without thread-safty."
+				fi
+			    ;;
+			esac
+		    fi
+                fi
+
+                if [ "$sgi_mode" = "n32" ] ; then       # set flag for SGI n32 mode
+                    hdf5_flags="$hdf5_flags -sgi32"
+                elif [ "$sgi_mode" = "64" ] ; then      # set flag for SGI 64-bit mode
+                    hdf5_flags="$hdf5_flags -sgi64"
+                fi
+
+                if [ "$f90_flag" = "1" ] ; then # set flag for f90 build
+
+                    hdf5_flags="$hdf5_flags -f90"
+
+                    if [ "$nag_flag" = "1" ] ; then     # using NAG f90
+                        hdf5_flags="$hdf5_flags -NAG"
+                    fi
+
+                fi
+
+		if [ "$absoft_flag" = "1" ] ; then     # using ABSOFT F77
+		    hdf5_flags="$hdf5_flags -ABSOFT"
+		fi
+
+                if [ "$fc_path" != "" ] ; then          # path for FORTRAN compiler
+                    hdf5_flags="$hdf5_flags -fc_path $fc_path"
+                fi
+
+                if [ "$cc_path" != "" ] ; then          # path for C compiler
+                    hdf5_flags="$hdf5_flags -cc_path $cc_path"
+                fi
+
+                if [ $batch_mode = 1 ] ; then           # batch mode
+                    hdf5_flags="$hdf5_flags -batch"
+                fi
+
+                # run the installation script
+
+                $script_dir/INSTALL-Scripts/INSTALL-HDF5 $hdf5_flags -install_dir $PGSHOME/hdf5/$BRAND
+                if [ "$?" != "0" ] ; then
+                    Done "The HDF5 Installation Script failed or had errors."
+                fi
+
+                # get HDF5 home directory from the HDF5 installation
+
+                HDF5HOME="`cat $home_file`"
+                export HDF5HOME
+                if [ "$?" != "0" ] ; then
+                    Done "Unable to get HDF5 home directory."
+                fi
+                if [ -f "$home_file" ] ; then
+                    \rm -f $home_file   # clean up the hdf5home file
+                fi
+                hdf5_installed=1                # flag HDF5 as successfully installed
+            ;;
+        esac
+
+    fi
+
+    #
+    # Set HDF5 directories:
+    #
+    # - first look in $HDF5HOME
+    # - if not found, default to $HDF5HOME/hdf5
+    #
+
+    if [ $?HDF5HOME ] ; then
+
+        if [  -d $HDF5HOME/bin  ] ; then                # HDF5 utilities
+            HDF5BIN=$HDF5HOME/bin
+        else
+            HDF5BIN=$HDF5HOME/hdf5/bin
+        fi
+
+        if [  -d $HDF5HOME/include  ] ; then    # HDF5 header files
+            HDF5INC=$HDF5HOME/include
+        else
+            HDF5INC=$HDF5HOME/hdf5/include
+        fi
+
+        if [  -d $HDF5HOME/lib  ] ; then                # HDF5 libraries
+            HDF5LIB=$HDF5HOME/lib
+	    echo "Adding $HDF5LIB to LD_LIBRARY_PATH"
+	    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$HDF5LIB # For hdf5 Shared libs
+        else
+            HDF5LIB=$HDF5HOME/hdf5/lib
+	    echo "Adding $HDF5LIB to LD_LIBRARY_PATH"
+	    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$HDF5LIB # For hdf5 Shared libs
+        fi
+
+        export HDF5HOME HDF5BIN HDF5INC HDF5LIB LD_LIBRARY_PATH
+    fi
+
+    #
+    # Rename HDF5 libraries for CUGWIN from .lib extemsion to .a extension:
+    #
+
+    if [ "$BRAND" = "cygwin" ] ; then
+	if [ -f "$HDF5LIB/libhdf5.lib" ] ; then
+	    EchoAndLog "**** Renaming HDF5 library from libhdf5.lib to libhdf5.a . ****"
+	    mv $HDF5LIB/libhdf5.lib $HDF5LIB/libhdf5.a
+	fi
+	if [ -f "$HDF5LIB/libhdf5_hl.lib" ] ; then
+	    EchoAndLog "**** Renaming HDF5 high level library from libhdf5_hl.lib to libhdf5_hl.a . ****"
+	    mv $HDF5LIB/libhdf5_hl.lib $HDF5LIB/libhdf5_hl.a
+	fi
+    fi
+}
+
+#
+# Function to install HDF-EOS(HDF4 based) (or get location of HDF-EOS 
+# installation)
+#
+
+InstallHdfeos()
+{
+    #
+    # HDFEOS installation
+    #
+    #
+
+    # initialize installation flags
+
+    current_hdfeos="HDF-EOS2.19v1.00"
+    hdfeos_distrib="${current_hdfeos}.tar.Z"
+    hdfeos_flags="-df $hdfeos_distrib"
+
+    if [ "$notext" = "0" -a "$batch_mode" = 0 ] ; then
+
+	more <<EOF
+
+         *        *        *
+
+The current release of HDF-EOS available is:
+
+        $current_hdfeos
+
+If this release of HDF-EOS is already installed on your host, you may enter
+its location when prompted.  The installation procedure will then attempt
+to use your copy of HDF-EOS to build some useful scripts for environment 
+setting.   Note: this may not work if your HDF-EOS installation uses a 
+non-standard directory structure for the installed library and header files.
+
+If the correct release of HDF-EOS is not installed on your host, or you wish
+to re-install, you will have an opportunity to install it momentarily.  In
+order to do this, you must already have downloaded the HDF-EOS distribution
+file.  If this distribution that you currently are using is not that release, 
+it is available on the same ftp server where you obtained this distribution.
+
+                    *        *        *
+
+EOF
+
+
+    UserPrompt "Continue installation [yes]"
+    case "$user_response" in
+	n* | N* )
+	    EchoAndLog "Installation cancelled."
+	    exit 0
+	;;
+    esac
+
+    fi
+
+    #
+    # Select HDF-EOS installation option.
+    #
+
+    hdfeos_installed=0	# assume HDF-EOS is not installed
+
+    if [ $batch_mode = 0 -a "$hdfeos_home" = "" ] ; then
+	UserPrompt "Is $current_hdfeos installed at your site [no]"
+	case "$user_response" in
+	    y* | Y* )
+		hdfeos_installed=1
+	    ;;
+	esac
+    elif [ "$hdfeos_home" != "" ] ; then
+	hdfeos_installed=1
+    fi
+
+    if [ $hdfeos_installed = 1 ] ; then
+
+	#
+	# The user says HDF-EOS is installed: ask where it is located (if not in batch mode)
+	#
+
+	if [ $batch_mode = 0 -a "$hdfeos_home" = "" ] ; then
+	    HDFEOS_path="$PGSHOME"
+	    UserPrompt "Pathname where $current_hdfeos is installed [$HDFEOS_path]"
+
+	    if [ "$user_response" != "" ] ; then
+		if [ -d "$user_response" ] ; then
+		    HDFEOS_path="$user_response"
+		fi
+	    fi
+        else
+	    HDFEOS_path=$hdfeos_home
+	fi
+
+
+	#
+	# Make sure it is really there.
+	#
+
+	if [ -d ${HDFEOS_path}  ] ; then
+
+	    HDFEOS_HOME=${HDFEOS_path}
+	    export HDFEOS_HOME
+
+	    #
+	    # Check for critical directories in $HDFEOS_HOME
+	    #
+
+	    # check for lib directory
+	    if [  ! -d ${HDFEOS_HOME}/lib/${BRAND}  ] ; then
+		Done "The HDF-EOS lib directory was not found."
+	    fi
+
+	    # check for include directory
+	    if [  ! -d ${HDFEOS_HOME}/include  ] ; then
+		Done "The HDF-EOS include directory was not found."
+	    fi
+
+	    EchoAndLog "Setting HDFEOS home directory to: $HDFEOS_HOME"
+
+	else
+
+	    Done "Directory $current_hdfeos not found in $HDFEOS_path"
+
+	fi
+
+	hdfeos_installed=1		# flag HDF-EOS as successfully installed
+
+    else
+
+	#
+	# The user says HDF-EOS is NOT installed: ask if it should be installed now
+	#
+
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "Do you wish to install $current_hdfeos now [yes]"
+	else
+	    user_response=y
+	fi
+	case $user_response in
+	    n* | N* )
+	    ;;
+	    * )
+		# Run the HDF-EOS installation wrapper script
+		# - this script unpacks the HDFEOS distribution and then
+		#   runs the INSTALL-HDFEOS installation script
+		#
+
+		EchoAndLog "Installing HDF-EOS ..."
+
+		# set installation flags
+
+		home_file="${PGSHOME}/.install-hdfeoshome"
+		hdfeos_flags="$hdfeos_flags -w_home $home_file"
+
+		if [ "$log_file" != ""  ] ; then
+		    hdfeos_flags="$hdfeos_flags -log $log_file -append"
+		fi
+
+		if [ "$dbug" != "" ] ; then
+		    if [ $batch_mode = 0 ] ; then
+			UserPrompt "Do you wish to install $current_hdfeos in debug mode [yes]"
+		    else
+			user_response=y
+		    fi
+		    case "$user_response" in
+		        n* | N*)
+		        ;;
+		        *)
+			    hdfeos_flags="$hdfeos_flags -dbug"
+		        ;;
+		    esac
+		fi
+
+		if [ "$sgi_mode" = "n32" ] ; then 		# set flag for SGI n32 mode
+		    hdfeos_flags="$hdfeos_flags -sgi32"
+		elif [ "$sgi_mode" = "64" ] ; then 	# set flag for SGI 64-bit mode
+		    hdfeos_flags="$hdfeos_flags -sgi64"
+		fi
+
+		if [ "$fc_path" != "" ] ; then 		# path for FORTRAN compiler
+		    hdfeos_flags="$hdfeos_flags -fc_path $fc_path"
+		fi
+
+		if [ "$cc_path" != "" ] ; then 		# path for C compiler
+		    hdfeos_flags="$hdfeos_flags -cc_path $cc_path"
+		fi
+
+		if [ $batch_mode = 1 ] ; then		# batch mode
+		    hdfeos_flags="$hdfeos_flags -batch"
+		fi
+
+		# run the installation script
+
+		$script_dir/INSTALL-Scripts/INSTALL-HDFEOS-Wrap $hdfeos_flags -install_dir $PGSHOME
+		if [ "$?" != "0" ] ; then
+		    Done "The HDFEOS Installation Script failed or had errors."
+		fi
+
+		# get HDF-EOS home directory from the HDF-EOS installation
+
+		HDFEOS_HOME="`cat $home_file`"
+		export HDFEOS_HOME
+		if [ "$?" != "0" ] ; then
+		    Done "Unable to get HDF-EOS home directory."
+		fi
+		if [ -f "$home_file" ] ; then
+		    \rm -f $home_file	# clean up the hdfeoshome file
+		fi
+		hdfeos_installed=1	# flag HDF-EOS as successfully installed
+
+	    ;;
+	esac
+
+    fi
+
+
+    #
+    # Set HDFEOS directories:
+    #
+
+    if [ $?HDFEOS_HOME ] ; then
+
+	HDFEOS_BIN=$HDFEOS_HOME/bin/$BRAND
+	HDFEOS_INC=$HDFEOS_HOME/include
+	HDFEOS_LIB=$HDFEOS_HOME/lib/$BRAND
+	export HDFEOS_BIN HDFEOS_INC HDFEOS_LIB
+
+    fi
+
+}
+#
+# Function to install HDF-EOS5(HDF5 based) (or get location of HDF-EOS 
+# installation)
+
+InstallHdfeos5()
+{
+    #
+    # HDFEOS installation
+    #
+    #
+
+    # initialize installation flags
+
+    current_hdfeos5="HDF-EOS5.1.15"
+    hdfeos5_distrib="${current_hdfeos5}.tar.Z"
+    hdfeos5_flags="-df $hdfeos5_distrib"
+
+    if [ "$notext" = "0" -a "$batch_mode" = 0 ] ; then
+
+        more <<EOF
+
+                    *        *        *
+
+The current release of HDF-EOS5 to be installed is:
+
+        $current_hdfeos5
+
+If this release of HDF-EOS5 is already installed on your host, you may enter
+its location when prompted.  The installation procedure will then attempt
+to use your copy of HDF-EOS5 to build some useful scripts for setting environment
+variables.   Note: this may not work if your HDF-EOS5 installation uses a 
+non-standard directory structure for the installed library and header files.
+
+If the correct release of HDF-EOS5 is not installed on your host, or you wish
+to re-install, you will have an opportunity to install it momentarily.  In
+order to do this, you must already have downloaded the HDF-EOS5 distribution
+file.  It is available on the same ftp server where the current distribution 
+files are located.
+
+
+                    *        *        *
+
+EOF
+
+
+    UserPrompt "Continue installation [yes]"
+    case "$user_response" in
+        n* | N* )
+            EchoAndLog "Installation cancelled."
+            exit 0
+        ;;
+    esac
+
+    fi
+
+    #
+    # Select HDF-EOS5 installation option.
+    #
+
+    hdfeos5_installed=0 # assume HDF-EOS5 is not installed
+
+    if [ $batch_mode = 0 -a "$hdfeos5_home" = "" ] ; then
+        UserPrompt "Is $current_hdfeos5 installed at your site [no]"
+        case "$user_response" in
+            y* | Y* )
+                hdfeos5_installed=1
+            ;;
+        esac
+    elif [ "$hdfeos5_home" != "" ] ; then
+        hdfeos5_installed=1
+    fi
+
+    if [ $hdfeos5_installed = 1 ] ; then
+
+        #
+        # The user says HDF-EOS is installed: ask where it is located (if not in batch mode)
+        #
+
+        if [ $batch_mode = 0 -a "$hdfeos5_home" = "" ] ; then
+            HDFEOS5_path="$PGSHOME"
+            UserPrompt "Pathname where $current_hdfeos5 is installed [$HDFEOS5_path]"
+
+            if [ "$user_response" != "" ] ; then
+                if [ -d "$user_response" ] ; then
+                    HDFEOS5_path="$user_response"
+                fi
+            fi
+        else
+            HDFEOS5_path=$hdfeos5_home
+        fi
+
+
+        #
+        # Make sure it is really there.
+        #
+
+        if [ -d ${HDFEOS5_path}  ] ; then
+
+            HDFEOS5_HOME=${HDFEOS5_path}
+            export HDFEOS5_HOME
+
+            #
+            # Check for critical directories in $HDFEOS5_HOME
+            #
+
+            # check for lib directory
+            if [  ! -d ${HDFEOS5_HOME}/lib/${BRAND}  ] ; then
+                Done "The HDF-EOS5 lib directory was not found."
+            fi
+
+            # check for include directory
+            if [  ! -d ${HDFEOS5_HOME}/include  ] ; then
+                Done "The HDF-EOS5 include directory was not found."
+            fi
+
+            EchoAndLog "Setting HDFEOS5 home directory to: $HDFEOS5_HOME"
+
+        else
+
+            Done "Directory $current_hdfeos5 not found in $HDFEOS5_path"
+
+        fi
+
+        hdfeos5_installed=1             # flag HDF-EOS5 as successfully installed
+
+    else
+
+        #
+        # The user says HDF-EOS5 is NOT installed: ask if it should be installed now
+        #
+
+        if [ $batch_mode = 0 ] ; then
+            UserPrompt "Do you wish to install $current_hdfeos5 now [yes]"
+        else
+            user_response=y
+        fi
+        case $user_response in
+            n* | N* )
+            ;;
+            * )
+                # Run the HDF-EOS5 installation wrapper script
+                # - this script unpacks the HDFEOS5 distribution and then
+                #   runs the INSTALL-HDFEOS installation script
+                #
+
+                EchoAndLog "Installing HDF-EOS5 ..."
+
+                # set installation flags
+
+                home_file="${PGSHOME}/.install-hdfeo5shome"
+                hdfeos5_flags="$hdfeos5_flags -w_home $home_file"
+
+                if [ "$log_file" != ""  ] ; then
+                    hdfeos5_flags="$hdfeos5_flags -log $log_file -append"
+                fi
+
+                if [ "$dbug" != "" ] ; then
+                    if [ $batch_mode = 0 ] ; then
+                        UserPrompt "Do you wish to install $current_hdfeos5 in debug mode [yes]"
+                    else
+                        user_response=y
+                    fi
+                    case "$user_response" in
+                        n* | N*)
+                            if [ "$c_rlib" = "1" ] ; then  #set threadsafe flag
+				hdfeos5_flags="$hdfeos5_flags -ts"
+			    else
+				hdfeos5_flags="$hdfeos5_flags"
+			    fi
+                        ;;
+                        *)
+                            if [ "$c_rlib" = "1" ] ; then  #set threadsafe flag
+				hdfeos5_flags="$hdfeos5_flags -ts_dbug"
+			    else
+                            hdfeos5_flags="$hdfeos5_flags -dbug"
+			    fi
+                        ;;
+                    esac
+		else
+                    if [ "$c_rlib" = "1" ] ; then  #set threadsafe flag
+			hdfeos5_flags="$hdfeos5_flags -ts"
+		    fi
+                fi
+
+                if [ "$sgi_mode" = "n32" ] ; then               # set flag for SGI n32 mode
+                    hdfeos5_flags="$hdfeos5_flags -sgi32"
+                elif [ "$sgi_mode" = "64" ] ; then      # set flag for SGI 64-bit mode
+                    hdfeos5_flags="$hdfeos5_flags -sgi64"
+                fi
+
+                if [ "$fc_path" != "" ] ; then          # path for FORTRAN compiler
+                    hdfeos5_flags="$hdfeos5_flags -fc_path $fc_path"
+                fi
+
+                if [ "$cc_path" != "" ] ; then          # path for C compiler
+                    hdfeos5_flags="$hdfeos5_flags -cc_path $cc_path"
+                fi
+
+                if [ $batch_mode = 1 ] ; then           # batch mode
+                    hdfeos5_flags="$hdfeos5_flags -batch"
+                fi
+
+                # run the installation script
+
+                $script_dir/INSTALL-Scripts/INSTALL-HDFEOS5-Wrap $hdfeos5_flags -install_dir $PGSHOME
+                if [ "$?" != "0" ] ; then
+                    Done "The HDFEOS5 Installation Script failed or had errors."
+                fi
+
+                # get HDF-EOS5 home directory from the HDF-EOS5 installation
+
+                HDFEOS5_HOME="`cat $home_file`"
+                export HDFEOS5_HOME
+                if [ "$?" != "0" ] ; then
+                    Done "Unable to get HDF-EOS5 home directory."
+                fi
+                if [ -f "$home_file" ] ; then
+                    \rm -f $home_file   # clean up the hdfeos5home file
+                fi
+                hdfeos5_installed=1     # flag HDF-EOS5 as successfully installed
+
+            ;;
+        esac
+
+    fi
+
+
+    #
+    # Set HDFEOS5 directories:
+    #
+
+    if [ $?HDFEOS5_HOME ] ; then
+
+        HDFEOS5_BIN=$HDFEOS5_HOME/bin/$BRAND
+        HDFEOS5_INC=$HDFEOS5_HOME/include
+        HDFEOS5_LIB=$HDFEOS5_HOME/lib/$BRAND
+        export HDFEOS5_BIN HDFEOS5_INC HDFEOS5_LIB
+
+    fi
+
+}
+
+#
+# Function called when Installation complete
+#
+
+Done()
+{
+
+    EchoAndLog ""
+
+    if [ "$1" = "" ] ; then
+	EchoAndLog "HDF-EOS installation completed at `date`"
+    else
+	EchoAndLog "`basename $0`: Error: $*"
+	EchoAndLog -n "HDF-EOS installation cancelled"
+	exit 1
+    fi
+
+    EchoAndLog -n ""
+}
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+#
+# Save starting directory, path
+# Create error message header
+#
+
+start_dir=`pwd`
+start_path=$PATH
+this_script="`basename $0`"
+script_error="$this_script: Error:"
+
+#
+# Get absolute pathname where this script is located
+# This allows the script to locate any needed auxilliary files
+#
+
+script_dir="`dirname $0`"
+if [ "$script_dir" = "." ] ; then
+    abs="`echo $0 | cut -c1`"
+    if [ "$abs" != "." ] ; then
+	script_dir=""
+    fi
+fi
+if [ "$script_dir" = "" ] ; then
+    Which $this_script
+    if [ "$which_result" = "1" ] ; then
+	script_dir="`dirname $which_cmd`"
+    fi
+fi
+abs="`echo $script_dir | cut -c1`"
+if [ "$abs" != "/" ] ; then
+    script_dir=`cd $script_dir;pwd`
+fi
+
+#
+# Get arguments from command line
+#
+
+status_msg=""
+
+help=0
+log_file=""
+notext=0
+clean=0
+append=0
+use_gcc=0
+sgi_mode=32
+f90_flag=0
+nag_flag=0
+absoft_flag=0
+fc_path=""
+cc_path=""
+build_ftn=""
+dbug=""
+install_options=""
+tk_search_path=""
+batch_mode=0
+zlibhome=""
+jpeghome=""
+hdfhome=""
+sziphome=""
+hdf5home=""
+hdfeos_home=""
+hdfeos5_home=""
+netcdfhome=""
+cpp=0
+cpp_path=""
+c_rlib=0
+EXT_CC_FLAGS=""
+EXT_FC_FLAGS=""
+EXT_CPP_FLAGS=""
+
+while [ "$1" != "" ] ; do
+
+    case "$1" in
+
+	-h | -help )
+	    Help
+	;;
+
+	-f90 )
+	    f90_flag=1
+	;;
+
+	-NAG )
+	    nag_flag=1
+	;;
+
+	-ABSOFT )
+	    absoft_flag=1
+	;;
+
+	-fc_path )
+	    fc_path="$2"
+	    install_options="$install_options $1"
+	    shift
+	;;
+
+	-cc_path )
+	    cc_path="$2"
+	    install_options="$install_options $1"
+	    shift
+	;;
+
+	-cc_flags )
+	    EXT_CC_FLAGS=$2
+	    export EXT_CC_FLAGS
+	    shift
+	;;
+
+	-fc_flags )
+	    EXT_FC_FLAGS=$2
+	    export EXT_FC_FLAGS
+	    shift
+	;;
+
+	-cpp_flags )
+	    EXT_CPP_FLAGS=$2
+	    export EXT_CPP_FLAGS
+	    shift
+	;;
+
+	-gcc )
+	    use_gcc=1
+	;;
+
+	-sgi )
+	    sgi_mode=old32
+	;;
+
+	-sgi32 )
+	    sgi_mode=n32
+	;;
+
+	-sgi64 )
+	    sgi_mode=64
+	;;
+
+	-log )
+	    if [ "$2" != "" ] ; then
+		if [ "` echo $2 | cut -c1`" = "/" ] ; then
+		    log_file="$2"
+		else
+		    log_file="$start_dir/$2"
+		fi
+		install_options="$install_options $1"
+		shift
+	    fi
+	;;
+
+	-append )
+	    append=1
+	;;
+
+	-nt | -notext )
+	    notext=1
+	;;
+
+	-clean )
+	    clean=1
+	;;
+
+	-dbug )
+	    dbug=-dbug
+	;;
+
+	-no_ftn )
+	    build_ftn=-no_ftn
+	;;
+
+	-pgshome )
+	    if [ "$2" != "" -a -d $2 ] ; then
+		tk_search_path=$2
+		install_options="$install_options $1"
+		shift
+	    else
+		WriteError "Invalid (or no) directory specified with -pgshome switch."
+		Help
+	    fi
+	    ;;
+	
+	-zlibhome )
+            if [ "$2" != "" -a -d $2 ] ; then
+                zlibhome=$2
+                install_options="$install_options $1"
+                shift
+            else
+                WriteError "Invalid (or no) directory specified with -zlibhome switch."
+                Help
+            fi
+	    ;;
+
+	-jpeghome )
+            if [ "$2" != "" -a -d $2 ] ; then
+                jpeghome=$2
+                install_options="$install_options $1"
+                shift
+            else
+                WriteError "Invalid (or no) directory specified with -jpeghome s
+witch."
+                Help
+            fi
+	    ;;
+
+
+	
+        -hdfhome )
+	    if [ "$2" != "" -a -d $2 ] ; then
+		hdfhome=$2
+		install_options="$install_options $1"
+		shift
+	    else
+		WriteError "Invalid (or no) directory specified with -hdfhome switch."
+		Help
+	    fi
+	    ;;
+
+        -sziphome )
+            if [ "$2" != "" -a -d $2 ] ; then
+                sziphome=$2
+                install_options="$install_options $1"
+                shift
+            else
+                WriteError "Invalid (or no) directory specified with -sziphome switch."
+                Help
+            fi
+	    ;;
+        -hdf5home )
+            if [ "$2" != "" -a -d $2 ] ; then
+                hdf5home=$2
+                install_options="$install_options $1"
+                shift
+            else
+                WriteError "Invalid (or no) directory specified with -hdf5home switch."
+                Help
+            fi
+	    ;;
+
+	-hdfeos_home )
+	    if [ "$2" != "" ] ; then
+		hdfeos_home=$2
+		install_options="$install_options $1"
+		shift
+	    else
+		WriteError "Invalid (or no) directory specified with -hdfeos_home switch."
+		Help
+	    fi
+	    ;;
+
+        -hdfeos5_home )
+            if [ "$2" != "" ] ; then
+                hdfeos5_home=$2
+                install_options="$install_options $1"
+                shift
+            else
+                WriteError "Invalid (or no) directory specified with -hdfeos5_home switch."
+                Help
+            fi
+	    ;;
+	
+        -netcdfhome )
+	    if [ "$2" != "" -a -d $2 ] ; then
+		netcdfhome=$2
+		install_options="$install_options $1"
+		shift
+	    else
+		WriteError "Invalid (or no) directory specified with -netcdfhome switch."
+		Help
+	    fi
+	    ;;
+
+
+	-batch )
+	    batch_mode=1
+	    ;;
+
+	-cpp )
+	    cpp=1
+	    ;;
+	-cpp_path )
+	    cpp_path="$2"
+	    install_options="$install_options $1"
+	    shift
+	    ;;
+
+	-c_rlib )
+	    c_rlib=1
+	    ;;
+
+        * )
+	    WriteError "`basename $0`: error: invalid option '$1'"
+	    Help
+	    ;;
+
+    esac
+    install_options="$install_options $1"
+    shift
+
+done
+
+export EXT_CC_FLAGS EXT_FC_FLAGS EXT_CPP_FLAGS
+
+
+# the NAG flag is only valid if f90 was requested AND the path to the
+# NAG f90 compiler also needs to be specified, make sure both these
+# conditions have been fulfilled
+
+if [ $nag_flag = 1 ] ; then
+    if [ "$fc_path" = "" -o $f90_flag = 0 ] ; then
+	WriteError "$script_error Must first specify -f90 and set compiler path."
+	exit 1
+    fi
+fi
+
+# the ABSOFT flag is only valid if f77 was requested AND the path to the
+# ABSOFT f77 compiler also needs to be specified.
+
+if [ $absoft_flag = 1 ] ; then
+    if [ "$fc_path" = "" ] ; then
+	WriteError "$script_error Must set absoft f77 compiler path using -fc_path."
+	exit 1
+    fi
+fi
+
+# attempt to determine installation directory
+
+# assume this script is located in one of the standard HDF-EOS/bin
+# directories
+
+pgsdir1=`dirname $script_dir`       # $PGSHOME/bin
+pgsdir2=`dirname $pgsdir1`          # $PGSHOME/bin/$BRAND
+
+tk_search_path="$tk_search_path $pgsdir1 $pgsdir2"
+
+#
+# make sure we are starting from a valid hdfeos directory,
+# by checking for the presence of all required subdirectories
+# if any of them is missing then set PGSHOME to the null string
+# and display the help message
+#
+
+for dir in $tk_search_path ; do
+    found_pgshome=1
+    for sub_dir in bin include lib src samples util; do
+
+	if [ -d $dir/$sub_dir ] ; then
+	    continue
+	else
+	    found_pgshome=0
+	    break
+	fi
+    done
+
+    if [ "$found_pgshome" = "1" ] ; then
+	PGSHOME=$dir
+	export PGSHOME
+	cd $PGSHOME
+	break
+    fi
+done
+
+if [ "$found_pgshome" = "0" ] ; then
+    WriteError "Not in toolkit home directory."
+    Help
+fi
+
+pathroot=`echo $PGSHOME | cut -f2 -d/`
+
+if [ "$pathroot" = "tmp_mnt" -a $batch_mode = 0 ] ; then
+    echo "The installation directory determined by this script contains the root"
+    echo "directory /tmp_mnt.  This is probably not correct."
+    echo ""
+    UserPrompt "Actual location of PGSHOME [$PGSHOME] "
+    if [ "$user_response" != "" ] ; then
+        if [ -d "$user_response" ] ; then
+
+	    cd $user_response
+	    found_pgshome=1
+	    for sub_dir in bin include lib message runtime src test ; do
+
+		if [ -d $sub_dir ] ; then
+		    continue
+		else
+		    found_pgshome=0
+		fi
+	    done
+
+	    if [ "$found_pgshome" = "0" ] ; then
+		echo "Invalid PGSHOME value! Exiting."
+		exit
+	    fi
+	    PGSHOME="$user_response"
+	    export PGSHOME
+        else
+	    echo "The directory $user_response does not exist!  Exiting."
+	    exit
+	fi
+    fi
+fi
+
+##
+# set up log file
+#
+
+if [ "$log_file" != "" ] ; then
+
+    if [ "$append" = "0" ] ; then
+	if [ -f "$log_file" ] ; then
+	    /bin/rm -f $log_file > /dev/null 2>&1
+	fi
+    fi
+
+    touch $log_file > /dev/null 2>&1
+    if [ $? != 0 ] ; then
+	WriteError "$script_error cannot write to file $log_file"
+	Help
+    fi
+
+fi
+
+EchoAndLog "HDF-EOS Installation starting at `date`"
+echo ""
+
+if [ "$log_file" != "" ] ; then
+    echo ""
+    echo "`basename $0`: session output will go to file: "
+    echo ""
+    echo "     $log_file"
+    echo ""
+fi
+
+#
+# Set architecture-specific variables
+#
+
+SetArchitecture
+
+Log  "host: $HOST    type: $BRAND     user: $USER"
+Log 'install options: '"$install_options"
+
+
+#
+# set default values for the toolkit directory environment variables
+#
+
+PGSBIN=$PGSHOME/bin/$BRAND	# executable files
+PGSDAT=$PGSHOME/database/$BRAND	# database files
+PGSCOM=$PGSHOME/database/common # database/common files
+PGSINC=$PGSHOME/include		# include header files
+PGSLIB=$PGSHOME/lib/$BRAND	# library files
+PGSMSG=$PGSHOME/message		# SMF message files
+PGSOBJ=$PGSHOME/obj/$BRAND	# object files
+PGSCPPO=$PGSHOME/objcpp/$BRAND	# object files
+PGSRUN=$PGSHOME/runtime		# runtime work files
+PGSSRC=$PGSHOME/src		# toolkit source files
+PGSTST=$PGSHOME/test		# test source files
+
+export PGSHOME PGSBIN PGSDAT PGSINC PGSLIB
+export PGSMSG  PGSOBJ PGSRUN PGSSRC PGSTST
+export PGSCPPO PGSCOM
+
+#
+# Set up variables needed by Process Control (PC) tools.
+#
+
+PGS_PC_INFO_FILE=$PGSRUN/$BRAND/PCF.relB0
+export PGS_PC_INFO_FILE
+
+#
+# add PGSBIN to path
+#
+
+PATH=$PATH:$PGSBIN; export PATH		# add PGSBIN to path
+
+InstallHdf
+
+if [ "$hdf_installed" = "1" ] ; then
+    InstallHdfeos
+else
+    hdfeos_installed=0
+fi
+
+if [ "$hdf5_installed" = "1" ] ; then
+    InstallHdfeos5
+else
+    hdfeos5_installed=0
+fi
+
+#
+# HDF-EOS installation
+#
+#
+
+# set installation flags
+
+toolkit_flags="-pgshome $PGSHOME $dbug $build_ftn"
+
+if [ "$hdf_installed" != "1" -o "$hdf5_installed" != "1" ] ; then	# set flag for no-HDF and no HDF-EOS build
+    toolkit_flags="$toolkit_flags -no_hdf -no_hdfeos"
+elif [ "$hdfeos_installed" != "1" ] ; then		# set flag for no-HDF-EOS build
+    toolkit_flags="$toolkit_flags -no_hdfeos"
+fi
+
+if [ "$f90_flag" = "1" ] ; then 			# set flag for f90 build
+
+    toolkit_flags="$toolkit_flags -f90"
+
+    if [ "$nag_flag" = "1" ] ; then 		# using NAG f90
+        toolkit_flags="$toolkit_flags -NAG"
+    fi
+
+fi
+
+if [ "$absoft_flag" = "1" ] ; then 		# using ABSOFT F77
+    toolkit_flags="$toolkit_flags -ABSOFT"
+fi
+
+if [ "$fc_path" != "" ] ; then 			# path for FORTRAN compiler
+    toolkit_flags="$toolkit_flags -fc_path $fc_path"
+fi
+
+if [ "$cc_path" != "" ] ; then 			# path for C compiler
+    toolkit_flags="$toolkit_flags -cc_path $cc_path"
+fi
+
+if [ "$use_gcc" = "1" ] ; then 			# set flag for GNU C build
+    toolkit_flags="$toolkit_flags -gcc"
+fi
+
+if [ "$sgi_mode" = "n32" ] ; then 		# set flag for SGI n32 mode
+    toolkit_flags="$toolkit_flags -sgi32"
+elif [ "$sgi_mode" = "64" ] ; then 		# set flag for SGI 64-bit mode
+    toolkit_flags="$toolkit_flags -sgi64"
+fi
+
+if [ "$cpp" = "1" ] ; then 			# set flag for C++ build
+    toolkit_flags="$toolkit_flags -cpp"
+fi
+
+if [ "$cpp_path" != "" ] ; then 		# path for C++ compiler
+    toolkit_flags="$toolkit_flags -cpp_path $cpp_path"
+fi
+
+if [ "$c_rlib" = "1" ] ; then 			# set flag for treadsafe build
+    toolkit_flags="$toolkit_flags -c_rlib"
+fi
+
+
+#EchoAndLog "Running the UtilityScripts Installation Script ..."
+EchoAndLog ""
+
+#if [ "$log_file" != ""  ] ; then
+
+#    $script_dir/INSTALL-UtilityScripts $toolkit_flags >> $log_file 2>&1
+#    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] && [ "$fc_path" != "" ]  ; then
+#	echo "# install option: $install_options" >> $PGSHOME/bin/$BRAND/pgs-env.csh
+#    fi
+#else
+
+#    $script_dir/INSTALL-UtilityScripts $toolkit_flags
+#    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] && [ "$fc_path" != "" ]  ; then
+#	echo "# install option: $install_options" >> $PGSHOME/bin/$BRAND/pgs-env.csh
+#    fi
+#fi
+
+if [ "$?" != "0" ] ; then
+    Done "The Installation Script failed or had errors."
+fi
+
+Done
diff --git a/bin/INSTALL-HDFEOS b/bin/INSTALL-HDFEOS
new file mode 100755
index 0000000..2bc5ba3
--- /dev/null
+++ b/bin/INSTALL-HDFEOS
@@ -0,0 +1,1931 @@
+#!/bin/sh
+# Copyright (C) 1996 Hughes and Applied Research Corporation
+#
+# Permission to use, modify, and distribute this software and its documentation 
+# for any purpose without fee is hereby granted, provided that the above 
+# copyright notice appear in all copies and that both that copyright notice and 
+# this permission notice appear in supporting documentation.
+#
+#-----------------------------------------------------------------------------
+# filename:	
+# 	INSTALL-HDFEOS
+#
+# description:
+# 	This script handles the installation of HDFEOS5.
+#
+# usage:
+# 	1) Set directory to HDFEOS top level directory.
+# 	2) Type:
+# 
+# 	       bin/INSTALL-HDFEOS [-dbug] [-sgi32 | -sgi64] [-i<incdir>] [-l<libdir>] [-szi<SZincdir>] [-szl<SZlibdir>]
+#              bin/INSTALL-HDFEOS [-cc_path <path/compiler_name>]
+# 	       bin/INSTALL-HDFEOS [-h]
+# 
+# 	   Where (optional) flags are:
+#
+# 	      -dbug    : build debug version of HDF-EOS
+# 	      -sgi32   : build in -n32 mode (SGI Power Challenge only)
+# 	      -sgi64   : build in -64  mode (SGI Power Challenge only)
+#             -ts      : build thread-safe version
+#             -ts_dbug : build thread-safe version and enable debug statements
+#             -cc_path : set the path of the C compiler to <path/compiler_name>
+# 	      -i       : set HDF include directory to <libdir>
+# 	      -l       : set HDF library directory to <libdir>
+# 	      -szi     : set SZIP include directory to <libdir>
+# 	      -szl     : set SZIP library directory to <libdir>
+# 	      -h       : display this help message and exit
+#
+# 	3) Enter requested information when prompted.
+# 
+# notes:
+# 	1) This script is compatible with the following platforms:
+# 	   Sun, SGI, HP-9000, IBM RS-6000 and DEC Alpha.
+# 	   It automatically figures out which platform you are on,
+# 	   and sets environment variables accordingly.
+#
+# author:
+# 	Mike Sucher / A.R.C.
+#
+# history:
+#	18-Jun-1996 MES  Initial version 
+# 	27-Sep-1996 MES  Add -i and -l options
+#	17-Apr-1997 DaW  Added support for old 32-bit compiling on SGI
+#			 Power Challenge
+#	09-Nov-2000 DaW  Modified to work with HDF5.1r2.1
+#       10-Oct-2001 AM   Modified to add option to build thread-safe version 
+#       15-Sep-2003 PTN  Added -cc_path option
+#       15-Apr-2004 PTN  Modified for Linux64
+#       09-Nov-2005 TR   Added i686 (cygwin on Pentium)
+#-----------------------------------------------------------------------------
+
+this_script="`basename $0`"
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to output a startup banner
+#
+
+Banner()
+{
+    echo ""
+    echo "-----------------------------------------------------------------------"
+    echo "$this_script: Installation script for HDFEOS5"
+    echo ""
+    echo "    Installing HDFEOS5 on host $HOST running $OSTYPE"
+    echo "    HDFEOS5 home directory is: $HDFEOS5_HOME"
+    echo ""
+    echo "    Starting HDFEOS5 installation at `date`"
+    echo ""
+    echo "-----------------------------------------------------------------------"
+    echo ""
+}
+
+#
+# Function to handle error exit
+#
+
+ErrorExit()
+{
+    echo ""
+    echo "${this_script}: Fatal error running command: $*"  >&2
+    echo ""
+
+    echo "-----------------------------------------------------------------------"
+    echo ""
+    echo "    HDFEOS5 installation ending with errors at `date`"
+    echo ""
+    echo "-----------------------------------------------------------------------"
+
+    exit 1
+}
+
+
+#
+# Functions to check HDF5 environment variables for validity
+#
+
+ValidHDFLIB()
+{
+    if [ "$HDF5LIB" = "" ] ; then
+        WriteError "No HDF5 library directory specified"
+        exit 1
+    else
+        if [ ! -f "$HDF5LIB/libhdf5.a" ] ; then
+            WriteError "HDF5 library not found in: $HDF5LIB"
+            exit 1
+        fi
+    fi
+}
+
+ValidHDFINC()
+{
+    if [ "$HDF5INC" = "" ] ; then
+        WriteError "No HDF5 include directory specified"
+        exit 1
+    else
+        if [ ! -f "$HDF5INC/hdf5.h" ] ; then
+            WriteError "HDF5 header file not found in: $HDF5INC"
+            exit 1
+        fi
+    fi
+}
+
+#
+# Functions to check SZIP environment variables for validity
+#
+
+ValidSZIPLIB()
+{
+    if [ "$SZIPLIB" = "" ] ; then
+        WriteError "No SZIP library directory specified"
+        exit 1
+    else
+        if [ ! -f "$SZIPLIB/libsz.a" ] ; then
+            WriteError "SZIP library not found in: $SZIPLIB"
+            exit 1
+        fi
+    fi
+}
+
+ValidSZIPINC()
+{
+    if [ "$SZIPINC" = "" ] ; then
+        WriteError "No SZIP include directory specified"
+        exit 1
+    else
+        if [ ! -f "$SZIPINC/szlib.h" ] ; then
+            WriteError "SZIP header file not found in: $SZIPINC"
+            exit 1
+        fi
+    fi
+}
+#
+# Function to set up the HDF5 environment variables HDF5INC and HDF5LIB 
+# The values are set via the following priority scheme:
+#
+#     (1) command line override, via the -l and -i flags
+#     (2) loaded from the saved HDF5 environment file
+#     (3) user prompt or inherited from the environment.
+# 
+# The user will be prompted to override inherited values, except in
+# case (1).
+#
+
+GetHdfEnv()
+{
+    #
+    # If HDF5INC or HDF5LIB has not been specified on the command line. 
+    # first look for them in the saved HDF5 environment file
+    #
+
+    hdf_env_file=$HDFEOS5_BIN/.hdf_env
+
+    if [ -f $hdf_env_file ] ; then
+
+        if [ $lib_flag = 0 ] ; then
+            echo "Getting HDF5LIB from $hdf_env_file"
+            HDF5LIB=`head -1 $hdf_env_file`
+        fi
+
+        if [ $inc_flag = 0 ] ; then
+            echo "Getting HDF5INC from $hdf_env_file"
+            HDF5INC=`tail -1 $hdf_env_file`
+        fi
+
+    fi
+
+    #
+    # If HDF5INC or HDF5LIB is undefined at this point, then prompt for them
+    # Otherwise ask if they should be accepted, unless specified via the
+    # command line.  Check them in any case !
+    #
+
+    if [ $lib_flag = 0 ] ; then
+        if [ "$HDF5LIB" = "" ] ; then
+            UserPrompt "Please enter the HDF5 library files directory: "
+        else
+            echo "Current value of the HDF5 library directory is: $HDF5LIB"
+            UserPrompt "New value (or Return to accept):"
+        fi
+        if [ "$user_response" != "" ] ; then
+            HDF5LIB="$user_response"
+        fi
+    fi
+
+    ValidHDFLIB 	# make sure it's valid before proceeding
+    
+
+    if [ $inc_flag = 0 ] ; then
+        if [ "$HDF5INC" = "" ] ; then
+            UserPrompt "Please enter the HDF5 include files directory: "
+        else
+            echo "Current value of the HDF5 include directory is: $HDF5INC"
+            UserPrompt "New value (or Return to accept):"
+        fi
+        if [ "$user_response" != "" ] ; then
+            HDF5INC="$user_response"
+        fi
+    fi
+
+    ValidHDFINC  	# make sure it's valid before proceeding
+
+
+    echo ""
+    echo "HDF5 include files in: $HDF5INC"
+    echo "HDF5 library files in: $HDF5LIB"
+
+
+    cat /dev/null > $hdf_env_file
+    echo $HDF5LIB >> $hdf_env_file
+    echo $HDF5INC >> $hdf_env_file
+    
+    export HDF5LIB HDF5INC
+
+}
+
+
+#
+# Function to set up the SZIP environment variables SZIPINC and SZIPLIB 
+# The values are set via the following priority scheme:
+#
+#     (1) command line override, via the -szl and -szi flags
+#     (2) loaded from the saved SZIP environment file
+#     (3) user prompt or inherited from the environment.
+# 
+# The user will be prompted to override inherited values, except in
+# case (1).
+#
+
+GetSzipEnv()
+{
+    #
+    # If SZIPINC or SZIPLIB has not been specified on the command line. 
+    # first look for them in the saved SZIP environment file
+    #
+
+    szip_env_file=$HDFEOS5_BIN/.szip_env
+
+    if [ -f $szip_env_file ] ; then
+
+        if [ $szlib_flag = 0 ] ; then
+            echo "Getting SZIPLIB from $szip_env_file"
+            SZIPLIB=`head -1 $szip_env_file`
+        fi
+
+        if [ $szinc_flag = 0 ] ; then
+            echo "Getting SZIPINC from $szip_env_file"
+            SZIPINC=`tail -1 $szip_env_file`
+        fi
+
+    fi
+
+    #
+    # If SZIPINC or SZIPLIB is undefined at this point, then prompt for them
+    # Otherwise ask if they should be accepted, unless specified via the
+    # command line.  Check them in any case !
+    #
+
+    if [ $szlib_flag = 0 ] ; then
+        if [ "$SZIPLIB" = "" ] ; then
+            UserPrompt "Please enter the SZIP library files directory: "
+        else
+            echo "Current value of the SZIP library directory is: $SZIPLIB"
+            UserPrompt "New value (or Return to accept):"
+        fi
+        if [ "$user_response" != "" ] ; then
+            SZIPLIB="$user_response"
+        fi
+    fi
+
+    ValidSZIPLIB 	# make sure it's valid before proceeding
+    
+
+    if [ $szinc_flag = 0 ] ; then
+        if [ "$SZIPINC" = "" ] ; then
+            UserPrompt "Please enter the SZIP include files directory: "
+        else
+            echo "Current value of the SZIP include directory is: $SZIPINC"
+            UserPrompt "New value (or Return to accept):"
+        fi
+        if [ "$user_response" != "" ] ; then
+            SZIPINC="$user_response"
+        fi
+    fi
+
+    ValidSZIPINC  	# make sure it's valid before proceeding
+
+
+    echo ""
+    echo "SZIP include files in: $SZIPINC"
+    echo "SZIP library files in: $SZIPLIB"
+
+
+    cat /dev/null > $szip_env_file
+    echo $SZIPLIB >> $szip_env_file
+    echo $SZIPINC >> $szip_env_file
+    
+    export SZIPLIB SZIPINC
+
+}
+
+#
+# Function to set up architecture-dependent environment scripts
+#
+
+SetupEnvScripts()
+{
+
+echo ""
+echo ""
+echo "-----------------------------------------------------------------------"
+echo ""
+echo "Setting up installation-dependent scripts"
+echo ""
+echo "-----------------------------------------------------------------------"
+echo ""
+
+cd $HDFEOS5_BIN
+
+if [ -f ../tmp/hdfeos_env.ksh.tmp ] ; then
+
+    echo "    Setting up Korn shell (ksh) script 'hdfeos_env.ksh' "
+    echo "    Korn shell users may call this file from their .profile "
+    echo "    file via the the line:"
+    echo "    "
+    echo "        . $HDFEOS5_BIN/hdfeos_env.ksh  "
+    echo "    "
+    echo "    It sets up machine-specific environment variables needed "
+    echo "    by the HDFEOS5 makefiles for compilation and linking."
+    echo "    "
+
+    echo "# " > hdfeos_env.ksh
+
+    echo '# Clear all conditional flags'  	>> hdfeos_env.ksh
+    echo 'sgi_mode=""'  	>> hdfeos_env.ksh
+    echo 'hdfeos_f90_comp=""' 	>> hdfeos_env.ksh
+    echo 'hdfeos_nag_flag=""' 	>> hdfeos_env.ksh
+
+    if [ "`uname -m`" = "x86_64" ] || [ "`uname -m`" = "ia64" ] || [ "`uname -m`" = "i386" ] || [ "`uname -m`" = "i686" ] ; then
+	if [ "$MACINTEL_COMP_FLAG" = "-m32" ] ; then
+	    echo 'MACINTEL_COMP_FLAG="-m32"' 	>> hdfeos_env.ksh
+	    echo "MAC_BRAND=macintel32		# set MACINTEL for -32 mode" >> hdfeos_env.ksh
+	else
+	    echo 'MACINTEL_COMP_FLAG="-mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk -fPIC"' 	>> hdfeos_env.ksh
+	    echo "MAC_BRAND=macintel64		# set MACINTEL for -64 mode" >> hdfeos_env.ksh
+	fi
+    fi
+
+    if [ "`uname -m`" = "x86_64" ] ; then
+	if [ "$LNX_COMP_FLAG" = "-m32" ] ; then
+		echo 'LNX_COMP_FLAG="-m32"' 	>> hdfeos_env.ksh
+		echo "LINUX_BRAND=linux32		# set LINUX for -32 mode" >> hdfeos_env.ksh
+	else
+		echo 'LNX_COMP_FLAG=""' 	>> hdfeos_env.ksh
+		echo "LINUX_BRAND=linux64		# set LINUX for -64 mode" >> hdfeos_env.ksh
+	fi
+    elif [ "`uname -m`" = "ia64" ] ; then
+	if [ "$LNX_COMP_FLAG" = "-m32" ] ; then
+		echo 'LNX_COMP_FLAG="-m32"' 	>> hdfeos_env.ksh
+		echo "LINUX_BRAND=linux32		# set LINUX for -32 mode" >> hdfeos_env.ksh
+	else
+		echo 'LNX_COMP_FLAG=""' 	>> hdfeos_env.ksh
+
+	fi
+    else
+	echo 'LNX_COMP_FLAG=""' 	>> hdfeos_env.ksh
+	echo "LINUX_BRAND=linux		# set LINUX for -32 mode" >> hdfeos_env.ksh
+    fi
+
+    echo " " >> hdfeos_env.ksh
+    echo "# set the HDFEOS5 home directory and HDF5 variables" >> hdfeos_env.ksh
+    echo "# HDFEOS5 installation done on `date` " >> hdfeos_env.ksh
+    echo "# " >> hdfeos_env.ksh
+    echo " " >> hdfeos_env.ksh
+
+    echo "HDFEOS5_HOME=$HDFEOS5_HOME	# the HDFEOS5 home directory" >> hdfeos_env.ksh
+    echo "HDF5LIB=$HDF5LIB 		# the HDF5 lib directory" >> hdfeos_env.ksh
+    echo "HDF5INC=$HDF5INC 		# the HDF5 include directory" >> hdfeos_env.ksh
+    echo "SZIPLIB=$SZIPLIB 		# the SZIP lib directory" >> hdfeos_env.ksh
+    echo "SZIPINC=$SZIPINC 		# the SZIP include directory" >> hdfeos_env.ksh
+    case "$sgi_mode" in
+      64 ) echo "sgi_mode=64 		# SGI for -64 mode" >> hdfeos_env.ksh
+        ;;
+      n32 ) echo "sgi_mode=n32 		# SGI for -n32 mode" >> hdfeos_env.ksh
+        ;;
+      * ) echo "sgi_mode=64 		# SGI for standard mode" >> hdfeos_env.ksh
+        ;;
+    esac
+
+
+    if [ "$f90_flag" = "1" ] ; then	 	#  do FORTRAN-90 setup
+
+        echo "hdfeos_f90_comp='$F77' 		# f90 compiler" >> hdfeos_env.ksh
+
+        if [ "$nag_flag" = "1" ] ; then 	#  using NAG f90
+            echo "hdfeos_nag_flag=1		# using NAG f90" >> hdfeos_env.ksh
+        fi
+
+    fi
+
+    echo "opt_flag='$opt_flag'		# set compiler optimization level" >> hdfeos_env.ksh
+
+    echo " " >> hdfeos_env.ksh
+
+    echo "ext_cc_flags='$EXT_CC_FLAGS'	  # set compiler extra C flags" >> hdfeos_env.ksh
+
+    echo " " >> hdfeos_env.ksh
+
+    sed "s^LNX_CMP_FLAG^$LNX_COMP_FLAG^" ../tmp/hdfeos_env.ksh.tmp >> hdfeos_env.ksh.1
+    cat hdfeos_env.ksh.1 >> hdfeos_env.ksh
+    /bin/rm -f hdfeos_env.ksh.1
+    
+    sleep 3
+
+fi
+
+echo "                -----------------------------------"
+echo ""
+
+if [ -f ../tmp/hdfeos_env.csh.tmp ] ; then
+
+    echo "    Setting up C-shell (csh) script 'hdfeos_env.csh' "
+    echo "    This file may be called from your .cshrc file via the the line:"
+    echo "    "
+    echo "        source $HDFEOS5_BIN/hdfeos_env.csh  "
+    echo "    "
+    echo "    It sets up machine-specific environment variables needed "
+    echo "    by the HDFEOS5 makefiles for compilation and linking."
+    echo "    "
+
+    echo "# " > hdfeos_env.csh
+
+   if [ "`uname -m`" = "x86_64" ] || [ "`uname -m`" = "ia64" ] || [ "`uname -m`" = "i386" ] || [ "`uname -m`" = "i686" ] ; then
+	if [ "$MACINTEL_COMP_FLAG" = "-m32" ] ; then
+	    echo 'setenv MACINTEL_COMP_FLAG "-m32"' 	>> hdfeos_env.csh
+	    echo "set MAC_BRAND=macintel32		# set MACINTEL for -32 mode" >> hdfeos_env.csh
+	else
+	    echo 'setenv MACINTEL_COMP_FLAG "-mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk -fPIC"' 	>> hdfeos_env.csh
+	    echo "set MAC_BRAND=macintel64		# set MACINTEL for -64 mode" >> hdfeos_env.csh
+
+	fi
+    fi
+
+    if [ "`uname -m`" = "x86_64" ] ; then
+	if [ "$LNX_COMP_FLAG" = "-m32" ] ; then
+		echo 'setenv LNX_COMP_FLAG "-m32"' 	>> hdfeos_env.csh
+		echo "set LINUX_BRAND=linux32		# set LINUX for -32 mode" >> hdfeos_env.csh
+	else
+		echo 'setenv LNX_COMP_FLAG ""' 	        >> hdfeos_env.csh
+		echo "set LINUX_BRAND=linux64		# set LINUX for -64 mode" >> hdfeos_env.csh
+	fi
+    elif [ "`uname -m`" = "ia64" ] ; then
+	if [ "$LNX_COMP_FLAG" = "-m32" ] ; then
+		echo 'setenv LNX_COMP_FLAG "-m32"' 	>> hdfeos_env.csh
+		echo "set LINUX_BRAND=linux32		# set LINUX for -32 mode" >> hdfeos_env.csh
+	else
+		echo 'setenv LNX_COMP_FLAG ""' 	        >> hdfeos_env.csh
+		echo "set LINUX_BRAND=linux64		# set LINUX for -64 mode" >> hdfeos_env.csh
+	fi
+    else
+	echo 'setenv LNX_COMP_FLAG ""' 	>> hdfeos_env.csh
+	echo "set LINUX_BRAND=linux		# set LINUX for -32 mode" >> hdfeos_env.csh
+    fi
+
+    echo '# Clear all conditional flags'  	>> hdfeos_env.csh
+    echo "unset sgi_mode" 	>> hdfeos_env.csh
+    echo "unset hdfeos_f90_comp" 	>> hdfeos_env.csh
+    echo "unset hdfeos_nag_flag" 	>> hdfeos_env.csh
+
+    echo " " >> hdfeos_env.csh
+    echo "# set the HDFEOS5 home directory and HDF5 variables" >> hdfeos_env.csh
+    echo "# HDFEOS5 installation done on `date` " >> hdfeos_env.csh
+    echo "# " >> hdfeos_env.csh
+    echo " " >> hdfeos_env.csh
+
+    echo "setenv HDFEOS5_HOME $HDFEOS5_HOME	# the HDFEOS5 home directory" >> hdfeos_env.csh
+    echo "setenv HDF5LIB $HDF5LIB 		# the HDF5 lib directory" >> hdfeos_env.csh
+    echo "setenv HDF5INC $HDF5INC 		# the HDF5 include directory" >> hdfeos_env.csh
+    echo "setenv SZIPLIB $SZIPLIB 		# the SZIP lib directory" >> hdfeos_env.csh
+    echo "setenv SZIPINC $SZIPINC 		# the SZIP include directory" >> hdfeos_env.csh
+
+    case "$sgi_mode" in
+      64 ) echo "set sgi_mode=64 		# SGI for -64 mode" >> hdfeos_env.csh
+        ;;
+      n32 ) echo "set sgi_mode=n32 		# SGI for -n32 mode" >> hdfeos_env.csh
+        ;;
+      * ) echo "set sgi_mode=64 		# SGI for standard mode" >> hdfeos_env.csh
+        ;;
+    esac
+
+
+    if [ "$f90_flag" = "1" ] ; then 		# do FORTRAN-90 setup
+
+        echo "hdfeos_f90_comp='$F77' 		# f90 compiler" >> hdfeos_env.csh
+
+        if [ "$nag_flag" = "1" ] ; then 	# check if using NAG f90
+            echo "hdfeos_nag_flag=1		# using NAG f90" >> hdfeos_env.csh
+        fi
+
+    fi
+
+    echo "set opt_flag='$opt_flag'		# set compiler optimization level" >> hdfeos_env.csh
+
+    echo " " >> hdfeos_env.csh
+
+    echo "set ext_cc_flags='$EXT_CC_FLAGS'	# set compiler extra C flags" >> hdfeos_env.csh
+
+    echo " " >> hdfeos_env.csh
+
+    sed "s^LNX_CMP_FLAG^$LNX_COMP_FLAG^" ../tmp/hdfeos_env.csh.tmp >> hdfeos_env.csh.1
+    cat hdfeos_env.csh.1 >> hdfeos_env.csh
+    /bin/rm -f hdfeos_env.csh.1
+
+    sleep 3
+
+fi
+
+
+}
+
+
+#
+# Get parameters from command line
+#
+
+sgi_mode=64         # by default, SGI mode is standard 64-bit
+pgs_f90_comp=""     # by default, no FORTRAN-90 compiler
+pgs_nag_flag=0      # by default, not using NAG FORTRAN-90
+inc_flag=0          # HDF5INC override flag
+lib_flag=0          # HDF5LIB override flag
+szinc_flag=0		# SZIPINC override flag
+szlib_flag=0		# SZIPLIB override flag
+opt_flag=-O         # compiler optimization level
+ts_flag=""          # build threadsafe version flag
+fc_path=""
+cc_path=""
+ext_cc_flags=""
+
+while [ "$1" != "" ]
+do
+
+    case $1 in
+
+      -h | -he  | -hel  | -help  ) Help ;;	# help
+
+      -sgi32) sgi_mode=n32 ;;
+      -sgi64) sgi_mode=64 ;;
+
+      -dbug) opt_flag=-g ;;
+
+      -ts) ts_flag=-D_HDFEOS5_THREADSAFE ;;
+      -ts_dbug) ts_flag="-D_HDFEOS5_THREADSAFE -D_HDFEOS5_THREADSAFE_DEBUG" ;;
+
+      -fc_path ) fc_path="$2" ; shift ;;
+      -cc_path ) cc_path="$2" ; shift ;;
+
+      -i) HDF5INC=$2 ; inc_flag=1; shift ;;
+      -l) HDF5LIB=$2 ; lib_flag=1; shift ;;
+
+      -szi) SZIPINC=$2 ; szinc_flag=1; shift ;;
+      -szl) SZIPLIB=$2 ; szlib_flag=1; shift ;;
+
+      -i*) HDF5INC=`echo $1 | cut -c3-` ; inc_flag=1 ;;
+      -l*) HDF5LIB=`echo $1 | cut -c3-` ; lib_flag=1 ;;
+
+      -szi*) SZIPINC=`echo $1 | cut -c5-` ; szinc_flag=1 ;;
+      -szl*) SZIPLIB=`echo $1 | cut -c5-` ; szlib_flag=1 ;;
+
+      -*)
+        echo "Invalid option: $1"
+        Help
+        ;;
+
+      *) 				# default
+        value1="$1"
+        ;;
+
+    esac
+
+    shift
+
+done
+
+
+
+# set path to a base subset of directories, allowing startup on unknown host
+# note: once the host has been determined the path is appropriately customized
+
+PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11
+export PATH 
+
+# get operating system type, login name
+# special cases: SCO and Cray  - uname works differently,
+
+MACHINE="`uname -m | awk '{print $1}'`"	# needed on Cray & SCO
+temp_ostype=`uname`
+
+case "$MACHINE" in
+    i386) OSTYPE=sco386 ;;		# SCO box
+    i686) OSTYPE=sco686 ;;      # Pentium
+    CRAY) OSTYPE=UNICOS ;;		# CRAY
+    *) OSTYPE="`uname`"	;;		# everybody else
+esac
+    
+CYGPL="`uname | awk -F_ '{print $1}'`"  
+         
+# Intel Macintosh is also i386 or i686 (?) machine
+
+    if [ "$MACHINE" = "i386" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	    echo "MAC_BRAND = $MAC_BRAND"
+	    if [ "$MAC_BRAND" = "" ] ; then 
+		echo " Error: In 64-bit MAC platform the env. variable MAC_BRAND must be set to mac32 or mac64 before running this script."
+		exit 1
+	    fi
+	fi
+	if [ "$CYGPL" = "CYGWIN" ] ; then 
+	    OSTYPE=Cygwin
+	fi
+    fi
+    if [ "$MACHINE" = "i686" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	    echo "MAC_BRAND = $MAC_BRAND"
+	    if [ "$MAC_BRAND" = "" ] ; then 
+		echo " Error: In 64-bit MAC platform the env. variable MAC_BRAND must be set to mac32 or mac64 before running this script."
+		exit 1
+	    fi
+	fi
+	if [ "$CYGPL" = "CYGWIN" ] ; then 
+	    OSTYPE=Cygwin
+	fi
+    fi
+    if [ "$MACHINE" = "x86_64" ]  || [ "$machine" = "ia64" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then
+	    OSTYPE=DarwinIntel
+	    echo "MAC_BRAND = $MAC_BRAND"
+	    if [ "$MAC_BRAND" = "" ] ; then 
+		echo " Error: In 64-bit MAC platform the env. variable MAC_BRAND must be set to mac32 or mac64 before running this script."
+		exit 1
+	    else
+		if [ "$MAC_BRAND" = "macintel32" ] ; then
+		    if [ "$MACINTEL_COMP_FLAG" = ""  ] ; then
+			MACINTEL_COMP_FLAG="-m32"
+		    fi
+		fi
+		if [ "$MAC_BRAND" = "macintel64" ] ; then
+		    if [ "$MACINTEL_COMP_FLAG" = ""  ] ; then
+			MACINTEL_COMP_FLAG="-mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk -fPIC"
+		    fi
+		fi
+	    fi
+	elif [ "$temp_ostype" = "Linux" ] ; then
+	    if [ "$LINUX_BRAND" = "" ] ; then 
+		echo " Error: In 64-bit linux platform the env. variable LINUX_BRAND must be set to linux32 or linux64 before running this script."
+		exit 1
+	    else
+		if [ "$LINUX_BRAND" = "linux32" ] ; then
+		    if [ "$LNX_COMP_FLAG" = ""  ] ; then
+			LNX_COMP_FLAG="-m32"
+		    fi
+		fi
+	    fi
+	fi
+    fi
+
+user=`id | cut -d\( -f2 | cut -d\) -f1`
+
+if [ "$LOGNAME" != "$user"  ] ; then
+        LOGNAME=$user
+        export LOGNAME
+fi
+if [ "$USER" != "$LOGNAME"  ] ; then
+        LOGNAME=$LOGNAME
+        export USER
+fi
+
+
+# set machine-dependent environment variables:
+# 	HOST   the host name of this machine
+# 	BRAND  used by other achitecture-specific code
+# 	OS_VERSION  used by other achitecture-specific code
+# 	PATH   the execution search path 
+
+case "$OSTYPE" in
+
+  AIX) 
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/sbin
+    HOST="`hostname`"
+    BRAND="ibm"
+    ;;
+
+  HP-UX) 
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/bin/X11
+    HOST="`hostname`"
+    BRAND="hp"
+    if [ `uname -r | awk -F. '{print $2}'` = "11" ] ; then 
+        OS_VERSION="11"			# release 11 
+        echo HP-UX 11 platform
+    else
+        OS_VERSION="10"                 # release 10
+        echo HP-UX 10 platform
+    fi
+    ;;
+
+  IRIX) 
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bsd:/usr/sbin
+    HOST="`hostname`"
+    if [ `uname -r | awk -F. '{print $2}'` = "5" ] ; then
+       OS_VERSION="5"                  # release V6.5 IRIX
+       echo IRIX 6.5 platform
+       case $sgi_mode in
+          64 ) BRAND=sgi64 ;;
+          n32) BRAND=sgi32 ;;
+          *  ) BRAND=sgi64 ;;  # just in case
+       esac
+    fi
+    if [ `uname -r | awk -F. '{print $2}'` = "2" ] ; then
+       OS_VERSION="2"                  # release V6.2 IRIX
+       echo IRIX 6.2 platform
+       case $sgi_mode in
+          64 ) BRAND=sgi64 ;;
+          n32) BRAND=sgi32 ;;
+          *  ) BRAND=sgi64 ;;  # just in case
+       esac
+    else
+       BRAND="sgi"
+    fi
+    ;;
+
+  IRIX64) 
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bsd:/usr/sbin
+    HOST="`hostname`"
+    if [ `uname -r | awk -F. '{print $2}'` = "5" ] ; then
+       OS_VERSION="5"                  # release V6.5 IRIX
+       echo IRIX 6.5 platform
+       case $sgi_mode in
+          64 ) BRAND=sgi64 ;;
+          n32) BRAND=sgi32 ;;
+          *  ) BRAND=sgi64 ;;  # just in case
+       esac
+    else
+       OS_VERSION="2"                  # release V6.2 IRIX
+       echo IRIX 6.2 platform
+       case $sgi_mode in
+          64 ) BRAND=sgi64 ;;
+          n32) BRAND=sgi32 ;;
+          *  ) BRAND=sgi64 ;;  # just in case
+       esac
+    fi
+    ;;
+
+  Linux )
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/X11/bin
+    HOST=`hostname`
+    BRAND=linux
+    if [ "$LINUX_BRAND" = "linux64" ] ; then
+	BRAND=linux64
+    elif [ "$LINUX_BRAND" = "linux32" ] ; then
+	BRAND=linux32
+    fi
+    if [ "$LNX_COMP_FLAG" = "-m32"  ] ; then
+        export LNX_COMP_FLAG
+    else
+	LNX_COMP_FLAG=""
+	export LNX_COMP_FLAG
+    fi
+    ;;
+
+  Darwin)
+    PATH=/bin:/sbin:/usr/bin:/usr/sbin
+    pgs_host=`hostname`
+    BRAND=macintosh
+    ;;
+
+  DarwinIntel)
+    PATH=/bin:/sbin:/usr/bin:/usr/sbin
+    pgs_host=`hostname`
+    BRAND=macintel32
+    if [ "$MAC_BRAND" = "macintel64" ] ; then
+	BRAND=macintel64
+    elif [ "$MAC_BRAND" = "macintel32" ] ; then
+	BRAND=macintel32
+    fi
+    if [ "$MACINTEL_COMP_FLAG" = "-m32"  ] ; then
+        export MACINTEL_COMP_FLAG
+    else
+	MACINTEL_COMP_FLAG="-mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk -fPIC"
+	export MACINTEL_COMP_FLAG
+    fi
+    ;;
+
+  Cygwin)
+    PATH=/bin:/sbin:/usr/bin:/usr/sbin
+    pgs_host=`hostname`
+    BRAND=cygwin
+    ;;
+
+  OSF1) 
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/sbin
+    HOST="`hostname -s`"
+    BRAND="dec"
+    ;;
+
+  sco386 ) 
+    if [ "`uname`" = "Linux" ] ; then
+	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/X11/bin
+	HOST="`hostname`"
+	BRAND=linux
+	if [ "$LINUX_BRAND" = "linux64" ] ; then
+	    BRAND=linux64
+	elif [ "$LINUX_BRAND" = "linux32" ] ; then
+	    BRAND=linux32
+	fi
+    elif [ "`uname`" = "Darwin" ] ; then
+	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/X11/bin
+	HOST="`hostname`"
+	BRAND=macintel32
+	if [ "$MAC_BRAND" = "macintel64" ] ; then
+	    BRAND=macintel64
+	elif [ "$MAC_BRAND" = "macintel32" ] ; then
+	    BRAND=macintel32
+	fi
+    else
+	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/bin/X11
+	HOST="`hostname -s`"
+	BRAND="sco"
+    fi
+    ;;
+
+  sco686 ) 
+    if [ "`uname`" = "Linux" ] ; then
+	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/X11/bin
+	HOST="`hostname`"
+	BRAND=linux
+	if [ "$LINUX_BRAND" = "linux64" ] ; then
+	    BRAND=linux64
+	elif [ "$LINUX_BRAND" = "linux32" ] ; then
+	    BRAND=linux32
+	fi
+    elif [ "`uname`" = "Darwin" ] ; then
+	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/X11/bin
+	HOST="`hostname`"
+	BRAND=macintel32
+	HOST="`hostname`"
+	BRAND="winnt98"
+	if [ "$MAC_BRAND" = "macintel64" ] ; then
+	    BRAND=macintel64
+	elif [ "$MAC_BRAND" = "macintel32" ] ; then
+	    BRAND=macintel32
+	fi
+    else
+	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/bin/X11
+	HOST="`hostname`"
+	BRAND="winnt98"
+    fi
+    ;;
+
+  SunOS) 
+    # distinguish between SunOS 5.x versions
+    if [ `uname -r | awk -F. '{print $1}'` = "5" ] ; then 
+       	if [ `uname -r | awk -F. '{print $2}'` = "10" ] ; then
+	    OS_VERSION="10"                # release V5.10 SunOS
+	    BRAND="sun5.10"			# release V5.x SunOS
+	    echo Solaris 10 platform
+	elif [ `uname -r | awk -F. '{print $2}'` = "9" ] ; then
+	    OS_VERSION="9"                # release V5.9 SunOS
+	    BRAND="sun5.9"			# release V5.x SunOS
+	    echo Solaris 9 platform
+	elif [ `uname -r | awk -F. '{print $2}'` = "8" ] ; then
+          OS_VERSION="8"                # release V5.8 SunOS
+          BRAND="sun5.8"		# release V5.x SunOS
+          echo Solaris 2.8 platform
+       else
+          OS_VERSION="5"                # release V5.8 SunOS
+          BRAND="sun5"			# release V5.x SunOS
+          echo Solaris 2.5 platform
+       fi
+       PATH=/usr/local/bin:/opt/SUNWspro/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin:/usr/ccs/bin
+    fi
+    HOST="`hostname`"
+    ;;
+
+  UNICOS) 
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/bin/X11
+    HOST="`hostname`"
+    BRAND="cray"
+    ;;
+
+  *)	
+    echo "Operating system: $OSTYPE not supported"
+    echo "This release of HDFEOS5 supports: "
+    echo "   Sun, SGI, HP-9000, Linux and DEC-Alpha "
+    ;;
+
+esac
+
+export PATH HOST BRAND
+
+
+#
+# Flag IRIX 6.2 because this may impact on makefiles
+#
+
+irix53=0
+case $BRAND in
+  sgi ) 
+    if [ "$OSTYPE" = "IRIX" ] ; then
+        irix53=1 
+    fi
+    ;;
+esac
+export irix53
+
+
+# set machine-dependent compilers and compilation switches:
+#
+#
+
+NSL_FLAG="" 			# this is nil on all but Sun platforms
+NSL_LIB="" 			# this is nil on all but Sun platforms
+AR="ar"			# command to build library
+RANLIB=touch			# default for platforms that don't need ranlib
+RANLIBSUN4=touch		# default for platforms that don't need ranlib
+
+case "$BRAND" in
+
+    cray)
+	CC=cc 			  # C compiler
+	CFLAGS="$opt_flag $EXT_CC_FLAGS -DH5_USE_16_API" # default C flags (optimize, ansi)
+	C_CFH="-DCRAYFortran"     # C/cfortran.h called from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	  # calling FORTRAN
+	C_F77_LIB=""		  # FORTRAN lib called by C main
+	F77=cf77		  # FORTRAN compiler
+	F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"	  # common FORTRAN flags
+	F77_CFH=""		  # FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	  # calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	  # old version of F77_C_CFH
+	F77_C_LIB=""		  # C lib called by FORTRAN main 
+	HDFSYS=UNICOS		  # system type as defined by HDF5
+	MACHINE=CRAY		  # system type as defined by HDFEOS5
+	;;
+
+    dec)
+	CC=cc 			         # C compiler
+	CFLAGS="$opt_flag $EXT_CC_FLAGS $ts_flag -std -DH5_USE_16_API" # default C flags
+	C_CFH="-DDECFortran"	         # C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH"        # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH -Dmain=MAIN__" # calling FORTRAN
+	C_F77_LIB=""		         # FORTRAN lib called by C main
+	F77=f77 		         # FORTRAN compiler
+	F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"	         # common FORTRAN flags
+	F77_CFH=""		         # FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH "            # calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	         # old version of F77_C_CFH
+	F77_C_LIB=""		         # C lib called by FORTRAN main
+	HDFSYS=DEC_ALPHA	         # system type as defined by HDF5
+	MACHINE=DEC		         # system type as defined by HDFEOS5
+	;;
+
+    hp)
+	CC=cc			         # C compiler
+	CFLAGS="$opt_flag $EXT_CC_FLAGS $ts_flag -Ae -DH5_USE_16_API"  # default C flags
+	C_CFH="" 		         # C w/cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH"        # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	         # calling FORTRAN
+	C_F77_LIB=""		         # FORTRAN lib called by C main 
+	F77=fort77		         # FORTRAN compiler
+	F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"	         # common FORTRAN flags
+	F77_CFH=""		         # FORTRAN callable from C w/cfortran.h
+	F77_C_CFH="$F77_CFH"	         # calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	         # old version of F77_C_CFH
+	F77_C_LIB=""		         # C lib called by FORTRAN main
+	HDFSYS=HP9000		         # system type as defined by HDF5
+	MACHINE=HP		         # system type as defined by HDFEOS5
+	;;
+
+    ibm)
+	CC=cc 			         # C compiler
+	CFLAGS="$opt_flag $EXT_CC_FLAGS  $ts_flag -qlanglvl=ansi -DH5_USE_16_API" # default C flags (optimize, ansi)
+	C_CFH="" 		         # C w/cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH"        # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	         # calling FORTRAN
+	C_F77_LIB=""		         # FORTRAN lib called by C main  FORTAN
+	F77=xlf 		         # FORTRAN compiler
+	F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"	         # common FORTRAN flags
+	F77_CFH="" 		         # FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	         # calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	         # old version of F77_C_CFH
+	F77_C_LIB=""		         # C lib called by FORTRAN main
+	HDFSYS=IBM6000		         # system type as defined by HDF5
+	MACHINE=IBM		         # system type as defined by HDFEOS5
+	;;
+
+    linux | linux32 | linux64)
+
+	#CC="gcc -m32"  		        # C compiler
+	CC="gcc $LNX_COMP_FLAG"  		# C compiler
+	CFLAGS="$opt_flag $EXT_CC_FLAGS $ts_flag -ansi -DH5_USE_16_API"       # default C flags
+	C_CFH="-Df2cFortran"	         # C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH"        # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	         # calling FORTRAN
+	C_F77_LIB=""		         # FORTRAN lib called by C main
+	#F77="g77 -m32"			 # FORTRAN compiler
+	F77="g77 $LNX_COMP_FLAG"			 # FORTRAN compiler
+	F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"	         # common FORTRAN flags
+	F77_CFH=""		         # FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	         # calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	         # old version of F77_C_CFH
+	F77_C_LIB=""		         # C lib called by FORTRAN main
+        if [ "`uname -m`" = "x86_64" ] ; then
+	    if [ "$LNX_COMP_FLAG" = "-m32" ] ; then
+		HDFSYS=LINUX		# system type as defined by HDF5
+	    else
+		HDFSYS=LINUX64       # Only for 64 bit linux
+	    fi
+	elif [ "`uname -m`" = "ia64" ] ; then
+	    if [ "$LNX_COMP_FLAG" = "-m32" ] ; then
+		HDFSYS=LINUX		# system type as defined by HDF5
+	    else
+		HDFSYS=IA64          #Only for IA64
+	    fi
+        else
+	   HDFSYS=LINUX		# system type as defined by HDF
+	fi
+	MACHINE=LINUX		         # system type as defined by HDFEOS5
+	;;
+
+    macintosh)
+        CC=gcc                    # C compiler
+        CFLAGS="$opt_flag $EXT_CC_FLAGS  $ts_flag -ansi -D_ANSI_SOURCE -DH5_USE_16_API"  # default C flags (optimize, ansi)
+        C_CFH="-Df2cFortran"      # C w/ cfortran.h callable from FORTRAN
+        CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+        C_F77_CFH="$C_CFH"        # calling FORTRAN
+        C_F77_LIB=""              # FORTRAN lib called by C main
+        F77=g77                   # FORTRAN compiler
+        F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"      # common FORTRAN flags
+        F77_CFH=""                # FORTRAN callable from C w/ cfortran.h
+        F77_C_CFH="$F77_CFH"      # calling C w/ cfortran.h
+        CFH_F77="$F77_C_CFH"      # old version of F77_C_CFH
+        F77_C_LIB=""              # C lib called by FORTRAN main
+        HDFSYS=MACINTOSH          # system type as defined by HDF5
+        MACHINE=MACINTOSH         # system type as defined by HDFEOS5
+        ;;
+
+    macintel)
+        CC="gcc $MACINTEL_COMP_FLAG"                  # C compiler
+        CFLAGS="$opt_flag $EXT_CC_FLAGS  $ts_flag -ansi -D_ANSI_SOURCE -DH5_USE_16_API"  # default C flags (optimize, ansi)
+        C_CFH="-Df2cFortran"      # C w/ cfortran.h callable from FORTRAN
+        CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+        C_F77_CFH="$C_CFH"        # calling FORTRAN
+        C_F77_LIB=""              # FORTRAN lib called by C main
+        F77="gfortran $MACINTEL_COMP_FLAG"              # FORTRAN compiler
+        F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"      # common FORTRAN flags
+        F77_CFH=""                # FORTRAN callable from C w/ cfortran.h
+        F77_C_CFH="$F77_CFH"      # calling C w/ cfortran.h
+        CFH_F77="$F77_C_CFH"      # old version of F77_C_CFH
+        F77_C_LIB=""              # C lib called by FORTRAN main
+        HDFSYS=MACINTEL           # system type as defined by HDF5
+        MACHINE=MACINTEL          # system type as defined by HDFEOS5
+        ;;
+
+    macintel32)
+        CC="gcc $MACINTEL_COMP_FLAG"                   # C compiler
+        CFLAGS="$opt_flag $EXT_CC_FLAGS  $ts_flag -ansi -D_ANSI_SOURCE -DH5_USE_16_API"  # default C flags (optimize, ansi)
+        C_CFH="-Df2cFortran"      # C w/ cfortran.h callable from FORTRAN
+        CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+        C_F77_CFH="$C_CFH"        # calling FORTRAN
+        C_F77_LIB=""              # FORTRAN lib called by C main
+        F77="gfortran $MACINTEL_COMP_FLAG"              # FORTRAN compiler
+        F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"      # common FORTRAN flags
+        F77_CFH=""                # FORTRAN callable from C w/ cfortran.h
+        F77_C_CFH="$F77_CFH"      # calling C w/ cfortran.h
+        CFH_F77="$F77_C_CFH"      # old version of F77_C_CFH
+        F77_C_LIB=""              # C lib called by FORTRAN main
+        HDFSYS=MACINTEL           # system type as defined by HDF5
+        MACHINE=MACINTEL          # system type as defined by HDFEOS5
+        ;;
+
+    macintel64)
+        CC="gcc $MACINTEL_COMP_FLAG"                    # C compiler
+        CFLAGS="$opt_flag $EXT_CC_FLAGS  $ts_flag -ansi -D_ANSI_SOURCE -DH5_USE_16_API"  # default C flags (optimize, ansi)
+        C_CFH="-Df2cFortran"      # C w/ cfortran.h callable from FORTRAN
+        CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+        C_F77_CFH="$C_CFH"        # calling FORTRAN
+        C_F77_LIB=""              # FORTRAN lib called by C main
+        F77="gfortran $MACINTEL_COMP_FLAG"              # FORTRAN compiler
+        F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"      # common FORTRAN flags
+        F77_CFH=""                # FORTRAN callable from C w/ cfortran.h
+        F77_C_CFH="$F77_CFH"      # calling C w/ cfortran.h
+        CFH_F77="$F77_C_CFH"      # old version of F77_C_CFH
+        F77_C_LIB=""              # C lib called by FORTRAN main
+        HDFSYS=MACINTEL           # system type as defined by HDF5
+        MACHINE=MACINTEL          # system type as defined by HDFEOS5
+        ;;
+
+    cygwin)
+        CC=gcc                  # C compiler
+        CFLAGS="$opt_flag $EXT_CC_FLAGS  $ts_flag -ansi -DH5_USE_16_API" # default C flags (optimize, ansi)
+        C_CFH="-Df2cFortran"    # C w/ cfortran.h callable from FORTRAN
+        CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+        C_F77_CFH="$C_CFH"      # calling FORTRAN
+        C_F77_LIB=""            # FORTRAN lib called by C main
+        F77=g77                 # FORTRAN compiler
+        F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"    # common FORTRAN flags
+        F77_CFH=""              # FORTRAN callable from C w/ cfortran.h
+        F77_C_CFH="$F77_CFH"    # calling C w/ cfortran.h
+        CFH_F77="$F77_C_CFH"    # old version of F77_C_CFH
+        F77_C_LIB=""            # C lib called by FORTRAN main
+        RANLIB=ranlib		# activate the ranlib command
+	HDFSYS=CYGWIN           # system type as defined by HDF
+        MACHINE=CYGWIN          # system type as defined by HDFEOS
+        ;;
+
+    sco)
+	CC=cc  			  # C compiler
+	CFLAGS="$opt_flag $EXT_CC_FLAGS -posix -DH5_USE_16_API" # default C flags (optimize, ansi)
+	C_CFH="-Df2cFortran"	  # C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	  # calling FORTRAN
+	C_F77_LIB=""		  # FORTRAN lib called by C main
+	F77=""		 	  # FORTRAN compiler
+	F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"	  # common FORTRAN flags
+	F77_CFH=""		  # FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	  # calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	  # old version of F77_C_CFH
+	F77_C_LIB=""		  # C lib called by FORTRAN main
+	HDFSYS=SCO		  # system type as defined by HDF5
+	MACHINE=SCO		  # system type as defined by HDFEOS5
+	;;
+
+    sgi32)
+	CC="cc -n32"		        # C compiler (new-style 32 bit)
+	F77="f77 -n32"		        # FORTRAN compiler (new-style 32 bit)
+	CFLAGS="$opt_flag $EXT_CC_FLAGS  -xansi -D_POSIX_SOURCE $ts_flag -DH5_USE_16_API"# default C flags
+	C_CFH=""	 	        # C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH"       # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	        # calling FORTRAN
+	C_F77_LIB="-lI77 -lU77 -lF77"   # FORTRAN lib called by C main
+	F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"	        # common FORTRAN flags
+	F77_CFH=""		        # FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	        # calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	        # old version of F77_C_CFH
+	F77_C_LIB=""		        # C lib called by FORTRAN main
+	HDFSYS=IRIS4		        # system type as defined by HDF5
+	MACHINE=SGI		        # system type as defined by HDFEOS5
+	;;
+
+    sgi64)
+	cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+	if [ "$cpu_type" = "4" ] ; then
+	    CC="cc -64 -mips3"		# C compiler (R4?00 chip)
+	    F77="f77 -64 -mips3"	# FORTRAN compiler (R4?00 chip)
+        else
+            CC="cc -64"      		# C compiler
+            F77="f77 -64"    		# FORTRAN compiler
+        fi
+	CFLAGS="$opt_flag $EXT_CC_FLAGS -xansi -D_POSIX_SOURCE $ts_flag -DH5_USE_16_API"   # default C flags
+	C_CFH=""	 	        # C w/cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH"       # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	        # calling FORTRAN
+	C_F77_LIB="-lI77 -lU77 -lF77"   # FORTRAN lib called by C main
+	F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"	        # common FORTRAN flags
+	F77_CFH=""		        # FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	        # calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	        # old version of F77_C_CFH
+	F77_C_LIB=""		        # C lib called by FORTRAN main
+	HDFSYS=IRIS4	 	        # system type as defined by HDF5
+	MACHINE=SGI		        # system type as defined by HDFEOS5
+	;;
+
+    sun5)
+	CC=cc			        # C compiler
+	CFLAGS="$opt_flag $EXT_CC_FLAGS -Xa $ts_flag -DH5_USE_16_API" # default C flags
+	C_CFH="-DsunFortran"	        # C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH"       # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	        # calling FORTRAN
+	C_F77_LIB=""		        # FORTRAN lib called by C main
+	F77=f77 		        # FORTRAN compiler
+	F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"	        # common FORTRAN flags
+	F77_CFH=""		        # FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH" 	        # calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	        # old version of F77_C_CFH
+	F77_C_LIB="-lm" 	        # C lib called by FORTRAN main
+	HDFSYS=SUN		        # system type as defined by HDF5
+	MACHINE=SUN5		        # system type as defined by HDFEOS5
+	NSL_FLAG="-lnsl"	        # this is nil on all but Sun platforms
+	NSL_LIB="/usr/lib/libnsl.a"	# this is nil on all but Sun platforms
+	;;
+
+    sun5.8)
+	CC=cc			        # C compiler
+	CFLAGS="$opt_flag $EXT_CC_FLAGS $ts_flag -Xa -DH5_USE_16_API" # default C flags
+	C_CFH="-DsunFortran"	        # C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH"       # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	        # calling FORTRAN
+	C_F77_LIB=""		        # FORTRAN lib called by C main
+	F77=f77 		        # FORTRAN compiler
+	F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"	        # common FORTRAN flags
+	F77_CFH=""		        # FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH" 	        # calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	        # old version of F77_C_CFH
+	F77_C_LIB="-lm" 	        # C lib called by FORTRAN main
+	HDFSYS=SUN		        # system type as defined by HDF5
+	MACHINE=SUN8		        # system type as defined by HDFEOS5
+	NSL_FLAG="-lnsl"	        # this is nil on all but Sun platforms
+	NSL_LIB="/usr/lib/libnsl.a"	# this is nil on all but Sun platforms
+	;;
+
+    sun5.9)
+	CC=cc			        # C compiler
+	CFLAGS="$opt_flag $EXT_CC_FLAGS $ts_flag -Xa -DH5_USE_16_API" # default C flags
+	C_CFH="-DsunFortran"	        # C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH"       # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	        # calling FORTRAN
+	C_F77_LIB=""		        # FORTRAN lib called by C main
+	F77=f77 		        # FORTRAN compiler
+	F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"	        # common FORTRAN flags
+	F77_CFH=""		        # FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH" 	        # calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	        # old version of F77_C_CFH
+	F77_C_LIB="-lm" 	        # C lib called by FORTRAN main
+	HDFSYS=SUN		        # system type as defined by HDF5
+	MACHINE=SUN9		        # system type as defined by HDFEOS5
+	NSL_FLAG="-lnsl"	        # this is nil on all but Sun platforms
+	NSL_LIB="/usr/lib/libnsl.a"	# this is nil on all but Sun platforms
+	;;
+
+    sun5.10)
+	CC=cc			        # C compiler
+	CFLAGS="$opt_flag $EXT_CC_FLAGS $ts_flag -Xa -DH5_USE_16_API" # default C flags
+	C_CFH="-DsunFortran"	        # C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH"       # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	        # calling FORTRAN
+	C_F77_LIB=""		        # FORTRAN lib called by C main
+	F77=f77 		        # FORTRAN compiler
+	F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"	        # common FORTRAN flags
+	F77_CFH=""		        # FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH" 	        # calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	        # old version of F77_C_CFH
+	F77_C_LIB="-lm" 	        # C lib called by FORTRAN main
+	HDFSYS=SUN		        # system type as defined by HDF5
+	MACHINE=SUN10		        # system type as defined by HDFEOS5
+	NSL_FLAG="-lnsl"	        # this is nil on all but Sun platforms
+	NSL_LIB="/usr/lib/libnsl.a"	# this is nil on all but Sun platforms
+	;;
+
+  winnt98 )
+    CPP=CC                  # C++ compiler
+    CC=gcc                  # C compiler
+    CFLAGS="$opt_flag $EXT_CC_FLAGS -O3 -Wall -W -Wundef -Wno-switch -DH5_USE_16_API"     # default C flags (optimize, ansi)
+    C_CFH="-Df2cFortran"    # C w/ cfortran.h callable from FORTRAN
+    CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+    CPPFLAGS="$EXT_CPP_FLAGS -g -ansi -DH5_USE_16_API"     # default C ++ flags (optimize, ansi)
+    CPP_CFH="-Df2cFortran"  # C ++ w/ cfortran.h callable from FORTRAN
+    CPPFHFLAGS="$CPPFLAGS $CPP_CFH" # CFLAGS + C_CFH for C++
+    F77=g77                 # FORTRAN compiler
+    F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"    # common FORTRAN flags
+    HDFSYS=CYGWIN           # system type as defined by HDF
+    ;;
+
+    *)
+	CC=cc			  # C compiler
+	CFLAGS="$opt_flag $EXT_CC_FLAGS -DH5_USE_16_API" 	  # default C flags (optimize)
+	C_CFH=""	          # C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	  # calling FORTRAN
+	C_F77_LIB=""		  # FORTRAN lib called by C main
+	F77=f77 		  # FORTRAN compiler
+	F77FLAGS="$opt_flag $EXT_FC_FLAGS -DH5_USE_16_API"	  # common FORTRAN flags
+	F77_CFH=""	 	  # FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH" 	  # calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	  # old version of F77_C_CFH
+	F77_C_LIB="-lm" 	  # C lib called by FORTRAN main
+	HDFSYS=unknown		  # system type as defined by HDF5
+	MACHINE=unknown		  # system type as defined by HDFEOS5
+	;;
+esac
+export NSL_FLAG NSL_LIB AR RANLIB RANLIBSUN4
+export CC CFLAGS C_CFH CFHFLAGS C_F77_CFH C_F77_LIB F77
+export F77FLAGS F77_CFH F77_C_CFH CFH_F77 F77_C_LIB HDFSYS
+
+#
+# Verify that this is the HDFEOS5 home directory before proceeding
+# If OK, then set the value of HDFEOS5_HOME, else quit.
+
+dirs="bin include lib obj src"
+ok=1
+
+for dir in $dirs ; do
+
+    if [ ! -d $dir ] ; then
+        ok=0
+        break
+    fi
+
+done
+
+if [ $ok = 1 ] ; then
+
+    HDFEOS5_HOME=`pwd`
+
+else
+
+    WriteError "You must first go to the HDFEOS5 home directory."
+    Help
+
+fi
+
+dirs="bin lib obj"
+for dir in $dirs ; do
+
+    if [ ! -d $dir/$BRAND ] ; then
+	mkdir $dir/$BRAND
+    fi
+
+done
+
+#
+# For linux create soft links for backward compatibility with 
+#                 older versions of the hdfeos5
+#
+    if [ "$BRAND" = "linux64" ] ; then
+	    
+	echo "64-bit structure is the default in this machine. Creating linux as soft link to linux64 in bin, lib, and obj directories."
+
+	dirs="bin lib obj"
+	for dir in $dirs ; do
+# back up existing linux diretory
+	    if [ -d $dir/linux ] ; then
+		/bin/mv  $dir/linux $dir/linux_backup
+	    fi
+	    ln -s ./$BRAND $dir/linux
+	done
+    fi
+
+    if [ "$BRAND" = "linux" ] ; then
+
+	echo "32-bit structure is the default in this machine. Creating linux32 as soft link to linux in bin, lib, and obj directories."
+
+	dirs="bin lib obj"
+	for dir in $dirs ; do
+# back up existing linux32 diretory
+	    if [ -d $dir/linux32 ] ; then
+		/bin/mv  $dir/linux32 $dir/linux32_backup
+	    fi
+	    ln -s ./$BRAND $dir/linux32
+	done
+    fi
+
+#
+# For macintel create soft links for backward compatibility with 
+#                 older versions of the hdfeos5
+#
+    if [ "$BRAND" = "macintel32" ] ; then
+	    
+	echo "macintel32 directories will be soft linked to macintel. Creating macintel as soft link to macintel32 in bin, lib, and obj directories."
+
+	dirs="bin lib obj"
+	for dir in $dirs ; do
+# back up existing macintel diretory
+	    if [ -d $dir/macintel ] ; then
+		/bin/mv  $dir/macintel $dir/macintel_backup
+	    fi
+	    ln -s ./$BRAND $dir/macintel
+	done
+    fi
+
+    if [ "$BRAND" = "macintel" ] ; then
+
+	echo "32-bit structure is the default in this machine. Creating macintel32 as soft link to macintel in bin, lib, and obj directories."
+
+	dirs="bin lib obj"
+	for dir in $dirs ; do
+# back up existing macintel32 diretory
+	    if [ -d $dir/macintel32 ] ; then
+		/bin/mv  $dir/macintel32 $dir/macintel32_backup
+	    fi
+	    ln -s ./$BRAND $dir/macintel32
+	done
+    fi
+
+#
+# set HDFEOS5-related environment variables
+# these may be referred to in makefiles and on compiler command lines
+#
+
+if [ "$HDFEOS5_HOME" != "" ] ; then
+
+# set up base set of HDFEOS5 directory variables.
+
+    HDFEOS5_BIN=${HDFEOS5_HOME}/bin/$BRAND	# executable files
+    HDFEOS5_INC=$HDFEOS5_HOME/include		# include header files
+    HDFEOS5_LIB=${HDFEOS5_HOME}/lib/$BRAND  	# library files
+    HDFEOS5_OBJ=${HDFEOS5_HOME}/obj/$BRAND	# object files
+    HDFEOS5_SRC=$HDFEOS5_HOME/src		# HDFEOS5 source files
+
+    export HDFEOS5_HOME HDFEOS5_BIN HDFEOS5_DAT HDFEOS5_INC HDFEOS5_LIB 
+    export HDFEOS5_MSG  HDFEOS5_OBJ HDFEOS5_RUN HDFEOS5_SRC HDFEOS5_TST
+
+# update path variables
+
+    PATH=$PATH:$HDFEOS5_BIN; export PATH	# add HDFEOS5_BIN to path
+
+else
+
+    echo "You must first set the environment variable HDFEOS5_HOME"
+    exit 1
+
+fi
+
+
+# 
+# set up environment to handle FORTRAN-90 compiler
+#
+
+if [ "$pgs_f90_comp" != "" ] ; then		# using FORTRAN-90
+
+    F77="$pgs_f90_comp"
+
+    if [ "$pgs_nag_flag" = "1" ] ; then		# using NAG f90
+        C_CFH="$C_CFH -DNAGf90F"
+        CFHFLAGS="$CFLAGS $C_CFH"
+    fi
+
+    export CFHFLAGS C_CFH F77
+
+fi
+
+#
+# Ouput a banner
+#
+
+Banner
+
+#
+# Get the HDF5 and SZIP library and include directories from the user
+#
+
+GetHdfEnv
+GetSzipEnv
+
+#
+# Set up the architecture-dependent environment scripts
+#
+
+SetupEnvScripts
+
+
+#
+# Run the architecture-dependent installation commands
+#
+
+MAKECMD=make; export MAKECMD 		# force use of regular make
+					# ClearMake doesn't work with
+					# current makefile
+
+: ${MAKECMD:=make}			# the make command defaults to 'make'
+
+					# augment path if using clearmake
+if [ "`echo $MAKECMD | grep clearmake`" != "" ] ; then
+    echo "$this_script : note : make command is set to clearmake"
+    PATH="$PATH:/usr/atria/bin" 
+    export PATH
+fi
+
+cd $HDFEOS5_SRC
+
+echo ""
+echo ""
+echo "-----------------------------------------------------------------------"
+echo ""
+echo "Configuring the GCTP library"
+echo ""
+echo "-----------------------------------------------------------------------"
+echo ""
+
+make_file="-f Makefile"		        # default makefile
+
+case $BRAND in
+
+  dec)
+    echo cp $HDFEOS5_LIB/../tmp/geolibDEC.a $HDFEOS5_LIB/libGctp.a
+    cp $HDFEOS5_LIB/../tmp/geolibDEC.a $HDFEOS5_LIB/libGctp.a
+    ;;
+
+  hp)
+    case $OS_VERSION in
+    10)
+       echo cp $HDFEOS5_LIB/../tmp/geolibHP.a $HDFEOS5_LIB/libGctp.a
+       cp $HDFEOS5_LIB/../tmp/geolibHP.a $HDFEOS5_LIB/libGctp.a 
+     ;;
+    11)
+       echo cp $HDFEOS5_LIB/../tmp/geolibHP11.a $HDFEOS5_LIB/libGctp.a
+       cp $HDFEOS5_LIB/../tmp/geolibHP11.a $HDFEOS5_LIB/libGctp.a 
+     ;;
+    esac
+    ;;
+
+  ibm)
+    echo cp $HDFEOS5_LIB/../tmp/geolibIBM.a $HDFEOS5_LIB/libGctp.a
+    cp $HDFEOS5_LIB/../tmp/geolibIBM.a $HDFEOS5_LIB/libGctp.a
+    ;;
+
+  sgi32)
+    case $OS_VERSION in
+    2)
+       echo cp $HDFEOS5_LIB/../tmp/geolibIRIX62-n32.a $HDFEOS5_LIB/libGctp.a
+       cp $HDFEOS5_LIB/../tmp/geolibIRIX62-n32.a $HDFEOS5_LIB/libGctp.a
+     ;;
+    5)
+       echo cp $HDFEOS5_LIB/../tmp/geolibIRIX65-n32.a $HDFEOS5_LIB/libGctp.a
+       cp $HDFEOS5_LIB/../tmp/geolibIRIX65-n32.a $HDFEOS5_LIB/libGctp.a
+    ;;
+    esac
+    ;;
+
+  sgi64)
+    case $OS_VERSION in
+    2)
+       if [ "$cpu_type" = "4" ] ; then
+	  echo cp $HDFEOS5_LIB/../tmp/geolibIRIX62-64mips3.a $HDFEOS5_LIB/libGctp.a
+	  cp $HDFEOS5_LIB/../tmp/geolibIRIX62-64mips3.a $HDFEOS5_LIB/libGctp.a 
+       else
+	  echo cp $HDFEOS5_LIB/../tmp/geolibIRIX62-64.a $HDFEOS5_LIB/libGctp.a
+	  cp $HDFEOS5_LIB/../tmp/geolibIRIX62-64.a $HDFEOS5_LIB/libGctp.a
+       fi
+     ;;
+    5)
+       echo cp $HDFEOS5_LIB/../tmp/geolibIRIX65-64.a $HDFEOS5_LIB/libGctp.a
+       cp $HDFEOS5_LIB/../tmp/geolibIRIX65-64.a $HDFEOS5_LIB/libGctp.a
+    ;;
+    esac
+    ;;
+
+  sun5)
+       echo cp $HDFEOS5_LIB/../tmp/geolibSOL24.a $HDFEOS5_LIB/libGctp.a
+       cp $HDFEOS5_LIB/../tmp/geolibSOL24.a $HDFEOS5_LIB/libGctp.a
+    ;;
+
+  sun5.8)
+       echo cp $HDFEOS5_LIB/../tmp/geolibSOL28.a $HDFEOS5_LIB/libGctp.a
+       cp $HDFEOS5_LIB/../tmp/geolibSOL28.a $HDFEOS5_LIB/libGctp.a
+    ;;
+
+  sun5.9)
+       echo cp $HDFEOS5_LIB/../tmp/geolibSOL29.a $HDFEOS5_LIB/libGctp.a
+       cp $HDFEOS5_LIB/../tmp/geolibSOL29.a $HDFEOS5_LIB/libGctp.a
+    ;;
+
+  sun5.10)
+       echo cp $HDFEOS5_LIB/../tmp/geolibSOL210.a $HDFEOS5_LIB/libGctp.a
+       cp $HDFEOS5_LIB/../tmp/geolibSOL210.a $HDFEOS5_LIB/libGctp.a
+    ;;
+
+  linux | linux32 | linux64)
+    if [ "`uname -m`" = "x86_64" ] ; then
+	if [ "$LNX_COMP_FLAG" = "-m32" ] ; then
+	    echo cp $HDFEOS5_LIB/../tmp/geolibLINUX.a $HDFEOS5_LIB/libGctp.a
+	    cp $HDFEOS5_LIB/../tmp/geolibLINUX.a $HDFEOS5_LIB/libGctp.a
+	else	    
+	    echo cp $HDFEOS5_LIB/../tmp/geolibLINUX64.a $HDFEOS5_LIB/libGctp.a
+	    cp $HDFEOS5_LIB/../tmp/geolibLINUX64.a $HDFEOS5_LIB/libGctp.a
+	fi
+    elif [ "`uname -m`" = "ia64" ] ; then
+	if [ "$LNX_COMP_FLAG" = "-m32" ] ; then
+	    echo cp $HDFEOS5_LIB/../tmp/geolibLINUX.a $HDFEOS5_LIB/libGctp.a
+	    cp $HDFEOS5_LIB/../tmp/geolibLINUX.a $HDFEOS5_LIB/libGctp.a
+	else
+	    echo cp $HDFEOS5_LIB/../tmp/geolibLINUXIA64.a $HDFEOS5_LIB/libGctp.a
+	    cp $HDFEOS5_LIB/../tmp/geolibLINUXIA64.a $HDFEOS5_LIB/libGctp.a
+	fi
+    else
+	echo cp $HDFEOS5_LIB/../tmp/geolibLINUX.a $HDFEOS5_LIB/libGctp.a
+	cp $HDFEOS5_LIB/../tmp/geolibLINUX.a $HDFEOS5_LIB/libGctp.a
+    fi
+    ;;
+
+  macintosh)
+    echo cp $HDFEOS5_LIB/../tmp/geolibMAC.a $HDFEOS5_LIB/libGctp.a
+    cp $HDFEOS5_LIB/../tmp/geolibMAC.a $HDFEOS5_LIB/libGctp.a
+    ;;
+
+  macintel | macintel32 | macintel64)
+	if [ "$MACINTEL_COMP_FLAG" = "-m32" ] || [ "$MACINTEL_COMP_FLAG" = "" ] ; then
+	    echo cp $HDFEOS5_LIB/../tmp/geolibMACIntel.a $HDFEOS5_LIB/libGctp.a
+	    cp $HDFEOS5_LIB/../tmp/geolibMACIntel.a $HDFEOS5_LIB/libGctp.a
+	else
+	    echo cp $HDFEOS5_LIB/../tmp/geolibMACIntel64.a $HDFEOS5_LIB/libGctp.a
+	    cp $HDFEOS5_LIB/../tmp/geolibMACIntel64.a $HDFEOS5_LIB/libGctp.a
+	fi
+    ;;
+
+  cygwin)
+    echo cp $HDFEOS5_LIB/../tmp/geolibCYGWIN.a $HDFEOS5_LIB/libGctp.a
+    cp $HDFEOS5_LIB/../tmp/geolibCYGWIN.a $HDFEOS5_LIB/libGctp.a
+    ;;
+
+  winnt98)
+    echo cp $HDFEOS5_LIB/../tmp/geolibCYGWIN.a $HDFEOS5_LIB/libGctp.a
+    cp $HDFEOS5_LIB/../tmp/geolibCYGWIN.a $HDFEOS5_LIB/libGctp.a
+    ;;
+
+  *)
+    echo '!!!!!! WARNING !!!!!! WARNING !!!!!! WARNING !!!!! WARNING !!!!!!'
+    echo '"'$BRAND'"' is not officially supported, no GCTP library available
+    echo for this mode '"'$BRAND'"'.  HDF-EOS5 grid routines will not work
+    echo without this library.
+    ;;
+
+esac
+
+if [ -f $HDFEOS5_LIB/libGctp.a ] ; then
+    chmod u+w $HDFEOS5_LIB/libGctp.a
+else
+    cd ${HDFEOS5_HOME}/gctp
+    make -f Makefile
+
+    case $BRAND in
+	
+	dec)
+	    cp lib/$BRAND/libgctpdec.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+	
+	hp)
+	    cp lib/$BRAND/libgctphp.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+	
+	ibm)
+	    cp lib/$BRAND/libgctpibm.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+	
+	sgi)
+	    cp lib/$BRAND/libgctpsgi32.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+	
+	sgi32)
+	    if [ "$cpu_type" = "4" ] ; then
+		cp lib/$BRAND/libgctpsgin32.a $HDFEOS5_LIB/libGctp.a
+	    else
+		cp lib/$BRAND/libgctpsgi65_n32.a $HDFEOS5_LIB/libGctp.a
+	    fi
+	    ;;
+	
+	sgi64)
+	    if [ "$cpu_type" = "4" ] ; then
+		cp lib/$BRAND/libgctpsgi64.a $HDFEOS5_LIB/libGctp.a
+	    else
+		cp lib/$BRAND/libgctpsgi65_64.a $HDFEOS5_LIB/libGctp.a
+	    fi
+	    ;;
+	
+	sun4)
+ 	    cp lib/$BRAND/libgctpsol24.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+	
+	sun5)
+	    cp lib/$BRAND/libgctpsol25.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+	
+	sun5.8)
+	    cp lib/$BRAND/libgctpsol28.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+	
+	sun5.9)
+	    cp lib/$BRAND/libgctpsol29.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+	
+	sun5.10)
+	    cp lib/$BRAND/libgctpsol210.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+	
+	linux | linux32 | linux64)
+	    if [ "`uname -m`" = "x86_64" ] ; then
+		if [ "$LNX_COMP_FLAG" = "-m32" ] ; then
+		    cp lib/$BRAND/libgctplinux.a $HDFEOS5_LIB/libGctp.a
+		else
+		    cp lib/$BRAND/libgctplinux64.a $HDFEOS5_LIB/libGctp.a
+		fi
+	    elif [ "`uname -m`" = "ia64" ] ; then
+		if [ "$LNX_COMP_FLAG" = "-m32" ] ; then
+		    cp lib/$BRAND/libgctplinux.a $HDFEOS5_LIB/libGctp.a
+		else
+		    cp lib/$BRAND/libgctplinuxia64.a $HDFEOS5_LIB/libGctp.a
+		fi
+	    else
+		cp lib/$BRAND/libgctplinux.a $HDFEOS5_LIB/libGctp.a
+	    fi
+	    ;;
+	
+	macintosh)
+	    cp lib/$BRAND/libgctpmacintosh.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+	
+	macintel)
+	    cp lib/$BRAND/libgctpmacintel.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+	
+	macintel32)
+	    cp lib/$BRAND/libgctpmacintel32.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+	
+	macintel64)
+	    cp lib/$BRAND/libgctpmacintel64.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+	
+	cygwin)
+	    cp lib/$BRAND/libgctpcygwin.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+	
+	winnt98)
+	    cp lib/$BRAND/libgctpcygwin.a $HDFEOS5_LIB/libGctp.a
+	    ;;
+    esac
+fi
+
+cd $HDFEOS5_SRC
+
+#
+# check to see if valid C compiler path was specified
+#
+    
+cc=""
+    
+if [ "$cc_path" != ""  ] ; then
+    
+    if [ -f $cc_path ] ; then
+    
+            cc=`basename $cc_path`
+            cc_path=`echo $cc_path | sed 's%/[^/]*/*$%%'`
+	    case "$BRAND" in
+		"sgi32" )
+		    CC="$cc_path/$cc -n32"
+		;;
+
+		"sgi64" )
+		    cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+		    if [ "$cpu_type" == "4" ] ; then
+			CC="$cc_path/$cc -64 -mips3"
+		    else
+			CC="$cc_path/$cc -64 -mips4"
+		    fi
+		;;
+
+		* )
+		    CC="$cc_path/$cc" 
+		;; 
+	    esac
+
+	    export CC		# user overrides C compiler name
+    fi
+    
+    if [ -d $cc_path ] ; then	         # make sure cc_path is now a directory
+         PATH=${cc_path}:${PATH} 	 # prepend cc_path to search path
+         export PATH
+    else
+         cc_path=""
+         echo "Warning: C compiler directory $cc_path not found."
+         echo  "HDFEOS5 build may fail."
+    fi
+fi
+
+cat /dev/null > ../include/HE5_config.h
+
+
+echo ""
+echo ""
+echo "-----------------------------------------------------------------------"
+echo ""
+echo "Building HDFEOS5"
+echo ""
+echo "-----------------------------------------------------------------------"
+echo ""
+
+$MAKECMD $make_file
+if [ $? != 0 ] ; then
+    ErrorExit "$MAKECMD $make_file"
+fi
+
+if [ "$BRAND" = "macintosh" ] ; then
+    ranlib -s $HDFEOS5_LIB/libGctp.a
+    ranlib -s $HDFEOS5_LIB/libhe5_hdfeos.a
+fi
+
+if [ "$BRAND" = "macintel" ] ; then
+    ranlib -s $HDFEOS5_LIB/libGctp.a
+    ranlib -s $HDFEOS5_LIB/libhe5_hdfeos.a
+fi
+
+if [ "$BRAND" = "macintel32" ] ; then
+    ranlib -s $HDFEOS5_LIB/libGctp.a
+    ranlib -s $HDFEOS5_LIB/libhe5_hdfeos.a
+fi
+
+if [ "$BRAND" = "macintel64" ] ; then
+    ranlib -s $HDFEOS5_LIB/libGctp.a
+    ranlib -s $HDFEOS5_LIB/libhe5_hdfeos.a
+fi
+
+if [ $BRAND = "cygwin" ] ; then
+    ranlib $HDFEOS5_LIB/libGctp.a
+    ranlib $HDFEOS5_LIB/libhe5_hdfeos.a
+fi
+
+echo ""
+echo ""
+echo "-----------------------------------------------------------------------"
+echo ""
+echo "Cleaning up"
+echo ""
+echo "-----------------------------------------------------------------------"
+echo ""
+
+$MAKECMD $make_file clean
+if [ $? != 0 ] ; then
+    ErrorExit "$MAKECMD $make_file clean"
+fi
+
+
+echo ""
+echo ""
+echo "-----------------------------------------------------------------------"
+echo ""
+echo "Building HDFEOS5 utilities"
+echo ""
+echo "-----------------------------------------------------------------------"
+echo ""
+
+    HDFEOS5_UTIL=${HDFEOS5_HOME}/util	# utility files
+    cd $HDFEOS5_UTIL
+    make_utilfile="-f makefile"		# default utility makefile
+    $MAKECMD $make_utilfile
+    if [ $? != 0 ] ; then
+	ErrorExit "$MAKECMD $make_utilfile"
+    fi
+
+#    cp HE5_GDconvert_ij2ll $HDFEOS5_BIN/HE5_GDconvert_ij2ll
+#    /bin/rm $HDFEOS5_UTIL/HE5_GDconvert_ij2ll
+    chmod u+wx $HDFEOS5_BIN/HE5_GDconvert_ij2ll
+
+# done
+
+echo ""
+echo ""
+echo "-----------------------------------------------------------------------"
+echo ""
+echo "    HDFEOS5 installation ending at `date`"
+echo ""
+echo "-----------------------------------------------------------------------"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bin/INSTALL-Scripts/INSTALL-HDF b/bin/INSTALL-Scripts/INSTALL-HDF
new file mode 100755
index 0000000..a0f2e14
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-HDF
@@ -0,0 +1,1778 @@
+#! /bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-HDF
+#
+# description:
+# 	HDF installation script for the SDP (PGS) Toolkit and hdfeos
+#
+# usage:
+# 	INSTALL-HDF [-f90 [-NAG]] [-ABSOFT] [-fc_path <path/compiler_name>]
+#                   [-cc_path <path/compiler_name>] [-sgi32 | -sgi64] 
+#                   [-log <log-file> [-append]] [-clean | -cleano] 
+#                   [-strip] [-w_home <file>] [-df <distribution-file>] 
+#                   [-batch] [-install_dir <base installation directory>]
+# 	INSTALL-HDF [-h] 
+#
+# 	  -f90     : build HDF FORTRAN modules using f90 
+# 	             optional flag -NAG specifies NAG f90
+#         -ABSOFT  : flag that specifies absoft f77 is used for fortran compilation
+# 	  -fc_path : set the path of the FORTRAN compiler to <path/compiler_name>
+# 	  -cc_path : set the path of the C compiler to <path/compiler_name>
+# 	  -sgi32   : build in -n32   mode (SGI Power Challenge only)
+# 	  -sgi64   : build in 64-bit mode (SGI Power Challenge only)
+# 	  -dbug    : build in debug mode
+# 	  -log     : sdone session output to new <log-file>
+# 	  -append  : append to existing <log-file>
+# 	  -clean   : run 'make clean' after doing the installation
+# 	  -cleano  : clean up all object and a.out files
+# 	  -strip   : strip out all non-installation files following install
+# 	  -w_home  : write HDF home directory to <file>
+# 	  -df      : install HDF from distribution file <distribution-file>
+# 	  -batch   : run script in batch (i.e. non-interactive) mode
+#         -install_dir : full path to top level directory where HDF will be
+#                        installed (e.g. /usr/local/hdfeos/hdf/sgi64)
+# 	  -h       : display this help message and exit
+#
+# notes:
+# 	1)  The use of the -clean option will cause the HDF utilites to 
+# 	    be deleted.  To preserve them, use the -cleano option instead.
+# 
+# 	2)  The -f90 and -NAG options are  * * NOT IMPLEMENTED  * * 
+# 	    Currently, these options are accepted, but ignored.
+# 	    
+#
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        Megan E. Donovan Spencer / SM&AE
+#        Abe Taaheri / SM&AE
+#        Phuong T. Nguyen / L3 Communication
+#        Adura Adekunjo/ L3 Communication GSI
+#
+# history:
+#       11-May-1995 MES Initial version
+# 	10-Jul-1995 MES Added patch to remove the typedef of _fcd from 
+# 	                hdfi.h if building HDF on a Cray.
+#	17-Jul-1995 MES Configure for IRIX64, the sgi 64 bit O/S.
+# 			- recognize OSTYPE of IRIX64
+# 			- Force all objects to be built in 32-bit mode.
+# 			- Do not not attempt to build basic utilities,
+# 			  because they need a missing 32-bit library.
+#	17-Jul-1995 MES Added a patch to fix file hdf.inc, the broken  
+# 			FORTRAN header file in the HDF3.3r4 release.
+#	02-Aug-1995 MES Patches to make netcdf section build on the cray.
+# 	19-Sep-1995 MES Don't remove tar file unless it was just generated
+# 			by uncompressing the distribution file.
+# 			Recognize the -sgi64 option.
+# 	31-Oct-1995 MES Recognize the -sgi32 option.
+# 			Various tweaks to sgi hanlding.
+# 	01-Nov-1995 MES More tweaks to sgi hanlding.
+# 			Add option handling for -f90, but don't implement yet.
+# 	02-Nov-1995 MES Add -fc_path and -cc_path options, but don't implement.
+# 	06-Nov-1995 MES Fix bug in NCSA-supplied FORTRAN header file: dffunc.inc
+# 	21-Nov-1995 MES Set default installation directory to:
+# 			    `pwd`/hdf/$BRAND
+# 			to facilitate multi-platform installations.
+# 	23-Apr-1996 MES Converted from csh to sh and rewrote to use
+# 			sh features, such as functions.
+# 			Removed version-specific code - it will now 
+# 			go in modules that will allow multiple versions 
+# 			of HDF to be supported, and facilitate maintenance
+# 			of this file.  Currently this script can call
+# 			modules to install either 3.3r4 or 4.0r1p1,
+# 			however only 4.0r1p1 installation will be supported 
+# 			by the Release A version of the SDP Toolkit.
+# 	26-Apr-1996 MES Updated SetArchitecture() to set CC CFLAGS and F77
+# 			for all platforms
+# 	22-Aug-1996 MES Updated to add support for support HDF4.0r2
+# 			- added function UserCompilers to implement the
+# 			  -cc_path and -fc_path options.
+# 			- updated GetDistribution to recognize HDF4.0r2.tar.gz 
+# 			  and HDF4.0r2.tar.Z distribution files.
+# 			- updated UnpackDistribution to support .gz files,
+# 			  assuming the GNU version of zcat is available.
+# 			- added function GnuZcat to attempt to determine
+# 			  if GNU zcat is available.
+# 			- added the -df option so the user may pass in the
+# 			  name of the distribution file (currently defaults
+# 			  to HDF4.0r2.tar.Z).
+# 			- added code to pass the -set_compilers option to 
+# 			  INSTALL-HDF4.0r2 when default compilers must be
+# 			  overridden.
+# 	04-Sep-1996 MES Add the -strip option
+#	15-Apr-1997 DaW Modified flags for Power Challenge.  Added support 
+#			for old 32-bit mode on Power Challenge
+#			But it is not documented because SGI is going to remove
+#			soon.
+#       24-Jun-1998 MEDS Updating script to include new tar file for version
+#                        HDF4.1r1.1 in the distribution list
+#       24-Jul-1999 MEDS Updating script to include new tar file for version
+#                        HDF4.1r3 in the distribution list
+#       04-18-2001 AT  Updataed so that f90 can be used for FORTRAN compiler
+#                       since starting with HDF4.1r2 release f90 is supported
+#       16-Jan-2002 PTN  Updating script to include new tar file for version 
+#                        HDF4.1r5 in the distribution list 
+#       16-Mar-2004 AA   Updating script to include new tar file for version
+#                        HDF4.2r0 in the distribution list.
+#       06-Jul-2005 AA   Updating script to include new tar file for version
+#                        HDF4.2r1 in the distribution list.
+#       06-Jul-2007 AT   Updating script to include new tar file for version
+#                        HDF4.2r2 in the distribution list.
+#       09-Jan-2008 AT   Updating script to include new tar file for version
+#                        HDF4.2r3 in the distribution list.
+#       09-May-2009 AT   Updating script to include new tar file for version
+#                        HDF4.2r4 in the distribution list.
+#       20-Jul-2010 AT   Updating script to include new tar file for version
+#                        hdf-4.2.5 in the distribution list.
+#       16-Nov-2011 AT   Updating script to include new tar file for version
+#                        hdf-4.2.6 in the distribution list.
+#       16-Nov-2011 AT   Updating script to include new tar file for version
+#                        hdf-4.2.10 in the distribution list.
+#
+#-----------------------------------------------------------------------------
+
+#
+# Save starting directory, path
+# Create error message header
+#
+
+start_dir=`pwd`
+start_path=$PATH
+this_script="`basename $0`"
+script_error="$this_script: Error:"
+
+#
+# Get absolute pathname where this script is located
+# This allows the script to locate any needed auxilliary files
+#
+
+script_dir="`dirname $0`"
+abs="`echo $script_dir | cut -c1`"
+if [ "$abs" != "/" ] ; then
+    script_dir="`cd $script_dir;pwd`"
+fi
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    echo ""
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+        echo "" >> $log_file
+        echo "$*" >> $log_file
+    fi
+}
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog2()
+{
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+        echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to set up and export the following architecture-specific variables:
+#
+#         BRAND HOST LOGNAME OSTYPE PATH USER
+#
+
+
+SetArchitecture()
+{
+    # set path to a base subset of directories, allowing startup on unknown host
+    # note: once the architecture has been determined the path is customized
+    
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11
+    
+    
+    # get operating system type, login name
+    # special cases: SCO and Cray  - uname works differently,
+    
+    machine=`uname -m | awk '{print $1}'`	# needed on Cray & SCO
+    temp_ostype=`uname`
+
+    case "$machine" in
+    
+      i386 )        			# SCO box
+    	OSTYPE=sco386
+        ;;
+    
+      CRAY )    				# CRAY
+    	OSTYPE=UNICOS
+        ;;
+    
+      * )					# everybody else
+    	OSTYPE=`uname`
+        ;;
+    
+    esac
+    
+# Intel Macintosh is also i386 or i686 (?) machine
+
+    if [ "$machine" = "i386" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	fi
+	if [ "`uname | awk -F_ '{print $1}'`" = "CYGWIN" ] ; then 
+	    OSTYPE=Cygwin
+	fi
+    fi
+    if [ "$machine" = "i686" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	fi
+	if [ "`uname | awk -F_ '{print $1}'`" = "CYGWIN" ] ; then 
+	    OSTYPE=Cygwin
+	fi
+    fi
+    if [ "$machine" = "x86_64" ] || [ "$machine" = "ia64" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then
+ 	    OSTYPE=DarwinIntel
+	    if [ "$MAC_BRAND" = "" ] ; then 
+		echo " Error: In 64-bit MAC platform the env. variable MAC_BRAND must be set to mac32 or mac64 before running this script."
+		exit 1
+	    fi
+	else
+	    if [ "$LINUX_BRAND" = "" ] ; then 
+		echo " Error: In 64-bit linux platform the env. variable LINUX_BRAND must be et to linux32 or linux64 before running this script."
+		exit 1
+	    fi
+	fi
+     fi
+
+    user=`id | cut -d\( -f2 | cut -d\) -f1`
+    if [ "$LOGNAME" = "" ] ; then 		# make sure $LOGNAME is defined
+        LOGNAME=$user	
+    fi
+    USER=$LOGNAME				# make sure $USER is defined
+    
+    
+    # set machine-depdoneent environment variables:
+    # 	HOST  the host name of this machine
+    # 	BRAND used by other achitecture-specific code
+    # 	path  the execution search path exported to PATH
+    
+    case "$OSTYPE" in
+    
+      AIX ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/ccs/bin:/usr/sbin
+    	HOST=`hostname`
+    	BRAND=ibm
+        CC=cc
+        CFLAGS="-O"
+        F77=xlf
+        ;;
+    
+      HP-UX ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bin/X11
+    	HOST=`hostname`
+    	BRAND=hp 
+        CC=cc
+        CFLAGS="-O"
+        F77=fort77
+        ;;
+    
+      IRIX )  
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bsd:/usr/bin/X11:/usr/sbin
+    	HOST=`hostname`
+    	BRAND=sgi 
+        CC=cc
+        CFLAGS="-O"
+        F77=f77
+        ;;
+    
+      IRIX64 )  
+        PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bsd:/usr/bin/X11:/usr/sbin
+        HOST=`hostname`
+        case "$sgi_mode" in
+          32  )  BRAND=sgi   ; CC="cc -32 -mips2"  ; F77="f77 -32 -mips2"  ;;
+          n32 )  BRAND=sgi32 ; CC="cc -n32 -mips3" ; F77="f77 -n32 -mips3"  ;;
+          64  )  BRAND=sgi64 ; CC="cc -64 -mips4"  ; F77="f77 -64 -mips4"  ;;
+          *   )  BRAND=sgi   ; CC="cc"  ; F77="f77"  ;;
+        esac
+        CFLAGS="-O"
+        set_compilers=0		# override HDF default compilers
+        ;;
+    
+      Linux )
+	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/X11/bin
+	HOST=`hostname -s`
+	BRAND=linux
+	if [ "$LINUX_BRAND" = "linux64" ] ; then
+	    BRAND=linux64
+	elif [ "$LINUX_BRAND" = "linux32" ] ; then
+	    BRAND=linux32
+	fi
+        CC="gcc $LNX_COMP_FLAG"
+        CFLAGS="-O"
+        F77="g77 $LNX_COMP_FLAG" 
+	;;
+
+      Darwin )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname -s`
+        BRAND=macintosh
+        CC=gcc
+        CFLAGS="-O"
+        F77=g77
+        ;;
+
+      DarwinIntel )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname -s`
+        BRAND=macintel32
+	if [ "$MAC_BRAND" = "macintel64" ] ; then
+	    BRAND=macintel64
+	elif [ "$MAC_BRAND" = "macintel32" ] ; then
+	    BRAND=macintel32
+	fi
+        CC="gcc $MACINTEL_COMP_FLAG"
+        CFLAGS="-O2"
+        F77="gfortran $MACINTEL_COMP_FLAG"
+        ;;
+
+      Cygwin )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname`
+        BRAND=cygwin
+        CC=gcc
+        CFLAGS="-O"
+        F77=g77
+        ;;
+
+      OSF1 )  
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/ccs/bin:/usr/sbin
+    	HOST=`hostname -s`
+    	BRAND=dec 
+        CC=cc
+        CFLAGS="-O -std"
+        F77=f77
+        ;;
+    
+      sco386 ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bin/X11
+    	HOST=`hostname -s`
+    	BRAND=sco 
+        CC=cc
+        CFLAGS="-O"
+        F77=f77
+        ;;
+    
+      SunOS ) 
+    	# distinguish between SunOS 5.x and 4.x versions
+    	if [ `uname -r | awk -F. '{print $1}'` = "5" ] ; then
+	    BRAND="sun5"			# release V5.x SunOS
+	    PATH=/usr/local/bin:/opt/SUNWspro/bin:/bin:/usr/ucb:/usr/bin:/etc:/usr/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/ccs/bin:/usr/sbin
+            CC=cc
+            CFLAGS="-O"
+            F77=f77
+	    if [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 10" ] ; then
+		BRAND="sun5.10"			# release V510 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+		CC=cc
+		CFLAGS="-O"
+		F77=f77
+	    elif [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 9" ] ; then
+		BRAND="sun5.9"			# release V5.9 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+		CC=cc
+		CFLAGS="-O"
+		F77=f77
+	    elif [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 8" ] ; then
+		BRAND="sun5.8"			# release V5.8 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/ccs/bin:/usr/sbin
+		CC=cc
+		CFLAGS="-O"
+		F77=f77
+	    fi
+    	else
+    	    BRAND="sun4"			# release V4 SunOS
+    	    PATH=/usr/local/bin:/opt/SUNWspro/bin:/bin:/usr/bin:/etc:/
+    	    PATH=/usr/local/bin:/usr/local/lang:/usr/lang:/usr/ucb:/bin:/usr/bin:/etc:/usr/etc:/usr/openwin/bin:/usr/openwin/demo
+            CC=acc
+            CFLAGS="-O"
+            F77=f77
+            set_compilers=1		# override HDF4.0r2 default compilers
+    	fi
+    	HOST=`hostname`
+        ;;
+    
+      UNICOS ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/ucb:/usr/bin/X11
+    	HOST=`hostname`
+    	BRAND=cray 
+        CC=cc
+        CFLAGS="-O"
+        F77=cf77
+        ;;
+    
+      * )
+    	echo "Operating system: $OSTYPE not supported" 	>&2
+    	echo "This release of the Toolkit and hdfeos supports: " 	>&2
+    	echo "   Sun, SGI HP-9000 IBM-6000 DEC-Alpha  Linux Macintosh and Cray/Unicos " 	>&2
+        exit 1
+        ;;
+    
+    esac
+
+
+    # if debug version was requested replace -O with -g in CFLAGS
+
+    if [ "$dbug" = "1" ] ; then
+	CFLAGS=`echo $CFLAGS | sed 's/-O/-g/'`
+    fi
+
+    CFLAGS="$CFLAGS $EXT_CC_FLAGS"
+
+    # export the architecture-specific variables
+
+    export BRAND HOST LOGNAME OSTYPE PATH USER
+    export CC CFLAGS F77
+    
+}
+
+
+#
+# Function to allow user to override the defaults for the compilers
+# The following variables are affected:
+#
+#         PATH CC F77
+#
+
+UserCompilers()
+{
+    #
+    # check to see if valid C compiler path was specified
+    #
+    
+    cc=""
+    
+    if [ "$cc_path" != ""  ] ; then
+    
+        if [ -f $cc_path ] ; then
+    
+            cc=`basename $cc_path`
+            cc_path=`echo $cc_path | sed 's%/[^/]*/*$%%'`
+	    case "$BRAND" in
+		"sgi32" )
+		    CC="$cc_path/$cc -n32"
+		;;
+
+		"sgi64" )
+		    cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+		    if [ "$cpu_type" == "4" ] ; then
+			CC="$cc_path/$cc -64 -mips3"
+		    else
+			CC="$cc_path/$cc -64 -mips4"
+		    fi
+		;;
+
+		"linux" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"linux32" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"linux64" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"macintel" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel32" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;; 
+
+		"macintel64" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;; 
+
+		* )
+		    CC="$cc_path/$cc"
+		;; 
+	    esac
+
+	    export CC		# user overrides C compiler name
+	    set_compilers=1		# override HDF default compilers
+    
+	fi
+    
+        if [ -d $cc_path ] ; then	# make sure cc_path is now a directory
+    
+            PATH=${cc_path}:${PATH} 	# prepend cc_path to search path
+            export PATH
+    
+        else
+    
+            cc_path=""
+            echo "Warning: C compiler directory $cc_path not found."
+            echo  "HDF build may fail."
+    
+        fi
+    
+    fi
+    
+    
+    #
+    # check to see if valid FORTRAN compiler path was specified
+    #
+    
+    fc=""
+    
+    if [ "$fc_path" != "" ] ; then
+    
+        if [ -f $fc_path ] ; then
+    
+            fc=`basename $fc_path`
+            fc_path=`echo $fc_path | sed 's%/[^/]*$%%'`
+	    case "$BRAND" in
+		"sgi32" )
+		    F77="$fc_path/$fc -n32"
+		;;
+
+		"sgi64" )
+		    cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+		    if [ "$cpu_type" == "4" ] ; then
+			F77="$fc_path/$fc -64 -mips3"
+		    else
+			F77="$fc_path/$fc -64 -mips4"
+		    fi
+		;;
+
+		"linux" )
+		    if [ "$fc" == "pgf90" ] || [ "$fc" == "pgf77" ] ; then
+			F77="$fc_path/$fc"
+		    else
+			F77="$fc_path/$fc $LNX_COMP_FLAG"
+		    fi
+		;; 
+
+		"linux32" )
+		    if [ "$fc" == "pgf90" ] || [ "$fc" == "pgf77" ] ; then
+			F77="$fc_path/$fc"
+		    else
+			F77="$fc_path/$fc $LNX_COMP_FLAG"
+		    fi
+		;; 
+
+		"linux64" )
+		    if [ "$fc" == "pgf90" ] || [ "$fc" == "pgf77" ] ; then
+			F77="$fc_path/$fc"
+		    else
+			F77="$fc_path/$fc $LNX_COMP_FLAG"
+		    fi
+		;; 
+
+		"macintel" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel32" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel64" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		* )
+		    F77="$fc_path/$fc" 
+		;; 
+	    esac
+
+    #        if [ "$fc" != f90 ] ; then	# (f90 not supported for HDF4.1r1)
+    # f90 is supported starting with the HDF4.1r2 release
+                export F77	# user overrides FORTRAN compiler name
+                set_compilers=1		# override HDF default compilers
+    #        fi
+    
+        fi
+    
+        if [ -d $fc_path ] ; then	# make sure fc_path is now a directory
+    
+            PATH=${fc_path}:${PATH} 	# prepend fc_path to search path
+            export PATH
+    
+        else
+    
+            fc_path=""
+            echo "Warning: FORTRAN directory $fc_path not found."
+            echo  "HDF build may fail."
+    
+        fi
+    
+    fi
+    
+}
+
+
+
+#
+# Function to get the location of the distribution file
+#
+    
+GetDistribution()
+{    
+    : ${distrib_file:=hdf-4.2.10.tar.gz}
+
+    ds1=$distrib_file			# backup copy
+    
+    # derive tar file name
+
+    case "$distrib_file" in
+
+ 
+      4.1r3_aix.tar )
+        tar_file=4.1r3_aix.tar
+        hdf_home=4.1r3_aix
+        ;;
+
+      HDF3.3r4.tar.Z ) 
+        tar_file=HDF3.3r4.tar
+        hdf_home=HDF3.3r4 
+        ;;
+
+      HDF4.1r1.tar.gz  )
+        tar_file=HDF4.1r1.tar
+        hdf_home=HDF4.1r1
+        ;;
+
+      HDF4.1r1.tar.Z  )
+        tar_file=HDF4.1r1.tar
+        hdf_home=HDF4.1r1
+        ;;
+
+      HDF4.1r1.1.tar.Z  )
+        tar_file=HDF4.1r1.1.tar
+        hdf_home=HDF4.1r1
+        ;;
+
+      HDF4.1r3.tar.Z  )
+        tar_file=HDF4.1r3.tar
+        hdf_home=HDF4.1r3
+        ;;
+
+      hdf4.1r4.tar.Z  )
+        tar_file=hdf4.1r4.tar.Z
+        hdf_home=hdf4.1r4
+        ;;
+
+      HDF4.1r5.tar.Z  )
+        tar_file=HDF4.1r5.tar
+        hdf_home=HDF4.1r5
+        ;;
+
+      HDF4.2r0.tar.Z  )
+       tar_file=HDF4.2r0.tar
+       hdf_home=HDF4.2r0
+       ;;
+
+      HDF4.2r1.tar.Z  )
+       tar_file=HDF4.2r1.tar
+       hdf_home=HDF4.2r1
+       ;;
+
+      HDF4.2r2.tar.gz  )
+       tar_file=HDF4.2r2.tar
+       hdf_home=HDF4.2r2
+       ;;
+
+      HDF4.2r3.tar.gz  )
+       tar_file=HDF4.2r3.tar
+       hdf_home=HDF4.2r3
+       ;;
+
+      HDF4.2r4.tar.gz  )
+       tar_file=HDF4.2r4.tar
+       hdf_home=HDF4.2r4
+       ;;
+
+      hdf-4.2.5.tar.gz  )
+       tar_file=hdf-4.2.5.tar
+       hdf_home=hdf-4.2.5
+       ;;
+
+      hdf-4.2.6.tar.gz  )
+       tar_file=hdf-4.2.6.tar
+       hdf_home=hdf-4.2.6
+       ;;
+
+      hdf-4.2.10.tar.gz  )
+       tar_file=hdf-4.2.10.tar
+       hdf_home=hdf-4.2.10
+       ;;
+
+      HDF4.0r2.tar.gz  )
+        tar_file=HDF4.0r2.tar
+        hdf_home=HDF4.0r2
+        ;;
+
+      HDF4.0r2.tar.Z  )
+        tar_file=HDF4.0r2.tar
+        hdf_home=HDF4.0r2
+        ;;
+
+      HDF4.0r1p1.tar.Z  )
+        tar_file=HDF4.0r1p1.tar
+        hdf_home=40r1p1_patchedsrc 
+        ;;
+
+      40r1p1_patchedsrc.tar.Z  )
+        tar_file=40r1p1_patchedsrc.tar
+        hdf_home=40r1p1_patchedsrc 
+        ;;
+
+      * )
+        EchoAndLog "HDF version in $distrib_file not supported by this script."
+        exit 1
+        ;;
+
+    esac
+
+    
+    # set search path to include current dir, parent of current and $HOME    
+    search_path=`pwd`
+    search_path="$search_path `cd ..; pwd` $HOME"
+
+    # set search file to include compressed tar file and uncompressed tar file
+    search_file="$distrib_file $tar_file"
+
+    # search for the distribution file
+
+    found_file=0
+    for distrib_path in $search_path ; do
+
+        for distrib_file in $search_file ; do
+
+            if [ -f ${distrib_path}/${distrib_file} ] ; then
+                found_file=1
+                break
+            fi
+
+        done
+
+        if [ $found_file = 1 ] ; then
+            break
+        fi
+
+    done
+
+    # if file was not found, ask the user
+
+    if [ $found_file = 0 ] ; then
+
+	if [ $batch_mode = 0 ] ; then
+	    echo ""	
+	    UserPrompt "Pathname where $ds1 is located: "
+	    echo ""
+  	else
+	    user_response=""
+	fi
+    
+        if [ "$user_response" != "" ] ; then
+
+            # make sure directory exists
+
+            if [ -d $user_response ] ; then
+                distrib_path=$user_response
+            else 
+                WriteError "Invalid directory: $user_response"
+                exit 1
+            fi
+    
+            # search for the distribution file in user directory
+
+            for distrib_file in $search_file ; do
+
+                if [ -f ${distrib_path}/${distrib_file} ] ; then
+                    found_file=1
+                    break
+                fi
+
+            done
+
+        fi
+
+
+    fi
+
+
+    if [ $found_file = 0 ] ; then
+        WriteError "Can't find ${ds1} in (${search_path})"
+        echo "HDF installation cancelled."
+        exit 1
+    fi
+
+}
+
+
+# 
+# Function to get the location of the HDF home directory for installation
+# Also, prompt user that all information is valid before proceeding
+#
+
+GetInstallDir()
+{
+    default_HDF_path="`pwd`/hdf/$BRAND"
+
+    if [ "$HDF_path" = "" ] ; then
+	HDF_path="`pwd`/hdf/$BRAND"
+    fi
+
+    # ask the user
+
+    if [ $batch_mode = 0 ] ; then
+	UserPrompt "Pathname where directory '$hdf_home' will be created [$HDF_path]: " 
+	echo ""
+    else
+	user_response=""
+    fi
+    
+    if [ "$user_response" = "" ] ; then
+        if [  ! -d `dirname $HDF_path`  ] ; then mkdir `dirname $HDF_path` ; fi
+        if [  ! -d $HDF_path  ] ; then  mkdir $HDF_path ; fi
+    else
+        if [ -d "$user_response" ] ; then HDF_path=$user_response ; fi
+    fi
+    
+    if [ ! -d $HDF_path ] ; then
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "$HDF_path does not exist.  Create [y]? "
+	else
+	    user_response=y
+	fi
+	if [ "$user_response" = "" ] ; then user_response="y" ; fi
+	case "$user_response" in
+	    y* | Y* )
+		mkdir -p $HDF_path
+		if [ ! -d $HDF_path ] ; then
+		    WriteError "Unable to create directory $HDF_path." 
+		    echo "HDF installation cancelled." 2>&1
+		    exit 1
+		
+		fi
+		;;
+	    *)
+		WriteError "Directory $HDF_path does not exist." 
+		echo "HDF installation cancelled." 2>&1
+		exit 1
+		;;
+        esac
+    fi
+    
+
+   #
+   # confirm Configuration with SZIP  before proceeding
+   #
+
+    # ask the user
+
+    if [ $batch_mode = 0 ] ; then
+	EchoAndLog2 "Note:"
+	EchoAndLog2 "If you configure HDF4 with szip you may need to add szip"
+	EchoAndLog2 "library to your application makefiles that use HDF4. If"
+	EchoAndLog2 "you do not configure HDF4 with szip you will not be able"
+	EchoAndLog2 "to use HDF4's SZIP compression encoding or decoding (or"
+	EchoAndLog2 "both) capabilties for HDF4 files, and you may not be able"
+	EchoAndLog2 "to read HDF files that has szip compressed fields."
+	UserPrompt "Do you wish to configure HDF4 with SZIP[y]: "
+	echo ""
+    else
+	user_response=y
+    fi
+    case "$user_response" in
+	n* | N* )
+	    EchoAndLog "---- HDF4 will be configured without SZIP.----"
+	    CONFIG_HDF4_WITH_SZIP="0"
+	    ;;
+	*)
+	    EchoAndLog "---- HDF4 will be configured with SZIP.----"
+	    CONFIG_HDF4_WITH_SZIP="1"
+	    ;;
+    esac
+    export CONFIG_HDF4_WITH_SZIP	
+
+    #
+    # confirm before proceeding
+    #
+    
+    echo "The HDF directory will be restored from: " 
+    echo "    ${distrib_path}/${distrib_file}" 
+    echo "" 
+    echo "The HDF directory will be created in: " 
+    echo "     ${HDF_path}" 
+    echo "" 
+
+    if [ $batch_mode = 0 ] ; then
+	UserPrompt "Continue [yes] ? " 
+	case "$user_response" in
+	    n* | N* ) echo "Cancelled." ; exit 1 ;;
+	    * ) echo "Confirmed." ; echo "" ;;
+	esac
+    fi
+
+#
+# For linux create soft links if default HDF installation directory is used
+#
+    save_dir="`pwd`"
+    if [ "`pwd`/hdf/$BRAND" = "$default_HDF_path" ] ;then
+	if [ "$BRAND" = "linux64" ] ; then
+	    cd ${default_HDF_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "64-bit structure is the default in this machine. Creating $current_path/linux as a soft link to $default_HDF_path"
+	    ln -s ./linux64 linux
+ 	    cd $save_dir
+	fi
+
+	if [ "$BRAND" = "linux" ] ; then
+	    cd ${default_HDF_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "32-bit structure is the default in this machine. Creating $current_path/linux32 as a soft link to $default_HDF_path"
+	    ln -s ./linux linux32
+ 	    cd $save_dir
+	fi
+    fi
+
+#
+# For macintel create soft links if default HDF installation directory is used
+#
+    save_dir="`pwd`"
+    if [ "`pwd`/hdf/$BRAND" = "$default_HDF_path" ] ;then
+	if [ "$BRAND" = "macintel32" ] ; then
+	    cd ${default_HDF_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "macintel32 directories will be soft linked to macintel. Creating $current_path/macintel as a soft link to $default_HDF_path"
+	    ln -s ./macintel32 macintel
+ 	    cd $save_dir
+	fi
+
+	if [ "$BRAND" = "macintel" ] ; then
+	    cd ${default_HDF_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "macintel32 directories will be soft linked to macintel. Creating $current_path/macintel32 as a soft link to $default_HDF_path"
+	    ln -s ./macintel macintel32
+ 	    cd $save_dir
+	fi
+    fi
+}
+
+
+#
+# Function to unpack the distribution file into the installation directory
+#
+
+UnpackDistribution()
+{
+    #
+    # Go to the HDF parent directory
+    #
+    
+    cd $HDF_path
+
+    #
+    # If the new HDF home directory already exits, it must
+    # be removed first.  Check with the user before proceeding.
+    #
+    
+    if [ -d "$hdf_home" ] ; then
+    
+        EchoAndLog "The directory $hdf_home already exists."
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "Replace it [no] ? "
+	else
+	    user_response=y
+	fi
+
+        case "$user_response" in
+          y* | Y* )
+            EchoAndLog "Removing old $hdf_home directory ..."
+            /bin/rm -rf $hdf_home
+            ;;
+    
+          * )
+            EchoAndLog "Cancelled."
+            exit 1
+            ;;
+        esac
+    
+    fi
+    
+    
+    #
+    # Create a link to the distribution file, if necessary.
+    #
+
+    link_flag=0
+    if [ ! -f $distrib_file ] ; then
+        if [ -f ${distrib_path}/${distrib_file} ] ; then
+            ln -s ${distrib_path}/${distrib_file} ${distrib_file}
+            link_flag=1
+        fi
+    fi
+    
+    # 
+    # Uncompress the distribution file, (if needed), and extract the files
+    # 
+    
+    EchoAndLog "Extracting files from $distrib_file ..."
+
+    suffix="`echo $distrib_file |  sed 's/^.*\.//'`"
+    case $suffix in
+    
+      Z  )
+        zcat $distrib_file | tar xvf - 
+        echo ""
+        ;;
+
+      gz )
+	gzip -cd $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+#        GnuZcat
+#        if [ $gnu_zcat != 1 ] ; then
+#            WriteError "You need the GNU version of zcat to unpack this file."
+#            exit 1
+#        fi
+#        zcat $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+
+      tar)
+	echo $distrib_file
+        tar -xvf $distrib_file | awk '{printf "."}' 2>&1
+	echo ""
+        ;;
+    
+    esac
+
+    #
+    # Clean up symbolic link, if present
+    #
+
+    if [ $link_flag = 1 ] ; then
+        /bin/rm -f $distrib_file
+    fi
+
+
+}
+
+
+#
+# See if zcat is GNU version
+#
+
+GnuZcat()
+{
+    if [ "$1" = "" ] ; then
+        zcat_cmd=zcat
+    else
+        zcat_cmd=$1
+    fi
+    
+    buf=`exec 2>&1; $zcat_cmd < /dev/null | tail -1` 
+    buf=`echo $buf | awk -F: '{print $1}'`
+    
+    case "$buf" in
+      zcat) gnu_zcat=1 ;;
+      *   ) gnu_zcat=0 ;;
+    esac
+}
+
+
+#
+# Strip all HDF distribution files not needed after installation.
+#
+
+StripHdfInstall()
+{
+    cd $HDFHOME
+
+    here=`pwd`
+    here=`basename $here`
+
+    #
+    # Make sure this is a valid HDF directory befor clobbering files !
+    # 
+
+    if [ "`echo $here | grep '^HDF'`" = "" ] ; then
+    
+        EchoAndLog "Not a valid HDF directory: no files removed."
+        
+    else
+
+        EchoAndLog "Removing all non-installation HDF files ..."
+
+        for file in * ; do
+
+            if [ -d "$file" ] ; then
+    
+                case "$file" in 
+        
+                  bin | lib | include | man ) ;;
+                  * ) rm -rf $file ;;
+              
+                esac
+        
+            else
+    
+                rm -f $file
+        
+            fi
+    
+        done
+        
+    fi
+}
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+
+
+#
+# Get arguments from command line
+#
+
+log_file=""
+home_file=""
+noquery=0
+clean=0
+cleano=0
+strip_install=0
+append=0
+no_untar=0
+sgi_mode=32
+f90_flag=0
+nag_flag=0
+absoft_flag=0
+fc_path=""
+cc_path=""
+distrib_file=""
+set_compilers=0
+dbug=0
+HDF_path=""
+batch_mode=0
+
+while [ "$1" != "" ] ; do 
+
+    case "$1" in
+
+      -h )
+        Help
+        ;;
+
+      -f90 )
+        f90_flag=1
+        ;;
+
+      -NAG )
+        if [  $f90_flag = 0  ] ; then
+            WriteError "Must first specify -f90 and set compiler path."
+            Help
+        else
+            nag_flag=1
+        fi
+        ;;
+
+
+       -ABSOFT )
+	    absoft_flag=1
+	;;
+
+      -fc_path )
+        fc_path="$2"
+        shift
+        ;;
+
+      -cc_path )
+        cc_path="$2"
+        shift
+        ;;
+
+      -df)
+        distrib_file="$2"
+        shift
+        ;;
+
+      -sgi32 )
+        sgi_mode=n32
+        ;;
+
+      -sgi64 )
+        sgi_mode=64
+        ;;
+
+      -log )
+        if [ "$2" != "" ] ; then
+            if [ "` echo $2 | cut -c1`" = "/" ] ; then
+                log_file="$2"
+            else
+                log_file="$start_dir/$2"
+            fi
+            shift
+        else
+            WriteError "A log file must be specified with the -log option."
+            Help
+        fi
+        ;;
+
+      -append )
+        append=1
+        ;;
+
+      -w_home )
+        if [ "$2" != "" ] ; then
+            if [ "` echo $2 | cut -c1`" = "/" ] ; then
+                home_file="$2"
+            else
+                home_file="$start_dir/$2"
+            fi
+            shift
+        else
+            WriteError "No file specified with -w_home switch."
+            Help
+        fi
+        ;;
+
+      -nq | -noquery )
+        noquery=1
+        ;;
+
+      -clean )
+        clean=1
+        ;;
+
+      -cleano )
+        cleano=1
+        ;;
+
+      -strip )
+        strip_install=1
+        ;;
+
+      -no_untar )
+        no_untar=1
+        ;;
+
+      -dbug )
+        dbug=1
+        ;;
+
+      -install_dir )
+        if [ "$2" != "" ] ; then
+	    HDF_path=$2
+            shift
+        else
+            WriteError "No installation directory specified with -install_dir switch."
+            Help
+        fi
+        ;;
+
+	-batch )
+	    batch_mode=1
+	;;
+
+      * )
+        echo "$script_error invalid argument '$1'"
+        Help
+        ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Inititialize log file
+#
+
+if [ "$log_file" != "" ] ; then
+
+    if [ "$append" = "0" ] ; then
+        if [ -f "$log_file" ] ; then 
+            /bin/rm  -f $log_file > /dev/null 2>&1
+        fi
+    fi
+
+    touch $log_file > /dev/null 2>&1
+    if [ $? != 0 ] ; then
+        WriteError "Cannot write to file $log_file"
+        exit 1
+    fi
+
+    echo ""
+    echo "`basename $0`: session output will go to file: "
+    echo ""
+    echo "     $log_file"
+    echo ""
+
+fi
+
+export log_file
+
+#
+# Initialize the home file
+#
+
+if [ "$home_file" != "" ] ; then
+
+    if [ -f "$home_file" ] ; then 
+        /bin/rm -f $home_file > /dev/null 2>&1
+    fi
+
+    touch $home_file > /dev/null 2>&1
+    if [ $? != 0 ] ; then
+        WriteError "Cannot write to file $home_file"
+        exit 1
+    fi
+
+fi
+
+
+#
+# Set architecture-specific variables
+#
+
+SetArchitecture
+
+
+#
+# Set user compiler overrides
+#
+
+UserCompilers
+
+
+#
+# Get the location of the distribution file
+#
+
+GetDistribution
+
+
+#
+# Got valid distribution file
+# Get the location of the HDF home directory for installation
+#
+
+GetInstallDir
+
+
+#
+# Write the log file header
+#
+
+if [ "$log_file" != "" ] ; then
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "HDF installation starting at: `date`" >> $log_file
+    echo "host: $HOST    type: $BRAND     user: $USER " >> $log_file
+    echo "" >> $log_file
+    echo "" >> $log_file
+    echo "The HDF directory will be restored from: " >> $log_file
+    echo "    ${distrib_path}/${distrib_file}" >> $log_file
+    echo "" >> $log_file
+    echo "The HDF directory will be created in: " >> $log_file
+    echo "     ${HDF_path}" >> $log_file
+    echo "" >> $log_file
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "" >> $log_file
+fi
+
+
+#
+# Unpack the distribution file into the installation directory
+#
+
+    cd $HDF_path
+
+    if [ "$no_untar" = 0 ] ; then
+        UnpackDistribution
+    fi
+
+
+#
+# Prepare to install the requested version of HDF
+#
+
+if [ ! -d $hdf_home ] ; then
+    EchoAndLog "Error creating directory: $hdf_home"
+    exit 1
+fi
+
+cd $hdf_home				# go to the starting directory
+
+hdf_install_caller="$this_script"	# set caller flag for sub-modules
+export hdf_install_caller
+
+
+#
+# Set the version to be installed
+#
+
+install_script=""
+install_options=""
+
+case $hdf_home in
+
+  HDF3.3r4 )				# HDF 3.3 release 4
+    HDFHOME=${HDF_path}/${hdf_home} ; export HDFHOME 
+    install_script="$script_dir/INSTALL-HDF3.3r4"
+    ;;
+
+  HDF4.0r1p1 | 40r1p1_patchedsrc ) 	# HDF 4.0 release 1, patch level 1
+
+    HDFHOME=${HDF_path}/HDF4.0r1p1 ; export HDFHOME
+    install_script="$script_dir/INSTALL-HDF4.0r1p1"
+    ;;
+
+  HDF4.0r2 ) 				# HDF 4.0 release 2
+
+    HDFHOME=${HDF_path}/HDF4.0r2 ; export HDFHOME
+    install_script="$script_dir/INSTALL-HDF4.0r2"
+    if [ $set_compilers = 1 ] ; then 
+        install_options="-set_compilers"
+    fi
+    ;;
+
+  HDF4.1r1 ) 				# HDF 4.1 release 1
+
+    HDFHOME=${HDF_path}/HDF4.1r1 ; export HDFHOME
+    install_script="$script_dir/INSTALL-HDF4.1r1"
+    if [ $set_compilers = 1 ] ; then 
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then 
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDFHOME}"
+    ;;
+
+ 4.1r3_aix ) 				# HDF 4.1 release 1
+
+    HDFHOME=${HDF_path}/4.1r3_aix; export HDFHOME
+    install_script="$script_dir/INSTALL-4.1r3_aix"
+    if [ $set_compilers = 1 ] ; then 
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then 
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDFHOME}"
+    ;;
+
+HDF4.1r3 )                            # HDF 4.1 release 3
+
+    HDFHOME=${HDF_path}/HDF4.1r3 ; export HDFHOME
+    install_script="$script_dir/INSTALL-HDF4.1r3"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDFHOME}"
+    ;;
+
+  hdf4.1r4 )                            # HDF 4.1 release 4
+
+    HDFHOME=${HDF_path}/hdf4.1r4 ; export HDFHOME
+    install_script="$script_dir/INSTALL-HDF4.1r4"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDFHOME}"
+    ;;
+
+
+  HDF4.2r0 )                            # HDF4.2 release 0  
+
+    HDFHOME=${HDF_path}/HDF4.2r0 ; export HDFHOME
+    install_script="$script_dir/INSTALL-HDF4.2r0"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDFHOME}"
+    ;;
+
+  HDF4.2r1 )                            # HDF4.2 release 1
+
+    HDFHOME=${HDF_path}/HDF4.2r1 ; export HDFHOME
+    install_script="$script_dir/INSTALL-HDF4.2r1"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDFHOME}"
+    ;;
+
+  HDF4.2r2 )                            # HDF4.2 release 2
+
+    HDFHOME=${HDF_path}/HDF4.2r2 ; export HDFHOME
+    install_script="$script_dir/INSTALL-HDF4.2r2"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDFHOME}"
+    ;;
+
+  HDF4.2r3 )                            # HDF4.2 release 3
+
+    HDFHOME=${HDF_path}/HDF4.2r3 ; export HDFHOME
+    install_script="$script_dir/INSTALL-HDF4.2r3"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDFHOME}"
+    ;;
+
+  HDF4.2r4 )                            # HDF4.2 release 4
+
+    HDFHOME=${HDF_path}/HDF4.2r4 ; export HDFHOME
+    install_script="$script_dir/INSTALL-HDF4.2r4"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDFHOME}"
+    ;;
+  hdf-4.2.5 )                            # HDF4.2 release 5
+
+    HDFHOME=${HDF_path}/hdf-4.2.5 ; export HDFHOME
+    install_script="$script_dir/INSTALL-HDF4.2r5"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDFHOME}"
+    ;;
+  hdf-4.2.6 )                            # HDF4.2 release 6
+
+    HDFHOME=${HDF_path}/hdf-4.2.6 ; export HDFHOME
+    install_script="$script_dir/INSTALL-HDF4.2r6"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDFHOME}"
+    ;;
+    
+  hdf-4.2.10)                           # HDF4.2 release 10
+
+    HDFHOME=${HDF_path}/hdf-4.2.10 ; export HDFHOME
+    install_script="$script_dir/INSTALL-HDF4.2r10"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDFHOME}"
+    ;;
+
+  * ) 			# unsupported
+    EchoAndLog "$hdf_home installation is not supported by this script."
+    exit 1
+    ;;
+esac
+
+
+#
+# Run the install script
+#
+
+if [ ! -f $install_script ] ; then
+    EchoAndLog "Can't find $install_script - installation failed."
+    exit 1
+fi
+
+$install_script $install_options
+
+if [ $? != 0 ] ; then
+    EchoAndLog "$hdf_home Installation failed."
+    exit 1
+fi
+
+#
+# Starting with HDF4.1r3 internally used structures are put in vgint.h file.
+# Some users are using this file in their code. Since it is not copied
+# automatically fro hdf/src to include directories, we will do it here.
+#
+
+if [ -f ${HDFHOME}/include/vgint.h ] ; then
+    echo " "
+    echo " File ${HDFHOME}/include/vgint.h already exist."
+    echo " "
+else
+    echo " "
+    echo " Copying File ${HDFHOME}/hdf/src/vgint.h to ${HDFHOME}/include/vgint.h."
+    echo " "
+    /bin/cp ${HDFHOME}/hdf/src/vgint.h ${HDFHOME}/include/vgint.h
+fi
+
+# 
+# Pass back the HDF install directory for the hdfeos installation
+# 
+
+if [ "$home_file" != "" ] ; then
+    echo $HDFHOME >> $home_file
+fi
+
+
+
+#
+# Clean up
+#
+
+cd $HDF_path
+
+if [ "$clean" = 1 ] ; then
+
+    for dir in $HDFHOME/hdf $HDFHOME/mfhdf ; do 
+
+        cd $dir
+        echo "Cleaning up in $dir ..."
+
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+            echo "Cleaning up in $dir ..." >> $log_file
+            echo "" >> $log_file
+            make clean  >> $log_file 2>&1
+        else
+            make clean
+        fi
+
+    done
+
+fi
+
+if [ "$cleano" = 1 ] ; then
+
+    cd $HDFHOME
+    echo "Removing any remaining object files ..." 
+
+    if [ "$log_file" != "" ] ; then
+        echo "" >> $log_file
+        echo "Removing any remaining object files ..." >> $log_file
+        echo "" >> $log_file
+        find . -name \*.o -print -exec rm -f {} \; >> $log_file 2>&1
+        find . -name a.out -print -exec rm -f {} \; >> $log_file 2>&1
+    else
+        find . -name \*.o -print -exec rm -f {} \; 
+        find . -name a.out -print -exec rm -f {} \; 
+    fi
+    
+fi
+
+
+if [ "$strip_install" = 1 ] ; then
+
+    StripHdfInstall
+   
+fi
+
+
+echo "------------------------------------------------------------"
+echo ""
+echo "    HDF installation ending at: `date` " 
+echo ""
+echo "------------------------------------------------------------"
+
+
+
+#
+# Write the log file trailer
+#
+
+if [ "$log_file" != "" ] ; then
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "    HDF installation ending at: `date`" >> $log_file
+    echo "" >> $log_file
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+fi
+
diff --git a/bin/INSTALL-Scripts/INSTALL-HDF4.2r10 b/bin/INSTALL-Scripts/INSTALL-HDF4.2r10
new file mode 100755
index 0000000..2c16eec
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-HDF4.2r10
@@ -0,0 +1,1194 @@
+#! /bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-HDF4.2r10
+#
+# description:
+# 	Installation script module for installing HDF 4.2 release 6
+# 	for the SDP (PGS) Toolkit and hdfeos.  
+#       It implements patches to the NCSA 
+# 	installation procedure to allow for trouble-free installation on
+# 	the platforms supported by the SDP (PGS) Toolkit and hdfeos.
+#
+# usage:
+# 	Called from INSTALL-HDF
+#
+# 	INSTALL-HDF4.2r10 [-dbug]
+# 	INSTALL-HDF4.2r10 -h[elp]
+#
+# 	  -h      : display this help message and exit
+# 	  -dbug   : install debug version of HDF
+#
+# notes:
+# 	This is NOT a standalone script.  It is only intended to be run
+# 	by INSTALL-HDF, the HDF installation script.
+# 
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        
+# history:
+#       23-Apr-1996 MES Initial version (file: INSTALL-HDF4.0r1)
+# 	26-Apr-1996 MES Updated PreConfigure compiler logic.
+# 	02-Jul-1996 MES Updated to handle SunOS 5.5
+# 	19-Aug-1996 MES Updated for HDF4.0r2 (file: INSTALL-HDF4.0r2)
+# 	23-Sep-1996 MES Added patch to hdfi.h on dec to avoid potential
+# 			conflict with <rpc/types.h>.
+#       19-Aug-1996 MES Updated for HDF4.1r3 (file: INSTALL-HDF4.1r3)
+#       05-Oct-2000 AT  for machine HP-11 the xdr library libnsl.a needs to be
+#                       loaded as for the SOLARIS. Added code to edit mh-hpux
+#                       file in config directory to include the load flag -lnsl
+#      15-Aug-2001  AA  Updated for HDF4.1r5 (file: INSTALL-HDF4.1r5)
+#      16-Mar-2004  AA  Updated for HDF4.2r0 (file: INSTALL-HDF4.2r0)
+#       8-Sep-2005  AT  Updated for HDF4.2r1 (file: INSTALL-HDF4.2r1)
+#       5-Jul-2007  AT  Updated for HDF4.2r2 (file: INSTALL-HDF4.2r2)
+#       9-Jan-2008  AT  Updated for HDF4.2r3 (file: INSTALL-HDF4.2r3)
+#       9-MAY-2009  AT  Updated for HDF4.2r4 (file: INSTALL-HDF4.2r4)
+#      20-Jul-2010  AT  Updated for hdf-4.2.5 (file: INSTALL-HDF4.2r5)
+#      20-Jul-2010  AT  Updated for hdf-4.2.6 (file: INSTALL-HDF4.2r6)
+#      27-Jan-2014  AT  Updated for hdf-4.2.10 (file: INSTALL-HDF4.2r10)
+#
+#-----------------------------------------------------------------------------
+
+#
+#
+# Save starting directory, path
+# Create error message header
+#
+
+start_dir=`pwd`
+start_path=$PATH
+this_script="`basename $0`"
+script_error="$this_script: Error:"
+
+#
+# Get absolute pathname where this script is located
+# This allows the script to locate any needed auxilliary files
+#
+
+script_dir="`dirname $0`"
+abs="`echo $script_dir | cut -c1`"
+if [ "$abs" != "/" ] ; then
+    script_dir=`cd $script_dir;pwd`
+fi
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    if [ "$1" = "-n" ] ; then		# -n: suppress leading blank line
+        shift
+    else
+        echo ""
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+        fi
+    fi
+    
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+         echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function to prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to silently emulate the 'which' command 
+#
+
+Which()
+{
+    if [ "$1" = "" ] ; then 
+        WriteError "Which() : Too few arguments." 
+        exit 1 
+    fi
+
+    saveifs="$IFS"
+    IFS=:
+    which_result=0
+    which_cmd=""
+    
+    for dir in $PATH;  do 
+        if [ -x $dir/$1 ] ; then 
+            which_result=1 
+            which_cmd=$dir/$1
+            break 
+        fi 
+    done
+    
+    IFS="$saveifs"
+}
+
+PreConfigJPEGFixes_dec()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure JPEG fixes for $BRAND ... "
+    echo " "
+    file=$start_dir/configure
+    jpeglib=$JPEGLIB/libjpeg.a
+
+    if [ ! -f $file.ncsa.default ] ; then
+	mv  $file $file.ncsa.default
+    fi
+
+    sed 's^-ljpeg ^$JPEGLIB/libjpeg.a ^g' $file.ncsa.default > $file
+    /bin/chmod 0755 $file
+    /bin/rm -f $file.ncsa.default
+
+    cd $start_dir
+}
+
+#
+# Function to implement debug version of hdf libraries
+#
+
+PreConfigFixes_dbug()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure for debug ... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that get
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    case $BRAND in
+
+        cray  ) 
+		file=mh-unicos;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        dec   ) 
+		file=mh-alpha;
+		c_opt='-Olimit 2048'; c_dbug='-g';
+		f_opt='='; f_dbug='= -g';
+		
+		;;
+    
+        hp    ) 
+		file=mh-hpux;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        ibm   ) 
+		file=mh-aix;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        linux ) 
+		file=mh-linux;
+		c_opt='-ansi'; c_dbug='-ansi -g';
+		f_opt='='; f_dbug='= -g';
+		;;
+        
+        linux32 ) 
+		file=mh-linux;
+		c_opt='-ansi'; c_dbug='-ansi -g';
+		f_opt='='; f_dbug='= -g';
+		;;
+        
+        linux64 ) 
+		file=mh-linux;
+		c_opt='-ansi'; c_dbug='-ansi -g';
+		f_opt='='; f_dbug='= -g';
+		;;
+    
+        macintosh )
+                file=mh-mac;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+        
+        macintel )
+                file=mh-mac;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+       
+        macintel32 )
+                file=mh-mac;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+       
+        macintel64 )
+                file=mh-mac;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+
+        cygwin )
+                file=mh-cygwin;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+    
+        sgi   ) 
+		file=mh-irix32;
+		if [ "$OSTYPE" = "IRIX" ] ; then
+		    file=mh-irix5;
+		fi
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        sgi32 )
+		file=mh-irix32;
+		c_opt='-O' c_dbug='-g';
+		f_opt='-O' f_dbug='-g';
+		;;
+
+        sgi64 )
+		file=mh-irix6;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        sun4  )
+		file=mh-sun; c_opt='-O';
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        sun5  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+
+       sun5.8  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+       sun5.9  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+       sun5.10  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    if [ ! -f $file.ncsa.default ] ; then
+        mv  $file $file.ncsa.default
+    fi
+    
+    cat $file.ncsa.default |
+    sed "/^CFLAGS/s/$c_opt/ $c_dbug/" |
+    sed "/^FFLAGS/s/$f_opt/ $f_dbug/" |
+    cat > $file.ncsa
+    
+    mv $file.ncsa $file
+
+
+    cd $start_dir
+}
+
+
+
+#
+# Function to implement pre-configure installation fixes for linux
+#
+
+PreConfigFixes_linux()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    mv mh-linux mh-linux.ncsa
+    sed 's/f77/g77/g' mh-linux.ncsa > mh-linux
+
+    cd $start_dir
+}
+
+#
+# Function to implement pre-configure installation fixes for macintosh
+#
+
+PreConfigFixes_macintosh()
+{
+    cd $start_dir
+        
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+ 
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+ 
+    cd $start_dir/config
+ 
+    mv mh-mac mh-mac.ncsa
+    sed 's/f77/g77/g' mh-mac.ncsa > mh-mac
+ 
+    cd $start_dir
+}
+
+PreConfigFixes_cygwin()
+{
+    cd $start_dir/config
+    cd $start_dir
+}
+
+#
+# Function to implement pre-configure installation fixes for sgi
+#
+
+PreConfigFixes_sgi()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    if [ ! -f mh-irix6.ncsa ] ; then
+        mv mh-irix6 mh-irix6.ncsa
+        mv mh-irix32 mh-irix32.ncsa
+        sed 's/n32/32/g' mh-irix32.ncsa > mh-irix32
+        mv mh-irix32 mh-irix32.ncsa
+        sed 's/mips3/mips2/g' mh-irix32.ncsa > mh-irix32
+        mv mh-irix32 mh-irix6
+    fi
+
+    cd $start_dir
+}
+
+
+
+
+#
+# Function to implement pre-configure installation fixes for sgi32
+#
+
+PreConfigFixes_sgi32()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+
+
+    #
+    # Return to starting directory
+    #
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement pre-configure installation fixes for sgi64
+#
+
+PreConfigFixes_sgi64()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND... "
+
+    #
+    # If the SGI is using old R4?00 chips then mips4 is
+    # not supported, so force the use of mips3.
+    #
+
+    cd $start_dir/config
+
+    if [ ! -f mh-irix6.ncsa ] ; then
+	sed 's/mips4/mips3/g' mh-irix6 > mh-irix6.ncsa
+        mv mh-irix6.ncsa mh-irix6
+    fi
+
+    cd $start_dir
+}
+
+
+
+
+#
+# Function to implement pre-configure installation fixes for SunOs 4.x
+#
+
+PreConfigFixes_sun4()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for SunOs `uname -r`... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to make gcc the default C compiler.  To get around this we
+    # edit the file config/mh-sun to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    if [ ! -f mh-sun.ncsa ] ; then
+        mv mh-sun mh-sun.ncsa
+    fi
+
+    cat mh-sun.ncsa |
+    sed '/^CC *=/s/^/#/' |
+    sed '/^CFLAGS *=/s/^/#/' |
+    cat > mh-sun
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement pre-configure installation fixes for SunOs 5.x
+#
+
+PreConfigFixes_sun5()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for SunOs `uname -r`... "
+
+
+
+    #
+    # Return to starting directory
+    #
+
+    cd $start_dir
+
+}
+
+
+#
+# Function to implement pre-configure installation fixes for dec
+#
+
+PreConfigFixes_dec()
+{
+    cd $start_dir/config
+
+    EchoAndLog "Pre-configure patching for $BRAND... "
+
+
+    # Modify mh-alpha to include math library for DEC-ALPHA
+    # version 4.0
+
+    chmod 0755 *
+    mv mh-alpha mh-alpha.ncsa
+    sed 's/#LIBSX/LIBSX/g' mh-alpha.ncsa > mh-alpha
+    mv mh-alpha mh-alpha.ncsa
+    sed 's/FC = NONE/FC = f77/g' mh-alpha.ncsa > mh-alpha
+    #
+    # Return to starting directory
+    #
+
+    cd $start_dir
+}
+
+
+
+#
+# Function to implement post-configure installation fixes for dec
+#
+
+PostConfigFixes_dec()
+{
+    cd $start_dir
+
+    EchoAndLog "Post-configure patching for $BRAND... "
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement post-configure installation fixes for IBM AIX 4.2
+#
+
+PostConfigFixes_ibm()
+{
+    cd $start_dir/mfhdf/nctest
+ 
+    EchoAndLog "Post-configure patching for IBM `uname -r`... "
+ 
+    # Rename program error.c and edit the Makfile to reflect change
+    # This version of AIX will not compile the program error.c
+    # So I am changing the name so that HDF will install
+ 
+    cp error.c dave.c
+    chmod 0755 Makefile
+    mv Makefile Makefile.ncsa
+    sed 's/error.c/dave.c/g' Makefile.ncsa > Makefile
+    mv Makefile Makefile.ncsa
+    sed 's/error.o/dave.o/g' Makefile.ncsa > Makefile
+ 
+    #
+    # Return to starting directory
+    #
+ 
+    cd $start_dir
+ 
+}
+
+#
+# Function to implement post-configure installation fixes for SunOs 5.x
+#
+
+PostConfigFixes_sun5()
+{
+    cd $start_dir
+
+    EchoAndLog "Post-configure patching for SunOs `uname -r`... "
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement post-configure installation fixes for 
+# platforms that do not have tbl or neqn
+#
+
+PostConfigFixes_NoTblNeqn()
+{
+    #
+    # Search the system for 'tbl' and 'neqn'
+    # If either one is not found, set up a sed command to patch 
+    # Makefiles to use 'cat' instead
+    #
+
+    sed_cmd="cat"
+    for util in tbl neqn ; do
+
+        Which $util
+        if [ "$which_result" = "0" ] ; then 
+            EchoAndLog "This system does not have the '$util' utility:"
+            EchoAndLog -n "- setting up to use 'cat' instead"
+            sed_cmd="$sed_cmd | sed 's/ $util/cat/g'"
+        fi
+    
+    done
+
+    #
+    # Edit the Makefiles generated by configure, setting the values of
+    # 'neqn' and 'tbl' to 'cat', as needed, so that man page installation
+    # can proceed without fatal errors.   Note: this may cause some
+    # man pages to be improperly formatted.   This only appears to
+    # be a problem in the mfhdf section, so only those makefiles
+    # are patched.
+    # 
+
+    if [ "$sed_cmd" != cat ] ; then
+
+        cd $start_dir/mfhdf
+
+        files=`find . -name Makefile -print`
+
+        for file in $files ; do
+
+            mv $file $file.tmp
+            eval "cat $file.tmp | $sed_cmd | cat > $file"
+
+        done
+        
+        cd $start_dir
+
+    fi
+
+
+}
+
+
+
+#
+# Function to set compilers, overriding the NCSA compiler defaults
+#
+    
+SetCompilers()
+{
+    #
+    # Set C compiler based on value of $CC
+    # Set C compilation flags based on value of $CFLAGS
+    # Set FORTRAN compiler based on value of $F77
+    # 
+    # NOTE: 
+    #     This is done recursively for ALL Makefiles because on some
+    #     platforms, the compiler variables are not inherited from the
+    #     the calling Makefile.
+
+
+    EchoAndLog "Overriding NCSA default compiler settings:"
+
+    files=`find . -name Makefile -print`
+
+    if [ "$CC" != "" ] ; then
+
+        if [ "$CFLAGS" = "" ] ; then
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+            for file in $files ; do
+            
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        else
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            if [ "$CFLAGS" = "-O" ] ; then
+                EchoAndLog -n "- setting C compilation flags to default"
+            else
+                EchoAndLog -n "- setting C compilation flags to '$CFLAGS'"
+            fi
+
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+           for file in $files ; do
+
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^CFLAGS/s/=.*$'"/= $CFLAGS/" |
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        fi
+
+    else
+
+        EchoAndLog "Warning: Environment variable(s) CC and/or F77 not set."
+        EchoAndLog "If CC is not set, the installation uses NCSA defaults."
+
+    fi
+
+}
+
+
+
+#
+# Function to do architecture-specific pre-configure fixes
+#
+    
+PreConfigure()
+{
+
+    cd $start_dir
+
+    if [ "$dbug" = "1" ] ; then
+	PreConfigFixes_dbug
+    fi
+
+    #
+    # Call architecture-specific functions
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) PreConfigFixes_dec;;
+    
+        hp    ) 
+	    # for HP-11 add -lnsl
+	    if [ `uname -r | awk -F. '{print $2}'` = "11" ] ; then
+		mv $install_dir/config/mh-hpux $install_dir/config/mh-hpux_tmp1
+		cat $install_dir/config/mh-hpux_tmp1 |
+		sed '/^LD_XDR/s/=.*$'"/= -lnsl/" |
+		cat > $install_dir/config/mh-hpux_tmp2
+		cp $install_dir/config/mh-hpux_tmp2 $install_dir/config/mh-hpux
+		/bin/rm -f $install_dir/config/mh-hpux_tmp1
+		/bin/rm -f $install_dir/config/mh-hpux_tmp2
+	    fi
+	    ;;
+    
+        ibm   ) ;;
+
+        linux ) 
+		if [ ! -f /bin/f77 ] ; then
+		    PreConfigFixes_linux
+		fi
+		;;
+    
+        linux32 ) 
+		if [ ! -f /bin/f77 ] ; then
+		    PreConfigFixes_linux
+		fi
+		;;
+    
+        linux64 ) 
+		if [ ! -f /bin/f77 ] ; then
+		    PreConfigFixes_linux
+		fi
+		;;
+    
+        macintosh )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+            
+        macintel )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+               
+        macintel32 )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+               
+        macintel64 )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+    
+        cygwin )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_cygwin
+                fi
+   		;;
+
+        sgi   ) 
+		if [ "$OSTYPE" = "IRIX64" ] ; then
+		    PreConfigFixes_sgi
+		fi
+		;;
+    
+        sgi32 ) config_flags=irix6_32;;
+
+        sgi64 )
+		cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+		if [ "$cpu_type" = "4" ] ; then
+		    PreConfigFixes_sgi64
+		fi
+		;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+    
+        sun5.9  ) ;;
+    
+        sun5.10  ) ;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    cd $start_dir
+
+}
+
+
+#
+# Function to do architecture-specific post-configure fixes
+#
+    
+PostConfigure()
+{
+    cd $start_dir
+    
+    
+    #
+    # Check for missing tbl and neqn, patching as needed
+    #
+
+    PostConfigFixes_NoTblNeqn
+
+
+    #
+    # Do architecture-specific fixes
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) ;;
+    
+        hp    ) ;;
+    
+        ibm   ) PostConfigFixes_ibm;;
+
+        linux ) ;;
+ 
+        linux32 ) ;;
+  
+        linux64 ) ;;
+   
+        macintosh ) ;;
+   
+        macintel ) ;;
+
+        macintel32 ) ;;
+
+        macintel64 ) ;;
+    
+        cygwin ) ;;
+  
+        sgi   ) ;;
+    
+        sgi32 ) ;;
+
+        sgi64 ) ;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+    
+        sun5.9  ) ;;
+    
+        sun5.10  ) ;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    
+    #
+    # If requested, set compilers to something other than the defaults
+    #
+
+    if [ $set_compilers = 1 ] ; then
+        SetCompilers
+    fi
+
+    cd $start_dir
+}
+
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+#
+# Get arguments from command line
+#
+
+set_compilers=0
+config_flags=""
+dbug=0
+
+while [ "$1" != "" ] ; do 
+
+    case "$1" in
+
+      -h | help ) Help ;;
+
+      -set_compilers ) set_compilers=1 ;;
+
+      -dbug ) dbug=1 ;;
+
+      -start_dir ) 
+          if [ "$2" != "" ] ; then
+              start_dir=$2
+              shift
+          else
+              WriteError "No installation directory specified with -start_dir switch."
+              Help
+          fi
+        ;;
+
+
+      * ) echo "$script_error invalid argument '$1'" ; Help ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Make sure we're not running standalone
+#
+
+if [ "$hdf_install_caller" = "" ] ; then
+
+    WriteError "This script can only be run from INSTALL-HDF."
+    Help
+
+else
+
+    # Here we set up the HDF installation directory,
+    # for use by the configure script.  
+    # 
+    # With this release of HDF, we abandon the convention of setting the
+    # installation directory to $HDFHOME/hdf, which was formerly done for
+    # backwards compatibility with the installed HDF directory structure 
+    # that the toolkit was using with the 3.3r4 version of HDF.
+    # 
+    # New releases of the SDP Toolkit  and hdfeos have been updated to handle this
+    # directory change
+
+    install_dir="$HDFHOME"
+
+    if [ ! -d "$install_dir" ] ; then 	# create the install dir, if needed.
+        mkdir $install_dir
+    fi
+
+fi
+
+
+
+#
+# Announce
+#
+
+EchoAndLog "Running $this_script"
+
+#
+# Do architecture-specific pre-configure fixes
+#
+
+#PreConfigure
+
+#
+# In dec -ljpeg does not work, must use full path for the library
+#
+if [ "$BRAND" = "dec" ] ; then
+	PreConfigJPEGFixes_dec
+fi
+
+if [ "$dbug" = "1" ] ; then
+        CFLAGS=" -g"
+    fi
+        export CFLAGS
+
+#
+# Run the NCSA-supplied configure script
+#
+
+if [ "$dbug" = "1" ] ; then
+        config_flags="$config_flags --disable-production  --disable-shared"
+else
+        config_flags="$config_flags --disable-shared"
+fi
+
+cd $start_dir
+
+tmp_home=$HOME			# save $HOME
+HOME=`pwd` ; export HOME	# change it to avoid interaction w/ .cshrc
+
+if [ "$User_has_external_netCDF" = "1" ] ; then # Configure HDF4 with --disable-netcdf
+    if [ "$CONFIG_HDF4_WITH_SZIP" = "1" ] ; then    # Configure HDF4 with SZIP
+	EchoAndLog "Running ./configure -v --with-jpeg=$JPEGINC,$JPEGLIB --with-zlib=$ZLIBINC,$ZLIBLIB --with-szlib=$SZIPINC,$SZIPLIB --disable-netcdf --prefix=$install_dir $config_flags"
+
+	if [ "$log_file" != "" ] ; then
+	    echo "" >> $log_file
+
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB  --with-szlib=$SZIPINC,$SZIPLIB --disable-netcdf --prefix=$install_dir $config_flags >> $log_file 2>&1
+	else
+	
+	    echo ""
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB   --with-szlib=$SZIPINC,$SZIPLIB --disable-netcdf --prefix=$install_dir $config_flags
+	fi
+    else      # Do not configure HDF4 with SZIP
+	EchoAndLog "Running ./configure -v  --with-jpeg=$JPEGINC,$JPEGLIB --with-zlib=$ZLIBINC,$ZLIBLIB  --disable-netcdf --prefix=$install_dir $config_flags"
+	
+	if [ "$log_file" != "" ] ; then
+	    echo "" >> $log_file
+	    
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB --disable-netcdf --prefix=$install_dir $config_flags >> $log_file 2>&1
+	else
+	
+	    echo ""
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB --disable-netcdf --prefix=$install_dir $config_flags
+	fi
+    fi
+else  # Configure HDF4 without --disable-netcdf
+    if [ "$CONFIG_HDF4_WITH_SZIP" = "1" ] ; then    # Configure HDF4 with SZIP
+	EchoAndLog "Running ./configure -v  --with-jpeg=$JPEGINC,$JPEGLIB --with-zlib=$ZLIBINC,$ZLIBLIB --with-szlib=$SZIPINC,$SZIPLIB --prefix=$install_dir $config_flags"
+
+	if [ "$log_file" != "" ] ; then
+	    echo "" >> $log_file
+
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB  --with-szlib=$SZIPINC,$SZIPLIB --prefix=$install_dir $config_flags >> $log_file 2>&1
+	else
+	
+	    echo ""
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB   --with-szlib=$SZIPINC,$SZIPLIB --prefix=$install_dir $config_flags
+	fi
+    else      # Do not configure HDF4 with SZIP
+	EchoAndLog "Running ./configure -v  --with-jpeg=$JPEGINC,$JPEGLIB --with-zlib=$ZLIBINC,$ZLIBLIB  --prefix=$install_dir $config_flags"
+	
+	if [ "$log_file" != "" ] ; then
+	    echo "" >> $log_file
+	    
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB  --prefix=$install_dir $config_flags >> $log_file 2>&1
+	else
+	
+	    echo ""
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB --prefix=$install_dir $config_flags
+	fi
+    fi
+fi
+
+HOME=$tmp_home ; export HOME	# restore $HOME
+
+
+#
+# Do architecture-specific post-configure fixes
+#
+
+
+PostConfigure
+
+
+#
+# Run the make utility to compile the library and utiltites
+#
+
+EchoAndLog "Running make, target=all"
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make 
+    tmp_status=$?
+fi
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make ' failed."
+    exit 1
+fi
+
+
+#
+# Run the make utility install the libraries, utilities, includes and man pages 
+#
+
+EchoAndLog "Running make, target=install "
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make install >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make install
+    tmp_status=$?
+fi
+
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make install' failed."
+    exit 1
+fi
+
diff --git a/bin/INSTALL-Scripts/INSTALL-HDF4.2r6 b/bin/INSTALL-Scripts/INSTALL-HDF4.2r6
new file mode 100755
index 0000000..07f1277
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-HDF4.2r6
@@ -0,0 +1,1193 @@
+#! /bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-HDF4.2r6
+#
+# description:
+# 	Installation script module for installing HDF 4.2 release 6
+# 	for the SDP (PGS) Toolkit and hdfeos.  
+#       It implements patches to the NCSA 
+# 	installation procedure to allow for trouble-free installation on
+# 	the platforms supported by the SDP (PGS) Toolkit and hdfeos.
+#
+# usage:
+# 	Called from INSTALL-HDF
+#
+# 	INSTALL-HDF4.2r6 [-dbug]
+# 	INSTALL-HDF4.2r6 -h[elp]
+#
+# 	  -h      : display this help message and exit
+# 	  -dbug   : install debug version of HDF
+#
+# notes:
+# 	This is NOT a standalone script.  It is only intended to be run
+# 	by INSTALL-HDF, the HDF installation script.
+# 
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        
+# history:
+#       23-Apr-1996 MES Initial version (file: INSTALL-HDF4.0r1)
+# 	26-Apr-1996 MES Updated PreConfigure compiler logic.
+# 	02-Jul-1996 MES Updated to handle SunOS 5.5
+# 	19-Aug-1996 MES Updated for HDF4.0r2 (file: INSTALL-HDF4.0r2)
+# 	23-Sep-1996 MES Added patch to hdfi.h on dec to avoid potential
+# 			conflict with <rpc/types.h>.
+#       19-Aug-1996 MES Updated for HDF4.1r3 (file: INSTALL-HDF4.1r3)
+#       05-Oct-2000 AT  for machine HP-11 the xdr library libnsl.a needs to be
+#                       loaded as for the SOLARIS. Added code to edit mh-hpux
+#                       file in config directory to include the load flag -lnsl
+#      15-Aug-2001  AA  Updated for HDF4.1r5 (file: INSTALL-HDF4.1r5)
+#      16-Mar-2004  AA  Updated for HDF4.2r0 (file: INSTALL-HDF4.2r0)
+#       8-Sep-2005  AT  Updated for HDF4.2r1 (file: INSTALL-HDF4.2r1)
+#       5-Jul-2007  AT  Updated for HDF4.2r2 (file: INSTALL-HDF4.2r2)
+#       9-Jan-2008  AT  Updated for HDF4.2r3 (file: INSTALL-HDF4.2r3)
+#       9-MAY-2009  AT  Updated for HDF4.2r4 (file: INSTALL-HDF4.2r4)
+#      20-Jul-2010  AT  Updated for hdf-4.2.5 (file: INSTALL-HDF4.2r5)
+#      20-Jul-2010  AT  Updated for hdf-4.2.6 (file: INSTALL-HDF4.2r6)
+#
+#-----------------------------------------------------------------------------
+
+#
+#
+# Save starting directory, path
+# Create error message header
+#
+
+start_dir=`pwd`
+start_path=$PATH
+this_script="`basename $0`"
+script_error="$this_script: Error:"
+
+#
+# Get absolute pathname where this script is located
+# This allows the script to locate any needed auxilliary files
+#
+
+script_dir="`dirname $0`"
+abs="`echo $script_dir | cut -c1`"
+if [ "$abs" != "/" ] ; then
+    script_dir=`cd $script_dir;pwd`
+fi
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    if [ "$1" = "-n" ] ; then		# -n: suppress leading blank line
+        shift
+    else
+        echo ""
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+        fi
+    fi
+    
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+         echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function to prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to silently emulate the 'which' command 
+#
+
+Which()
+{
+    if [ "$1" = "" ] ; then 
+        WriteError "Which() : Too few arguments." 
+        exit 1 
+    fi
+
+    saveifs="$IFS"
+    IFS=:
+    which_result=0
+    which_cmd=""
+    
+    for dir in $PATH;  do 
+        if [ -x $dir/$1 ] ; then 
+            which_result=1 
+            which_cmd=$dir/$1
+            break 
+        fi 
+    done
+    
+    IFS="$saveifs"
+}
+
+PreConfigJPEGFixes_dec()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure JPEG fixes for $BRAND ... "
+    echo " "
+    file=$start_dir/configure
+    jpeglib=$JPEGLIB/libjpeg.a
+
+    if [ ! -f $file.ncsa.default ] ; then
+	mv  $file $file.ncsa.default
+    fi
+
+    sed 's^-ljpeg ^$JPEGLIB/libjpeg.a ^g' $file.ncsa.default > $file
+    /bin/chmod 0755 $file
+    /bin/rm -f $file.ncsa.default
+
+    cd $start_dir
+}
+
+#
+# Function to implement debug version of hdf libraries
+#
+
+PreConfigFixes_dbug()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure for debug ... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that get
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    case $BRAND in
+
+        cray  ) 
+		file=mh-unicos;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        dec   ) 
+		file=mh-alpha;
+		c_opt='-Olimit 2048'; c_dbug='-g';
+		f_opt='='; f_dbug='= -g';
+		
+		;;
+    
+        hp    ) 
+		file=mh-hpux;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        ibm   ) 
+		file=mh-aix;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        linux ) 
+		file=mh-linux;
+		c_opt='-ansi'; c_dbug='-ansi -g';
+		f_opt='='; f_dbug='= -g';
+		;;
+        
+        linux32 ) 
+		file=mh-linux;
+		c_opt='-ansi'; c_dbug='-ansi -g';
+		f_opt='='; f_dbug='= -g';
+		;;
+        
+        linux64 ) 
+		file=mh-linux;
+		c_opt='-ansi'; c_dbug='-ansi -g';
+		f_opt='='; f_dbug='= -g';
+		;;
+    
+        macintosh )
+                file=mh-mac;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+        
+        macintel )
+                file=mh-mac;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+       
+        macintel32 )
+                file=mh-mac;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+       
+        macintel64 )
+                file=mh-mac;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+
+        cygwin )
+                file=mh-cygwin;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+    
+        sgi   ) 
+		file=mh-irix32;
+		if [ "$OSTYPE" = "IRIX" ] ; then
+		    file=mh-irix5;
+		fi
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        sgi32 )
+		file=mh-irix32;
+		c_opt='-O' c_dbug='-g';
+		f_opt='-O' f_dbug='-g';
+		;;
+
+        sgi64 )
+		file=mh-irix6;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        sun4  )
+		file=mh-sun; c_opt='-O';
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        sun5  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+
+       sun5.8  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+       sun5.9  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+       sun5.10  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    if [ ! -f $file.ncsa.default ] ; then
+        mv  $file $file.ncsa.default
+    fi
+    
+    cat $file.ncsa.default |
+    sed "/^CFLAGS/s/$c_opt/ $c_dbug/" |
+    sed "/^FFLAGS/s/$f_opt/ $f_dbug/" |
+    cat > $file.ncsa
+    
+    mv $file.ncsa $file
+
+
+    cd $start_dir
+}
+
+
+
+#
+# Function to implement pre-configure installation fixes for linux
+#
+
+PreConfigFixes_linux()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    mv mh-linux mh-linux.ncsa
+    sed 's/f77/g77/g' mh-linux.ncsa > mh-linux
+
+    cd $start_dir
+}
+
+#
+# Function to implement pre-configure installation fixes for macintosh
+#
+
+PreConfigFixes_macintosh()
+{
+    cd $start_dir
+        
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+ 
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+ 
+    cd $start_dir/config
+ 
+    mv mh-mac mh-mac.ncsa
+    sed 's/f77/g77/g' mh-mac.ncsa > mh-mac
+ 
+    cd $start_dir
+}
+
+PreConfigFixes_cygwin()
+{
+    cd $start_dir/config
+    cd $start_dir
+}
+
+#
+# Function to implement pre-configure installation fixes for sgi
+#
+
+PreConfigFixes_sgi()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    if [ ! -f mh-irix6.ncsa ] ; then
+        mv mh-irix6 mh-irix6.ncsa
+        mv mh-irix32 mh-irix32.ncsa
+        sed 's/n32/32/g' mh-irix32.ncsa > mh-irix32
+        mv mh-irix32 mh-irix32.ncsa
+        sed 's/mips3/mips2/g' mh-irix32.ncsa > mh-irix32
+        mv mh-irix32 mh-irix6
+    fi
+
+    cd $start_dir
+}
+
+
+
+
+#
+# Function to implement pre-configure installation fixes for sgi32
+#
+
+PreConfigFixes_sgi32()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+
+
+    #
+    # Return to starting directory
+    #
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement pre-configure installation fixes for sgi64
+#
+
+PreConfigFixes_sgi64()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND... "
+
+    #
+    # If the SGI is using old R4?00 chips then mips4 is
+    # not supported, so force the use of mips3.
+    #
+
+    cd $start_dir/config
+
+    if [ ! -f mh-irix6.ncsa ] ; then
+	sed 's/mips4/mips3/g' mh-irix6 > mh-irix6.ncsa
+        mv mh-irix6.ncsa mh-irix6
+    fi
+
+    cd $start_dir
+}
+
+
+
+
+#
+# Function to implement pre-configure installation fixes for SunOs 4.x
+#
+
+PreConfigFixes_sun4()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for SunOs `uname -r`... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to make gcc the default C compiler.  To get around this we
+    # edit the file config/mh-sun to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    if [ ! -f mh-sun.ncsa ] ; then
+        mv mh-sun mh-sun.ncsa
+    fi
+
+    cat mh-sun.ncsa |
+    sed '/^CC *=/s/^/#/' |
+    sed '/^CFLAGS *=/s/^/#/' |
+    cat > mh-sun
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement pre-configure installation fixes for SunOs 5.x
+#
+
+PreConfigFixes_sun5()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for SunOs `uname -r`... "
+
+
+
+    #
+    # Return to starting directory
+    #
+
+    cd $start_dir
+
+}
+
+
+#
+# Function to implement pre-configure installation fixes for dec
+#
+
+PreConfigFixes_dec()
+{
+    cd $start_dir/config
+
+    EchoAndLog "Pre-configure patching for $BRAND... "
+
+
+    # Modify mh-alpha to include math library for DEC-ALPHA
+    # version 4.0
+
+    chmod 0755 *
+    mv mh-alpha mh-alpha.ncsa
+    sed 's/#LIBSX/LIBSX/g' mh-alpha.ncsa > mh-alpha
+    mv mh-alpha mh-alpha.ncsa
+    sed 's/FC = NONE/FC = f77/g' mh-alpha.ncsa > mh-alpha
+    #
+    # Return to starting directory
+    #
+
+    cd $start_dir
+}
+
+
+
+#
+# Function to implement post-configure installation fixes for dec
+#
+
+PostConfigFixes_dec()
+{
+    cd $start_dir
+
+    EchoAndLog "Post-configure patching for $BRAND... "
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement post-configure installation fixes for IBM AIX 4.2
+#
+
+PostConfigFixes_ibm()
+{
+    cd $start_dir/mfhdf/nctest
+ 
+    EchoAndLog "Post-configure patching for IBM `uname -r`... "
+ 
+    # Rename program error.c and edit the Makfile to reflect change
+    # This version of AIX will not compile the program error.c
+    # So I am changing the name so that HDF will install
+ 
+    cp error.c dave.c
+    chmod 0755 Makefile
+    mv Makefile Makefile.ncsa
+    sed 's/error.c/dave.c/g' Makefile.ncsa > Makefile
+    mv Makefile Makefile.ncsa
+    sed 's/error.o/dave.o/g' Makefile.ncsa > Makefile
+ 
+    #
+    # Return to starting directory
+    #
+ 
+    cd $start_dir
+ 
+}
+
+#
+# Function to implement post-configure installation fixes for SunOs 5.x
+#
+
+PostConfigFixes_sun5()
+{
+    cd $start_dir
+
+    EchoAndLog "Post-configure patching for SunOs `uname -r`... "
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement post-configure installation fixes for 
+# platforms that do not have tbl or neqn
+#
+
+PostConfigFixes_NoTblNeqn()
+{
+    #
+    # Search the system for 'tbl' and 'neqn'
+    # If either one is not found, set up a sed command to patch 
+    # Makefiles to use 'cat' instead
+    #
+
+    sed_cmd="cat"
+    for util in tbl neqn ; do
+
+        Which $util
+        if [ "$which_result" = "0" ] ; then 
+            EchoAndLog "This system does not have the '$util' utility:"
+            EchoAndLog -n "- setting up to use 'cat' instead"
+            sed_cmd="$sed_cmd | sed 's/ $util/cat/g'"
+        fi
+    
+    done
+
+    #
+    # Edit the Makefiles generated by configure, setting the values of
+    # 'neqn' and 'tbl' to 'cat', as needed, so that man page installation
+    # can proceed without fatal errors.   Note: this may cause some
+    # man pages to be improperly formatted.   This only appears to
+    # be a problem in the mfhdf section, so only those makefiles
+    # are patched.
+    # 
+
+    if [ "$sed_cmd" != cat ] ; then
+
+        cd $start_dir/mfhdf
+
+        files=`find . -name Makefile -print`
+
+        for file in $files ; do
+
+            mv $file $file.tmp
+            eval "cat $file.tmp | $sed_cmd | cat > $file"
+
+        done
+        
+        cd $start_dir
+
+    fi
+
+
+}
+
+
+
+#
+# Function to set compilers, overriding the NCSA compiler defaults
+#
+    
+SetCompilers()
+{
+    #
+    # Set C compiler based on value of $CC
+    # Set C compilation flags based on value of $CFLAGS
+    # Set FORTRAN compiler based on value of $F77
+    # 
+    # NOTE: 
+    #     This is done recursively for ALL Makefiles because on some
+    #     platforms, the compiler variables are not inherited from the
+    #     the calling Makefile.
+
+
+    EchoAndLog "Overriding NCSA default compiler settings:"
+
+    files=`find . -name Makefile -print`
+
+    if [ "$CC" != "" ] ; then
+
+        if [ "$CFLAGS" = "" ] ; then
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+            for file in $files ; do
+            
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        else
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            if [ "$CFLAGS" = "-O" ] ; then
+                EchoAndLog -n "- setting C compilation flags to default"
+            else
+                EchoAndLog -n "- setting C compilation flags to '$CFLAGS'"
+            fi
+
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+           for file in $files ; do
+
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^CFLAGS/s/=.*$'"/= $CFLAGS/" |
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        fi
+
+    else
+
+        EchoAndLog "Warning: Environment variable(s) CC and/or F77 not set."
+        EchoAndLog "If CC is not set, the installation uses NCSA defaults."
+
+    fi
+
+}
+
+
+
+#
+# Function to do architecture-specific pre-configure fixes
+#
+    
+PreConfigure()
+{
+
+    cd $start_dir
+
+    if [ "$dbug" = "1" ] ; then
+	PreConfigFixes_dbug
+    fi
+
+    #
+    # Call architecture-specific functions
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) PreConfigFixes_dec;;
+    
+        hp    ) 
+	    # for HP-11 add -lnsl
+	    if [ `uname -r | awk -F. '{print $2}'` = "11" ] ; then
+		mv $install_dir/config/mh-hpux $install_dir/config/mh-hpux_tmp1
+		cat $install_dir/config/mh-hpux_tmp1 |
+		sed '/^LD_XDR/s/=.*$'"/= -lnsl/" |
+		cat > $install_dir/config/mh-hpux_tmp2
+		cp $install_dir/config/mh-hpux_tmp2 $install_dir/config/mh-hpux
+		/bin/rm -f $install_dir/config/mh-hpux_tmp1
+		/bin/rm -f $install_dir/config/mh-hpux_tmp2
+	    fi
+	    ;;
+    
+        ibm   ) ;;
+
+        linux ) 
+		if [ ! -f /bin/f77 ] ; then
+		    PreConfigFixes_linux
+		fi
+		;;
+    
+        linux32 ) 
+		if [ ! -f /bin/f77 ] ; then
+		    PreConfigFixes_linux
+		fi
+		;;
+    
+        linux64 ) 
+		if [ ! -f /bin/f77 ] ; then
+		    PreConfigFixes_linux
+		fi
+		;;
+    
+        macintosh )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+            
+        macintel )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+               
+        macintel32 )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+               
+        macintel64 )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+    
+        cygwin )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_cygwin
+                fi
+   		;;
+
+        sgi   ) 
+		if [ "$OSTYPE" = "IRIX64" ] ; then
+		    PreConfigFixes_sgi
+		fi
+		;;
+    
+        sgi32 ) config_flags=irix6_32;;
+
+        sgi64 )
+		cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+		if [ "$cpu_type" = "4" ] ; then
+		    PreConfigFixes_sgi64
+		fi
+		;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+    
+        sun5.9  ) ;;
+    
+        sun5.10  ) ;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    cd $start_dir
+
+}
+
+
+#
+# Function to do architecture-specific post-configure fixes
+#
+    
+PostConfigure()
+{
+    cd $start_dir
+    
+    
+    #
+    # Check for missing tbl and neqn, patching as needed
+    #
+
+    PostConfigFixes_NoTblNeqn
+
+
+    #
+    # Do architecture-specific fixes
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) ;;
+    
+        hp    ) ;;
+    
+        ibm   ) PostConfigFixes_ibm;;
+
+        linux ) ;;
+ 
+        linux32 ) ;;
+  
+        linux64 ) ;;
+   
+        macintosh ) ;;
+   
+        macintel ) ;;
+
+        macintel32 ) ;;
+
+        macintel64 ) ;;
+    
+        cygwin ) ;;
+  
+        sgi   ) ;;
+    
+        sgi32 ) ;;
+
+        sgi64 ) ;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+    
+        sun5.9  ) ;;
+    
+        sun5.10  ) ;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    
+    #
+    # If requested, set compilers to something other than the defaults
+    #
+
+    if [ $set_compilers = 1 ] ; then
+        SetCompilers
+    fi
+
+    cd $start_dir
+}
+
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+#
+# Get arguments from command line
+#
+
+set_compilers=0
+config_flags=""
+dbug=0
+
+while [ "$1" != "" ] ; do 
+
+    case "$1" in
+
+      -h | help ) Help ;;
+
+      -set_compilers ) set_compilers=1 ;;
+
+      -dbug ) dbug=1 ;;
+
+      -start_dir ) 
+          if [ "$2" != "" ] ; then
+              start_dir=$2
+              shift
+          else
+              WriteError "No installation directory specified with -start_dir switch."
+              Help
+          fi
+        ;;
+
+
+      * ) echo "$script_error invalid argument '$1'" ; Help ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Make sure we're not running standalone
+#
+
+if [ "$hdf_install_caller" = "" ] ; then
+
+    WriteError "This script can only be run from INSTALL-HDF."
+    Help
+
+else
+
+    # Here we set up the HDF installation directory,
+    # for use by the configure script.  
+    # 
+    # With this release of HDF, we abandon the convention of setting the
+    # installation directory to $HDFHOME/hdf, which was formerly done for
+    # backwards compatibility with the installed HDF directory structure 
+    # that the toolkit was using with the 3.3r4 version of HDF.
+    # 
+    # New releases of the SDP Toolkit  and hdfeos have been updated to handle this
+    # directory change
+
+    install_dir="$HDFHOME"
+
+    if [ ! -d "$install_dir" ] ; then 	# create the install dir, if needed.
+        mkdir $install_dir
+    fi
+
+fi
+
+
+
+#
+# Announce
+#
+
+EchoAndLog "Running $this_script"
+
+#
+# Do architecture-specific pre-configure fixes
+#
+
+#PreConfigure
+
+#
+# In dec -ljpeg does not work, must use full path for the library
+#
+if [ "$BRAND" = "dec" ] ; then
+	PreConfigJPEGFixes_dec
+fi
+
+if [ "$dbug" = "1" ] ; then
+        CFLAGS=" -g"
+    fi
+        export CFLAGS
+
+#
+# Run the NCSA-supplied configure script
+#
+
+if [ "$dbug" = "1" ] ; then
+        config_flags="$config_flags --disable-production  --disable-shared"
+else
+        config_flags="$config_flags --disable-shared"
+fi
+
+cd $start_dir
+
+tmp_home=$HOME			# save $HOME
+HOME=`pwd` ; export HOME	# change it to avoid interaction w/ .cshrc
+
+if [ "$User_has_external_netCDF" = "1" ] ; then # Configure HDF4 with --disable-netcdf
+    if [ "$CONFIG_HDF4_WITH_SZIP" = "1" ] ; then    # Configure HDF4 with SZIP
+	EchoAndLog "Running ./configure -v --with-jpeg=$JPEGINC,$JPEGLIB --with-zlib=$ZLIBINC,$ZLIBLIB --with-szlib=$SZIPINC,$SZIPLIB --disable-netcdf --prefix=$install_dir $config_flags"
+
+	if [ "$log_file" != "" ] ; then
+	    echo "" >> $log_file
+
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB  --with-szlib=$SZIPINC,$SZIPLIB --disable-netcdf --prefix=$install_dir $config_flags >> $log_file 2>&1
+	else
+	
+	    echo ""
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB   --with-szlib=$SZIPINC,$SZIPLIB --disable-netcdf --prefix=$install_dir $config_flags
+	fi
+    else      # Do not configure HDF4 with SZIP
+	EchoAndLog "Running ./configure -v  --with-jpeg=$JPEGINC,$JPEGLIB --with-zlib=$ZLIBINC,$ZLIBLIB  --disable-netcdf --prefix=$install_dir $config_flags"
+	
+	if [ "$log_file" != "" ] ; then
+	    echo "" >> $log_file
+	    
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB --disable-netcdf --prefix=$install_dir $config_flags >> $log_file 2>&1
+	else
+	
+	    echo ""
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB --disable-netcdf --prefix=$install_dir $config_flags
+	fi
+    fi
+else  # Configure HDF4 without --disable-netcdf
+    if [ "$CONFIG_HDF4_WITH_SZIP" = "1" ] ; then    # Configure HDF4 with SZIP
+	EchoAndLog "Running ./configure -v  --with-jpeg=$JPEGINC,$JPEGLIB --with-zlib=$ZLIBINC,$ZLIBLIB --with-szlib=$SZIPINC,$SZIPLIB --prefix=$install_dir $config_flags"
+
+	if [ "$log_file" != "" ] ; then
+	    echo "" >> $log_file
+
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB  --with-szlib=$SZIPINC,$SZIPLIB --prefix=$install_dir $config_flags >> $log_file 2>&1
+	else
+	
+	    echo ""
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB   --with-szlib=$SZIPINC,$SZIPLIB --prefix=$install_dir $config_flags
+	fi
+    else      # Do not configure HDF4 with SZIP
+	EchoAndLog "Running ./configure -v  --with-jpeg=$JPEGINC,$JPEGLIB --with-zlib=$ZLIBINC,$ZLIBLIB  --prefix=$install_dir $config_flags"
+	
+	if [ "$log_file" != "" ] ; then
+	    echo "" >> $log_file
+	    
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB  --prefix=$install_dir $config_flags >> $log_file 2>&1
+	else
+	
+	    echo ""
+	    ./configure -v --with-zlib=$ZLIBINC,$ZLIBLIB --with-jpeg=$JPEGINC,$JPEGLIB --prefix=$install_dir $config_flags
+	fi
+    fi
+fi
+
+HOME=$tmp_home ; export HOME	# restore $HOME
+
+
+#
+# Do architecture-specific post-configure fixes
+#
+
+
+PostConfigure
+
+
+#
+# Run the make utility to compile the library and utiltites
+#
+
+EchoAndLog "Running make, target=all"
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make 
+    tmp_status=$?
+fi
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make ' failed."
+    exit 1
+fi
+
+
+#
+# Run the make utility install the libraries, utilities, includes and man pages 
+#
+
+EchoAndLog "Running make, target=install "
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make install >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make install
+    tmp_status=$?
+fi
+
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make install' failed."
+    exit 1
+fi
+
diff --git a/bin/INSTALL-Scripts/INSTALL-HDF5 b/bin/INSTALL-Scripts/INSTALL-HDF5
new file mode 100755
index 0000000..627103a
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-HDF5
@@ -0,0 +1,1541 @@
+#! /bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-HDF5
+#
+# description:
+# 	HDF5 installation script for the (PGS) Toolkit and hdfeos
+#
+# usage:
+# 	INSTALL-HDF5 [-f90 [-NAG]] [-ABSOFT] [-fc_path <path/compiler_name>] 
+#                    [-cc_path <path/compiler_name>] 
+# 	             [-sgi32 | -sgi64] [-log <log-file> [-append]] 
+# 	             [-clean | -cleano] [-strip] [-w_home <file>]
+# 	             [-df <distribution-file>] [-batch]
+# 	             [-install_dir <base installation directory>]
+#                    [-c_rlib]
+# 	INSTALL-HDF5 [-h] 
+#
+# 	  -f90     : build HDF5 FORTRAN modules using f90 
+# 	             optional flag -NAG specifies NAG f90
+#         -ABSOFT  : flag that specifies absoft f77 is used for fortran compilation
+# 	  -fc_path : set the path of the FORTRAN compiler to <path/compiler_name>
+# 	  -cc_path : set the path of the C compiler to <path/compiler_name>
+# 	  -sgi32   : build in -n32   mode (SGI Power Challenge only)
+# 	  -sgi64   : build in 64-bit mode (SGI Power Challenge only)
+# 	  -dbug    : build in debug mode
+# 	  -log     : sdone session output to new <log-file>
+# 	  -append  : append to existing <log-file>
+# 	  -clean   : run 'make clean' after doing the installation
+# 	  -cleano  : clean up all object and a.out files
+# 	  -strip   : strip out all non-installation files following install
+# 	  -w_home  : write HDF5 home directory to <file>
+# 	  -df      : install HDF5 from distribution file <distribution-file>
+# 	  -batch   : run script in batch (i.e. non-interactive) mode
+#         -install_dir : full path to top level directory where HDF5 will be
+#                        installed (e.g. /usr/local/hdfeso/hdf5/sgi64)
+# 	  -c_rlib  : build C threadsafe Version
+# 	  -h       : display this help message and exit
+#
+# notes:
+# 	1)  The use of the -clean option will cause the HDF5 utilites to 
+# 	    be deleted.  To preserve them, use the -cleano option instead.
+# 
+# 	2)  The -f90 and -NAG options are  * * NOT IMPLEMENTED  * * 
+# 	    Currently, these options are accepted, but ignored.
+# 	    
+#
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        Megan E. Donovan Spencer / SM&AE
+#        Abe Taaheri / SM&AE
+#        Phuong T Nguyen / L3 Communication Analytics Corp.
+# history:
+#       11-May-1995 MES Initial version
+#       08-Dec-2000 AT  Used INSTALL-HDF as template for INSTALL-HDF5 
+#       15-May-2002 PTN Changed version hdf5-1.4.1 to hdf5-1.4.3 
+#       23-Feb-2003 AA  Changed version hdf5-1.4.3 to hdf5-1.4.4
+#       20-Oct-2003 AT  Changed version hdf5-1.4.4 to hdf5-1.6.1
+#       16-Mar-2004 AA  Changed version hdf5-1.6.1 to hdf5-1.6.2
+#       24-Oct-2003 At  Modified PATH for installation of HDF5-1.6.1 to 
+#	                work with "tr"
+#       16-Jan-2005 MP  Changed version hdf5-1.6.2 to hdf5-1.6.3
+#       05-Sep-2005 AT  Changed version hdf5-1.6.3 to hdf5-1.6.5 
+#                       (using post5 patch that had a fix for sgi64)
+#       05-Jun-2007 AT  Changed version hdf5-1.6.5 to hdf5-1.6.6 
+#       09-Jan-2008 AT  Changed version hdf5-1.6.6 to hdf5-1.6.7
+#       09-May-2009 AT  Changed version hdf5-1.6.7 to hdf5-1.8.3
+#       20-Jul-2010 AT  Changed version hdf5-1.8.3 to hdf5-1.8.5-snap4
+#       16-Nov-2011 AT  Changed version hdf5-1.8.5-snap4 to hdf5-1.8.8
+#       27-Jan-2014 AT  Changed version hdf5-1.8.8 to hdf5-1.8.12
+#-----------------------------------------------------------------------------
+
+#
+# Save starting directory, path
+# Create error message header
+#
+
+start_dir=`pwd`
+start_path=$PATH
+this_script="`basename $0`"
+script_error="$this_script: Error:"
+
+#
+# Get absolute pathname where this script is located
+# This allows the script to locate any needed auxilliary files
+#
+
+script_dir="`dirname $0`"
+abs="`echo $script_dir | cut -c1`"
+if [ "$abs" != "/" ] ; then
+    script_dir="`cd $script_dir;pwd`"
+fi
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    echo ""
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+        echo "" >> $log_file
+        echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to set up and export the following architecture-specific variables:
+#
+#         BRAND HOST LOGNAME OSTYPE PATH USER
+#
+
+
+SetArchitecture()
+{
+    # set path to a base subset of directories, allowing startup on unknown host
+    # note: once the architecture has been determined the path is customized
+    
+    PATH=/usr/local/bin:/usr/bin:/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11
+    
+    
+    # get operating system type, login name
+    # special cases: SCO and Cray  - uname works differently,
+    
+    machine=`uname -m | awk '{print $1}'`	# needed on Cray & SCO
+    temp_ostype=`uname`
+
+    case "$machine" in
+    
+      i386 )        			# SCO box
+    	OSTYPE=sco386
+        ;;
+    
+      CRAY )    				# CRAY
+    	OSTYPE=UNICOS
+        ;;
+    
+      * )					# everybody else
+    	OSTYPE=`uname`
+        ;;
+    
+    esac
+    
+# Intel Macintosh is also i386 or i686 (?) machine
+
+    if [ "$machine" = "i386" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	fi
+	if [ "`uname | awk -F_ '{print $1}'`" = "CYGWIN" ] ; then 
+	    OSTYPE=Cygwin
+	fi
+    fi
+    if [ "$machine" = "i686" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	fi
+	if [ "`uname | awk -F_ '{print $1}'`" = "CYGWIN" ] ; then 
+	    OSTYPE=Cygwin
+	fi
+    fi
+   if [ "$machine" = "x86_64" ] || [ "$machine" = "ia64" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	    if [ "$MAC_BRAND" = "" ] ; then 
+		echo " Error: In 64-bit MAC platform the env. variable MAC_BRAND must be set to mac32 or mac64 before running this script."
+		exit 1
+	    fi
+	else
+	    if [ "$LINUX_BRAND" = "" ] ; then 
+		echo " Error: In 64-bit linux platform the env. variable LINUX_BRAND must be et to linux32 or linux64 before running this script."
+		exit 1
+	    fi
+	fi
+    fi
+
+    user=`id | cut -d\( -f2 | cut -d\) -f1`
+    if [ "$LOGNAME" = "" ] ; then 		# make sure $LOGNAME is defined
+        LOGNAME=$user	
+    fi
+    USER=$LOGNAME				# make sure $USER is defined
+    
+    
+    # set machine-depdoneent environment variables:
+    # 	HOST  the host name of this machine
+    # 	BRAND used by other achitecture-specific code
+    # 	path  the execution search path exported to PATH
+    
+    case "$OSTYPE" in
+    
+      AIX ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/ccs/bin:/usr/sbin
+    	HOST=`hostname`
+    	BRAND=ibm
+        CC=cc
+        CFLAGS="-O"
+        F77=xlf
+        ;;
+    
+      HP-UX ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bin/X11:/tools/bin
+    	HOST=`hostname`
+    	BRAND=hp 
+        CC=cc
+        CFLAGS="-O"
+        F77=fort77
+        ;;
+    
+      IRIX )  
+    	PATH=/usr/local/bin:/usr/bin:/bin:/etc:/usr/etc:/usr/bsd:/usr/bin/X11:/usr/sbin
+    	HOST=`hostname`
+    	BRAND=sgi 
+        CC=cc
+        CFLAGS="-O"
+        F77=f77
+        ;;
+    
+      IRIX64 )  
+        PATH=/usr/local/bin:/usr/bin:/bin:/etc:/usr/etc:/usr/bsd:/usr/bin/X11:/usr/sbin
+        HOST=`hostname`
+        case "$sgi_mode" in
+          32  )  BRAND=sgi   ; CC="cc -32 -mips2"  ; F77="f77 -32 -mips2"  ;;
+          n32 )  BRAND=sgi32 ; CC="cc -n32 -mips3" ; F77="f77 -n32 -mips3"  ;;
+          64  )  BRAND=sgi64 ; CC="cc -64 -mips4"  ; F77="f77 -64 -mips4"  ;;
+          *   )  BRAND=sgi   ; CC="cc"  ; F77="f77"  ;;
+        esac
+        CFLAGS="-O"
+        set_compilers=0		# override HDF5 default compilers
+        ;;
+    
+      Linux )
+	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/X11/bin
+	HOST=`hostname -s`
+	BRAND=linux
+	if [ "$LINUX_BRAND" = "linux64" ] ; then
+	    BRAND=linux64
+	elif [ "$LINUX_BRAND" = "linux32" ] ; then
+	    BRAND=linux32
+	fi
+        CC="gcc $LNX_COMP_FLAG" 
+        CFLAGS="-O"
+        F77="g77 $LNX_COMP_FLAG" 
+	;;
+
+      Darwin )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname -s`
+        BRAND=macintosh
+        CC=gcc
+        CFLAGS="-O"
+        F77=g77
+        ;;
+
+      DarwinIntel )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname -s`
+        BRAND=macintel32
+	if [ "$MAC_BRAND" = "macintel64" ] ; then
+	    BRAND=macintel64
+	elif [ "$MAC_BRAND" = "macintel32" ] ; then
+	    BRAND=macintel32
+	fi
+        CC="gcc $MACINTEL_COMP_FLAG"
+        CFLAGS="-O2"
+        F77="gfortran $MACINTEL_COMP_FLAG"
+        ;;
+
+      Cygwin )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname`
+        BRAND=cygwin
+        CC=gcc
+        CFLAGS="-O"
+        F77=g77
+        ;;
+
+      OSF1 )  
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/ccs/bin:/usr/sbin
+    	HOST=`hostname -s`
+    	BRAND=dec 
+        CC=cc
+        CFLAGS="-O -std"
+        F77=f77
+        ;;
+    
+      sco386 ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bin/X11
+    	HOST=`hostname -s`
+    	BRAND=sco 
+        CC=cc
+        CFLAGS="-O"
+        F77=f77
+        ;;
+    
+      SunOS ) 
+    	# distinguish between SunOS 5.x and 4.x versions
+	if [ `uname -r | awk -F. '{print $1}'` = "5" ] ; then
+	    BRAND=sun5			# release V5.x SunOS
+	    PATH=/opt/SUNWspro/bin:/opt/SUNWspro/lib:/usr/ccs/bin:/usr/ucb:/usr/local/bin:/opt/SUNWspro/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+	    CC=cc
+	    CFLAGS="-O"
+	    F77=f77
+
+	    if [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 10" ] ; then 
+		BRAND="sun5.10"			# release V5.x SunOS
+		PATH=/opt/SUNWspro/bin:/opt/SUNWspro/lib:/usr/ccs/bin:/usr/ucb:/usr/lib:/usr/include:/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+	    elif [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 9" ] ; then 
+		BRAND="sun5.9"			# release V5.x SunOS
+		PATH=/opt/SUNWspro/bin:/opt/SUNWspro/lib:/usr/ccs/bin:/usr/ucb:/usr/lib:/usr/include:/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+	    elif [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 8" ] ; then 
+		BRAND="sun5.8"			# release V5.x SunOS
+		PATH=/opt/SUNWspro/bin:/opt/SUNWspro/lib:/usr/ccs/bin:/usr/ucb:/usr/lib:/usr/include:/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+	    fi
+	else                                
+	    BRAND=sun4			# release V4.x SunOS
+	    PATH=/usr/openwin/bin:/usr/openwin/demo:/usr/ucb:/usr/local/bin:/usr/local/lang:/usr/lang:/bin:/usr/bin:/etc:/usr/etc
+	    CC=acc
+	    CFLAGS="-O"
+	    F77=f77
+	    set_compilers=1		# override HDF5 default compilers
+	fi
+    	HOST=`hostname`
+        ;;
+    
+      UNICOS ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/ucb:/usr/bin/X11
+    	HOST=`hostname`
+    	BRAND=cray 
+        CC=cc
+        CFLAGS="-O"
+        F77=cf77
+        ;;
+    
+      * )
+    	echo "Operating system: $OSTYPE not supported" 	>&2
+    	echo "This release of the Toolkit and hdfeos supports: " 	>&2
+    	echo "   Sun, SGI HP-9000 IBM-6000 DEC-Alpha  Linux Macintosh and Cray/Unicos " 	>&2
+        exit 1
+        ;;
+    
+    esac
+
+
+    # if debug version was requested replace -O with -g in CFLAGS
+
+    if [ "$dbug" = "1" ] ; then
+	CFLAGS=`echo $CFLAGS | sed 's/-O/-g/'`
+    fi
+
+    CFLAGS="$CFLAGS $EXT_CC_FLAGS"
+
+    # export the architecture-specific variables
+
+    export BRAND HOST LOGNAME OSTYPE PATH USER
+    export CC CFLAGS F77
+    
+}
+
+
+#
+# Function to allow user to override the defaults for the compilers
+# The following variables are affected:
+#
+#         PATH CC F77
+#
+
+UserCompilers()
+{
+    #
+    # check to see if valid C compiler path was specified
+    #
+    
+    cc=""
+    
+    if [ "$cc_path" != ""  ] ; then
+    
+        if [ -f $cc_path ] ; then
+    
+            cc=`basename $cc_path`
+            cc_path=`echo $cc_path | sed 's%/[^/]*/*$%%'`
+	    case "$BRAND" in
+		"sgi32" )
+		    CC="$cc_path/$cc -n32"
+		;;
+
+		"sgi64" )
+		    cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+		    if [ "$cpu_type" == "4" ] ; then
+			CC="$cc_path/$cc -64 -mips3"
+		    else
+			CC="$cc_path/$cc -64 -mips4"
+		    fi
+		;;
+
+		"linux" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"linux32" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"linux64" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"macintel" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel32" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;; 
+
+		"macintel64" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;; 
+
+		* )
+		    CC="$cc_path/$cc" 
+		;; 
+	    esac
+
+	    export CC		# user overrides C compiler name
+	    set_compilers=1		# override HDF default compilers
+    
+	fi
+    
+        if [ -d $cc_path ] ; then	# make sure cc_path is now a directory
+    
+            PATH=${cc_path}:${PATH} 	# prepend cc_path to search path
+            export PATH
+    
+        else
+    
+            cc_path=""
+            echo "Warning: C compiler directory $cc_path not found."
+            echo  "HDF5 build may fail."
+    
+        fi
+    
+    fi
+    
+    
+    #
+    # check to see if valid FORTRAN compiler path was specified
+    #
+    
+    fc=""
+    
+    if [ "$fc_path" != "" ] ; then
+    
+        if [ -f $fc_path ] ; then
+    
+            fc=`basename $fc_path`
+            fc_path=`echo $fc_path | sed 's%/[^/]*$%%'`
+	    case "$BRAND" in
+		"sgi32" )
+		    F77="$fc_path/$fc -n32"
+		;;
+
+		"sgi64" )
+		    cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+		    if [ "$cpu_type" == "4" ] ; then
+			F77="$fc_path/$fc -64 -mips3"
+		    else
+			F77="$fc_path/$fc -64 -mips4"
+		    fi
+		;;
+
+		"linux" )
+		    if [ "$fc" == "pgf90" ] || [ "$fc" == "pgf77" ] ; then
+			F77="$fc_path/$fc"
+		    else
+			F77="$fc_path/$fc $LNX_COMP_FLAG"
+		    fi
+		;; 
+
+		"linux32" )
+		    if [ "$fc" == "pgf90" ] || [ "$fc" == "pgf77" ] ; then
+			F77="$fc_path/$fc"
+		    else
+			F77="$fc_path/$fc $LNX_COMP_FLAG"
+		    fi
+		;; 
+
+		"linux64" )
+		    if [ "$fc" == "pgf90" ] || [ "$fc" == "pgf77" ] ; then
+			F77="$fc_path/$fc"
+		    else
+			F77="$fc_path/$fc $LNX_COMP_FLAG"
+		    fi
+		;; 
+
+		"macintel" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel32" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel64" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		* )
+		    F77="$fc_path/$fc" 
+		;; 
+	    esac
+
+    #        if [ "$fc" != f90 ] ; then	# (f90 not supported for HDF4.1r1)
+    # f90 is supported starting with the HDF4.1r2 release
+                export F77	# user overrides FORTRAN compiler name
+                set_compilers=1		# override HDF5 default compilers
+    #        fi
+    
+        fi
+    
+        if [ -d $fc_path ] ; then	# make sure fc_path is now a directory
+    
+            PATH=${fc_path}:${PATH} 	# prepend fc_path to search path
+            export PATH
+    
+        else
+    
+            fc_path=""
+            echo "Warning: FORTRAN directory $fc_path not found."
+            echo  "HDF5 build may fail."
+    
+        fi
+    
+    fi
+    
+}
+
+
+
+#
+# Function to get the location of the distribution file
+#
+    
+GetDistribution()
+{    
+    : ${distrib_file:=hdf5-1.8.12.tar.gz}
+
+    ds1=$distrib_file			# backup copy
+    
+    # derive tar file name
+
+    case "$distrib_file" in
+
+      hdf5-1.6.3.tar.Z  )
+        tar_file=hdf5-1.6.3.tar
+        hdf_home=hdf5-1.6.3
+        ;;
+
+      hdf5-1.6.5.tar.gz  )
+        tar_file=hdf5-1.6.5.tar
+        hdf_home=hdf5-1.6.5
+        ;;
+
+      hdf5-1.6.5-post5.tar.gz  )
+        tar_file=hdf5-1.6.5-post5.tar
+        hdf_home=hdf5-1.6.5-post5
+        ;;
+
+      hdf5-1.6.6.tar.gz  )
+        tar_file=hdf5-1.6.6.tar
+        hdf_home=hdf5-1.6.6
+        ;;
+
+      hdf5-1.6.7.tar.gz  )
+        tar_file=hdf5-1.6.7.tar
+        hdf_home=hdf5-1.6.7
+        ;;
+
+      hdf5-1.8.3.tar.gz  )
+        tar_file=hdf5-1.8.3.tar
+        hdf_home=hdf5-1.8.3
+        ;;
+
+      hdf5-1.8.5-snap4.tar.gz  )
+        tar_file=hdf5-1.8.5-snap4.tar
+        hdf_home=hdf5-1.8.5-snap4
+        ;;
+
+      hdf5-1.8.8.tar.gz  )
+        tar_file=hdf5-1.8.8.tar
+        hdf_home=hdf5-1.8.8
+        ;;
+
+      hdf5-1.8.12.tar.gz  )
+        tar_file=hdf5-1.8.12.tar
+        hdf_home=hdf5-1.8.12
+        ;;
+
+      * )
+        EchoAndLog "HDF5 version in $distrib_file not supported by this script."
+        exit 1
+        ;;
+
+    esac
+
+    
+    # set search path to include current dir, parent of current and $HOME    
+    search_path=`pwd`
+    search_path="$search_path `cd ..; pwd` $HOME"
+
+    # set search file to include compressed tar file and uncompressed tar file
+    search_file="$distrib_file $tar_file"
+
+    # search for the distribution file
+
+    found_file=0
+    for distrib_path in $search_path ; do
+
+        for distrib_file in $search_file ; do
+
+            if [ -f ${distrib_path}/${distrib_file} ] ; then
+                found_file=1
+                break
+            fi
+
+        done
+
+        if [ $found_file = 1 ] ; then
+            break
+        fi
+
+    done
+
+    # if file was not found, ask the user
+
+    if [ $found_file = 0 ] ; then
+
+	if [ $batch_mode = 0 ] ; then
+	    echo ""	
+	    UserPrompt "Pathname where $ds1 is located: "
+	    echo ""
+  	else
+	    user_response=""
+	fi
+    
+        if [ "$user_response" != "" ] ; then
+
+            # make sure directory exists
+
+            if [ -d $user_response ] ; then
+                distrib_path=$user_response
+            else 
+                WriteError "Invalid directory: $user_response"
+                exit 1
+            fi
+    
+            # search for the distribution file in user directory
+
+            for distrib_file in $search_file ; do
+
+                if [ -f ${distrib_path}/${distrib_file} ] ; then
+                    found_file=1
+                    break
+                fi
+
+            done
+
+        fi
+
+
+    fi
+
+
+    if [ $found_file = 0 ] ; then
+        WriteError "Can't find ${ds1} in (${search_path})"
+        echo "HDF5 installation cancelled."
+        exit 1
+    fi
+
+}
+
+
+# 
+# Function to get the location of the HDF5 home directory for installation
+# Also, prompt user that all information is valid before proceeding
+#
+
+GetInstallDir()
+{
+    default_HDF5_path="`pwd`/hdf5/$BRAND"
+
+    if [ "$HDF5_path" = "" ] ; then
+	HDF5_path="`pwd`/hdf5/$BRAND"
+    fi
+
+    # ask the user
+
+    if [ $batch_mode = 0 ] ; then
+	UserPrompt "Pathname where directory '$hdf_home' will be created [$HDF5_path]: " 
+	echo ""
+    else
+	user_response=""
+    fi
+    
+    if [ "$user_response" = "" ] ; then
+        if [  ! -d `dirname $HDF5_path`  ] ; then mkdir `dirname $HDF5_path` ; fi
+        if [  ! -d $HDF5_path  ] ; then  mkdir $HDF5_path ; fi
+    else
+#        if [ -d "$user_response" ] ; then 
+	 HDF5_path=$user_response ; #fi
+    fi
+    
+    if [ ! -d $HDF5_path ] ; then
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "$HDF5_path does not exist.  Create [y]? "
+	else
+	    user_response=y
+	fi
+	if [ "$user_response" = "" ] ; then user_response="y" ; fi
+	case "$user_response" in
+	    y* | Y* )
+		mkdir -p $HDF5_path
+		if [ ! -d $HDF5_path ] ; then
+		    WriteError "Unable to create directory $HDF5_path." 
+		    echo "HDF5 installation cancelled." 2>&1
+		    exit 1
+		
+		fi
+		;;
+	    *)
+		WriteError "Directory $HDF5_path does not exist." 
+		echo "HDF5 installation cancelled." 2>&1
+		exit 1
+		;;
+        esac
+    fi
+        
+    
+    #
+    # confirm before proceeding
+    #
+    
+    echo "The HDF5 directory will be restored from: " 
+    echo "    ${distrib_path}/${distrib_file}" 
+    echo "" 
+    echo "The HDF5 directory will be created in: " 
+    echo "     ${HDF5_path}" 
+    echo "" 
+
+    if [ $batch_mode = 0 ] ; then
+	UserPrompt "Continue [yes] ? " 
+	case "$user_response" in
+	    n* | N* ) echo "Cancelled." ; exit 1 ;;
+	    * ) echo "Confirmed." ; echo "" ;;
+	esac
+    fi
+
+#
+# For linux create soft links if default HDF5 installation directory is used
+#
+    save_dir="`pwd`"
+    if [ "`pwd`/hdf5/$BRAND" = "$default_HDF5_path" ] ;then
+	if [ "$BRAND" = "linux64" ] ; then
+	    cd ${default_HDF5_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "64-bit structure is the default in this machine. Creating $current_path/linux as a soft link to $default_HDF5_path"
+	    ln -s ./linux64 linux
+ 	    cd $save_dir
+	fi
+
+	if [ "$BRAND" = "linux" ] ; then
+	    cd ${default_HDF5_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "32-bit structure is the default in this machine. Creating $current_path/linux32 as a soft link to $default_HDF5_path"
+	    ln -s ./linux linux32
+ 	    cd $save_dir
+	fi
+    fi
+
+
+#
+# For macintel create soft links if default HDF5 installation directory is used
+#
+    save_dir="`pwd`"
+    if [ "`pwd`/hdf5/$BRAND" = "$default_HDF5_path" ] ;then
+	if [ "$BRAND" = "macintel32" ] ; then
+	    cd ${default_HDF5_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "macintel32 directories will be soft linked to macintel. Creating $current_path/macintel as a soft link to $default_HDF5_path"
+	    ln -s ./macintel32 macintel
+ 	    cd $save_dir
+	fi
+
+	if [ "$BRAND" = "macintel" ] ; then
+	    cd ${default_HDF5_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "macintel32 directories will be soft linked to macintel. Creating $current_path/macintel32 as a soft link to $default_HDF5_path"
+	    ln -s ./macintel macintel32
+ 	    cd $save_dir
+	fi
+    fi
+}
+
+
+#
+# Function to unpack the distribution file into the installation directory
+#
+
+UnpackDistribution()
+{
+    #
+    # Go to the HDF5 parent directory
+    #
+    
+    cd $HDF5_path
+
+    #
+    # If the new HDF5 home directory already exits, it must
+    # be removed first.  Check with the user before proceeding.
+    #
+    
+    if [ -d "$hdf_home" ] ; then
+    
+        EchoAndLog "The directory $hdf_home already exists."
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "Replace it [no] ? "
+	else
+	    user_response=y
+	fi
+
+        case "$user_response" in
+          y* | Y* )
+            EchoAndLog "Removing old $hdf_home directory ..."
+            /bin/rm -rf $hdf_home
+            ;;
+    
+          * )
+            EchoAndLog "Cancelled."
+            exit 1
+            ;;
+        esac
+    
+    fi
+    
+    
+    #
+    # Create a link to the distribution file, if necessary.
+    #
+
+    link_flag=0
+    if [ ! -f $distrib_file ] ; then
+        if [ -f ${distrib_path}/${distrib_file} ] ; then
+            ln -s ${distrib_path}/${distrib_file} ${distrib_file}
+            link_flag=1
+        fi
+    fi
+    
+    # 
+    # Uncompress the distribution file, (if needed), and extract the files
+    # 
+    
+    EchoAndLog "Extracting files from $distrib_file ..."
+
+    suffix="`echo $distrib_file |  sed 's/^.*\.//'`"
+    case $suffix in
+    
+      Z  )
+        zcat $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+
+      gz )
+	gzip -cd $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+#        GnuZcat
+#        if [ $gnu_zcat != 1 ] ; then
+#            WriteError "You need the GNU version of zcat to unpack this file."
+#            exit 1
+#        fi
+#        zcat $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+
+      tar)
+        echo $distrib_file
+        tar -xvf $distrib_file | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+    
+    esac
+
+    #
+    # Clean up symbolic link, if present
+    #
+
+    if [ $link_flag = 1 ] ; then
+        /bin/rm -f $distrib_file
+    fi
+
+
+}
+
+
+#
+# See if zcat is GNU version
+#
+
+GnuZcat()
+{
+    if [ "$1" = "" ] ; then
+        zcat_cmd=zcat
+    else
+        zcat_cmd=$1
+    fi
+    
+    buf=`exec 2>&1; $zcat_cmd < /dev/null | tail -1` 
+    buf=`echo $buf | awk -F: '{print $1}'`
+    
+    case "$buf" in
+      zcat) gnu_zcat=1 ;;
+      *   ) gnu_zcat=0 ;;
+    esac
+}
+
+
+#
+# Strip all HDF5 distribution files not needed after installation.
+#
+
+StripHdfInstall()
+{
+    cd $HDF5HOME
+
+    here=`pwd`
+    here=`basename $here`
+
+    #
+    # Make sure this is a valid HDF5 directory befor clobbering files !
+    # 
+
+    if [ "`echo $here | grep '^HDF5'`" = "" ] ; then
+    
+        EchoAndLog "Not a valid HDF5 directory: no files removed."
+        
+    else
+
+        EchoAndLog "Removing all non-installation HDF5 files ..."
+
+        for file in * ; do
+
+            if [ -d "$file" ] ; then
+    
+                case "$file" in 
+        
+                  bin | lib | include | man ) ;;
+                  * ) rm -rf $file ;;
+              
+                esac
+        
+            else
+    
+                rm -f $file
+        
+            fi
+    
+        done
+        
+    fi
+}
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+
+
+#
+# Get arguments from command line
+#
+
+log_file=""
+home_file=""
+noquery=0
+clean=0
+cleano=0
+strip_install=0
+append=0
+no_untar=0
+sgi_mode=32
+f90_flag=0
+nag_flag=0
+absoft_flag=0
+fc_path=""
+cc_path=""
+distrib_file=""
+set_compilers=0
+dbug=0
+HDF5_path=""
+batch_mode=0
+c_rlib=0
+
+while [ "$1" != "" ] ; do 
+
+    case "$1" in
+
+      -h )
+        Help
+        ;;
+
+      -f90 )
+        f90_flag=1
+        ;;
+
+      -NAG )
+        if [  $f90_flag = 0  ] ; then
+            WriteError "Must first specify -f90 and set compiler path."
+            Help
+        else
+            nag_flag=1
+        fi
+        ;;
+
+      -ABSOFT )
+	    absoft_flag=1
+	;;
+
+      -fc_path )
+        fc_path="$2"
+        shift
+        ;;
+
+      -cc_path )
+        cc_path="$2"
+        shift
+        ;;
+
+      -df)
+        distrib_file="$2"
+        shift
+        ;;
+
+      -sgi32 )
+        sgi_mode=n32
+        ;;
+
+      -sgi64 )
+        sgi_mode=64
+        ;;
+
+      -log )
+        if [ "$2" != "" ] ; then
+            if [ "` echo $2 | cut -c1`" = "/" ] ; then
+                log_file="$2"
+            else
+                log_file="$start_dir/$2"
+            fi
+            shift
+        else
+            WriteError "A log file must be specified with the -log option."
+            Help
+        fi
+        ;;
+
+      -append )
+        append=1
+        ;;
+
+      -w_home )
+        if [ "$2" != "" ] ; then
+            if [ "` echo $2 | cut -c1`" = "/" ] ; then
+                home_file="$2"
+            else
+                home_file="$start_dir/$2"
+            fi
+            shift
+        else
+            WriteError "No file specified with -w_home switch."
+            Help
+        fi
+        ;;
+
+      -nq | -noquery )
+        noquery=1
+        ;;
+
+      -clean )
+        clean=1
+        ;;
+
+      -cleano )
+        cleano=1
+        ;;
+
+      -strip )
+        strip_install=1
+        ;;
+
+      -no_untar )
+        no_untar=1
+        ;;
+
+      -dbug )
+        dbug=1
+        ;;
+
+      -install_dir )
+        if [ "$2" != "" ] ; then
+	    HDF5_path=$2
+            shift
+        else
+            WriteError "No installation directory specified with -install_dir switch."
+            Help
+        fi
+        ;;
+
+	-batch )
+	    batch_mode=1
+	;;
+
+	-c_rlib )
+	    c_rlib=1
+	    ;;
+
+      * )
+        echo "$script_error invalid argument '$1'"
+        Help
+        ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Inititialize log file
+#
+
+if [ "$log_file" != "" ] ; then
+
+    if [ "$append" = "0" ] ; then
+        if [ -f "$log_file" ] ; then 
+            /bin/rm  -f $log_file > /dev/null 2>&1
+        fi
+    fi
+
+    touch $log_file > /dev/null 2>&1
+    if [ $? != 0 ] ; then
+        WriteError "Cannot write to file $log_file"
+        exit 1
+    fi
+
+    echo ""
+    echo "`basename $0`: session output will go to file: "
+    echo ""
+    echo "     $log_file"
+    echo ""
+
+fi
+
+export log_file
+
+#
+# Initialize the home file
+#
+
+if [ "$home_file" != "" ] ; then
+
+    if [ -f "$home_file" ] ; then 
+        /bin/rm -f $home_file > /dev/null 2>&1
+    fi
+
+    touch $home_file > /dev/null 2>&1
+    if [ $? != 0 ] ; then
+        WriteError "Cannot write to file $home_file"
+        exit 1
+    fi
+
+fi
+
+
+#
+# Set architecture-specific variables
+#
+
+SetArchitecture
+
+
+#
+# Set user compiler overrides
+#
+
+UserCompilers
+
+
+#
+# Get the location of the distribution file
+#
+
+GetDistribution
+
+
+#
+# Got valid distribution file
+# Get the location of the HDF5 home directory for installation
+#
+
+GetInstallDir
+
+
+#
+# Write the log file header
+#
+
+if [ "$log_file" != "" ] ; then
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "HDF5 installation starting at: `date`" >> $log_file
+    echo "host: $HOST    type: $BRAND     user: $USER " >> $log_file
+    echo "" >> $log_file
+    echo "" >> $log_file
+    echo "The HDF5 directory will be restored from: " >> $log_file
+    echo "    ${distrib_path}/${distrib_file}" >> $log_file
+    echo "" >> $log_file
+    echo "The HDF5 directory will be created in: " >> $log_file
+    echo "     ${HDF5_path}" >> $log_file
+    echo "" >> $log_file
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "" >> $log_file
+fi
+
+
+#
+# Unpack the distribution file into the installation directory
+#
+
+    cd $HDF5_path
+
+    if [ "$no_untar" = 0 ] ; then
+        UnpackDistribution
+    fi
+
+
+#
+# Prepare to install the requested version of HDF5
+#
+
+if [ ! -d $hdf_home ] ; then
+    EchoAndLog "Error creating directory: $hdf_home"
+    exit 1
+fi
+
+cd $hdf_home				# go to the starting directory
+
+hdf_install_caller="$this_script"	# set caller flag for sub-modules
+export hdf_install_caller
+
+
+#
+# Set the version to be installed
+#
+
+install_script=""
+install_options=""
+
+case $hdf_home in
+
+  hdf5-1.6.5 )
+
+    HDF5HOME=${HDF5_path}/hdf5-1.6.5 ; export HDF5HOME
+    install_script="$script_dir/INSTALL-HDF5-1.6.5"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDF5HOME}"
+    ;;
+
+  hdf5-1.6.5-post5 )
+
+    HDF5HOME=${HDF5_path}/hdf5-1.6.5-post5 ; export HDF5HOME
+    install_script="$script_dir/INSTALL-HDF5-1.6.5"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDF5HOME}"
+    ;;
+
+  hdf5-1.6.6 )
+
+    HDF5HOME=${HDF5_path}/hdf5-1.6.6 ; export HDF5HOME
+    install_script="$script_dir/INSTALL-HDF5-1.6.6"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDF5HOME}"
+    ;;
+
+  hdf5-1.6.7 )
+
+    HDF5HOME=${HDF5_path}/hdf5-1.6.7 ; export HDF5HOME
+    install_script="$script_dir/INSTALL-HDF5-1.6.7"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDF5HOME}"
+    ;;
+
+  hdf5-1.8.3 )
+
+    HDF5HOME=${HDF5_path}/hdf5-1.8.3 ; export HDF5HOME
+    install_script="$script_dir/INSTALL-HDF5-1.8.3"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${HDF5HOME}"
+    ;;
+
+  hdf5-1.8.5-snap4 )
+
+    HDF5HOME=${HDF5_path}/hdf5-1.8.5-snap4 ; export HDF5HOME
+    install_script="$script_dir/INSTALL-HDF5-1.8.5"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    if [ $c_rlib = 1 ] ; then
+        install_options="$install_options -c_rlib"
+    fi
+
+    install_options="$install_options -start_dir ${HDF5HOME}"
+    ;;
+
+  hdf5-1.8.8 )
+
+    HDF5HOME=${HDF5_path}/hdf5-1.8.8 ; export HDF5HOME
+    install_script="$script_dir/INSTALL-HDF5-1.8.8"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    if [ $c_rlib = 1 ] ; then
+        install_options="$install_options -c_rlib"
+    fi
+
+    install_options="$install_options -start_dir ${HDF5HOME}"
+    ;;
+
+  hdf5-1.8.12 )
+
+    HDF5HOME=${HDF5_path}/hdf5-1.8.12 ; export HDF5HOME
+    install_script="$script_dir/INSTALL-HDF5-1.8.12"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    if [ $c_rlib = 1 ] ; then
+        install_options="$install_options -c_rlib"
+    fi
+
+    install_options="$install_options -start_dir ${HDF5HOME}"
+    ;;
+
+  * )  			# unsupported
+    EchoAndLog "$hdf_home installation is not supported by this script."
+    exit 1
+    ;;
+
+esac
+
+
+#
+# Run the install script
+#
+
+if [ ! -f $install_script ] ; then
+    EchoAndLog "Can't find $install_script - installation failed."
+    exit 1
+fi
+
+$install_script $install_options
+
+if [ $? != 0 ] ; then
+    EchoAndLog "$hdf_home Installation failed."
+    exit 1
+fi
+
+
+# 
+# Pass back the HDF5 install directory for the hdfeos installation
+# 
+
+if [ "$home_file" != "" ] ; then
+    echo $HDF5HOME >> $home_file
+fi
+
+
+
+#
+# Clean up
+#
+
+cd $HDF5_path
+
+if [ "$clean" = 1 ] ; then
+
+    for dir in $HDF5HOME ; do 
+
+        cd $dir
+        echo "Cleaning up in $dir ..."
+
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+            echo "Cleaning up in $dir ..." >> $log_file
+            echo "" >> $log_file
+            make clean  >> $log_file 2>&1
+        else
+            make clean
+        fi
+
+    done
+
+fi
+
+if [ "$cleano" = 1 ] ; then
+
+    cd $HDF5HOME
+    echo "Removing any remaining object files ..." 
+
+    if [ "$log_file" != "" ] ; then
+        echo "" >> $log_file
+        echo "Removing any remaining object files ..." >> $log_file
+        echo "" >> $log_file
+        find . -name \*.o -print -exec rm -f {} \; >> $log_file 2>&1
+        find . -name a.out -print -exec rm -f {} \; >> $log_file 2>&1
+    else
+        find . -name \*.o -print -exec rm -f {} \; 
+        find . -name a.out -print -exec rm -f {} \; 
+    fi
+    
+fi
+
+
+if [ "$strip_install" = 1 ] ; then
+
+    StripHdfInstall
+   
+fi
+
+
+echo "------------------------------------------------------------"
+echo ""
+echo "    HDF5 installation ending at: `date` " 
+echo ""
+echo "------------------------------------------------------------"
+
+
+
+#
+# Write the log file trailer
+#
+
+if [ "$log_file" != "" ] ; then
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "    HDF5 installation ending at: `date`" >> $log_file
+    echo "" >> $log_file
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+fi
+
diff --git a/bin/INSTALL-Scripts/INSTALL-HDF5-1.8.12 b/bin/INSTALL-Scripts/INSTALL-HDF5-1.8.12
new file mode 100755
index 0000000..ceae5b2
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-HDF5-1.8.12
@@ -0,0 +1,1172 @@
+#! /bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-HDF5-1.8.12
+#
+# description:
+# 	Installation script module for installing HDF5-1.8.12
+# 	for the SDP (PGS) Toolkit and hdfeos.  
+#       It implements patches to the NCSA 
+# 	installation procedure to allow for trouble-free installation on
+# 	the platforms supported by the SDP (PGS) Toolkit and hdfeos.
+#
+# usage:
+# 	Called from INSTALL-HDF5
+#
+# 	INSTALL-HDF5-1.8.12 [-dbug]
+# 	INSTALL-HDF5-1.8.12 -h[elp]
+# 	INSTALL-HDF5-1.8.12 [-c_rlib]
+#
+# 	  -h      : display this help message and exit
+# 	  -dbug   : install debug version of HDF5
+# 	  -c_rlib : install thread safe HDF5 library
+#
+# notes:
+# 	This is NOT a standalone script.  It is only intended to be run
+# 	by INSTALL-HDF5, the HDF installation script.
+# 
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        Abe Taaheri / Emergent Information Technologies, Inc.
+#        Adura Adekunjo /L3 Communications EER Inc.
+#
+# history:
+#       23-Apr-1996 MES Initial version (file: INSTALL-HDF4.0r1)
+# 	26-Apr-1996 MES Updated PreConfigure compiler logic.
+# 	02-Jul-1996 MES Updated to handle SunOS 5.5
+# 	19-Aug-1996 MES Updated for HDF4.0r2 (file: INSTALL-HDF4.0r2)
+# 	23-Sep-1996 MES Added patch to hdfi.h on dec to avoid potential
+# 			conflict with <rpc/types.h>.
+#       19-Aug-1996 MES Updated for HDF4.1r3 (file: INSTALL-HDF4.1r3)
+#       05-Oct-2000 AT  for machine HP-11 the xdr library libnsl.a needs to be
+#                       loaded as for the SOLARIS. Added code to edit mh-hpux
+#                       file in config directory to include the load flag -lnsl
+#       19-Mar-2001 AT  Added for HDF5 Installation
+#	13-Aug-2001 AA  Modified for solaris8
+#       20-Oct-2003 AT  Update hdf5-1.4.4 to hdf5-1.6.1
+#       16-Mar-2004 AA  Updated hdf5-1.6.1 to hdf5-1.6.2
+#       24-Jan-2005 MP  Updated hdf5-1.6.2 to hdf5-1.6.3 
+#       05-Sep-2005 AT  Updated hdf5-1.6.3 to hdf5-1.6.5
+#       05-Jul-2007 AT  Updated hdf5-1.6.5 to hdf5-1.6.6
+#       09-Jan-2008 AT  Updated hdf5-1.6.6 to hdf5-1.6.7
+#       09-MAy-2009 AT  Updated hdf5-1.6.7 to hdf5-1.8.3
+#       20-Jul-2010 AT  Updated hdf5-1.8.3 to hdf5-1.8.5-snap4
+#       20-Jul-2010 AT  Updated hdf5-1.8.5-snap4 to hdf5-1.8.8
+#       27-Jan-2014 AT  UpdatedUpdated hdf5-1.8.8 to hdf5-1.8.12
+#
+#-----------------------------------------------------------------------------
+
+
+#
+# Save starting directory, path
+# Create error message header
+#
+
+start_dir=`pwd`
+start_path=$PATH
+this_script="`basename $0`"
+script_error="$this_script: Error:"
+
+#
+# Get absolute pathname where this script is located
+# This allows the script to locate any needed auxilliary files
+#
+
+script_dir="`dirname $0`"
+abs="`echo $script_dir | cut -c1`"
+if [ "$abs" != "/" ] ; then
+    script_dir=`cd $script_dir;pwd`
+fi
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    if [ "$1" = "-n" ] ; then		# -n: suppress leading blank line
+        shift
+    else
+        echo ""
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+        fi
+    fi
+    
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+         echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function to prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to silently emulate the 'which' command 
+#
+
+Which()
+{
+    if [ "$1" = "" ] ; then 
+        WriteError "Which() : Too few arguments." 
+        exit 1 
+    fi
+
+    saveifs="$IFS"
+    IFS=:
+    which_result=0
+    which_cmd=""
+    
+    for dir in $PATH;  do 
+        if [ -x $dir/$1 ] ; then 
+            which_result=1 
+            which_cmd=$dir/$1
+            break 
+        fi 
+    done
+    
+    IFS="$saveifs"
+}
+
+#
+# Function to implement debug version of hdf libraries
+#
+
+PreConfigFixes_dbug()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure for debug ... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that get
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    case $BRAND in
+
+        cray  ) 
+		file=mh-unicos;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        dec   ) 
+		file=mh-alpha;
+		c_opt='-Olimit 2048'; c_dbug='-g';
+		f_opt='='; f_dbug='= -g';
+		;;
+    
+        hp    ) 
+		file=mh-hpux;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        ibm   ) 
+		file=mh-aix;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        linux ) 
+		file=mh-linux;
+		c_opt='-ansi'; c_dbug='-ansi -g';
+		f_opt='='; f_dbug='= -g';
+		;;
+        
+        linux32 ) 
+		file=mh-linux;
+		c_opt='-ansi'; c_dbug='-ansi -g';
+		f_opt='='; f_dbug='= -g';
+		;;
+       
+        linux64 ) 
+		file=mh-linux;
+		c_opt='-ansi'; c_dbug='-ansi -g';
+		f_opt='='; f_dbug='= -g';
+		;;
+   
+        macintosh )
+                file=mh-mac;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+            
+        macintel )
+                file=mh-mac;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+	macintel32 )
+	        file=mh-mac;
+	        c_opt='-ansi'; c_dbug='-ansi -g';
+	        f_opt='='; f_dbug='= -g';
+	        ;;
+	macintel64 )
+	        file=mh-mac;
+	        c_opt='-ansi'; c_dbug='-ansi -g';
+	        f_opt='='; f_dbug='= -g';
+	        ;;
+    
+        cygwin )
+                file=mh-cygwin;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+   
+        sgi   ) 
+		file=mh-irix32;
+		if [ "$OSTYPE" = "IRIX" ] ; then
+		    file=mh-irix5;
+		fi
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        sgi32 )
+		file=mh-irix32;
+		c_opt='-O' c_dbug='-g';
+		f_opt='-O' f_dbug='-g';
+		;;
+
+        sgi64 )
+		file=mh-irix6;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        sun4  )
+		file=mh-sun; c_opt='-O';
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        sun5  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+       sun5.8  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+       sun5.9  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+       sun5.10  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    if [ ! -f $file.ncsa.default ] ; then
+        mv  $file $file.ncsa.default
+    fi
+    
+    cat $file.ncsa.default |
+    sed "/^CFLAGS/s/$c_opt/$c_dbug/" |
+    sed "/^FFLAGS/s/$f_opt/$f_dbug/" |
+    cat > $file.ncsa
+    
+    mv $file.ncsa $file
+
+    cd $start_dir
+}
+
+
+
+#
+# Function to implement pre-configure installation fixes for linux
+#
+
+PreConfigFixes_linux()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    mv mh-linux mh-linux.ncsa
+    sed 's/f77/g77/g' mh-linux.ncsa > mh-linux
+
+    cd $start_dir
+}
+
+#
+# Function to implement pre-configure installation fixes for macintosh
+#
+
+PreConfigFixes_macintosh()
+{
+    cd $start_dir
+        
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+ 
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+ 
+    cd $start_dir/config
+ 
+    mv mh-mac mh-mac.ncsa
+    sed 's/f77/g77/g' mh-mac.ncsa > mh-mac
+ 
+    cd $start_dir
+}
+
+PreConfigFixes_cygwin()
+{
+    cd $start_dir/config
+    cd $start_dir 
+}
+
+#
+# Function to implement pre-configure installation fixes for sgi
+#
+
+PreConfigFixes_sgi()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    if [ ! -f mh-irix6.ncsa ] ; then
+        mv mh-irix6 mh-irix6.ncsa
+        mv mh-irix32 mh-irix32.ncsa
+        sed 's/n32/32/g' mh-irix32.ncsa > mh-irix32
+        mv mh-irix32 mh-irix32.ncsa
+        sed 's/mips3/mips2/g' mh-irix32.ncsa > mh-irix32
+        mv mh-irix32 mh-irix6
+    fi
+
+    cd $start_dir
+}
+
+
+
+
+#
+# Function to implement pre-configure installation fixes for sgi32
+#
+
+PreConfigFixes_sgi32()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+
+
+    #
+    # Return to starting directory
+    #
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement pre-configure installation fixes for sgi64
+#
+
+PreConfigFixes_sgi64()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND... "
+
+    #
+    # If the SGI is using old R4?00 chips then mips4 is
+    # not supported, so force the use of mips3.
+    #
+
+    cd $start_dir/config
+
+    if [ ! -f mh-irix6.ncsa ] ; then
+	sed 's/mips4/mips3/g' mh-irix6 > mh-irix6.ncsa
+        mv mh-irix6.ncsa mh-irix6
+    fi
+
+    cd $start_dir
+}
+
+
+
+
+#
+# Function to implement pre-configure installation fixes for SunOs 4.x
+#
+
+PreConfigFixes_sun4()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for SunOs `uname -r`... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to make gcc the default C compiler.  To get around this we
+    # edit the file config/mh-sun to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    if [ ! -f mh-sun.ncsa ] ; then
+        mv mh-sun mh-sun.ncsa
+    fi
+
+    cat mh-sun.ncsa |
+    sed '/^CC *=/s/^/#/' |
+    sed '/^CFLAGS *=/s/^/#/' |
+    cat > mh-sun
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement pre-configure installation fixes for SunOs 5.x
+#
+
+PreConfigFixes_sun5()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for SunOs `uname -r`... "
+
+
+
+    #
+    # Return to starting directory
+    #
+
+    cd $start_dir
+
+}
+
+
+#
+# Function to implement pre-configure installation fixes for dec
+#
+
+PreConfigFixes_dec()
+{
+    cd $start_dir/config
+
+    EchoAndLog "Pre-configure patching for $BRAND... "
+
+
+    # Modify mh-alpha to include math library for DEC-ALPHA
+    # version 4.0
+
+    chmod 0755 *
+    mv mh-alpha mh-alpha.ncsa
+    sed 's/#LIBSX/LIBSX/g' mh-alpha.ncsa > mh-alpha
+
+    #
+    # Return to starting directory
+    #
+
+    cd $start_dir
+}
+
+
+
+#
+# Function to implement post-configure installation fixes for dec
+#
+
+PostConfigFixes_dec()
+{
+    cd $start_dir
+
+    EchoAndLog "Post-configure patching for $BRAND... "
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement post-configure installation fixes for sgi
+#
+
+PostConfigFixes_sgi()
+{
+    cd $start_dir
+
+    EchoAndLog "Post-configure patching for $BRAND... "
+#
+# For some reason in sgi for some users LD_LIBRARY_PATH causes 
+# problem inside the hdf5's src/Makefile. Lets redefine it as in INSTALL
+# script before running INSTALL-HDF5
+#
+    LD_LIBRARY_PATH="$ZLIBLIB:$SZIPLIB"
+    export LD_LIBRARY_PATH
+echo "Redefined LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
+    cd $start_dir
+}
+
+
+#
+# Function to implement post-configure installation fixes for IBM AIX 4.2
+#
+
+PostConfigFixes_ibm()
+{
+    cd $start_dir/mfhdf/nctest
+ 
+    EchoAndLog "Post-configure patching for IBM `uname -r`... "
+ 
+    # Rename program error.c and edit the Makfile to reflect change
+    # This version of AIX will not compile the program error.c
+    # So I am changing the name so that HDF will install
+ 
+    cp error.c dave.c
+    chmod 0755 Makefile
+    mv Makefile Makefile.ncsa
+    sed 's/error.c/dave.c/g' Makefile.ncsa > Makefile
+    mv Makefile Makefile.ncsa
+    sed 's/error.o/dave.o/g' Makefile.ncsa > Makefile
+ 
+    #
+    # Return to starting directory
+    #
+ 
+    cd $start_dir
+ 
+}
+
+#
+# Function to implement post-configure installation fixes for linux
+#
+
+PostConfigFixes_linux()
+{
+    cd $start_dir
+
+    hdf5_files=`find . -name Makefile -print`
+
+    EchoAndLog "Post-configure patching for linux `uname -r`... "
+
+    for file in $hdf5_files;  do 
+
+	mv $file Makefile.ncsa
+	sed 's^$$(srcdir)/^ /^g' Makefile.ncsa > $file
+	/bin/rm -f Makefile.ncsa
+    done
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement post-configure installation fixes for macintosh
+#
+
+PostConfigFixes_macintosh()
+{
+    cd $start_dir
+ 
+    hdf5_files=`find . -name Makefile -print`
+ 
+    EchoAndLog "Post-configure patching for macintosh `uname -r`... "
+ 
+    for file in $hdf5_files;  do
+ 
+        mv $file Makefile.ncsa
+        sed 's^$$(srcdir)/^ /^g' Makefile.ncsa > $file
+        /bin/rm -f Makefile.ncsa
+    done
+ 
+    cd $start_dir
+}
+
+PostConfigFixes_cygwin()
+{
+    cd $start_dir/config
+    cd $start_dir
+}
+
+#
+# Function to implement post-configure installation fixes for SunOs 5.x
+#
+
+PostConfigFixes_sun5()
+{
+    cd $start_dir
+
+    EchoAndLog "Post-configure patching for SunOs `uname -r`... "
+	mv $install_dir/examples/Makefile $install_dir/examples/Makefile_temp
+	sed "s^export LD_LIBRARY_PATH^#export LD_LIBRARY_PATH^" $install_dir/examples/Makefile_temp >> $install_dir/examples/Makefile
+
+	mv $install_dir/hl/examples/Makefile $install_dir/hl/examples/Makefile_temp
+	sed "s^export LD_LIBRARY_PATH^#export LD_LIBRARY_PATH^" $install_dir/hl/examples/Makefile_temp >> $install_dir/hl/examples/Makefile
+
+    cd $start_dir
+}
+
+
+#
+# Function to set compilers, overriding the NCSA compiler defaults
+#
+    
+SetCompilers()
+{
+    #
+    # Set C compiler based on value of $CC
+    # Set C compilation flags based on value of $CFLAGS
+    # Set FORTRAN compiler based on value of $F77
+    # 
+    # NOTE: 
+    #     This is done recursively for ALL Makefiles because on some
+    #     platforms, the compiler variables are not inherited from the
+    #     the calling Makefile.
+
+
+    EchoAndLog "Overriding NCSA default compiler settings:"
+
+    files=`find . -name Makefile -print`
+
+    if [ "$CC" != "" ] ; then
+
+        if [ "$CFLAGS" = "" ] ; then
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+            for file in $files ; do
+            
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        else
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            if [ "$CFLAGS" = "-O" ] ; then
+                EchoAndLog -n "- setting C compilation flags to default"
+            else
+                EchoAndLog -n "- setting C compilation flags to '$CFLAGS'"
+            fi
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+           for file in $files ; do
+
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^CFLAGS/s/=.*$'"/= $CFLAGS/" |
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        fi
+
+    else
+
+        EchoAndLog "Warning: Environment variable(s) CC and/or F77 not set."
+        EchoAndLog "If CC is not set, the installation uses NCSA defaults."
+
+    fi
+
+}
+
+
+
+#
+# Function to do architecture-specific pre-configure fixes
+#
+    
+PreConfigure()
+{
+
+    cd $start_dir
+
+    if [ "$dbug" = "1" ] ; then
+	PreConfigFixes_dbug
+    fi
+
+    #
+    # Call architecture-specific functions
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) PreConfigFixes_dec;;
+    
+        hp    ) 
+	    # for HP-11 add -lnsl
+	    if [ `uname -r | awk -F. '{print $2}'` = "11" ] ; then
+		mv $install_dir/config/mh-hpux $install_dir/config/mh-hpux_tmp1
+		cat $install_dir/config/mh-hpux_tmp1 |
+		sed '/^LD_XDR/s/=.*$'"/= -lnsl/" |
+		cat > $install_dir/config/mh-hpux_tmp2
+		cp $install_dir/config/mh-hpux_tmp2 $install_dir/config/mh-hpux
+		/bin/rm -f $install_dir/config/mh-hpux_tmp1
+		/bin/rm -f $install_dir/config/mh-hpux_tmp2
+	    fi
+	    ;;
+    
+        ibm   ) ;;
+
+        linux ) 
+		if [ ! -f /bin/f77 ] ; then
+		    PreConfigFixes_linux
+		fi
+		;;
+    
+        linux32 ) 
+		if [ ! -f /bin/f77 ] ; then
+		    PreConfigFixes_linux
+		fi
+		;;
+    
+        linux64 ) 
+		if [ ! -f /bin/f77 ] ; then
+		    PreConfigFixes_linux
+		fi
+		;;
+    
+        macintosh )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+        
+        macintel )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+       
+        macintel32 )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+       
+        macintel64 )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+
+        cygwin )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_cygwin
+                fi
+                ;;
+    
+        sgi   ) 
+		if [ "$OSTYPE" = "IRIX64" ] ; then
+		    PreConfigFixes_sgi
+		fi
+		;;
+    
+        sgi32 ) config_flags=irix6_32;;
+
+        sgi64 )
+		cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+		if [ "$cpu_type" = "4" ] ; then
+		    PreConfigFixes_sgi64
+		fi
+		;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+    
+        sun5.9  ) ;;
+    
+        sun5.10  ) ;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    cd $start_dir
+
+}
+
+
+#
+# Function to do architecture-specific post-configure fixes
+#
+    
+PostConfigure()
+{
+    cd $start_dir
+    
+    
+    #
+    # Check for missing tbl and neqn, patching as needed
+    #
+
+#    PostConfigFixes_NoTblNeqn
+
+
+    #
+    # Do architecture-specific fixes
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) ;;
+    
+        hp    ) ;;
+    
+        ibm   ) 
+#	PostConfigFixes_ibm
+		;;
+        ibm   ) ;;
+
+        linux )
+    	PostConfigFixes_linux ;;
+
+        linux32 )
+    	PostConfigFixes_linux ;;
+
+        linux64 )
+    	PostConfigFixes_linux ;;
+
+        macintosh )
+        PostConfigFixes_macintosh ;;
+
+        macintel )
+        PostConfigFixes_macintosh ;;
+    
+        macintel32 )
+        PostConfigFixes_macintosh ;;
+    
+        macintel64 )
+        PostConfigFixes_macintosh ;;
+    
+        cygwin )
+        PostConfigFixes_cygwin ;;
+    
+        sgi   ) ;;
+    
+        sgi32 )
+	PostConfigFixes_sgi ;;
+
+        sgi64 )
+	PostConfigFixes_sgi ;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+    
+        sun5.9  ) ;;
+    
+        sun5.10  )
+	PostConfigFixes_sun5 ;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    
+    #
+    # If requested, set compilers to something other than the defaults
+    #
+
+    if [ $set_compilers = 1 ] ; then
+        SetCompilers
+    fi
+
+    cd $start_dir
+}
+
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+#
+# Get arguments from command line
+#
+
+set_compilers=0
+config_flags=""
+dbug=0
+c_rlib=0
+
+while [ "$1" != "" ] ; do 
+
+    case "$1" in
+
+      -h | help ) Help ;;
+
+      -set_compilers ) set_compilers=1 ;;
+
+      -dbug ) dbug=1 ;;
+
+      -c_rlib ) c_rlib=1;;
+
+      -start_dir ) 
+          if [ "$2" != "" ] ; then
+              start_dir=$2
+              shift
+          else
+              WriteError "No installation directory specified with -start_dir switch."
+              Help
+          fi
+        ;;
+
+
+      * ) echo "$script_error invalid argument '$1'" ; Help ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Make sure we're not running standalone
+#
+
+if [ "$hdf_install_caller" = "" ] ; then
+
+    WriteError "This script can only be run from INSTALL-HDF."
+    Help
+
+else
+
+    # Here we set up the HDF installation directory,
+    # for use by the configure script.  
+    # 
+    # With this release of HDF, we abandon the convention of setting the
+    # installation directory to $HDFHOME/hdf, which was formerly done for
+    # backwards compatibility with the installed HDF directory structure 
+    # that the toolkit was using with the 3.3r4 version of HDF.
+    # 
+    # New releases of the SDP Toolkit  and hdfeos have been updated to handle this
+    # directory change
+
+    install_dir="$HDF5HOME"
+
+    if [ ! -d "$install_dir" ] ; then 	# create the install dir, if needed.
+        mkdir $install_dir
+    fi
+
+fi
+
+
+
+#
+# Announce
+#
+
+EchoAndLog "Running $this_script"
+
+#
+# Do architecture-specific pre-configure fixes
+#
+
+#PreConfigure
+
+    if [ "$dbug" = "1" ] ; then
+	CFLAGS="-g"
+    fi
+	export CFLAGS
+#
+# Run the NCSA-supplied configure script
+#
+
+	if [ "$dbug" = "1" ] ; then
+		config_flags="$config_flags --disable-production"
+	fi
+	if [ "$c_rlib" = "1" ] ; then
+		config_flags="$config_flags --enable-threadsafe --with-pthread=$PTHREAD_HOME"
+	fi
+cd $start_dir
+
+tmp_home=$HOME			# save $HOME
+HOME=`pwd` ; export HOME	# change it to avoid interaction w/ .cshrc
+
+# linux does not support hsize_t which is "long long"
+
+if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	EchoAndLog "Running ./configure --disable-shared --with-szlib=$SZIPHOME --prefix=$install_dir $config_flags"
+else
+	EchoAndLog "Running ./configure --disable-shared --with-zlib=$ZLIBHOME --with-szlib=$SZIPHOME --prefix=$install_dir $config_flags"
+fi
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+	if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	./configure --disable-shared --with-szlib=$SZIPHOME --prefix=$install_dir $config_flags >> $log_file 2>&1
+	else
+	./configure --disable-shared --with-zlib=$ZLIBHOME --with-szlib=$SZIPHOME --prefix=$install_dir $config_flags >> $log_file 2>&1
+	fi
+else
+    echo ""
+	if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	./configure --disable-shared --with-szlib=$SZIPHOME --prefix=$install_dir $config_flags
+	else
+	./configure --disable-shared --with-zlib=$ZLIBHOME --with-szlib=$SZIPHOME --prefix=$install_dir $config_flags
+	fi
+fi
+
+HOME=$tmp_home ; export HOME	# restore $HOME
+
+
+#
+# Do architecture-specific post-configure fixes
+#
+
+
+PostConfigure
+
+
+#
+# Run the make utility to compile the library and utiltites
+#
+
+EchoAndLog "Running make, target=all"
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make all >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make all
+    tmp_status=$?
+fi
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make all' failed."
+    exit 1
+fi
+
+
+#
+# Run the make utility install the libraries, utilities, includes and man pages 
+#
+
+EchoAndLog "Running make, target=install "
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make install >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make install
+    tmp_status=$?
+fi
+
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make install' failed."
+    exit 1
+fi
+
diff --git a/bin/INSTALL-Scripts/INSTALL-HDF5-1.8.8 b/bin/INSTALL-Scripts/INSTALL-HDF5-1.8.8
new file mode 100755
index 0000000..2e88ae4
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-HDF5-1.8.8
@@ -0,0 +1,1171 @@
+#! /bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-HDF5-1.8.8
+#
+# description:
+# 	Installation script module for installing HDF5-1.8.8
+# 	for the SDP (PGS) Toolkit and hdfeos.  
+#       It implements patches to the NCSA 
+# 	installation procedure to allow for trouble-free installation on
+# 	the platforms supported by the SDP (PGS) Toolkit and hdfeos.
+#
+# usage:
+# 	Called from INSTALL-HDF5
+#
+# 	INSTALL-HDF5-1.8.8 [-dbug]
+# 	INSTALL-HDF5-1.8.8 -h[elp]
+# 	INSTALL-HDF5-1.8.8 [-c_rlib]
+#
+# 	  -h      : display this help message and exit
+# 	  -dbug   : install debug version of HDF5
+# 	  -c_rlib : install thread safe HDF5 library
+#
+# notes:
+# 	This is NOT a standalone script.  It is only intended to be run
+# 	by INSTALL-HDF5, the HDF installation script.
+# 
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        Abe Taaheri / Emergent Information Technologies, Inc.
+#        Adura Adekunjo /L3 Communications EER Inc.
+#
+# history:
+#       23-Apr-1996 MES Initial version (file: INSTALL-HDF4.0r1)
+# 	26-Apr-1996 MES Updated PreConfigure compiler logic.
+# 	02-Jul-1996 MES Updated to handle SunOS 5.5
+# 	19-Aug-1996 MES Updated for HDF4.0r2 (file: INSTALL-HDF4.0r2)
+# 	23-Sep-1996 MES Added patch to hdfi.h on dec to avoid potential
+# 			conflict with <rpc/types.h>.
+#       19-Aug-1996 MES Updated for HDF4.1r3 (file: INSTALL-HDF4.1r3)
+#       05-Oct-2000 AT  for machine HP-11 the xdr library libnsl.a needs to be
+#                       loaded as for the SOLARIS. Added code to edit mh-hpux
+#                       file in config directory to include the load flag -lnsl
+#       19-Mar-2001 AT  Added for HDF5 Installation
+#	13-Aug-2001 AA  Modified for solaris8
+#       20-Oct-2003 AT  Update hdf5-1.4.4 to hdf5-1.6.1
+#       16-Mar-2004 AA  Updated hdf5-1.6.1 to hdf5-1.6.2
+#       24-Jan-2005 MP  Updated hdf5-1.6.2 to hdf5-1.6.3 
+#       05-Sep-2005 AT  Updated hdf5-1.6.3 to hdf5-1.6.5
+#       05-Jul-2007 AT  Updated hdf5-1.6.5 to hdf5-1.6.6
+#       09-Jan-2008 AT  Updated hdf5-1.6.6 to hdf5-1.6.7
+#       09-MAy-2009 AT  Updated hdf5-1.6.7 to hdf5-1.8.3
+#       20-Jul-2010 AT  Updated hdf5-1.8.3 to hdf5-1.8.5-snap4
+#       20-Jul-2010 AT  Updated hdf5-1.8.5-snap4 to hdf5-1.8.8
+#
+#-----------------------------------------------------------------------------
+
+
+#
+# Save starting directory, path
+# Create error message header
+#
+
+start_dir=`pwd`
+start_path=$PATH
+this_script="`basename $0`"
+script_error="$this_script: Error:"
+
+#
+# Get absolute pathname where this script is located
+# This allows the script to locate any needed auxilliary files
+#
+
+script_dir="`dirname $0`"
+abs="`echo $script_dir | cut -c1`"
+if [ "$abs" != "/" ] ; then
+    script_dir=`cd $script_dir;pwd`
+fi
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    if [ "$1" = "-n" ] ; then		# -n: suppress leading blank line
+        shift
+    else
+        echo ""
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+        fi
+    fi
+    
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+         echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function to prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to silently emulate the 'which' command 
+#
+
+Which()
+{
+    if [ "$1" = "" ] ; then 
+        WriteError "Which() : Too few arguments." 
+        exit 1 
+    fi
+
+    saveifs="$IFS"
+    IFS=:
+    which_result=0
+    which_cmd=""
+    
+    for dir in $PATH;  do 
+        if [ -x $dir/$1 ] ; then 
+            which_result=1 
+            which_cmd=$dir/$1
+            break 
+        fi 
+    done
+    
+    IFS="$saveifs"
+}
+
+#
+# Function to implement debug version of hdf libraries
+#
+
+PreConfigFixes_dbug()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure for debug ... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that get
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    case $BRAND in
+
+        cray  ) 
+		file=mh-unicos;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        dec   ) 
+		file=mh-alpha;
+		c_opt='-Olimit 2048'; c_dbug='-g';
+		f_opt='='; f_dbug='= -g';
+		;;
+    
+        hp    ) 
+		file=mh-hpux;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        ibm   ) 
+		file=mh-aix;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        linux ) 
+		file=mh-linux;
+		c_opt='-ansi'; c_dbug='-ansi -g';
+		f_opt='='; f_dbug='= -g';
+		;;
+        
+        linux32 ) 
+		file=mh-linux;
+		c_opt='-ansi'; c_dbug='-ansi -g';
+		f_opt='='; f_dbug='= -g';
+		;;
+       
+        linux64 ) 
+		file=mh-linux;
+		c_opt='-ansi'; c_dbug='-ansi -g';
+		f_opt='='; f_dbug='= -g';
+		;;
+   
+        macintosh )
+                file=mh-mac;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+            
+        macintel )
+                file=mh-mac;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+	macintel32 )
+	        file=mh-mac;
+	        c_opt='-ansi'; c_dbug='-ansi -g';
+	        f_opt='='; f_dbug='= -g';
+	        ;;
+	macintel64 )
+	        file=mh-mac;
+	        c_opt='-ansi'; c_dbug='-ansi -g';
+	        f_opt='='; f_dbug='= -g';
+	        ;;
+    
+        cygwin )
+                file=mh-cygwin;
+                c_opt='-ansi'; c_dbug='-ansi -g';
+                f_opt='='; f_dbug='= -g';
+                ;;
+   
+        sgi   ) 
+		file=mh-irix32;
+		if [ "$OSTYPE" = "IRIX" ] ; then
+		    file=mh-irix5;
+		fi
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        sgi32 )
+		file=mh-irix32;
+		c_opt='-O' c_dbug='-g';
+		f_opt='-O' f_dbug='-g';
+		;;
+
+        sgi64 )
+		file=mh-irix6;
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        sun4  )
+		file=mh-sun; c_opt='-O';
+		c_opt='-O'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        sun5  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+       sun5.8  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+       sun5.9  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+       sun5.10  )
+		file=mh-solaris;
+		c_opt='-xO2'; c_dbug='-g';
+		f_opt='-O'; f_dbug='-g';
+		;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    if [ ! -f $file.ncsa.default ] ; then
+        mv  $file $file.ncsa.default
+    fi
+    
+    cat $file.ncsa.default |
+    sed "/^CFLAGS/s/$c_opt/$c_dbug/" |
+    sed "/^FFLAGS/s/$f_opt/$f_dbug/" |
+    cat > $file.ncsa
+    
+    mv $file.ncsa $file
+
+    cd $start_dir
+}
+
+
+
+#
+# Function to implement pre-configure installation fixes for linux
+#
+
+PreConfigFixes_linux()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    mv mh-linux mh-linux.ncsa
+    sed 's/f77/g77/g' mh-linux.ncsa > mh-linux
+
+    cd $start_dir
+}
+
+#
+# Function to implement pre-configure installation fixes for macintosh
+#
+
+PreConfigFixes_macintosh()
+{
+    cd $start_dir
+        
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+ 
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+ 
+    cd $start_dir/config
+ 
+    mv mh-mac mh-mac.ncsa
+    sed 's/f77/g77/g' mh-mac.ncsa > mh-mac
+ 
+    cd $start_dir
+}
+
+PreConfigFixes_cygwin()
+{
+    cd $start_dir/config
+    cd $start_dir 
+}
+
+#
+# Function to implement pre-configure installation fixes for sgi
+#
+
+PreConfigFixes_sgi()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to change the compilers.  To get around this, we edit the
+    # file config/<arch-file> to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    if [ ! -f mh-irix6.ncsa ] ; then
+        mv mh-irix6 mh-irix6.ncsa
+        mv mh-irix32 mh-irix32.ncsa
+        sed 's/n32/32/g' mh-irix32.ncsa > mh-irix32
+        mv mh-irix32 mh-irix32.ncsa
+        sed 's/mips3/mips2/g' mh-irix32.ncsa > mh-irix32
+        mv mh-irix32 mh-irix6
+    fi
+
+    cd $start_dir
+}
+
+
+
+
+#
+# Function to implement pre-configure installation fixes for sgi32
+#
+
+PreConfigFixes_sgi32()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND ... "
+
+
+    #
+    # Return to starting directory
+    #
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement pre-configure installation fixes for sgi64
+#
+
+PreConfigFixes_sgi64()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for $BRAND... "
+
+    #
+    # If the SGI is using old R4?00 chips then mips4 is
+    # not supported, so force the use of mips3.
+    #
+
+    cd $start_dir/config
+
+    if [ ! -f mh-irix6.ncsa ] ; then
+	sed 's/mips4/mips3/g' mh-irix6 > mh-irix6.ncsa
+        mv mh-irix6.ncsa mh-irix6
+    fi
+
+    cd $start_dir
+}
+
+
+
+
+#
+# Function to implement pre-configure installation fixes for SunOs 4.x
+#
+
+PreConfigFixes_sun4()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for SunOs `uname -r`... "
+
+    #
+    # Despite overrides in Makefile.in, the configure script steadfastly
+    # tries to make gcc the default C compiler.  To get around this we
+    # edit the file config/mh-sun to comment out the offending lines that
+    # get included in the Makefile generated by configure.
+    #
+
+    cd $start_dir/config
+
+    if [ ! -f mh-sun.ncsa ] ; then
+        mv mh-sun mh-sun.ncsa
+    fi
+
+    cat mh-sun.ncsa |
+    sed '/^CC *=/s/^/#/' |
+    sed '/^CFLAGS *=/s/^/#/' |
+    cat > mh-sun
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement pre-configure installation fixes for SunOs 5.x
+#
+
+PreConfigFixes_sun5()
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure patching for SunOs `uname -r`... "
+
+
+
+    #
+    # Return to starting directory
+    #
+
+    cd $start_dir
+
+}
+
+
+#
+# Function to implement pre-configure installation fixes for dec
+#
+
+PreConfigFixes_dec()
+{
+    cd $start_dir/config
+
+    EchoAndLog "Pre-configure patching for $BRAND... "
+
+
+    # Modify mh-alpha to include math library for DEC-ALPHA
+    # version 4.0
+
+    chmod 0755 *
+    mv mh-alpha mh-alpha.ncsa
+    sed 's/#LIBSX/LIBSX/g' mh-alpha.ncsa > mh-alpha
+
+    #
+    # Return to starting directory
+    #
+
+    cd $start_dir
+}
+
+
+
+#
+# Function to implement post-configure installation fixes for dec
+#
+
+PostConfigFixes_dec()
+{
+    cd $start_dir
+
+    EchoAndLog "Post-configure patching for $BRAND... "
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement post-configure installation fixes for sgi
+#
+
+PostConfigFixes_sgi()
+{
+    cd $start_dir
+
+    EchoAndLog "Post-configure patching for $BRAND... "
+#
+# For some reason in sgi for some users LD_LIBRARY_PATH causes 
+# problem inside the hdf5's src/Makefile. Lets redefine it as in INSTALL
+# script before running INSTALL-HDF5
+#
+    LD_LIBRARY_PATH="$ZLIBLIB:$SZIPLIB"
+    export LD_LIBRARY_PATH
+echo "Redefined LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
+    cd $start_dir
+}
+
+
+#
+# Function to implement post-configure installation fixes for IBM AIX 4.2
+#
+
+PostConfigFixes_ibm()
+{
+    cd $start_dir/mfhdf/nctest
+ 
+    EchoAndLog "Post-configure patching for IBM `uname -r`... "
+ 
+    # Rename program error.c and edit the Makfile to reflect change
+    # This version of AIX will not compile the program error.c
+    # So I am changing the name so that HDF will install
+ 
+    cp error.c dave.c
+    chmod 0755 Makefile
+    mv Makefile Makefile.ncsa
+    sed 's/error.c/dave.c/g' Makefile.ncsa > Makefile
+    mv Makefile Makefile.ncsa
+    sed 's/error.o/dave.o/g' Makefile.ncsa > Makefile
+ 
+    #
+    # Return to starting directory
+    #
+ 
+    cd $start_dir
+ 
+}
+
+#
+# Function to implement post-configure installation fixes for linux
+#
+
+PostConfigFixes_linux()
+{
+    cd $start_dir
+
+    hdf5_files=`find . -name Makefile -print`
+
+    EchoAndLog "Post-configure patching for linux `uname -r`... "
+
+    for file in $hdf5_files;  do 
+
+	mv $file Makefile.ncsa
+	sed 's^$$(srcdir)/^ /^g' Makefile.ncsa > $file
+	/bin/rm -f Makefile.ncsa
+    done
+
+    cd $start_dir
+}
+
+
+#
+# Function to implement post-configure installation fixes for macintosh
+#
+
+PostConfigFixes_macintosh()
+{
+    cd $start_dir
+ 
+    hdf5_files=`find . -name Makefile -print`
+ 
+    EchoAndLog "Post-configure patching for macintosh `uname -r`... "
+ 
+    for file in $hdf5_files;  do
+ 
+        mv $file Makefile.ncsa
+        sed 's^$$(srcdir)/^ /^g' Makefile.ncsa > $file
+        /bin/rm -f Makefile.ncsa
+    done
+ 
+    cd $start_dir
+}
+
+PostConfigFixes_cygwin()
+{
+    cd $start_dir/config
+    cd $start_dir
+}
+
+#
+# Function to implement post-configure installation fixes for SunOs 5.x
+#
+
+PostConfigFixes_sun5()
+{
+    cd $start_dir
+
+    EchoAndLog "Post-configure patching for SunOs `uname -r`... "
+	mv $install_dir/examples/Makefile $install_dir/examples/Makefile_temp
+	sed "s^export LD_LIBRARY_PATH^#export LD_LIBRARY_PATH^" $install_dir/examples/Makefile_temp >> $install_dir/examples/Makefile
+
+	mv $install_dir/hl/examples/Makefile $install_dir/hl/examples/Makefile_temp
+	sed "s^export LD_LIBRARY_PATH^#export LD_LIBRARY_PATH^" $install_dir/hl/examples/Makefile_temp >> $install_dir/hl/examples/Makefile
+
+    cd $start_dir
+}
+
+
+#
+# Function to set compilers, overriding the NCSA compiler defaults
+#
+    
+SetCompilers()
+{
+    #
+    # Set C compiler based on value of $CC
+    # Set C compilation flags based on value of $CFLAGS
+    # Set FORTRAN compiler based on value of $F77
+    # 
+    # NOTE: 
+    #     This is done recursively for ALL Makefiles because on some
+    #     platforms, the compiler variables are not inherited from the
+    #     the calling Makefile.
+
+
+    EchoAndLog "Overriding NCSA default compiler settings:"
+
+    files=`find . -name Makefile -print`
+
+    if [ "$CC" != "" ] ; then
+
+        if [ "$CFLAGS" = "" ] ; then
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+            for file in $files ; do
+            
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        else
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            if [ "$CFLAGS" = "-O" ] ; then
+                EchoAndLog -n "- setting C compilation flags to default"
+            else
+                EchoAndLog -n "- setting C compilation flags to '$CFLAGS'"
+            fi
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+           for file in $files ; do
+
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^CFLAGS/s/=.*$'"/= $CFLAGS/" |
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        fi
+
+    else
+
+        EchoAndLog "Warning: Environment variable(s) CC and/or F77 not set."
+        EchoAndLog "If CC is not set, the installation uses NCSA defaults."
+
+    fi
+
+}
+
+
+
+#
+# Function to do architecture-specific pre-configure fixes
+#
+    
+PreConfigure()
+{
+
+    cd $start_dir
+
+    if [ "$dbug" = "1" ] ; then
+	PreConfigFixes_dbug
+    fi
+
+    #
+    # Call architecture-specific functions
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) PreConfigFixes_dec;;
+    
+        hp    ) 
+	    # for HP-11 add -lnsl
+	    if [ `uname -r | awk -F. '{print $2}'` = "11" ] ; then
+		mv $install_dir/config/mh-hpux $install_dir/config/mh-hpux_tmp1
+		cat $install_dir/config/mh-hpux_tmp1 |
+		sed '/^LD_XDR/s/=.*$'"/= -lnsl/" |
+		cat > $install_dir/config/mh-hpux_tmp2
+		cp $install_dir/config/mh-hpux_tmp2 $install_dir/config/mh-hpux
+		/bin/rm -f $install_dir/config/mh-hpux_tmp1
+		/bin/rm -f $install_dir/config/mh-hpux_tmp2
+	    fi
+	    ;;
+    
+        ibm   ) ;;
+
+        linux ) 
+		if [ ! -f /bin/f77 ] ; then
+		    PreConfigFixes_linux
+		fi
+		;;
+    
+        linux32 ) 
+		if [ ! -f /bin/f77 ] ; then
+		    PreConfigFixes_linux
+		fi
+		;;
+    
+        linux64 ) 
+		if [ ! -f /bin/f77 ] ; then
+		    PreConfigFixes_linux
+		fi
+		;;
+    
+        macintosh )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+        
+        macintel )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+       
+        macintel32 )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+       
+        macintel64 )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_macintosh
+                fi
+                ;;
+
+        cygwin )
+                if [ ! -f /bin/f77 ] ; then
+                    PreConfigFixes_cygwin
+                fi
+                ;;
+    
+        sgi   ) 
+		if [ "$OSTYPE" = "IRIX64" ] ; then
+		    PreConfigFixes_sgi
+		fi
+		;;
+    
+        sgi32 ) config_flags=irix6_32;;
+
+        sgi64 )
+		cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+		if [ "$cpu_type" = "4" ] ; then
+		    PreConfigFixes_sgi64
+		fi
+		;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+    
+        sun5.9  ) ;;
+    
+        sun5.10  ) ;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    cd $start_dir
+
+}
+
+
+#
+# Function to do architecture-specific post-configure fixes
+#
+    
+PostConfigure()
+{
+    cd $start_dir
+    
+    
+    #
+    # Check for missing tbl and neqn, patching as needed
+    #
+
+#    PostConfigFixes_NoTblNeqn
+
+
+    #
+    # Do architecture-specific fixes
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) ;;
+    
+        hp    ) ;;
+    
+        ibm   ) 
+#	PostConfigFixes_ibm
+		;;
+        ibm   ) ;;
+
+        linux )
+    	PostConfigFixes_linux ;;
+
+        linux32 )
+    	PostConfigFixes_linux ;;
+
+        linux64 )
+    	PostConfigFixes_linux ;;
+
+        macintosh )
+        PostConfigFixes_macintosh ;;
+
+        macintel )
+        PostConfigFixes_macintosh ;;
+    
+        macintel32 )
+        PostConfigFixes_macintosh ;;
+    
+        macintel64 )
+        PostConfigFixes_macintosh ;;
+    
+        cygwin )
+        PostConfigFixes_cygwin ;;
+    
+        sgi   ) ;;
+    
+        sgi32 )
+	PostConfigFixes_sgi ;;
+
+        sgi64 )
+	PostConfigFixes_sgi ;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+    
+        sun5.9  ) ;;
+    
+        sun5.10  )
+	PostConfigFixes_sun5 ;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    
+    #
+    # If requested, set compilers to something other than the defaults
+    #
+
+    if [ $set_compilers = 1 ] ; then
+        SetCompilers
+    fi
+
+    cd $start_dir
+}
+
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+#
+# Get arguments from command line
+#
+
+set_compilers=0
+config_flags=""
+dbug=0
+c_rlib=0
+
+while [ "$1" != "" ] ; do 
+
+    case "$1" in
+
+      -h | help ) Help ;;
+
+      -set_compilers ) set_compilers=1 ;;
+
+      -dbug ) dbug=1 ;;
+
+      -c_rlib ) c_rlib=1;;
+
+      -start_dir ) 
+          if [ "$2" != "" ] ; then
+              start_dir=$2
+              shift
+          else
+              WriteError "No installation directory specified with -start_dir switch."
+              Help
+          fi
+        ;;
+
+
+      * ) echo "$script_error invalid argument '$1'" ; Help ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Make sure we're not running standalone
+#
+
+if [ "$hdf_install_caller" = "" ] ; then
+
+    WriteError "This script can only be run from INSTALL-HDF."
+    Help
+
+else
+
+    # Here we set up the HDF installation directory,
+    # for use by the configure script.  
+    # 
+    # With this release of HDF, we abandon the convention of setting the
+    # installation directory to $HDFHOME/hdf, which was formerly done for
+    # backwards compatibility with the installed HDF directory structure 
+    # that the toolkit was using with the 3.3r4 version of HDF.
+    # 
+    # New releases of the SDP Toolkit  and hdfeos have been updated to handle this
+    # directory change
+
+    install_dir="$HDF5HOME"
+
+    if [ ! -d "$install_dir" ] ; then 	# create the install dir, if needed.
+        mkdir $install_dir
+    fi
+
+fi
+
+
+
+#
+# Announce
+#
+
+EchoAndLog "Running $this_script"
+
+#
+# Do architecture-specific pre-configure fixes
+#
+
+#PreConfigure
+
+    if [ "$dbug" = "1" ] ; then
+	CFLAGS="-g"
+    fi
+	export CFLAGS
+#
+# Run the NCSA-supplied configure script
+#
+
+	if [ "$dbug" = "1" ] ; then
+		config_flags="$config_flags --disable-production"
+	fi
+	if [ "$c_rlib" = "1" ] ; then
+		config_flags="$config_flags --enable-threadsafe --with-pthread=$PTHREAD_HOME"
+	fi
+cd $start_dir
+
+tmp_home=$HOME			# save $HOME
+HOME=`pwd` ; export HOME	# change it to avoid interaction w/ .cshrc
+
+# linux does not support hsize_t which is "long long"
+
+if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	EchoAndLog "Running ./configure --disable-shared --with-szlib=$SZIPHOME --prefix=$install_dir $config_flags"
+else
+	EchoAndLog "Running ./configure --disable-shared --with-zlib=$ZLIBHOME --with-szlib=$SZIPHOME --prefix=$install_dir $config_flags"
+fi
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+	if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	./configure --disable-shared --with-szlib=$SZIPHOME --prefix=$install_dir $config_flags >> $log_file 2>&1
+	else
+	./configure --disable-shared --with-zlib=$ZLIBHOME --with-szlib=$SZIPHOME --prefix=$install_dir $config_flags >> $log_file 2>&1
+	fi
+else
+    echo ""
+	if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	./configure --disable-shared --with-szlib=$SZIPHOME --prefix=$install_dir $config_flags
+	else
+	./configure --disable-shared --with-zlib=$ZLIBHOME --with-szlib=$SZIPHOME --prefix=$install_dir $config_flags
+	fi
+fi
+
+HOME=$tmp_home ; export HOME	# restore $HOME
+
+
+#
+# Do architecture-specific post-configure fixes
+#
+
+
+PostConfigure
+
+
+#
+# Run the make utility to compile the library and utiltites
+#
+
+EchoAndLog "Running make, target=all"
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make all >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make all
+    tmp_status=$?
+fi
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make all' failed."
+    exit 1
+fi
+
+
+#
+# Run the make utility install the libraries, utilities, includes and man pages 
+#
+
+EchoAndLog "Running make, target=install "
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make install >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make install
+    tmp_status=$?
+fi
+
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make install' failed."
+    exit 1
+fi
+
diff --git a/bin/INSTALL-Scripts/INSTALL-HDFEOS-Wrap b/bin/INSTALL-Scripts/INSTALL-HDFEOS-Wrap
new file mode 100755
index 0000000..7579487
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-HDFEOS-Wrap
@@ -0,0 +1,760 @@
+#!/bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-HDFEOS-Wrap
+#
+# description:
+# 	HDFEOS installation script wrapper for the SDP(PGS) Toolkit and hdfeos
+# 	The  purpose of this script is to integrate the installation
+# 	of HDFEOS when it is being performed concurrently with the
+# 	SDP Toolkit or hdfeos5 installation.In normal use this script is called
+# 	by INSTALL, the master Toolkit installation script, though it
+# 	may also be run standalone.
+#
+# usage:
+# 	INSTALL-HDFEOS-Wrap [-sgi32 | -sgi64] [-log <log-file> 
+#                           [-cc_path <path/compiler_name>]
+#	                    [-append]] [-df <distribution-file>] 
+#                           [-w_home <file>] [-batch]
+# 	                    [-install_dir <base installation directory>]
+# 	INSTALL-HDFEOS-Wrap [-h] 
+#
+# 	  -sgi32  : build in -n32   mode (SGI Power Challenge only)
+# 	  -sgi64  : build in 64-bit mode (SGI Power Challenge only)
+# 	  -log    : send session output to <log-file>
+# 	  -dbug   : build debug version of hdfeos library
+#         -cc_path: set the path of the C compiler to <path/compiler_name>
+# 	  -append : append to existing <log-file>
+# 	  -w_home : write HDFEOS home directory to <file>
+# 	  -df     : install HDFEOS from distribution file <distribution-file>
+# 	  -batch  : run script in batch (i.e. non-interactive) mode
+# 	  -h      : display this help message and exit
+#
+# notes:
+# 	1) An initial installation requires the HDFEOS distribution file to 
+# 	   have been previously downloaded.  Also, HDF must already be 
+# 	   installed, preferably as part of the Toolkit installation.
+# 	    
+# 	2) This script requires the environment variables HDFINC, HDFLIB,
+#          SZIPINC and SZIPLIB to be properly set.  In normal use these
+# 	   will be set by the INSTALL script.
+#
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        Phuong T. Nguyen/ Emergent Information Technology, Inc.
+#        Abe Taaheri/ Raytheon IIS
+#
+# history:
+#       27-Sep-1996 MES Initial version (portions taken from INSTALL-HDF)
+# 	17-Oct-1996 MES Various fixes and enhancements.
+# 	23-Oct-1996 MES Add UserPrompt -x option to do shell syntax expansion.
+#       24-Jun-1998 MEDS Updating script to include new tar file for version
+#                        HDF-EOS 2.3 in the distribution list
+#       24-Jun-1998 MEDS Updating script to include new tar file for version
+#                        HDF-EOS 2.4 in the distribution list
+#       19-Jun-1999 MEDS Updating script to include new tar file for version
+#                        HDF-EOS 2.5 in the distribution list
+#       12-Oct-1999 MEDS Updating script to include new tar file for version
+#                        HDF-EOS 2.6 in the distribution list
+#       26-Sep-2001 PTN  Updating script to include new tar file for version
+#                        HDF-EOS 2.8 in the distribution list
+#       17-Mar-2003  AA  Updating script to include new tar file for version
+#                        HDF-EOS 2.9 in the distribution list 
+#       15-Sep-2003 PTN  Add -cc_path option.
+#       20-Oct-2003  AT  Updating script to include new tar file for version
+#                        HDF-EOS 2.10 in the distribution list 
+#       18-Jan-2005  MP  Updating script to include new tar file for version
+#                        HDF-EOS 2.13 in the distribution list
+#       08-Sep-2005  AT  Updating script to include new tar file for version
+#                        HDF-EOS 2.14 in the distribution list
+#       05-Jul-2007  AT  Updating script to include new tar file for version
+#                        HDF-EOS 2.15 in the distribution list
+#       20-May-2009  AT  Updating script to include new tar file for version
+#                        HDF-EOS 2.16 in the distribution list
+#       20-Jul-2010  AT  Updating script to include new tar file for version
+#                        HDF-EOS 2.17 in the distribution list
+#       16-Nov-2011  AT  Updating script to include new tar file for version
+#                        HDF-EOS 2.18 in the distribution list
+#       27-Jan-2014  AT  Updating script to include new tar file for version
+#                        HDF-EOS 2.19 in the distribution list
+#
+#
+#-----------------------------------------------------------------------------
+
+this_script="`basename $0`"
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    if [ "$1" = "-n" ] ; then		# -n: suppress leading blank line
+        shift
+    else
+        echo ""
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+        fi
+    fi
+    
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+         echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function to prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$1" = -x ] ; then		# -x: eXpand shell variables
+        shift
+        expand_flag=1
+    else
+        expand_flag=0
+    fi
+
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ]; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+
+    read user_response
+
+    if [ $expand_flag = 1 ] ; then	# perform shell variable expansion
+        user_response=`echo $user_response | sed 's%~%$HOME%'`  # map ~ to $HOME
+        user_response=`eval echo $user_response`		# expand all
+    fi
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+#
+# Function to get the location of the distribution file
+#
+    
+GetDistribution()
+{    
+    : ${distrib_file:=HDF-EOS2.19v1.00.tar.Z}
+
+    ds1=$distrib_file			# backup copy
+    
+    # derive tar file name
+
+    case "$distrib_file" in
+
+      HDF-EOS2.0v1.00.tar.Z )
+        tar_file=HDF-EOS2.0v1.00.tar
+        HDFEOS_home=hdfeos
+        ;;
+
+
+      HDF-EOS2.1v1.00.tar.Z )
+        tar_file=HDF-EOS2.1v1.00.tar
+        HDFEOS_home=hdfeos
+        ;;
+
+
+      HDF-EOS2.2v1.00.tar.Z )
+        tar_file=HDF-EOS2.2v1.00.tar
+        HDFEOS_home=hdfeos
+        ;;
+
+      HDF-EOS2.3v1.00.tar.Z )
+        tar_file=HDF-EOS2.3v1.00.tar
+        HDFEOS_home=hdfeos
+        ;;
+
+      HDF-EOS2.4v1.00.tar.Z )
+        tar_file=HDF-EOS2.4v1.00.tar
+        HDFEOS_home=hdfeos
+        ;;
+
+      HDF-EOS2.5v1.00.tar.Z )
+        tar_file=HDF-EOS2.5v1.00.tar
+        HDFEOS_home=hdfeos
+        ;;
+
+      HDF-EOS2.7.2v1.00.tar.Z )
+        tar_file=HDF-EOS2.7.2v1.00.tar
+        HDFEOS_home=hdfeos
+        ;;
+
+      HDF-EOS2.8v1.00.tar.Z )
+        tar_file=HDF-EOS2.8v1.00.tar
+        HDFEOS_home=hdfeos
+        ;;
+      
+      HDF-EOS2.10v1.00.tar.Z )
+        tar_file=HDF-EOS2.10v1.00.tar
+        HDFEOS_home=hdfeos
+        ;;
+
+     HDF-EOS2.11v1.00.tar.Z )
+      tar_file=HDF-EOS2.11v1.00.tar
+      HDFEOS_home=hdfeos
+        ;;
+
+     HDF-EOS2.12v1.00.tar.Z )
+      tar_file=HDF-EOS2.12v1.00.tar
+      HDFEOS_home=hdfeos
+        ;;
+
+     HDF-EOS2.13v1.00.tar.Z )
+      tar_file=HDF-EOS2.13v1.00.tar
+      HDFEOS_home=hdfeos
+        ;;
+
+     HDF-EOS2.14v1.00.tar.Z )
+      tar_file=HDF-EOS2.14v1.00.tar
+      HDFEOS_home=hdfeos
+        ;;
+
+     HDF-EOS2.16v1.00.tar.Z )
+      tar_file=HDF-EOS2.16v1.00.tar
+      HDFEOS_home=hdfeos
+        ;;
+
+     HDF-EOS2.17v1.00.tar.Z )
+      tar_file=HDF-EOS2.17v1.00.tar
+      HDFEOS_home=hdfeos
+        ;;
+
+     HDF-EOS2.18v1.00.tar.Z )
+      tar_file=HDF-EOS2.18v1.00.tar
+      HDFEOS_home=hdfeos
+        ;;
+
+     HDF-EOS2.19v1.00.tar.Z )
+      tar_file=HDF-EOS2.19v1.00.tar
+      HDFEOS_home=hdfeos
+        ;;
+
+     * )
+        EchoAndLog "HDFEOS version in $distrib_file not supported by this script."
+        exit 1
+        ;;
+
+    esac
+
+    
+    # set search path to include current dir, parent of current and $HOME    
+    search_path=`pwd`
+    search_path="$search_path `cd ..; pwd` $HOME"
+
+    # set search file to include compressed tar file and uncompressed tar file
+    search_file="$distrib_file $tar_file"
+
+    # search for the distribution file
+
+    found_file=0
+    for distrib_path in $search_path ; do
+
+        for distrib_file in $search_file ; do
+
+            if [ -f ${distrib_path}/${distrib_file} ] ; then
+                found_file=1
+                break
+            fi
+
+        done
+
+        if [ $found_file = 1 ] ; then
+            break
+        fi
+
+    done
+
+    # if file was not found, ask the user
+
+    if [ $found_file = 0 ] ; then
+
+	if [ $batch_mode = 0 ] ; then
+	    echo ""	
+	    UserPrompt -x "Pathname where $ds1 is located: "
+	    echo ""
+  	else
+	    user_response=""
+	fi
+    
+        if [ "$user_response" != "" ] ; then
+
+            # make sure directory exists
+
+            if [ -d $user_response ] ; then
+                distrib_path=$user_response
+            else 
+                WriteError "Invalid directory: $user_response"
+                exit 1
+            fi
+    
+            # search for the distribution file in user directory
+
+            for distrib_file in $search_file ; do
+
+                if [ -f ${distrib_path}/${distrib_file} ] ; then
+                    found_file=1
+                    break
+                fi
+
+            done
+
+        fi
+
+
+    fi
+
+
+    if [ $found_file = 0 ] ; then
+        WriteError "Can't find ${ds1} in (${search_path})"
+        echo "HDFEOS installation cancelled."
+        exit 1
+    fi
+
+}
+
+# 
+# Function to get the location of the HDFEOS home directory for installation
+# Also, prompt user that all information is valid before proceeding
+#
+
+GetInstallDir()
+{    
+    if [ "$HDFEOS_path" = "" ] ; then
+	HDFEOS_path="`pwd`"
+    fi
+    
+
+    if [ "$HDFEOS_path" = "`pwd`" ] ; then
+	HDFEOS_path="$HDFEOS_path/.."
+    fi
+
+    # ask the user
+    
+    if [ $batch_mode = 0 ] ; then
+	UserPrompt -x "Pathname where '$HDFEOS_home' will be installed [$HDFEOS_path]: " 
+	echo ""
+    else
+	user_response=""
+    fi
+    
+    if [ "$user_response" = "" ] ; then
+        if [  ! -d `dirname $HDFEOS_path`  ] ; then mkdir `dirname $HDFEOS_path` ; fi
+        if [  ! -d $HDFEOS_path  ] ; then  mkdir $HDFEOS_path ; fi
+    else
+        if [ -d "$user_response" ] ; then HDFEOS_path=$user_response ; fi
+    fi
+    
+    if [ ! -d $HDFEOS_path ] ; then
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "$HDFEOS_path does not exist.  Create [y]? "
+	else
+	    user_response=y
+	fi
+	if [ "$user_response" = "" ] ; then user_response="y" ; fi
+	case "$user_response" in
+	    y* | Y* )
+		mkdir -p $HDFEOS_path
+		if [ ! -d $HDFEOS_path ] ; then
+		    WriteError "Unable to create directory $HDFEOS_path." 
+		    echo "HDFEOS installation cancelled." 2>&1
+		    exit 1
+		
+		fi
+		;;
+	    *)
+		WriteError "Directory $HDFEOS_path does not exist." 
+		echo "HDFEOS installation cancelled." 2>&1
+		exit 1
+		;;
+        esac
+    fi
+    
+    
+    #
+    # confirm before proceeding
+    #
+    
+    echo "The HDFEOS directory will be restored from: " 
+    echo "    ${distrib_path}/${distrib_file}" 
+    echo "" 
+    echo "The HDFEOS will be installed in: " 
+    echo "     ${HDFEOS_path}" 
+    echo "" 
+
+    if [ $batch_mode = 0 ] ; then
+	UserPrompt "Continue [yes] ? " 
+	case "$user_response" in
+	    n* | N* ) echo "Cancelled." ; exit 1 ;;
+	    * ) echo "Confirmed." ; echo "" ;;
+	esac
+    fi
+}
+
+#
+# Function to unpack the distribution file into the installation directory
+#
+
+UnpackDistribution()
+{
+    #
+    # Go to the HDFEOS parent directory
+    #
+    
+    cd $HDFEOS_path
+
+    #
+    # If the new HDFEOS home directory already exits, it must
+    # be removed first.  Check with the user before proceeding.
+    #
+    
+    if [ -d "$HDFEOS_home" ] ; then
+    
+        EchoAndLog "The directory $HDFEOS_home already exists."
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "[O]verwrite, [R]e-use or [Q]uit (default) ? "
+	else
+	    user_response=r
+	fi
+
+        case "$user_response" in
+          o* | O* )
+            EchoAndLog "Removing old $HDFEOS_home directory ..."
+            /bin/rm -rf $HDFEOS_home
+            ;;
+    
+          r* | R* )
+            EchoAndLog "Installation will use existing $HDFEOS_home directory."
+            return 0
+            ;;
+    
+          * )
+            EchoAndLog "Cancelled."
+            exit 1
+            ;;
+        esac
+    
+    fi
+    
+    
+    #
+    # Create a link to the distribution file, if necessary.
+    #
+
+    link_flag=0
+    if [ ! -f $distrib_file ] ; then
+        if [ -f ${distrib_path}/${distrib_file} ] ; then
+            ln -s ${distrib_path}/${distrib_file} ${distrib_file}
+            link_flag=1
+        fi
+    fi
+    
+    # 
+    # Uncompress the distribution file, (if needed), and extract the files
+    # 
+    
+    EchoAndLog "Extracting files from $distrib_file ..."
+
+    suffix="`echo $distrib_file |  sed 's/^.*\.//'`"
+    case $suffix in
+    
+      Z  )
+        zcat $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+
+      tar)
+        tar xvf $distrib_file | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+    
+    esac
+
+    #
+    # Clean up symbolic link, if present
+    #
+
+    if [ $link_flag = 1 ] ; then
+        /bin/rm -f $distrib_file
+    fi
+
+
+}
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+
+
+#
+# Get arguments from command line
+#
+
+home_file=""
+no_untar=0
+sgi_mode=32		# by default, SGI mode is standard 32-bit
+log_file=""
+distrib_file=""
+fc_path=""
+cc_path=""
+append=0
+dbug=0
+batch_mode=0
+
+while [ "$1" != "" ]
+do
+
+    case $1 in
+
+      -h | -he  | -hel  | -help  ) Help ;;	# help
+
+      -sgi32) sgi_mode=n32 ;;
+      -sgi64) sgi_mode=64 ;;
+
+      -fc_path ) fc_path="$2" ; shift ;;
+
+      -cc_path ) cc_path="$2" ; shift ;;
+
+      -df) distrib_file="$2" ; shift ;;
+
+      -log )
+        if [ "$2" != "" ] ; then
+            if [ "` echo $2 | cut -c1`" = "/" ] ; then
+                log_file="$2"
+            else
+                log_file="$start_dir/$2"
+            fi
+            shift
+        else
+            WriteError "A log file must be specified with the -log option"
+            Help
+        fi
+        ;;
+
+      -append )
+        append=1
+        ;;
+
+      -dbug )
+        dbug=1
+        ;;
+
+
+      -w_home )
+        if [ "$2" != "" ] ; then
+            if [ "` echo $2 | cut -c1`" = "/" ] ; then
+                home_file="$2"
+            else
+                home_file="$start_dir/$2"
+            fi
+            shift
+        else
+            WriteError "A file name must be specified with the -w_home option."
+            Help
+        fi
+        ;;
+
+      -install_dir )
+        if [ "$2" != "" ] ; then
+	    HDFEOS_path=$2
+            shift
+        else
+            WriteError "No installation directory specified with -install_dir switch."
+            Help
+        fi
+        ;;
+
+	-batch )
+	    batch_mode=1
+	;;
+
+      -*)
+        echo "Invalid option: $1"
+        Help
+        ;;
+
+      *) 				# default
+        value1="$1"
+        ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Initialize the home file
+#
+
+if [ "$home_file" != "" ] ; then
+
+    if [ -f "$home_file" ] ; then 
+        /bin/rm -f $home_file > /dev/null 2>&1
+    fi
+
+    touch $home_file > /dev/null 2>&1
+    if [ $? != 0 ] ; then
+        WriteError "Cannot write to file $home_file"
+        exit 1
+    fi
+
+fi
+
+
+#
+# Get the location of the distribution file
+#
+
+GetDistribution
+
+
+#
+# Got valid distribution file
+# Get the location of the HDFEOS home directory for installation
+#
+
+GetInstallDir
+
+
+
+
+#
+# Unpack the distribution file into the installation directory
+#
+
+cd $HDFEOS_path
+
+if [ "$no_untar" = 0 ] ; then
+    UnpackDistribution
+fi
+
+
+#
+# Prepare to install the requested version of HDFEOS
+#
+
+if [ ! -d "$HDFEOS_path" ] ; then
+    EchoAndLog "Error creating directory: $HDFEOS_path"
+    exit 1
+fi
+
+cd $HDFEOS_path/$HDFEOS_home		# go to the starting directory
+
+EchoAndLog "Setting directory to: $HDFEOS_path/$HDFEOS_home"
+
+# HDF-EOS expects these directories to be in place, if they are not
+# then create them here.  If we have to do this then the INSTALL may
+# fail, but at least we're still one step ahead of the game
+
+if [ ! -d bin/$BRAND ] ; then
+        mkdir bin/$BRAND
+fi
+ 
+if [ ! -d obj/$BRAND ] ; then
+        mkdir obj/$BRAND
+fi
+ 
+if [ ! -d lib/$BRAND ] ; then
+        mkdir lib/$BRAND
+fi
+
+install_flags="-i$HDFINC -l$HDFLIB -szi$SZIPINC -szl$SZIPLIB"
+
+if [ $dbug = 1 ] ; then
+    install_flags="$install_flags -dbug"
+fi
+
+case "$sgi_mode" in
+  n32)
+    install_flags="$install_flags -sgi32" ;;
+  64)
+    install_flags="$install_flags -sgi64" ;;
+esac
+
+if [ "$cc_path" != "" ] ; then 		# path for C compiler
+    install_flags="$install_flags -cc_path $cc_path"
+fi
+
+if [ "$fc_path" != "" ] ; then 		# path for FORTRAN compiler
+    install_flags="$install_flags -fc_path $fc_path"
+fi
+
+EchoAndLog "Running the HDFEOS installation script ..."
+
+return_status=0
+if [ "$log_file" != "" ] ; then
+
+    if [ $append = 1 ] ; then
+        bin/INSTALL-HDFEOS $install_flags >> $log_file 2>&1 # append
+        return_status=$?
+    else
+        bin/INSTALL-HDFEOS $install_flags > $log_file  2>&1 # clobber
+        return_status=$?
+    fi
+
+else
+
+    bin/INSTALL-HDFEOS $install_flags
+    return_status=$?
+
+fi
+
+
+# 
+# Pass back the HDF install directory for the toolkit installation
+# 
+
+if [ $return_status = 0 ] ; then
+
+    if [ "$home_file" != "" ] ; then
+      echo $HDFEOS_path/$HDFEOS_home >> $home_file
+    fi
+
+fi
+
+
+if [ $return_status != 0 ] ; then
+    echo "The HDFEOS Installation Script failed or had errors."
+    exit 1
+fi
+
+
diff --git a/bin/INSTALL-Scripts/INSTALL-HDFEOS5-Wrap b/bin/INSTALL-Scripts/INSTALL-HDFEOS5-Wrap
new file mode 100755
index 0000000..716604f
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-HDFEOS5-Wrap
@@ -0,0 +1,677 @@
+#!/bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-HDFEOS5-Wrap
+#
+# description:
+# 	HDFEOS5 installation script wrapper for the SDP(PGS) Toolkit and hdfeos
+# 	The purpose of this script is to integrate the installation
+# 	of HDFEOS5 when it is being performed concurrently with the
+# 	SDP Toolkit or hdfeos installation. In normal use this script is called
+# 	by INSTALL, the master Toolkit installation script, though it
+# 	may also be run standalone.
+#
+# usage:
+# 	INSTALL-HDFEOS5-Wrap [-sgi32 | -sgi64] [-log <log-file> 
+#                            [-cc_path <path/compiler_name>]
+#                            [-append]] [-df <distribution-file>] 
+#                            [-w_home <file>] [-batch]
+# 	                     [-install_dir <base installation directory>]
+# 	INSTALL-HDFEOS5-Wrap [-h] 
+#
+# 	  -sgi32  : build in -n32   mode (SGI Power Challenge only)
+# 	  -sgi64  : build in 64-bit mode (SGI Power Challenge only)
+# 	  -log    : send session output to <log-file>
+# 	  -dbug   : build debug version of hdfeos library
+#         -cc_path: set the path of the C compiler to <path/compiler_name>
+# 	  -append : append to existing <log-file>
+# 	  -w_home : write HDFEOS5 home directory to <file>
+# 	  -df     : install HDFEOS5 from distribution file <distribution-file>
+# 	  -batch  : run script in batch (i.e. non-interactive) mode
+# 	  -h      : display this help message and exit
+#
+# notes:
+# 	1) An initial installation requires the HDFEOS5 distribution file to 
+# 	   have been previously downloaded.  Also, HDF5 must already be 
+# 	   installed, preferably as part of the Toolkit installation.
+# 	    
+# 	2) This script requires the environment variables HDF5INC, HDFLIB,
+#          SZIPINC and SZIPLIB to be properly set.  In normal use these
+# 	   will be set by the INSTALL script.
+#
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        Abe Taaheri/ Emergent Information Technologies, Inc.
+#        Phuong T. Nguyen/ L3 Communication.
+# history:
+#       12-Jan-2001 AT  Initial Version. Used INSTALL-HDFEOS-Wrap for this 
+#                       script as template and modified to work for HDFEOS5
+#       16-Jan-2002 PTN Changed HDF-EOS5.0.tar.Z to HDF-EOS5.1.2.tar.Z 
+#       17-Jul-2002 PTN Changed HDF-EOS5.1.2.tar.Z to HDF-EOS5.1.3.tar.Z
+#       24-Mar-2003 PTN Changed HDF-EOS5.1.4.tar.Z to HDF-EOS5.1.5.tar.Z
+#       15-Sep-2003 PTN Add -cc_path option.
+#       20-Oct-2003 AT  Changed HDF-EOS5.1.5.tar.Z to HDF-EOS5.1.6.tar.Z
+#       18-Jan-2005 MP  Changed HDF-EOS5.1.8.tar.Z to HDF-EOS5.1.9.tar.Z
+#       08-Sep-2005 AT  Changed HDF-EOS5.1.9.tar.Z to HDF-EOS5.1.10.tar.Z
+#       05-Jul-2007 AT  Changed HDF-EOS5.1.10.tar.Z to HDF-EOS5.1.11.tar.Z
+#       20-May-2009 AT  Changed HDF-EOS5.1.11.tar.Z to HDF-EOS5.1.12.tar.Z
+#       20-Jul-2010 AT  Changed HDF-EOS5.1.12.tar.Z to HDF-EOS5.1.13.tar.Z
+#       16-Nov-2011 AT  Changed HDF-EOS5.1.13.tar.Z to HDF-EOS5.1.14.tar.Z
+#       27-Jan-2014 AT  Changed HDF-EOS5.1.14.tar.Z to HDF-EOS5.1.15.tar.Z
+#
+#-----------------------------------------------------------------------------
+
+this_script="`basename $0`"
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    if [ "$1" = "-n" ] ; then		# -n: suppress leading blank line
+        shift
+    else
+        echo ""
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+        fi
+    fi
+    
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+         echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function to prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$1" = -x ] ; then		# -x: eXpand shell variables
+        shift
+        expand_flag=1
+    else
+        expand_flag=0
+    fi
+
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+
+    read user_response
+
+    if [ $expand_flag = 1 ] ; then	# perform shell variable expansion
+        user_response=`echo $user_response | sed 's%~%$HOME%'`  # map ~ to $HOME
+        user_response=`eval echo $user_response`		# expand all
+    fi
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+#
+# Function to get the location of the distribution file
+#
+    
+GetDistribution()
+{    
+    : ${distrib_file:=HDF-EOS5.1.15.tar.Z}
+
+    ds1=$distrib_file			# backup copy
+    
+    # derive tar file name
+
+    case "$distrib_file" in
+
+      HDF-EOS5.1.14.tar.Z )
+        tar_file=HDF-EOS5.1.14.tar
+        HDFEOS5_home=hdfeos5
+        ;;
+
+      HDF-EOS5.1.15.tar.Z )
+        tar_file=HDF-EOS5.1.15.tar
+        HDFEOS5_home=hdfeos5
+        ;;
+
+      * )
+        EchoAndLog "HDFEOS5 version in $distrib_file not supported by this script."
+        exit 1
+        ;;
+
+    esac
+
+    
+    # set search path to include current dir, parent of current and $HOME    
+    search_path=`pwd`
+    search_path="$search_path `cd ..; pwd` $HOME"
+
+    # set search file to include compressed tar file and uncompressed tar file
+    search_file="$distrib_file $tar_file"
+
+    # search for the distribution file
+
+    found_file=0
+    for distrib_path in $search_path ; do
+
+        for distrib_file in $search_file ; do
+
+            if [ -f ${distrib_path}/${distrib_file} ] ; then
+                found_file=1
+                break
+            fi
+
+        done
+
+        if [ $found_file = 1 ] ; then
+            break
+        fi
+
+    done
+
+    # if file was not found, ask the user
+
+    if [ $found_file = 0 ] ; then
+
+	if [ $batch_mode = 0 ] ; then
+	    echo ""	
+	    UserPrompt -x "Pathname where $ds1 is located: "
+	    echo ""
+  	else
+	    user_response=""
+	fi
+    
+        if [ "$user_response" != "" ] ; then
+
+            # make sure directory exists
+
+            if [ -d $user_response ] ; then
+                distrib_path=$user_response
+            else 
+                WriteError "Invalid directory: $user_response"
+                exit 1
+            fi
+    
+            # search for the distribution file in user directory
+
+            for distrib_file in $search_file ; do
+
+                if [ -f ${distrib_path}/${distrib_file} ] ; then
+                    found_file=1
+                    break
+                fi
+
+            done
+
+        fi
+
+
+    fi
+
+
+    if [ $found_file = 0 ] ; then
+        WriteError "Can't find ${ds1} in (${search_path})"
+        echo "HDFEOS5 installation cancelled."
+        exit 1
+    fi
+
+}
+
+# 
+# Function to get the location of the HDFEOS home directory for installation
+# Also, prompt user that all information is valid before proceeding
+#
+
+GetInstallDir()
+{    
+    if [ "$HDFEOS5_path" = "" ] ; then
+	HDFEOS5_path="`pwd`"
+    fi
+    
+
+    # ask the user
+    
+    if [ $batch_mode = 0 ] ; then
+	UserPrompt -x "Pathname where directory hdfeos5 will be created [$HDFEOS5_path]: " 
+	echo ""
+    else
+	user_response=""
+    fi
+    
+    if [ "$user_response" = "" ] ; then
+        if [  ! -d `dirname $HDFEOS5_path`  ] ; then mkdir `dirname $HDFEOS5_path` ; fi
+        if [  ! -d $HDFEOS5_path  ] ; then  mkdir $HDFEOS5_path ; fi
+    else
+        if [ -d "$user_response" ] ; then HDFEOS5_path=$user_response ; fi
+    fi
+    
+    if [ ! -d $HDFEOS5_path ] ; then
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "$HDFEOS5_path does not exist.  Create [y]? "
+	else
+	    user_response=y
+	fi
+	if [ "$user_response" = "" ] ; then user_response="y" ; fi
+	case "$user_response" in
+	    y* | Y* )
+		mkdir -p $HDFEOS5_path
+		if [ ! -d $HDFEOS5_path ] ; then
+		    WriteError "Unable to create directory $HDFEOS5_path." 
+		    echo "HDFEOS5 installation cancelled." 2>&1
+		    exit 1
+		
+		fi
+		;;
+	    *)
+		WriteError "Directory $HDFEOS5_path does not exist." 
+		echo "HDFEOS5 installation cancelled." 2>&1
+		exit 1
+		;;
+        esac
+    fi
+    
+    
+    #
+    # confirm before proceeding
+    #
+    
+#    echo "The HDFEOS5 directory will be restored from: " 
+#    echo "    ${distrib_path}/${distrib_file}" 
+#    echo "" 
+    echo "The HDFEOS5 directory will be created in: " 
+    echo "     ${HDFEOS5_path}" 
+    echo "" 
+
+    if [ $batch_mode = 0 ] ; then
+	UserPrompt "Continue [yes] ? " 
+	case "$user_response" in
+	    n* | N* ) echo "Cancelled." ; exit 1 ;;
+	    * ) echo "Confirmed." ; echo "" ;;
+	esac
+    fi
+}
+
+#
+# Function to unpack the distribution file into the installation directory
+#
+
+UnpackDistribution()
+{
+    #
+    # Go to the HDFEOS parent directory
+    #
+    
+    cd $HDFEOS5_path
+
+    #
+    # If the new HDFEOS home directory already exits, it must
+    # be removed first.  Check with the user before proceeding.
+    #
+    
+    if [ -d "$HDFEOS5_home" ] ; then
+    
+        EchoAndLog "The directory $HDFEOS5_home already exists."
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "[O]verwrite, [R]e-use or [Q]uit (default) ? "
+	else
+	    user_response=r
+	fi
+
+        case "$user_response" in
+          o* | O* )
+            EchoAndLog "Removing old $HDFEOS5_home directory ..."
+            /bin/rm -rf $HDFEOS5_home
+            ;;
+    
+          r* | R* )
+            EchoAndLog "Installation will use existing $HDFEOS5_home directory."
+            return 0
+            ;;
+    
+          * )
+            EchoAndLog "Cancelled."
+            exit 1
+            ;;
+        esac
+    
+    fi
+    
+    
+    #
+    # Create a link to the distribution file, if necessary.
+    #
+
+    link_flag=0
+    if [ ! -f $distrib_file ] ; then
+        if [ -f ${distrib_path}/${distrib_file} ] ; then
+            ln -s ${distrib_path}/${distrib_file} ${distrib_file}
+            link_flag=1
+        fi
+    fi
+    
+    # 
+    # Uncompress the distribution file, (if needed), and extract the files
+    # 
+    
+    EchoAndLog "Extracting files from $distrib_file ..."
+
+    suffix="`echo $distrib_file |  sed 's/^.*\.//'`"
+    case $suffix in
+    
+      Z  )
+        zcat $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+
+      tar)
+        tar xvf $distrib_file | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+    
+    esac
+
+    #
+    # Clean up symbolic link, if present
+    #
+
+    if [ $link_flag = 1 ] ; then
+        /bin/rm -f $distrib_file
+    fi
+
+
+}
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+
+
+#
+# Get arguments from command line
+#
+
+home_file=""
+no_untar=0
+sgi_mode=32		# by default, SGI mode is standard 32-bit
+log_file=""
+distrib_file=""
+fc_path=""
+cc_path=""
+append=0
+dbug=0
+batch_mode=0
+ts_mode=0
+
+while [ "$1" != "" ]
+do
+    case $1 in
+
+      -h | -he  | -hel  | -help  ) Help ;;	# help
+
+      -sgi32) sgi_mode=n32 ;;
+      -sgi64) sgi_mode=64 ;;
+
+      -fc_path ) fc_path="$2" ; shift ;;
+
+      -cc_path ) cc_path="$2" ; shift ;;
+
+      -df) distrib_file="$2" ; shift ;;
+
+      -log )
+        if [ "$2" != "" ] ; then
+            if [ "` echo $2 | cut -c1`" = "/" ] ; then
+                log_file="$2"
+            else
+                log_file="$start_dir/$2"
+            fi
+            shift
+        else
+            WriteError "A log file must be specified with the -log option"
+            Help
+        fi
+        ;;
+
+      -append )
+        append=1
+        ;;
+
+      -dbug )
+        dbug=1
+        ;;
+
+       -ts) 
+	ts_mode=1
+	;;
+
+     -ts_dbug)
+	ts_mode=1
+	dbug=1
+	;;
+
+      -w_home )
+        if [ "$2" != "" ] ; then
+            if [ "` echo $2 | cut -c1`" = "/" ] ; then
+                home_file="$2"
+            else
+                home_file="$start_dir/$2"
+            fi
+            shift
+        else
+            WriteError "A file name must be specified with the -w_home option."
+            Help
+        fi
+        ;;
+
+      -install_dir )
+        if [ "$2" != "" ] ; then
+	    HDFEOS5_path=$2
+            shift
+        else
+            WriteError "No installation directory specified with -install_dir switch."
+            Help
+        fi
+        ;;
+
+	-batch )
+	    batch_mode=1
+	;;
+
+      -*)
+        echo "Invalid option: $1"
+        Help
+        ;;
+
+      *) 				# default
+        value1="$1"
+        ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Initialize the home file
+#
+
+if [ "$home_file" != "" ] ; then
+
+    if [ -f "$home_file" ] ; then 
+        /bin/rm -f $home_file > /dev/null 2>&1
+    fi
+
+    touch $home_file > /dev/null 2>&1
+    if [ $? != 0 ] ; then
+        WriteError "Cannot write to file $home_file"
+        exit 1
+    fi
+
+fi
+
+
+#
+# Get the location of the distribution file
+#
+HDFEOS5_home=.
+#GetDistribution
+
+
+#
+# Got valid distribution file
+# Get the location of the HDFEOS home directory for installation
+#
+
+GetInstallDir
+
+
+
+
+#
+# Unpack the distribution file into the installation directory
+#
+
+cd $HDFEOS5_path
+
+#if [ "$no_untar" = 0 ] ; then
+#    UnpackDistribution
+#fi
+
+
+#
+# Prepare to install the requested version of HDFEOS
+#
+
+if [ ! -d "$HDFEOS5_path" ] ; then
+    EchoAndLog "Error creating directory: $HDFEOS5_path"
+    exit 1
+fi
+
+cd $HDFEOS5_path/$HDFEOS5_home		# go to the starting directory
+
+EchoAndLog "Setting directory to: $HDFEOS5_path/$HDFEOS5_home"
+
+# HDF-EOS expects these directories to be in place, if they are not
+# then create them here.  If we have to do this then the INSTALL may
+# fail, but at least we're still one step ahead of the game
+
+if [ ! -d bin/$BRAND ] ; then
+        mkdir bin/$BRAND
+fi
+ 
+if [ ! -d obj/$BRAND ] ; then
+        mkdir obj/$BRAND
+fi
+ 
+if [ ! -d lib/$BRAND ] ; then
+        mkdir lib/$BRAND
+fi
+
+install_flags="-i$HDF5INC -l$HDF5LIB -szi$SZIPINC -szl$SZIPLIB"
+
+if [ $dbug = 1 ] ; then
+    if [ $ts_mode = 1 ] ; then
+	install_flags="$install_flags -ts_dbug"
+    else
+	install_flags="$install_flags -dbug"
+    fi
+else
+    if [ $ts_mode = 1 ] ; then
+	install_flags="$install_flags -ts"
+    else
+	install_flags="$install_flags"
+    fi
+fi
+
+case "$sgi_mode" in
+  n32)
+    install_flags="$install_flags -sgi32" ;;
+  64)
+    install_flags="$install_flags -sgi64" ;;
+esac
+
+if [ "$cc_path" != "" ] ; then 		# path for C compiler
+    install_flags="$install_flags -cc_path $cc_path"
+fi
+
+if [ "$fc_path" != "" ] ; then 		# path for FORTRAN compiler
+    install_flags="$install_flags -fc_path $fc_path"
+fi
+
+EchoAndLog "Running the HDFEOS5 installation script ..."
+
+return_status=0
+if [ "$log_file" != "" ] ; then
+
+    if [ $append = 1 ] ; then
+        bin/INSTALL-HDFEOS $install_flags >> $log_file 2>&1 # append
+        return_status=$?
+    else
+        bin/INSTALL-HDFEOS $install_flags > $log_file  2>&1 # clobber
+        return_status=$?
+    fi
+
+else
+
+    bin/INSTALL-HDFEOS $install_flags
+    return_status=$?
+
+fi
+
+
+# 
+# Pass back the HDF5 install directory for the toolkit installation
+# 
+
+if [ $return_status = 0 ] ; then
+
+    if [ "$home_file" != "" ] ; then
+      echo $HDFEOS5_path/$HDFEOS5_home >> $home_file
+    fi
+
+fi
+
+
+if [ $return_status != 0 ] ; then
+    echo "The HDFEOS5 Installation Script failed or had errors."
+    exit 1
+fi
+
+
diff --git a/bin/INSTALL-Scripts/INSTALL-JPEG b/bin/INSTALL-Scripts/INSTALL-JPEG
new file mode 100755
index 0000000..2363b84
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-JPEG
@@ -0,0 +1,1377 @@
+#! /bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-JPEG
+#
+# description:
+# 	JPEG installation script for the (PGS) Toolkit and hdfeos
+#
+# usage:
+# 	INSTALL-JPEG [-f90 [-NAG]] [-ABSOFT] [-fc_path <path/compiler_name>] 
+#                    [-cc_path <path/compiler_name>] 
+# 	             [-sgi32 | -sgi64] [-log <log-file> [-append]] 
+# 	             [-clean | -cleano] [-strip] [-w_home <file>]
+# 	             [-df <distribution-file>] [-batch]
+# 	             [-install_dir <base installation directory>]
+# 	INSTALL-JPEG [-h] 
+#
+# 	  -f90     : build JPEG FORTRAN modules using f90 
+# 	             optional flag -NAG specifies NAG f90
+#         -ABSOFT  : flag that specifies absoft f77 is used for fortran compilation
+# 	  -fc_path : set the path of the FORTRAN compiler to <path/compiler_name>
+# 	  -cc_path : set the path of the C compiler to <path/compiler_name>
+# 	  -sgi32   : build in -n32   mode (SGI Power Challenge only)
+# 	  -sgi64   : build in 64-bit mode (SGI Power Challenge only)
+# 	  -log     : sdone session output to new <log-file>
+# 	  -append  : append to existing <log-file>
+# 	  -clean   : run 'make clean' after doing the installation
+# 	  -cleano  : clean up all object and a.out files
+# 	  -strip   : strip out all non-installation files following install
+# 	  -w_home  : write JPEG home directory to <file>
+# 	  -df      : install JPEG from distribution file <distribution-file>
+# 	  -batch   : run script in batch (i.e. non-interactive) mode
+#         -install_dir : full path to top level directory where JPEG will be
+#                        installed (e.g. /usr/local/hdfeos/jpeg/sgi64)
+# 	  -h       : display this help message and exit
+#
+# notes:
+# 	1)  The use of the -clean option will cause the JPEG utilites to 
+# 	    be deleted.  To preserve them, use the -cleano option instead.
+# 
+# 	2)  The -f90 and -NAG options are  * * NOT IMPLEMENTED  * * 
+# 	    Currently, these options are accepted, but ignored.
+# 	    
+#
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        Megan E. Donovan Spencer / SM&AE
+#        Abe Taaheri / SM&AE
+#        Phuong T Nguyen / L3 Communication GSI.
+#        Adura Adekunjo /L3 Communication GSI.
+# history:
+#       11-May-1995 MES Initial version
+#       20-Oct-2003 AT  Used INSTALL-HDF5 as template for INSTALL-SZIP 
+#       26-Mar-2004 AA  Used INSTALL-SZIP as template for INSTALL-JPEG
+#-----------------------------------------------------------------------------
+
+#
+# Save starting directory, path
+# Create error message header
+#
+
+start_dir=`pwd`
+start_path=$PATH
+this_script="`basename $0`"
+script_error="$this_script: Error:"
+
+#
+# Get absolute pathname where this script is located
+# This allows the script to locate any needed auxilliary files
+#
+
+script_dir="`dirname $0`"
+abs="`echo $script_dir | cut -c1`"
+if [ "$abs" != "/" ] ; then
+    script_dir="`cd $script_dir;pwd`"
+fi
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    echo ""
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+        echo "" >> $log_file
+        echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to set up and export the following architecture-specific variables:
+#
+#         BRAND HOST LOGNAME OSTYPE PATH USER
+#
+
+
+SetArchitecture()
+{
+    # set path to a base subset of directories, allowing startup on unknown host
+    # note: once the architecture has been determined the path is customized
+    
+    PATH=/usr/local/bin:/usr/bin:/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11
+    
+    
+    # get operating system type, login name
+    # special cases: SCO and Cray  - uname works differently,
+    
+    machine=`uname -m | awk '{print $1}'`	# needed on Cray & SCO
+    temp_ostype=`uname`
+
+    case "$machine" in
+    
+      i386 )        			# SCO box
+    	OSTYPE=sco386
+        ;;
+    
+      CRAY )    				# CRAY
+    	OSTYPE=UNICOS
+        ;;
+    
+      * )					# everybody else
+    	OSTYPE=`uname`
+        ;;
+    
+    esac
+    # Intel Macintosh is also i386 or i686 (?) machine
+
+    if [ "$machine" = "i386" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	fi
+	if [ "`uname | awk -F_ '{print $1}'`" = "CYGWIN" ] ; then 
+	    OSTYPE=Cygwin
+	fi
+    fi
+    if [ "$machine" = "i686" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	fi
+	if [ "`uname | awk -F_ '{print $1}'`" = "CYGWIN" ] ; then 
+	    OSTYPE=Cygwin
+	fi
+    fi
+   if [ "$machine" = "x86_64" ] || [ "$machine" = "ia64" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	    if [ "$MAC_BRAND" = "" ] ; then 
+		echo " Error: In 64-bit MAC platform the env. variable MAC_BRAND must be set to mac32 or mac64 before running this script."
+		exit 1
+	    fi
+	else
+	    if [ "$LINUX_BRAND" = "" ] ; then 
+		echo " Error: In 64-bit linux platform the env. variable LINUX_BRAND must be et to linux32 or linux64 before running this script."
+		exit 1
+	    fi
+	fi
+    fi
+
+    user=`id | cut -d\( -f2 | cut -d\) -f1`
+    if [ "$LOGNAME" = "" ] ; then 		# make sure $LOGNAME is defined
+        LOGNAME=$user	
+    fi
+    USER=$LOGNAME				# make sure $USER is defined
+    
+    
+    # set machine-depdoneent environment variables:
+    # 	HOST  the host name of this machine
+    # 	BRAND used by other achitecture-specific code
+    # 	path  the execution search path exported to PATH
+    
+    case "$OSTYPE" in
+    
+      AIX ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/ccs/bin:/usr/sbin
+    	HOST=`hostname`
+    	BRAND=ibm
+        CC=cc
+        CFLAGS="-O"
+        F77=xlf
+        ;;
+    
+      HP-UX ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bin/X11:/tools/bin
+    	HOST=`hostname`
+    	BRAND=hp 
+        CC=cc
+        CFLAGS="-O"
+        F77=fort77
+        ;;
+    
+      IRIX )  
+    	PATH=/usr/local/bin:/usr/bin:/bin:/etc:/usr/etc:/usr/bsd:/usr/bin/X11:/usr/sbin
+    	HOST=`hostname`
+    	BRAND=sgi 
+        CC=cc
+        CFLAGS="-O"
+        F77=f77
+        ;;
+    
+      IRIX64 )  
+        PATH=/usr/local/bin:/usr/bin:/bin:/etc:/usr/etc:/usr/bsd:/usr/bin/X11:/usr/sbin
+        HOST=`hostname`
+        case "$sgi_mode" in
+          32  )  BRAND=sgi   ; CC="cc -32 -mips2"  ; F77="f77 -32 -mips2"  ;;
+          n32 )  BRAND=sgi32 ; CC="cc -n32 -mips3" ; F77="f77 -n32 -mips3"  ;;
+          64  )  BRAND=sgi64 ; CC="cc -64 -mips4"  ; F77="f77 -64 -mips4"  ;;
+          *   )  BRAND=sgi   ; CC="cc"  ; F77="f77"  ;;
+        esac
+        CFLAGS="-O"
+        set_compilers=0		# override JPEG default compilers
+        ;;
+    
+      Linux )
+	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/X11/bin
+	HOST=`hostname -s`
+	BRAND=linux
+	if [ "$LINUX_BRAND" = "linux64" ] ; then
+	    BRAND=linux64
+	elif [ "$LINUX_BRAND" = "linux32" ] ; then
+	    BRAND=linux32
+	fi
+        CC="gcc $LNX_COMP_FLAG"
+        CFLAGS="-O"
+        F77="g77 $LNX_COMP_FLAG"
+	;;
+
+      Darwin )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname -s`
+        BRAND=macintosh
+        CC=gcc
+        CFLAGS="-O"
+        F77=g77
+        ;;
+
+      DarwinIntel )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname -s`
+        BRAND=macintel32
+	if [ "$MAC_BRAND" = "macintel64" ] ; then
+	    BRAND=macintel64
+	elif [ "$MAC_BRAND" = "macintel32" ] ; then
+	    BRAND=macintel32
+	fi
+        CC="gcc $MACINTEL_COMP_FLAG"
+        CFLAGS="-O2"
+        F77="gfortran $MACINTEL_COMP_FLAG"
+        ;;
+
+      Cygwin )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname`
+        BRAND=cygwin
+        CC=gcc
+        CFLAGS="-O"
+        F77=g77
+        ;;
+
+      OSF1 )  
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/ccs/bin:/usr/sbin
+    	HOST=`hostname -s`
+    	BRAND=dec 
+        CC=cc
+        CFLAGS="-O -std"
+        F77=f77
+        ;;
+    
+      sco386 ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bin/X11
+    	HOST=`hostname -s`
+    	BRAND=sco 
+        CC=cc
+        CFLAGS="-O"
+        F77=f77
+        ;;
+    
+      SunOS ) 
+    	# distinguish between SunOS 5.x and 4.x versions
+    	if [ `uname -r | awk -F. '{print $1}'` = "5" ] ; then
+	    BRAND="sun5"                        # release V5.x SunOS
+            PATH=/usr/local/bin:/opt/SUNWspro/bin:/bin:/usr/ucb:/usr/bin:/etc:/usr/etc:/usr/openwin/bin:/usr/openwin/demo
+:/usr/ccs/bin:/usr/sbin
+            CC=cc
+            CFLAGS="-O"
+            F77=f77
+	    if [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 10" ] ; then
+		BRAND=sun5.10			# release V5.10 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/ccs/bin:/usr/sbin
+		CC=cc
+		CFLAGS="-O"
+		F77=f77
+	    elif [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 9" ] ; then
+		BRAND=sun5.9			# release V5.9 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/ccs/bin:/usr/sbin
+		CC=cc
+		CFLAGS="-O"
+		F77=f77
+	    elif [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 8" ] ; then
+		BRAND=sun5.8			# release V5.8 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/ccs/bin:/usr/sbin
+		CC=cc
+		CFLAGS="-O"
+		F77=f77
+	    fi
+    	else
+            BRAND=sun4			# release V4.x SunOS
+    	    PATH=/usr/local/bin:/usr/local/lang:/usr/lang:/bin:/usr/ucb:/usr/bin:/etc:/usr/etc:/usr/openwin/bin:/usr/openwin/demo
+            CC=acc
+            CFLAGS="-O"
+            F77=f77
+            set_compilers=1		# override JPEG default compilers
+    	fi
+    	HOST=`hostname`
+        ;;
+    
+      UNICOS ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/ucb:/usr/bin/X11
+    	HOST=`hostname`
+    	BRAND=cray 
+        CC=cc
+        CFLAGS="-O"
+        F77=cf77
+        ;;
+    
+      * )
+    	echo "Operating system: $OSTYPE not supported" 	>&2
+    	echo "This release of the Toolkit and hdfeos supports: " 	>&2
+    	echo "   Sun, SGI HP-9000 IBM-6000 DEC-Alpha  Linux Macintosh and Cray/Unicos " 	>&2
+        exit 1
+        ;;
+    
+    esac
+
+
+    # if debug version was requested replace -O with -g in CFLAGS
+
+    if [ "$dbug" = "1" ] ; then
+	CFLAGS=`echo $CFLAGS | sed 's/-O/-g/'`
+    fi
+
+    CFLAGS="$CFLAGS $EXT_CC_FLAGS"
+
+    # export the architecture-specific variables
+
+    export BRAND HOST LOGNAME OSTYPE PATH USER
+    export CC CFLAGS F77
+    
+}
+
+
+#
+# Function to allow user to override the defaults for the compilers
+# The following variables are affected:
+#
+#         PATH CC F77
+#
+
+UserCompilers()
+{
+    #
+    # check to see if valid C compiler path was specified
+    #
+    
+    cc=""
+    
+    if [ "$cc_path" != ""  ] ; then
+    
+        if [ -f $cc_path ] ; then
+    
+            cc=`basename $cc_path`
+            cc_path=`echo $cc_path | sed 's%/[^/]*/*$%%'`
+	    case "$BRAND" in
+		"sgi32" )
+		    CC="$cc_path/$cc -n32"
+		;;
+
+		"sgi64" )
+		    cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+		    if [ "$cpu_type" == "4" ] ; then
+			CC="$cc_path/$cc -64 -mips3"
+		    else
+			CC="$cc_path/$cc -64 -mips4"
+		    fi
+		;;
+
+		"linux" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"linux32" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"linux64" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"macintel" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel32" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;; 
+
+		"macintel64" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;; 
+
+		* )
+		    CC="$cc_path/$cc"
+		;; 
+	    esac
+
+	    export CC		# user overrides C compiler name
+	    set_compilers=1		# override HDF default compilers
+    
+	fi
+    
+        if [ -d $cc_path ] ; then	# make sure cc_path is now a directory
+    
+            PATH=${cc_path}:${PATH} 	# prepend cc_path to search path
+            export PATH
+    
+        else
+    
+            cc_path=""
+            echo "Warning: C compiler directory $cc_path not found."
+            echo  "JPEG build may fail."
+    
+        fi
+    
+    fi
+    
+    
+    #
+    # check to see if valid FORTRAN compiler path was specified
+    #
+    
+    fc=""
+    
+    if [ "$fc_path" != "" ] ; then
+    
+        if [ -f $fc_path ] ; then
+    
+            fc=`basename $fc_path`
+            fc_path=`echo $fc_path | sed 's%/[^/]*$%%'`
+	    case "$BRAND" in
+		"sgi32" )
+		    F77="$fc_path/$fc -n32"
+		;;
+
+		"sgi64" )
+		    cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+		    if [ "$cpu_type" == "4" ] ; then
+			F77="$fc_path/$fc -64 -mips3"
+		    else
+			F77="$fc_path/$fc -64 -mips4"
+		    fi
+		;;
+
+		"linux" )
+		    F77="$fc_path/$fc $LNX_COMP_FLAG"
+		;; 
+
+		"linux32" )
+		    F77="$fc_path/$fc $LNX_COMP_FLAG"
+		;; 
+
+		"linux64" )
+		    F77="$fc_path/$fc $LNX_COMP_FLAG"
+		;;
+
+		"macintel" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel32" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel64" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		* )
+		    F77="$fc_path/$fc" 
+		;; 
+	    esac
+
+    #        if [ "$fc" != f90 ] ; then	# (f90 not supported for HDF4.1r1)
+    # f90 is supported starting with the HDF4.1r2 release
+                export F77	# user overrides FORTRAN compiler name
+                set_compilers=1		# override HDF default compilers
+    #        fi
+    
+        fi
+    
+        if [ -d $fc_path ] ; then	# make sure fc_path is now a directory
+    
+            PATH=${fc_path}:${PATH} 	# prepend fc_path to search path
+            export PATH
+    
+        else
+    
+            fc_path=""
+            echo "Warning: FORTRAN directory $fc_path not found."
+            echo  "JPEG build may fail."
+    
+        fi
+    
+    fi
+    
+}
+
+
+
+#
+# Function to get the location of the distribution file
+#
+    
+GetDistribution()
+{    
+    : ${distrib_file:=jpegsrc.v6b.tar.gz}
+
+    ds1=$distrib_file			# backup copy
+    
+    # derive tar file name
+
+    case "$distrib_file" in
+
+      jpegsrc.v6b.tar.gz  )
+        tar_file=jpegsrc.v6b.tar
+        jpeg_home=jpeg-6b
+        ;;
+
+      * )
+        EchoAndLog "JPEG version in $distrib_file not supported by this script."
+        exit 1
+        ;;
+
+    esac
+
+    
+    # set search path to include current dir, parent of current and $HOME    
+    search_path=`pwd`
+    search_path="$search_path `cd ..; pwd` $HOME"
+
+    # set search file to include compressed tar file and uncompressed tar file
+    search_file="$distrib_file $tar_file"
+
+    # search for the distribution file
+
+    found_file=0
+    for distrib_path in $search_path ; do
+
+        for distrib_file in $search_file ; do
+
+            if [ -f ${distrib_path}/${distrib_file} ] ; then
+                found_file=1
+                break
+            fi
+
+        done
+
+        if [ $found_file = 1 ] ; then
+            break
+        fi
+
+    done
+
+    # if file was not found, ask the user
+
+    if [ $found_file = 0 ] ; then
+
+	if [ $batch_mode = 0 ] ; then
+	    echo ""	
+	    UserPrompt "Pathname where $ds1 is located: "
+	    echo ""
+  	else
+	    user_response=""
+	fi
+    
+        if [ "$user_response" != "" ] ; then
+
+            # make sure directory exists
+
+            if [ -d $user_response ] ; then
+                distrib_path=$user_response
+            else 
+                WriteError "Invalid directory: $user_response"
+                exit 1
+            fi
+    
+            # search for the distribution file in user directory
+
+            for distrib_file in $search_file ; do
+
+                if [ -f ${distrib_path}/${distrib_file} ] ; then
+                    found_file=1
+                    break
+                fi
+
+            done
+
+        fi
+
+
+    fi
+
+
+    if [ $found_file = 0 ] ; then
+        WriteError "Can't find ${ds1} in (${search_path})"
+        echo "JPEG installation cancelled."
+        exit 1
+    fi
+
+}
+
+
+# 
+# Function to get the location of the JPEG home directory for installation
+# Also, prompt user that all information is valid before proceeding
+#
+
+GetInstallDir()
+{
+    default_JPEG_path="`pwd`/jpeg/$BRAND"
+
+    if [ "$JPEG_path" = "" ] ; then
+	JPEG_path="`pwd`/jpeg/$BRAND"
+    fi
+
+    # ask the user
+
+    if [ $batch_mode = 0 ] ; then
+	UserPrompt "Pathname where directory '$jpeg_home' will be created [$JPEG_path]: " 
+	echo ""
+    else
+	user_response=""
+    fi
+    
+    if [ "$user_response" = "" ] ; then
+        if [  ! -d `dirname $JPEG_path`  ] ; then mkdir `dirname $JPEG_path` ; fi
+        if [  ! -d $JPEG_path  ] ; then  mkdir $JPEG_path ; fi
+    else
+#        if [ -d "$user_response" ] ; then 
+	JPEG_path=$user_response ; #fi
+    fi
+
+    if [ ! -d $JPEG_path ] ; then
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "$JPEG_path does not exist.  Create [y]? "
+	else
+	    user_response=y
+	fi
+	if [ "$user_response" = "" ] ; then user_response="y" ; fi
+	case "$user_response" in
+	    y* | Y* )
+		mkdir -p $JPEG_path
+		if [ ! -d $JPEG_path ] ; then
+		    WriteError "Unable to create directory $JPEG_path." 
+		    echo "JPEG installation cancelled." 2>&1
+		    exit 1
+		
+		fi
+		;;
+	    *)
+		WriteError "Directory $JPEG_path does not exist." 
+		echo "JPEG installation cancelled." 2>&1
+		exit 1
+		;;
+        esac
+    fi
+    
+    
+    #
+    # confirm before proceeding
+    #
+    
+    echo "The JPEG directory will be restored from: " 
+    echo "    ${distrib_path}/${distrib_file}" 
+    echo "" 
+    echo "The JPEG directory will be created in: " 
+    echo "     ${JPEG_path}" 
+    echo "" 
+
+    if [ $batch_mode = 0 ] ; then
+	UserPrompt "Continue [yes] ? " 
+	case "$user_response" in
+	    n* | N* ) echo "Cancelled." ; exit 1 ;;
+	    * ) echo "Confirmed." ; echo "" ;;
+	esac
+    fi
+
+#
+# For linux create soft links if default JPEG installation directory is used
+#
+    save_dir="`pwd`"
+    if [ "`pwd`/jpeg/$BRAND" = "$default_JPEG_path" ] ;then
+	if [ "$BRAND" = "linux64" ] ; then
+	    cd ${default_JPEG_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "64-bit structure is the default in this machine. Creating $current_path/linux as a soft link to $default_JPEG_path"
+	    ln -s ./linux64 linux
+ 	    cd $save_dir
+	fi
+
+	if [ "$BRAND" = "linux" ] ; then
+	    cd ${default_JPEG_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "32-bit structure is the default in this machine. Creating $current_path/linux32 as a soft link to $default_JPEG_path"
+	    ln -s ./linux linux32
+ 	    cd $save_dir
+	fi
+    fi
+
+#
+# For macintel create soft links if default JPEG installation directory is used
+#
+    save_dir="`pwd`"
+    if [ "`pwd`/jpeg/$BRAND" = "$default_JPEG_path" ] ;then
+	if [ "$BRAND" = "macintel32" ] ; then
+	    cd ${default_JPEG_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "macintel32 directories will be soft linked to macintel. Creating $current_path/macintel as a soft link to $default_JPEG_path"
+	    ln -s ./macintel32 macintel
+ 	    cd $save_dir
+	fi
+
+	if [ "$BRAND" = "macintel" ] ; then
+	    cd ${default_JPEG_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "macintel32 directories will be soft linked to macintel. Creating $current_path/macintel32 as a soft link to $default_JPEG_path"
+	    ln -s ./macintel macintel32
+ 	    cd $save_dir
+	fi
+    fi
+
+}
+
+
+#
+# Function to unpack the distribution file into the installation directory
+#
+
+UnpackDistribution()
+{
+    #
+    # Go to the JPEG parent directory
+    #
+    
+    cd $JPEG_path
+
+    #
+    # If the new JPEG home directory already exits, it must
+    # be removed first.  Check with the user before proceeding.
+    #
+    
+    if [ -d "$jpeg_home" ] ; then
+    
+        EchoAndLog "The directory $jpeg_home already exists."
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "Replace it [no] ? "
+	else
+	    user_response=y
+	fi
+
+        case "$user_response" in
+          y* | Y* )
+            EchoAndLog "Removing old $jpeg_home directory ..."
+            /bin/rm -rf $jpeg_home
+            ;;
+    
+          * )
+            EchoAndLog "Cancelled."
+            exit 1
+            ;;
+        esac
+    
+    fi
+    
+    
+    #
+    # Create a link to the distribution file, if necessary.
+    #
+
+    link_flag=0
+    if [ ! -f $distrib_file ] ; then
+        if [ -f ${distrib_path}/${distrib_file} ] ; then
+            ln -s ${distrib_path}/${distrib_file} ${distrib_file}
+            link_flag=1
+        fi
+    fi
+    
+    # 
+    # Uncompress the distribution file, (if needed), and extract the files
+    # 
+    
+    EchoAndLog "Extracting files from $distrib_file ..."
+
+    suffix="`echo $distrib_file |  sed 's/^.*\.//'`"
+    case $suffix in
+    
+      Z  )
+        zcat $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+
+      gz )
+	gzip -cd $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+#        GnuZcat
+#        if [ $gnu_zcat != 1 ] ; then
+#            WriteError "You need the GNU version of zcat to unpack this file."
+#            exit 1
+#        fi
+#         zcat $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+
+      tar)
+        echo $distrib_file
+        tar -xvf $distrib_file | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+    
+    esac
+
+    #
+    # Clean up symbolic link, if present
+    #
+
+    if [ $link_flag = 1 ] ; then
+        /bin/rm -f $distrib_file
+    fi
+
+
+}
+
+
+#
+# See if zcat is GNU version
+#
+
+GnuZcat()
+{
+    if [ "$1" = "" ] ; then
+        zcat_cmd=zcat
+    else
+        zcat_cmd=$1
+    fi
+    
+    buf=`exec 2>&1; $zcat_cmd < /dev/null | tail -1` 
+    buf=`echo $buf | awk -F: '{print $1}'`
+    
+    case "$buf" in
+      zcat) gnu_zcat=1 ;;
+      *   ) gnu_zcat=0 ;;
+    esac
+}
+
+
+#
+# Strip all JPEG distribution files not needed after installation.
+#
+
+StripHdfInstall()
+{
+    cd $JPEGHOME
+
+    here=`pwd`
+    here=`basename $here`
+
+    #
+    # Make sure this is a valid JPEG directory befor clobbering files !
+    # 
+
+    if [ "`echo $here | grep '^JPEG'`" = "" ] ; then
+    
+        EchoAndLog "Not a valid JPEG directory: no files removed."
+        
+    else
+
+        EchoAndLog "Removing all non-installation JPEG files ..."
+
+        for file in * ; do
+
+            if [ -d "$file" ] ; then
+    
+                case "$file" in 
+        
+                  bin | lib | include | man ) ;;
+                  * ) rm -rf $file ;;
+              
+                esac
+        
+            else
+    
+                rm -f $file
+        
+            fi
+    
+        done
+        
+    fi
+}
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+
+
+#
+# Get arguments from command line
+#
+
+log_file=""
+home_file=""
+noquery=0
+clean=0
+cleano=0
+strip_install=0
+append=0
+no_untar=0
+sgi_mode=32
+f90_flag=0
+nag_flag=0
+absoft_flag=0
+fc_path=""
+cc_path=""
+distrib_file=""
+set_compilers=0
+dbug=0
+JPEG_path=""
+batch_mode=0
+
+while [ "$1" != "" ] ; do 
+
+    case "$1" in
+
+      -h )
+        Help
+        ;;
+
+      -f90 )
+        f90_flag=1
+        ;;
+
+      -NAG )
+        if [  $f90_flag = 0  ] ; then
+            WriteError "Must first specify -f90 and set compiler path."
+            Help
+        else
+            nag_flag=1
+        fi
+        ;;
+
+      -ABSOFT )
+	    absoft_flag=1
+	;;
+
+      -fc_path )
+        fc_path="$2"
+        shift
+        ;;
+
+      -cc_path )
+        cc_path="$2"
+        shift
+        ;;
+
+      -df)
+        distrib_file="$2"
+        shift
+        ;;
+
+      -sgi32 )
+        sgi_mode=n32
+        ;;
+
+      -sgi64 )
+        sgi_mode=64
+        ;;
+
+      -log )
+        if [ "$2" != "" ] ; then
+            if [ "` echo $2 | cut -c1`" = "/" ] ; then
+                log_file="$2"
+            else
+                log_file="$start_dir/$2"
+            fi
+            shift
+        else
+            WriteError "A log file must be specified with the -log option."
+            Help
+        fi
+        ;;
+
+      -append )
+        append=1
+        ;;
+
+      -w_home )
+        if [ "$2" != "" ] ; then
+            if [ "` echo $2 | cut -c1`" = "/" ] ; then
+                home_file="$2"
+            else
+                home_file="$start_dir/$2"
+            fi
+            shift
+        else
+            WriteError "No file specified with -w_home switch."
+            Help
+        fi
+        ;;
+
+      -nq | -noquery )
+        noquery=1
+        ;;
+
+      -clean )
+        clean=1
+        ;;
+
+      -cleano )
+        cleano=1
+        ;;
+
+      -strip )
+        strip_install=1
+        ;;
+
+      -no_untar )
+        no_untar=1
+        ;;
+
+      -install_dir )
+        if [ "$2" != "" ] ; then
+	    JPEG_path=$2
+            shift
+        else
+            WriteError "No installation directory specified with -install_dir switch."
+            Help
+        fi
+        ;;
+
+	-batch )
+	    batch_mode=1
+	;;
+
+      * )
+        echo "$script_error invalid argument '$1'"
+        Help
+        ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Inititialize log file
+#
+
+if [ "$log_file" != "" ] ; then
+
+    if [ "$append" = "0" ] ; then
+        if [ -f "$log_file" ] ; then 
+            /bin/rm  -f $log_file > /dev/null 2>&1
+        fi
+    fi
+
+    touch $log_file > /dev/null 2>&1
+    if [ $? != 0 ] ; then
+        WriteError "Cannot write to file $log_file"
+        exit 1
+    fi
+
+    echo ""
+    echo "`basename $0`: session output will go to file: "
+    echo ""
+    echo "     $log_file"
+    echo ""
+
+fi
+
+export log_file
+
+#
+# Initialize the home file
+#
+
+if [ "$home_file" != "" ] ; then
+
+    if [ -f "$home_file" ] ; then 
+        /bin/rm -f $home_file > /dev/null 2>&1
+    fi
+
+    touch $home_file > /dev/null 2>&1
+    if [ $? != 0 ] ; then
+        WriteError "Cannot write to file $home_file"
+        exit 1
+    fi
+
+fi
+
+
+#
+# Set architecture-specific variables
+#
+
+SetArchitecture
+
+
+#
+# Set user compiler overrides
+#
+
+UserCompilers
+
+
+#
+# Get the location of the distribution file
+#
+
+GetDistribution
+
+
+#
+# Got valid distribution file
+# Get the location of the JPEG home directory for installation
+#
+
+GetInstallDir
+
+
+#
+# Write the log file header
+#
+
+if [ "$log_file" != "" ] ; then
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "JPEG installation starting at: `date`" >> $log_file
+    echo "host: $HOST    type: $BRAND     user: $USER " >> $log_file
+    echo "" >> $log_file
+    echo "" >> $log_file
+    echo "The JPEG directory will be restored from: " >> $log_file
+    echo "    ${distrib_path}/${distrib_file}" >> $log_file
+    echo "" >> $log_file
+    echo "The JPEG directory will be created in: " >> $log_file
+    echo "     ${JPEG_path}" >> $log_file
+    echo "" >> $log_file
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "" >> $log_file
+fi
+
+
+#
+# Unpack the distribution file into the installation directory
+#
+
+    cd $JPEG_path
+
+    if [ "$no_untar" = 0 ] ; then
+        UnpackDistribution
+    fi
+
+
+#
+# Prepare to install the requested version of JPEG
+#
+
+if [ ! -d $jpeg_home ] ; then
+    EchoAndLog "Error creating directory: $jpeg_home"
+    exit 1
+fi
+
+cd $jpeg_home				# go to the starting directory
+
+jpeg_install_caller="$this_script"	# set caller flag for sub-modules
+export jpeg_install_caller
+
+
+#
+# Set the version to be installed
+#
+
+install_script=""
+install_options=""
+
+case $jpeg_home in
+
+  jpeg-6b )
+
+    JPEGHOME=${JPEG_path}/jpeg-6b ; export JPEGHOME
+    install_script="$script_dir/INSTALL-JPEGSRC.v6b"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${JPEGHOME}"
+    ;;
+
+  * ) 			# unsupported
+    EchoAndLog "$jpeg_home installation is not supported by this script."
+    exit 1
+    ;;
+
+esac
+
+
+#
+# Run the install script
+#
+
+if [ ! -f $install_script ] ; then
+    EchoAndLog "Can't find $install_script - installation failed."
+    exit 1
+fi
+
+$install_script $install_options
+
+if [ $? != 0 ] ; then
+    EchoAndLog "$jpeg_home Installation failed."
+    exit 1
+fi
+
+
+# 
+# Pass back the JPEG install directory for the hdfeos installation
+# 
+
+if [ "$home_file" != "" ] ; then
+    echo $JPEGHOME >> $home_file
+fi
+
+
+
+#
+# Clean up
+#
+
+cd $JPEG_path
+
+if [ "$clean" = 1 ] ; then
+
+    for dir in $JPEGHOME ; do 
+
+        cd $dir
+        echo "Cleaning up in $dir ..."
+
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+            echo "Cleaning up in $dir ..." >> $log_file
+            echo "" >> $log_file
+            make clean  >> $log_file 2>&1
+        else
+            make clean
+        fi
+
+    done
+
+fi
+
+if [ "$cleano" = 1 ] ; then
+
+    cd $JPEGHOME
+    echo "Removing any remaining object files ..." 
+
+    if [ "$log_file" != "" ] ; then
+        echo "" >> $log_file
+        echo "Removing any remaining object files ..." >> $log_file
+        echo "" >> $log_file
+        find . -name \*.o -print -exec rm -f {} \; >> $log_file 2>&1
+        find . -name a.out -print -exec rm -f {} \; >> $log_file 2>&1
+    else
+        find . -name \*.o -print -exec rm -f {} \; 
+        find . -name a.out -print -exec rm -f {} \; 
+    fi
+    
+fi
+
+
+if [ "$strip_install" = 1 ] ; then
+
+    StripHdfInstall
+   
+fi
+
+#
+# Mac and MacIntel have problems with libjpeg table; run ranlib
+#
+
+if [ "$BRAND" = "macintosh" ] || [ "$BRAND" = "macintel" ]  || [ "$BRAND" = "macintel32" ] || [ "$BRAND" = "macintel32" ]; then
+   ranlib $JPEGHOME/lib/libjpeg.a
+fi
+
+
+echo "------------------------------------------------------------"
+echo ""
+echo "    JPEG installation ending at: `date` " 
+echo ""
+echo "------------------------------------------------------------"
+
+
+
+#
+# Write the log file trailer
+#
+
+if [ "$log_file" != "" ] ; then
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "    JPEG installation ending at: `date`" >> $log_file
+    echo "" >> $log_file
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+fi
+
diff --git a/bin/INSTALL-Scripts/INSTALL-JPEGSRC.v6b b/bin/INSTALL-Scripts/INSTALL-JPEGSRC.v6b
new file mode 100755
index 0000000..e1cb7bd
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-JPEGSRC.v6b
@@ -0,0 +1,595 @@
+#! /bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-JPEGSRC.v6b
+#
+# description:
+# 	Installation script module for installing JPEG-6b
+# 	for the SDP (PGS) Toolkit and hdfeos.  
+#       It implements patches to the NCSA 
+# 	installation procedure to allow for trouble-free installation on
+# 	the platforms supported by the SDP (PGS) Toolkit and hdfeos.
+#
+# usage:
+# 	Called from INSTALL-JPEG
+#
+# 	INSTALL-JPEGSRC.v6b -h[elp]
+#
+# 	  -h      : display this help message and exit
+# 	  -dbug   : install debug version of ZLIB 
+#
+# notes:
+# 	This is NOT a standalone script.  It is only intended to be run
+# 	by INSTALL-ZLIB, the ZLIB installation script.
+# 
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        Abe Taaheri / L-3 comm. GSI
+#        Adura Adekunjo / L-3 comm. GSI
+#
+# history:
+#       26-Mar-2004 AA  Used INSTALL-SZIP1.1 as template for INSTALL-JPEGSRC.v6b 
+#-----------------------------------------------------------------------------
+
+
+#
+# Save starting directory, path
+# Create error message header
+#
+
+start_dir=`pwd`
+start_path=$PATH
+this_script="`basename $0`"
+script_error="$this_script: Error:"
+
+#
+# Get absolute pathname where this script is located
+# This allows the script to locate any needed auxilliary files
+#
+
+script_dir="`dirname $0`"
+abs="`echo $script_dir | cut -c1`"
+if [ "$abs" != "/" ] ; then
+    script_dir=`cd $script_dir;pwd`
+fi
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    if [ "$1" = "-n" ] ; then		# -n: suppress leading blank line
+        shift
+    else
+        echo ""
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+        fi
+    fi
+    
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+         echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function to prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to silently emulate the 'which' command 
+#
+
+Which()
+{
+    if [ "$1" = "" ] ; then 
+        WriteError "Which() : Too few arguments." 
+        exit 1 
+    fi
+
+    saveifs="$IFS"
+    IFS=:
+    which_result=0
+    which_cmd=""
+    
+    for dir in $PATH;  do 
+        if [ -x $dir/$1 ] ; then 
+            which_result=1 
+            which_cmd=$dir/$1
+            break 
+        fi 
+    done
+    
+    IFS="$saveifs"
+}
+
+#
+# Function to set compilers, overriding the NCSA compiler defaults
+#
+    
+SetCompilers()
+{
+    #
+    # Set C compiler based on value of $CC
+    # Set C compilation flags based on value of $CFLAGS
+    # Set FORTRAN compiler based on value of $F77
+    # 
+    # NOTE: 
+    #     This is done recursively for ALL Makefiles because on some
+    #     platforms, the compiler variables are not inherited from the
+    #     the calling Makefile.
+
+
+    EchoAndLog "Overriding NCSA default compiler settings:"
+
+    files=`find . -name Makefile -print`
+
+    if [ "$CC" != "" ] ; then
+
+        if [ "$CFLAGS" = "" ] ; then
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+            for file in $files ; do
+            
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        else
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            if [ "$CFLAGS" = "-O" ] ; then
+                EchoAndLog -n "- setting C compilation flags to default"
+            else
+                EchoAndLog -n "- setting C compilation flags to '$CFLAGS'"
+            fi
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+           for file in $files ; do
+
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^CFLAGS/s/=.*$'"/= $CFLAGS/" |
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        fi
+
+    else
+
+        EchoAndLog "Warning: Environment variable(s) CC and/or F77 not set."
+        EchoAndLog "If CC is not set, the installation uses NCSA defaults."
+
+    fi
+
+}
+
+
+
+#
+# Function to do architecture-specific pre-configure fixes
+#
+    
+PreConfigure()
+{
+
+    cd $start_dir
+
+    if [ "$dbug" = "1" ] ; then
+	PreConfigFixes_dbug
+    fi
+
+    #
+    # Call architecture-specific functions
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) ;;
+    
+        hp    ) ;;
+    
+        ibm   ) ;;
+
+        linux ) ;;
+
+        linux32 ) ;;
+
+        linux64 ) ;;
+
+        macintosh ) ;;
+ 
+        macintel ) ;;
+
+        macintel32 ) ;;
+
+        macintel64 ) ;;
+
+	cygwin ) ;;
+   
+        sgi   ) ;;
+    
+        sgi32 ) ;;
+
+        sgi64 ) ;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+    
+        sun5.9  ) ;;
+    
+        sun5.10  ) ;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    cd $start_dir
+
+}
+
+
+#
+# Function to do architecture-specific post-configure fixes
+#
+    
+PostConfigure()
+{
+    cd $start_dir
+    
+    
+    #
+    # Check for missing tbl and neqn, patching as needed
+    #
+
+#    PostConfigFixes_NoTblNeqn
+
+
+    #
+    # Do architecture-specific fixes
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) ;;
+    
+        hp    ) ;;
+    
+        ibm   ) ;;
+
+        ibm   ) ;;
+
+        linux ) ;;
+
+        linux32 ) ;;
+
+        linux64 ) ;;
+
+        macintosh ) ;;
+
+        macintel ) ;;
+
+        macintel32 ) ;;
+
+        macintel64 ) ;;
+
+	cygwin ) ;;
+   
+        sgi   ) ;;
+    
+        sgi32 ) ;;
+
+        sgi64 ) ;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+    
+        sun5.9  ) ;;
+    
+        sun5.10  ) ;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    
+    #
+    # If requested, set compilers to something other than the defaults
+    #
+
+    if [ $set_compilers = 1 ] ; then
+        SetCompilers
+    fi
+
+    cd $start_dir
+}
+
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+#
+# Get arguments from command line
+#
+
+set_compilers=0
+config_flags=""
+dbug=0
+
+while [ "$1" != "" ] ; do 
+
+    case "$1" in
+
+      -h | help ) Help ;;
+
+      -set_compilers ) set_compilers=1 ;;
+
+      -dbug ) dbug=1 ;;
+
+      -start_dir ) 
+          if [ "$2" != "" ] ; then
+              start_dir=$2
+              shift
+          else
+              WriteError "No installation directory specified with -start_dir switch."
+              Help
+          fi
+        ;;
+
+
+      * ) echo "$script_error invalid argument '$1'" ; Help ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Make sure we're not running standalone
+#
+
+if [ "$jpeg_install_caller" = "" ] ; then
+
+    WriteError "This script can only be run from INSTALL-ZLIB."
+    Help
+
+else
+
+    # Here we set up the JPEG installation directory,
+    # for use by the configure script.  
+    # 
+
+    install_dir="$JPEGHOME"
+
+    if [ ! -d "$install_dir" ] ; then 	# create the install dir, if needed.
+        mkdir $install_dir
+    fi
+fi
+
+
+
+#
+# Announce
+#
+
+EchoAndLog "Running $this_script"
+
+
+#
+# Run the NCSA-supplied configure script
+#
+
+cd $start_dir
+
+tmp_home=$HOME			# save $HOME
+HOME=`pwd` ; export HOME	# change it to avoid interaction w/ .cshrc
+
+if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	EchoAndLog "Running ./configure --prefix=$install_dir $config_flags"
+elif [ "$BRAND" = "sgi64" ] ; then
+        EchoAndLog "Running ./configure  RANLIB='ar -ts' --prefix=$install_dir $config_flags"
+else
+	EchoAndLog "Running ./configure --prefix=$install_dir $config_flags"
+fi
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+	if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	./configure --prefix=$install_dir $config_flags >> $log_file 2>&1
+        elif [ "$BRAND" = "sgi64" ]; then
+        ./configure RANLIB='ar -ts' --prefix=$install_dir $config_flags >> $log_file 2>&1 
+	else
+	./configure  --prefix=$install_dir $config_flags >> $log_file 2>&1
+	fi
+else
+    echo ""
+	if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	./configure --prefix=$install_dir $config_flags
+        elif [ "$BRAND" = "sgi64" ]; then
+        ./configure RANLIB='ar -ts' --prefix=$install_dir $config_flags >> $log_file 2>&1
+	else
+	./configure --prefix=$install_dir $config_flags
+	fi
+
+fi
+
+HOME=$tmp_home ; export HOME	# restore $HOME
+
+
+#
+# Do architecture-specific post-configure fixes
+#
+
+
+PostConfigure
+
+
+#
+# Run the make utility to compile the library and utiltites
+#
+
+EchoAndLog "Running make, target=all"
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make 
+    tmp_status=$?
+fi
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make' failed."
+    exit 1
+fi
+
+
+EchoAndLog "Running make, target=test"
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make test>> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make test
+    tmp_status=$?
+fi
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make all' failed."
+    exit 1
+fi
+
+
+
+#
+# Run the make utility install the libraries, utilities, includes and man pages 
+#
+
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] || [ "$BRAND" = "macintosh" ] || [ "$BRAND" = "macintel" ] || [ "$BRAND" = "macintel32" ] || [ "$BRAND" = "macintel64" ] ; then
+	/bin/mkdir $JPEGHOME/include
+	/bin/mkdir $JPEGHOME/lib
+    fi
+
+    if [ "$BRAND" = "dec" ] ; then
+	/bin/mkdir $JPEGHOME/include
+	/bin/mkdir $JPEGHOME/lib
+    fi
+
+
+    if [ "$BRAND" = "ibm" ] ; then
+	/bin/mkdir $JPEGHOME/include
+	/bin/mkdir $JPEGHOME/lib
+    fi
+
+
+
+    if [ "$BRAND" = "cygwin" ] ; then
+	/bin/mkdir $JPEGHOME/include
+	/bin/mkdir $JPEGHOME/lib
+    fi
+
+EchoAndLog "Running make, target=install "
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make install-lib >> $log_file 2>&1
+
+    tmp_status=$?
+else
+    echo ""
+    make install-lib
+
+    tmp_status=$?
+fi
+
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make install' failed."
+    exit 1
+fi
+
diff --git a/bin/INSTALL-Scripts/INSTALL-SZIP b/bin/INSTALL-Scripts/INSTALL-SZIP
new file mode 100755
index 0000000..5d2232d
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-SZIP
@@ -0,0 +1,1389 @@
+#! /bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-SZIP
+#
+# description:
+# 	SZIP installation script for the (PGS) Toolkit and hdfeos
+#
+# usage:
+# 	INSTALL-SZIP [-f90 [-NAG]] [-ABSOFT] [-fc_path <path/compiler_name>] 
+#                    [-cc_path <path/compiler_name>] 
+# 	             [-sgi32 | -sgi64] [-log <log-file> [-append]] 
+# 	             [-clean | -cleano] [-strip] [-w_home <file>]
+# 	             [-df <distribution-file>] [-batch]
+# 	             [-install_dir <base installation directory>]
+# 	INSTALL-SZIP [-h] 
+#
+# 	  -f90     : build SZIP FORTRAN modules using f90 
+# 	             optional flag -NAG specifies NAG f90
+#         -ABSOFT  : flag that specifies absoft f77 is used for fortran compilation
+# 	  -fc_path : set the path of the FORTRAN compiler to <path/compiler_name>
+# 	  -cc_path : set the path of the C compiler to <path/compiler_name>
+# 	  -sgi32   : build in -n32   mode (SGI Power Challenge only)
+# 	  -sgi64   : build in 64-bit mode (SGI Power Challenge only)
+# 	  -log     : sdone session output to new <log-file>
+# 	  -append  : append to existing <log-file>
+# 	  -clean   : run 'make clean' after doing the installation
+# 	  -cleano  : clean up all object and a.out files
+# 	  -strip   : strip out all non-installation files following install
+# 	  -w_home  : write SZIP home directory to <file>
+# 	  -df      : install SZIP from distribution file <distribution-file>
+# 	  -batch   : run script in batch (i.e. non-interactive) mode
+#         -install_dir : full path to top level directory where SZIP will be
+#                        installed (e.g. /usr/local/hdfeos/szip/sgi64)
+# 	  -h       : display this help message and exit
+#
+# notes:
+# 	1)  The use of the -clean option will cause the SZIP utilites to 
+# 	    be deleted.  To preserve them, use the -cleano option instead.
+# 
+# 	2)  The -f90 and -NAG options are  * * NOT IMPLEMENTED  * * 
+# 	    Currently, these options are accepted, but ignored.
+# 	    
+#
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        Megan E. Donovan Spencer / SM&AE
+#        Abe Taaheri / SM&AE
+#        Phuong T Nguyen / L3 Communication GSI.
+# history:
+#       11-May-1995 MES Initial version
+#       20-Oct-2003 AT  Used INSTALL-HDF5 as template for INSTALL-SZIP 
+#       24-Jan-2005 MP  Updated szip1.1.tar.gz to szip1.2.tar.gz
+#       06-Jul-2005 AA  Updated szip tar file to szip-2.0.tar.gz
+#       05-Sep-2007 AT  Updated szip tar file to szip-2.1.tar.gz
+#
+#-----------------------------------------------------------------------------
+
+#
+# Save starting directory, path
+# Create error message header
+#
+
+start_dir=`pwd`
+start_path=$PATH
+this_script="`basename $0`"
+script_error="$this_script: Error:"
+
+#
+# Get absolute pathname where this script is located
+# This allows the script to locate any needed auxilliary files
+#
+
+script_dir="`dirname $0`"
+abs="`echo $script_dir | cut -c1`"
+if [ "$abs" != "/" ] ; then
+    script_dir="`cd $script_dir;pwd`"
+fi
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    echo ""
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+        echo "" >> $log_file
+        echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to set up and export the following architecture-specific variables:
+#
+#         BRAND HOST LOGNAME OSTYPE PATH USER
+#
+
+
+SetArchitecture()
+{
+    # set path to a base subset of directories, allowing startup on unknown host
+    # note: once the architecture has been determined the path is customized
+    
+    PATH=/usr/local/bin:/usr/bin:/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11
+    
+    
+    # get operating system type, login name
+    # special cases: SCO and Cray  - uname works differently,
+    
+    machine=`uname -m | awk '{print $1}'`	# needed on Cray & SCO
+    temp_ostype=`uname`
+
+    case "$machine" in
+    
+      i386 )        			# SCO box
+    	OSTYPE=sco386
+        ;;
+    
+      CRAY )    				# CRAY
+    	OSTYPE=UNICOS
+        ;;
+    
+      * )					# everybody else
+    	OSTYPE=`uname`
+        ;;
+    
+    esac
+
+    # Intel Macintosh is also i386 or i686 (?) machine
+
+    if [ "$machine" = "i386" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	fi
+	if [ "`uname | awk -F_ '{print $1}'`" = "CYGWIN" ] ; then 
+	    OSTYPE=Cygwin
+	fi
+    fi
+    if [ "$machine" = "i686" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	fi
+	if [ "`uname | awk -F_ '{print $1}'`" = "CYGWIN" ] ; then 
+	    OSTYPE=Cygwin
+	fi
+    fi
+   if [ "$machine" = "x86_64" ] || [ "$machine" = "ia64" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	    if [ "$MAC_BRAND" = "" ] ; then 
+		echo " Error: In 64-bit MAC platform the env. variable MAC_BRAND must be set to mac32 or mac64 before running this script."
+		exit 1
+	    fi
+	else
+	    if [ "$LINUX_BRAND" = "" ] ; then 
+		echo " Error: In 64-bit linux platform the env. variable LINUX_BRAND must be et to linux32 or linux64 before running this script."
+		exit 1
+	    fi
+	fi
+    fi
+
+    user=`id | cut -d\( -f2 | cut -d\) -f1`
+    if [ "$LOGNAME" = "" ] ; then 		# make sure $LOGNAME is defined
+        LOGNAME=$user	
+    fi
+    USER=$LOGNAME				# make sure $USER is defined
+    
+    
+    # set machine-depdoneent environment variables:
+    # 	HOST  the host name of this machine
+    # 	BRAND used by other achitecture-specific code
+    # 	path  the execution search path exported to PATH
+    
+    case "$OSTYPE" in
+    
+      AIX ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/ccs/bin:/usr/sbin
+    	HOST=`hostname`
+    	BRAND=ibm
+        CC=cc
+        CFLAGS="-O"
+        F77=xlf
+        ;;
+    
+      HP-UX ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bin/X11:/tools/bin
+    	HOST=`hostname`
+    	BRAND=hp 
+        CC=cc
+        CFLAGS="-O"
+        F77=fort77
+        ;;
+    
+      IRIX )  
+    	PATH=/usr/local/bin:/usr/bin:/bin:/etc:/usr/etc:/usr/bsd:/usr/bin/X11:/usr/sbin
+    	HOST=`hostname`
+    	BRAND=sgi 
+        CC=cc
+        CFLAGS="-O"
+        F77=f77
+        ;;
+    
+      IRIX64 )  
+        PATH=/usr/local/bin:/usr/bin:/bin:/etc:/usr/etc:/usr/bsd:/usr/bin/X11:/usr/sbin
+        HOST=`hostname`
+        case "$sgi_mode" in
+          32  )  BRAND=sgi   ; CC="cc -32 -mips2"  ; F77="f77 -32 -mips2"  ;;
+          n32 )  BRAND=sgi32 ; CC="cc -n32 -mips3" ; F77="f77 -n32 -mips3"  ;;
+          64  )  BRAND=sgi64 ; CC="cc -64 -mips4"  ; F77="f77 -64 -mips4"  ;;
+          *   )  BRAND=sgi   ; CC="cc"  ; F77="f77"  ;;
+        esac
+        CFLAGS="-O"
+        set_compilers=0		# override SZIP default compilers
+        ;;
+    
+      Linux )
+	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/X11/bin
+	HOST=`hostname -s`
+	BRAND=linux
+	if [ "$LINUX_BRAND" = "linux64" ] ; then
+	    BRAND=linux64
+	elif [ "$LINUX_BRAND" = "linux32" ] ; then
+	    BRAND=linux32
+	fi
+        CC="gcc $LNX_COMP_FLAG"
+        CFLAGS="-O"
+        F77="g77 $LNX_COMP_FLAG"
+	;;
+
+      Darwin )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname -s`
+        BRAND=macintosh
+        CC=gcc
+        CFLAGS="-O"
+        F77=g77
+        ;;
+
+      DarwinIntel )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname -s`
+        BRAND=macintel32
+	if [ "$MAC_BRAND" = "macintel64" ] ; then
+	    BRAND=macintel64
+	elif [ "$MAC_BRAND" = "macintel32" ] ; then
+	    BRAND=macintel32
+	fi
+        CC="gcc $MACINTEL_COMP_FLAG"
+        CFLAGS="-O2"
+        F77="gfortran $MACINTEL_COMP_FLAG"
+         ;;
+
+      Cygwin )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname`
+        BRAND=cygwin
+        CC=gcc
+        CFLAGS="-O"
+        F77=g77
+        ;;
+
+      OSF1 )  
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/ccs/bin:/usr/sbin
+    	HOST=`hostname -s`
+    	BRAND=dec 
+        CC=cc
+        CFLAGS="-O -std"
+        F77=f77
+        ;;
+    
+      sco386 ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bin/X11
+    	HOST=`hostname -s`
+    	BRAND=sco 
+        CC=cc
+        CFLAGS="-O"
+        F77=f77
+        ;;
+    
+      SunOS ) 
+    	# distinguish between SunOS 5.x and 4.x versions
+    	if [ `uname -r | awk -F. '{print $1}'` = "5" ] ; then
+    	    BRAND=sun5			# release V5.x SunOS
+    	    PATH=/usr/local/bin:/opt/SUNWspro/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/openwin/bin:/usr/openwin/demo:/usr/ccs/bin:/usr/sbin
+            CC=cc
+            CFLAGS="-O"
+            F77=f77
+	    if [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 10" ] ; then
+		BRAND="sun5.10"			# release V5.8 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+		CC=cc
+		CFLAGS="-O"
+		F77=f77
+	    elif [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 9" ] ; then
+		BRAND="sun5.9"			# release V5.8 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+		CC=cc
+		CFLAGS="-O"
+		F77=f77
+	    elif [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 8" ] ; then
+		BRAND="sun5.8"			# release V5.8 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+		CC=cc
+		CFLAGS="-O"
+		F77=f77
+	    fi
+    	else                                
+    	    BRAND=sun4			# release V4.x SunOS
+    	    PATH=/usr/local/bin:/usr/local/lang:/usr/lang:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/openwin/bin:/usr/openwin/demo
+            CC=acc
+            CFLAGS="-O"
+            F77=f77
+            set_compilers=1		# override SZIP default compilers
+    	fi
+    	HOST=`hostname`
+        ;;
+    
+      UNICOS ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/ucb:/usr/bin/X11
+    	HOST=`hostname`
+    	BRAND=cray 
+        CC=cc
+        CFLAGS="-O"
+        F77=cf77
+        ;;
+    
+      * )
+    	echo "Operating system: $OSTYPE not supported" 	>&2
+    	echo "This release of the Toolkit and hdfeos supports: " 	>&2
+    	echo "   Sun, SGI HP-9000 IBM-6000 DEC-Alpha  Linux Macintosh and Cray/Unicos " 	>&2
+        exit 1
+        ;;
+    
+    esac
+
+
+    # if debug version was requested replace -O with -g in CFLAGS
+
+    if [ "$dbug" = "1" ] ; then
+	CFLAGS=`echo $CFLAGS | sed 's/-O/-g/'`
+    fi
+
+    CFLAGS="$CFLAGS $EXT_CC_FLAGS"
+
+    # export the architecture-specific variables
+
+    export BRAND HOST LOGNAME OSTYPE PATH USER
+    export CC CFLAGS F77
+    
+}
+
+
+#
+# Function to allow user to override the defaults for the compilers
+# The following variables are affected:
+#
+#         PATH CC F77
+#
+
+UserCompilers()
+{
+    #
+    # check to see if valid C compiler path was specified
+    #
+    
+    cc=""
+    
+    if [ "$cc_path" != ""  ] ; then
+    
+        if [ -f $cc_path ] ; then
+    
+            cc=`basename $cc_path`
+            cc_path=`echo $cc_path | sed 's%/[^/]*/*$%%'`
+	    case "$BRAND" in
+		"sgi32" )
+		    CC="$cc_path/$cc -n32"
+		;;
+
+		"sgi64" )
+		    cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+		    if [ "$cpu_type" == "4" ] ; then
+			CC="$cc_path/$cc -64 -mips3"
+		    else
+			CC="$cc_path/$cc -64 -mips4"
+		    fi
+		;;
+
+		"linux" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"linux32" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"linux64" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"macintel" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel32" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;; 
+
+		"macintel64" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;; 
+
+		* )
+		    CC="$cc_path/$cc"
+		;; 
+	    esac
+
+	    export CC		# user overrides C compiler name
+	    set_compilers=1		# override HDF default compilers
+    
+	fi
+    
+        if [ -d $cc_path ] ; then	# make sure cc_path is now a directory
+    
+            PATH=${cc_path}:${PATH} 	# prepend cc_path to search path
+            export PATH
+    
+        else
+    
+            cc_path=""
+            echo "Warning: C compiler directory $cc_path not found."
+            echo  "SZIP build may fail."
+    
+        fi
+    
+    fi
+    
+    
+    #
+    # check to see if valid FORTRAN compiler path was specified
+    #
+    
+    fc=""
+    
+    if [ "$fc_path" != "" ] ; then
+    
+        if [ -f $fc_path ] ; then
+    
+            fc=`basename $fc_path`
+            fc_path=`echo $fc_path | sed 's%/[^/]*$%%'`
+	    case "$BRAND" in
+		"sgi32" )
+		    F77="$fc_path/$fc -n32"
+		;;
+
+		"sgi64" )
+		    cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+		    if [ "$cpu_type" == "4" ] ; then
+			F77="$fc_path/$fc -64 -mips3"
+		    else
+			F77="$fc_path/$fc -64 -mips4"
+		    fi
+		;;
+
+		"linux" )
+		    F77="$fc_path/$fc $LNX_COMP_FLAG"
+		;; 
+
+		"linux32" )
+		    F77="$fc_path/$fc $LNX_COMP_FLAG"
+		;; 
+
+		"linux64" )
+		    F77="$fc_path/$fc $LNX_COMP_FLAG"
+		;; 
+
+		"macintel" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel32" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel64" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		* )
+		    F77="$fc_path/$fc" 
+		;; 
+	    esac
+
+    #        if [ "$fc" != f90 ] ; then	# (f90 not supported for HDF4.1r1)
+    # f90 is supported starting with the HDF4.1r2 release
+                export F77	# user overrides FORTRAN compiler name
+                set_compilers=1		# override HDF default compilers
+    #        fi
+    
+        fi
+    
+        if [ -d $fc_path ] ; then	# make sure fc_path is now a directory
+    
+            PATH=${fc_path}:${PATH} 	# prepend fc_path to search path
+            export PATH
+    
+        else
+    
+            fc_path=""
+            echo "Warning: FORTRAN directory $fc_path not found."
+            echo  "SZIP build may fail."
+    
+        fi
+    
+    fi
+    
+}
+
+
+
+#
+# Function to get the location of the distribution file
+#
+    
+GetDistribution()
+{    
+    : ${distrib_file:=szip-2.1.tar.gz}
+
+    ds1=$distrib_file			# backup copy
+    
+    # derive tar file name
+
+    case "$distrib_file" in
+
+      szip-2.1.tar.gz  )
+        tar_file=szip-2.1.tar
+        szip_home=szip-2.1
+        ;;
+
+      szip-2.0.tar.gz  )
+        tar_file=szip-2.0.tar
+        szip_home=szip-2.0
+        ;;
+
+      * )
+        EchoAndLog "SZIP version in $distrib_file not supported by this script."
+        exit 1
+        ;;
+
+    esac
+
+    
+    # set search path to include current dir, parent of current and $HOME    
+    search_path=`pwd`
+    search_path="$search_path `cd ..; pwd` $HOME"
+
+    # set search file to include compressed tar file and uncompressed tar file
+    search_file="$distrib_file $tar_file"
+
+    # search for the distribution file
+
+    found_file=0
+    for distrib_path in $search_path ; do
+
+        for distrib_file in $search_file ; do
+
+            if [ -f ${distrib_path}/${distrib_file} ] ; then
+                found_file=1
+                break
+            fi
+
+        done
+
+        if [ $found_file = 1 ] ; then
+            break
+        fi
+
+    done
+
+    # if file was not found, ask the user
+
+    if [ $found_file = 0 ] ; then
+
+	if [ $batch_mode = 0 ] ; then
+	    echo ""	
+	    UserPrompt "Pathname where $ds1 is located: "
+	    echo ""
+  	else
+	    user_response=""
+	fi
+    
+        if [ "$user_response" != "" ] ; then
+
+            # make sure directory exists
+
+            if [ -d $user_response ] ; then
+                distrib_path=$user_response
+            else 
+                WriteError "Invalid directory: $user_response"
+                exit 1
+            fi
+    
+            # search for the distribution file in user directory
+
+            for distrib_file in $search_file ; do
+
+                if [ -f ${distrib_path}/${distrib_file} ] ; then
+                    found_file=1
+                    break
+                fi
+
+            done
+
+        fi
+
+
+    fi
+
+
+    if [ $found_file = 0 ] ; then
+        WriteError "Can't find ${ds1} in (${search_path})"
+        echo "SZIP installation cancelled."
+        exit 1
+    fi
+
+}
+
+
+# 
+# Function to get the location of the SZIP home directory for installation
+# Also, prompt user that all information is valid before proceeding
+#
+
+GetInstallDir()
+{
+    default_SZIP_path="`pwd`/szip/$BRAND"
+
+    if [ "$SZIP_path" = "" ] ; then
+	SZIP_path="`pwd`/szip/$BRAND"
+    fi
+
+    # ask the user
+
+    if [ $batch_mode = 0 ] ; then
+	UserPrompt "Pathname where directory '$szip_home' will be created [$SZIP_path]: " 
+	echo ""
+    else
+	user_response=""
+    fi
+    
+    if [ "$user_response" = "" ] ; then
+        if [  ! -d `dirname $SZIP_path`  ] ; then mkdir `dirname $SZIP_path` ; fi
+        if [  ! -d $SZIP_path  ] ; then  mkdir $SZIP_path ; fi
+    else
+#        if [ -d "$user_response" ] ; then 
+	SZIP_path=$user_response ; #fi
+    fi
+
+    if [ ! -d $SZIP_path ] ; then
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "$SZIP_path does not exist.  Create [y]? "
+	else
+	    user_response=y
+	fi
+	if [ "$user_response" = "" ] ; then user_response="y" ; fi
+	case "$user_response" in
+	    y* | Y* )
+		mkdir -p $SZIP_path
+		if [ ! -d $SZIP_path ] ; then
+		    WriteError "Unable to create directory $SZIP_path." 
+		    echo "SZIP installation cancelled." 2>&1
+		    exit 1
+		
+		fi
+		;;
+	    *)
+		WriteError "Directory $SZIP_path does not exist." 
+		echo "SZIP installation cancelled." 2>&1
+		exit 1
+		;;
+        esac
+    fi
+    
+    
+    #
+    # confirm before proceeding
+    #
+    
+    echo "The SZIP directory will be restored from: " 
+    echo "    ${distrib_path}/${distrib_file}" 
+    echo "" 
+    echo "The SZIP directory will be created in: " 
+    echo "     ${SZIP_path}" 
+    echo "" 
+
+    if [ $batch_mode = 0 ] ; then
+	UserPrompt "Continue [yes] ? " 
+	case "$user_response" in
+	    n* | N* ) echo "Cancelled." ; exit 1 ;;
+	    * ) echo "Confirmed." ; echo "" ;;
+	esac
+    fi
+
+#
+# For linux create soft links if default SZIP installation directory is used
+#
+    save_dir="`pwd`"
+    if [ "`pwd`/szip/$BRAND" = "$default_SZIP_path" ] ;then
+	if [ "$BRAND" = "linux64" ] ; then
+	    cd ${default_SZIP_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "64-bit structure is the default in this machine. Creating $current_path/linux as a soft link to $default_SZIP_path"
+	    ln -s ./linux64 linux
+ 	    cd $save_dir
+	fi
+
+	if [ "$BRAND" = "linux" ] ; then
+	    cd ${default_SZIP_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "32-bit structure is the default in this machine. Creating $current_path/linux32 as a soft link to $default_SZIP_path"
+	    ln -s ./linux linux32
+ 	    cd $save_dir
+	fi
+    fi
+
+#
+# For macintel create soft links if default SZIP installation directory is used
+#
+    save_dir="`pwd`"
+    if [ "`pwd`/jpeg/$BRAND" = "$default_JPEG_path" ] ;then
+	if [ "$BRAND" = "macintel32" ] ; then
+	    cd ${default_JPEG_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "macintel32 directories will be soft linked to macintel. Creating $current_path/macintel as a soft link to $default_JPEG_path"
+	    ln -s ./macintel32 macintel
+ 	    cd $save_dir
+	fi
+
+	if [ "$BRAND" = "macintel" ] ; then
+	    cd ${default_JPEG_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "macintel32 directories will be soft linked to macintel. Creating $current_path/macintel32 as a soft link to $default_JPEG_path"
+	    ln -s ./macintel macintel32
+ 	    cd $save_dir
+	fi
+    fi
+
+}
+
+
+#
+# Function to unpack the distribution file into the installation directory
+#
+
+UnpackDistribution()
+{
+    #
+    # Go to the SZIP parent directory
+    #
+    
+    cd $SZIP_path
+
+    #
+    # If the new SZIP home directory already exits, it must
+    # be removed first.  Check with the user before proceeding.
+    #
+
+    if [ -d "$szip_home" ] ; then
+    
+        EchoAndLog "The directory $szip_home already exists."
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "Replace it [no] ? "
+	else
+	    user_response=y
+	fi
+
+        case "$user_response" in
+          y* | Y* )
+            EchoAndLog "Removing old $szip_home directory ..."
+            /bin/rm -rf $szip_home
+            ;;
+    
+          * )
+            EchoAndLog "Cancelled."
+            exit 1
+            ;;
+        esac
+    
+    fi
+    
+    
+    #
+    # Create a link to the distribution file, if necessary.
+    #
+
+    link_flag=0
+    if [ ! -f $distrib_file ] ; then
+        if [ -f ${distrib_path}/${distrib_file} ] ; then
+            ln -s ${distrib_path}/${distrib_file} ${distrib_file}
+            link_flag=1
+        fi
+    fi
+    
+    # 
+    # Uncompress the distribution file, (if needed), and extract the files
+    # 
+    
+    EchoAndLog "Extracting files from $distrib_file ..."
+
+    suffix="`echo $distrib_file |  sed 's/^.*\.//'`"
+    case $suffix in
+    
+      Z  )
+        zcat $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+
+      gz )
+	gzip -cd $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+#        GnuZcat
+#        if [ $gnu_zcat != 1 ] ; then
+#            WriteError "You need the GNU version of zcat to unpack this file."
+#            exit 1
+#        fi
+#         zcat $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+
+      tar)
+        echo $distrib_file
+        tar -xvf $distrib_file | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+    
+    esac
+
+    #
+    # Clean up symbolic link, if present
+    #
+
+    if [ $link_flag = 1 ] ; then
+        /bin/rm -f $distrib_file
+    fi
+
+
+}
+
+
+#
+# See if zcat is GNU version
+#
+
+GnuZcat()
+{
+    if [ "$1" = "" ] ; then
+        zcat_cmd=zcat
+    else
+        zcat_cmd=$1
+    fi
+    
+    buf=`exec 2>&1; $zcat_cmd < /dev/null | tail -1` 
+    buf=`echo $buf | awk -F: '{print $1}'`
+    
+    case "$buf" in
+      zcat) gnu_zcat=1 ;;
+      *   ) gnu_zcat=0 ;;
+    esac
+}
+
+
+#
+# Strip all SZIP distribution files not needed after installation.
+#
+
+StripHdfInstall()
+{
+    cd $SZIPHOME
+
+    here=`pwd`
+    here=`basename $here`
+
+    #
+    # Make sure this is a valid SZIP directory befor clobbering files !
+    # 
+
+    if [ "`echo $here | grep '^SZIP'`" = "" ] ; then
+    
+        EchoAndLog "Not a valid SZIP directory: no files removed."
+        
+    else
+
+        EchoAndLog "Removing all non-installation SZIP files ..."
+
+        for file in * ; do
+
+            if [ -d "$file" ] ; then
+    
+                case "$file" in 
+        
+                  bin | lib | include | man ) ;;
+                  * ) rm -rf $file ;;
+              
+                esac
+        
+            else
+    
+                rm -f $file
+        
+            fi
+    
+        done
+        
+    fi
+}
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+
+
+#
+# Get arguments from command line
+#
+
+log_file=""
+home_file=""
+noquery=0
+clean=0
+cleano=0
+strip_install=0
+append=0
+no_untar=0
+sgi_mode=32
+f90_flag=0
+nag_flag=0
+absoft_flag=0
+fc_path=""
+cc_path=""
+distrib_file=""
+set_compilers=0
+dbug=0
+SZIP_path=""
+batch_mode=0
+
+while [ "$1" != "" ] ; do 
+
+    case "$1" in
+
+      -h )
+        Help
+        ;;
+
+      -f90 )
+        f90_flag=1
+        ;;
+
+      -NAG )
+        if [  $f90_flag = 0  ] ; then
+            WriteError "Must first specify -f90 and set compiler path."
+            Help
+        else
+            nag_flag=1
+        fi
+        ;;
+
+      -ABSOFT )
+	    absoft_flag=1
+	;;
+
+      -fc_path )
+        fc_path="$2"
+        shift
+        ;;
+
+      -cc_path )
+        cc_path="$2"
+        shift
+        ;;
+
+      -df)
+        distrib_file="$2"
+        shift
+        ;;
+
+      -sgi32 )
+        sgi_mode=n32
+        ;;
+
+      -sgi64 )
+        sgi_mode=64
+        ;;
+
+      -log )
+        if [ "$2" != "" ] ; then
+            if [ "` echo $2 | cut -c1`" = "/" ] ; then
+                log_file="$2"
+            else
+                log_file="$start_dir/$2"
+            fi
+            shift
+        else
+            WriteError "A log file must be specified with the -log option."
+            Help
+        fi
+        ;;
+
+      -append )
+        append=1
+        ;;
+
+      -w_home )
+        if [ "$2" != "" ] ; then
+            if [ "` echo $2 | cut -c1`" = "/" ] ; then
+                home_file="$2"
+            else
+                home_file="$start_dir/$2"
+            fi
+            shift
+        else
+            WriteError "No file specified with -w_home switch."
+            Help
+        fi
+        ;;
+
+      -nq | -noquery )
+        noquery=1
+        ;;
+
+      -clean )
+        clean=1
+        ;;
+
+      -cleano )
+        cleano=1
+        ;;
+
+      -strip )
+        strip_install=1
+        ;;
+
+      -no_untar )
+        no_untar=1
+        ;;
+
+      -install_dir )
+        if [ "$2" != "" ] ; then
+	    SZIP_path=$2
+            shift
+        else
+            WriteError "No installation directory specified with -install_dir switch."
+            Help
+        fi
+        ;;
+
+	-batch )
+	    batch_mode=1
+	;;
+
+      * )
+        echo "$script_error invalid argument '$1'"
+        Help
+        ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Inititialize log file
+#
+
+if [ "$log_file" != "" ] ; then
+
+    if [ "$append" = "0" ] ; then
+        if [ -f "$log_file" ] ; then 
+            /bin/rm  -f $log_file > /dev/null 2>&1
+        fi
+    fi
+
+    touch $log_file > /dev/null 2>&1
+    if [ $? != 0 ] ; then
+        WriteError "Cannot write to file $log_file"
+        exit 1
+    fi
+
+    echo ""
+    echo "`basename $0`: session output will go to file: "
+    echo ""
+    echo "     $log_file"
+    echo ""
+
+fi
+
+export log_file
+
+#
+# Initialize the home file
+#
+
+if [ "$home_file" != "" ] ; then
+
+    if [ -f "$home_file" ] ; then 
+        /bin/rm -f $home_file > /dev/null 2>&1
+    fi
+
+    touch $home_file > /dev/null 2>&1
+    if [ $? != 0 ] ; then
+        WriteError "Cannot write to file $home_file"
+        exit 1
+    fi
+
+fi
+
+
+#
+# Set architecture-specific variables
+#
+
+SetArchitecture
+
+
+#
+# Set user compiler overrides
+#
+
+UserCompilers
+
+
+#
+# Get the location of the distribution file
+#
+
+GetDistribution
+
+
+#
+# Got valid distribution file
+# Get the location of the SZIP home directory for installation
+#
+
+GetInstallDir
+
+
+#
+# Write the log file header
+#
+
+if [ "$log_file" != "" ] ; then
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "SZIP installation starting at: `date`" >> $log_file
+    echo "host: $HOST    type: $BRAND     user: $USER " >> $log_file
+    echo "" >> $log_file
+    echo "" >> $log_file
+    echo "The SZIP directory will be restored from: " >> $log_file
+    echo "    ${distrib_path}/${distrib_file}" >> $log_file
+    echo "" >> $log_file
+    echo "The SZIP directory will be created in: " >> $log_file
+    echo "     ${SZIP_path}" >> $log_file
+    echo "" >> $log_file
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "" >> $log_file
+fi
+
+
+#
+# Unpack the distribution file into the installation directory
+#
+
+    cd $SZIP_path
+
+    if [ "$no_untar" = 0 ] ; then
+        UnpackDistribution
+    fi
+
+
+#
+# Prepare to install the requested version of SZIP
+#
+
+if [ ! -d $szip_home ] ; then
+    EchoAndLog "Error creating directory: $szip_home"
+    exit 1
+fi
+
+cd $szip_home				# go to the starting directory
+
+szip_install_caller="$this_script"	# set caller flag for sub-modules
+export szip_install_caller
+
+
+#
+# Set the version to be installed
+#
+
+install_script=""
+install_options=""
+
+case $szip_home in
+
+  szip-2.1)
+
+    SZIPHOME=${SZIP_path}/szip-2.1 ; export SZIPHOME
+    install_script="$script_dir/INSTALL-SZIP2.1"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${SZIPHOME}"
+    ;;
+
+  szip-2.0)
+
+    SZIPHOME=${SZIP_path}/szip-2.0 ; export SZIPHOME
+    install_script="$script_dir/INSTALL-SZIP2.0"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${SZIPHOME}"
+    ;;
+
+  * ) 			# unsupported
+    EchoAndLog "$szip_home installation is not supported by this script."
+    exit 1
+    ;;
+
+esac
+
+
+#
+# Run the install script
+#
+
+if [ ! -f $install_script ] ; then
+    EchoAndLog "Can't find $install_script - installation failed."
+    exit 1
+fi
+
+$install_script $install_options
+
+if [ $? != 0 ] ; then
+    EchoAndLog "$szip_home Installation failed."
+    exit 1
+fi
+
+
+# 
+# Pass back the SZIP install directory for the hdfeos installation
+# 
+
+if [ "$home_file" != "" ] ; then
+    echo $SZIPHOME >> $home_file
+fi
+
+
+
+#
+# Clean up
+#
+
+cd $SZIP_path
+
+if [ "$clean" = 1 ] ; then
+
+    for dir in $SZIPHOME ; do 
+
+        cd $dir
+        echo "Cleaning up in $dir ..."
+
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+            echo "Cleaning up in $dir ..." >> $log_file
+            echo "" >> $log_file
+            make clean  >> $log_file 2>&1
+        else
+            make clean
+        fi
+
+    done
+
+fi
+
+if [ "$cleano" = 1 ] ; then
+
+    cd $SZIPHOME
+    echo "Removing any remaining object files ..." 
+
+    if [ "$log_file" != "" ] ; then
+        echo "" >> $log_file
+        echo "Removing any remaining object files ..." >> $log_file
+        echo "" >> $log_file
+        find . -name \*.o -print -exec rm -f {} \; >> $log_file 2>&1
+        find . -name a.out -print -exec rm -f {} \; >> $log_file 2>&1
+    else
+        find . -name \*.o -print -exec rm -f {} \; 
+        find . -name a.out -print -exec rm -f {} \; 
+    fi
+    
+fi
+
+
+if [ "$strip_install" = 1 ] ; then
+
+    StripHdfInstall
+   
+fi
+
+
+echo "------------------------------------------------------------"
+echo ""
+echo "    SZIP installation ending at: `date` " 
+echo ""
+echo "------------------------------------------------------------"
+
+
+
+#
+# Write the log file trailer
+#
+
+if [ "$log_file" != "" ] ; then
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "    SZIP installation ending at: `date`" >> $log_file
+    echo "" >> $log_file
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+fi
+
diff --git a/bin/INSTALL-Scripts/INSTALL-SZIP2.1 b/bin/INSTALL-Scripts/INSTALL-SZIP2.1
new file mode 100755
index 0000000..19a83af
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-SZIP2.1
@@ -0,0 +1,581 @@
+#! /bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-SZIP2.1
+#
+# description:
+# 	Installation script module for installing SZIP2.1
+# 	for the SDP (PGS) Toolkit and hdfeos.  
+#       It implements patches to the NCSA 
+# 	installation procedure to allow for trouble-free installation on
+# 	the platforms supported by the SDP (PGS) Toolkit and hdfeos.
+#
+# usage:
+# 	Called from INSTALL-SZIP
+#
+# 	INSTALL-SZIP2.1 -h[elp]
+#
+# 	  -h      : display this help message and exit
+# 	  -dbug   : install debug version of SZIP
+#
+# notes:
+# 	This is NOT a standalone script.  It is only intended to be run
+# 	by INSTALL-SZIP, the SZIP installation script.
+# 
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        Abe Taaheri / L-3 comm. GSI
+#        Adura Adekunjo / L-3 comm. GSI
+#
+# history:
+#       20-Oct-2003 AT  Added for SZIP Installation
+#       20-Jan-2005 MP  Updated for version 1.2 
+#       07-Jul-2005 AA  Updated for version 2.0
+#       05-Sep-2007 AT  Updated for version 2.1
+#-----------------------------------------------------------------------------
+
+
+#
+# Save starting directory, path
+# Create error message header
+#
+
+start_dir=`pwd`
+start_path=$PATH
+this_script="`basename $0`"
+script_error="$this_script: Error:"
+
+#
+# Get absolute pathname where this script is located
+# This allows the script to locate any needed auxilliary files
+#
+
+script_dir="`dirname $0`"
+abs="`echo $script_dir | cut -c1`"
+if [ "$abs" != "/" ] ; then
+    script_dir=`cd $script_dir;pwd`
+fi
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    if [ "$1" = "-n" ] ; then		# -n: suppress leading blank line
+        shift
+    else
+        echo ""
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+        fi
+    fi
+    
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+         echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function to prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to silently emulate the 'which' command 
+#
+
+Which()
+{
+    if [ "$1" = "" ] ; then 
+        WriteError "Which() : Too few arguments." 
+        exit 1 
+    fi
+
+    saveifs="$IFS"
+    IFS=:
+    which_result=0
+    which_cmd=""
+    
+    for dir in $PATH;  do 
+        if [ -x $dir/$1 ] ; then 
+            which_result=1 
+            which_cmd=$dir/$1
+            break 
+        fi 
+    done
+    
+    IFS="$saveifs"
+}
+
+#
+# Function to set compilers, overriding the NCSA compiler defaults
+#
+    
+SetCompilers()
+{
+    #
+    # Set C compiler based on value of $CC
+    # Set C compilation flags based on value of $CFLAGS
+    # Set FORTRAN compiler based on value of $F77
+    # 
+    # NOTE: 
+    #     This is done recursively for ALL Makefiles because on some
+    #     platforms, the compiler variables are not inherited from the
+    #     the calling Makefile.
+
+
+    EchoAndLog "Overriding NCSA default compiler settings:"
+
+    files=`find . -name Makefile -print`
+
+    if [ "$CC" != "" ] ; then
+
+        if [ "$CFLAGS" = "" ] ; then
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+            for file in $files ; do
+            
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        else
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            if [ "$CFLAGS" = "-O" ] ; then
+                EchoAndLog -n "- setting C compilation flags to default"
+            else
+                EchoAndLog -n "- setting C compilation flags to '$CFLAGS'"
+            fi
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+           for file in $files ; do
+
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+		if [ "$CFLAGS" = "-O" ] ; then
+		    cat $file.ncsa.default |
+#		    sed '/^CC /s/=.*$'"/= $CC/" | 
+#		    sed '/^FC/s/=.*$'"/= $F77/" |
+		    cat > $file.ncsa
+		else
+		    cat $file.ncsa.default |
+#		    sed '/^CC /s/=.*$'"/= $CC/" | 
+#		    sed '/^CFLAGS/s/=.*$'"/= $CFLAGS/" |
+#		    sed '/^FC/s/=.*$'"/= $F77/" |
+		    cat > $file.ncsa
+		fi
+                cp $file.ncsa $file
+
+            done
+
+        fi
+
+    else
+
+        EchoAndLog "Warning: Environment variable(s) CC and/or F77 not set."
+        EchoAndLog "If CC is not set, the installation uses NCSA defaults."
+
+    fi
+}
+
+
+
+#
+# Function to do architecture-specific pre-configure fixes
+#
+    
+PreConfigure()
+{
+
+    #
+    # Call architecture-specific functions
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) ;;
+    
+        hp    ) ;;
+    
+        ibm   ) ;;
+
+        linux ) ;;
+
+        linux32 ) ;;
+
+        linux64 ) ;;
+
+        macintosh ) ;;
+    
+        macintel ) ;;
+        
+        macintel32 ) ;;
+        
+        macintel64 ) ;;
+    
+	cygwin ) ;;
+
+        sgi   ) ;;
+
+        sgi32 ) ;;
+       
+        sgi64 ) ;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+    
+        sun5.9  ) ;;
+    
+        sun5.10  ) ;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    cd $start_dir
+
+}
+
+
+#
+# Function to do architecture-specific post-configure fixes
+#
+    
+PostConfigure()
+{
+    cd $start_dir
+    
+    
+    #
+    # Check for missing tbl and neqn, patching as needed
+    #
+
+#    PostConfigFixes_NoTblNeqn
+
+
+    #
+    # Do architecture-specific fixes
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) ;;
+    
+        hp    ) ;;
+    
+        ibm   ) ;;
+
+        ibm   ) ;;
+
+        linux ) ;;
+
+        linux32 ) ;;
+
+        linux64 ) ;;
+
+        macintosh ) ;;
+
+        macintel ) ;;
+    
+        macintel32 ) ;;
+    
+        macintel64 ) ;;
+    
+	cygwin ) ;;
+
+        sgi   ) ;;
+    
+        sgi32 ) ;;
+
+        sgi64 ) ;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+    
+        sun5.9  ) ;;
+    
+        sun5.10  ) ;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    
+    #
+    # If requested, set compilers to something other than the defaults
+    #
+
+    if [ $set_compilers = 1 ] ; then
+        SetCompilers
+    fi
+
+    cd $start_dir
+}
+
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+#
+# Get arguments from command line
+#
+
+set_compilers=0
+config_flags=""
+dbug=0
+
+while [ "$1" != "" ] ; do 
+
+    case "$1" in
+
+      -h | help ) Help ;;
+
+      -set_compilers ) set_compilers=1 ;;
+
+      -dbug ) dbug=1 ;;
+
+      -start_dir ) 
+          if [ "$2" != "" ] ; then
+              start_dir=$2
+              shift
+          else
+              WriteError "No installation directory specified with -start_dir switch."
+              Help
+          fi
+        ;;
+
+
+      * ) echo "$script_error invalid argument '$1'" ; Help ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Make sure we're not running standalone
+#
+
+if [ "$szip_install_caller" = "" ] ; then
+
+    WriteError "This script can only be run from INSTALL-SZIP."
+    Help
+
+else
+
+    # Here we set up the SZIP installation directory,
+    # for use by the configure script.  
+    # 
+    # With this release of SZIP, we abandon the convention of setting the
+    # installation directory to $SZIPHOME/szip, which was formerly done for
+    # backwards compatibility with the installed SZIP directory structure 
+    # that the toolkit was using with the 3.3r4 version of SZIP.
+    # 
+    # New releases of the SDP Toolkit  and hdfeos have been updated to handle this
+    # directory change
+
+    install_dir="$SZIPHOME"
+
+    if [ ! -d "$install_dir" ] ; then 	# create the install dir, if needed.
+        mkdir $install_dir
+    fi
+
+fi
+
+
+
+#
+# Announce
+#
+
+EchoAndLog "Running $this_script"
+
+
+#
+# Run the NCSA-supplied configure script
+#
+
+cd $start_dir
+
+tmp_home=$HOME			# save $HOME
+HOME=`pwd` ; export HOME	# change it to avoid interaction w/ .cshrc
+
+PreConfigure
+
+if [ "$szip_encode" = "n" ] ; then
+    config_flags="$config_flags --disable-shared --disable-encoding"
+else
+    config_flags="$config_flags --disable-shared"
+fi
+
+if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	EchoAndLog "Running ./configure --prefix=$install_dir $config_flags"
+else
+	EchoAndLog "Running ./configure --prefix=$install_dir $config_flags"
+fi
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+	if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	./configure --prefix=$install_dir $config_flags >> $log_file 2>&1
+	else
+	./configure --prefix=$install_dir $config_flags >> $log_file 2>&1
+	fi
+else
+    echo ""
+	if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	./configure --prefix=$install_dir $config_flags
+	else
+	./configure --prefix=$install_dir $config_flags
+	fi
+fi
+
+HOME=$tmp_home ; export HOME	# restore $HOME
+
+
+#
+# Do architecture-specific post-configure fixes
+#
+
+
+PostConfigure
+
+
+#
+# Run the make utility to compile the library and utiltites
+#
+
+EchoAndLog "Running make, target=all"
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make
+    tmp_status=$?
+fi
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make' failed."
+    exit 1
+fi
+
+
+EchoAndLog "Running make, target=test"
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make test>> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make test
+    tmp_status=$?
+fi
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make all' failed."
+    exit 1
+fi
+
+
+
+#
+# Run the make utility install the libraries, utilities, includes and man pages 
+#
+
+EchoAndLog "Running make, target=install "
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make install >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make install
+    tmp_status=$?
+fi
+
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make install' failed."
+    exit 1
+fi
+
diff --git a/bin/INSTALL-Scripts/INSTALL-ZLIB b/bin/INSTALL-Scripts/INSTALL-ZLIB
new file mode 100755
index 0000000..05f8ba1
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-ZLIB
@@ -0,0 +1,1431 @@
+#! /bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-ZLIB
+#
+# description:
+# 	ZLIB installation script for the (PGS) Toolkit and hdfeos
+#
+# usage:
+# 	INSTALL-ZLIB [-f90 [-NAG]] [-ABSOFT] [-fc_path <path/compiler_name>] 
+#                    [-cc_path <path/compiler_name>] 
+# 	             [-sgi32 | -sgi64] [-log <log-file> [-append]] 
+# 	             [-clean | -cleano] [-strip] [-w_home <file>]
+# 	             [-df <distribution-file>] [-batch]
+# 	             [-install_dir <base installation directory>]
+# 	INSTALL-ZLIB [-h] 
+#
+# 	  -f90     : build ZLIB FORTRAN modules using f90 
+# 	             optional flag -NAG specifies NAG f90
+#         -ABSOFT  : flag that specifies absoft f77 is used for fortran compilation
+# 	  -fc_path : set the path of the FORTRAN compiler to <path/compiler_name>
+# 	  -cc_path : set the path of the C compiler to <path/compiler_name>
+# 	  -sgi32   : build in -n32   mode (SGI Power Challenge only)
+# 	  -sgi64   : build in 64-bit mode (SGI Power Challenge only)
+# 	  -log     : sdone session output to new <log-file>
+# 	  -append  : append to existing <log-file>
+# 	  -clean   : run 'make clean' after doing the installation
+# 	  -cleano  : clean up all object and a.out files
+# 	  -strip   : strip out all non-installation files following install
+# 	  -w_home  : write ZLIB home directory to <file>
+# 	  -df      : install ZLIB from distribution file <distribution-file>
+# 	  -batch   : run script in batch (i.e. non-interactive) mode
+#         -install_dir : full path to top level directory where ZLIB will be
+#                        installed (e.g. /usr/local/hdfeos/zlib/sgi64)
+# 	  -h       : display this help message and exit
+#
+# notes:
+# 	1)  The use of the -clean option will cause the ZLIB utilites to 
+# 	    be deleted.  To preserve them, use the -cleano option instead.
+# 
+# 	2)  The -f90 and -NAG options are  * * NOT IMPLEMENTED  * * 
+# 	    Currently, these options are accepted, but ignored.
+# 	    
+#
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        Megan E. Donovan Spencer / SM&AE
+#        Abe Taaheri / SM&AE, Raytheon IIS
+#        Phuong T Nguyen / L3 Communication GSI.
+#        Adura Adekunjo / L3 Communication GSI.
+# history:
+#       11-May-1995 MES Initial version
+#       20-Oct-2003 AT  Used INSTALL-HDF5 as template for INSTALL-SZIP 
+#       26-Mar-2004 AA  Used INSTALL-SZIP as template for INSTALL-ZLIB
+#       27-Jan-2014 AT  Updated for ZLIB-1.2.8
+#-----------------------------------------------------------------------------
+
+#
+# Save starting directory, path
+# Create error message header
+#
+
+start_dir=`pwd`
+start_path=$PATH
+this_script="`basename $0`"
+script_error="$this_script: Error:"
+
+#
+# Get absolute pathname where this script is located
+# This allows the script to locate any needed auxilliary files
+#
+
+script_dir="`dirname $0`"
+abs="`echo $script_dir | cut -c1`"
+if [ "$abs" != "/" ] ; then
+    script_dir="`cd $script_dir;pwd`"
+fi
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    echo ""
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+        echo "" >> $log_file
+        echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to set up and export the following architecture-specific variables:
+#
+#         BRAND HOST LOGNAME OSTYPE PATH USER
+#
+
+
+SetArchitecture()
+{
+    # set path to a base subset of directories, allowing startup on unknown host
+    # note: once the architecture has been determined the path is customized
+    
+    PATH=/usr/local/bin:/usr/bin:/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11
+    
+    
+    # get operating system type, login name
+    # special cases: SCO and Cray  - uname works differently,
+    
+    machine=`uname -m | awk '{print $1}'`	# needed on Cray & SCO
+    temp_ostype=`uname`
+
+    case "$machine" in
+    
+      i386 )        			# SCO box
+    	OSTYPE=sco386
+        ;;
+    
+      CRAY )    				# CRAY
+    	OSTYPE=UNICOS
+        ;;
+    
+      * )					# everybody else
+    	OSTYPE=`uname`
+        ;;
+    
+    esac
+        
+# Intel Macintosh is also i386 or i686 (?) machine
+
+    if [ "$machine" = "i386" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	fi
+	if [ "`uname | awk -F_ '{print $1}'`" = "CYGWIN" ] ; then 
+	    OSTYPE=Cygwin
+	fi
+    fi
+    if [ "$machine" = "i686" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	fi
+	if [ "`uname | awk -F_ '{print $1}'`" = "CYGWIN" ] ; then 
+	    OSTYPE=Cygwin
+	fi
+    fi
+    if [ "$machine" = "x86_64" ] || [ "$machine" = "ia64" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then
+	    OSTYPE=DarwinIntel
+	    if [ "$MAC_BRAND" = "" ] ; then 
+		echo " Error: In 64-bit MAC platform the env. variable MAC_BRAND must be set to mac32 or mac64 before running this script."
+		exit 1
+	    fi
+	else
+	    if [ "$LINUX_BRAND" = "" ] ; then 
+		echo " Error: In 64-bit linux platform the env. variable LINUX_BRAND must be et to linux32 or linux64 before running this script."
+		exit 1
+	    fi
+	fi
+     fi
+
+
+    user=`id | cut -d\( -f2 | cut -d\) -f1`
+    if [ "$LOGNAME" = "" ] ; then 		# make sure $LOGNAME is defined
+        LOGNAME=$user	
+    fi
+    USER=$LOGNAME				# make sure $USER is defined
+    
+    
+    # set machine-depdoneent environment variables:
+    # 	HOST  the host name of this machine
+    # 	BRAND used by other achitecture-specific code
+    # 	path  the execution search path exported to PATH
+    
+    case "$OSTYPE" in
+    
+      AIX ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/ccs/bin:/usr/sbin
+    	HOST=`hostname`
+    	BRAND=ibm
+        CC=cc
+        CFLAGS="-O"
+        F77=xlf
+        ;;
+    
+      HP-UX ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bin/X11:/tools/bin
+    	HOST=`hostname`
+    	BRAND=hp 
+        CC=cc
+        CFLAGS="-O"
+        F77=fort77
+        ;;
+    
+      IRIX )  
+    	PATH=/usr/local/bin:/usr/bin:/bin:/etc:/usr/etc:/usr/bsd:/usr/bin/X11:/usr/sbin
+    	HOST=`hostname`
+    	BRAND=sgi 
+        CC=cc
+        CFLAGS="-O"
+        F77=f77
+        ;;
+    
+      IRIX64 )  
+        PATH=/usr/local/bin:/usr/bin:/bin:/etc:/usr/etc:/usr/bsd:/usr/bin/X11:/usr/sbin
+        HOST=`hostname`
+        case "$sgi_mode" in
+          32  )  BRAND=sgi   ; CC="cc -32 -mips2"  ; F77="f77 -32 -mips2"  ;;
+          n32 )  BRAND=sgi32 ; CC="cc -n32 -mips3" ; F77="f77 -n32 -mips3"  ;;
+          64  )  BRAND=sgi64 ; CC="cc -64 -mips4"  ; F77="f77 -64 -mips4"  ;;
+          *   )  BRAND=sgi   ; CC="cc"  ; F77="f77"  ;;
+        esac
+        CFLAGS="-O"
+        set_compilers=0		# override ZLIB default compilers
+        ;;
+    
+      Linux )
+	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/X11/bin
+	HOST=`hostname -s`
+	BRAND=linux
+	if [ "$LINUX_BRAND" = "linux64" ] ; then
+	    BRAND=linux64
+	elif [ "$LINUX_BRAND" = "linux32" ] ; then
+	    BRAND=linux32
+	fi
+        CC="gcc $LNX_COMP_FLAG"
+        CFLAGS="-O"
+        F77="g77 $LNX_COMP_FLAG"
+	;;
+
+      Darwin )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname -s`
+        BRAND=macintosh
+        CC=gcc
+        CFLAGS="-O"
+        F77=g77
+        ;;
+
+      DarwinIntel )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname -s`
+        BRAND=macintel32
+	if [ "$MAC_BRAND" = "macintel64" ] ; then
+	    BRAND=macintel64
+	elif [ "$MAC_BRAND" = "macintel32" ] ; then
+	    BRAND=macintel32
+	fi
+        CC="gcc $MACINTEL_COMP_FLAG"
+        CFLAGS="-O2"
+        F77="gfortran $MACINTEL_COMP_FLAG"
+        ;;
+
+      Cygwin )
+        PATH=/bin:/sbin:/usr/bin:/usr/sbin
+        HOST=`hostname`
+        BRAND=cygwin
+        CC=gcc
+        CFLAGS="-O"
+        F77=g77
+        ;;
+
+      OSF1 )  
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/ccs/bin:/usr/sbin
+    	HOST=`hostname -s`
+    	BRAND=dec 
+        CC=cc
+        CFLAGS="-O -std"
+        F77=f77
+        ;;
+    
+      sco386 ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bin/X11
+    	HOST=`hostname -s`
+    	BRAND=sco 
+        CC=cc
+        CFLAGS="-O"
+        F77=f77
+        ;;
+    
+      SunOS ) 
+    	# distinguish between SunOS 5.x and 4.x versions
+    	if [ `uname -r | awk -F. '{print $1}'` = "5" ] ; then
+    	    BRAND=sun5			# release V5.x SunOS
+    	    PATH=/usr/local/bin:/opt/SUNWspro/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/openwin/bin:/usr/openwin/demo:/usr/ccs/bin:/usr/sbin
+            CC=cc
+            CFLAGS="-O"
+            F77=f77
+	    if [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 10" ] ; then
+		BRAND="sun5.10"			# release V5.10 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+		CC=cc
+		CFLAGS="-O"
+		F77=f77
+	    elif [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 9" ] ; then
+		BRAND="sun5.9"			# release V5.9 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+		CC=cc
+		CFLAGS="-O"
+		F77=f77
+	    elif [ "`uname -r | awk -F. '{print $1, $2}'`" = "5 8" ] ; then
+		BRAND="sun5.8"			# release V5.8 SunOS
+		PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/openwin/demo:/usr/sbin
+		CC=cc
+		CFLAGS="-O"
+		F77=f77
+	    fi
+    	else                                
+    	    BRAND=sun4			# release V4.x SunOS
+    	    PATH=/usr/local/bin:/usr/local/lang:/usr/lang:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/openwin/bin:/usr/openwin/demo
+            CC=acc
+            CFLAGS="-O"
+            F77=f77
+            set_compilers=1		# override ZLIB default compilers
+    	fi
+    	HOST=`hostname`
+        ;;
+    
+      UNICOS ) 
+    	PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/ucb:/usr/bin/X11
+    	HOST=`hostname`
+    	BRAND=cray 
+        CC=cc
+        CFLAGS="-O"
+        F77=cf77
+        ;;
+    
+      * )
+    	echo "Operating system: $OSTYPE not supported" 	>&2
+    	echo "This release of the Toolkitand hdfeos  supports: " 	>&2
+    	echo "   Sun SGI HP-9000 IBM-6000 DEC-Alpha Linux Macintosh and Cray/Unicos " 	>&2
+        exit 1
+        ;;
+    
+    esac
+
+
+    # if debug version was requested replace -O with -g in CFLAGS
+
+    if [ "$dbug" = "1" ] ; then
+	CFLAGS=`echo $CFLAGS | sed 's/-O/-g/'`
+    fi
+
+    CFLAGS="$CFLAGS $EXT_CC_FLAGS"
+
+    # export the architecture-specific variables
+
+    export BRAND HOST LOGNAME OSTYPE PATH USER
+    export CC CFLAGS F77
+    
+}
+
+
+#
+# Function to allow user to override the defaults for the compilers
+# The following variables are affected:
+#
+#         PATH CC F77
+#
+
+UserCompilers()
+{
+    #
+    # check to see if valid C compiler path was specified
+    #
+    
+    cc=""
+    
+    if [ "$cc_path" != ""  ] ; then
+    
+        if [ -f $cc_path ] ; then
+    
+            cc=`basename $cc_path`
+            cc_path=`echo $cc_path | sed 's%/[^/]*/*$%%'`
+	    case "$BRAND" in
+		"sgi32" )
+		    CC="$cc_path/$cc -n32"
+		;;
+
+		"sgi64" )
+		    cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+
+		    if [ "$cpu_type" == "4" ] ; then
+			CC="$cc_path/$cc -64 -mips3"
+		    else
+			CC="$cc_path/$cc -64 -mips4"
+		    fi
+		;;
+
+		"linux" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"linux32" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"linux64" )
+		    CC="$cc_path/$cc $LNX_COMP_FLAG"
+		;; 
+
+		"macintel" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel32" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;; 
+
+		"macintel64" )
+		    CC="$cc_path/$cc $MACINTEL_COMP_FLAG"
+		;; 
+
+		* )
+		    CC="$cc_path/$cc" 
+		;; 
+	    esac
+
+	    export CC		        # user overrides C compiler name
+	    set_compilers=1		# override HDF default compilers
+    
+	fi
+    
+        if [ -d $cc_path ] ; then	# make sure cc_path is now a directory
+    
+            PATH=${cc_path}:${PATH} 	# prepend cc_path to search path
+            export PATH
+    
+        else
+    
+            cc_path=""
+            echo "Warning: C compiler directory $cc_path not found."
+            echo  "ZLIB build may fail."
+    
+        fi
+    
+    fi
+    
+    
+    #
+    # check to see if valid FORTRAN compiler path was specified
+    #
+    
+    fc=""
+    
+    if [ "$fc_path" != "" ] ; then
+    
+        if [ -f $fc_path ] ; then
+    
+            fc=`basename $fc_path`
+            fc_path=`echo $fc_path | sed 's%/[^/]*$%%'`
+	    case "$BRAND" in
+		"sgi32" )
+		    F77="$fc_path/$fc -n32"
+		;;
+
+		"sgi64" )
+		    cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+		    if [ "$cpu_type" == "4" ] ; then
+			F77="$fc_path/$fc -64 -mips3"
+		    else
+			F77="$fc_path/$fc -64 -mips4"
+		    fi
+		;;
+
+		"linux" )
+		    F77="$fc_path/$fc $LNX_COMP_FLAG"
+		;; 
+
+		"linux64" )
+		    F77="$fc_path/$fc $LNX_COMP_FLAG"
+		;; 
+
+		"linux32" )
+		    F77="$fc_path/$fc $LNX_COMP_FLAG"
+		;; 
+
+		"macintel" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel32" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		"macintel64" )
+		    F77="$fc_path/$fc $MACINTEL_COMP_FLAG"
+		;;
+
+		* )
+		    F77="$fc_path/$fc" 
+		;; 
+	    esac
+
+    #        if [ "$fc" != f90 ] ; then	# (f90 not supported for HDF4.1r1)
+    # f90 is supported starting with the HDF4.1r2 release
+                export F77	# user overrides FORTRAN compiler name
+                set_compilers=1		# override HDF default compilers
+    #        fi
+    
+        fi
+    
+        if [ -d $fc_path ] ; then	# make sure fc_path is now a directory
+    
+            PATH=${fc_path}:${PATH} 	# prepend fc_path to search path
+            export PATH
+    
+        else
+    
+            fc_path=""
+            echo "Warning: FORTRAN directory $fc_path not found."
+            echo  "ZLIB build may fail."
+    
+        fi
+    
+    fi
+    
+}
+
+
+
+#
+# Function to get the location of the distribution file
+#
+    
+GetDistribution()
+{    
+    : ${distrib_file:=zlib-1.2.8.tar.gz}
+
+    ds1=$distrib_file			# backup copy
+    
+    # derive tar file name
+
+    case "$distrib_file" in
+
+      zlib-1.2.1.tar.gz  )
+        tar_file=zlib-1.2.1.tar
+        zlib_home=zlib-1.2.1
+        ;;
+
+      zlib-1.2.1.tar.Z  )
+        tar_file=zlib-1.2.1.tar
+        zlib_home=zlib-1.2.1
+        ;;
+
+      zlib-1.2.3.tar.gz  )
+        tar_file=zlib-1.2.3.tar
+        zlib_home=zlib-1.2.3
+        ;;
+
+      zlib-1.2.5.tar.gz  )
+        tar_file=zlib-1.2.5.tar
+        zlib_home=zlib-1.2.5
+        ;;
+
+      zlib-1.2.8.tar.gz  )
+        tar_file=zlib-1.2.8.tar
+        zlib_home=zlib-1.2.8
+        ;;
+
+      * )
+        EchoAndLog "ZLIB version in $distrib_file not supported by this script."
+        exit 1
+        ;;
+
+    esac
+
+    
+    # set search path to include current dir, parent of current and $HOME    
+    search_path=`pwd`
+    search_path="$search_path `cd ..; pwd` $HOME"
+
+    # set search file to include compressed tar file and uncompressed tar file
+    search_file="$distrib_file $tar_file"
+
+    # search for the distribution file
+
+    found_file=0
+    for distrib_path in $search_path ; do
+
+        for distrib_file in $search_file ; do
+
+            if [ -f ${distrib_path}/${distrib_file} ] ; then
+                found_file=1
+                break
+            fi
+
+        done
+
+        if [ $found_file = 1 ] ; then
+            break
+        fi
+
+    done
+
+    # if file was not found, ask the user
+
+    if [ $found_file = 0 ] ; then
+
+	if [ $batch_mode = 0 ] ; then
+	    echo ""	
+	    UserPrompt "Pathname where $ds1 is located: "
+	    echo ""
+  	else
+	    user_response=""
+	fi
+    
+        if [ "$user_response" != "" ] ; then
+
+            # make sure directory exists
+
+            if [ -d $user_response ] ; then
+                distrib_path=$user_response
+            else 
+                WriteError "Invalid directory: $user_response"
+                exit 1
+            fi
+    
+            # search for the distribution file in user directory
+
+            for distrib_file in $search_file ; do
+
+                if [ -f ${distrib_path}/${distrib_file} ] ; then
+                    found_file=1
+                    break
+                fi
+
+            done
+
+        fi
+
+
+    fi
+
+
+    if [ $found_file = 0 ] ; then
+        WriteError "Can't find ${ds1} in (${search_path})"
+        echo "ZLIB installation cancelled."
+        exit 1
+    fi
+
+}
+
+
+# 
+# Function to get the location of the ZLIB home directory for installation 
+# Also, prompt user that all information is valid before proceeding
+#
+
+GetInstallDir()
+{
+    default_ZLIB_path="`pwd`/zlib/$BRAND"
+
+    if [ "$ZLIB_path" = "" ] ; then
+	ZLIB_path="`pwd`/zlib/$BRAND"
+    fi
+
+    # ask the user
+
+    if [ $batch_mode = 0 ] ; then
+	UserPrompt "Pathname where directory '$zlib_home' will be created [$ZLIB_path]: " 
+	echo ""
+    else
+	user_response=""
+    fi
+    
+    if [ "$user_response" = "" ] ; then
+        if [  ! -d `dirname $ZLIB_path`  ] ; then mkdir `dirname $ZLIB_path` ; fi
+        if [  ! -d $ZLIB_path  ] ; then  mkdir $ZLIB_path ; fi
+    else
+#        if [ -d "$user_response" ] ; then 
+	ZLIB_path=$user_response ; #fi
+    fi
+
+    if [ ! -d $ZLIB_path ] ; then
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "$ZLIB_path does not exist.  Create [y]? "
+	else
+	    user_response=y
+	fi
+	if [ "$user_response" = "" ] ; then user_response="y" ; fi
+	case "$user_response" in
+	    y* | Y* )
+		mkdir -p $ZLIB_path
+		if [ ! -d $ZLIB_path ] ; then
+		    WriteError "Unable to create directory $ZLIB_path." 
+		    echo "ZLIB installation cancelled." 2>&1
+		    exit 1
+		
+		fi
+		;;
+	    *)
+		WriteError "Directory $ZLIB_path does not exist." 
+		echo "ZLIB installation cancelled." 2>&1
+		exit 1
+		;;
+        esac
+    fi
+    
+    
+    #
+    # confirm before proceeding
+    #
+    
+    echo "The ZLIB directory will be restored from: " 
+    echo "    ${distrib_path}/${distrib_file}" 
+    echo "" 
+    echo "The ZLIB directory will be created in: " 
+    echo "     ${ZLIB_path}" 
+    echo "" 
+
+    if [ $batch_mode = 0 ] ; then
+	UserPrompt "Continue [yes] ? " 
+	case "$user_response" in
+	    n* | N* ) echo "Cancelled." ; exit 1 ;;
+	    * ) echo "Confirmed." ; echo "" ;;
+	esac
+    fi
+
+#
+# For linux create soft links if default ZLIB installation directory is used
+#
+    save_dir="`pwd`"
+    if [ "`pwd`/zlib/$BRAND" = "$default_ZLIB_path" ] ;then
+	if [ "$BRAND" = "linux64" ] ; then
+	    cd ${default_ZLIB_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "64-bit structure is the default in this machine. Creating $current_path/linux as a soft link to $default_ZLIB_path"
+	    ln -s ./linux64 linux
+ 	    cd $save_dir
+	fi
+
+	if [ "$BRAND" = "linux" ] ; then
+	    cd ${default_ZLIB_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "32-bit structure is the default in this machine. Creating $current_path/linux32 as a soft link to $default_ZLIB_path"
+	    ln -s ./linux linux32
+ 	    cd $save_dir
+	fi
+    fi
+
+
+#
+# For macintel create soft links if default ZLIB installation directory is used
+#
+    save_dir="`pwd`"
+    if [ "`pwd`/zlib/$BRAND" = "$default_ZLIB_path" ] ;then
+	if [ "$BRAND" = "macintel32" ] ; then
+	    cd ${default_ZLIB_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "macintel32 directories will be soft linked to macintel. Creating $current_path/macintel as a soft link to $default_ZLIB_path"
+	    ln -s ./macintel32 macintel
+ 	    cd $save_dir
+	fi
+
+	if [ "$BRAND" = "macintel" ] ; then
+	    cd ${default_ZLIB_path}/..
+	    current_path="`pwd`"
+	    EchoAndLog "macintel32 directories will be soft linked to macintel. Creating $current_path/macintel32 as a soft link to $default_ZLIB_path"
+	    ln -s ./macintel macintel32
+ 	    cd $save_dir
+	fi
+    fi
+}
+
+
+#
+# Function to unpack the distribution file into the installation directory
+#
+
+UnpackDistribution()
+{
+    #
+    # Go to the ZLIB parent directory
+    #
+    
+    cd $ZLIB_path
+
+    #
+    # If the new ZLIB home directory already exits, it must
+    # be removed first.  Check with the user before proceeding.
+    #
+    
+    if [ -d "$zlib_home" ] ; then
+    
+        EchoAndLog "The directory $zlib_home already exists."
+	if [ $batch_mode = 0 ] ; then
+	    UserPrompt "Replace it [no] ? "
+	else
+	    user_response=y
+	fi
+
+        case "$user_response" in
+          y* | Y* )
+            EchoAndLog "Removing old $zlib_home directory ..."
+            /bin/rm -rf $zlib_home
+            ;;
+    
+          * )
+            EchoAndLog "Cancelled."
+            exit 1
+            ;;
+        esac
+    
+    fi
+    
+    
+    #
+    # Create a link to the distribution file, if necessary.
+    #
+
+    link_flag=0
+    if [ ! -f $distrib_file ] ; then
+        if [ -f ${distrib_path}/${distrib_file} ] ; then
+            ln -s ${distrib_path}/${distrib_file} ${distrib_file}
+            link_flag=1
+        fi
+    fi
+    
+    # 
+    # Uncompress the distribution file, (if needed), and extract the files
+    # 
+    
+    EchoAndLog "Extracting files from $distrib_file ..."
+
+    suffix="`echo $distrib_file |  sed 's/^.*\.//'`"
+    case $suffix in
+    
+      Z  )
+        zcat $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+
+      gz )
+	gzip -cd $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+#        GnuZcat
+#        if [ $gnu_zcat != 1 ] ; then
+#            WriteError "You need the GNU version of zcat to unpack this file."
+#            exit 1
+#        fi
+#         zcat $distrib_file | tar xvf - | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+
+      tar)
+        echo $distrib_file
+        tar -xvf $distrib_file | awk '{printf "."}' 2>&1
+        echo ""
+        ;;
+    
+    esac
+
+    #
+    # Clean up symbolic link, if present
+    #
+
+    if [ $link_flag = 1 ] ; then
+        /bin/rm -f $distrib_file
+    fi
+
+
+}
+
+
+#
+# See if zcat is GNU version
+#
+
+GnuZcat()
+{
+    if [ "$1" = "" ] ; then
+        zcat_cmd=zcat
+    else
+        zcat_cmd=$1
+    fi
+    
+    buf=`exec 2>&1; $zcat_cmd < /dev/null | tail -1` 
+    buf=`echo $buf | awk -F: '{print $1}'`
+    
+    case "$buf" in
+      zcat) gnu_zcat=1 ;;
+      *   ) gnu_zcat=0 ;;
+    esac
+}
+
+
+#
+# Strip all ZLIB distribution files not needed after installation.
+#
+
+StripHdfInstall()
+{
+    cd $ZLIBHOME
+
+    here=`pwd`
+    here=`basename $here`
+
+    #
+    # Make sure this is a valid ZLIB directory befor clobbering files !
+    # 
+
+    if [ "`echo $here | grep '^ZLIB'`" = "" ] ; then
+    
+        EchoAndLog "Not a valid ZLIB directory: no files removed."
+        
+    else
+
+        EchoAndLog "Removing all non-installation ZLIB files ..."
+
+        for file in * ; do
+
+            if [ -d "$file" ] ; then
+    
+                case "$file" in 
+        
+                  bin | lib | include | man ) ;;
+                  * ) rm -rf $file ;;
+              
+                esac
+        
+            else
+    
+                rm -f $file
+        
+            fi
+    
+        done
+        
+    fi
+}
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+
+
+#
+# Get arguments from command line
+#
+
+log_file=""
+home_file=""
+noquery=0
+clean=0
+cleano=0
+strip_install=0
+append=0
+no_untar=0
+sgi_mode=32
+f90_flag=0
+nag_flag=0
+absoft_flag=0
+fc_path=""
+cc_path=""
+distrib_file=""
+set_compilers=0
+dbug=0
+ZLIB_path=""
+batch_mode=0
+
+while [ "$1" != "" ] ; do 
+
+    case "$1" in
+
+      -h )
+        Help
+        ;;
+
+      -f90 )
+        f90_flag=1
+        ;;
+
+      -NAG )
+        if [  $f90_flag = 0  ] ; then
+            WriteError "Must first specify -f90 and set compiler path."
+            Help
+        else
+            nag_flag=1
+        fi
+        ;;
+
+      -ABSOFT )
+	    absoft_flag=1
+	;;
+
+      -fc_path )
+        fc_path="$2"
+        shift
+        ;;
+
+      -cc_path )
+        cc_path="$2"
+        shift
+        ;;
+
+      -df)
+        distrib_file="$2"
+        shift
+        ;;
+
+      -sgi32 )
+        sgi_mode=n32
+        ;;
+
+      -sgi64 )
+        sgi_mode=64
+        ;;
+
+      -log )
+        if [ "$2" != "" ] ; then
+            if [ "` echo $2 | cut -c1`" = "/" ] ; then
+                log_file="$2"
+            else
+                log_file="$start_dir/$2"
+            fi
+            shift
+        else
+            WriteError "A log file must be specified with the -log option."
+            Help
+        fi
+        ;;
+
+      -append )
+        append=1
+        ;;
+
+      -w_home )
+        if [ "$2" != "" ] ; then
+            if [ "` echo $2 | cut -c1`" = "/" ] ; then
+                home_file="$2"
+            else
+                home_file="$start_dir/$2"
+            fi
+            shift
+        else
+            WriteError "No file specified with -w_home switch."
+            Help
+        fi
+        ;;
+
+      -nq | -noquery )
+        noquery=1
+        ;;
+
+      -clean )
+        clean=1
+        ;;
+
+      -cleano )
+        cleano=1
+        ;;
+
+      -strip )
+        strip_install=1
+        ;;
+
+      -no_untar )
+        no_untar=1
+        ;;
+
+      -install_dir )
+        if [ "$2" != "" ] ; then
+	    ZLIB_path=$2
+            shift
+        else
+            WriteError "No installation directory specified with -install_dir switch."
+            Help
+        fi
+        ;;
+
+	-batch )
+	    batch_mode=1
+	;;
+
+      * )
+        echo "$script_error invalid argument '$1'"
+        Help
+        ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Inititialize log file
+#
+
+if [ "$log_file" != "" ] ; then
+
+    if [ "$append" = "0" ] ; then
+        if [ -f "$log_file" ] ; then 
+            /bin/rm  -f $log_file > /dev/null 2>&1
+        fi
+    fi
+
+    touch $log_file > /dev/null 2>&1
+    if [ $? != 0 ] ; then
+        WriteError "Cannot write to file $log_file"
+        exit 1
+    fi
+
+    echo ""
+    echo "`basename $0`: session output will go to file: "
+    echo ""
+    echo "     $log_file"
+    echo ""
+
+fi
+
+export log_file
+
+#
+# Initialize the home file
+#
+
+if [ "$home_file" != "" ] ; then
+
+    if [ -f "$home_file" ] ; then 
+        /bin/rm -f $home_file > /dev/null 2>&1
+    fi
+
+    touch $home_file > /dev/null 2>&1
+    if [ $? != 0 ] ; then
+        WriteError "Cannot write to file $home_file"
+        exit 1
+    fi
+
+fi
+
+
+#
+# Set architecture-specific variables
+#
+
+SetArchitecture
+
+
+#
+# Set user compiler overrides
+#
+
+UserCompilers
+
+
+#
+# Get the location of the distribution file
+#
+
+GetDistribution
+
+
+#
+# Got valid distribution file
+# Get the location of the ZLIB home directory for installation
+#
+
+GetInstallDir
+
+
+#
+# Write the log file header
+#
+
+if [ "$log_file" != "" ] ; then
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "ZLIB installation starting at: `date`" >> $log_file
+    echo "host: $HOST    type: $BRAND     user: $USER " >> $log_file
+    echo "" >> $log_file
+    echo "" >> $log_file
+    echo "The ZLIB directory will be restored from: " >> $log_file
+    echo "    ${distrib_path}/${distrib_file}" >> $log_file
+    echo "" >> $log_file
+    echo "The ZLIB directory will be created in: " >> $log_file
+    echo "     ${ZLIB_path}" >> $log_file
+    echo "" >> $log_file
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "" >> $log_file
+fi
+
+
+#
+# Unpack the distribution file into the installation directory
+#
+
+    cd $ZLIB_path
+
+    if [ "$no_untar" = 0 ] ; then
+        UnpackDistribution
+    fi
+
+
+#
+# Prepare to install the requested version of ZLIB 
+#
+
+if [ ! -d $zlib_home ] ; then
+    EchoAndLog "Error creating directory: $zlib_home"
+    exit 1
+fi
+
+cd $zlib_home				# go to the starting directory
+
+zlib_install_caller="$this_script"	# set caller flag for sub-modules
+export zlib_install_caller
+
+
+#
+# Set the version to be installed
+#
+
+install_script=""
+install_options=""
+
+case $zlib_home in
+
+  zlib-1.2.1)
+
+    ZLIBHOME=${ZLIB_path}/zlib-1.2.1 ; export ZLIBHOME
+    install_script="$script_dir/INSTALL-ZLIB-1.2.1"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${ZLIBHOME}"
+    ;;
+
+  zlib-1.2.3)
+
+    ZLIBHOME=${ZLIB_path}/zlib-1.2.3 ; export ZLIBHOME
+    install_script="$script_dir/INSTALL-ZLIB-1.2.3"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${ZLIBHOME}"
+    ;;
+
+  zlib-1.2.5)
+
+    ZLIBHOME=${ZLIB_path}/zlib-1.2.5 ; export ZLIBHOME
+    install_script="$script_dir/INSTALL-ZLIB-1.2.5"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${ZLIBHOME}"
+    ;;
+
+  zlib-1.2.8)
+
+    ZLIBHOME=${ZLIB_path}/zlib-1.2.8 ; export ZLIBHOME
+    install_script="$script_dir/INSTALL-ZLIB-1.2.8"
+    if [ $set_compilers = 1 ] ; then
+        install_options="-set_compilers"
+    fi
+    if [ $dbug = 1 ] ; then
+        install_options="$install_options -dbug"
+    fi
+    install_options="$install_options -start_dir ${ZLIBHOME}"
+    ;;
+
+  * ) 			# unsupported
+    EchoAndLog "$zlib_home installation is not supported by this script."
+    exit 1
+    ;;
+
+esac
+
+
+#
+# Run the install script
+#
+
+if [ ! -f $install_script ] ; then
+    EchoAndLog "Can't find $install_script - installation failed."
+    exit 1
+fi
+
+$install_script $install_options
+
+if [ $? != 0 ] ; then
+    EchoAndLog "$zlib_home Installation failed."
+    exit 1
+fi
+
+
+# 
+# Pass back the ZLIB install directory for the hdfeos installation
+# 
+
+if [ "$home_file" != "" ] ; then
+    echo $ZLIBHOME >> $home_file
+fi
+
+
+
+#
+# Clean up
+#
+
+cd $ZLIB_path
+
+if [ "$clean" = 1 ] ; then
+
+    for dir in $ZLIBHOME ; do 
+
+        cd $dir
+        echo "Cleaning up in $dir ..."
+
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+            echo "Cleaning up in $dir ..." >> $log_file
+            echo "" >> $log_file
+            make clean  >> $log_file 2>&1
+        else
+            make clean
+        fi
+
+    done
+
+fi
+
+if [ "$cleano" = 1 ] ; then
+
+    cd $ZLIBHOME
+    echo "Removing any remaining object files ..." 
+
+    if [ "$log_file" != "" ] ; then
+        echo "" >> $log_file
+        echo "Removing any remaining object files ..." >> $log_file
+        echo "" >> $log_file
+        find . -name \*.o -print -exec rm -f {} \; >> $log_file 2>&1
+        find . -name a.out -print -exec rm -f {} \; >> $log_file 2>&1
+    else
+        find . -name \*.o -print -exec rm -f {} \; 
+        find . -name a.out -print -exec rm -f {} \; 
+    fi
+    
+fi
+
+
+if [ "$strip_install" = 1 ] ; then
+
+    StripHdfInstall
+   
+fi
+
+
+echo "------------------------------------------------------------"
+echo ""
+echo "    ZLIB installation ending at: `date` " 
+echo ""
+echo "------------------------------------------------------------"
+
+
+
+#
+# Write the log file trailer
+#
+
+if [ "$log_file" != "" ] ; then
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+    echo "    ZLIB installation ending at: `date`" >> $log_file
+    echo "" >> $log_file
+    echo "------------------------------------------------------------" >> $log_file
+    echo "" >> $log_file
+fi
+
diff --git a/bin/INSTALL-Scripts/INSTALL-ZLIB-1.2.5 b/bin/INSTALL-Scripts/INSTALL-ZLIB-1.2.5
new file mode 100755
index 0000000..69218ff
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-ZLIB-1.2.5
@@ -0,0 +1,620 @@
+#! /bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-ZLIB-1.2.5
+#
+# description:
+# 	Installation script module for installing ZLIB-1.2.3
+# 	for the SDP (PGS) Toolkit and hdfeos.  
+#       It implements patches to the NCSA 
+# 	installation procedure to allow for trouble-free installation on
+# 	the platforms supported by the SDP (PGS) Toolkit and hdfeos.
+#
+# usage:
+# 	Called from INSTALL-ZLIB
+#
+# 	INSTALL-ZLIB-1.2.5 -h[elp]
+#
+# 	  -h      : display this help message and exit
+# 	  -dbug   : install debug version of ZLIB 
+#
+# notes:
+# 	This is NOT a standalone script.  It is only intended to be run
+# 	by INSTALL-ZLIB, the ZLIB installation script.
+# 
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        Abe Taaheri / L-3 comm. GSI
+#        Adura Adekunjo / L-3 comm. GSI
+#
+# history:
+#       26-Mar-2004 AA Used INSTALL-SZIP1.1 as template for INSTALL-ZLIB-1.2.1
+#       20-July-2010 AT Created this file for INSTALL-ZLIB-1.2.5
+#-----------------------------------------------------------------------------
+
+
+#
+# Save starting directory, path
+# Create error message header
+#
+
+start_dir=`pwd`
+start_path=$PATH
+this_script="`basename $0`"
+script_error="$this_script: Error:"
+
+#
+# Get absolute pathname where this script is located
+# This allows the script to locate any needed auxilliary files
+#
+
+script_dir="`dirname $0`"
+abs="`echo $script_dir | cut -c1`"
+if [ "$abs" != "/" ] ; then
+    script_dir=`cd $script_dir;pwd`
+fi
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    if [ "$1" = "-n" ] ; then		# -n: suppress leading blank line
+        shift
+    else
+        echo ""
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+        fi
+    fi
+    
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+         echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function to prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to silently emulate the 'which' command 
+#
+
+Which()
+{
+    if [ "$1" = "" ] ; then 
+        WriteError "Which() : Too few arguments." 
+        exit 1 
+    fi
+
+    saveifs="$IFS"
+    IFS=:
+    which_result=0
+    which_cmd=""
+    
+    for dir in $PATH;  do 
+        if [ -x $dir/$1 ] ; then 
+            which_result=1 
+            which_cmd=$dir/$1
+            break 
+        fi 
+    done
+    
+    IFS="$saveifs"
+}
+
+#
+# Function to set compilers, overriding the NCSA compiler defaults
+#
+    
+SetCompilers()
+{
+    #
+    # Set C compiler based on value of $CC
+    # Set C compilation flags based on value of $CFLAGS
+    # Set FORTRAN compiler based on value of $F77
+    # 
+    # NOTE: 
+    #     This is done recursively for ALL Makefiles because on some
+    #     platforms, the compiler variables are not inherited from the
+    #     the calling Makefile.
+
+
+    EchoAndLog "Overriding NCSA default compiler settings:"
+
+    files=`find . -name Makefile -print`
+
+    if [ "$CC" != "" ] ; then
+
+        if [ "$CFLAGS" = "" ] ; then
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+            for file in $files ; do
+            
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        else
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            if [ "$CFLAGS" = "-O" ] ; then
+                EchoAndLog -n "- setting C compilation flags to default"
+            else
+                EchoAndLog -n "- setting C compilation flags to '$CFLAGS'"
+            fi
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+           for file in $files ; do
+
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^CFLAGS/s/=.*$'"/= $CFLAGS/" |
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        fi
+
+    else
+
+        EchoAndLog "Warning: Environment variable(s) CC and/or F77 not set."
+        EchoAndLog "If CC is not set, the installation uses NCSA defaults."
+
+    fi
+
+}
+
+
+PreConfigZLIBFixes_mac()
+
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure ZLIB fixes for $BRAND ... "
+    echo " "
+    file=$start_dir/configure
+
+    if [ ! -f $file.ncsa.default ] ; then
+	mv  $file $file.ncsa.default
+    fi
+
+    sed "s^libdir='/usr/lib'^libdir='DOLLAR{prefix}/lib'^g" $file.ncsa.default > $file
+    mv $file $file.ncsa.default
+    sed "s^includedir='/usr/include'^includedir='DOLLAR{prefix}/include'^g" $file.ncsa.default > $file
+    mv $file $file.ncsa.default
+    sed 's^DOLLAR^$^g' $file.ncsa.default > $file
+    /bin/chmod 0755 $file
+    /bin/rm -f $file.ncsa.default
+
+    cd $start_dir
+}
+
+#
+# Function to do architecture-specific pre-configure fixes
+#
+    
+PreConfigure()
+{
+
+    cd $start_dir
+
+    if [ "$dbug" = "1" ] ; then
+	PreConfigFixes_dbug
+    fi
+
+    #
+    # Call architecture-specific functions
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) ;;
+    
+        hp    ) ;;
+    
+        ibm   ) ;;
+
+        linux ) ;;
+
+        linux32 ) ;;
+
+        linux64 ) ;;
+
+        macintosh ) ;;
+    
+        macintel ) ;;
+        
+        macintel32 ) ;;
+        
+        macintel64 ) ;;
+    
+        sgi   ) ;;
+    
+        sgi32 ) ;;
+
+        sgi64 ) ;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+
+        sun5.9  ) ;;
+
+        sun5.10  ) ;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    cd $start_dir
+
+}
+
+
+#
+# Function to do architecture-specific post-configure fixes
+#
+    
+PostConfigure()
+{
+    cd $start_dir
+    
+    
+    #
+    # Check for missing tbl and neqn, patching as needed
+    #
+
+#    PostConfigFixes_NoTblNeqn
+
+
+    #
+    # Do architecture-specific fixes
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) ;;
+    
+        hp    ) ;;
+    
+        ibm   ) ;;
+
+        ibm   ) ;;
+
+        linux ) ;;
+
+        linux32 ) ;;
+
+        linux64 ) ;;
+
+        macintosh ) ;;
+
+        macintel ) ;;
+
+        macintel32 ) ;;
+
+        macintel64 ) ;;
+
+	cygwin ) ;;
+    
+        sgi   ) ;;
+    
+        sgi32 ) ;;
+
+        sgi64 ) ;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+    
+        sun5.9  ) ;;
+
+        sun5.10  ) ;;
+
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    
+    #
+    # If requested, set compilers to something other than the defaults
+    #
+
+    if [ $set_compilers = 1 ] ; then
+        SetCompilers
+    fi
+
+    cd $start_dir
+}
+
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+#
+# Get arguments from command line
+#
+
+set_compilers=0
+config_flags=""
+dbug=0
+
+while [ "$1" != "" ] ; do 
+
+    case "$1" in
+
+      -h | help ) Help ;;
+
+      -set_compilers ) set_compilers=1 ;;
+
+      -dbug ) dbug=1 ;;
+
+      -start_dir ) 
+          if [ "$2" != "" ] ; then
+              start_dir=$2
+              shift
+          else
+              WriteError "No installation directory specified with -start_dir switch."
+              Help
+          fi
+        ;;
+
+
+      * ) echo "$script_error invalid argument '$1'" ; Help ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Make sure we're not running standalone
+#
+
+if [ "$zlib_install_caller" = "" ] ; then
+
+    WriteError "This script can only be run from INSTALL-ZLIB."
+    Help
+
+else
+
+    # Here we set up the ZLIB installation directory,
+    # for use by the configure script.  
+    # 
+
+    install_dir="$ZLIBHOME"
+
+    if [ ! -d "$install_dir" ] ; then 	# create the install dir, if needed.
+        mkdir $install_dir
+    fi
+
+fi
+
+
+
+#
+# Announce
+#
+
+EchoAndLog "Running $this_script"
+
+if [ "$BRAND" = "macintosh" ] || [ "$BRAND" = "macintel" ] ; then
+PreConfigZLIBFixes_mac
+fi
+
+#
+# Run the NCSA-supplied configure script
+#
+
+cd $start_dir
+
+tmp_home=$HOME			# save $HOME
+HOME=`pwd` ; export HOME	# change it to avoid interaction w/ .cshrc
+
+if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ]  ; then
+	EchoAndLog "Running ./configure --prefix=$install_dir $config_flags"
+else
+	EchoAndLog "Running ./configure --prefix=$install_dir $config_flags"
+fi
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+	if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	./configure --prefix=$install_dir $config_flags >> $log_file 2>&1
+	else
+	./configure --prefix=$install_dir $config_flags >> $log_file 2>&1
+	fi
+else
+    echo ""
+	if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	./configure --prefix=$install_dir $config_flags
+	else
+	./configure --prefix=$install_dir $config_flags
+	fi
+fi
+
+HOME=$tmp_home ; export HOME	# restore $HOME
+
+
+#
+# Do architecture-specific post-configure fixes
+#
+
+
+PostConfigure
+
+
+#
+# Run the make utility to compile the library and utiltites
+#
+
+EchoAndLog "Running make, target=all"
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make
+    tmp_status=$?
+fi
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make' failed."
+    exit 1
+fi
+
+
+EchoAndLog "Running make, target=test"
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make test>> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make test
+    tmp_status=$?
+fi
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make all' failed."
+    exit 1
+fi
+
+
+
+#
+# Run the make utility install the libraries, utilities, includes and man pages 
+#
+
+if [ "$BRAND" = "macintosh" ] ; then
+   /bin/mkdir $ZLIBHOME/include
+   /bin/mkdir $ZLIBHOME/lib
+fi
+
+if [ "$BRAND" = "macintel" ] ; then
+   /bin/mkdir $ZLIBHOME/include
+   /bin/mkdir $ZLIBHOME/lib
+fi
+
+if [ "$BRAND" = "ibm" ] ; then
+   /bin/mkdir $ZLIBHOME/include
+   /bin/mkdir $ZLIBHOME/lib
+fi
+
+EchoAndLog "Running make, target=install "
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make install >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make install
+    tmp_status=$?
+fi
+
+
+if [ "$tmp_status" != 0 ] ; then
+    if [ "$BRAND" = "cygwin" ] ; then
+	EchoAndLog "Run of 'make install' failed.But it was completed in the install script."
+	if [ -f $ZLIBHOME/lib/libz.a ] ; then
+	    if [ ! -d $ZLIBHOME/include ] ; then
+		EchoAndLog "Creating $ZLIBHOME/include directory."
+		mkdir -p $ZLIBHOME/include
+	    fi
+	    cp zlib.h $ZLIBHOME/include/.
+	    cp zconf.h $ZLIBHOME/include/.
+	    chmod 644 $ZLIBHOME/include/zlib.h $ZLIBHOME/include/zconf.h
+	    ranlib $ZLIBHOME/lib/libz.a
+	else
+	    EchoAndLog "Run of 'make install' failed."
+	    exit 1
+	fi
+    else
+	EchoAndLog "Run of 'make install' failed."
+	exit 1
+    fi
+fi
diff --git a/bin/INSTALL-Scripts/INSTALL-ZLIB-1.2.8 b/bin/INSTALL-Scripts/INSTALL-ZLIB-1.2.8
new file mode 100755
index 0000000..6efd3b1
--- /dev/null
+++ b/bin/INSTALL-Scripts/INSTALL-ZLIB-1.2.8
@@ -0,0 +1,621 @@
+#! /bin/sh
+#-----------------------------------------------------------------------------
+# filename:
+# 	INSTALL-ZLIB-1.2.8
+#
+# description:
+# 	Installation script module for installing ZLIB-1.2.8
+# 	for the SDP (PGS) Toolkit and hdfeos.  
+#       It implements patches to the NCSA 
+# 	installation procedure to allow for trouble-free installation on
+# 	the platforms supported by the SDP (PGS) Toolkit and hdfeos.
+#
+# usage:
+# 	Called from INSTALL-ZLIB
+#
+# 	INSTALL-ZLIB-1.2.8 -h[elp]
+#
+# 	  -h      : display this help message and exit
+# 	  -dbug   : install debug version of ZLIB 
+#
+# notes:
+# 	This is NOT a standalone script.  It is only intended to be run
+# 	by INSTALL-ZLIB, the ZLIB installation script.
+# 
+# author:
+#        Mike Sucher / Applied Research Corp.
+#        Abe Taaheri / L-3 comm. GSI
+#        Adura Adekunjo / L-3 comm. GSI
+#
+# history:
+#       26-Mar-2004 AA Used INSTALL-SZIP1.1 as template for INSTALL-ZLIB-1.2.1
+#       20-July-2010 AT Created this file for INSTALL-ZLIB-1.2.5
+#       27-Jan-2014  AT  Updated this file for INSTALL-ZLIB-1.2.8
+#-----------------------------------------------------------------------------
+
+
+#
+# Save starting directory, path
+# Create error message header
+#
+
+start_dir=`pwd`
+start_path=$PATH
+this_script="`basename $0`"
+script_error="$this_script: Error:"
+
+#
+# Get absolute pathname where this script is located
+# This allows the script to locate any needed auxilliary files
+#
+
+script_dir="`dirname $0`"
+abs="`echo $script_dir | cut -c1`"
+if [ "$abs" != "/" ] ; then
+    script_dir=`cd $script_dir;pwd`
+fi
+
+
+#****************************************************************
+#                                                               *
+#                   * * * Functions  * * *                      *
+#                                                               *
+#****************************************************************
+
+#
+# Function to output error message
+#
+
+WriteError()
+{
+    echo ""
+    echo "${this_script}: Error: $*"  >&2
+}
+
+
+#
+# Function to output message to logfile and console
+#
+
+EchoAndLog()
+{
+    if [ "$1" = "-n" ] ; then		# -n: suppress leading blank line
+        shift
+    else
+        echo ""
+        if [ "$log_file" != "" ] ; then
+            echo "" >> $log_file
+        fi
+    fi
+    
+    echo "$*"
+    if [ "$log_file" != "" ] ; then
+         echo "$*" >> $log_file
+    fi
+}
+
+
+#
+# Function to prompt for user response
+#
+
+UserPrompt()
+{
+    if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	/bin/echo "$* \c" > /dev/tty
+    else
+	echo "$* \\c" > /dev/tty
+    fi
+    read user_response
+}
+
+
+#
+# Function to output help message and exit
+#
+
+Help()
+{
+    sed -n '/filename:/,/author:/p' $0 | grep -v "author:" | cut -c3-300 | more
+    #this line must be here because it contains the string: "author:"
+    exit
+}
+
+
+#
+# Function to silently emulate the 'which' command 
+#
+
+Which()
+{
+    if [ "$1" = "" ] ; then 
+        WriteError "Which() : Too few arguments." 
+        exit 1 
+    fi
+
+    saveifs="$IFS"
+    IFS=:
+    which_result=0
+    which_cmd=""
+    
+    for dir in $PATH;  do 
+        if [ -x $dir/$1 ] ; then 
+            which_result=1 
+            which_cmd=$dir/$1
+            break 
+        fi 
+    done
+    
+    IFS="$saveifs"
+}
+
+#
+# Function to set compilers, overriding the NCSA compiler defaults
+#
+    
+SetCompilers()
+{
+    #
+    # Set C compiler based on value of $CC
+    # Set C compilation flags based on value of $CFLAGS
+    # Set FORTRAN compiler based on value of $F77
+    # 
+    # NOTE: 
+    #     This is done recursively for ALL Makefiles because on some
+    #     platforms, the compiler variables are not inherited from the
+    #     the calling Makefile.
+
+
+    EchoAndLog "Overriding NCSA default compiler settings:"
+
+    files=`find . -name Makefile -print`
+
+    if [ "$CC" != "" ] ; then
+
+        if [ "$CFLAGS" = "" ] ; then
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+            for file in $files ; do
+            
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        else
+
+            EchoAndLog -n "- setting C compiler to '$CC'"
+            if [ "$CFLAGS" = "-O" ] ; then
+                EchoAndLog -n "- setting C compilation flags to default"
+            else
+                EchoAndLog -n "- setting C compilation flags to '$CFLAGS'"
+            fi
+            EchoAndLog -n "- setting FORTRAN compiler to '$F77'"
+             
+           for file in $files ; do
+
+                if [ ! -f $file.ncsa.default ] ; then
+                    mv  $file $file.ncsa.default
+                fi
+
+                cat $file.ncsa.default |
+#                sed '/^CC/s/=.*$'"/= $CC/" | 
+#                sed '/^CFLAGS/s/=.*$'"/= $CFLAGS/" |
+#                sed '/^FC/s/=.*$'"/= $F77/" |
+                cat > $file.ncsa
+
+                cp $file.ncsa $file
+
+            done
+
+        fi
+
+    else
+
+        EchoAndLog "Warning: Environment variable(s) CC and/or F77 not set."
+        EchoAndLog "If CC is not set, the installation uses NCSA defaults."
+
+    fi
+
+}
+
+
+PreConfigZLIBFixes_mac()
+
+{
+    cd $start_dir
+
+    EchoAndLog "Pre-configure ZLIB fixes for $BRAND ... "
+    echo " "
+    file=$start_dir/configure
+
+    if [ ! -f $file.ncsa.default ] ; then
+	mv  $file $file.ncsa.default
+    fi
+
+    sed "s^libdir='/usr/lib'^libdir='DOLLAR{prefix}/lib'^g" $file.ncsa.default > $file
+    mv $file $file.ncsa.default
+    sed "s^includedir='/usr/include'^includedir='DOLLAR{prefix}/include'^g" $file.ncsa.default > $file
+    mv $file $file.ncsa.default
+    sed 's^DOLLAR^$^g' $file.ncsa.default > $file
+    /bin/chmod 0755 $file
+    /bin/rm -f $file.ncsa.default
+
+    cd $start_dir
+}
+
+#
+# Function to do architecture-specific pre-configure fixes
+#
+    
+PreConfigure()
+{
+
+    cd $start_dir
+
+    if [ "$dbug" = "1" ] ; then
+	PreConfigFixes_dbug
+    fi
+
+    #
+    # Call architecture-specific functions
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) ;;
+    
+        hp    ) ;;
+    
+        ibm   ) ;;
+
+        linux ) ;;
+
+        linux32 ) ;;
+
+        linux64 ) ;;
+
+        macintosh ) ;;
+    
+        macintel ) ;;
+        
+        macintel32 ) ;;
+        
+        macintel64 ) ;;
+    
+        sgi   ) ;;
+    
+        sgi32 ) ;;
+
+        sgi64 ) ;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+
+        sun5.9  ) ;;
+
+        sun5.10  ) ;;
+    
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    cd $start_dir
+
+}
+
+
+#
+# Function to do architecture-specific post-configure fixes
+#
+    
+PostConfigure()
+{
+    cd $start_dir
+    
+    
+    #
+    # Check for missing tbl and neqn, patching as needed
+    #
+
+#    PostConfigFixes_NoTblNeqn
+
+
+    #
+    # Do architecture-specific fixes
+    #
+
+    case $BRAND in
+    
+        cray  ) ;;
+    
+        dec   ) ;;
+    
+        hp    ) ;;
+    
+        ibm   ) ;;
+
+        ibm   ) ;;
+
+        linux ) ;;
+
+        linux32 ) ;;
+
+        linux64 ) ;;
+
+        macintosh ) ;;
+
+        macintel ) ;;
+
+        macintel32 ) ;;
+
+        macintel64 ) ;;
+
+	cygwin ) ;;
+    
+        sgi   ) ;;
+    
+        sgi32 ) ;;
+
+        sgi64 ) ;;
+    
+        sun4  ) ;;
+    
+        sun5  ) ;;
+
+        sun5.8  ) ;;
+    
+        sun5.9  ) ;;
+
+        sun5.10  ) ;;
+
+        *     ) WriteError "Architecture $BRAND is not supported."
+                exit 1 ;;
+    
+    esac
+
+    
+    #
+    # If requested, set compilers to something other than the defaults
+    #
+
+    if [ $set_compilers = 1 ] ; then
+        SetCompilers
+    fi
+
+    cd $start_dir
+}
+
+
+
+#****************************************************************
+#                                                               *
+#                  * * * Main Program  * * *                    *
+#                                                               *
+#****************************************************************
+
+#
+# Get arguments from command line
+#
+
+set_compilers=0
+config_flags=""
+dbug=0
+
+while [ "$1" != "" ] ; do 
+
+    case "$1" in
+
+      -h | help ) Help ;;
+
+      -set_compilers ) set_compilers=1 ;;
+
+      -dbug ) dbug=1 ;;
+
+      -start_dir ) 
+          if [ "$2" != "" ] ; then
+              start_dir=$2
+              shift
+          else
+              WriteError "No installation directory specified with -start_dir switch."
+              Help
+          fi
+        ;;
+
+
+      * ) echo "$script_error invalid argument '$1'" ; Help ;;
+
+    esac
+
+    shift
+
+done
+
+
+#
+# Make sure we're not running standalone
+#
+
+if [ "$zlib_install_caller" = "" ] ; then
+
+    WriteError "This script can only be run from INSTALL-ZLIB."
+    Help
+
+else
+
+    # Here we set up the ZLIB installation directory,
+    # for use by the configure script.  
+    # 
+
+    install_dir="$ZLIBHOME"
+
+    if [ ! -d "$install_dir" ] ; then 	# create the install dir, if needed.
+        mkdir $install_dir
+    fi
+
+fi
+
+
+
+#
+# Announce
+#
+
+EchoAndLog "Running $this_script"
+
+if [ "$BRAND" = "macintosh" ] || [ "$BRAND" = "macintel" ] ; then
+PreConfigZLIBFixes_mac
+fi
+
+#
+# Run the NCSA-supplied configure script
+#
+
+cd $start_dir
+
+tmp_home=$HOME			# save $HOME
+HOME=`pwd` ; export HOME	# change it to avoid interaction w/ .cshrc
+
+if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ]  ; then
+	EchoAndLog "Running ./configure --prefix=$install_dir $config_flags"
+else
+	EchoAndLog "Running ./configure --prefix=$install_dir $config_flags"
+fi
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+	if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	./configure --prefix=$install_dir $config_flags >> $log_file 2>&1
+	else
+	./configure --prefix=$install_dir $config_flags >> $log_file 2>&1
+	fi
+else
+    echo ""
+	if [ "$BRAND" = "linux" ] || [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux64" ] ; then
+	./configure --prefix=$install_dir $config_flags
+	else
+	./configure --prefix=$install_dir $config_flags
+	fi
+fi
+
+HOME=$tmp_home ; export HOME	# restore $HOME
+
+
+#
+# Do architecture-specific post-configure fixes
+#
+
+
+PostConfigure
+
+
+#
+# Run the make utility to compile the library and utiltites
+#
+
+EchoAndLog "Running make, target=all"
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make
+    tmp_status=$?
+fi
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make' failed."
+    exit 1
+fi
+
+
+EchoAndLog "Running make, target=test"
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make test>> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make test
+    tmp_status=$?
+fi
+
+if [ "$tmp_status" != 0 ] ; then
+    EchoAndLog "Run of 'make all' failed."
+    exit 1
+fi
+
+
+
+#
+# Run the make utility install the libraries, utilities, includes and man pages 
+#
+
+if [ "$BRAND" = "macintosh" ] ; then
+   /bin/mkdir $ZLIBHOME/include
+   /bin/mkdir $ZLIBHOME/lib
+fi
+
+if [ "$BRAND" = "macintel" ] ; then
+   /bin/mkdir $ZLIBHOME/include
+   /bin/mkdir $ZLIBHOME/lib
+fi
+
+if [ "$BRAND" = "ibm" ] ; then
+   /bin/mkdir $ZLIBHOME/include
+   /bin/mkdir $ZLIBHOME/lib
+fi
+
+EchoAndLog "Running make, target=install "
+
+if [ "$log_file" != "" ] ; then
+    echo "" >> $log_file
+    make install >> $log_file 2>&1
+    tmp_status=$?
+else
+    echo ""
+    make install
+    tmp_status=$?
+fi
+
+
+if [ "$tmp_status" != 0 ] ; then
+    if [ "$BRAND" = "cygwin" ] ; then
+	EchoAndLog "Run of 'make install' failed.But it was completed in the install script."
+	if [ -f $ZLIBHOME/lib/libz.a ] ; then
+	    if [ ! -d $ZLIBHOME/include ] ; then
+		EchoAndLog "Creating $ZLIBHOME/include directory."
+		mkdir -p $ZLIBHOME/include
+	    fi
+	    cp zlib.h $ZLIBHOME/include/.
+	    cp zconf.h $ZLIBHOME/include/.
+	    chmod 644 $ZLIBHOME/include/zlib.h $ZLIBHOME/include/zconf.h
+	    ranlib $ZLIBHOME/lib/libz.a
+	else
+	    EchoAndLog "Run of 'make install' failed."
+	    exit 1
+	fi
+    else
+	EchoAndLog "Run of 'make install' failed."
+	exit 1
+    fi
+fi
diff --git a/bin/tmp/hdfeos_env.csh.tmp b/bin/tmp/hdfeos_env.csh.tmp
new file mode 100755
index 0000000..56a6f1a
--- /dev/null
+++ b/bin/tmp/hdfeos_env.csh.tmp
@@ -0,0 +1,728 @@
+#-----------------------------------------------------------------------------
+# file:	
+# 	hdfeos_env.csh
+#
+# description:
+# 	This file defines environment variables used by HDFEOS5
+# 	This version is for use under the C shell (csh).
+#
+# usage:
+# 	This file should be called from your .cshrc file with the line:
+#
+# 	    source <HDFEOS5-home-dir>/bin/hdfeos_env.csh
+#	
+# 	where <HDFEOS5-home-dir> is the full path of the HDFEOS5 home directory.
+#
+# author:
+# 	Mike Sucher / A.R.C.
+#       Abe Taaheri / Emergent Information Technologies, Inc.
+#
+# notes:
+# 	1) This file is compatible with the following platforms:
+# 	   Sun, SGI, HP-9000, IBM RS-600 and DEC Alpha.
+# 	   It automatically figures out which platform you are on,
+# 	   and sets environment variables accordingly.
+# 	2) This file defines a variable called hdfeos5_path which contains
+# 	   all the directories likely to be needed on a given machine
+# 	   type, including the HDFEOS5_ (and HDF5) bin directories.  Users 
+# 	   may choose to set their path variable with:
+# 	   
+# 	           set path=(<user-path-additions> $hdfeos5_path )
+#
+# 	   where <user-path-additions> is an optional list of other
+# 	   directories added to the search path.
+#
+# history:
+#	17-Jun-1996 MES  Initial version
+#       11-Apr-2001 AT   Modified for HDF5
+# 
+#-----------------------------------------------------------------------------
+
+if (! $?sgi_mode ) then		# by default, SGI mode is standard 32-bit
+    set sgi_mode=32
+endif
+if (! $?hdfeos5_formal ) then	# by default, PGS formal directories disabled
+    set hdfeos5_formal=0
+endif
+if (! $?hdfeos5_daac ) then 	# by default, DAAC toolkit version disabled
+    set hdfeos5_daac=0
+endif
+if (! $?hdfeos5_f90_comp ) then 	# by default, no FORTRAN-90 compiler
+    set hdfeos5_f90_comp=""
+endif
+if (! $?hdfeos5_nag_flag ) then 	# by default, not using NAG FORTRAN-90
+    set hdfeos5_nag_flag=0
+endif
+if (! $?use_flavor ) then 	# by default, not using "flavor"
+    set use_flavor=0
+endif
+if (! $?opt_flag ) then 	# by default, optimizing code
+    set opt_flag=-O
+endif
+
+set user_path = ( $path )	# save user path
+
+# set path to a base subset of directories, allowing startup on unknown host
+# note: once the host has been determined the path is appropriately customized
+
+set path=(/usr/local/bin /bin /usr/bin /etc /usr/etc /usr/ucb /usr/bin/X11)
+
+
+# get operating system type, login name
+# special cases: SCO and Cray  - uname works differently,
+
+setenv MACHINE `uname -m | awk '{print $1}'`	# needed on Cray & SCO
+setenv temp_ostype `uname`
+
+switch ( "$MACHINE" )
+
+    case "i386":        			# SCO box
+	setenv OSTYPE sco386
+        breaksw
+
+    case "CRAY":    				# CRAY
+	setenv OSTYPE UNICOS
+        breaksw
+
+    default:					# everybody else
+	setenv OSTYPE `uname`
+        breaksw
+
+endsw
+
+setenv CYGPL `uname | awk -F_ '{print $1}'`
+
+# Intel Macintosh is also i386 or i686 (?) machine
+
+    if ( "$MACHINE" == "i386" ) then
+	if ( "$temp_ostype" == "Darwin" ) then 
+	    setenv OSTYPE DarwinIntel
+	endif
+	if("$CYGPL" == "CYGWIN") then 
+	    setenv OSTYPE Cygwin
+	endif
+    endif
+    if ( "$MACHINE" == "i686" ) then
+	if [ "$temp_ostype" == "Darwin" ) then 
+	    setenv OSTYPE DarwinIntel
+	endif
+	if("$CYGPL" == "CYGWIN") then 
+	    setenv OSTYPE Cygwin
+	endif
+    endif
+
+
+set user=`id | cut -d\( -f2 | cut -d\) -f1`
+if ($?LOGNAME == 0) setenv LOGNAME $user	# make sure $LOGNAME is defined
+setenv USER $LOGNAME				# make sure $USER is defined
+
+
+# set machine-dependent environment variables:
+# 	HOST  the host name of this machine
+# 	BRAND used by other achitecture-specific code
+# 	path  the execution search path exported to PATH
+
+switch ( "$OSTYPE" )
+
+    case "AIX": 
+	set path=(/usr/local/bin /bin /usr/bin /etc /usr/etc /usr/ucb /usr/bin/X11 /usr/ccs/bin /usr/sbin)
+	setenv HOST `hostname`
+	setenv BRAND ibm
+        breaksw
+
+    case "HP-UX": 
+	set path=(/usr/local/bin /bin /usr/bin /etc /usr/etc /usr/bin/X11)
+	setenv HOST `hostname`
+	setenv BRAND hp 
+        breaksw
+
+    case "IRIX":  
+	set path=(/usr/local/bin /bin /usr/bin /etc /usr/etc /usr/bsd /usr/bin/X11 /usr/sbin)
+	setenv HOST `hostname`
+        if ("$sgi_mode" == 32) then
+            setenv BRAND sgi
+        else if ("$sgi_mode" == 64) then
+            setenv BRAND sgi64
+        else if ("$sgi_mode" == n32) then
+            setenv BRAND sgi32
+	else if ("$sgi_mode" == 65) then
+	    setenv BRAND irix65
+        else
+            setenv BRAND sgi
+        endif
+        breaksw
+
+    case "IRIX64":  
+	set path=(/usr/local/bin /bin /usr/bin /etc /usr/etc /usr/bsd /usr/bin/X11 /usr/sbin)
+	setenv HOST `hostname`
+	if ("$sgi_mode" == 32) then
+	    setenv BRAND sgi
+        else if ("$sgi_mode" == 64) then
+	    setenv BRAND sgi64
+        else if ("$sgi_mode" == n32) then
+	    setenv BRAND sgi32
+	else if ("$sgi_mode" == 65) then
+	    setenv BRAND irix65
+        else
+	    setenv BRAND sgi
+        endif
+        breaksw
+
+    case "Linux": 
+	set path=(/usr/local/bin /bin /usr/bin /etc /usr/etc /usr/bin/X11)
+	setenv HOST `hostname -s`
+	setenv BRAND linux
+	if("$LINUX_BRAND" == "linux32") then
+		 setenv BRAND linux32
+	else if("$LINUX_BRAND" == "linux") then
+		 setenv BRAND linux
+	else if("$LINUX_BRAND" == "linux64") then
+		 setenv BRAND linux64
+	else if( "$LINUX_BRAND" == "" ) then
+	if( "`uname -m | awk '{print $1}'`" == "x86_64" || "`uname -m | awk '{print $1}'`" == "ia64" ) then
+		if( "$LNX_COMP_FLAG" == "-m32" ) then
+			setenv BRAND linux32
+			setenv LINUX_BRAND linux32
+		else
+			setenv BRAND linux64
+			setenv LINUX_BRAND linux64
+		endif
+	endif
+	endif
+        breaksw
+
+    case "Darwin":
+        set path=(/bin /sbin /usr/bin /usr/sbin)
+        setenv HOST `hostname -s`
+        setenv BRAND macintosh
+        breaksw
+
+    case "DarwinIntel":
+        set path=(/bin /sbin /usr/bin /usr/sbin)
+        setenv HOST `hostname -s`
+        setenv BRAND macintel32
+	if("$MAC_BRAND" == "macintel32") then 
+		setenv BRAND macintel32
+	else if("$MAC_BRAND" == "macintel") then 
+		setenv BRAND macintel
+	else if("$MAC_BRAND" == "macintel64") then
+		setenv BRAND macintel64
+	else if("$MAC_BRAND" == "") then 
+		if( "`uname -m | awk '{print $1}'`" == "x86_64" ||  "`uname -m | awk '{print $1}'`" == "ia64"   || "`uname -m | awk '{print $1}'`" == "i386"   || "`uname -m | awk '{print $1}'`" == "i686" ) then
+			setenv BRAND macintel64
+			setenv MAC_BRAND macintel64
+		else
+			setenv BRAND macintel32
+			setenv MAC_BRAND macintel32
+		endif
+	endif
+        breaksw
+
+    case "Cygwin":
+        set path=(/bin /sbin /usr/bin /usr/sbin)
+        setenv HOST `hostname`
+        setenv BRAND cygwin
+        breaksw
+
+    case "OSF1":  
+	set path=(/usr/local/bin /bin /usr/bin /etc /usr/etc /usr/ucb /usr/bin/X11 /usr/ccs/bin /usr/sbin)
+	setenv HOST `hostname -s`
+	setenv BRAND dec 
+        breaksw
+
+    case "sco386": 
+	set path=(/usr/local/bin /bin /usr/bin /etc /usr/etc /usr/bin/X11)
+	setenv HOST `hostname -s`
+	setenv BRAND sco 
+        breaksw
+
+    case "SunOS": 
+	# distinguish between SunOS 5.5/5.8 and 4.x versions
+	if (`uname -r | awk -F. '{print $1}'` == "5") then 
+	   if (`uname -r | awk -F. '{print $2}'` == "8") then 
+	    setenv BRAND sun5.8			# Solaris 8
+           else if ( `uname -r | awk -F. '{print $2}'` == "9" ) then
+            setenv BRAND sun5.9                 # release V5.x SunOS
+           else if ( `uname -r | awk -F. '{print $2}'` == "10" ) then
+            setenv BRAND sun5.10                 # release V5.x SunOS
+           else
+	    setenv BRAND sun5			# Version 5.5 SunOS
+           endif
+	    set path=(/usr/local/bin /opt/SUNWspro/bin /bin /usr/bin /etc /usr/etc /usr/ucb /usr/openwin/bin /usr/openwin/demo /usr/ccs/bin /usr/sbin)
+	else                                
+	    setenv BRAND sun4			# release V4.x SunOS
+	    set path=(/usr/local/bin /usr/local/lang /usr/lang /bin /usr/bin /etc /usr/etc /usr/ucb /usr/openwin/bin /usr/openwin/demo)
+	endif
+	setenv HOST `hostname`
+        breaksw
+
+    case "UNICOS": 
+	set path=(/usr/local/bin /bin /usr/bin /etc /usr/ucb /usr/bin/X11)
+	setenv HOST `hostname`
+	setenv BRAND cray 
+        breaksw
+
+    default:
+	echo "Operating system: $OSTYPE not supported"
+	echo "This release of HDFEOS5 supports: "
+	echo "   Sun, SGI HP-9000 IBM-6000 DEC-Alpha and Cray/Unicos "
+        breaksw
+
+endsw
+
+
+
+
+# set machine-dependent compilers and compilation switches:
+#
+#
+
+setenv NSL_FLAG "" 			# this is nil on all but Sun platforms
+setenv NSL_LIB "" 			# this is nil on all but Sun platforms
+
+switch ($BRAND)
+
+    case cray:
+	setenv CC cc 			# C compiler
+	setenv CFLAGS "$opt_flag $ext_cc_flags -DH5_USE_16_API" 		# default C flags (optimize, ansi)
+	setenv C_CFH "-DCRAYFortran"    # C/cfortran.h called from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB ""		# FORTRAN lib called by C main
+	setenv F77 cf77			# FORTRAN compiler
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH"	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB ""		# C lib called by FORTRAN main 
+	setenv HDFSYS UNICOS		# system type as defined by HDF5
+	setenv MACHINE CRAY		# system type as defined by HDFEOS5
+	breaksw
+
+    case dec:
+	setenv CC cc 			# C compiler
+	setenv CFLAGS "$opt_flag $ext_cc_flags -std -DH5_USE_16_API"		# default C flags (optimize, ansi)
+	setenv C_CFH "-DDECFortran"	# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH -Dmain=MAIN__"	# calling FORTRAN
+	setenv C_F77_LIB ""		# FORTRAN lib called by C main
+	setenv F77 f77 			# FORTRAN compiler
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH "    # calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB ""		# C lib called by FORTRAN main
+	setenv HDFSYS DEC_ALPHA		# system type as defined by HDF5
+	setenv MACHINE DEC		# system type as defined by HDFEOS5
+	breaksw
+
+    case hp:
+	setenv CC c89 			# C compiler
+	setenv CFLAGS "$opt_flag $ext_cc_flags -Ae -DH5_USE_16_API" 		# default C flags (optimize, ansi)
+	setenv C_CFH "" 		# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB ""		# FORTRAN lib called by C main 
+	setenv F77 fort77		# FORTRAN compiler
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH"	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB ""		# C lib called by FORTRAN main
+	setenv HDFSYS HP9000		# system type as defined by HDF5
+	setenv MACHINE HP		# system type as defined by HDFEOS5
+	breaksw
+
+    case ibm:
+	setenv CC cc 			# C compiler
+	setenv CFLAGS "$opt_flag $ext_cc_flags -qlanglvl=ansi -DH5_USE_16_API" # default C flags (optimize, ansi)
+	setenv C_CFH "" 		# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB ""		# FORTRAN lib called by C main  FORTAN
+	setenv F77 xlf 			# FORTRAN compiler
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH "" 		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH"	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB ""		# C lib called by FORTRAN main
+	setenv HDFSYS IBM6000		# system type as defined by HDF5
+	setenv MACHINE IBM		# system type as defined by HDFEOS5
+	breaksw
+
+    case linux:
+    case linux32:
+    case linux64:
+	setenv CC "gcc LNX_CMP_FLAG" 	# C compiler
+	setenv CFLAGS "$opt_flag $ext_cc_flags -ansi -DH5_USE_16_API" # default C flags (optimize, ansi)
+	setenv C_CFH "-Df2cFortran"	# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB ""		# FORTRAN lib called by C main
+	setenv F77 "g77 LNX_CMP_FLAG"	# FORTRAN compiler
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH"	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB ""		# C lib called by FORTRAN main
+	setenv HDFSYS LINUX		# system type as defined by HDF5
+	if( "`uname -m | awk '{print $1}'`" == "x86_64" ) then
+	    if( "$BRAND" == "linux64" ) then
+		setenv HDFSYS LINUX64      # system type as defined by HDF
+	    else if( "$BRAND" == "linux32" || "$BRAND" == "linux" ) then
+		setenv HDFSYS LINUX
+	    endif
+	else if( "`uname -m | awk '{print $1}'`" == "ia64" ) then
+	    if( "$BRAND" == "linux64" ) then
+		setenv HDFSYS IA64      # system type as defined by HDF
+	    else if( "$BRAND" == "linux32" || "$BRAND" == "linux" ) then
+		setenv HDFSYS LINUX
+	    endif
+	else
+	    setenv HDFSYS LINUX		   # system type as defined by HDF
+	endif
+	setenv MACHINE LINUX		# system type as defined by HDFEOS5
+	breaksw
+
+    case macintosh:
+        setenv CC gcc                   # C compiler
+        setenv CFLAGS "$opt_flag $ext_cc_flags -ansi -DH5_USE_16_API" # default C flags (optimize, ansi)
+        setenv C_CFH "-Df2cFortran"     # C w/ cfortran.h callable from FORTRAN
+        setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+        setenv C_F77_CFH "$C_CFH"       # calling FORTRAN
+        setenv C_F77_LIB ""             # FORTRAN lib called by C main
+        setenv F77 "g77"                # FORTRAN compiler
+        setenv F77FLAGS "$ext_fc_flags"              # common FORTRAN flags
+        setenv F77_CFH ""               # FORTRAN callable from C w/ cfortran.h
+        setenv F77_C_CFH "$F77_CFH"     # calling C w/ cfortran.h
+        setenv CFH_F77 "$F77_C_CFH"     # old version of F77_C_CFH
+        setenv F77_C_LIB ""             # C lib called by FORTRAN main
+        setenv HDFSYS MACINTOSH         # system type as defined by HDF
+        setenv MACHINE MACINTOSH        # system type as defined by HDFEOS
+        breaksw
+
+    case macintel:
+    case macintel32:
+    case macintel64:
+        setenv CC "gcc $MACINTEL_COMP_FLAG"               # C compiler
+        setenv CFLAGS "$opt_flag $ext_cc_flags -ansi -DH5_USE_16_API" # default C flags (optimize, ansi)
+        setenv C_CFH "-Df2cFortran"     # C w/ cfortran.h callable from FORTRAN
+        setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+        setenv C_F77_CFH "$C_CFH"       # calling FORTRAN
+        setenv C_F77_LIB ""             # FORTRAN lib called by C main
+        setenv F77 "gfortran $MACINTEL_COMP_FLAG"                # FORTRAN compiler
+        setenv F77FLAGS "$ext_fc_flags"              # common FORTRAN flags
+        setenv F77_CFH ""               # FORTRAN callable from C w/ cfortran.h
+        setenv F77_C_CFH "$F77_CFH"     # calling C w/ cfortran.h
+        setenv CFH_F77 "$F77_C_CFH"     # old version of F77_C_CFH
+        setenv F77_C_LIB ""             # C lib called by FORTRAN main
+        setenv HDFSYS MACINTEL         # system type as defined by HDF
+        setenv MACHINE MACINTEL        # system type as defined by HDFEOS
+        breaksw
+
+    case cygwin:
+        setenv CC gcc                   # C compiler
+        setenv CFLAGS "$opt_flag $ext_cc_flags -ansi -DH5_USE_16_API"     # default C flags (optimize, ansi)
+        setenv C_CFH "-Df2cFortran"     # C w/ cfortran.h callable from FORTRAN
+        setenv CFHFLAGS "$CFLAGS $C_CFH"# CFLAGS + C_CFH
+        setenv F77 "g77"                # FORTRAN compiler - default
+        setenv F77FLAGS "$opt_flag $ext_fc_flags -fno-second-underscore" # common FORTRAN flags  
+        setenv F77_CFH "-fno-second-underscore"     # FORTRAN callable from C w/cfortran.h
+        setenv F77_C_CFH ""             # calling C w/ cfortran.h
+        setenv F77_C_LIB ""             # C lib called by FORTRAN main
+        setenv HDFSYS CYGWIN            # system type as defined by HDF
+        setenv MACHINE CYGWIN        # system type as defined by HDFEOS
+        breaksw
+
+    case sco:
+	setenv CC cc 			# C compiler
+	setenv CFLAGS "$opt_flag $ext_cc_flags -posix -DH5_USE_16_API" # default C flags (optimize, ansi)
+	setenv C_CFH "-Df2cFortran"	# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB ""		# FORTRAN lib called by C main
+	setenv F77 ""			# FORTRAN compiler
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH"	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB ""		# C lib called by FORTRAN main
+	setenv HDFSYS SCO		# system type as defined by HDF5
+	setenv MACHINE SCO		# system type as defined by HDFEOS5
+	breaksw
+
+    case sgi:
+	if ($OSTYPE == "IRIX64") then
+		setenv CC "cc -32"	# C compiler (32 bit)
+		setenv F77 "f77 -32"	# FORTRAN compiler (32 bit)
+	else
+                setenv CC cc		# C compiler
+                setenv F77 f77		# FORTRAN compiler
+	endif
+	setenv CFLAGS "$opt_flag $ext_cc_flags -xansi -D_POSIX_SOURCE -DH5_USE_16_API"	# default C flags (optimize, ansi)
+	setenv C_CFH ""	 		# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB "-lI77 -lU77 -lF77" # FORTRAN lib called by C main
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH"	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB ""		# C lib called by FORTRAN main
+	setenv HDFSYS IRIS4		# system type as defined by HDF5
+	setenv MACHINE SGI		# system type as defined by HDFEOS5
+	breaksw
+
+    case sgi32:
+	setenv CC "cc -n32"		# C compiler (new-style 32 bit)
+	setenv F77 "f77 -n32"		# FORTRAN compiler (new-style 32 bit)
+	setenv CFLAGS "$opt_flag $ext_cc_flags -xansi -D_POSIX_SOURCE -DH5_USE_16_API"	# default C flags (optimize, ansi)
+	setenv C_CFH ""	 		# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB "-lI77 -lU77 -lF77" # FORTRAN lib called by C main
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH"	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB ""		# C lib called by FORTRAN main
+	setenv HDFSYS IRIS4		# system type as defined by HDF5
+	setenv MACHINE SGI		# system type as defined by HDFEOS5
+	breaksw
+
+    case irix65:
+	setenv CC "cc -n32"		# C compiler (new-style 32 bit)
+	setenv F77 "f77 -n32"		# FORTRAN compiler (new-style 32 bit)
+	setenv CFLAGS "$opt_flag $ext_cc_flags -xansi -D_POSIX_SOURCE -DH5_USE_16_API"	# default C flags (optimize, ansi)
+	setenv C_CFH ""	 		# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB "-lI77 -lU77 -lF77" # FORTRAN lib called by C main
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH"	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB ""		# C lib called by FORTRAN main
+	setenv HDFSYS IRIS4		# system type as defined by HDF5
+	setenv MACHINE SGI		# system type as defined by HDFEOS5
+	breaksw
+
+    case sgi64:
+	set cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+	if ("$cpu_type" == "4") then
+	    setenv CC "cc -64 -mips3"	# C compiler (R4?00 chip)
+	    setenv F77 "f77 -64 -mips3"	# FORTRAN compiler (R4?00 chip)
+        else
+            setenv CC "cc -64"      	# C compiler
+            setenv F77 "f77 -64"    	# FORTRAN compiler
+        endif
+	setenv CFLAGS "$opt_flag $ext_cc_flags -xansi -D_POSIX_SOURCE -DH5_USE_16_API"	# default C flags (optimize, ansi)
+	setenv C_CFH ""	 		# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB "-lI77 -lU77 -lF77" # FORTRAN lib called by C main
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH"	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB ""		# C lib called by FORTRAN main
+	setenv HDFSYS IRIS4		# system type as defined by HDF5
+	setenv MACHINE SGI		# system type as defined by HDFEOS5
+	breaksw
+
+    case sun4:
+	setenv CC acc			# C compiler
+	setenv CFLAGS "$opt_flag $ext_cc_flags -Xa -DH5_USE_16_API" 		# default C flags (optimize, ansi)
+	setenv C_CFH "-DsunFortran"	# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB ""		# FORTRAN lib called by C main
+	setenv F77 f77 			# FORTRAN compiler
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH" 	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB "-lm" 		# C lib called by FORTRAN main
+	setenv HDFSYS SUN		# system type as defined by HDF5
+	setenv MACHINE SUN4		# system type as defined by HDFEOS5
+	setenv NSL_FLAG "-lnsl"		# this is nil on all but Sun platforms
+	setenv NSL_LIB "/usr/lib/libnsl.a" # this is nil on all but Sun platforms
+	breaksw
+
+    case sun5:
+	setenv CC cc			# C compiler
+	setenv CFLAGS "$opt_flag $ext_cc_flags -Xa -DH5_USE_16_API" 		# default C flags (optimize, ansi)
+	setenv C_CFH "-DsunFortran"	# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB ""		# FORTRAN lib called by C main
+	setenv F77 f77 			# FORTRAN compiler
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH" 	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB "-lm" 		# C lib called by FORTRAN main
+	setenv HDFSYS SUN		# system type as defined by HDF5
+	setenv MACHINE SUN5		# system type as defined by HDFEOS5
+	setenv NSL_FLAG "-lnsl"		# this is nil on all but Sun platforms
+	setenv NSL_LIB "/usr/lib/libnsl.a" # this is nil on all but Sun platform
+	breaksw
+
+    case sun5.8:
+	setenv CC cc			# C compiler
+	setenv CFLAGS "$opt_flag $ext_cc_flags -Xa -DH5_USE_16_API" 		# default C flags (optimize, ansi)
+	setenv C_CFH "-DsunFortran"	# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB ""		# FORTRAN lib called by C main
+	setenv F77 f77 			# FORTRAN compiler
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH" 	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB "-lm" 		# C lib called by FORTRAN main
+	setenv HDFSYS SUN		# system type as defined by HDF5
+	setenv MACHINE SUN8		# system type as defined by HDFEOS5
+	setenv NSL_FLAG "-lnsl"		# this is nil on all but Sun platforms
+	setenv NSL_LIB "/usr/lib/libnsl.a" # this is nil on all but Sun platform
+	breaksw
+
+    case sun5.9:
+	setenv CC cc			# C compiler
+	setenv CFLAGS "$opt_flag $ext_cc_flags -Xa -DH5_USE_16_API" 		# default C flags (optimize, ansi)
+	setenv C_CFH "-DsunFortran"	# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB ""		# FORTRAN lib called by C main
+	setenv F77 f77 			# FORTRAN compiler
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH" 	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB "-lm" 		# C lib called by FORTRAN main
+	setenv HDFSYS SUN		# system type as defined by HDF5
+	setenv MACHINE SUN9		# system type as defined by HDFEOS5
+	setenv NSL_FLAG "-lnsl"		# this is nil on all but Sun platforms
+	setenv NSL_LIB "/usr/lib/libnsl.a" # this is nil on all but Sun platform
+	breaksw
+
+    case sun5.10:
+	setenv CC cc			# C compiler
+	setenv CFLAGS "$opt_flag $ext_cc_flags -Xa -DH5_USE_16_API" 		# default C flags (optimize, ansi)
+	setenv C_CFH "-DsunFortran"	# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB ""		# FORTRAN lib called by C main
+	setenv F77 f77 			# FORTRAN compiler
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH" 	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB "-lm" 		# C lib called by FORTRAN main
+	setenv HDFSYS SUN		# system type as defined by HDF5
+	setenv MACHINE SUN10		# system type as defined by HDFEOS5
+	setenv NSL_FLAG "-lnsl"		# this is nil on all but Sun platforms
+	setenv NSL_LIB "/usr/lib/libnsl.a" # this is nil on all but Sun platform
+	breaksw
+
+    default:
+	setenv CC cc			# C compiler
+	setenv CFLAGS "$opt_flag $ext_cc_flags  -DH5_USE_16_API" 	# default C flags (optimize)
+	setenv C_CFH ""	        	# C w/ cfortran.h callable from FORTRAN
+	setenv CFHFLAGS "$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	setenv C_F77_CFH "$C_CFH"	# calling FORTRAN
+	setenv C_F77_LIB ""		# FORTRAN lib called by C main
+	setenv F77 f77 			# FORTRAN compiler
+	setenv F77FLAGS "$ext_fc_flags" 		# common FORTRAN flags
+	setenv F77_CFH ""		# FORTRAN callable from C w/ cfortran.h
+	setenv F77_C_CFH "$F77_CFH" 	# calling C w/ cfortran.h
+	setenv CFH_F77 "$F77_C_CFH"	# old version of F77_C_CFH
+	setenv F77_C_LIB "-lm" 		# C lib called by FORTRAN main
+	setenv HDFSYS unknown		# system type as defined by HDF5
+	setenv MACHINE unknown		# system type as defined by HDFEOS5
+	breaksw
+endsw
+
+
+# 
+# set up environment to handle FORTRAN-90 compiler
+#
+
+if ("$hdfeos5_f90_comp" != "") then		# using FORTRAN-90
+
+    setenv F77 "$hdfeos5_f90_comp"
+
+    if ("$hdfeos5_nag_flag" == "1") then	# using NAG f90
+        setenv C_CFH "$C_CFH -DNAGf90F"
+        setenv CFHFLAGS "$CFLAGS $C_CFH"
+    endif
+
+endif
+
+
+# copy the machine-specific path to variable hdfeos5_path
+
+set hdfeos5_path = ($path)
+
+# set HDFEOS5-related environment variables
+# these may be referred to in makefiles and on compiler command lines
+
+if ( $?HDFEOS5_HOME ) then
+
+# set up base set of HDFEOS5_ Toolkit directory variables.
+
+    setenv HDFEOS5_INC 	$HDFEOS5_HOME/include		# include (header) files
+    setenv HDFEOS5_BIN 	${HDFEOS5_HOME}/bin/$BRAND	# exectuable files
+    setenv HDFEOS5_LIB 	${HDFEOS5_HOME}/lib/$BRAND	# library files
+    setenv HDFEOS5_OBJ 	${HDFEOS5_HOME}/obj/$BRAND	# object files
+    setenv HDFEOS5_SRC 	${HDFEOS5_HOME}/src 		# source files
+
+    if ( $use_flavor == 1 && "$opt_flag" == "-g" ) then
+
+    	setenv HDFEOS5_LIB ${HDFEOS5_LIB}_debug
+    	setenv HDFEOS5_OBJ ${HDFEOS5_OBJ}_debug
+    	setenv HDFEOS5_BIN ${HDFEOS5_BIN}_debug
+
+        set hdf5lib=`echo $HDF5LIB | sed "s/${BRAND}/${BRAND}_debug/"`
+        if ( -d $hdf5lib ) then
+            setenv HDF5LIB $hdf5lib
+        endif
+        unset hdf5lib
+
+        set hdf5inc=`echo $HDF5INC | sed "s/${BRAND}/${BRAND}_debug/"`
+        if ( -d $hdf5inc ) then
+            setenv HDF5INC $hdf5inc
+        endif
+        unset hdf5inc
+
+    endif
+
+# update path variables
+
+    set path = ($path $HDFEOS5_BIN)		# add HDFEOS5_BIN to path
+    set hdfeos5_path = ($hdfeos5_path $HDFEOS5_BIN) # add HDFEOS5_BIN to hdfeos5 path
+    set user_path = ($user_path $HDFEOS5_BIN)	# add HDFEOS5_BIN to user path
+
+
+else
+
+    echo "You must first set the environment variable HDFEOS5_HOME"
+
+endif
+
+
+# set HDF5-related environment variables
+# these may be referred to in makefiles and on compiler command lines
+# use the command 'sethdf <hdf5-home-directory> to override the default
+
+
+
+
+#
+# restore augmented user path
+#
+set path = ( $user_path )
+
+
+# done
+
diff --git a/bin/tmp/hdfeos_env.ksh.tmp b/bin/tmp/hdfeos_env.ksh.tmp
new file mode 100755
index 0000000..9111fe4
--- /dev/null
+++ b/bin/tmp/hdfeos_env.ksh.tmp
@@ -0,0 +1,706 @@
+#-----------------------------------------------------------------------------
+# file:	
+# 	hdfeos_env.ksh
+#
+# description:
+# 	This file defines environment variables used by HDFEOS5.
+# 	This version is for use under the Korn shell (ksh).
+#
+# usage:
+# 	This file should be called from your .profile file with the line:
+#
+# 	    . <HDFEOS5-home-dir>/bin/hdfeos_env.ksh
+#	
+# 	where <HDFEOS5-home-dir> is the full path of the HDFEOS5 home directory.
+#
+# author:
+# 	Mike Sucher / A.R.C.
+#       Guru Tej S. Khalsa / Applied Research Corporation
+#       Abe Taaheri / Emergent Information Technologies, Inc.
+#
+# notes:
+# 	1) This file is compatible with the following platforms:
+# 	   Sun, SGI, HP-9000, IBM RS-6000 and DEC Alpha.
+# 	   It automatically figures out which platform you are on,
+# 	   and sets environment variables accordingly.
+# 	2) This file defines a variable called hdfeos5_path which contains
+# 	   all the directories likely to be needed on a given machine
+# 	   type, including the HDFEOS5 bin directories.  Users 
+# 	   may choose to set their path variable with:
+# 	   
+# 	           PATH=<user-path-additions>:$hdfeos5_path
+# 	           export PATH
+#
+# 	   where <user-path-additions> is an optional list of other
+# 	   directories added to the search path.
+#
+# history:
+#	17-Jun-1996 MES  Initial version 
+#       11-Apr-2001 AT   Modified for HDF5
+# 
+#-----------------------------------------------------------------------------
+
+: ${sgi_mode:=32}		# by default, SGI mode is standard 32-bit
+
+: ${hdfeos5_f90_comp:=""}	# by default, no FORTRAN-90 compiler
+
+: ${hdfeos5_nag_flag:=0}	# by default, not using NAG FORTRAN-90
+
+: ${use_flavor:=0}		# by default, not using "flavor"
+
+: ${opt_flag:=-O}		# by default, optimizing code
+
+
+
+user_path=$PATH		# save user path
+
+# set path to a base subset of directories, allowing startup on unknown host
+# note: once the host has been determined the path is appropriately customized
+
+PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11
+export PATH 
+
+# get operating system type, login name
+# special cases: SCO and Cray  - uname works differently,
+
+MACHINE="`uname -m | awk '{print $1}'`"	# needed on Cray & SCO
+temp_ostype=`uname`
+
+case "$MACHINE" in
+
+    i386)        			# SCO box
+        OSTYPE=sco386 
+        ;;
+
+    CRAY) 				# CRAY
+        OSTYPE=UNICOS 
+        ;;
+
+    *)     				# everybody else
+        OSTYPE="`uname`"
+        ;;
+
+esac
+         
+CYGPL="`uname | awk -F_ '{print $1}'`"  
+     
+# Intel Macintosh is also i386 or i686 (?) machine
+
+    if [ "$MACHINE" = "i386" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	fi
+	if [ "$CYGPL" = "CYGWIN" ] ; then 
+	    OSTYPE=Cygwin
+	fi
+    fi
+    if [ "$MACHINE" = "i686" ] ; then
+	if [ "$temp_ostype" = "Darwin" ] ; then 
+	    OSTYPE=DarwinIntel
+	fi
+	if [ "$CYGPL" = "CYGWIN" ] ; then 
+	    OSTYPE=Cygwin
+	fi
+    fi
+    if [ "`uname -m | awk '{print $1}'`" = "x86_64" ] || [ "`uname -m | awk '{print $1}'`" = "ia64" ] ; then
+	if [ "$LINUX_BRAND" = "" ] ; then
+		echo " Warning: In 64-bit linux platform the environment variable LINUX_BRAND must be set to linux32 or linux64 values before running this script.Please make sure that BRAND is linux32 or linux64."
+		if [ "$LNX_COMP_FLAG" = "-m32" ] ; then
+			BRAND=linux32
+			LINUX_BRAND=linux32
+		else
+			BRAND=linux64
+			LINUX_BRAND=linux64
+		fi
+	fi
+    fi
+
+user=`id | cut -d\( -f2 | cut -d\) -f1`
+LOGNAME=$user				# make sure $LOGNAME is defined
+USER=$LOGNAME				# make sure $USER is defined
+export USER LOGNAME
+
+# set machine-dependent environment variables:
+# 	HOST   the host name of this machine
+# 	BRAND  used by other achitecture-specific code
+# 	PATH   the execution search path 
+
+case "$OSTYPE" in
+
+  AIX) 
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/sbin
+    HOST="`hostname`"
+    BRAND="ibm"
+    ;;
+
+  HP-UX) 
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/bin/X11
+    HOST="`hostname`"
+    BRAND="hp"
+    ;;
+
+  IRIX) 
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bsd:/usr/sbin
+    HOST="`hostname`"
+    case $sgi_mode in
+      64 ) BRAND=sgi64 ;;
+      n32) BRAND=sgi32 ;;
+      65 ) BRAND=irix65 ;;
+      32 ) BRAND=sgi ;;
+      *  ) BRAND=sgi ;;  # just in case
+    esac
+    ;;
+
+  IRIX64) 
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/bsd:/usr/sbin
+    HOST="`hostname`"
+    case $sgi_mode in
+      64 ) BRAND=sgi64 ;;
+      n32) BRAND=sgi32 ;;
+      65 ) BRAND=irix65 ;;
+      32 ) BRAND=sgi ;;
+      *  ) BRAND=sgi ;;  # just in case
+    esac
+    ;;
+
+  Linux )
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/X11/bin
+    HOST=`hostname`
+    BRAND=linux
+    if [ "$LINUX_BRAND" = "linux64" ] ; then
+	BRAND=linux64
+    elif [ "$LINUX_BRAND" = "linux32" ] ; then
+	BRAND=linux32
+    elif [ "$LINUX_BRAND" = "linux" ] ; then
+	BRAND=linux
+    fi
+    ;;
+
+  Darwin )
+    PATH=/bin:/sbin:/usr/bin:/usr/sbin
+    HOST=`hostname`
+    BRAND=macintosh
+    ;;
+
+  DarwinIntel )
+    	PATH=/bin:/sbin:/usr/bin:/usr/sbin
+    	HOST=`hostname`
+	BRAND=macintel32
+	if [ "$MAC_BRAND" = "macinel64" ] ; then
+		BRAND=macintel64
+    	elif [ "$MAC_BRAND" = "macintel32" ] ; then
+		BRAND=macintel32
+    	fi
+    ;;
+
+  Cygwin)
+    PATH=/bin:/sbin:/usr/bin:/usr/sbin
+    HOST="`hostname`"
+    BRAND="cygwin"
+    ;;
+
+  OSF1) 
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/bin/X11:/usr/sbin
+    HOST="`hostname -s`"
+    BRAND="dec"
+    ;;
+
+  sco386) 
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/bin/X11
+    HOST="`hostname -s`"
+    BRAND="sco"
+    ;;
+
+  SunOS) 
+    # distinguish between SunOS 5.5/5.8 and 4.x versions
+    if [ `uname -r | awk -F. '{print $1}'` = "5" ] ; then 
+       if [ `uname -r | awk -F. '{print $2}'` = "8" ] ; then 
+        BRAND="sun5.8"			# Solaris 8
+       elif [ `uname -r | awk -F. '{print $2}'` = "9" ] ; then
+        BRAND="sun5.9"			# Solaris 9
+       elif [ `uname -r | awk -F. '{print $2}'` = "10" ] ; then
+        BRAND="sun5.10"			# Solaris 10
+       else
+        BRAND="sun5"			# release V5.5 SunOS
+       fi
+        PATH=/usr/local/bin:/opt/SUNWspro/bin:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/openwin/bin:/usr/openwin/demo:/usr/ccs/bin:/usr/sbin
+    else                                
+        BRAND="sun4"			# release V4.x SunOS
+        PATH=/usr/local/bin:/usr/local/lang:/usr/lang:/bin:/usr/bin:/etc:/usr/etc:/usr/ucb:/usr/openwin/demo
+    fi
+    HOST="`hostname`"
+    ;;
+
+  UNICOS) 
+    PATH=/usr/local/bin:/bin:/usr/bin:/etc:/usr/bin/X11
+    HOST="`hostname`"
+    BRAND="cray"
+    ;;
+
+  *)	
+    echo "Operating system: $OSTYPE not supported"
+    echo "This release of HDFEOS5 supports: "
+    echo "   Sun, SGI HP-9000 IBM-6000 DEC-Alpha and Cray/Unicos "
+    ;;
+
+esac
+
+export PATH HOST BRAND
+
+
+# set machine-dependent compilers and compilation switches:
+#
+#
+
+NSL_FLAG="" 			# this is nil on all but Sun platforms
+NSL_LIB="" 			# this is nil on all but Sun platforms
+
+case "$BRAND" in
+
+    cray)
+	CC=cc 			# C compiler
+	CFLAGS="$opt_flag $ext_cc_flags -DH5_USE_16_API"	# default C flags (optimize, ansi)
+	C_CFH="-DCRAYFortran"   # C/cfortran.h called from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB=""		# FORTRAN lib called by C main
+	F77=cf77		# FORTRAN compiler
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB=""		# C lib called by FORTRAN main 
+	HDFSYS=UNICOS		# system type as defined by HDF5
+	MACHINE=CRAY		# system type as defined by HDFEOS5
+	;;
+
+    dec)
+	CC=cc 			# C compiler
+	CFLAGS="$opt_flag $ext_cc_flags -std -DH5_USE_16_API"	# default C flags (optimize, ansi)
+	C_CFH="-DDECFortran"	# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH -Dmain=MAIN__" # calling FORTRAN
+	C_F77_LIB=""		# FORTRAN lib called by C main
+	F77=f77 		# FORTRAN compiler
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH "   # calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB=""		# C lib called by FORTRAN main
+	HDFSYS=DEC_ALPHA	# system type as defined by HDF5
+	MACHINE=DEC		# system type as defined by HDFEOS5
+	;;
+
+    hp)
+	CC=c89 			# C compiler
+	CFLAGS="$opt_flag $ext_cc_flags -Ae -DH5_USE_16_API" 	# default C flags (optimize, ansi)
+	C_CFH="" 		# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB=""		# FORTRAN lib called by C main 
+	F77=fort77		# FORTRAN compiler
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB=""		# C lib called by FORTRAN main
+	HDFSYS=HP9000		# system type as defined by HDF5
+	MACHINE=HP		# system type as defined by HDFEOS5
+	;;
+
+    ibm)
+	CC=cc 			# C compiler
+	CFLAGS="$opt_flag $ext_cc_flags -qlanglvl=ansi -DH5_USE_16_API" # default C flags (optimize, ansi)
+	C_CFH="" 		# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB=""		# FORTRAN lib called by C main  FORTAN
+	F77=xlf 		# FORTRAN compiler
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH="" 		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB=""		# C lib called by FORTRAN main
+	HDFSYS=IBM6000		# system type as defined by HDF5
+	MACHINE=IBM		# system type as defined by HDFEOS5
+	;;
+
+    linux | linux32 | linux64)
+	CC="gcc LNX_CMP_FLAG" 	# C compiler
+	CFLAGS="$opt_flag $ext_cc_flags -ansi -DH5_USE_16_API"  # default C flags (optimize, ansi)
+	C_CFH="-Df2cFortran"	# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB=""		# FORTRAN lib called by C main
+	F77="g77 LNX_CMP_FLAG"	# FORTRAN compiler
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB=""		# C lib called by FORTRAN main
+	HDFSYS=LINUX		# system type as defined by HDF5
+        if [ `/bin/uname -m` = "x86_64" ]; then
+	    if [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux" ] ; then
+		HDFSYS=LINUX	# system type as defined by HDF
+	    else
+		HDFSYS=LINUX64  # Only for 64 bit linux
+	    fi
+	elif [ `/bin/uname -m` = "ia64" ]; then
+	    if [ "$BRAND" = "linux32" ] || [ "$BRAND" = "linux" ] ; then
+		HDFSYS=LINUX	# system type as defined by HDF
+	    else
+		HDFSYS=IA64     #Only for IA64
+	    fi
+        else
+	   HDFSYS=LINUX		# system type as defined by HDF
+	fi
+
+	MACHINE=LINUX		# system type as defined by HDFEOS5
+	;;
+
+    macintosh)
+	CC=gcc 			# C compiler
+	CFLAGS="$opt_flag $ext_cc_flags -ansi -DH5_USE_16_API"	# default C flags (optimize, ansi)
+	C_CFH="-Df2cFortran"	# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB=""		# FORTRAN lib called by C main
+	F77="g77"		# FORTRAN compiler
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB=""		# C lib called by FORTRAN main
+	HDFSYS=MACINTOSH	# system type as defined by HDF5
+	MACHINE=MACINTOSH	# system type as defined by HDFEOS5
+	;;
+
+    macintel | macintel32 | macintel64)
+	CC="gcc $MACINTEL_COMP_FLAG" 			# C compiler
+	CFLAGS="$opt_flag $ext_cc_flags -ansi -DH5_USE_16_API"	# default C flags (optimize, ansi)
+	C_CFH="-Df2cFortran"	# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB=""		# FORTRAN lib called by C main
+	F77="gfortran $MACINTEL_COMP_FLAG"		# FORTRAN compiler
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB=""		# C lib called by FORTRAN main
+	HDFSYS=MACINTEL		# system type as defined by HDF
+	MACHINE=MACINTEL	# system type as defined by HDFEOS
+	;;
+
+    cygwin)
+        CC=gcc                          # C compiler
+        CFLAGS="$opt_flag $ext_cc_flags -ansi -DH5_USE_16_API"            # default C flags (optimize, ansi)
+        C_CFH="-Df2cFortran"            # C w/ cfortran.h callable from FORTRAN
+        CFHFLAGS="$CFLAGS $C_CFH"       # CFLAGS + C_CFH
+        F77=g77
+        F77FLAGS="$opt_flag $ext_fc_flags -fno-second-underscore" # common FORTRAN flags
+        F77_CFH="-fno-second-underscore"     # FORTRAN callable from C w/cfortran.h
+        F77_C_CFH=""            # calling C w/ cfortran.h
+        F77_C_LIB=""            # C lib called by FORTRAN main
+        HDFSYS=CYGWIN           # system type as defined by HDF
+	MACHINE=CYGWIN		# system type as defined by HDFEOS
+        ;;
+
+    sco)
+	CC=cc 			# C compiler
+	CFLAGS="$opt_flag $ext_cc_flags -posix -DH5_USE_16_API"	# default C flags (optimize, ansi)
+	C_CFH="-Df2cFortran"	# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB=""		# FORTRAN lib called by C main
+	F77=""			# FORTRAN compiler
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB=""		# C lib called by FORTRAN main
+	HDFSYS=SCO		# system type as defined by HDF5
+	MACHINE=SCO		# system type as defined by HDFEOS5
+	;;
+
+    sgi)
+	if [ $OSTYPE = "IRIX64" ]
+        then
+		CC="cc -32"	# C compiler (32 bit)
+		F77="f77 -32"	# FORTRAN compiler (32 bit)
+        else
+		CC=cc		# C compiler
+		F77=f77		# FORTRAN compiler
+        fi
+	CFLAGS="$opt_flag $ext_cc_flags -xansi -D_POSIX_SOURCE -DH5_USE_16_API"	# default C flags (optimize, ansi)
+	C_CFH=""	 	# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB="-lI77 -lU77 -lF77" # FORTRAN lib called by C main
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB=""		# C lib called by FORTRAN main
+	HDFSYS=IRIS4		# system type as defined by HDF5
+	MACHINE=SGI		# system type as defined by HDFEOS5
+	;;
+
+    sgi32)
+	CC="cc -n32"		# C compiler (new-style 32 bit)
+	F77="f77 -n32"		# FORTRAN compiler (new-style 32 bit)
+	CFLAGS="$opt_flag $ext_cc_flags -xansi -D_POSIX_SOURCE -DH5_USE_16_API"	# default C flags (optimize, ansi)
+	C_CFH=""	 	# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB="-lI77 -lU77 -lF77" # FORTRAN lib called by C main
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB=""		# C lib called by FORTRAN main
+	HDFSYS=IRIS4		# system type as defined by HDF5
+	MACHINE=SGI		# system type as defined by HDFEOS5
+	;;
+
+   irix65)
+        CC="cc -n32"            # C compiler (new-style 32 bit)
+        F77="f77 -n32"          # FORTRAN compiler (new-style 32 bit)
+        CFLAGS="$opt_flag $ext_cc_flags -xansi -D_POSIX_SOURCE -DH5_USE_16_API"       # default C flags (optimize, ansi)
+        C_CFH=""                # C w/ cfortran.h callable from FORTRAN
+        CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+        C_F77_CFH="$C_CFH"      # calling FORTRAN
+        C_F77_LIB="-lI77 -lU77 -lF77" # FORTRAN lib called by C main
+        F77FLAGS="$ext_fc_flags"             # common FORTRAN flags
+        F77_CFH=""              # FORTRAN callable from C w/ cfortran.h
+        F77_C_CFH="$F77_CFH"    # calling C w/ cfortran.h
+        CFH_F77="$F77_C_CFH"    # old version of F77_C_CFH
+        F77_C_LIB=""            # C lib called by FORTRAN main
+        HDFSYS=IRIS4            # system type as defined by HDF5
+        MACHINE=SGI             # system type as defined by HDFEOS5
+        ;;
+
+    sgi64)
+	cpu_type=`hinv | fgrep CPU | head -1 | cut -d' ' -f3 | cut -b2`
+	if [ "$cpu_type" = "4" ] ; then
+	    CC="cc -64 -mips3"	# C compiler (R4?00 chip)
+	    F77="f77 -64 -mips3"	# FORTRAN compiler (R4?00 chip)
+        else
+            CC="cc -64"      	# C compiler
+            F77="f77 -64"    	# FORTRAN compiler
+        fi
+	CFLAGS="$opt_flag $ext_cc_flags -xansi -D_POSIX_SOURCE -DH5_USE_16_API"	# default C flags (optimize, ansi)
+	C_CFH=""	 	# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB="-lI77 -lU77 -lF77" # FORTRAN lib called by C main
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH"	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB=""		# C lib called by FORTRAN main
+	HDFSYS=IRIS4		# system type as defined by HDF5
+	MACHINE=SGI		# system type as defined by HDFEOS5
+	;;
+
+    sun4)
+	CC=acc			# C compiler
+	CFLAGS="$opt_flag $ext_cc_flags -Xa -DH5_USE_16_API" 	# default C flags (optimize, ansi)
+	C_CFH="-DsunFortran"	# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB=""		# FORTRAN lib called by C main
+	F77=f77 		# FORTRAN compiler
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH" 	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB="-lm" 	# C lib called by FORTRAN main
+	HDFSYS=SUN		# system type as defined by HDF5
+	MACHINE=SUN4		# system type as defined by HDFEOS5
+	NSL_FLAG="-lnsl"	# this is nil on all but Sun platforms
+	NSL_LIB="/usr/lib/libnsl.a" # this is nil on all but Sun platforms
+	;;
+
+    sun5)
+	CC=cc			# C compiler
+	CFLAGS="$opt_flag $ext_cc_flags -Xa -DH5_USE_16_API" 	# default C flags (optimize, ansi)
+	C_CFH="-DsunFortran"	# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB=""		# FORTRAN lib called by C main
+	F77=f77 		# FORTRAN compiler
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH" 	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB="-lm" 	# C lib called by FORTRAN main
+	HDFSYS=SUN		# system type as defined by HDF5
+	MACHINE=SUN5		# system type as defined by HDFEOS5
+	NSL_FLAG="-lnsl"	# this is nil on all but Sun platforms
+	NSL_LIB="/usr/lib/libnsl.a" # this is nil on all but Sun platforms
+	;;
+
+    sun5.8)
+	CC=cc			# C compiler
+	CFLAGS="$opt_flag $ext_cc_flags -Xa -DH5_USE_16_API" 	# default C flags (optimize, ansi)
+	C_CFH="-DsunFortran"	# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB=""		# FORTRAN lib called by C main
+	F77=f77 		# FORTRAN compiler
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH" 	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB="-lm" 	# C lib called by FORTRAN main
+	HDFSYS=SUN		# system type as defined by HDF5
+	MACHINE=SUN8		# system type as defined by HDFEOS5
+	NSL_FLAG="-lnsl"	# this is nil on all but Sun platforms
+	NSL_LIB="/usr/lib/libnsl.a" # this is nil on all but Sun platforms
+	;;
+
+    sun5.9)
+	CC=cc			# C compiler
+	CFLAGS="$opt_flag $ext_cc_flags -Xa -DH5_USE_16_API" 	# default C flags (optimize, ansi)
+	C_CFH="-DsunFortran"	# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB=""		# FORTRAN lib called by C main
+	F77=f77 		# FORTRAN compiler
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH" 	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB="-lm" 	# C lib called by FORTRAN main
+	HDFSYS=SUN		# system type as defined by HDF5
+	MACHINE=SUN9		# system type as defined by HDFEOS5
+	NSL_FLAG="-lnsl"	# this is nil on all but Sun platforms
+	NSL_LIB="/usr/lib/libnsl.a" # this is nil on all but Sun platforms
+	;;
+
+    sun5.10)
+	CC=cc			# C compiler
+	CFLAGS="$opt_flag $ext_cc_flags -Xa -DH5_USE_16_API" 	# default C flags (optimize, ansi)
+	C_CFH="-DsunFortran"	# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB=""		# FORTRAN lib called by C main
+	F77=f77 		# FORTRAN compiler
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH" 	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB="-lm" 	# C lib called by FORTRAN main
+	HDFSYS=SUN		# system type as defined by HDF5
+	MACHINE=SUN10		# system type as defined by HDFEOS5
+	NSL_FLAG="-lnsl"	# this is nil on all but Sun platforms
+	NSL_LIB="/usr/lib/libnsl.a" # this is nil on all but Sun platforms
+	;;
+
+    *)
+	CC=cc			# C compiler
+	CFLAGS="$opt_flag $ext_cc_flags -DH5_USE_16_API"	# default C flags (optimize)
+	C_CFH=""	# C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS="$CFLAGS $C_CFH" # CFLAGS + C_CFH
+	C_F77_CFH="$C_CFH"	# calling FORTRAN
+	C_F77_LIB=""		# FORTRAN lib called by C main
+	F77=f77 		# FORTRAN compiler
+	F77FLAGS="$ext_fc_flags" 		# common FORTRAN flags
+	F77_CFH=""		# FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH="$F77_CFH" 	# calling C w/ cfortran.h
+	CFH_F77="$F77_C_CFH"	# old version of F77_C_CFH
+	F77_C_LIB="-lm" 	# C lib called by FORTRAN main
+	HDFSYS=unknown		# system type as defined by HDF5
+	MACHINE=unknown		# system type as defined by HDFEOS5
+	;;
+esac
+
+export MACHINE
+export NSL_FLAG NSL_LIB
+
+export CC CFLAGS C_CFH CFHFLAGS C_F77_CFH C_F77_LIB F77
+export F77FLAGS F77_CFH F77_C_CFH CFH_F77 F77_C_LIB HDFSYS
+
+
+# 
+# set up environment to handle FORTRAN-90 compiler
+#
+
+if [ "$hdfeos5_f90_comp" != "" ] ; then		# using FORTRAN-90
+
+    F77="$hdfeos5_f90_comp"
+
+    if [ "$hdfeos5_nag_flag" = "1" ] ; then		# using NAG f90
+        C_CFH="$C_CFH -DNAGf90F"
+        CFHFLAGS="$CFLAGS $C_CFH"
+    fi
+
+    export CFHFLAGS C_CFH F77
+
+fi
+
+
+# copy the machine-specific path to variable hdfeos5_path
+
+hdfeos5_path=$PATH
+
+# set HDFEOS5-related environment variables
+# these may be referred to in makefiles and on compiler command lines
+
+if [ "$HDFEOS5_HOME" != "" ] ; then
+
+# set up base set of HDFEOS5_ Toolkit directory variables.
+
+    HDFEOS5_BIN=${HDFEOS5_HOME}/bin/$BRAND	# executable files
+    HDFEOS5_INC=$HDFEOS5_HOME/include		# include header files
+    HDFEOS5_LIB=${HDFEOS5_HOME}/lib/$BRAND  	# library files
+    HDFEOS5_OBJ=${HDFEOS5_HOME}/obj/$BRAND	# object files
+    HDFEOS5_SRC=$HDFEOS5_HOME/src		# HDFEOS5 source files
+
+    if [ $use_flavor = 1 ] ; then
+    if [ "$opt_flag" = "-g" ] ; then
+
+	HDFEOS5_LIB=${HDFEOS5_LIB}_debug
+	HDFEOS5_OBJ=${HDFEOS5_OBJ}_debug
+	HDFEOS5_BIN=${HDFEOS5_BIN}_debug
+
+        hdf5lib=`echo $HDF5LIB | sed "s/${BRAND}/${BRAND}_debug/"`
+        if [ -d $hdf5lib ] ; then
+            HDF5LIB=$hdf5lib
+        fi
+
+        hdf5inc=`echo $HDF5INC | sed "s/${BRAND}/${BRAND}_debug/"`
+        if [ -d $hdf5inc ] ; then
+            HDF5INC=$hdf5inc
+        fi
+
+    fi
+    fi
+
+    export HDFEOS5_HOME HDFEOS5_BIN HDFEOS5_DAT HDFEOS5_INC HDFEOS5_LIB 
+    export HDFEOS5_MSG  HDFEOS5_OBJ HDFEOS5_RUN HDFEOS5_SRC HDFEOS5_TST
+
+# update path variables
+
+    PATH=$PATH:$HDFEOS5_BIN; export PATH	# add HDFEOS5_BIN to path
+    hdfeos5_path=$hdfeos5_path:$HDFEOS5_BIN	# add HDFEOS5_BIN to hdfeos5 path
+    user_path=$user_path:$HDFEOS5_BIN		# add HDFEOS5_BIN to user path
+
+
+else
+
+    echo "You must first set the environment variable HDFEOS5_HOME"
+
+fi
+
+
+
+#
+# restore augmented user path
+#
+PATH=$user_path ; export PATH
+
+
+# done
+
diff --git a/config/cmake/CPack.cmake b/config/cmake/CPack.cmake
new file mode 100644
index 0000000..d96fe43
--- /dev/null
+++ b/config/cmake/CPack.cmake
@@ -0,0 +1,583 @@
+##section Variables common to all CPack generators
+##end
+##module
+# - Build binary and source package installers.
+# The CPack module generates binary and source installers in a variety
+# of formats using the cpack program. Inclusion of the CPack module
+# adds two new targets to the resulting makefiles, package and
+# package_source, which build the binary and source installers,
+# respectively. The generated binary installers contain everything
+# installed via CMake's INSTALL command (and the deprecated
+# INSTALL_FILES, INSTALL_PROGRAMS, and INSTALL_TARGETS commands).
+#
+# For certain kinds of binary installers (including the graphical
+# installers on Mac OS X and Windows), CPack generates installers that
+# allow users to select individual application components to
+# install. See CPackComponent module for that.
+#
+# The CPACK_GENERATOR variable has different meanings in different
+# contexts. In your CMakeLists.txt file, CPACK_GENERATOR is a
+# *list of generators*: when run with no other arguments, CPack
+# will iterate over that list and produce one package for each
+# generator. In a CPACK_PROJECT_CONFIG_FILE, though, CPACK_GENERATOR
+# is a *string naming a single generator*. If you need per-cpack-
+# generator logic to control *other* cpack settings, then you need
+# a CPACK_PROJECT_CONFIG_FILE.
+#
+# The CMake source tree itself contains a CPACK_PROJECT_CONFIG_FILE.
+# See the top level file CMakeCPackOptions.cmake.in for an example.
+#
+# If set, the CPACK_PROJECT_CONFIG_FILE is included automatically
+# on a per-generator basis. It only need contain overrides.
+#
+# Here's how it works:
+#  - cpack runs
+#  - it includes CPackConfig.cmake
+#  - it iterates over the generators listed in that file's
+#    CPACK_GENERATOR list variable (unless told to use just a
+#    specific one via -G on the command line...)
+#
+#  - foreach generator, it then
+#    - sets CPACK_GENERATOR to the one currently being iterated
+#    - includes the CPACK_PROJECT_CONFIG_FILE
+#    - produces the package for that generator
+#
+# This is the key: For each generator listed in CPACK_GENERATOR
+# in CPackConfig.cmake, cpack will *reset* CPACK_GENERATOR
+# internally to *the one currently being used* and then include
+# the CPACK_PROJECT_CONFIG_FILE.
+#
+# Before including this CPack module in your CMakeLists.txt file,
+# there are a variety of variables that can be set to customize
+# the resulting installers. The most commonly-used variables are:
+##end
+#
+##variable
+#  CPACK_PACKAGE_NAME - The name of the package (or application). If
+#  not specified, defaults to the project name.
+##end
+#
+##variable
+#  CPACK_PACKAGE_VENDOR - The name of the package vendor. (e.g.,
+#  "Kitware").
+##end
+#
+##variable
+#  CPACK_PACKAGE_DIRECTORY - The directory in which CPack is doing its
+#  packaging. If it is not set then this will default (internally) to the
+#  build dir. This variable may be defined in CPack config file or from
+#  the cpack command line option "-B". If set the command line option
+#  override the value found in the config file.
+##end
+#
+##variable
+#  CPACK_PACKAGE_VERSION_MAJOR - Package major Version
+##end
+#
+##variable
+#  CPACK_PACKAGE_VERSION_MINOR - Package minor Version
+##end
+#
+##variable
+#  CPACK_PACKAGE_VERSION_PATCH - Package patch Version
+##end
+#
+##variable
+#  CPACK_PACKAGE_DESCRIPTION_FILE - A text file used to describe the
+#  project. Used, for example, the introduction screen of a
+#  CPack-generated Windows installer to describe the project.
+##end
+#
+##variable
+#  CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the
+#  project (only a few words).
+##end
+#
+##variable
+#  CPACK_PACKAGE_FILE_NAME - The name of the package file to generate,
+#  not including the extension. For example, cmake-2.6.1-Linux-i686.
+#  The default value is
+#
+#  ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}.
+##end
+#
+##variable
+#  CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the
+#  target system. This may be used by some CPack generators
+#  like NSIS to create an installation directory e.g., "CMake 2.5"
+#  below the installation prefix. All installed element will be
+#  put inside this directory.
+##end
+#
+##variable
+#   CPACK_PACKAGE_ICON - A branding image that will be displayed inside
+#   the installer (used by GUI installers).
+##end
+#
+##variable
+#  CPACK_PROJECT_CONFIG_FILE - CPack-time project CPack configuration
+#  file. This file included at cpack time, once per
+#  generator after CPack has set CPACK_GENERATOR to the actual generator
+#  being used. It allows per-generator setting of CPACK_* variables at
+#  cpack time.
+##end
+#
+##variable
+#  CPACK_RESOURCE_FILE_LICENSE - License to be embedded in the installer. It
+#  will typically be displayed to the user by the produced installer
+#  (often with an explicit "Accept" button, for graphical installers)
+#  prior to installation. This license file is NOT added to installed
+#  file but is used by some CPack generators like NSIS. If you want
+#  to install a license file (may be the same as this one)
+#  along with your project you must add an appropriate CMake INSTALL
+#  command in your CMakeLists.txt.
+##end
+#
+##variable
+#  CPACK_RESOURCE_FILE_README - ReadMe file to be embedded in the installer. It
+#  typically describes in some detail the purpose of the project
+#  during the installation. Not all CPack generators uses
+#  this file.
+##end
+#
+##variable
+#  CPACK_RESOURCE_FILE_WELCOME - Welcome file to be embedded in the
+#  installer. It welcomes users to this installer.
+#  Typically used in the graphical installers on Windows and Mac OS X.
+##end
+#
+##variable
+#  CPACK_MONOLITHIC_INSTALL - Disables the component-based
+#  installation mechanism. When set the component specification is ignored
+#  and all installed items are put in a single "MONOLITHIC" package.
+#  Some CPack generators do monolithic packaging by default and
+#  may be asked to do component packaging by setting
+#  CPACK_<GENNAME>_COMPONENT_INSTALL to 1/TRUE.
+##end
+#
+##variable
+#  CPACK_GENERATOR - List of CPack generators to use. If not
+#  specified, CPack will create a set of options CPACK_BINARY_<GENNAME> (e.g.,
+#  CPACK_BINARY_NSIS) allowing the user to enable/disable individual
+#  generators. This variable may be used on the command line
+#  as well as in:
+#
+#    cpack -D CPACK_GENERATOR="ZIP;TGZ" /path/to/build/tree
+##end
+#
+##variable
+#  CPACK_OUTPUT_CONFIG_FILE - The name of the CPack binary configuration
+#  file. This file is the CPack configuration generated by the CPack module
+#  for binary installers. Defaults to CPackConfig.cmake.
+##end
+#
+##variable
+#  CPACK_PACKAGE_EXECUTABLES - Lists each of the executables and associated
+#  text label to be used to create Start Menu shortcuts. For example,
+#  setting this to the list ccmake;CMake will
+#  create a shortcut named "CMake" that will execute the installed
+#  executable ccmake. Not all CPack generators use it (at least NSIS and
+#  OSXX11 do).
+##end
+#
+##variable
+#  CPACK_STRIP_FILES - List of files to be stripped. Starting with
+#  CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable which
+#  enables stripping of all files (a list of files evaluates to TRUE
+#  in CMake, so this change is compatible).
+##end
+#
+# The following CPack variables are specific to source packages, and
+# will not affect binary packages:
+#
+##variable
+#  CPACK_SOURCE_PACKAGE_FILE_NAME - The name of the source package. For
+#  example cmake-2.6.1.
+##end
+#
+##variable
+#  CPACK_SOURCE_STRIP_FILES - List of files in the source tree that
+#  will be stripped. Starting with CMake 2.6.0
+#  CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables
+#  stripping of all files (a list of files evaluates to TRUE in CMake,
+#  so this change is compatible).
+##end
+#
+##variable
+#  CPACK_SOURCE_GENERATOR - List of generators used for the source
+#  packages. As with CPACK_GENERATOR, if this is not specified then
+#  CPack will create a set of options (e.g., CPACK_SOURCE_ZIP)
+#  allowing users to select which packages will be generated.
+##end
+#
+##variable
+#  CPACK_SOURCE_OUTPUT_CONFIG_FILE - The name of the CPack source
+#  configuration file. This file is the CPack configuration generated by the
+#  CPack module for source installers. Defaults to CPackSourceConfig.cmake.
+##end
+#
+##variable
+#  CPACK_SOURCE_IGNORE_FILES - Pattern of files in the source tree
+#  that won't be packaged when building a source package. This is a
+#  list of regular expression patterns (that must be properly escaped),
+#  e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.*
+##end
+#
+# The following variables are for advanced uses of CPack:
+#
+##variable
+#  CPACK_CMAKE_GENERATOR - What CMake generator should be used if the
+#  project is CMake project. Defaults to the value of CMAKE_GENERATOR
+#  few users will want to change this setting.
+##end
+#
+##variable
+#  CPACK_INSTALL_CMAKE_PROJECTS - List of four values that specify
+#  what project to install. The four values are: Build directory,
+#  Project Name, Project Component, Directory. If omitted, CPack will
+#  build an installer that installers everything.
+##end
+#
+##variable
+#  CPACK_SYSTEM_NAME - System name, defaults to the value of
+#  ${CMAKE_SYSTEM_NAME}.
+##end
+#
+##variable
+#  CPACK_PACKAGE_VERSION - Package full version, used internally. By
+#  default, this is built from CPACK_PACKAGE_VERSION_MAJOR,
+#  CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH.
+##end
+#
+##variable
+#  CPACK_TOPLEVEL_TAG - Directory for the installed files.
+##end
+#
+##variable
+#  CPACK_INSTALL_COMMANDS - Extra commands to install components.
+##end
+#
+##variable
+#  CPACK_INSTALLED_DIRECTORIES - Extra directories to install.
+##end
+#
+##variable
+#   CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when
+#   installing this project. This is only used
+#   by installer for Windows.
+##end
+##variable
+#   CPACK_CREATE_DESKTOP_LINKS - List of desktop links to create.
+##end
+#
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+# Define this var in order to avoid (or warn) concerning multiple inclusion
+if(CPack_CMake_INCLUDED)
+  message(WARNING "CPack.cmake has already been included!!")
+else()
+  set(CPack_CMake_INCLUDED 1)
+endif()
+
+# Pick a configuration file
+set(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
+if(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
+  set(cpack_input_file "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
+endif()
+set(cpack_source_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
+if(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
+  set(cpack_source_input_file "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
+endif()
+
+# Backward compatibility
+# Include CPackComponent macros if it has not already been included before.
+include(CPackComponent)
+
+# Macro for setting values if a user did not overwrite them
+macro(cpack_set_if_not_set name value)
+  if(NOT DEFINED "${name}")
+    set(${name} "${value}")
+  endif()
+endmacro()
+
+# cpack_encode_variables - Macro to encode variables for the configuration file
+# find any variable that starts with CPACK and create a variable
+# _CPACK_OTHER_VARIABLES_ that contains SET commands for
+# each cpack variable.  _CPACK_OTHER_VARIABLES_ is then
+# used as an @ replacment in configure_file for the CPackConfig.
+macro(cpack_encode_variables)
+  set(_CPACK_OTHER_VARIABLES_)
+  get_cmake_property(res VARIABLES)
+  foreach(var ${res})
+    if("xxx${var}" MATCHES "xxxCPACK")
+      set(_CPACK_OTHER_VARIABLES_
+        "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")")
+      endif()
+  endforeach()
+endmacro()
+
+# Set the package name
+cpack_set_if_not_set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
+cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MAJOR "0")
+cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MINOR "1")
+cpack_set_if_not_set(CPACK_PACKAGE_VERSION_PATCH "1")
+cpack_set_if_not_set(CPACK_PACKAGE_VERSION
+  "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+cpack_set_if_not_set(CPACK_PACKAGE_VENDOR "Humanity")
+cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
+  "${CMAKE_PROJECT_NAME} built using CMake")
+
+cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_FILE
+  "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
+cpack_set_if_not_set(CPACK_RESOURCE_FILE_LICENSE
+  "${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
+cpack_set_if_not_set(CPACK_RESOURCE_FILE_README
+  "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
+cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME
+  "${CMAKE_ROOT}/Templates/CPack.GenericWelcome.txt")
+
+cpack_set_if_not_set(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}")
+
+if(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL)
+  set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
+endif()
+
+if(CPACK_NSIS_MODIFY_PATH)
+  set(CPACK_NSIS_MODIFY_PATH ON)
+endif()
+
+set(__cpack_system_name ${CMAKE_SYSTEM_NAME})
+if(${__cpack_system_name} MATCHES Windows)
+  if(CMAKE_CL_64)
+    set(__cpack_system_name win64)
+  else()
+    set(__cpack_system_name win32)
+  endif()
+endif()
+cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}")
+
+# Root dir: default value should be the string literal "$PROGRAMFILES"
+# for backwards compatibility. Projects may set this value to anything.
+if(CMAKE_CL_64)
+set(__cpack_root_default "$PROGRAMFILES64")
+else()
+set(__cpack_root_default "$PROGRAMFILES")
+endif()
+cpack_set_if_not_set(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}")
+
+# <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype>
+cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME
+  "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
+cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_DIRECTORY
+  "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
+cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
+  "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+cpack_set_if_not_set(CPACK_PACKAGE_DEFAULT_LOCATION "/")
+cpack_set_if_not_set(CPACK_PACKAGE_RELOCATABLE "true")
+
+# always force to exactly "true" or "false" for CPack.Info.plist.in:
+if(CPACK_PACKAGE_RELOCATABLE)
+  set(CPACK_PACKAGE_RELOCATABLE "true")
+else()
+  set(CPACK_PACKAGE_RELOCATABLE "false")
+endif()
+
+macro(cpack_check_file_exists file description)
+  if(NOT EXISTS "${file}")
+    message(SEND_ERROR "CPack ${description} file: \"${file}\" could not be found.")
+  endif()
+endmacro()
+
+cpack_check_file_exists("${CPACK_PACKAGE_DESCRIPTION_FILE}" "package description")
+cpack_check_file_exists("${CPACK_RESOURCE_FILE_LICENSE}"    "license resource")
+cpack_check_file_exists("${CPACK_RESOURCE_FILE_README}"     "readme resource")
+cpack_check_file_exists("${CPACK_RESOURCE_FILE_WELCOME}"    "welcome resource")
+
+macro(cpack_optional_append _list _cond _item)
+  if(${_cond})
+    set(${_list} ${${_list}} ${_item})
+  endif()
+endmacro()
+
+##variable
+# CPACK_BINARY_<GENNAME> - CPack generated options for binary generators. The
+# CPack.cmake module generates (when CPACK_GENERATOR is not set)
+# a set of CMake options (see CMake option command) which may then be used to
+# select the CPack generator(s) to be used when launching the package target.
+##end
+# Provide options to choose generators
+# we might check here if the required tools for the generates exist
+# and set the defaults according to the results
+if(NOT CPACK_GENERATOR)
+  if(UNIX)
+    if(CYGWIN)
+      option(CPACK_BINARY_CYGWIN "Enable to build Cygwin binary packages" ON)
+    else()
+      if(APPLE)
+        option(CPACK_BINARY_BUNDLE       "Enable to build OSX bundles"      OFF)
+        option(CPACK_BINARY_DRAGNDROP    "Enable to build OSX Drag And Drop package" OFF)
+        option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" ON)
+        option(CPACK_BINARY_OSXX11       "Enable to build OSX X11 packages"      OFF)
+      else()
+        option(CPACK_BINARY_TZ  "Enable to build TZ packages"     ON)
+      endif()
+      option(CPACK_BINARY_STGZ "Enable to build STGZ packages"    ON)
+      option(CPACK_BINARY_TGZ  "Enable to build TGZ packages"     ON)
+      option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages"    OFF)
+      option(CPACK_BINARY_DEB  "Enable to build Debian packages"  OFF)
+      option(CPACK_BINARY_RPM  "Enable to build RPM packages"     OFF)
+      option(CPACK_BINARY_NSIS "Enable to build NSIS packages"    OFF)
+    endif()
+  else()
+    option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
+    option(CPACK_BINARY_ZIP  "Enable to build ZIP packages" OFF)
+  endif()
+
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_BUNDLE       Bundle)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_DRAGNDROP    DragNDrop)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_PACKAGEMAKER PackageMaker)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_OSXX11       OSXX11)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_CYGWIN       CygwinBinary)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_DEB          DEB)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_RPM          RPM)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_NSIS         NSIS)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_STGZ         STGZ)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TGZ          TGZ)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TBZ2         TBZ2)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TZ           TZ)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_ZIP          ZIP)
+
+endif()
+
+# Provide options to choose source generators
+if(NOT CPACK_SOURCE_GENERATOR)
+  if(UNIX)
+    if(CYGWIN)
+      option(CPACK_SOURCE_CYGWIN "Enable to build Cygwin source packages" ON)
+    else()
+      option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON)
+      option(CPACK_SOURCE_TGZ  "Enable to build TGZ source packages"  ON)
+      option(CPACK_SOURCE_TZ   "Enable to build TZ source packages"   ON)
+      option(CPACK_SOURCE_ZIP  "Enable to build ZIP source packages"  OFF)
+    endif()
+  else()
+    option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON)
+  endif()
+
+  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_CYGWIN  CygwinSource)
+  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TGZ     TGZ)
+  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TBZ2    TBZ2)
+  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TZ      TZ)
+  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_ZIP     ZIP)
+endif()
+
+# mark the above options as advanced
+mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11
+                 CPACK_BINARY_STGZ   CPACK_BINARY_TGZ          CPACK_BINARY_TBZ2
+                 CPACK_BINARY_DEB    CPACK_BINARY_RPM          CPACK_BINARY_TZ
+                 CPACK_BINARY_NSIS CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE
+                 CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ
+                 CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP)
+
+# Set some other variables
+cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS
+  "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
+cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
+cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}")
+# if the user has set CPACK_NSIS_DISPLAY_NAME remember it
+if(DEFINED CPACK_NSIS_DISPLAY_NAME)
+  set(CPACK_NSIS_DISPLAY_NAME_SET TRUE)
+endif()
+# if the user has set CPACK_NSIS_DISPLAY
+# explicitly, then use that as the default
+# value of CPACK_NSIS_PACKAGE_NAME  instead
+# of CPACK_PACKAGE_INSTALL_DIRECTORY
+cpack_set_if_not_set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+
+if(CPACK_NSIS_DISPLAY_NAME_SET)
+  string(REPLACE "\\" "\\\\"
+    _NSIS_DISPLAY_NAME_TMP  "${CPACK_NSIS_DISPLAY_NAME}")
+  cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${_NSIS_DISPLAY_NAME_TMP}")
+else()
+  cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+endif()
+
+cpack_set_if_not_set(CPACK_OUTPUT_CONFIG_FILE
+  "${CMAKE_BINARY_DIR}/CPackConfig.cmake")
+
+cpack_set_if_not_set(CPACK_SOURCE_OUTPUT_CONFIG_FILE
+  "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake")
+
+cpack_set_if_not_set(CPACK_SET_DESTDIR OFF)
+cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
+
+cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "")
+cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
+
+if(DEFINED CPACK_COMPONENTS_ALL)
+  if(CPACK_MONOLITHIC_INSTALL)
+    message("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.")
+    set(CPACK_COMPONENTS_ALL)
+  else()
+    # The user has provided the set of components to be installed as
+    # part of a component-based installation; trust her.
+    set(CPACK_COMPONENTS_ALL_SET_BY_USER TRUE)
+  endif()
+else()
+  # If the user has not specifically requested a monolithic installer
+  # but has specified components in various "install" commands, tell
+  # CPack about those components.
+  if(NOT CPACK_MONOLITHIC_INSTALL)
+    get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
+    list(LENGTH CPACK_COMPONENTS_ALL CPACK_COMPONENTS_LEN)
+    if(CPACK_COMPONENTS_LEN EQUAL 1)
+      # Only one component: this is not a component-based installation
+      # (at least, it isn't a component-based installation, but may
+      # become one later if the user uses the cpack_add_* commands).
+      set(CPACK_COMPONENTS_ALL)
+    endif()
+    set(CPACK_COMPONENTS_LEN)
+  endif()
+endif()
+
+# CMake always generates a component named "Unspecified", which is
+# used to install everything that doesn't have an explicitly-provided
+# component. Since these files should always be installed, we'll make
+# them hidden and required.
+set(CPACK_COMPONENT_UNSPECIFIED_HIDDEN TRUE)
+set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED TRUE)
+
+cpack_encode_variables()
+configure_file("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE)
+
+# Generate source file
+cpack_set_if_not_set(CPACK_SOURCE_INSTALLED_DIRECTORIES
+  "${CMAKE_SOURCE_DIR};/")
+cpack_set_if_not_set(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source")
+cpack_set_if_not_set(CPACK_SOURCE_PACKAGE_FILE_NAME
+  "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source")
+cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES
+  "/CVS/;/\\\\\\\\.svn/;/\\\\\\\\.bzr/;/\\\\\\\\.hg/;/\\\\\\\\.git/;\\\\\\\\.swp$;\\\\\\\\.#;/#")
+set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}")
+set(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}")
+set(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}")
+set(CPACK_TOPLEVEL_TAG "${CPACK_SOURCE_TOPLEVEL_TAG}")
+set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
+set(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}")
+set(CPACK_STRIP_FILES "${CPACK_SOURCE_STRIP_FILES}")
+
+cpack_encode_variables()
+configure_file("${cpack_source_input_file}"
+  "${CPACK_SOURCE_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE)
diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake
new file mode 100755
index 0000000..aa6e2fc
--- /dev/null
+++ b/config/cmake/CTestCustom.cmake
@@ -0,0 +1,13 @@
+SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 1500)
+
+SET (CTEST_CUSTOM_WARNING_EXCEPTION
+    ${CTEST_CUSTOM_WARNING_EXCEPTION}
+    "note.*expected.*void.*but argument is of type.*volatile"
+    "SZIP.src.*:[ \t]*warning"
+    "jpeg.src.*:[ \t]*warning"
+    "POSIX name for this item is deprecated"
+    "disabling jobserver mode"
+    "config.cmake.xlatefile.c"
+    "warning.*implicit declaration of function"
+)
+ 
diff --git a/config/cmake/CheckTypeSize.cmake b/config/cmake/CheckTypeSize.cmake
new file mode 100644
index 0000000..b0d461f
--- /dev/null
+++ b/config/cmake/CheckTypeSize.cmake
@@ -0,0 +1,48 @@
+#
+# Check if the type exists and determine size of type.  if the type
+# exists, the size will be stored to the variable.
+#
+# CHECK_TYPE_SIZE - macro which checks the size of type
+# VARIABLE - variable to store size if the type exists.
+# HAVE_${VARIABLE} - does the variable exists or not
+#
+
+MACRO (HDFEOS_CHECK_TYPE_SIZE TYPE VARIABLE)
+  SET (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1)
+  IF ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
+    SET (MACRO_CHECK_TYPE_SIZE_FLAGS 
+        "-DCHECK_TYPE_SIZE_TYPE=\"${TYPE}\" ${CMAKE_REQUIRED_FLAGS}"
+    )
+    FOREACH (def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H HAVE_INTTYPES_H)
+      IF ("${def}")
+        SET (MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}")
+      ENDIF("${def}")
+    ENDFOREACH (def)
+
+    MESSAGE (STATUS "Check size of ${TYPE}")
+    IF (CMAKE_REQUIRED_LIBRARIES)
+      SET (CHECK_TYPE_SIZE_ADD_LIBRARIES 
+          "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
+      )
+    ENDIF (CMAKE_REQUIRED_LIBRARIES)
+    TRY_RUN (${VARIABLE} HAVE_${VARIABLE}
+        ${CMAKE_BINARY_DIR}
+        ${EOS_RESOURCES_DIR}/CheckTypeSize.c
+        CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS}
+        "${CHECK_TYPE_SIZE_ADD_LIBRARIES}"
+        OUTPUT_VARIABLE OUTPUT
+    )
+    IF (HAVE_${VARIABLE})
+      MESSAGE (STATUS "Check size of ${TYPE} - done")
+      FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log 
+          "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n"
+      )
+    ELSE (HAVE_${VARIABLE})
+      MESSAGE (STATUS "Check size of ${TYPE} - failed")
+      FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log 
+          "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n\n"
+      )
+    ENDIF (HAVE_${VARIABLE})
+  ENDIF ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
+  SET (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS)
+ENDMACRO (HDFEOS_CHECK_TYPE_SIZE)
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
new file mode 100644
index 0000000..2c080ed
--- /dev/null
+++ b/config/cmake/ConfigureChecks.cmake
@@ -0,0 +1,340 @@
+#-----------------------------------------------------------------------------
+# Include all the necessary files for macros
+#-----------------------------------------------------------------------------
+INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
+
+#-----------------------------------------------------------------------------
+# Always SET this for now IF we are on an OS X box
+#-----------------------------------------------------------------------------
+IF (APPLE)
+  LIST(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_LENGTH)
+  IF(ARCH_LENGTH GREATER 1)
+    set (CMAKE_OSX_ARCHITECTURES "" CACHE STRING "" FORCE)
+    message(FATAL_ERROR "Building Universal Binaries on OS X is NOT supported by the EOS project. This is"
+    "due to technical reasons. The best approach would be build each architecture in separate directories"
+    "and use the 'lipo' tool to combine them into a single executable or library. The 'CMAKE_OSX_ARCHITECTURES'"
+    "variable has been set to a blank value which will build the default architecture for this system.")
+  ENDIF()
+  SET (EOS_AC_APPLE_UNIVERSAL_BUILD 0)
+ENDIF (APPLE)
+
+#-----------------------------------------------------------------------------
+# This MACRO checks IF the symbol exists in the library and IF it
+# does, it appends library to the list.
+#-----------------------------------------------------------------------------
+SET (LINK_LIBS "")
+MACRO (CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE)
+  CHECK_LIBRARY_EXISTS ("${LIBRARY};${LINK_LIBS}" ${SYMBOL} "" ${VARIABLE})
+  IF (${VARIABLE})
+    SET (LINK_LIBS ${LINK_LIBS} ${LIBRARY})
+  ENDIF (${VARIABLE})
+ENDMACRO (CHECK_LIBRARY_EXISTS_CONCAT)
+
+# ----------------------------------------------------------------------
+# WINDOWS Hard code Values
+# ----------------------------------------------------------------------
+
+SET (WINDOWS)
+IF (WIN32)
+  IF (MINGW)
+    SET (WINDOWS 1) # MinGW tries to imitate Windows
+    SET (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1")
+  ENDIF (MINGW)
+  SET (CMAKE_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib")
+  IF (NOT UNIX AND NOT CYGWIN AND NOT MINGW)
+    SET (WINDOWS 1)
+    SET (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1")
+  ENDIF (NOT UNIX AND NOT CYGWIN AND NOT MINGW)
+ENDIF (WIN32)
+
+IF (WINDOWS)
+  SET (EOS_HAVE_STDDEF_H 1)
+  SET (EOS_HAVE_SYS_STAT_H 1)
+  SET (EOS_HAVE_SYS_TYPES_H 1)
+  SET (EOS_HAVE_LIBM 1)
+  SET (EOS_HAVE_STRDUP 1)
+  SET (EOS_HAVE_SYSTEM 1)
+  SET (EOS_HAVE_LONGJMP 1)
+  IF (NOT MINGW)
+    SET (EOS_HAVE_GETHOSTNAME 1)
+  ENDIF (NOT MINGW)
+  SET (EOS_HAVE_GETCONSOLESCREENBUFFERINFO 1)
+  SET (EOS_HAVE_FUNCTION 1)
+  SET (EOS_HAVE_TIMEZONE 1)
+  IF (MINGW)
+    SET (EOS_HAVE_WINSOCK2_H 1)
+  ENDIF (MINGW)
+  SET (EOS_HAVE_LIBWS2_32 1)
+  SET (EOS_HAVE_LIBWSOCK32 1)
+ENDIF (WINDOWS)
+
+# ----------------------------------------------------------------------
+# END of WINDOWS Hard code Values
+# ----------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+#  Check for the math library "m"
+#-----------------------------------------------------------------------------
+IF (NOT WINDOWS)
+  CHECK_LIBRARY_EXISTS_CONCAT ("m" ceil     EOS_HAVE_LIBM)
+  CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup  EOS_HAVE_LIBWS2_32)
+  CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname EOS_HAVE_LIBWSOCK32)
+ENDIF (NOT WINDOWS)
+
+CHECK_LIBRARY_EXISTS_CONCAT ("ucb"    gethostname  EOS_HAVE_LIBUCB)
+CHECK_LIBRARY_EXISTS_CONCAT ("socket" connect      EOS_HAVE_LIBSOCKET)
+CHECK_LIBRARY_EXISTS ("c" gethostbyname "" NOT_NEED_LIBNSL)
+
+IF (NOT NOT_NEED_LIBNSL)
+  CHECK_LIBRARY_EXISTS_CONCAT ("nsl"    gethostbyname  EOS_HAVE_LIBNSL)
+ENDIF (NOT NOT_NEED_LIBNSL)
+
+# For other tests to use the same libraries
+SET (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LINK_LIBS})
+
+SET (USE_INCLUDES "")
+IF (WINDOWS)
+  SET (USE_INCLUDES ${USE_INCLUDES} "windows.h")
+ENDIF (WINDOWS)
+
+# For other other specific tests, use this MACRO.
+MACRO (HDFEOS_FUNCTION_TEST OTHER_TEST)
+  IF ("EOS_${OTHER_TEST}" MATCHES "^EOS_${OTHER_TEST}$")
+    SET (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}")
+    SET (OTHER_TEST_ADD_LIBRARIES)
+    IF (CMAKE_REQUIRED_LIBRARIES)
+      SET (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
+    ENDIF (CMAKE_REQUIRED_LIBRARIES)
+    
+    FOREACH (def ${EOS_EXTRA_TEST_DEFINITIONS})
+      SET (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}")
+    ENDFOREACH (def)
+
+    FOREACH (def
+        HAVE_SYS_TIME_H
+        HAVE_UNISTD_H
+        HAVE_SYS_TYPES_H
+        HAVE_SYS_SOCKET_H
+    )
+      IF ("${EOS_${def}}")
+        SET (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}")
+      ENDIF ("${EOS_${def}}")
+    ENDFOREACH (def)
+    
+    IF (LARGEFILE)
+      SET (MACRO_CHECK_FUNCTION_DEFINITIONS
+          "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE"
+      )
+    ENDIF (LARGEFILE)
+
+    #MESSAGE (STATUS "Performing ${OTHER_TEST}")
+    TRY_COMPILE (${OTHER_TEST}
+        ${CMAKE_BINARY_DIR}
+        ${EOS_RESOURCES_DIR}/EOSTests.c
+        CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+        "${OTHER_TEST_ADD_LIBRARIES}"
+        OUTPUT_VARIABLE OUTPUT
+    )
+    IF (${OTHER_TEST})
+      SET (EOS_${OTHER_TEST} 1 CACHE INTERNAL "Other test ${FUNCTION}")
+      MESSAGE (STATUS "Performing Other Test ${OTHER_TEST} - Success")
+    ELSE (${OTHER_TEST})
+      MESSAGE (STATUS "Performing Other Test ${OTHER_TEST} - Failed")
+      SET (EOS_${OTHER_TEST} "" CACHE INTERNAL "Other test ${FUNCTION}")
+      FILE (APPEND
+          ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+          "Performing Other Test ${OTHER_TEST} failed with the following output:\n"
+          "${OUTPUT}\n"
+      )
+    ENDIF (${OTHER_TEST})
+  ENDIF ("EOS_${OTHER_TEST}" MATCHES "^EOS_${OTHER_TEST}$")
+ENDMACRO (HDFEOS_FUNCTION_TEST)
+
+#-----------------------------------------------------------------------------
+HDFEOS_FUNCTION_TEST (STDC_HEADERS)
+HDFEOS_FUNCTION_TEST (HAVE_F2CFORTRAN_MACRO)
+HDFEOS_FUNCTION_TEST (HAVE_F2CFORTRAN_32PTR)
+
+#-----------------------------------------------------------------------------
+# Check IF header file exists and add it to the list.
+#-----------------------------------------------------------------------------
+MACRO (CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE)
+  CHECK_INCLUDE_FILES ("${USE_INCLUDES};${FILE}" ${VARIABLE})
+  IF (${VARIABLE})
+    SET (USE_INCLUDES ${USE_INCLUDES} ${FILE})
+  ENDIF (${VARIABLE})
+ENDMACRO (CHECK_INCLUDE_FILE_CONCAT)
+
+#-----------------------------------------------------------------------------
+#  Check for the existence of certain header files
+#-----------------------------------------------------------------------------
+CHECK_INCLUDE_FILE_CONCAT ("unistd.h"        EOS_HAVE_UNISTD_H)
+CHECK_INCLUDE_FILE_CONCAT ("sys/stat.h"      EOS_HAVE_SYS_STAT_H)
+CHECK_INCLUDE_FILE_CONCAT ("sys/types.h"     EOS_HAVE_SYS_TYPES_H)
+CHECK_INCLUDE_FILE_CONCAT ("stddef.h"        EOS_HAVE_STDDEF_H)
+CHECK_INCLUDE_FILE_CONCAT ("stdint.h"        EOS_HAVE_STDINT_H)
+
+# IF the c compiler found stdint, check the C++ as well. On some systems this
+# file will be found by C but not C++, only do this test IF the C++ compiler
+# has been initialized (e.g. the project also includes some c++)
+IF (EOS_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED)
+  CHECK_INCLUDE_FILE_CXX ("stdint.h" EOS_HAVE_STDINT_H_CXX)
+  IF (NOT EOS_HAVE_STDINT_H_CXX)
+    SET (EOS_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H")
+    SET (USE_INCLUDES ${USE_INCLUDES} "stdint.h")
+  ENDIF (NOT EOS_HAVE_STDINT_H_CXX)
+ENDIF (EOS_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED)
+
+# Windows
+IF (NOT CYGWIN)
+  CHECK_INCLUDE_FILE_CONCAT ("winsock2.h"      EOS_HAVE_WINSOCK2_H)
+ENDIF (NOT CYGWIN)
+CHECK_INCLUDE_FILE_CONCAT ("pthread.h"       EOS_HAVE_PTHREAD_H)
+CHECK_INCLUDE_FILE_CONCAT ("string.h"        EOS_HAVE_STRING_H)
+CHECK_INCLUDE_FILE_CONCAT ("strings.h"       EOS_HAVE_STRINGS_H)
+CHECK_INCLUDE_FILE_CONCAT ("stdlib.h"        EOS_HAVE_STDLIB_H)
+CHECK_INCLUDE_FILE_CONCAT ("memory.h"        EOS_HAVE_MEMORY_H)
+CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h"         EOS_HAVE_DLFCN_H)
+CHECK_INCLUDE_FILE_CONCAT ("inttypes.h"      EOS_HAVE_INTTYPES_H)
+
+#-----------------------------------------------------------------------------
+#  Check for large file support
+#-----------------------------------------------------------------------------
+
+# The linux-lfs option is deprecated.
+SET (LINUX_LFS 0)
+
+SET (EOS_EXTRA_FLAGS)
+IF (NOT WINDOWS)
+  # Linux Specific flags
+  IF (CYGWIN)
+    SET (EOS_EXTRA_FLAGS -D_BSD_SOURCE)
+  ELSE (CYGWIN)
+    SET (EOS_EXTRA_FLAGS -D_POSIX_SOURCE -D_BSD_SOURCE)
+  ENDIF (CYGWIN)
+  OPTION (EOS_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON)
+  IF (EOS_ENABLE_LARGE_FILE)
+    SET (msg "Performing TEST_LFS_WORKS")
+    TRY_RUN (TEST_LFS_WORKS_RUN   TEST_LFS_WORKS_COMPILE
+        ${CMAKE_BINARY_DIR}/CMake
+        ${EOS_RESOURCES_DIR}/EOSTests.c
+        CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS
+        OUTPUT_VARIABLE OUTPUT
+    )
+    IF (TEST_LFS_WORKS_COMPILE)
+      IF (TEST_LFS_WORKS_RUN  MATCHES 0)
+        SET (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg})
+        SET (LARGEFILE 1)
+        SET (EOS_EXTRA_FLAGS ${EOS_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE)
+        MESSAGE (STATUS "${msg}... yes")
+      ELSE (TEST_LFS_WORKS_RUN  MATCHES 0)
+        SET (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
+        MESSAGE (STATUS "${msg}... no")
+        FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+              "Test TEST_LFS_WORKS Run failed with the following output and exit code:\n ${OUTPUT}\n"
+        )
+      ENDIF (TEST_LFS_WORKS_RUN  MATCHES 0)
+    ELSE (TEST_LFS_WORKS_COMPILE )
+      SET (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
+      MESSAGE (STATUS "${msg}... no")
+      FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+          "Test TEST_LFS_WORKS Compile failed with the following output:\n ${OUTPUT}\n"
+      )
+    ENDIF (TEST_LFS_WORKS_COMPILE)
+  ENDIF (EOS_ENABLE_LARGE_FILE)
+  SET (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${EOS_EXTRA_FLAGS})
+ENDIF (NOT WINDOWS)
+
+ADD_DEFINITIONS (${EOS_EXTRA_FLAGS})
+
+#-----------------------------------------------------------------------------
+#  Check the size in bytes of all the int and float types
+#-----------------------------------------------------------------------------
+MACRO (EOS_CHECK_TYPE_SIZE type var)
+  SET (aType ${type})
+  SET (aVar  ${var})
+#  MESSAGE (STATUS "Checking size of ${aType} and storing into ${aVar}")
+  CHECK_TYPE_SIZE (${aType}   ${aVar})
+  IF (NOT ${aVar})
+    SET (${aVar} 0 CACHE INTERNAL "SizeOf for ${aType}")
+#    MESSAGE (STATUS "Size of ${aType} was NOT Found")
+  ENDIF (NOT ${aVar})
+ENDMACRO (EOS_CHECK_TYPE_SIZE)
+
+
+EOS_CHECK_TYPE_SIZE (char           EOS_SIZEOF_CHAR)
+EOS_CHECK_TYPE_SIZE (short          EOS_SIZEOF_SHORT)
+EOS_CHECK_TYPE_SIZE (int            EOS_SIZEOF_INT)
+EOS_CHECK_TYPE_SIZE (unsigned       EOS_SIZEOF_UNSIGNED)
+IF (NOT APPLE)
+  EOS_CHECK_TYPE_SIZE (long         EOS_SIZEOF_LONG)
+ENDIF (NOT APPLE)
+EOS_CHECK_TYPE_SIZE ("long long"    EOS_SIZEOF_LONG_LONG)
+EOS_CHECK_TYPE_SIZE (__int64        EOS_SIZEOF___INT64)
+IF (NOT EOS_SIZEOF___INT64)
+  SET (EOS_SIZEOF___INT64 0)
+ENDIF (NOT EOS_SIZEOF___INT64)
+
+EOS_CHECK_TYPE_SIZE (float          EOS_SIZEOF_FLOAT)
+EOS_CHECK_TYPE_SIZE (double         EOS_SIZEOF_DOUBLE)
+EOS_CHECK_TYPE_SIZE ("long double"  EOS_SIZEOF_LONG_DOUBLE)
+
+EOS_CHECK_TYPE_SIZE (int8_t         EOS_SIZEOF_INT8_T)
+EOS_CHECK_TYPE_SIZE (uint8_t        EOS_SIZEOF_UINT8_T)
+EOS_CHECK_TYPE_SIZE (int_least8_t   EOS_SIZEOF_INT_LEAST8_T)
+EOS_CHECK_TYPE_SIZE (uint_least8_t  EOS_SIZEOF_UINT_LEAST8_T)
+EOS_CHECK_TYPE_SIZE (int_fast8_t    EOS_SIZEOF_INT_FAST8_T)
+EOS_CHECK_TYPE_SIZE (uint_fast8_t   EOS_SIZEOF_UINT_FAST8_T)
+
+EOS_CHECK_TYPE_SIZE (int16_t        EOS_SIZEOF_INT16_T)
+EOS_CHECK_TYPE_SIZE (uint16_t       EOS_SIZEOF_UINT16_T)
+EOS_CHECK_TYPE_SIZE (int_least16_t  EOS_SIZEOF_INT_LEAST16_T)
+EOS_CHECK_TYPE_SIZE (uint_least16_t EOS_SIZEOF_UINT_LEAST16_T)
+EOS_CHECK_TYPE_SIZE (int_fast16_t   EOS_SIZEOF_INT_FAST16_T)
+EOS_CHECK_TYPE_SIZE (uint_fast16_t  EOS_SIZEOF_UINT_FAST16_T)
+
+EOS_CHECK_TYPE_SIZE (int32_t        EOS_SIZEOF_INT32_T)
+EOS_CHECK_TYPE_SIZE (uint32_t       EOS_SIZEOF_UINT32_T)
+EOS_CHECK_TYPE_SIZE (int_least32_t  EOS_SIZEOF_INT_LEAST32_T)
+EOS_CHECK_TYPE_SIZE (uint_least32_t EOS_SIZEOF_UINT_LEAST32_T)
+EOS_CHECK_TYPE_SIZE (int_fast32_t   EOS_SIZEOF_INT_FAST32_T)
+EOS_CHECK_TYPE_SIZE (uint_fast32_t  EOS_SIZEOF_UINT_FAST32_T)
+
+EOS_CHECK_TYPE_SIZE (int64_t        EOS_SIZEOF_INT64_T)
+EOS_CHECK_TYPE_SIZE (uint64_t       EOS_SIZEOF_UINT64_T)
+EOS_CHECK_TYPE_SIZE (int_least64_t  EOS_SIZEOF_INT_LEAST64_T)
+EOS_CHECK_TYPE_SIZE (uint_least64_t EOS_SIZEOF_UINT_LEAST64_T)
+EOS_CHECK_TYPE_SIZE (int_fast64_t   EOS_SIZEOF_INT_FAST64_T)
+EOS_CHECK_TYPE_SIZE (uint_fast64_t  EOS_SIZEOF_UINT_FAST64_T)
+IF (NOT APPLE)
+  EOS_CHECK_TYPE_SIZE (size_t       EOS_SIZEOF_SIZE_T)
+  EOS_CHECK_TYPE_SIZE (ssize_t      EOS_SIZEOF_SSIZE_T)
+  IF (NOT EOS_SIZEOF_SSIZE_T)
+    SET (EOS_SIZEOF_SSIZE_T 0)
+  ENDIF (NOT EOS_SIZEOF_SSIZE_T)
+ENDIF (NOT APPLE)
+EOS_CHECK_TYPE_SIZE (off_t          EOS_SIZEOF_OFF_T)
+EOS_CHECK_TYPE_SIZE (off64_t        EOS_SIZEOF_OFF64_T)
+IF (NOT EOS_SIZEOF_OFF64_T)
+  SET (EOS_SIZEOF_OFF64_T 0)
+ENDIF (NOT EOS_SIZEOF_OFF64_T)
+
+
+#-----------------------------------------------------------------------------
+# Check a bunch of other functions
+#-----------------------------------------------------------------------------
+IF (NOT WINDOWS)
+  FOREACH (test
+      STDC_HEADERS
+      HAVE_FUNCTION
+  )
+    HDFEOS_FUNCTION_TEST (${test})
+  ENDFOREACH (test)
+ENDIF (NOT WINDOWS)
diff --git a/config/cmake/EOSMacros.cmake b/config/cmake/EOSMacros.cmake
new file mode 100644
index 0000000..91b7e03
--- /dev/null
+++ b/config/cmake/EOSMacros.cmake
@@ -0,0 +1,140 @@
+#-------------------------------------------------------------------------------
+MACRO (SET_GLOBAL_VARIABLE name value)
+  SET (${name} ${value} CACHE INTERNAL "Used to pass variables between directories" FORCE)
+ENDMACRO (SET_GLOBAL_VARIABLE)
+
+#-------------------------------------------------------------------------------
+MACRO (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES)
+  #set(source_group_path "Source/AIM/${NAME}")
+  STRING (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH})
+  source_group (${source_group_path} FILES ${HEADERS} ${SOURCES})
+
+  #-- The following is needed if we ever start to use OS X Frameworks but only
+  #--  works on CMake 2.6 and greater
+  #SET_PROPERTY (SOURCE ${HEADERS}
+  #       PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME}
+  #)
+ENDMACRO (IDE_GENERATED_PROPERTIES)
+
+#-------------------------------------------------------------------------------
+MACRO (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES)
+  #  INSTALL (FILES ${HEADERS}
+  #       DESTINATION include/R3D/${NAME}
+  #       COMPONENT Headers       
+  #  )
+
+  STRING (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH}  )
+  source_group (${source_group_path} FILES ${HEADERS} ${SOURCES})
+
+  #-- The following is needed if we ever start to use OS X Frameworks but only
+  #--  works on CMake 2.6 and greater
+  #SET_PROPERTY (SOURCE ${HEADERS}
+  #       PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME}
+  #)
+ENDMACRO (IDE_SOURCE_PROPERTIES)
+
+#-------------------------------------------------------------------------------
+MACRO (TARGET_NAMING target libtype)
+  IF (WIN32)
+    IF (${libtype} MATCHES "SHARED")
+      SET_TARGET_PROPERTIES (${target} PROPERTIES OUTPUT_NAME "${target}dll")
+    ENDIF (${libtype} MATCHES "SHARED")
+  ENDIF (WIN32)
+ENDMACRO (TARGET_NAMING)
+
+#-------------------------------------------------------------------------------
+MACRO (INSTALL_TARGET_PDB target targetdestination targetcomponent)
+  IF (WIN32 AND MSVC)
+    GET_TARGET_PROPERTY (target_name ${target} RELWITHDEBINFO_OUTPUT_NAME)
+    INSTALL (
+      FILES
+          ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${target_name}.pdb
+      DESTINATION
+          ${targetdestination}
+      CONFIGURATIONS RelWithDebInfo
+      COMPONENT ${targetcomponent}
+  )
+  ENDIF (WIN32 AND MSVC)
+ENDMACRO (INSTALL_TARGET_PDB)
+
+#-------------------------------------------------------------------------------
+MACRO (INSTALL_PROGRAM_PDB target targetdestination targetcomponent)
+  IF (WIN32 AND MSVC)
+    GET_TARGET_PROPERTY (target_name ${target} RELWITHDEBINFO_OUTPUT_NAME)
+    GET_TARGET_PROPERTY (target_prefix h5dump PREFIX)
+    INSTALL (
+      FILES
+          ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${target_prefix}${target_name}.pdb
+      DESTINATION
+          ${targetdestination}
+      CONFIGURATIONS RelWithDebInfo
+      COMPONENT ${targetcomponent}
+  )
+  ENDIF (WIN32 AND MSVC)
+ENDMACRO (INSTALL_PROGRAM_PDB)
+
+#-------------------------------------------------------------------------------
+MACRO (EOS_SET_LIB_OPTIONS libtarget libname libtype)
+  # message (STATUS "${libname} libtype: ${libtype}")
+  IF (${libtype} MATCHES "SHARED")
+    IF (WIN32)
+      SET (LIB_RELEASE_NAME "${libname}")
+      SET (LIB_DEBUG_NAME "${libname}d")
+    ELSE (WIN32)
+      SET (LIB_RELEASE_NAME "${libname}")
+      SET (LIB_DEBUG_NAME "${libname}_debug")
+    ENDIF (WIN32)
+  ELSE (${libtype} MATCHES "SHARED")
+    IF (WIN32)
+      SET (LIB_RELEASE_NAME "lib${libname}")
+      SET (LIB_DEBUG_NAME "lib${libname}d")
+    ELSE (WIN32)
+      # if the generator supports configuration types or if the CMAKE_BUILD_TYPE has a value
+      IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+        SET (LIB_RELEASE_NAME "${libname}")
+        SET (LIB_DEBUG_NAME "${libname}_debug")
+      ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+        SET (LIB_RELEASE_NAME "lib${libname}")
+        SET (LIB_DEBUG_NAME "lib${libname}_debug")
+      ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+    ENDIF (WIN32)
+  ENDIF (${libtype} MATCHES "SHARED")
+  
+  SET_TARGET_PROPERTIES (${libtarget}
+      PROPERTIES
+      DEBUG_OUTPUT_NAME          ${LIB_DEBUG_NAME}
+      RELEASE_OUTPUT_NAME        ${LIB_RELEASE_NAME}
+      MINSIZEREL_OUTPUT_NAME     ${LIB_RELEASE_NAME}
+      RELWITHDEBINFO_OUTPUT_NAME ${LIB_RELEASE_NAME}
+  )
+  
+  #----- Use MSVC Naming conventions for Shared Libraries
+  IF (MINGW AND ${libtype} MATCHES "SHARED")
+    SET_TARGET_PROPERTIES (${libtarget}
+        PROPERTIES
+        IMPORT_SUFFIX ".lib"
+        IMPORT_PREFIX ""
+        PREFIX ""
+    )
+  ENDIF (MINGW AND ${libtype} MATCHES "SHARED")
+
+ENDMACRO (EOS_SET_LIB_OPTIONS)
+
+#-------------------------------------------------------------------------------
+MACRO (TARGET_FORTRAN_WIN_PROPERTIES target addlinkflags)
+  IF (WIN32 AND MSVC)
+    IF (BUILD_SHARED_LIBS)
+      SET_TARGET_PROPERTIES (${target}
+          PROPERTIES
+              COMPILE_FLAGS "/dll"
+              LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}"
+      ) 
+    ELSE (BUILD_SHARED_LIBS)
+      SET_TARGET_PROPERTIES (${target}
+          PROPERTIES
+              COMPILE_FLAGS "/MD"
+              LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}"
+      ) 
+    ENDIF (BUILD_SHARED_LIBS)
+  ENDIF (WIN32 AND MSVC)
+ENDMACRO (TARGET_FORTRAN_WIN_PROPERTIES)
diff --git a/config/cmake/EOSTests.c b/config/cmake/EOSTests.c
new file mode 100644
index 0000000..adc156a
--- /dev/null
+++ b/config/cmake/EOSTests.c
@@ -0,0 +1,512 @@
+#define SIMPLE_TEST(x) int main(){ x; return 0; }
+
+#ifdef HAVE_C99_DESIGNATED_INITIALIZER
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+extern "C"
+#  endif
+int FC_DUMMY_MAIN()
+{ return 1;}
+#endif
+#endif
+int
+main ()
+{
+
+  typedef struct
+  {
+    int x;
+    union
+    {
+      int i;
+      double d;
+    }u;
+  }di_struct_t;
+  di_struct_t x =
+  { 0,
+    { .d = 0.0}};
+  ;
+  return 0;
+}
+
+#endif
+
+#ifdef HAVE_C99_FUNC
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+ const char *fname = __func__;
+  ;
+  return 0;
+}
+
+#endif
+
+#ifdef VSNPRINTF_WORKS
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+int test_vsnprintf(const char *fmt,...)
+{
+    va_list     ap;
+    char *s = malloc(16);
+    int ret;
+
+    va_start(ap, fmt);
+    ret=vsnprintf(s,16,"%s",ap);
+    va_end(ap);
+
+    return(ret!=42 ? 1 : 0);
+}
+
+int main(void)
+{
+    return(test_vsnprintf("%s","A string that is longer than 16 characters"));
+}
+#endif
+
+
+#ifdef TIME_WITH_SYS_TIME
+/* Time with sys/time test */
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+  ;
+  return 0;
+}
+
+#endif
+
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+int main() { return 0; }
+#endif /* STDC_HEADERS */
+
+#ifdef HAVE_TM_ZONE
+
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(struct tm tm; tm.tm_zone);
+
+#endif /* HAVE_TM_ZONE */
+
+#ifdef HAVE_STRUCT_TM_TM_ZONE
+
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(struct tm tm; tm.tm_zone);
+
+#endif /* HAVE_STRUCT_TM_TM_ZONE */
+
+#ifdef HAVE_ATTRIBUTE
+
+#if 0
+static void test int __attribute((unused)) var)
+{
+  int __attribute__((unused)) x = var;
+}
+
+int main(void)
+{
+  test(19);
+}
+
+#else
+int
+main ()
+{
+int __attribute__((unused)) x
+  ;
+  return 0;
+}
+#endif
+
+
+#endif /* HAVE_ATTRIBUTE */
+
+#ifdef HAVE_FUNCTION
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+(void)__FUNCTION__
+  ;
+  return 0;
+}
+
+#endif /* HAVE_FUNCTION */
+
+#ifdef HAVE_TM_GMTOFF
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(struct tm tm; tm.tm_gmtoff=0);
+
+#endif /* HAVE_TM_GMTOFF */
+
+#ifdef HAVE___TM_GMTOFF
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(struct tm tm; tm.__tm_gmtoff=0);
+
+#endif /* HAVE_TM_GMTOFF */
+
+#ifdef HAVE_TIMEZONE
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(timezone=0);
+
+#endif /* HAVE_TIMEZONE */
+
+#ifdef HAVE_STRUCT_TIMEZONE
+
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(struct timezone tz; tz.tz_minuteswest=0);
+
+#endif /* HAVE_STRUCT_TIMEZONE */
+
+#ifdef HAVE_STAT_ST_BLOCKS
+
+#include <sys/stat.h>
+SIMPLE_TEST(struct stat sb; sb.st_blocks=0);
+
+#endif /* HAVE_STAT_ST_BLOCKS */
+
+#ifdef PRINTF_LL_WIDTH
+
+#ifdef HAVE_LONG_LONG
+#  define LL_TYPE long long
+#else /* HAVE_LONG_LONG */
+#  define LL_TYPE __int64
+#endif /* HAVE_LONG_LONG */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main(void)
+{
+  char *llwidthArgs[] = { "l64", "l", "L", "q", "ll", NULL };
+  char *s = malloc(128);
+  char **currentArg = NULL;
+  LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576;
+  for (currentArg = llwidthArgs; *currentArg != NULL; currentArg++)
+    {
+    char formatString[64];
+    sprintf(formatString, "%%%sd", *currentArg);
+    sprintf(s, formatString, x);
+    if (strcmp(s, "1099511627776") == 0)
+      {
+      printf("PRINTF_LL_WIDTH=[%s]\n", *currentArg);
+      return 0;
+      }
+    }
+  return 1;
+}
+
+#endif /* PRINTF_LL_WIDTH */
+
+#ifdef SYSTEM_SCOPE_THREADS
+#include <stdlib.h>
+#include <pthread.h>
+
+int main(void)
+{
+    pthread_attr_t attribute;
+    int ret;
+
+    pthread_attr_init(&attribute);
+    ret=pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM);
+    if (ret==0)
+        return 0;
+    return 1;
+}
+
+#endif /* SYSTEM_SCOPE_THREADS */
+
+#ifdef HAVE_SOCKLEN_T
+
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+SIMPLE_TEST(socklen_t foo);
+
+#endif /* HAVE_SOCKLEN_T */
+
+#ifdef DEV_T_IS_SCALAR
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+int main ()
+{
+  dev_t d1, d2;
+  if(d1==d2)
+    return 0;
+  return 1;
+}
+
+#endif /* DEV_T_IS_SCALAR */
+
+#ifdef HAVE_OFF64_T
+#include <sys/types.h>
+int main()
+{
+  off64_t n = 0;
+  return (int)n;
+}
+#endif
+
+#ifdef HAVE_STAT64_STRUCT
+#include <sys/types.h>
+#include <sys/stat.h>],
+struct stat64 sb;
+int main()
+{
+  return 0;
+}
+#endif
+
+#ifdef HAVE_F2CFORTRAN_MACRO
+int main(void)
+{
+#ifdef f2cFortran
+  return 0;
+#else
+  return 1;
+#endif
+}
+#endif
+
+#ifdef HAVE_F2CFORTRAN_32PTR
+int main(void)
+{
+#ifdef SIZEOF_INTP
+return SIZEOF_INTP == 4 ? 0 : 1;
+#else
+#error SIZEOF_INTP is not defined
+#endif
+}
+#endif
+
+#ifdef TEST_DIRECT_VFD_WORKS
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+int main(void)
+{
+   int fid;
+   if((fid=open("tst_file", O_CREAT | O_TRUNC | O_DIRECT, 0755))<0)
+       return 1;
+   close(fid);
+   remove("tst_file");
+   return 0;
+}
+#endif
+
+#ifdef HAVE_DIRECT
+       SIMPLE_TEST(posix_memalign());
+#endif
+
+#ifdef TEST_LFS_WORKS
+/* Return 0 when LFS is available and 1 otherwise.  */
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE
+#define _LARGE_FILES
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <assert.h>
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+  /* check that off_t can hold 2^63 - 1 and perform basic operations... */
+#define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  if (OFF_T_64 % 2147483647 != 1)
+    return 1;
+
+  /* stat breaks on SCO OpenServer */
+  struct stat buf;
+  stat( argv[0], &buf );
+  if (!S_ISREG(buf.st_mode))
+    return 2;
+
+  FILE *file = fopen( argv[0], "r" );
+  off_t offset = ftello( file );
+  fseek( file, offset, SEEK_CUR );
+  fclose( file );
+  return 0;
+}
+#endif
+
+#ifdef GETTIMEOFDAY_GIVES_TZ
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+int main(void)
+{
+ struct timeval tv;
+ struct timezone tz;
+ tz.tz_minuteswest = 7777;  /* Initialize to an unreasonable number */
+ tz.tz_dsttime = 7;
+ gettimeofday(&tv, &tz);
+    /* Check whether the function returned any value at all */
+ if(tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7)
+     return 1;
+ else return 0;
+}
+#endif
+
+#ifdef LONE_COLON
+int main(int argc, char * argv) 
+{
+  return 0;
+}
+#endif
+
+#ifdef CXX_HAVE_OFFSETOF
+
+#include <stdio.h>
+#include <stddef.h>
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+extern "C"
+#  endif
+int FC_DUMMY_MAIN()
+{ return 1;}
+#endif
+#endif
+int
+main ()
+{
+
+  struct index_st
+  {
+    unsigned char type;
+    unsigned char num;
+    unsigned int len;
+  };
+  typedef struct index_st index_t;
+  int x,y;
+  x = offsetof(struct index_st, len);
+  y = offsetof(index_t, num)
+
+  ;
+  return 0;
+}
+
+#endif
+
+#ifdef HAVE_GPFS
+
+#include <gpfs.h>
+int main ()
+{
+    int fd = 0; 
+    gpfs_fcntl(fd, (void *)0);
+}
+
+#endif /* HAVE_GPFS */
+
+#ifdef HAVE_IOEO
+
+#include <windows.h>
+typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
+int main ()
+{
+	PGNSI pGNSI;
+	pGNSI = (PGNSI) GetProcAddress(
+      GetModuleHandle(TEXT("kernel32.dll")), 
+      "InitOnceExecuteOnce");
+	if(NULL == pGNSI)
+		return 1;
+	else
+		return 0;
+}
+
+#endif /* HAVE_IOEO */
+
+#ifdef HAVE_STRUCT_VIDEOCONFIG
+
+SIMPLE_TEST(struct videoconfig w; w.numtextcols=0);
+
+#endif /* HAVE_TM_GMTOFF */
+
+#ifdef HAVE_STRUCT_TEXT_INFO
+
+SIMPLE_TEST(struct text_info w; w.screenwidth=0);
+
+#endif /* HAVE_TM_GMTOFF */
+
+
+#if defined( INLINE_TEST_inline ) || defined( INLINE_TEST___inline__ ) || defined( INLINE_TEST___inline )
+#ifndef __cplusplus
+typedef int foo_t;
+static INLINE_TEST_INLINE foo_t static_foo () { return 0; }
+INLINE_TEST_INLINE foo_t foo () {return 0; }
+int main() { return 0; }
+#endif
+
+#endif /* INLINE_TEST */
diff --git a/config/cmake/FindHDF5.cmake b/config/cmake/FindHDF5.cmake
new file mode 100644
index 0000000..142d64e
--- /dev/null
+++ b/config/cmake/FindHDF5.cmake
@@ -0,0 +1,85 @@
+#
+# To be used by projects that make use of Cmakeified hdf5-1.8
+#
+
+#
+# Find the HDF5 includes and get all installed hdf5 library settings from
+# HDF5-config.cmake file : Requires a CMake compatible hdf5-1.8.5 or later 
+# for this feature to work. The following vars are set if hdf5 is found.
+#
+# HDF5_FOUND               - True if found, otherwise all other vars are undefined
+# HDF5_INCLUDE_DIR         - The include dir for main *.h files
+# HDF5_FORTRAN_INCLUDE_DIR - The include dir for fortran modules and headers
+# HDF5_VERSION_STRING      - full version (e.g. 1.8.5)
+# HDF5_VERSION_MAJOR       - major part of version (e.g. 1.8)
+# HDF5_VERSION_MINOR       - minor part (e.g. 5)
+# 
+# The following boolean vars will be defined
+# HDF5_ENABLE_PARALLEL  - 1 if HDF5 parallel supported
+# HDF5_BUILD_FORTRAN    - 1 if HDF5 was compiled with fortran on
+# HDF5_BUILD_CPP_LIB    - 1 if HDF5 was compiled with cpp on
+# HDF5_BUILD_TOOLS      - 1 if HDF5 was compiled with tools on
+# HDF5_BUILD_HL_LIB     - 1 if HDF5 was compiled with high level on
+# HDF5_BUILD_HL_CPP_LIB - 1 if HDF5 was compiled with high level and cpp on
+# 
+# Target names that are valid (depending on enabled options)
+# will be the following
+#
+# hdf5              : HDF5 C library
+# hdf5_tools        : the tools library
+# hdf5_f90cstub     : used by Fortran to C interface
+# hdf5_fortran      : Fortran HDF5 library
+# hdf5_cpp          : HDF5 cpp interface library
+# hdf5_hl           : High Level library
+# hdf5_hl_f90cstub  : used by Fortran to C interface to High Level library
+# hdf5_hl_fortran   : Fortran High Level library
+# hdf5_hl_cpp       : High Level cpp interface library
+# 
+# To aid in finding HDF5 as part of a subproject set
+# HDF5_ROOT_DIR_HINT to the location where hdf5-config.cmake lies
+
+INCLUDE (SelectLibraryConfigurations)
+INCLUDE (FindPackageHandleStandardArgs)
+
+# The HINTS option should only be used for values computed from the system.
+SET (_HDF5_HINTS
+    $ENV{HOME}/.local
+    $ENV{HDF5_ROOT}
+    $ENV{HDF5_ROOT_DIR_HINT}
+)
+# Hard-coded guesses should still go in PATHS. This ensures that the user
+# environment can always override hard guesses.
+SET (_HDF5_PATHS
+    $ENV{HOME}/.local
+    $ENV{HDF5_ROOT}
+    $ENV{HDF5_ROOT_DIR_HINT}
+    /usr/lib/hdf5
+    /usr/share/hdf5
+    /usr/local/hdf5
+    /usr/local/hdf5/share
+)
+
+FIND_PATH (HDF5_ROOT_DIR "hdf5-config.cmake"
+    HINTS ${_HDF5_HINTS}
+    PATHS ${_HDF5_PATHS}
+    PATH_SUFFIXES
+        lib/cmake/hdf5
+        share/cmake/hdf5
+)
+
+FIND_PATH (HDF5_INCLUDE_DIRS "H5public.h"
+    HINTS ${_HDF5_HINTS}
+    PATHS ${_HDF5_PATHS}
+    PATH_SUFFIXES
+        include
+        Include
+)
+
+# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of
+# HDF5_INCLUDE_DIRS
+SET ( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" )
+
+IF (HDF5_INCLUDE_DIR)
+  SET (HDF5_FOUND "YES")
+  INCLUDE (${HDF5_ROOT_DIR}/hdf5-config.cmake)
+ENDIF (HDF5_INCLUDE_DIR)
diff --git a/config/cmake/FindHDFEOS5.cmake.in b/config/cmake/FindHDFEOS5.cmake.in
new file mode 100644
index 0000000..8ca4080
--- /dev/null
+++ b/config/cmake/FindHDFEOS5.cmake.in
@@ -0,0 +1,77 @@
+#
+# To be used by projects that make use of CMakeified hdfeos tools @HDFEOS5_PACKAGE_VERSION@
+#
+
+#
+# Find the HDFEOS5 includes and get all installed HDFEOS5 library settings from
+# hdfeos-config.cmake file : Requires a CMake compatible HDFEOS5-2.19 or later 
+# for this feature to work. The following vars are set if HDFEOS5 is found.
+#
+# HDFEOS5_FOUND               - True if found, otherwise all other vars are undefined
+# HDFEOS5_INCLUDE_DIR         - The include dir for main *.h files
+# HDFEOS5_VERSION_STRING      - full version (e.g. @HDFEOS5_PACKAGE_VERSION@)
+# HDFEOS5_VERSION_MAJOR       - major part of version (e.g. @HDFEOS5_PACKAGE_VERSION_MAJOR@)
+# HDFEOS5_VERSION_MINOR       - minor part (e.g. @HDFEOS5_PACKAGE_VERSION_MINOR@)
+# 
+# The following boolean vars will be defined
+# HDFEOS5_ENABLE_PARALLEL - 1 if HDFEOS5 parallel supported
+# HDFEOS5_BUILD_TOOLS     - 1 if HDFEOS5 was compiled with tools on
+# 
+# Target names that are valid (depending on enabled options)
+# will be the following
+#
+# HDFEOS5              : HDFEOS5 C library
+# HDFEOS5_tools        : the tools library
+# 
+# To aid in finding HDFEOS5 as part of a subproject set
+# HDFEOS5_ROOT_DIR_HINT to the location where @HDFEOS5_PACKAGE@@HDFEOS5_PACKAGE_EXT at -config.cmake lies
+
+INCLUDE (SelectLibraryConfigurations)
+INCLUDE (FindPackageHandleStandardArgs)
+
+# The HINTS option should only be used for values computed from the system.
+SET (_HDFEOS5_HINTS
+    $ENV{HOME}/.local
+    $ENV{HDFEOS5_ROOT}
+    $ENV{HDFEOS5_ROOT_DIR_HINT}
+)
+# Hard-coded guesses should still go in PATHS. This ensures that the user
+# environment can always override hard guesses.
+SET (_HDFEOS5_PATHS
+    $ENV{HOME}/.local
+    $ENV{HDFEOS5_ROOT}
+    $ENV{HDFEOS5_ROOT_DIR_HINT}
+    /usr/lib/@HDFEOS5_PACKAGE@
+    /usr/share/@HDFEOS5_PACKAGE@
+    /usr/local/@HDFEOS5_PACKAGE@
+    /usr/local/@HDFEOS5_PACKAGE@/share
+)
+
+FIND_PATH (HDFEOS5_ROOT_DIR "@HDFEOS5_PACKAGE@@HDFEOS5_PACKAGE_EXT at -config.cmake"
+    HINTS ${_HDFEOS5_HINTS}
+    PATHS ${_HDFEOS5_PATHS}
+    PATH_SUFFIXES
+        cmake/@HDFEOS5_PACKAGE@
+        lib/cmake/@HDFEOS5_PACKAGE@
+        share/cmake/@HDFEOS5_PACKAGE@
+)
+
+MESSAGE(STATUS "HDFEOS5_ROOT_DIR is ${HDFEOS5_ROOT_DIR}")
+FIND_PATH (HDFEOS5_INCLUDE_DIRS "HDFEOS5Version.h"
+    HINTS ${_HDFEOS5_HINTS}
+    PATHS ${_HDFEOS5_PATHS}
+    PATH_SUFFIXES
+        include
+        Include
+)
+MESSAGE(STATUS "HDFEOS5_INCLUDE_DIRS is ${HDFEOS5_INCLUDE_DIRS}")
+
+# For backwards compatibility we set HDFEOS5_INCLUDE_DIR to the value of
+# HDFEOS5_INCLUDE_DIRS
+SET ( HDFEOS5_INCLUDE_DIR "${HDFEOS5_INCLUDE_DIRS}" )
+
+IF (HDFEOS5_INCLUDE_DIR)
+  SET (HDFEOS5_FOUND "YES")
+  INCLUDE (${HDFEOS5_ROOT_DIR}/@HDFEOS5_PACKAGE@@HDFEOS5_PACKAGE_EXT at -config.cmake)
+  MESSAGE(STATUS "HDFEOS5_FOUND is ${HDFEOS5_FOUND}")
+ENDIF (HDFEOS5_INCLUDE_DIR)
diff --git a/config/cmake/FindMPI.cmake b/config/cmake/FindMPI.cmake
new file mode 100644
index 0000000..b16c9c3
--- /dev/null
+++ b/config/cmake/FindMPI.cmake
@@ -0,0 +1,628 @@
+# - Find a Message Passing Interface (MPI) implementation
+# The Message Passing Interface (MPI) is a library used to write
+# high-performance distributed-memory parallel applications, and
+# is typically deployed on a cluster. MPI is a standard interface
+# (defined by the MPI forum) for which many implementations are
+# available. All of them have somewhat different include paths,
+# libraries to link against, etc., and this module tries to smooth
+# out those differences.
+#
+# === Variables ===
+#
+# This module will set the following variables per language in your project,
+# where <lang> is one of C, CXX, or Fortran:
+#   MPI_<lang>_FOUND           TRUE if FindMPI found MPI flags for <lang>
+#   MPI_<lang>_COMPILER        MPI Compiler wrapper for <lang>
+#   MPI_<lang>_COMPILE_FLAGS   Compilation flags for MPI programs
+#   MPI_<lang>_INCLUDE_PATH    Include path(s) for MPI header
+#   MPI_<lang>_LINK_FLAGS      Linking flags for MPI programs
+#   MPI_<lang>_LIBRARIES       All libraries to link MPI programs against
+# Additionally, FindMPI sets the following variables for running MPI
+# programs from the command line:
+#   MPIEXEC                    Executable for running MPI programs
+#   MPIEXEC_NUMPROC_FLAG       Flag to pass to MPIEXEC before giving
+#                              it the number of processors to run on
+#   MPIEXEC_PREFLAGS           Flags to pass to MPIEXEC directly
+#                              before the executable to run.
+#   MPIEXEC_POSTFLAGS          Flags to pass to MPIEXEC after other flags
+# === Usage ===
+#
+# To use this module, simply call FindMPI from a CMakeLists.txt file, or
+# run find_package(MPI), then run CMake.  If you are happy with the auto-
+# detected configuration for your language, then you're done.  If not, you
+# have two options:
+#   1. Set MPI_<lang>_COMPILER to the MPI wrapper (mpicc, etc.) of your
+#      choice and reconfigure.  FindMPI will attempt to determine all the
+#      necessary variables using THAT compiler's compile and link flags.
+#   2. If this fails, or if your MPI implementation does not come with
+#      a compiler wrapper, then set both MPI_<lang>_LIBRARIES and
+#      MPI_<lang>_INCLUDE_PATH.  You may also set any other variables
+#      listed above, but these two are required.  This will circumvent
+#      autodetection entirely.
+# When configuration is successful, MPI_<lang>_COMPILER will be set to the
+# compiler wrapper for <lang>, if it was found.  MPI_<lang>_FOUND and other
+# variables above will be set if any MPI implementation was found for <lang>,
+# regardless of whether a compiler was found.
+#
+# When using MPIEXEC to execute MPI applications, you should typically use
+# all of the MPIEXEC flags as follows:
+#   ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS
+#     ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS
+# where PROCS is the number of processors on which to execute the program,
+# EXECUTABLE is the MPI program, and ARGS are the arguments to pass to the
+# MPI program.
+#
+# === Backward Compatibility ===
+#
+# For backward compatibility with older versions of FindMPI, these
+# variables are set, but deprecated:
+#   MPI_FOUND           MPI_COMPILER        MPI_LIBRARY
+#   MPI_COMPILE_FLAGS   MPI_INCLUDE_PATH    MPI_EXTRA_LIBRARY
+#   MPI_LINK_FLAGS      MPI_LIBRARIES
+# In new projects, please use the MPI_<lang>_XXX equivalents.
+
+#=============================================================================
+# Copyright 2001-2011 Kitware, Inc.
+# Copyright 2010-2011 Todd Gamblin tgamblin at llnl.gov
+# Copyright 2001-2009 Dave Partyka
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+# include this to handle the QUIETLY and REQUIRED arguments
+include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
+include(GetPrerequisites)
+
+#
+# This part detects MPI compilers, attempting to wade through the mess of compiler names in
+# a sensible way.
+#
+# The compilers are detected in this order:
+#
+# 1. Try to find the most generic availble MPI compiler, as this is usually set up by
+#    cluster admins.  e.g., if plain old mpicc is available, we'll use it and assume it's
+#    the right compiler.
+#
+# 2. If a generic mpicc is NOT found, then we attempt to find one that matches
+#    CMAKE_<lang>_COMPILER_ID. e.g. if you are using XL compilers, we'll try to find mpixlc
+#    and company, but not mpiicc.  This hopefully prevents toolchain mismatches.
+#
+# If you want to force a particular MPI compiler other than what we autodetect (e.g. if you
+# want to compile regular stuff with GNU and parallel stuff with Intel), you can always set
+# your favorite MPI_<lang>_COMPILER explicitly and this stuff will be ignored.
+#
+
+# Start out with the generic MPI compiler names, as these are most commonly used.
+set(_MPI_C_COMPILER_NAMES                  mpicc    mpcc      mpicc_r mpcc_r)
+set(_MPI_CXX_COMPILER_NAMES                mpicxx   mpiCC     mpcxx   mpCC    mpic++   mpc++
+                                           mpicxx_r mpiCC_r   mpcxx_r mpCC_r  mpic++_r mpc++_r)
+set(_MPI_Fortran_COMPILER_NAMES            mpif95   mpif95_r  mpf95   mpf95_r
+                                           mpif90   mpif90_r  mpf90   mpf90_r
+                                           mpif77   mpif77_r  mpf77   mpf77_r)
+
+# GNU compiler names
+set(_MPI_GNU_C_COMPILER_NAMES              mpigcc mpgcc mpigcc_r mpgcc_r)
+set(_MPI_GNU_CXX_COMPILER_NAMES            mpig++ mpg++ mpig++_r mpg++_r)
+set(_MPI_GNU_Fortran_COMPILER_NAMES        mpigfortran mpgfortran mpigfortran_r mpgfortran_r
+                                           mpig77 mpig77_r mpg77 mpg77_r)
+
+# Intel MPI compiler names
+set(_MPI_Intel_C_COMPILER_NAMES            mpiicc)
+set(_MPI_Intel_CXX_COMPILER_NAMES          mpiicpc  mpiicxx mpiic++ mpiiCC)
+set(_MPI_Intel_Fortran_COMPILER_NAMES      mpiifort mpiif95 mpiif90 mpiif77)
+
+# PGI compiler names
+set(_MPI_PGI_C_COMPILER_NAMES              mpipgcc mppgcc)
+set(_MPI_PGI_CXX_COMPILER_NAMES            mpipgCC mppgCC)
+set(_MPI_PGI_Fortran_COMPILER_NAMES        mpipgf95 mpipgf90 mppgf95 mppgf90 mpipgf77 mppgf77)
+
+# XLC MPI Compiler names
+set(_MPI_XL_C_COMPILER_NAMES               mpxlc      mpxlc_r    mpixlc     mpixlc_r)
+set(_MPI_XL_CXX_COMPILER_NAMES             mpixlcxx   mpixlC     mpixlc++   mpxlcxx   mpxlc++   mpixlc++   mpxlCC
+                                           mpixlcxx_r mpixlC_r   mpixlc++_r mpxlcxx_r mpxlc++_r mpixlc++_r mpxlCC_r)
+set(_MPI_XL_Fortran_COMPILER_NAMES         mpixlf95   mpixlf95_r mpxlf95 mpxlf95_r
+                                           mpixlf90   mpixlf90_r mpxlf90 mpxlf90_r
+                                           mpixlf77   mpixlf77_r mpxlf77 mpxlf77_r
+                                           mpixlf     mpixlf_r   mpxlf   mpxlf_r)
+
+# append vendor-specific compilers to the list if we either don't know the compiler id,
+# or if we know it matches the regular compiler.
+foreach (lang C CXX Fortran)
+  foreach (id GNU Intel PGI XL)
+    if (NOT CMAKE_${lang}_COMPILER_ID OR "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "${id}")
+      list(APPEND _MPI_${lang}_COMPILER_NAMES ${_MPI_${id}_${lang}_COMPILER_NAMES})
+    endif()
+    unset(_MPI_${id}_${lang}_COMPILER_NAMES)    # clean up the namespace here
+  endforeach()
+endforeach()
+
+
+# Names to try for MPI exec
+set(_MPI_EXEC_NAMES                        mpiexec mpirun lamexec srun)
+
+# Grab the path to MPI from the registry if we're on windows.
+set(_MPI_PREFIX_PATH)
+if(WIN32)
+  list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/..")
+  list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]")
+  list(APPEND _MPI_PREFIX_PATH "$ENV{ProgramW6432}/MPICH2/")
+endif()
+
+# Build a list of prefixes to search for MPI.
+foreach(SystemPrefixDir ${CMAKE_SYSTEM_PREFIX_PATH})
+  foreach(MpiPackageDir ${_MPI_PREFIX_PATH})
+    if(EXISTS ${SystemPrefixDir}/${MpiPackageDir})
+      list(APPEND _MPI_PREFIX_PATH "${SystemPrefixDir}/${MpiPackageDir}")
+    endif()
+  endforeach()
+endforeach()
+
+
+#
+# interrogate_mpi_compiler(lang try_libs)
+#
+# Attempts to extract compiler and linker args from an MPI compiler. The arguments set
+# by this function are:
+#
+#   MPI_<lang>_INCLUDE_PATH    MPI_<lang>_LINK_FLAGS     MPI_<lang>_FOUND
+#   MPI_<lang>_COMPILE_FLAGS   MPI_<lang>_LIBRARIES
+#
+# MPI_<lang>_COMPILER must be set beforehand to the absolute path to an MPI compiler for
+# <lang>.  Additionally, MPI_<lang>_INCLUDE_PATH and MPI_<lang>_LIBRARIES may be set
+# to skip autodetection.
+#
+# If try_libs is TRUE, this will also attempt to find plain MPI libraries in the usual
+# way.  In general, this is not as effective as interrogating the compilers, as it
+# ignores language-specific flags and libraries.  However, some MPI implementations
+# (Windows implementations) do not have compiler wrappers, so this approach must be used.
+#
+function (interrogate_mpi_compiler lang try_libs)
+  # MPI_${lang}_NO_INTERROGATE will be set to a compiler name when the *regular* compiler was
+  # discovered to be the MPI compiler.  This happens on machines like the Cray XE6 that use
+  # modules to set cc, CC, and ftn to the MPI compilers.  If the user force-sets another MPI
+  # compiler, MPI_${lang}_COMPILER won't be equal to MPI_${lang}_NO_INTERROGATE, and we'll
+  # inspect that compiler anew.  This allows users to set new compilers w/o rm'ing cache.
+  string(COMPARE NOTEQUAL "${MPI_${lang}_NO_INTERROGATE}" "${MPI_${lang}_COMPILER}" interrogate)
+
+  # If MPI is set already in the cache, don't bother with interrogating the compiler.
+  if (interrogate AND ((NOT MPI_${lang}_INCLUDE_PATH) OR (NOT MPI_${lang}_LIBRARIES)))
+    if (MPI_${lang}_COMPILER)
+      # Check whether the -showme:compile option works. This indicates that we have either OpenMPI
+      # or a newer version of LAM-MPI, and implies that -showme:link will also work.
+      execute_process(
+        COMMAND ${MPI_${lang}_COMPILER} -showme:compile
+        OUTPUT_VARIABLE  MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+        ERROR_VARIABLE   MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+        RESULT_VARIABLE  MPI_COMPILER_RETURN)
+
+      if (MPI_COMPILER_RETURN EQUAL 0)
+        # If we appear to have -showme:compile, then we should
+        # also have -showme:link. Try it.
+        execute_process(
+          COMMAND ${MPI_${lang}_COMPILER} -showme:link
+          OUTPUT_VARIABLE  MPI_LINK_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+          ERROR_VARIABLE   MPI_LINK_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+          RESULT_VARIABLE  MPI_COMPILER_RETURN)
+
+        if (MPI_COMPILER_RETURN EQUAL 0)
+          # We probably have -showme:incdirs and -showme:libdirs as well,
+          # so grab that while we're at it.
+          execute_process(
+            COMMAND ${MPI_${lang}_COMPILER} -showme:incdirs
+            OUTPUT_VARIABLE  MPI_INCDIRS OUTPUT_STRIP_TRAILING_WHITESPACE
+            ERROR_VARIABLE   MPI_INCDIRS ERROR_STRIP_TRAILING_WHITESPACE)
+
+          execute_process(
+            COMMAND ${MPI_${lang}_COMPILER} -showme:libdirs
+            OUTPUT_VARIABLE  MPI_LIBDIRS OUTPUT_STRIP_TRAILING_WHITESPACE
+            ERROR_VARIABLE   MPI_LIBDIRS ERROR_STRIP_TRAILING_WHITESPACE)
+
+        else()
+          # reset things here if something went wrong.
+          set(MPI_COMPILE_CMDLINE)
+          set(MPI_LINK_CMDLINE)
+        endif()
+      endif ()
+
+      # Older versions of LAM-MPI have "-showme". Try to find that.
+      if (NOT MPI_COMPILER_RETURN EQUAL 0)
+        execute_process(
+          COMMAND ${MPI_${lang}_COMPILER} -showme
+          OUTPUT_VARIABLE  MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+          ERROR_VARIABLE   MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+          RESULT_VARIABLE  MPI_COMPILER_RETURN)
+      endif()
+
+      # MVAPICH uses -compile-info and -link-info.  Try them.
+      if (NOT MPI_COMPILER_RETURN EQUAL 0)
+        execute_process(
+          COMMAND ${MPI_${lang}_COMPILER} -compile-info
+          OUTPUT_VARIABLE  MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+          ERROR_VARIABLE   MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+          RESULT_VARIABLE  MPI_COMPILER_RETURN)
+
+        # If we have compile-info, also have link-info.
+        if (MPI_COMPILER_RETURN EQUAL 0)
+          execute_process(
+            COMMAND ${MPI_${lang}_COMPILER} -link-info
+            OUTPUT_VARIABLE  MPI_LINK_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+            ERROR_VARIABLE   MPI_LINK_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+            RESULT_VARIABLE  MPI_COMPILER_RETURN)
+        endif()
+
+        # make sure we got compile and link.  Reset vars if something's wrong.
+        if (NOT MPI_COMPILER_RETURN EQUAL 0)
+          set(MPI_COMPILE_CMDLINE)
+          set(MPI_LINK_CMDLINE)
+        endif()
+      endif()
+
+      # MPICH just uses "-show". Try it.
+      if (NOT MPI_COMPILER_RETURN EQUAL 0)
+        execute_process(
+          COMMAND ${MPI_${lang}_COMPILER} -show
+          OUTPUT_VARIABLE  MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+          ERROR_VARIABLE   MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+          RESULT_VARIABLE  MPI_COMPILER_RETURN)
+      endif()
+
+      if (MPI_COMPILER_RETURN EQUAL 0)
+        # We have our command lines, but we might need to copy MPI_COMPILE_CMDLINE
+        # into MPI_LINK_CMDLINE, if we didn't find the link line.
+        if (NOT MPI_LINK_CMDLINE)
+          set(MPI_LINK_CMDLINE ${MPI_COMPILE_CMDLINE})
+        endif()
+      else()
+        message(STATUS "Unable to determine MPI from MPI driver ${MPI_${lang}_COMPILER}")
+        set(MPI_COMPILE_CMDLINE)
+        set(MPI_LINK_CMDLINE)
+      endif()
+
+      # Here, we're done with the interrogation part, and we'll try to extract args we care
+      # about from what we learned from the compiler wrapper scripts.
+
+      # If interrogation came back with something, extract our variable from the MPI command line
+      if (MPI_COMPILE_CMDLINE OR MPI_LINK_CMDLINE)
+        # Extract compile flags from the compile command line.
+        string(REGEX MATCHALL "(^| )-[Df]([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}")
+        set(MPI_COMPILE_FLAGS_WORK)
+
+        foreach(FLAG ${MPI_ALL_COMPILE_FLAGS})
+          if (MPI_COMPILE_FLAGS_WORK)
+            set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}")
+          else()
+            set(MPI_COMPILE_FLAGS_WORK ${FLAG})
+          endif()
+        endforeach()
+
+        # Extract include paths from compile command line
+        string(REGEX MATCHALL "(^| )-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
+        foreach(IPATH ${MPI_ALL_INCLUDE_PATHS})
+          string(REGEX REPLACE "^ ?-I" "" IPATH ${IPATH})
+          string(REGEX REPLACE "//" "/" IPATH ${IPATH})
+          list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
+        endforeach()
+
+        # try using showme:incdirs if extracting didn't work.
+        if (NOT MPI_INCLUDE_PATH_WORK)
+          set(MPI_INCLUDE_PATH_WORK ${MPI_INCDIRS})
+          separate_arguments(MPI_INCLUDE_PATH_WORK)
+        endif()
+
+        # If all else fails, just search for mpi.h in the normal include paths.
+        if (NOT MPI_INCLUDE_PATH_WORK)
+          set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+          find_path(MPI_HEADER_PATH mpi.h
+            HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+            PATH_SUFFIXES include)
+          set(MPI_INCLUDE_PATH_WORK ${MPI_HEADER_PATH})
+        endif()
+
+        # Extract linker paths from the link command line
+        string(REGEX MATCHALL "(^| |-Wl,)-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}")
+        set(MPI_LINK_PATH)
+        foreach(LPATH ${MPI_ALL_LINK_PATHS})
+          string(REGEX REPLACE "^(| |-Wl,)-L" "" LPATH ${LPATH})
+          string(REGEX REPLACE "//" "/" LPATH ${LPATH})
+          list(APPEND MPI_LINK_PATH ${LPATH})
+        endforeach()
+
+        # try using showme:libdirs if extracting didn't work.
+        if (NOT MPI_LINK_PATH)
+          set(MPI_LINK_PATH ${MPI_LIBDIRS})
+          separate_arguments(MPI_LINK_PATH)
+        endif()
+
+        # Extract linker flags from the link command line
+        string(REGEX MATCHALL "(^| )-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
+        set(MPI_LINK_FLAGS_WORK)
+        foreach(FLAG ${MPI_ALL_LINK_FLAGS})
+          if (MPI_LINK_FLAGS_WORK)
+            set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}")
+          else()
+            set(MPI_LINK_FLAGS_WORK ${FLAG})
+          endif()
+        endforeach()
+
+        # Extract the set of libraries to link against from the link command
+        # line
+        string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
+
+        # Determine full path names for all of the libraries that one needs
+        # to link against in an MPI program
+        foreach(LIB ${MPI_LIBNAMES})
+          string(REGEX REPLACE "^ ?-l" "" LIB ${LIB})
+          # MPI_LIB is cached by find_library, but we don't want that.  Clear it first.
+          set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+          find_library(MPI_LIB NAMES ${LIB} HINTS ${MPI_LINK_PATH})
+
+          if (MPI_LIB)
+            list(APPEND MPI_LIBRARIES_WORK ${MPI_LIB})
+          elseif (NOT MPI_FIND_QUIETLY)
+            message(WARNING "Unable to find MPI library ${LIB}")
+          endif()
+        endforeach()
+
+        # Sanity check MPI_LIBRARIES to make sure there are enough libraries
+        list(LENGTH MPI_LIBRARIES_WORK MPI_NUMLIBS)
+        list(LENGTH MPI_LIBNAMES MPI_NUMLIBS_EXPECTED)
+        if (NOT MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
+          set(MPI_LIBRARIES_WORK "MPI_${lang}_LIBRARIES-NOTFOUND")
+        endif()
+      endif()
+
+    elseif(try_libs)
+      # If we didn't have an MPI compiler script to interrogate, attempt to find everything
+      # with plain old find functions.  This is nasty because MPI implementations have LOTS of
+      # different library names, so this section isn't going to be very generic.  We need to
+      # make sure it works for MS MPI, though, since there are no compiler wrappers for that.
+      find_path(MPI_HEADER_PATH mpi.h
+        HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+        PATH_SUFFIXES include Inc)
+      set(MPI_INCLUDE_PATH_WORK ${MPI_HEADER_PATH})
+
+      # Decide between 32-bit and 64-bit libraries for Microsoft's MPI
+      if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
+        set(MS_MPI_ARCH_DIR amd64)
+      else()
+        set(MS_MPI_ARCH_DIR i386)
+      endif()
+
+      set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+      find_library(MPI_LIB
+        NAMES         mpi mpich mpich2 msmpi
+        HINTS         ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+        PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR})
+      set(MPI_LIBRARIES_WORK ${MPI_LIB})
+
+      # Right now, we only know about the extra libs for C++.
+      # We could add Fortran here (as there is usually libfmpich, etc.), but
+      # this really only has to work with MS MPI on Windows.
+      # Assume that other MPI's are covered by the compiler wrappers.
+      if (${lang} STREQUAL CXX)
+        set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+        find_library(MPI_LIB
+          NAMES         mpi++ mpicxx cxx mpi_cxx
+          HINTS         ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+          PATH_SUFFIXES lib)
+        if (MPI_LIBRARIES_WORK AND MPI_LIB)
+          set(MPI_LIBRARIES_WORK ${MPI_LIBRARIES_WORK} ${MPI_LIB})
+        endif()
+      endif()
+
+      if (${lang} STREQUAL Fortran)
+        set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+        find_library(MPI_LIB
+          NAMES         fmpi fmpich fmpich2 fmpich2g
+          HINTS         ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+          PATH_SUFFIXES lib)
+        if (MPI_LIBRARIES_WORK AND MPI_LIB)
+          set(MPI_LIBRARIES_WORK ${MPI_LIBRARIES_WORK} ${MPI_LIB})
+        endif()
+      endif()
+
+      if (NOT MPI_LIBRARIES_WORK)
+        set(MPI_LIBRARIES_WORK "MPI_${lang}_LIBRARIES-NOTFOUND")
+      endif()
+    endif()
+
+    # If we found MPI, set up all of the appropriate cache entries
+    set(MPI_${lang}_COMPILE_FLAGS ${MPI_COMPILE_FLAGS_WORK} CACHE STRING "MPI ${lang} compilation flags"         FORCE)
+    set(MPI_${lang}_INCLUDE_PATH  ${MPI_INCLUDE_PATH_WORK}  CACHE STRING "MPI ${lang} include path"              FORCE)
+    set(MPI_${lang}_LINK_FLAGS    ${MPI_LINK_FLAGS_WORK}    CACHE STRING "MPI ${lang} linking flags"             FORCE)
+    set(MPI_${lang}_LIBRARIES     ${MPI_LIBRARIES_WORK}     CACHE STRING "MPI ${lang} libraries to link against" FORCE)
+    mark_as_advanced(MPI_${lang}_COMPILE_FLAGS MPI_${lang}_INCLUDE_PATH MPI_${lang}_LINK_FLAGS MPI_${lang}_LIBRARIES)
+
+    # clear out our temporary lib/header detectionv variable here.
+    set(MPI_LIB         "MPI_LIB-NOTFOUND"         CACHE INTERNAL "Scratch variable for MPI lib detection"    FORCE)
+    set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI header detection" FORCE)
+  endif()
+
+  # finally set a found variable for each MPI language
+  if (MPI_${lang}_INCLUDE_PATH AND MPI_${lang}_LIBRARIES)
+    set(MPI_${lang}_FOUND TRUE PARENT_SCOPE)
+  else()
+    set(MPI_${lang}_FOUND FALSE PARENT_SCOPE)
+  endif()
+endfunction()
+
+
+# This function attempts to compile with the regular compiler, to see if MPI programs
+# work with it.  This is a last ditch attempt after we've tried interrogating mpicc and
+# friends, and after we've tried to find generic libraries.  Works on machines like
+# Cray XE6, where the modules environment changes what MPI version cc, CC, and ftn use.
+function(try_regular_compiler lang success)
+  set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
+  if (${lang} STREQUAL Fortran)
+    set(test_file ${scratch_directory}/cmake_mpi_test.f90)
+    file(WRITE ${test_file}
+      "program hello\n"
+      "include 'mpif.h'\n"
+      "integer ierror\n"
+      "call MPI_INIT(ierror)\n"
+      "call MPI_FINALIZE(ierror)\n"
+      "end\n")
+  else()
+    if (${lang} STREQUAL CXX)
+      set(test_file ${scratch_directory}/cmake_mpi_test.cpp)
+    else()
+      set(test_file ${scratch_directory}/cmake_mpi_test.c)
+    endif()
+    file(WRITE ${test_file}
+      "#include <mpi.h>\n"
+      "int main(int argc, char **argv) {\n"
+      "  MPI_Init(&argc, &argv);\n"
+      "  MPI_Finalize();\n"
+      "}\n")
+  endif()
+  try_compile(compiler_has_mpi ${scratch_directory} ${test_file})
+  if (compiler_has_mpi)
+    set(MPI_${lang}_NO_INTERROGATE ${CMAKE_${lang}_COMPILER} CACHE STRING "Whether to interrogate MPI ${lang} compiler" FORCE)
+    set(MPI_${lang}_COMPILER       ${CMAKE_${lang}_COMPILER} CACHE STRING "MPI ${lang} compiler"                        FORCE)
+    set(MPI_${lang}_COMPILE_FLAGS  ""                        CACHE STRING "MPI ${lang} compilation flags"               FORCE)
+    set(MPI_${lang}_INCLUDE_PATH   ""                        CACHE STRING "MPI ${lang} include path"                    FORCE)
+    set(MPI_${lang}_LINK_FLAGS     ""                        CACHE STRING "MPI ${lang} linking flags"                   FORCE)
+    set(MPI_${lang}_LIBRARIES      ""                        CACHE STRING "MPI ${lang} libraries to link against"       FORCE)
+  endif()
+  set(${success} ${compiler_has_mpi} PARENT_SCOPE)
+  unset(compiler_has_mpi CACHE)
+endfunction()
+
+# End definitions, commence real work here.
+
+# Most mpi distros have some form of mpiexec which gives us something we can reliably look for.
+find_program(MPIEXEC
+  NAMES ${_MPI_EXEC_NAMES}
+  PATHS ${_MPI_PREFIX_PATH}
+  PATH_SUFFIXES bin
+  DOC "Executable for running MPI programs.")
+
+# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin).
+# This gives us a fairly reliable base directory to search for /bin /lib and /include from.
+get_filename_component(_MPI_BASE_DIR "${MPIEXEC}" PATH)
+get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH)
+
+set(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes.")
+set(MPIEXEC_PREFLAGS     ""    CACHE STRING "These flags will be directly before the executable that is being run by MPIEXEC.")
+set(MPIEXEC_POSTFLAGS    ""    CACHE STRING "These flags will come after all flags given to MPIEXEC.")
+set(MPIEXEC_MAX_NUMPROCS "2"   CACHE STRING "Maximum number of processors available to run MPI applications.")
+mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS)
+
+
+#=============================================================================
+# Backward compatibility input hacks.  Propagate the FindMPI hints to C and
+# CXX if the respective new versions are not defined.  Translate the old
+# MPI_LIBRARY and MPI_EXTRA_LIBRARY to respective MPI_${lang}_LIBRARIES.
+#
+# Once we find the new variables, we translate them back into their old
+# equivalents below.
+foreach (lang C CXX)
+  # Old input variables.
+  set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS)
+
+  # Set new vars based on their old equivalents, if the new versions are not already set.
+  foreach (var ${_MPI_OLD_INPUT_VARS})
+    if (NOT MPI_${lang}_${var} AND MPI_${var})
+      set(MPI_${lang}_${var} "${MPI_${var}}")
+    endif()
+  endforeach()
+
+  # Special handling for MPI_LIBRARY and MPI_EXTRA_LIBRARY, which we nixed in the
+  # new FindMPI.  These need to be merged into MPI_<lang>_LIBRARIES
+  if (NOT MPI_${lang}_LIBRARIES AND (MPI_LIBRARY OR MPI_EXTRA_LIBRARY))
+    set(MPI_${lang}_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
+  endif()
+endforeach()
+#=============================================================================
+
+
+# This loop finds the compilers and sends them off for interrogation.
+foreach (lang C CXX Fortran)
+  if (CMAKE_${lang}_COMPILER_WORKS)
+    # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler.
+    if (MPI_${lang}_COMPILER)
+      is_file_executable(MPI_${lang}_COMPILER MPI_COMPILER_IS_EXECUTABLE)
+      if (NOT MPI_COMPILER_IS_EXECUTABLE)
+        # Get rid of our default list of names and just search for the name the user wants.
+        set(_MPI_${lang}_COMPILER_NAMES ${MPI_${lang}_COMPILER})
+        set(MPI_${lang}_COMPILER "MPI_${lang}_COMPILER-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+        # If the user specifies a compiler, we don't want to try to search libraries either.
+        set(try_libs FALSE)
+      endif()
+    else()
+      set(try_libs TRUE)
+    endif()
+
+    find_program(MPI_${lang}_COMPILER
+      NAMES  ${_MPI_${lang}_COMPILER_NAMES}
+      PATHS  "${MPI_HOME}/bin" "$ENV{MPI_HOME}/bin" ${_MPI_PREFIX_PATH})
+    interrogate_mpi_compiler(${lang} ${try_libs})
+    mark_as_advanced(MPI_${lang}_COMPILER)
+
+    # last ditch try -- if nothing works so far, just try running the regular compiler and
+    # see if we can create an MPI executable.
+    set(regular_compiler_worked 0)
+    if (NOT MPI_${lang}_LIBRARIES OR NOT MPI_${lang}_INCLUDE_PATH)
+      try_regular_compiler(${lang} regular_compiler_worked)
+    endif()
+
+    if (regular_compiler_worked)
+      find_package_handle_standard_args(MPI_${lang} DEFAULT_MSG MPI_${lang}_COMPILER)
+    else()
+      find_package_handle_standard_args(MPI_${lang} DEFAULT_MSG MPI_${lang}_LIBRARIES MPI_${lang}_INCLUDE_PATH)
+    endif()
+  endif()
+endforeach()
+
+
+#=============================================================================
+# More backward compatibility stuff
+#
+# Bare MPI sans ${lang} vars are set to CXX then C, depending on what was found.
+# This mimics the behavior of the old language-oblivious FindMPI.
+set(_MPI_OLD_VARS FOUND COMPILER INCLUDE_PATH COMPILE_FLAGS LINK_FLAGS LIBRARIES)
+if (MPI_CXX_FOUND)
+  foreach (var ${_MPI_OLD_VARS})
+    set(MPI_${var} ${MPI_CXX_${var}})
+  endforeach()
+elseif (MPI_C_FOUND)
+  foreach (var ${_MPI_OLD_VARS})
+    set(MPI_${var} ${MPI_C_${var}})
+  endforeach()
+else()
+  # Note that we might still have found Fortran, but you'll need to use MPI_Fortran_FOUND
+  set(MPI_FOUND FALSE)
+endif()
+
+# Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and MPI_EXTRA_LIBRARY, and set them in cache.
+if (MPI_LIBRARIES)
+  list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK)
+  set(MPI_LIBRARY ${MPI_LIBRARY_WORK} CACHE FILEPATH "MPI library to link against" FORCE)
+else()
+  set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" CACHE FILEPATH "MPI library to link against" FORCE)
+endif()
+
+list(LENGTH MPI_LIBRARIES MPI_NUMLIBS)
+if (MPI_NUMLIBS GREATER 1)
+  set(MPI_EXTRA_LIBRARY_WORK ${MPI_LIBRARIES})
+  list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0)
+  set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY_WORK} CACHE STRING "Extra MPI libraries to link against" FORCE)
+else()
+  set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND" CACHE STRING "Extra MPI libraries to link against" FORCE)
+endif()
+#=============================================================================
+
+# unset these vars to cleanup namespace
+unset(_MPI_OLD_VARS)
+unset(_MPI_PREFIX_PATH)
+unset(_MPI_BASE_DIR)
+foreach (lang C CXX Fortran)
+  unset(_MPI_${lang}_COMPILER_NAMES)
+endforeach()
diff --git a/config/cmake/FindSZIP.cmake b/config/cmake/FindSZIP.cmake
new file mode 100644
index 0000000..b358862
--- /dev/null
+++ b/config/cmake/FindSZIP.cmake
@@ -0,0 +1,179 @@
+
+# - Find SZIP library
+# - Derived from the FindTiff.cmake that is included with cmake
+# Find the native SZIP includes and library
+# This module defines
+#  SZIP_INCLUDE_DIRS, where to find tiff.h, etc.
+#  SZIP_LIBRARIES, libraries to link against to use SZIP.
+#  SZIP_FOUND, If false, do not try to use SZIP.
+#    also defined, but not for general use are
+#  SZIP_LIBRARY, where to find the SZIP library.
+#  SZIP_LIBRARY_DEBUG - Debug version of SZIP library
+#  SZIP_LIBRARY_RELEASE - Release Version of SZIP library
+
+# MESSAGE (STATUS "Finding SZIP library and headers..." )
+
+############################################
+#
+# Check the existence of the libraries.
+#
+############################################
+# This macro was taken directly from the FindQt4.cmake file that is included
+# with the CMake distribution. This is NOT my work. All work was done by the
+# original authors of the FindQt4.cmake file. Only minor modifications were
+# made to remove references to Qt and make this file more generally applicable
+#########################################################################
+
+MACRO (SZIP_ADJUST_LIB_VARS basename)
+  IF (${basename}_INCLUDE_DIR)
+
+    # if only the release version was found, set the debug variable also to the release version
+    IF (${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG)
+      SET (${basename}_LIBRARY_DEBUG ${${basename}_LIBRARY_RELEASE})
+      SET (${basename}_LIBRARY       ${${basename}_LIBRARY_RELEASE})
+      SET (${basename}_LIBRARIES     ${${basename}_LIBRARY_RELEASE})
+    ENDIF (${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG)
+
+    # if only the debug version was found, set the release variable also to the debug version
+    IF (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE)
+      SET (${basename}_LIBRARY_RELEASE ${${basename}_LIBRARY_DEBUG})
+      SET (${basename}_LIBRARY         ${${basename}_LIBRARY_DEBUG})
+      SET (${basename}_LIBRARIES       ${${basename}_LIBRARY_DEBUG})
+    ENDIF (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE)
+    IF (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE)
+      # if the generator supports configuration types then set
+      # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
+      IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+        SET (${basename}_LIBRARY       optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG})
+      ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+        # if there are no configuration types and CMAKE_BUILD_TYPE has no value
+        # then just use the release libraries
+        SET (${basename}_LIBRARY       ${${basename}_LIBRARY_RELEASE} )
+      ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+      SET (${basename}_LIBRARIES       optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG})
+    ENDIF (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE)
+
+    SET (${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH "The ${basename} library")
+
+    IF (${basename}_LIBRARY)
+      SET (${basename}_FOUND 1)
+    ENDIF (${basename}_LIBRARY)
+
+  ENDIF (${basename}_INCLUDE_DIR )
+
+  # Make variables changeble to the advanced user
+  MARK_AS_ADVANCED (${basename}_LIBRARY ${basename}_LIBRARY_RELEASE ${basename}_LIBRARY_DEBUG ${basename}_INCLUDE_DIR )
+ENDMACRO (SZIP_ADJUST_LIB_VARS)
+
+
+# Look for the header file.
+SET (SZIP_INCLUDE_SEARCH_DIRS
+    $ENV{SZIP_INSTALL}/include
+    $ENV{SZIP_INSTALL}/include/szip
+    /usr/include
+    /usr/include/szip
+)
+
+SET (SZIP_LIB_SEARCH_DIRS
+    $ENV{SZIP_INSTALL}/lib
+    /usr/lib
+)
+
+SET (SZIP_BIN_SEARCH_DIRS
+    $ENV{SZIP_INSTALL}/bin
+    /usr/bin
+)
+
+FIND_PATH (SZIP_INCLUDE_DIR
+    NAMES szlib.h
+    PATHS ${SZIP_INCLUDE_SEARCH_DIRS}
+    NO_DEFAULT_PATH
+)
+
+IF (WIN32)
+    SET (SZIP_SEARCH_DEBUG_NAMES "sz_d;libsz_d")
+    SET (SZIP_SEARCH_RELEASE_NAMES "sz;libsz;libszip")
+ELSE (WIN32)
+    SET (SZIP_SEARCH_DEBUG_NAMES "sz_d")
+    SET (SZIP_SEARCH_RELEASE_NAMES "sz;szip")
+ENDIF (WIN32)
+
+# Look for the library.
+FIND_LIBRARY (SZIP_LIBRARY_DEBUG
+    NAMES ${SZIP_SEARCH_DEBUG_NAMES}
+    PATHS ${SZIP_LIB_SEARCH_DIRS}
+    NO_DEFAULT_PATH
+)
+
+FIND_LIBRARY (SZIP_LIBRARY_RELEASE
+    NAMES ${SZIP_SEARCH_RELEASE_NAMES}
+    PATHS ${SZIP_LIB_SEARCH_DIRS}
+    NO_DEFAULT_PATH
+)
+
+SZIP_ADJUST_LIB_VARS (SZIP)
+
+IF (SZIP_INCLUDE_DIR AND SZIP_LIBRARY)
+  SET (SZIP_FOUND 1)
+  SET (SZIP_LIBRARIES ${SZIP_LIBRARY})
+  SET (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR})
+  IF (SZIP_LIBRARY_DEBUG)
+    GET_FILENAME_COMPONENT (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_DEBUG} PATH)
+    SET (SZIP_LIB_DIR  ${SZIP_LIBRARY_PATH})
+  ELSEIF (SZIP_LIBRARY_RELEASE)
+    GET_FILENAME_COMPONENT (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_RELEASE} PATH)
+    SET (SZIP_LIB_DIR  ${SZIP_LIBRARY_PATH})
+  ENDIF (SZIP_LIBRARY_DEBUG)
+
+ELSE (SZIP_INCLUDE_DIR AND SZIP_LIBRARY)
+  SET (SZIP_FOUND 0)
+  SET (SZIP_LIBRARIES)
+  SET (SZIP_INCLUDE_DIRS)
+ENDIF (SZIP_INCLUDE_DIR AND SZIP_LIBRARY)
+
+# Report the results.
+IF (NOT SZIP_FOUND)
+  SET (SZIP_DIR_MESSAGE
+      "SZip was not found. Make sure SZIP_LIBRARY and SZIP_INCLUDE_DIR are set or set the SZIP_INSTALL environment variable."
+  )
+  IF (NOT SZIP_FIND_QUIETLY)
+    MESSAGE (STATUS "${SZIP_DIR_MESSAGE}")
+  ELSE (NOT SZIP_FIND_QUIETLY)
+    IF (SZIP_FIND_REQUIRED)
+      MESSAGE (FATAL_ERROR "SZip was NOT found and is Required by this project")
+    ENDIF (SZIP_FIND_REQUIRED)
+  ENDIF (NOT SZIP_FIND_QUIETLY)
+ENDIF (NOT SZIP_FOUND)
+
+IF (SZIP_FOUND)
+  INCLUDE (CheckSymbolExists)
+  #############################################
+  # Find out if SZIP was build using dll's
+  #############################################
+  # Save required variable
+  SET (CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
+  SET (CMAKE_REQUIRED_FLAGS_SAVE    ${CMAKE_REQUIRED_FLAGS})
+  # Add SZIP_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
+  SET (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${SZIP_INCLUDE_DIRS}")
+
+  CHECK_SYMBOL_EXISTS (SZIP_BUILT_AS_DYNAMIC_LIB "SZconfig.h" HAVE_SZIP_DLL)
+
+  IF (HAVE_SZIP_DLL STREQUAL "TRUE")
+    SET (HAVE_SZIP_DLL "1")
+  ENDIF (HAVE_SZIP_DLL STREQUAL "TRUE")
+
+  # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables
+  SET (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
+  SET (CMAKE_REQUIRED_FLAGS    ${CMAKE_REQUIRED_FLAGS_SAVE})
+  #
+  #############################################
+ENDIF (SZIP_FOUND)
+
+IF (FIND_SZIP_DEBUG)
+  MESSAGE (STATUS "SZIP_INCLUDE_DIR: ${SZIP_INCLUDE_DIR}")
+  MESSAGE (STATUS "SZIP_INCLUDE_DIRS: ${SZIP_INCLUDE_DIRS}")
+  MESSAGE (STATUS "SZIP_LIBRARY_DEBUG: ${SZIP_LIBRARY_DEBUG}")
+  MESSAGE (STATUS "SZIP_LIBRARY_RELEASE: ${SZIP_LIBRARY_RELEASE}")
+  MESSAGE (STATUS "HAVE_SZIP_DLL: ${HAVE_SZIP_DLL}")
+  MESSAGE (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+ENDIF (FIND_SZIP_DEBUG)
diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake
new file mode 100644
index 0000000..fa3398b
--- /dev/null
+++ b/config/cmake/HDF5Macros.cmake
@@ -0,0 +1,135 @@
+#-------------------------------------------------------------------------------
+MACRO (EXTERNAL_HDF5_LIBRARY compress_type libtype)
+  IF (${compress_type} MATCHES "SVN")
+    EXTERNALPROJECT_ADD (HDF5
+        SVN_REPOSITORY ${HDF5_URL}
+        # [SVN_REVISION rev] 
+        INSTALL_COMMAND ""
+        CMAKE_ARGS
+            -DHDF_LEGACY_NAMING:BOOL=OFF
+            -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
+            -DHDF_PACKAGE_EXT:STRING=${HDFEOS_PACKAGE_EXT}
+            -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+            -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
+            -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+            -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+            -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
+            -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
+            -DHDF5_BUILD_TOOLS:BOOL=ON
+            -DHDF5_EXTERNALLY_CONFIGURED:BOOL=OFF
+            -DHDF5_PACKAGE_EXTLIBS:BOOL=${HDF_PACKAGE_EXTLIBS}
+            -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="SVN"
+            -DZLIB_SVN_URL:STRING=${ZLIB_SVN_URL}
+            -DSZIP_SVN_URL:STRING=${SZIP_SVN_URL}
+            -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=${HDF_ENABLE_Z_LIB_SUPPORT}
+            -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=${HDF_ENABLE_SZIP_SUPPORT}
+            -DHDF5_ENABLE_SZIP_ENCODING:BOOL=${HDF_ENABLE_SZIP_ENCODING}
+    ) 
+  ENDIF (${compress_type} MATCHES "SVN")
+  IF (${compress_type} MATCHES "TGZ")
+    EXTERNALPROJECT_ADD (HDF5
+        URL ${HDF5_URL}
+        URL_MD5 ""
+        INSTALL_COMMAND ""
+        CMAKE_ARGS
+            -DHDF_LEGACY_NAMING:BOOL=OFF
+            -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
+            -DHDF_PACKAGE_EXT:STRING=${HDFEOS_PACKAGE_EXT}
+            -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+            -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
+            -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+            -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+            -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
+            -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
+            -DHDF5_BUILD_TOOLS:BOOL=ON
+            -DHDF5_EXTERNALLY_CONFIGURED:BOOL=OFF
+            -DHDF5_PACKAGE_EXTLIBS:BOOL=${HDF_PACKAGE_EXTLIBS}
+            -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ"
+            -DTGZ_PATH:STRING=${TGZ_PATH}
+            -DZLIB_TGZ_NAME:STRING=${ZLIB_TGZ_NAME}
+            -DSZIP_TGZ_NAME:STRING=${SZIP_TGZ_NAME}
+            -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=${HDF_ENABLE_Z_LIB_SUPPORT}
+            -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=${HDF_ENABLE_SZIP_SUPPORT}
+            -DHDF5_ENABLE_SZIP_ENCODING:BOOL=${HDF_ENABLE_SZIP_ENCODING}
+    ) 
+  ENDIF (${compress_type} MATCHES "TGZ")
+  EXTERNALPROJECT_GET_PROPERTY (HDF5 BINARY_DIR SOURCE_DIR) 
+
+  IF (${CMAKE_BUILD_TYPE} MATCHES "DEBUG")
+    IF (WIN32)
+      SET (HDF5_LIB_NAME "hdf5_D")
+    ELSE (WIN32)
+      SET (HDF5_LIB_NAME "hdf5_debug")
+    ENDIF (WIN32)
+  ELSE (${CMAKE_BUILD_TYPE} MATCHES "DEBUG")
+    SET (HDF5_LIB_NAME "hdf5")
+  ENDIF (${CMAKE_BUILD_TYPE} MATCHES "DEBUG")
+
+  # Create imported target hdf5
+  ADD_LIBRARY(hdf5 ${libtype} IMPORTED)
+  ADD_DEPENDENCIES (hdf5 HDF5)
+
+  IF (${libtype} MATCHES "SHARED")
+    IF (WIN32)
+      IF (MINGW)
+        SET_TARGET_PROPERTIES(hdf5 PROPERTIES
+            IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF5_LIB_NAME}.lib"
+            IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF5_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+            IMPORTED_LINK_INTERFACE_LIBRARIES "zlib;szip"
+        )
+      ELSE (MINGW)
+        SET_TARGET_PROPERTIES(hdf5 PROPERTIES
+            IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${HDF5_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}"
+            IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${HDF5_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+            IMPORTED_LINK_INTERFACE_LIBRARIES "zlib;szip"
+        )
+      ENDIF (MINGW)
+    ELSE (WIN32)
+      SET_TARGET_PROPERTIES(hdf5 PROPERTIES
+          IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${HDF5_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+          IMPORTED_LINK_INTERFACE_LIBRARIES "zlib;szip"
+          IMPORTED_SONAME "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${HDF5_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${HDF5_VERSION_STRING}"
+          SOVERSION "${HDF5_VERSION_STRING}"
+      )
+    ENDIF (WIN32)
+  ELSE (${libtype} MATCHES "SHARED")
+    IF (WIN32 AND NOT MINGW)
+      SET_TARGET_PROPERTIES(hdf5 PROPERTIES
+          IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/lib${HDF5_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
+          IMPORTED_LINK_INTERFACE_LIBRARIES "zlib;szip"
+          IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+      )
+    ELSE (WIN32 AND NOT MINGW)
+      SET_TARGET_PROPERTIES(hdf5 PROPERTIES
+          IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${HDF5_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
+          IMPORTED_LINK_INTERFACE_LIBRARIES "zlib;szip"
+          IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+      )
+    ENDIF (WIN32 AND NOT MINGW)
+  ENDIF (${libtype} MATCHES "SHARED")
+  SET (HDF5_LIBRARY "hdf5")
+
+  SET (HDF5_INCLUDE_DIR_GEN "${BINARY_DIR}")
+  SET (HDF5_INCLUDE_DIR "${SOURCE_DIR}/src")
+  SET (HDF5_FOUND 1)
+  SET (HDF5_LIBRARIES ${HDF5_LIBRARY})
+  SET (HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR_GEN} ${HDF5_INCLUDE_DIR})
+  ADD_EXECUTABLE (h5diff IMPORTED)
+  IF (${libtype} MATCHES "SHARED" AND WIN32)
+    SET_PROPERTY (TARGET h5diff PROPERTY IMPORTED_LOCATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/h5diffdll")
+  ELSE (${libtype} MATCHES "SHARED" AND WIN32)
+    SET_PROPERTY (TARGET h5diff PROPERTY IMPORTED_LOCATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/h5diff")
+  ENDIF (${libtype} MATCHES "SHARED" AND WIN32)
+  SET (HDF5_DIFF_EXECUTABLE $<TARGET_FILE:h5diff>)
+ENDMACRO (EXTERNAL_HDF5_LIBRARY)
+
+#-------------------------------------------------------------------------------
+MACRO (PACKAGE_HDF5_LIBRARY compress_type)
+  ADD_CUSTOM_TARGET (HDF5-GenHeader-Copy ALL
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_INCLUDE_DIR_GEN}/H5pubconf.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/
+      COMMENT "Copying ${HDF5_INCLUDE_DIR_GEN}/H5pubconf.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
+  )
+  IF (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
+    ADD_DEPENDENCIES (HDF5-GenHeader-Copy HDF5)
+  ENDIF (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
+ENDMACRO (PACKAGE_HDF5_LIBRARY)
diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake
new file mode 100644
index 0000000..1f429f5
--- /dev/null
+++ b/config/cmake/HDF5UseFortran.cmake
@@ -0,0 +1,121 @@
+#
+# This file provides functions for Fortran support.
+#
+#-------------------------------------------------------------------------------
+ENABLE_LANGUAGE (Fortran)
+  
+#-----------------------------------------------------------------------------
+# Detect name mangling convention used between Fortran and C
+#-----------------------------------------------------------------------------
+INCLUDE (FortranCInterface)
+FortranCInterface_HEADER (
+    ${CMAKE_BINARY_DIR}/FCMangle.h
+    MACRO_NAMESPACE "H5_FC_"
+    SYMBOL_NAMESPACE "H5_FC_"
+    SYMBOLS mysub mymod:my_sub
+)
+
+FILE (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL\\(.*,.*\\) +(.*)")
+STRING (REGEX MATCH "H5_FC_GLOBAL\\(.*,.*\\) +(.*)" RESULT ${CONTENTS})
+SET (H5_FC_FUNC "H5_FC_FUNC(name,NAME) ${CMAKE_MATCH_1}")
+
+FILE (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)")
+STRING (REGEX MATCH "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)" RESULT ${CONTENTS})
+SET (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) ${CMAKE_MATCH_1}")
+
+#-----------------------------------------------------------------------------
+# The provided CMake Fortran macros don't provide a general check function
+# so this one is used for a sizeof test.
+#-----------------------------------------------------------------------------
+MACRO (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE)
+  IF (NOT DEFINED ${VARIABLE})
+    MESSAGE (STATUS "Testing Fortran ${FUNCTION}")
+    IF (CMAKE_REQUIRED_LIBRARIES)
+      SET (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
+          "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
+    ELSE (CMAKE_REQUIRED_LIBRARIES)
+      SET (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
+    ENDIF (CMAKE_REQUIRED_LIBRARIES)
+    FILE (WRITE
+        ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
+        "${CODE}"
+    )
+    TRY_COMPILE (${VARIABLE}
+        ${CMAKE_BINARY_DIR}
+        ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
+        CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
+        OUTPUT_VARIABLE OUTPUT
+    )
+
+#    MESSAGE ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+#    MESSAGE ( "Test result ${OUTPUT}")
+#    MESSAGE ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+
+    IF (${VARIABLE})
+      SET (${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}")
+      MESSAGE (STATUS "Testing Fortran ${FUNCTION} - OK")
+      FILE (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+          "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n"
+          "${OUTPUT}\n\n"
+      )
+    ELSE (${VARIABLE})
+      MESSAGE (STATUS "Testing Fortran ${FUNCTION} - Fail")
+      SET (${VARIABLE} "" CACHE INTERNAL "Have Fortran function ${FUNCTION}")
+      FILE (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+          "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n"
+          "${OUTPUT}\n\n")
+    ENDIF (${VARIABLE})
+  ENDIF (NOT DEFINED ${VARIABLE})
+ENDMACRO (CHECK_FORTRAN_FEATURE)
+
+#-----------------------------------------------------------------------------
+# Configure Checks which require Fortran compilation must go in here
+# not in the main ConfigureChecks.cmake files, because if the user has
+# no Fortran compiler, problems arise.
+#
+# Be careful with leading spaces here, do not remove them.
+#-----------------------------------------------------------------------------
+CHECK_FORTRAN_FEATURE(sizeof
+  "
+       PROGRAM main
+       i = sizeof(x)
+       END PROGRAM
+  "
+  FORTRAN_HAVE_SIZEOF
+)
+
+CHECK_FORTRAN_FEATURE(RealIsNotDouble
+  "
+       MODULE type_mod
+         INTERFACE h5t
+           MODULE PROCEDURE h5t_real
+           MODULE PROCEDURE h5t_dble
+         END INTERFACE
+       CONTAINS
+         SUBROUTINE h5t_real(r)
+           REAL :: r
+         END SUBROUTINE h5t_real
+         SUBROUTINE h5t_dble(d)
+           DOUBLE PRECISION :: d
+         END SUBROUTINE h5t_dble
+       END MODULE type_mod
+       PROGRAM main
+         USE type_mod
+         REAL :: r
+         DOUBLE PRECISION :: d
+         CALL h5t(r)
+         CALL h5t(d)
+       END PROGRAM main
+  "
+  FORTRAN_DEFAULT_REAL_NOT_DOUBLE
+)
+
+#-----------------------------------------------------------------------------
+# Add debug information (intel Fortran : JB)
+#-----------------------------------------------------------------------------
+IF (CMAKE_Fortran_COMPILER MATCHES ifort)
+    IF (WIN32)
+        SET (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE)
+        SET (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE)
+    ENDIF (WIN32)
+ENDIF (CMAKE_Fortran_COMPILER MATCHES ifort)
diff --git a/config/cmake/HDFEOSMacros.cmake b/config/cmake/HDFEOSMacros.cmake
new file mode 100644
index 0000000..0aea8d0
--- /dev/null
+++ b/config/cmake/HDFEOSMacros.cmake
@@ -0,0 +1,33 @@
+#-------------------------------------------------------------------------------
+MACRO (HDFEOS_SET_LIB_OPTIONS libtarget libname libtype)
+  SET (LIB_OUT_NAME "${libname}")
+  IF (${libtype} MATCHES "SHARED")
+    IF (WIN32)
+      SET (LIBHDFEOS_VERSION ${HDFEOS_PACKAGE_VERSION_MAJOR})
+    ELSE (WIN32)
+      SET (LIBHDFEOS_VERSION ${HDFEOS_PACKAGE_VERSION})
+    ENDIF (WIN32)
+    SET_TARGET_PROPERTIES (${libtarget} PROPERTIES VERSION ${LIBHDFEOS_VERSION})
+#    IF (WIN32)
+#      SET (${LIB_OUT_NAME} "${LIB_OUT_NAME}-${HDFEOS_PACKAGE_SOVERSION}")
+#    ELSE (WIN32)
+#       SET_TARGET_PROPERTIES (${libtarget} PROPERTIES SOVERSION ${HDFEOS_PACKAGE_SOVERSION})
+#    ENDIF (WIN32)
+    SET_TARGET_PROPERTIES (${libtarget} PROPERTIES SOVERSION ${LIBHDFEOS_VERSION})
+  ENDIF (${libtype} MATCHES "SHARED")
+  EOS_SET_LIB_OPTIONS (${libtarget} ${LIB_OUT_NAME} ${libtype})
+
+  #-- Apple Specific install_name for libraries
+  IF (APPLE)
+    OPTION (HDFEOS_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF)
+    IF (HDFEOS_BUILD_WITH_INSTALL_NAME)
+      SET_TARGET_PROPERTIES (${libtarget} PROPERTIES
+          LINK_FLAGS "-current_version ${HDFEOS_PACKAGE_VERSION} -compatibility_version ${HDFEOS_PACKAGE_VERSION}"
+          INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
+          BUILD_WITH_INSTALL_RPATH ${HDFEOS_BUILD_WITH_INSTALL_NAME}
+      )
+    ENDIF (HDFEOS_BUILD_WITH_INSTALL_NAME)
+  ENDIF (APPLE)
+
+ENDMACRO (HDFEOS_SET_LIB_OPTIONS)
+
diff --git a/config/cmake/HE5_config.h.in b/config/cmake/HE5_config.h.in
new file mode 100644
index 0000000..83339db
--- /dev/null
+++ b/config/cmake/HE5_config.h.in
@@ -0,0 +1,150 @@
+/* HE5_config.h.in.  Generated by CMake during the configuration.  */
+
+/* Defined if HDF5 was built with CMake AND build as a shared library */
+#cmakedefine HDFEOS_BUILT_AS_DYNAMIC_LIB @HDFEOS_BUILT_AS_DYNAMIC_LIB@
+
+/* Defined if HDF5 was built with CMake AND build as a static library */
+#cmakedefine HDFEOS_BUILT_AS_STATIC_LIB @HDFEOS_BUILT_AS_STATIC_LIB@
+
+/* Define if HDF5 has szip any type of filter */
+#cmakedefine H5_HAVE_FILTER_SZIP @H5_HAVE_FILTER_SZIP@
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H @EOS_HAVE_DLFCN_H@
+
+/* Define if support for szip filter is enabled */
+#cmakedefine HAVE_FILTER_SZIP @EOS_HAVE_FILTER_SZIP@
+
+/* Define if support for szip encoder filter is enabled */
+#cmakedefine HAVE_FILTER_SZIP_ENCODER @EOS_HAVE_FILTER_SZIP_ENCODER@
+
+/* Define to 1 if you have the <hdf5.h> header file. */
+#cmakedefine HAVE_HDF5_H @HEOS_HAVE_HDF5_H@
+
+/* Define if HDF5 has szip decoder filter */
+#cmakedefine HAVE_HDF5_SZIP_DECODER @HEOS_HAVE_HDF5_SZIP_DECODER@
+
+/* Define if HDF5 has szip encoder filter */
+#cmakedefine HAVE_HDF5_SZIP_ENCODER @HEOS_HAVE_HDF5_SZIP_ENCODER@
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H @EOS_HAVE_INTTYPES_H@
+
+/* Define to 1 if you have the `df' library (-ldf). */
+#cmakedefine HAVE_LIBDF5 @HEOS_HAVE_LIBDF5@
+
+/* Define to 1 if you have the `m' library (-lm). */
+#cmakedefine HAVE_LIBM @EOS_HAVE_LIBM@
+
+/* Define to 1 if you have the `sz' library (-lsz). */
+#cmakedefine HAVE_LIBSZ @EOS_HAVE_LIBSZ@
+
+/* Define to 1 if you have the `z' library (-lz). */
+#cmakedefine HAVE_LIBZ @EOS_HAVE_LIBZ@
+
+/* Define to 1 if you have the <limits.h> header file. */
+#cmakedefine HAVE_LIMITS_H @EOS_HAVE_LIMITS_H@
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+   to 0 otherwise. */
+#cmakedefine HAVE_MALLOC @EOS_HAVE_MALLOC@
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#cmakedefine HAVE_MALLOC_H @EOS_HAVE_MALLOC_H@
+
+/* Define to 1 if you have the `memchr' function. */
+#cmakedefine HAVE_MEMCHR @EOS_HAVE_MEMCHR@
+
+/* Define to 1 if you have the `memmove' function. */
+#cmakedefine HAVE_MEMMOVE @EOS_HAVE_MEMMOVE@
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H @EOS_HAVE_MEMORY_H@
+
+/* Define to 1 if you have the `memset' function. */
+#cmakedefine HAVE_MEMSET @EOS_HAVE_MEMSET@
+
+/* Define to 1 if you have the `pow' function. */
+#cmakedefine HAVE_POW @EOS_HAVE_POW@
+
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+   and to 0 otherwise. */
+#cmakedefine HAVE_REALLOC @EOS_HAVE_REALLOC@
+
+/* Define to 1 if you have the `sqrt' function. */
+#cmakedefine HAVE_SQRT @EOS_HAVE_SQRT@
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H @EOS_HAVE_STDINT_H@
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H @EOS_HAVE_STDLIB_H@
+
+/* Define to 1 if you have the `strchr' function. */
+#cmakedefine HAVE_STRCHR @EOS_HAVE_STRCHR@
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H @EOS_HAVE_STRINGS_H@
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H @EOS_HAVE_STRING_H@
+
+/* Define to 1 if you have the `strstr' function. */
+#cmakedefine HAVE_STRSTR @EOS_HAVE_STRSTR@
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H @EOS_HAVE_SYS_STAT_H@
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H @EOS_HAVE_SYS_TYPES_H@
+
+/* Define to 1 if you have the <szlib.h> header file. */
+#cmakedefine HAVE_SZLIB_H @EOS_HAVE_SZLIB_H@
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H @EOS_HAVE_UNISTD_H@
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#cmakedefine HAVE_ZLIB_H @EOS_HAVE_ZLIB_H@
+
+/* Name of package */
+#cmakedefine PACKAGE @HDFEOS5_PACKAGE@
+
+/* Define to the address where bug reports for this package should be sent. */
+#cmakedefine PACKAGE_BUGREPORT @HDFEOS5_PACKAGE_BUGREPORT@
+
+/* Define to the full name of this package. */
+#cmakedefine PACKAGE_NAME @HDFEOS5_PACKAGE_NAME@
+
+/* Define to the full name and version of this package. */
+#cmakedefine PACKAGE_STRING @HDFEOS5_PACKAGE_STRING@
+
+/* Define to the one symbol short name of this package. */
+#cmakedefine PACKAGE_TARNAME @HDFEOS5_PACKAGE_TARNAME@
+
+/* Define to the version of this package. */
+#cmakedefine PACKAGE_VERSION @HDFEOS5_PACKAGE_VERSION@
+
+/* Define to 1 if you have the ANSI C header files. */
+#cmakedefine STDC_HEADERS @EOS_STDC_HEADERS@
+
+/* Version number of package */
+#cmakedefine VERSION @HDFEOS5_VERSION@
+
+/* Define if threadsafe HDF-EOS is enabled */
+#cmakedefine _HDFEOS5_THREADSAFE @EOS_HDFEOS5_THREADSAFE@
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#cmakedefine const @EOS_const@
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#cmakedefine malloc @EOS_malloc@
+
+/* Define to `long int' if <sys/types.h> does not define. */
+#cmakedefine off_t @EOS_off_t@
+
+/* Define to rpl_realloc if the replacement function should be used. */
+#cmakedefine realloc @EOS_realloc@
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#cmakedefine size_t @EOS_size_t@
diff --git a/config/cmake/NSIS.InstallOptions.ini.in b/config/cmake/NSIS.InstallOptions.ini.in
new file mode 100644
index 0000000..83ca053
--- /dev/null
+++ b/config/cmake/NSIS.InstallOptions.ini.in
@@ -0,0 +1,37 @@
+[Settings]
+NumFields=5
+
+[Field 1]
+Type=label
+Text=By default @CPACK_PACKAGE_INSTALL_DIRECTORY@ does add its directory to the system PATH.
+Left=0
+Right=-1
+Top=0
+Bottom=20
+
+[Field 2]
+Type=radiobutton
+Text=Do not add @CPACK_PACKAGE_NAME@ to the system PATH
+Left=0
+Right=-1
+Top=30
+Bottom=40
+State=0
+
+[Field 3]
+Type=radiobutton
+Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for all users
+Left=0
+Right=-1
+Top=40
+Bottom=50
+State=1
+
+[Field 4]
+Type=radiobutton
+Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for current user
+Left=0
+Right=-1
+Top=50
+Bottom=60
+State=0
diff --git a/config/cmake/NSIS.template.in b/config/cmake/NSIS.template.in
new file mode 100644
index 0000000..f28db0f
--- /dev/null
+++ b/config/cmake/NSIS.template.in
@@ -0,0 +1,949 @@
+; CPack install script designed for a nmake build
+
+;--------------------------------
+; You must define these values
+
+  !define VERSION "@CPACK_PACKAGE_VERSION@"
+  !define PATCH  "@CPACK_PACKAGE_VERSION_PATCH@"
+  !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@"
+
+;--------------------------------
+;Variables
+
+  Var MUI_TEMP
+  Var STARTMENU_FOLDER
+  Var SV_ALLUSERS
+  Var START_MENU
+  Var DO_NOT_ADD_TO_PATH
+  Var ADD_TO_PATH_ALL_USERS
+  Var ADD_TO_PATH_CURRENT_USER
+  Var INSTALL_DESKTOP
+  Var IS_DEFAULT_INSTALLDIR
+;--------------------------------
+;Include Modern UI
+
+  !include "MUI.nsh"
+
+  ;Default installation folder
+  InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_DIRECTORY@\@CPACK_PACKAGE_VERSION@"
+
+;--------------------------------
+;General
+
+  ;Name and file
+  Name "@CPACK_NSIS_PACKAGE_NAME@"
+  OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
+
+  ;Set compression
+  SetCompressor @CPACK_NSIS_COMPRESSOR@
+
+ at CPACK_NSIS_DEFINES@   
+
+  !include Sections.nsh
+
+;--- Component support macros: ---
+; The code for the add/remove functionality is from:
+;   http://nsis.sourceforge.net/Add/Remove_Functionality
+; It has been modified slightly and extended to provide
+; inter-component dependencies.
+Var AR_SecFlags
+Var AR_RegFlags
+ at CPACK_NSIS_SECTION_SELECTED_VARS@
+
+; Loads the "selected" flag for the section named SecName into the
+; variable VarName.
+!macro LoadSectionSelectedIntoVar SecName VarName
+ SectionGetFlags ${${SecName}} $${VarName}
+ IntOp $${VarName} $${VarName} & ${SF_SELECTED}  ;Turn off all other bits
+!macroend
+
+; Loads the value of a variable... can we get around this?
+!macro LoadVar VarName
+  IntOp $R0 0 + $${VarName}
+!macroend
+
+; Sets the value of a variable
+!macro StoreVar VarName IntValue
+  IntOp $${VarName} 0 + ${IntValue}
+!macroend
+
+!macro InitSection SecName
+  ;  This macro reads component installed flag from the registry and
+  ;changes checked state of the section on the components page.
+  ;Input: section index constant name specified in Section command.
+   
+  ClearErrors
+  ;Reading component status from registry
+  ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" "Installed"
+  IfErrors "default_${SecName}"
+    ;Status will stay default if registry value not found
+    ;(component was never installed)
+  IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits
+  SectionGetFlags ${${SecName}} $AR_SecFlags  ;Reading default section flags
+  IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE  ;Turn lowest (enabled) bit off
+  IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags      ;Change lowest bit
+
+  ; Note whether this component was installed before
+  !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags
+  IntOp $R0 $AR_RegFlags & $AR_RegFlags
+  
+  ;Writing modified flags
+  SectionSetFlags ${${SecName}} $AR_SecFlags
+  
+ "default_${SecName}:"
+ !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
+!macroend
+ 
+!macro FinishSection SecName
+  ;  This macro reads section flag set by user and removes the section
+  ;if it is not selected.
+  ;Then it writes component installed flag to registry
+  ;Input: section index constant name specified in Section command.
+ 
+  SectionGetFlags ${${SecName}} $AR_SecFlags  ;Reading section flags
+  ;Checking lowest bit:
+  IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED}
+  IntCmp $AR_SecFlags 1 "leave_${SecName}"
+    ;Section is not selected:
+    ;Calling Section uninstall macro and writing zero installed flag
+    !insertmacro "Remove_${${SecName}}"
+    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" \
+  "Installed" 0
+    Goto "exit_${SecName}"
+ 
+ "leave_${SecName}:"
+    ;Section is selected:
+    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" \
+  "Installed" 1
+ 
+ "exit_${SecName}:"
+!macroend
+ 
+!macro RemoveSection SecName
+  ;  This macro is used to call section's Remove_... macro
+  ;from the uninstaller.
+  ;Input: section index constant name specified in Section command.
+ 
+  !insertmacro "Remove_${${SecName}}"
+!macroend
+
+; Determine whether the selection of SecName changed
+!macro MaybeSelectionChanged SecName
+  !insertmacro LoadVar ${SecName}_selected
+  SectionGetFlags ${${SecName}} $R1
+  IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits
+  
+  ; See if the status has changed:
+  IntCmp $R0 $R1 "${SecName}_unchanged"
+  !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
+  
+  IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected"
+  !insertmacro "Deselect_required_by_${SecName}"
+  goto "${SecName}_unchanged"
+  
+  "${SecName}_was_selected:"
+  !insertmacro "Select_${SecName}_depends"
+  
+  "${SecName}_unchanged:"
+!macroend
+;--- End of Add/Remove macros ---
+
+;--------------------------------
+;Interface Settings
+
+  !define MUI_HEADERIMAGE
+  !define MUI_ABORTWARNING
+    
+;--------------------------------
+; path functions
+
+!verbose 3
+!include "WinMessages.NSH"
+!verbose 4
+
+;----------------------------------------
+; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02"
+;----------------------------------------
+!verbose 3
+!include "WinMessages.NSH"
+!verbose 4
+;====================================================
+; get_NT_environment 
+;     Returns: the selected environment
+;     Output : head of the stack
+;====================================================
+!macro select_NT_profile UN
+Function ${UN}select_NT_profile
+   StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single
+      DetailPrint "Selected environment for all users"
+      Push "all"
+      Return
+   environment_single:
+      DetailPrint "Selected environment for current user only."
+      Push "current"
+      Return
+FunctionEnd
+!macroend
+!insertmacro select_NT_profile ""
+!insertmacro select_NT_profile "un."
+;----------------------------------------------------
+!define NT_current_env 'HKCU "Environment"'
+!define NT_all_env     'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+
+!ifndef WriteEnvStr_RegKey
+  !ifdef ALL_USERS
+    !define WriteEnvStr_RegKey \
+       'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+  !else
+    !define WriteEnvStr_RegKey 'HKCU "Environment"'
+  !endif
+!endif
+ 
+; AddToPath - Adds the given dir to the search path.
+;        Input - head of the stack
+;        Note - Win9x systems requires reboot
+ 
+Function AddToPath
+  Exch $0
+  Push $1
+  Push $2
+  Push $3
+ 
+  # don't add if the path doesn't exist
+  IfFileExists "$0\*.*" "" AddToPath_done
+ 
+  ReadEnvStr $1 PATH
+  ; if the path is too long for a NSIS variable NSIS will return a 0 
+  ; length string.  If we find that, then warn and skip any path
+  ; modification as it will trash the existing path.
+  StrLen $2 $1
+  IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done
+    CheckPathLength_ShowPathWarning:
+    Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!"
+    Goto AddToPath_done
+  CheckPathLength_Done:
+  Push "$1;"
+  Push "$0;"
+  Call StrStr
+  Pop $2
+  StrCmp $2 "" "" AddToPath_done
+  Push "$1;"
+  Push "$0\;"
+  Call StrStr
+  Pop $2
+  StrCmp $2 "" "" AddToPath_done
+  GetFullPathName /SHORT $3 $0
+  Push "$1;"
+  Push "$3;"
+  Call StrStr
+  Pop $2
+  StrCmp $2 "" "" AddToPath_done
+  Push "$1;"
+  Push "$3\;"
+  Call StrStr
+  Pop $2
+  StrCmp $2 "" "" AddToPath_done
+ 
+  Call IsNT
+  Pop $1
+  StrCmp $1 1 AddToPath_NT
+    ; Not on NT
+    StrCpy $1 $WINDIR 2
+    FileOpen $1 "$1\autoexec.bat" a
+    FileSeek $1 -1 END
+    FileReadByte $1 $2
+    IntCmp $2 26 0 +2 +2 # DOS EOF
+      FileSeek $1 -1 END # write over EOF
+    FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
+    FileClose $1
+    SetRebootFlag true
+    Goto AddToPath_done
+ 
+  AddToPath_NT:
+    StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey
+      ReadRegStr $1 ${NT_current_env} "PATH"
+      Goto DoTrim
+    ReadAllKey:
+      ReadRegStr $1 ${NT_all_env} "PATH"
+    DoTrim:
+    StrCmp $1 "" AddToPath_NTdoIt
+      Push $1
+      Call Trim
+      Pop $1
+      StrCpy $0 "$1;$0"
+    AddToPath_NTdoIt:
+      StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey
+        WriteRegExpandStr ${NT_current_env} "PATH" $0
+        Goto DoSend
+      WriteAllKey:
+        WriteRegExpandStr ${NT_all_env} "PATH" $0
+      DoSend:
+      SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+ 
+  AddToPath_done:
+    Pop $3
+    Pop $2
+    Pop $1
+    Pop $0
+FunctionEnd
+
+ 
+; RemoveFromPath - Remove a given dir from the path
+;     Input: head of the stack
+ 
+Function un.RemoveFromPath
+  Exch $0
+  Push $1
+  Push $2
+  Push $3
+  Push $4
+  Push $5
+  Push $6
+ 
+  IntFmt $6 "%c" 26 # DOS EOF
+ 
+  Call un.IsNT
+  Pop $1
+  StrCmp $1 1 unRemoveFromPath_NT
+    ; Not on NT
+    StrCpy $1 $WINDIR 2
+    FileOpen $1 "$1\autoexec.bat" r
+    GetTempFileName $4
+    FileOpen $2 $4 w
+    GetFullPathName /SHORT $0 $0
+    StrCpy $0 "SET PATH=%PATH%;$0"
+    Goto unRemoveFromPath_dosLoop
+ 
+    unRemoveFromPath_dosLoop:
+      FileRead $1 $3
+      StrCpy $5 $3 1 -1 # read last char
+      StrCmp $5 $6 0 +2 # if DOS EOF
+        StrCpy $3 $3 -1 # remove DOS EOF so we can compare
+      StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
+      StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
+      StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
+      StrCmp $3 "" unRemoveFromPath_dosLoopEnd
+      FileWrite $2 $3
+      Goto unRemoveFromPath_dosLoop
+      unRemoveFromPath_dosLoopRemoveLine:
+        SetRebootFlag true
+        Goto unRemoveFromPath_dosLoop
+ 
+    unRemoveFromPath_dosLoopEnd:
+      FileClose $2
+      FileClose $1
+      StrCpy $1 $WINDIR 2
+      Delete "$1\autoexec.bat"
+      CopyFiles /SILENT $4 "$1\autoexec.bat"
+      Delete $4
+      Goto unRemoveFromPath_done
+ 
+  unRemoveFromPath_NT:
+    StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey
+      ReadRegStr $1 ${NT_current_env} "PATH"
+      Goto unDoTrim
+    unReadAllKey:
+      ReadRegStr $1 ${NT_all_env} "PATH"
+    unDoTrim:
+    StrCpy $5 $1 1 -1 # copy last char
+    StrCmp $5 ";" +2 # if last char != ;
+      StrCpy $1 "$1;" # append ;
+    Push $1
+    Push "$0;"
+    Call un.StrStr ; Find `$0;` in $1
+    Pop $2 ; pos of our dir
+    StrCmp $2 "" unRemoveFromPath_done
+      ; else, it is in path
+      # $0 - path to add
+      # $1 - path var
+      StrLen $3 "$0;"
+      StrLen $4 $2
+      StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
+      StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
+      StrCpy $3 $5$6
+ 
+      StrCpy $5 $3 1 -1 # copy last char
+      StrCmp $5 ";" 0 +2 # if last char == ;
+        StrCpy $3 $3 -1 # remove last char
+ 
+      StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey
+        WriteRegExpandStr ${NT_current_env} "PATH" $3
+        Goto unDoSend
+      unWriteAllKey:
+        WriteRegExpandStr ${NT_all_env} "PATH" $3
+      unDoSend:
+      SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+ 
+  unRemoveFromPath_done:
+    Pop $6
+    Pop $5
+    Pop $4
+    Pop $3
+    Pop $2
+    Pop $1
+    Pop $0
+FunctionEnd
+ 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Uninstall sutff
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+###########################################
+#            Utility Functions            #
+###########################################
+ 
+;====================================================
+; IsNT - Returns 1 if the current system is NT, 0
+;        otherwise.
+;     Output: head of the stack
+;====================================================
+; IsNT
+; no input
+; output, top of the stack = 1 if NT or 0 if not
+;
+; Usage:
+;   Call IsNT
+;   Pop $R0
+;  ($R0 at this point is 1 or 0)
+ 
+!macro IsNT un
+Function ${un}IsNT
+  Push $0
+  ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
+  StrCmp $0 "" 0 IsNT_yes
+  ; we are not NT.
+  Pop $0
+  Push 0
+  Return
+ 
+  IsNT_yes:
+    ; NT!!!
+    Pop $0
+    Push 1
+FunctionEnd
+!macroend
+!insertmacro IsNT ""
+!insertmacro IsNT "un."
+ 
+; StrStr
+; input, top of stack = string to search for
+;        top of stack-1 = string to search in
+; output, top of stack (replaces with the portion of the string remaining)
+; modifies no other variables.
+;
+; Usage:
+;   Push "this is a long ass string"
+;   Push "ass"
+;   Call StrStr
+;   Pop $R0
+;  ($R0 at this point is "ass string")
+ 
+!macro StrStr un
+Function ${un}StrStr
+Exch $R1 ; st=haystack,old$R1, $R1=needle
+  Exch    ; st=old$R1,haystack
+  Exch $R2 ; st=old$R1,old$R2, $R2=haystack
+  Push $R3
+  Push $R4
+  Push $R5
+  StrLen $R3 $R1
+  StrCpy $R4 0
+  ; $R1=needle
+  ; $R2=haystack
+  ; $R3=len(needle)
+  ; $R4=cnt
+  ; $R5=tmp
+  loop:
+    StrCpy $R5 $R2 $R3 $R4
+    StrCmp $R5 $R1 done
+    StrCmp $R5 "" done
+    IntOp $R4 $R4 + 1
+    Goto loop
+done:
+  StrCpy $R1 $R2 "" $R4
+  Pop $R5
+  Pop $R4
+  Pop $R3
+  Pop $R2
+  Exch $R1
+FunctionEnd
+!macroend
+!insertmacro StrStr ""
+!insertmacro StrStr "un."
+
+Function Trim ; Added by Pelaca
+  Exch $R1
+  Push $R2
+Loop:
+  StrCpy $R2 "$R1" 1 -1
+  StrCmp "$R2" " " RTrim
+  StrCmp "$R2" "$\n" RTrim
+  StrCmp "$R2" "$\r" RTrim
+  StrCmp "$R2" ";" RTrim
+  GoTo Done
+RTrim:  
+  StrCpy $R1 "$R1" -1
+  Goto Loop
+Done:
+  Pop $R2
+  Exch $R1
+FunctionEnd
+
+Function ConditionalAddToRegisty
+  Pop $0
+  Pop $1
+  StrCmp "$0" "" ConditionalAddToRegisty_EmptyString
+    WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" \
+    "$1" "$0"
+    ;MessageBox MB_OK "Set Registry: '$1' to '$0'"
+    DetailPrint "Set install registry entry: '$1' to '$0'"
+  ConditionalAddToRegisty_EmptyString:
+FunctionEnd
+
+;--------------------------------
+
+!ifdef CPACK_USES_DOWNLOAD
+Function DownloadFile
+    IfFileExists $INSTDIR\* +2
+    CreateDirectory $INSTDIR
+    Pop $0
+
+    ; Skip if already downloaded
+    IfFileExists $INSTDIR\$0 0 +2
+    Return
+
+    StrCpy $1 "@CPACK_DOWNLOAD_SITE@"
+
+  try_again:
+    NSISdl::download "$1/$0" "$INSTDIR\$0"
+    
+    Pop $1
+    StrCmp $1 "success" success
+    StrCmp $1 "Cancelled" cancel
+    MessageBox MB_OK "Download failed: $1"
+  cancel:
+    Return
+  success:
+FunctionEnd
+!endif
+
+;--------------------------------
+; Installation types
+ at CPACK_NSIS_INSTALLATION_TYPES@
+
+;--------------------------------
+; Component sections
+ at CPACK_NSIS_COMPONENT_SECTIONS@
+
+;--------------------------------
+; Define some macro setting for the gui
+ at CPACK_NSIS_INSTALLER_MUI_ICON_CODE@
+ at CPACK_NSIS_INSTALLER_ICON_CODE@
+ at CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
+ at CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@
+
+;--------------------------------
+;Pages
+  !insertmacro MUI_PAGE_WELCOME
+
+  !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
+  Page custom InstallOptionsPage
+  !insertmacro MUI_PAGE_DIRECTORY
+  
+  ;Start Menu Folder Page Configuration
+  !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX" 
+  !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" 
+  !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
+  !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
+
+  @CPACK_NSIS_PAGE_COMPONENTS@
+
+  !insertmacro MUI_PAGE_INSTFILES
+  !insertmacro MUI_PAGE_FINISH
+
+  !insertmacro MUI_UNPAGE_CONFIRM
+  !insertmacro MUI_UNPAGE_INSTFILES
+
+;--------------------------------
+;Languages
+
+  !insertmacro MUI_LANGUAGE "English" ;first language is the default language
+  !insertmacro MUI_LANGUAGE "Albanian"
+  !insertmacro MUI_LANGUAGE "Arabic"
+  !insertmacro MUI_LANGUAGE "Basque"
+  !insertmacro MUI_LANGUAGE "Belarusian"
+  !insertmacro MUI_LANGUAGE "Bosnian"
+  !insertmacro MUI_LANGUAGE "Breton"
+  !insertmacro MUI_LANGUAGE "Bulgarian"
+  !insertmacro MUI_LANGUAGE "Croatian"
+  !insertmacro MUI_LANGUAGE "Czech"
+  !insertmacro MUI_LANGUAGE "Danish"
+  !insertmacro MUI_LANGUAGE "Dutch"
+  !insertmacro MUI_LANGUAGE "Estonian"
+  !insertmacro MUI_LANGUAGE "Farsi"
+  !insertmacro MUI_LANGUAGE "Finnish"
+  !insertmacro MUI_LANGUAGE "French"
+  !insertmacro MUI_LANGUAGE "German"
+  !insertmacro MUI_LANGUAGE "Greek"
+  !insertmacro MUI_LANGUAGE "Hebrew"
+  !insertmacro MUI_LANGUAGE "Hungarian"
+  !insertmacro MUI_LANGUAGE "Icelandic"
+  !insertmacro MUI_LANGUAGE "Indonesian"
+  !insertmacro MUI_LANGUAGE "Irish"
+  !insertmacro MUI_LANGUAGE "Italian"
+  !insertmacro MUI_LANGUAGE "Japanese"
+  !insertmacro MUI_LANGUAGE "Korean"
+  !insertmacro MUI_LANGUAGE "Kurdish"
+  !insertmacro MUI_LANGUAGE "Latvian"
+  !insertmacro MUI_LANGUAGE "Lithuanian"
+  !insertmacro MUI_LANGUAGE "Luxembourgish"
+  !insertmacro MUI_LANGUAGE "Macedonian"
+  !insertmacro MUI_LANGUAGE "Malay"
+  !insertmacro MUI_LANGUAGE "Mongolian"
+  !insertmacro MUI_LANGUAGE "Norwegian"
+  !insertmacro MUI_LANGUAGE "Polish"
+  !insertmacro MUI_LANGUAGE "Portuguese"
+  !insertmacro MUI_LANGUAGE "PortugueseBR"
+  !insertmacro MUI_LANGUAGE "Romanian"
+  !insertmacro MUI_LANGUAGE "Russian"
+  !insertmacro MUI_LANGUAGE "Serbian"
+  !insertmacro MUI_LANGUAGE "SerbianLatin"
+  !insertmacro MUI_LANGUAGE "SimpChinese"
+  !insertmacro MUI_LANGUAGE "Slovak"
+  !insertmacro MUI_LANGUAGE "Slovenian"
+  !insertmacro MUI_LANGUAGE "Spanish"
+  !insertmacro MUI_LANGUAGE "Swedish"
+  !insertmacro MUI_LANGUAGE "Thai"
+  !insertmacro MUI_LANGUAGE "TradChinese"
+  !insertmacro MUI_LANGUAGE "Turkish"
+  !insertmacro MUI_LANGUAGE "Ukrainian"
+  !insertmacro MUI_LANGUAGE "Welsh"
+
+
+;--------------------------------
+;Reserve Files
+
+  ;These files should be inserted before other files in the data block
+  ;Keep these lines before any File command
+  ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
+
+  ReserveFile "NSIS.InstallOptions.ini"
+  !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
+
+;--------------------------------
+;Installer Sections
+
+Section "-Core installation"
+  ;Use the entire tree produced by the INSTALL target.  Keep the
+  ;list of directories here in sync with the RMDir commands below.
+  SetOutPath "$INSTDIR"
+  @CPACK_NSIS_FULL_INSTALL@
+  
+  ;Store installation folder
+  WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
+  
+  ;Create uninstaller
+  WriteUninstaller "$INSTDIR\Uninstall.exe"
+  Push "DisplayName"
+  Push "@CPACK_NSIS_DISPLAY_NAME@"
+  Call ConditionalAddToRegisty
+  Push "DisplayVersion"
+  Push "@CPACK_PACKAGE_VERSION@"
+  Call ConditionalAddToRegisty
+  Push "Publisher"
+  Push "@CPACK_PACKAGE_VENDOR@"
+  Call ConditionalAddToRegisty
+  Push "UninstallString"
+  Push "$INSTDIR\Uninstall.exe"
+  Call ConditionalAddToRegisty
+  Push "NoRepair"
+  Push "1"
+  Call ConditionalAddToRegisty
+  
+  !ifdef CPACK_NSIS_ADD_REMOVE
+  ;Create add/remove functionality
+  Push "ModifyPath"
+  Push "$INSTDIR\AddRemove.exe"
+  Call ConditionalAddToRegisty
+  !else
+  Push "NoModify"
+  Push "1"
+  Call ConditionalAddToRegisty
+  !endif
+  
+  ; Optional registration
+  Push "DisplayIcon"
+  Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@"
+  Call ConditionalAddToRegisty
+  Push "HelpLink"
+  Push "@CPACK_NSIS_HELP_LINK@"
+  Call ConditionalAddToRegisty
+  Push "URLInfoAbout"
+  Push "@CPACK_NSIS_URL_INFO_ABOUT@"
+  Call ConditionalAddToRegisty
+  Push "Contact"
+  Push "@CPACK_NSIS_CONTACT@"
+  Call ConditionalAddToRegisty
+  !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State"
+  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+  
+  ;Create shortcuts
+  CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
+ at CPACK_NSIS_CREATE_ICONS@
+ at CPACK_NSIS_CREATE_ICONS_EXTRA@
+  CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
+
+  ;Read a value from an InstallOptions INI file
+  !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State"
+  !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State"
+  !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State"
+
+  ; Write special uninstall registry entries
+  Push "StartMenu"
+  Push "$STARTMENU_FOLDER"
+  Call ConditionalAddToRegisty
+  Push "DoNotAddToPath"
+  Push "$DO_NOT_ADD_TO_PATH"
+  Call ConditionalAddToRegisty
+  Push "AddToPathAllUsers"
+  Push "$ADD_TO_PATH_ALL_USERS"
+  Call ConditionalAddToRegisty
+  Push "AddToPathCurrentUser"
+  Push "$ADD_TO_PATH_CURRENT_USER"
+  Call ConditionalAddToRegisty
+  Push "InstallToDesktop"
+  Push "$INSTALL_DESKTOP"
+  Call ConditionalAddToRegisty
+
+  !insertmacro MUI_STARTMENU_WRITE_END
+
+ at CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
+
+SectionEnd
+
+Section "-Add to path"
+  Push $INSTDIR\bin
+  StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath
+  StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0  
+    Call AddToPath
+  doNotAddToPath:
+SectionEnd
+
+;--------------------------------
+; Create custom pages
+Function InstallOptionsPage
+  !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@"
+  !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
+
+FunctionEnd
+
+;--------------------------------
+; determine admin versus local install
+Function un.onInit
+
+  ClearErrors
+  UserInfo::GetName
+  IfErrors noLM
+  Pop $0
+  UserInfo::GetAccountType
+  Pop $1
+  StrCmp $1 "Admin" 0 +3
+    SetShellVarContext all
+    ;MessageBox MB_OK 'User "$0" is in the Admin group'
+    Goto done
+  StrCmp $1 "Power" 0 +3
+    SetShellVarContext all
+    ;MessageBox MB_OK 'User "$0" is in the Power Users group'
+    Goto done
+    
+  noLM:
+    ;Get installation folder from registry if available
+
+  done:
+    
+FunctionEnd
+
+;--- Add/Remove callback functions: ---
+!macro SectionList MacroName
+  ;This macro used to perform operation on multiple sections.
+  ;List all of your components in following manner here.
+ at CPACK_NSIS_COMPONENT_SECTION_LIST@
+!macroend
+ 
+Section -FinishComponents
+  ;Removes unselected components and writes component status to registry
+  !insertmacro SectionList "FinishSection"
+  
+!ifdef CPACK_NSIS_ADD_REMOVE  
+  ; Get the name of the installer executable
+  System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
+  StrCpy $R3 $R0
+  
+  ; Strip off the last 13 characters, to see if we have AddRemove.exe
+  StrLen $R1 $R0
+  IntOp $R1 $R0 - 13
+  StrCpy $R2 $R0 13 $R1
+  StrCmp $R2 "AddRemove.exe" addremove_installed
+  
+  ; We're not running AddRemove.exe, so install it
+  CopyFiles $R3 $INSTDIR\AddRemove.exe
+  
+  addremove_installed:
+!endif
+SectionEnd
+;--- End of Add/Remove callback functions ---
+
+;--------------------------------
+; Component dependencies
+Function .onSelChange
+  !insertmacro SectionList MaybeSelectionChanged
+FunctionEnd
+
+;--------------------------------
+;Uninstaller Section
+
+Section "Uninstall"
+  ReadRegStr $START_MENU SHCTX \
+   "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "StartMenu"
+  ;MessageBox MB_OK "Start menu is in: $START_MENU"
+  ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \
+    "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "DoNotAddToPath"
+  ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \
+    "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "AddToPathAllUsers"
+  ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \
+    "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "AddToPathCurrentUser"
+  ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS"
+  ReadRegStr $INSTALL_DESKTOP SHCTX \
+    "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "InstallToDesktop"
+  ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP "
+
+ at CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@
+
+  ;Remove files we installed.
+  ;Keep the list of directories here in sync with the File commands above.
+ at CPACK_NSIS_DELETE_FILES@
+ at CPACK_NSIS_DELETE_DIRECTORIES@
+
+!ifdef CPACK_NSIS_ADD_REMOVE  
+  ;Remove the add/remove program
+  Delete "$INSTDIR\AddRemove.exe"
+!endif
+
+  ;Remove the uninstaller itself.
+  Delete "$INSTDIR\Uninstall.exe"
+  DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@"
+
+  ;Remove the installation directory if it is empty.
+  RMDir "$INSTDIR"
+
+  ; Remove the registry entries.
+  DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+
+  ; Removes all optional components
+  !insertmacro SectionList "RemoveSection"
+  
+  !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
+    
+  Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
+ at CPACK_NSIS_DELETE_ICONS@
+ at CPACK_NSIS_DELETE_ICONS_EXTRA@
+  
+  ;Delete empty start menu parent diretories
+  StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
+ 
+  startMenuDeleteLoop:
+    ClearErrors
+    RMDir $MUI_TEMP
+    GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
+    
+    IfErrors startMenuDeleteLoopDone
+  
+    StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop
+  startMenuDeleteLoopDone:
+
+  ; If the user changed the shortcut, then untinstall may not work. This should
+  ; try to fix it.
+  StrCpy $MUI_TEMP "$START_MENU"
+  Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
+ at CPACK_NSIS_DELETE_ICONS_EXTRA@
+  
+  ;Delete empty start menu parent diretories
+  StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
+ 
+  secondStartMenuDeleteLoop:
+    ClearErrors
+    RMDir $MUI_TEMP
+    GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
+    
+    IfErrors secondStartMenuDeleteLoopDone
+  
+    StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop
+  secondStartMenuDeleteLoopDone:
+
+  DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+
+  Push $INSTDIR\bin
+  StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0
+    Call un.RemoveFromPath
+  doNotRemoveFromPath:
+SectionEnd
+
+;--------------------------------
+; determine admin versus local install
+; Is install for "AllUsers" or "JustMe"?
+; Default to "JustMe" - set to "AllUsers" if admin or on Win9x
+; This function is used for the very first "custom page" of the installer.
+; This custom page does not show up visibly, but it executes prior to the
+; first visible page and sets up $INSTDIR properly...
+; Choose different default installation folder based on SV_ALLUSERS...
+; "Program Files" for AllUsers, "My Documents" for JustMe...
+
+Function .onInit
+  ; Reads components status for registry
+  !insertmacro SectionList "InitSection"
+
+  ; check to see if /D has been used to change 
+  ; the install directory by comparing it to the 
+  ; install directory that is expected to be the
+  ; default
+  StrCpy $IS_DEFAULT_INSTALLDIR 0
+  StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_DIRECTORY@\@CPACK_PACKAGE_VERSION@" 0 +2
+    StrCpy $IS_DEFAULT_INSTALLDIR 1
+  
+  StrCpy $SV_ALLUSERS "JustMe"
+  ; if default install dir then change the default
+  ; if it is installed for JustMe
+  StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
+    StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_DIRECTORY@\@CPACK_PACKAGE_VERSION@"
+
+  ClearErrors
+  UserInfo::GetName
+  IfErrors noLM
+  Pop $0
+  UserInfo::GetAccountType
+  Pop $1
+  StrCmp $1 "Admin" 0 +3
+    SetShellVarContext all
+    ;MessageBox MB_OK 'User "$0" is in the Admin group'
+    StrCpy $SV_ALLUSERS "AllUsers"
+    Goto done
+  StrCmp $1 "Power" 0 +3
+    SetShellVarContext all
+    ;MessageBox MB_OK 'User "$0" is in the Power Users group'
+    StrCpy $SV_ALLUSERS "AllUsers"
+    Goto done
+    
+  noLM:
+    StrCpy $SV_ALLUSERS "AllUsers"
+    ;Get installation folder from registry if available
+
+  done:
+  StrCmp $SV_ALLUSERS "AllUsers" 0 +3
+    StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
+      StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_DIRECTORY@\@CPACK_PACKAGE_VERSION@"
+
+  StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
+    !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
+
+  noOptionsPage:
+FunctionEnd
diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake
new file mode 100755
index 0000000..c3e0e05
--- /dev/null
+++ b/config/cmake/cacheinit.cmake
@@ -0,0 +1,53 @@
+# This is the CMakeCache file.
+
+########################
+# EXTERNAL cache entries
+########################
+
+SET (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE)
+
+SET (USE_SHARED_LIBS ON CACHE BOOL "Use Shared Libraries" FORCE)
+
+SET (BUILD_TESTING ON CACHE BOOL "Build HDFEOS5 Unit Testing" FORCE)
+
+SET (HDFEOS5_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE)
+
+SET (HDFEOS5_BUILD_SAMPLES ON CACHE BOOL "Build HDFEOS5 Library Samples" FORCE)
+
+SET (HDFEOS5_BUILD_TESTDRIVERS ON CACHE BOOL "Build HDFEOS5 Testdrivers" FORCE)
+
+SET (HDFEOS5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE)
+
+SET (HDFEOS5_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE)
+
+SET (HDFEOS5_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE)
+
+SET (USE_HDF5_16_API_DEFAULT ON CACHE BOOL "Use the HDF5 1.6.x API" FORCE)
+
+SET (HDFEOS5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE)
+
+SET (HDFEOS5_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)" FORCE)
+
+SET (HDFEOS_BUILD_FORTRAN ON CACHE BOOL "Enable fortran for Programs" FORCE)
+
+SET (HDFEOS5_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libraries" FORCE)
+
+SET (HDFEOS5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building" FORCE)
+
+SET (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE)
+
+SET (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE)
+
+SET (HDF5_SVN_URL "http://svn.hdfgroup.uiuc.edu/hdf5/branches/hdf5_1_8" CACHE STRING "Use HDF5 from HDF repository" FORCE)
+
+SET (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE)
+
+SET (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE)
+
+SET (HDF5_TGZ_NAME "HDF5.tar.gz" CACHE STRING "Use HDF5 from compressed file" FORCE)
+
+SET (HDF5_PACKAGE_NAME "hdf5" CACHE STRING "Name of HDF5 package" FORCE)
+
+SET (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE)
+
+SET (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE)
diff --git a/config/cmake/hdfeos5-config-version.cmake.in b/config/cmake/hdfeos5-config-version.cmake.in
new file mode 100644
index 0000000..09f51de
--- /dev/null
+++ b/config/cmake/hdfeos5-config-version.cmake.in
@@ -0,0 +1,27 @@
+#-----------------------------------------------------------------------------
+# hdfeos Version file for install directory
+#-----------------------------------------------------------------------------
+
+SET (PACKAGE_VERSION @HDFEOS5_VERSION_STRING@)
+
+IF ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @HDFEOS5_VERS_MAJOR@)
+
+  # exact match for version @HDFEOS5_VERS_MAJOR at .@HDFEOS5_VERS_MINOR@
+  IF ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @HDFEOS5_VERS_MINOR@)
+
+    # compatible with any version @HDFEOS5_VERS_MAJOR at .@HDFEOS5_VERS_MINOR at .x
+    SET (PACKAGE_VERSION_COMPATIBLE 1) 
+    
+    IF ("${PACKAGE_FIND_VERSION_PATCH}" EQUAL @HDFEOS5_VERS_RELEASE@)
+      SET (PACKAGE_VERSION_EXACT 1)    
+
+      IF ("${PACKAGE_FIND_VERSION_TWEAK}" EQUAL @HDFEOS5_VERS_SUBRELEASE@)
+        # not using this yet
+      ENDIF ("${PACKAGE_FIND_VERSION_TWEAK}" EQUAL @HDFEOS5_VERS_SUBRELEASE@)
+      
+    ENDIF ("${PACKAGE_FIND_VERSION_PATCH}" EQUAL @HDFEOS5_VERS_RELEASE@)
+    
+  ENDIF ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @HDFEOS5_VERS_MINOR@)
+ENDIF ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @HDFEOS5_VERS_MAJOR@)
+
+
diff --git a/config/cmake/hdfeos5-config.cmake.build.in b/config/cmake/hdfeos5-config.cmake.build.in
new file mode 100644
index 0000000..f45f3a0
--- /dev/null
+++ b/config/cmake/hdfeos5-config.cmake.build.in
@@ -0,0 +1,39 @@
+#-----------------------------------------------------------------------------
+# HDFEOS5 Config file for compiling against HDFEOS5 build directory
+#-----------------------------------------------------------------------------
+GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+#-----------------------------------------------------------------------------
+# User Options
+#-----------------------------------------------------------------------------
+SET (HDFEOS5_ENABLE_PARALLEL @HDFEOS5_ENABLE_PARALLEL@)
+SET (HDFEOS5_BUILD_TOOLS     @HDFEOS5_BUILD_TOOLS@)
+SET (HDFEOS5_ENABLE_Z_LIB_SUPPORT @HDFEOS5_ENABLE_Z_LIB_SUPPORT@)
+SET (HDFEOS5_ENABLE_SZIP_SUPPORT  @HDFEOS5_ENABLE_SZIP_SUPPORT@)
+SET (HDFEOS5_ENABLE_SZIP_ENCODING @HDFEOS5_ENABLE_SZIP_ENCODING@)
+SET (BUILD_SHARED_LIBS    @BUILD_SHARED_LIBS@)
+
+#-----------------------------------------------------------------------------
+# Directories
+#-----------------------------------------------------------------------------
+SET (HDFEOS5_INCLUDE_DIRS "@HDFEOS5_INCLUDES_BUILD_TIME@")
+
+IF (HDFEOS5_BUILD_TOOLS)
+  SET (HDFEOS5_INCLUDE_DIR_TOOLS ${HDFEOS5_INCLUDE_DIR} )
+ENDIF (HDFEOS5_BUILD_TOOLS)
+
+#-----------------------------------------------------------------------------
+# Version Strings
+#-----------------------------------------------------------------------------
+SET (HDFEOS5_VERSION_STRING @HDFEOS5_VERSION_STRING@)
+SET (HDFEOS5_VERSION_MAJOR  @HDFEOS5_VERSION_MAJOR@)
+SET (HDFEOS5_VERSION_MINOR  @HDFEOS5_VERSION_MINOR@)
+
+#-----------------------------------------------------------------------------
+# Don't include targets if this file is being picked up by another
+# project which has already build HDFEOS5 as a subproject
+#-----------------------------------------------------------------------------
+IF (NOT TARGET "@HDFEOS5_PACKAGE@")
+  INCLUDE (${SELF_DIR}/@HDFEOS5_PACKAGE@@HDFEOS_PACKAGE_EXT at -targets.cmake)
+  SET (HDFEOS5_LIBRARIES "@HDFEOS_LIBRARIES_TO_EXPORT@")
+ENDIF (NOT TARGET "@HDFEOS5_PACKAGE@")
diff --git a/config/cmake/hdfeos5-config.cmake.install.in b/config/cmake/hdfeos5-config.cmake.install.in
new file mode 100644
index 0000000..ac8cda2
--- /dev/null
+++ b/config/cmake/hdfeos5-config.cmake.install.in
@@ -0,0 +1,54 @@
+#-----------------------------------------------------------------------------
+# HDFEOS5 Config file for compiling against HDFEOS5 install directory
+#-----------------------------------------------------------------------------
+GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${SELF_DIR}" PATH)
+GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+IF (NOT WIN32)
+  GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+ENDIF (NOT WIN32)
+
+#-----------------------------------------------------------------------------
+# User Options
+#-----------------------------------------------------------------------------
+SET (HDFEOS5_ENABLE_PARALLEL @HDFEOS5_ENABLE_PARALLEL@)
+SET (HDFEOS5_BUILD_TOOLS     @HDFEOS5_BUILD_TOOLS@)
+SET (HDFEOS5_ENABLE_Z_LIB_SUPPORT @HDFEOS5_ENABLE_Z_LIB_SUPPORT@)
+SET (HDFEOS5_ENABLE_SZIP_SUPPORT  @HDFEOS5_ENABLE_SZIP_SUPPORT@)
+SET (HDFEOS5_ENABLE_SZIP_ENCODING @HDFEOS5_ENABLE_SZIP_ENCODING@)
+SET (BUILD_SHARED_LIBS    @BUILD_SHARED_LIBS@)
+SET (HDFEOS5_PACKAGE_EXTLIBS @HDFEOS5_PACKAGE_EXTLIBS@)
+
+#-----------------------------------------------------------------------------
+# Directories
+#-----------------------------------------------------------------------------
+SET (HDFEOS5_INCLUDE_DIRS "${_IMPORT_PREFIX}/include")
+
+IF (HDFEOS5_BUILD_TOOLS)
+  SET (HDFEOS5_INCLUDE_DIR_TOOLS "${_IMPORT_PREFIX}/include")
+ENDIF (HDFEOS5_BUILD_TOOLS)
+
+#-----------------------------------------------------------------------------
+# Version Strings
+#-----------------------------------------------------------------------------
+SET (HDFEOS5_VERSION_STRING @HDFEOS5_VERSION_STRING@)
+SET (HDFEOS5_VERSION_MAJOR  @HDFEOS5_VERSION_MAJOR@)
+SET (HDFEOS5_VERSION_MINOR  @HDFEOS5_VERSION_MINOR@)
+
+#-----------------------------------------------------------------------------
+# Don't include targets if this file is being picked up by another
+# project which has already build HDFEOS5 as a subproject
+#-----------------------------------------------------------------------------
+IF (NOT TARGET "@HDFEOS5_PACKAGE@")
+  IF (HDFEOS5_ENABLE_Z_LIB_SUPPORT AND HDFEOS_PACKAGE_EXTLIBS AND NOT TARGET "zlib")
+    INCLUDE (${SELF_DIR}/../ZLIB/@ZLIB_PACKAGE_NAME@@HDFEOS_PACKAGE_EXT at -targets.cmake)
+  ENDIF (HDFEOS5_ENABLE_Z_LIB_SUPPORT AND HDFEOS_PACKAGE_EXTLIBS AND NOT TARGET "zlib")
+  IF (HDFEOS5_ENABLE_SZIP_SUPPORT AND HDFEOS_PACKAGE_EXTLIBS AND NOT TARGET "szip")
+    INCLUDE (${SELF_DIR}/../SZIP/@SZIP_PACKAGE_NAME@@HDFEOS_PACKAGE_EXT at -targets.cmake)
+  ENDIF (HDFEOS5_ENABLE_SZIP_SUPPORT AND HDFEOS_PACKAGE_EXTLIBS AND NOT TARGET "szip")
+  IF (HDFEOS5_PACKAGE_EXTLIBS AND NOT TARGET "hdf5")
+    INCLUDE (${SELF_DIR}/../hdf5/@HDF5_PACKAGE_NAME@@HDFEOS_PACKAGE_EXT at -targets.cmake)
+  ENDIF (HDFEOS5_PACKAGE_EXTLIBS AND NOT TARGET "hdf5")
+  INCLUDE (${SELF_DIR}/@HDFEOS5_PACKAGE@@HDFEOS_PACKAGE_EXT at -targets.cmake)
+  SET (HDFEOS5_LIBRARIES "@HDFEOS_LIBRARIES_TO_EXPORT@")
+ENDIF (NOT TARGET "@HDFEOS5_PACKAGE@")
diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake
new file mode 100644
index 0000000..8aadef4
--- /dev/null
+++ b/config/cmake/runTest.cmake
@@ -0,0 +1,108 @@
+# runTest.cmake executes a command and captures the output in a file. File is then compared
+# against a reference file. Exit status of command can also be compared.
+cmake_policy(SET CMP0007 NEW)
+
+# arguments checking
+IF (NOT TEST_PROGRAM)
+  MESSAGE (FATAL_ERROR "Require TEST_PROGRAM to be defined")
+ENDIF (NOT TEST_PROGRAM)
+#IF (NOT TEST_ARGS)
+#  MESSAGE (STATUS "Require TEST_ARGS to be defined")
+#ENDIF (NOT TEST_ARGS)
+IF (NOT TEST_FOLDER)
+  MESSAGE ( FATAL_ERROR "Require TEST_FOLDER to be defined")
+ENDIF (NOT TEST_FOLDER)
+IF (NOT TEST_OUTPUT)
+  MESSAGE (FATAL_ERROR "Require TEST_OUTPUT to be defined")
+ENDIF (NOT TEST_OUTPUT)
+#IF (NOT TEST_EXPECT)
+#  MESSAGE (STATUS "Require TEST_EXPECT to be defined")
+#ENDIF (NOT TEST_EXPECT)
+IF (NOT TEST_REFERENCE)
+  MESSAGE (FATAL_ERROR "Require TEST_REFERENCE to be defined")
+ENDIF (NOT TEST_REFERENCE)
+
+#SET (ERROR_APPEND 1)
+
+MESSAGE (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")
+
+# run the test program, capture the stdout/stderr and the result var
+EXECUTE_PROCESS (
+    COMMAND ${TEST_PROGRAM} ${TEST_ARGS}
+    WORKING_DIRECTORY ${TEST_FOLDER}
+    RESULT_VARIABLE TEST_RESULT
+    OUTPUT_FILE ${TEST_OUTPUT}
+    ERROR_FILE ${TEST_OUTPUT}.err
+    OUTPUT_VARIABLE TEST_ERROR
+    ERROR_VARIABLE TEST_ERROR
+)
+
+MESSAGE (STATUS "COMMAND Result: ${TEST_RESULT}")
+
+#IF (ERROR_APPEND)
+#  FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
+#  FILE (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") 
+#ENDIF (ERROR_APPEND)
+
+IF (TEST_APPEND)
+  FILE (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n") 
+ENDIF (TEST_APPEND)
+
+# if the return value is !=${TEST_EXPECT} bail out
+IF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT})
+  MESSAGE ( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}")
+ENDIF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT})
+
+MESSAGE (STATUS "COMMAND Error: ${TEST_ERROR}")
+
+IF (TEST_MASK)
+  FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
+  #STRING(REGEX REPLACE "Modified:[^\n]+\n" "Modified:  XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}") 
+  STRING(REGEX REPLACE "Storage:[^\n]+\n" "Storage:   <details removed for portability>\n" TEST_STREAM "${TEST_STREAM}") 
+  FILE (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
+ENDIF (TEST_MASK)
+
+IF (WIN32 AND NOT MINGW)
+  FILE (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
+  FILE (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
+ENDIF (WIN32 AND NOT MINGW)
+
+  # now compare the output with the reference
+  EXECUTE_PROCESS (
+      COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
+      RESULT_VARIABLE TEST_RESULT
+  )
+  IF (NOT ${TEST_RESULT} STREQUAL 0)
+  SET (TEST_RESULT 0)
+  FILE (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
+  LIST (LENGTH test_act len_act)
+  FILE (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
+  LIST (LENGTH test_ref len_ref)
+  IF (NOT ${len_act} STREQUAL "0")
+    MATH (EXPR _FP_LEN "${len_ref} - 1")
+    FOREACH (line RANGE 0 ${_FP_LEN})
+      LIST (GET test_act ${line} str_act)
+      LIST (GET test_ref ${line} str_ref)
+      IF (NOT "${str_act}" STREQUAL "${str_ref}")
+        IF (NOT "${str_act}" STREQUAL "")
+          SET (TEST_RESULT 1)
+          MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
+         ENDIF (NOT "${str_act}" STREQUAL "")
+      ENDIF (NOT "${str_act}" STREQUAL "${str_ref}")
+    ENDFOREACH (line RANGE 0 ${_FP_LEN})
+  ENDIF (NOT ${len_act} STREQUAL "0")
+  IF (NOT ${len_act} STREQUAL ${len_ref})
+    SET (TEST_RESULT 1)
+  ENDIF (NOT ${len_act} STREQUAL ${len_ref})
+  ENDIF (NOT ${TEST_RESULT} STREQUAL 0)
+
+  MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}")
+
+  # again, if return value is !=0 scream and shout
+  IF (NOT ${TEST_RESULT} STREQUAL 0)
+    MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}")
+  ENDIF (NOT ${TEST_RESULT} STREQUAL 0)
+  
+# everything went fine...
+MESSAGE ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}")
+
diff --git a/config/cmake/xlatefile.c b/config/cmake/xlatefile.c
new file mode 100644
index 0000000..e220289
--- /dev/null
+++ b/config/cmake/xlatefile.c
@@ -0,0 +1,56 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define BUFFERSIZE 1024
+
+int main(int argc, char *argv[]) {
+    FILE *infile = NULL;
+    FILE *outfile = NULL;
+    char *buffer = NULL;
+    char argbuf[8];
+    size_t bytes = 0;
+    size_t idx = 0;
+    unsigned int lineidx = 0;
+    unsigned int stripXlines = 3;
+   
+    if(argc < 3)
+        exit(1);
+    if(NULL == (infile = fopen(argv[1], "rb")))
+        exit(2);
+    if(NULL == (outfile = fopen(argv[2], "wb+")))
+        exit(3);
+    if(argc > 3)
+        if(argv[3][0] == '-')
+            if(argv[3][1] == 'l') {
+                strcpy(argbuf, &argv[3][2]);
+                stripXlines = atoi(argbuf);
+            }
+    buffer = (char*)malloc(BUFFERSIZE);
+    if(buffer) {
+        while(!feof(infile)) {
+            /* read the file into the buffer. */
+            bytes = fread(buffer, 1, BUFFERSIZE, infile);  
+            if(lineidx < stripXlines) {
+                for(idx = 0; idx < bytes; idx++) {
+                    if(buffer[idx] == '\n') {
+                        lineidx++;
+                        if(buffer[idx+1] == '\r')
+                            idx++;
+                    }
+                    if(lineidx >= stripXlines) {
+                        fwrite(&buffer[idx+1], 1, bytes-idx-1, outfile);
+                        idx = bytes;
+                    }
+                }
+            }
+            else
+                fwrite(buffer, 1, bytes, outfile);
+        }
+        free(buffer);
+    }
+    fclose(outfile);
+    fclose(infile);
+    
+    return 0;
+}
diff --git a/config/config.guess b/config/config.guess
new file mode 100755
index 0000000..917bbc5
--- /dev/null
+++ b/config/config.guess
@@ -0,0 +1,1463 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-08'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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 GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per at bothner.com>.
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi at noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[45])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep __LP64__ >/dev/null
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    i*:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    x86:Interix*:[34]*)
+	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+	exit ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-gnu
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#ifdef __INTEL_COMPILER
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	test x"${LIBC}" != x && {
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+		exit
+	}
+	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel at ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes at openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf at swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    *86) UNAME_PROCESSOR=i686 ;;
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches at gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config/config.sub b/config/config.sub
new file mode 100755
index 0000000..1c366df
--- /dev/null
+++ b/config/config.sub
@@ -0,0 +1,1579 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-08'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray)
+		os=
+		basic_machine=$1
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| ms1 \
+	| msp430 \
+	| ns16k | ns32k \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b \
+	| strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m32c)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| ms1-* \
+	| msp430-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	m32c-*)
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16c)
+		basic_machine=cr16c-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+        -os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+        -tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+    c4x-* | tic4x-*)
+        os=-coff
+        ;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+    	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config/depcomp b/config/depcomp
new file mode 100755
index 0000000..04701da
--- /dev/null
+++ b/config/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva at dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake at gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mecanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/config/include.am b/config/include.am
new file mode 100644
index 0000000..b82fae9
--- /dev/null
+++ b/config/include.am
@@ -0,0 +1,8 @@
+## config/include.am
+##
+## This file is included in the beginning of each Makefile.am.  It contains
+## shared definitions.
+
+LIBHDFEOS5=$(top_builddir)/src/libhe5_hdfeos.la
+LIBGCTP=$(top_builddir)/gctp/src/libGctp.la
+
diff --git a/config/install-sh b/config/install-sh
new file mode 100755
index 0000000..4d4a951
--- /dev/null
+++ b/config/install-sh
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+	shift
+	shift
+	continue;;
+
+    -T) no_target_directory=true
+	shift
+	continue;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+	# When -t is used, the destination is already specified.
+	test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+	for arg
+	do
+          if test -n "$dstarg"; then
+	    # $@ is not empty: it contains at least $arg.
+	    set fnord "$@" "$dstarg"
+	    shift # fnord
+	  fi
+	  shift # arg
+	  dstarg=$arg
+	done
+	break;;
+  esac
+done
+
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  else
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dstarg: Is a directory" >&2
+	exit 1
+      fi
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+	 '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    shift
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+	# mkdir can fail with a `File exist' error in case several
+	# install-sh are creating the directory concurrently.  This
+	# is OK.
+	test -d "$pathcomp" || exit
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Copy the file name to the temp name.
+    $doit $cpprog "$src" "$dsttmp" &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+      || {
+	   # The rename failed, perhaps because mv can't rename something else
+	   # to itself, or perhaps because mv is so ancient that it does not
+	   # support -f.
+
+	   # Now remove or move aside any old file at destination location.
+	   # We try this two ways since rm can't unlink itself on some
+	   # systems and the destination file might be busy for other
+	   # reasons.  In this case, the final cleanup might fail but the new
+	   # file should still install successfully.
+	   {
+	     if test -f "$dstdir/$dstfile"; then
+	       $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+	       || {
+		 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+		 (exit 1); exit 1
+	       }
+	     else
+	       :
+	     fi
+	   } &&
+
+	   # Now rename the file to the real destination.
+	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+	 }
+    }
+  fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+  (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/config/ltmain.sh b/config/ltmain.sh
new file mode 100644
index 0000000..fb79d8c
--- /dev/null
+++ b/config/ltmain.sh
@@ -0,0 +1,6402 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
+# Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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 GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+basename="s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+progname=`echo "$progpath" | $SED $basename`
+modename="$progname"
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.5.8
+TIMESTAMP=" (1.1220.2.117 2004/08/04 14:12:05)"
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes.
+if test -n "${ZSH_VERSION+set}" ; then
+  setopt NO_GLOB_SUBST
+fi
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell, and then maybe $echo will work.
+  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit $EXIT_SUCCESS
+fi
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo A|tr A '\301'` in
+ A) # EBCDIC based system
+  SP2NL="tr '\100' '\n'"
+  NL2SP="tr '\r\n' '\100\100'"
+  ;;
+ *) # Assume ASCII based system
+  SP2NL="tr '\040' '\012'"
+  NL2SP="tr '\015\012' '\040\040'"
+  ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+  save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+# Make sure IFS has a sensible default
+: ${IFS=" 	
+"}
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+  $echo "$modename: not configured to build any kind of library" 1>&2
+  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+  exit $EXIT_FAILURE
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid () {
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 | \
+	sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
+      if test "X$win32_nmres" = "Ximport" ; then
+        win32_libid_type="x86 archive import"
+      else
+        win32_libid_type="x86 archive static"
+      fi
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $echo $win32_libid_type
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag () {
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+	case $arg in
+	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	CC_quoted="$CC_quoted $arg"
+      done
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+	for z in $available_tags; do
+	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+	    CC_quoted=
+	    for arg in $CC; do
+	    # Double-quote args containing other shell metacharacters.
+	    case $arg in
+	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	      arg="\"$arg\""
+	      ;;
+	    esac
+	    CC_quoted="$CC_quoted $arg"
+	  done
+	    case "$@ " in
+	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
+	      # The compiler in the base compile command matches
+	      # the one in the tagged configuration.
+	      # Assume this is the tagged configuration we want.
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+	  fi
+	done
+	# If $tagname still isn't set, then no tagged configuration
+	# was found and let the user know that the "--tag" command
+	# line option must be used.
+	if test -z "$tagname"; then
+	  $echo "$modename: unable to infer tagged configuration"
+	  $echo "$modename: specify a tag with \`--tag'" 1>&2
+	  exit $EXIT_FAILURE
+#        else
+#          $echo "$modename: using $tagname tagged configuration"
+	fi
+	;;
+      esac
+    fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives () {
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+    my_status=""
+
+    $show "${rm}r $my_gentop"
+    $run ${rm}r "$my_gentop"
+    $show "$mkdir $my_gentop"
+    $run $mkdir "$my_gentop"
+    my_status=$?
+    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+      exit $my_status
+    fi
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+	*) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+      my_xdir="$my_gentop/$my_xlib"
+
+      $show "${rm}r $my_xdir"
+      $run ${rm}r "$my_xdir"
+      $show "$mkdir $my_xdir"
+      $run $mkdir "$my_xdir"
+      status=$?
+      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
+	exit $status
+      fi
+      case $host in
+      *-darwin*)
+	$show "Extracting $my_xabs"
+	# Do not bother doing anything if just a dry run
+	if test -z "$run"; then
+	  darwin_orig_dir=`pwd`
+	  cd $my_xdir || exit $?
+	  darwin_archive=$my_xabs
+	  darwin_curdir=`pwd`
+	  darwin_base_archive=`basename $darwin_archive`
+	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+	  if test -n "$darwin_arches"; then 
+	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+	    darwin_arch=
+	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
+	    for darwin_arch in  $darwin_arches ; do
+	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+	      # Remove the table of contents from the thin files.
+	      $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true
+	      $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true
+	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      $AR -xo "${darwin_base_archive}"
+	      rm "${darwin_base_archive}"
+	      cd "$darwin_curdir"
+	    done # $darwin_arches
+      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+	    darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP`
+	    darwin_file=
+	    darwin_files=
+	    for darwin_file in $darwin_filelist; do
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+	      lipo -create -output "$darwin_file" $darwin_files
+	    done # $darwin_filelist
+	    rm -rf unfat-$$
+	    cd "$darwin_orig_dir"
+	  else
+	    cd $darwin_orig_dir
+	    (cd $my_xdir && $AR x $my_xabs) || exit $?
+	  fi # $darwin_arches
+	fi # $run
+      ;;
+      *)
+	# We will extract separately just the conflicting names and we will
+	# no longer touch any unique names. It is faster to leave these
+	# extract automatically by $AR in one run.
+	$show "(cd $my_xdir && $AR x $my_xabs)"
+	$run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
+	if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
+	  :
+	else
+	  $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
+	  $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
+	  $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
+	  do
+	    i=1
+	    while test "$i" -le "$count"
+	    do
+	      # Put our $i before any first dot (extension)
+	      # Never overwrite any file
+	      name_to="$name"
+	      while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
+	      do
+		name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+	      done
+	      $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
+	      $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
+	      i=`expr $i + 1`
+	    done
+	  done
+	fi
+	;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+    done
+
+    func_extract_archives_result="$my_oldobjs"
+}
+# End of Shell function definitions
+#####################################
+
+# Darwin sucks
+eval std_shrext=\"$shrext_cmds\"
+
+# Parse our command line options once, thoroughly.
+while test "$#" -gt 0
+do
+  arg="$1"
+  shift
+
+  case $arg in
+  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$prev"; then
+    case $prev in
+    execute_dlfiles)
+      execute_dlfiles="$execute_dlfiles $arg"
+      ;;
+    tag)
+      tagname="$arg"
+      preserve_args="${preserve_args}=$arg"
+
+      # Check whether tagname contains only valid characters
+      case $tagname in
+      *[!-_A-Za-z0-9,/]*)
+	$echo "$progname: invalid tag name: $tagname" 1>&2
+	exit $EXIT_FAILURE
+	;;
+      esac
+
+      case $tagname in
+      CC)
+	# Don't test for the "default" C tag, as we know, it's there, but
+	# not specially marked.
+	;;
+      *)
+	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+	  taglist="$taglist $tagname"
+	  # Evaluate the configuration.
+	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+	else
+	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
+	fi
+	;;
+      esac
+      ;;
+    *)
+      eval "$prev=\$arg"
+      ;;
+    esac
+
+    prev=
+    prevopt=
+    continue
+  fi
+
+  # Have we seen a non-optional argument yet?
+  case $arg in
+  --help)
+    show_help=yes
+    ;;
+
+  --version)
+    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+    $echo
+    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
+    $echo "This is free software; see the source for copying conditions.  There is NO"
+    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+    exit $EXIT_SUCCESS
+    ;;
+
+  --config)
+    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+    done
+    exit $EXIT_SUCCESS
+    ;;
+
+  --debug)
+    $echo "$progname: enabling shell trace mode"
+    set -x
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --dry-run | -n)
+    run=:
+    ;;
+
+  --features)
+    $echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      $echo "enable shared libraries"
+    else
+      $echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      $echo "enable static libraries"
+    else
+      $echo "disable static libraries"
+    fi
+    exit $EXIT_SUCCESS
+    ;;
+
+  --finish) mode="finish" ;;
+
+  --mode) prevopt="--mode" prev=mode ;;
+  --mode=*) mode="$optarg" ;;
+
+  --preserve-dup-deps) duplicate_deps="yes" ;;
+
+  --quiet | --silent)
+    show=:
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --tag) prevopt="--tag" prev=tag ;;
+  --tag=*)
+    set tag "$optarg" ${1+"$@"}
+    shift
+    prev=tag
+    preserve_args="$preserve_args --tag"
+    ;;
+
+  -dlopen)
+    prevopt="-dlopen"
+    prev=execute_dlfiles
+    ;;
+
+  -*)
+    $echo "$modename: unrecognized option \`$arg'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+
+  *)
+    nonopt="$arg"
+    break
+    ;;
+  esac
+done
+
+if test -n "$prevopt"; then
+  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+fi
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+  # Infer the operation mode.
+  if test -z "$mode"; then
+    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
+    case $nonopt in
+    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+      mode=link
+      for arg
+      do
+	case $arg in
+	-c)
+	   mode=compile
+	   break
+	   ;;
+	esac
+      done
+      ;;
+    *db | *dbx | *strace | *truss)
+      mode=execute
+      ;;
+    *install*|cp|mv)
+      mode=install
+      ;;
+    *rm)
+      mode=uninstall
+      ;;
+    *)
+      # If we have no mode, but dlfiles were specified, then do execute mode.
+      test -n "$execute_dlfiles" && mode=execute
+
+      # Just use the default operation mode.
+      if test -z "$mode"; then
+	if test -n "$nonopt"; then
+	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+	else
+	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+	fi
+      fi
+      ;;
+    esac
+  fi
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$modename --help --mode=$mode' for more information."
+
+  # These modes are in order of execution frequency so that they run quickly.
+  case $mode in
+  # libtool compile mode
+  compile)
+    modename="$modename: compile"
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+
+    for arg
+    do
+      case "$arg_mode" in
+      arg  )
+	# do not "continue".  Instead, add this to base_compile
+	lastarg="$arg"
+	arg_mode=normal
+	;;
+
+      target )
+	libobj="$arg"
+	arg_mode=normal
+	continue
+	;;
+
+      normal )
+	# Accept any command-line options.
+	case $arg in
+	-o)
+	  if test -n "$libobj" ; then
+	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  arg_mode=target
+	  continue
+	  ;;
+
+	-static | -prefer-pic | -prefer-non-pic)
+	  later="$later $arg"
+	  continue
+	  ;;
+
+	-no-suppress)
+	  suppress_opt=no
+	  continue
+	  ;;
+
+	-Xcompiler)
+	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
+	  continue      #  The current "srcfile" will either be retained or
+	  ;;            #  replaced later.  I would guess that would be a bug.
+
+	-Wc,*)
+	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+	  lastarg=
+	  save_ifs="$IFS"; IFS=','
+ 	  for arg in $args; do
+	    IFS="$save_ifs"
+
+	    # Double-quote args containing other shell metacharacters.
+	    # Many Bourne shells cannot handle close brackets correctly
+	    # in scan sets, so we specify it separately.
+	    case $arg in
+	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	      arg="\"$arg\""
+	      ;;
+	    esac
+	    lastarg="$lastarg $arg"
+	  done
+	  IFS="$save_ifs"
+	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+	  # Add the arguments to base_compile.
+	  base_compile="$base_compile $lastarg"
+	  continue
+	  ;;
+
+	* )
+	  # Accept the current argument as the source file.
+	  # The previous "srcfile" becomes the current argument.
+	  #
+	  lastarg="$srcfile"
+	  srcfile="$arg"
+	  ;;
+	esac  #  case $arg
+	;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+      case $lastarg in
+      # Double-quote args containing other shell metacharacters.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	lastarg="\"$lastarg\""
+	;;
+      esac
+
+      base_compile="$base_compile $lastarg"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      $echo "$modename: you must specify an argument for -Xcompile"
+      exit $EXIT_FAILURE
+      ;;
+    target)
+      $echo "$modename: you must specify a target with \`-o'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *)
+      # Get the name of the library object.
+      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    xform='[cCFSifmso]'
+    case $libobj in
+    *.ada) xform=ada ;;
+    *.adb) xform=adb ;;
+    *.ads) xform=ads ;;
+    *.asm) xform=asm ;;
+    *.c++) xform=c++ ;;
+    *.cc) xform=cc ;;
+    *.ii) xform=ii ;;
+    *.class) xform=class ;;
+    *.cpp) xform=cpp ;;
+    *.cxx) xform=cxx ;;
+    *.f90) xform=f90 ;;
+    *.for) xform=for ;;
+    *.java) xform=java ;;
+    esac
+
+    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+    case $libobj in
+    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+    *)
+      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -static)
+	build_old_libs=yes
+	continue
+	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+      esac
+    done
+
+    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$xdir" = "X$obj"; then
+      xdir=
+    else
+      xdir=$xdir/
+    fi
+    lobj=${xdir}$objdir/$objname
+
+    if test -z "$base_compile"; then
+      $echo "$modename: you must specify a compilation command" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    $run $rm $removelist
+    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+      removelist="$removelist $output_obj $lockfile"
+      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+	$show "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+	$echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+      $echo $srcfile > "$lockfile"
+    fi
+
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
+
+    $run $rm "$libobj" "${libobj}T"
+
+    # Create a libtool object file (analogous to a ".la" file),
+    # but don't create it if we're doing a dry run.
+    test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+	command="$base_compile $srcfile $pic_flag"
+      else
+	# Don't build PIC code
+	command="$base_compile $srcfile"
+      fi
+
+      if test ! -d "${xdir}$objdir"; then
+	$show "$mkdir ${xdir}$objdir"
+	$run $mkdir ${xdir}$objdir
+	status=$?
+	if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
+	  exit $status
+	fi
+      fi
+
+      if test -z "$output_obj"; then
+	# Place PIC objects in $objdir
+	command="$command -o $lobj"
+      fi
+
+      $run $rm "$lobj" "$output_obj"
+
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+	test -n "$output_obj" && $run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+	$show "$mv $output_obj $lobj"
+	if $run $mv $output_obj $lobj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # Append the name of the PIC object to the libtool object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+        suppress_output=' >/dev/null 2>&1'
+      fi
+    else
+      # No PIC object so indicate it doesn't exist in the libtool
+      # object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+	# Don't build PIC code
+	command="$base_compile $srcfile"
+      else
+	command="$base_compile $srcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+	command="$command -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      command="$command$suppress_output"
+      $run $rm "$obj" "$output_obj"
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+	$show "$mv $output_obj $obj"
+	if $run $mv $output_obj $obj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+    else
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
+    fi
+
+    $run $mv "${libobj}T" "${libobj}"
+
+    # Unlock the critical section if it was locked
+    if test "$need_locks" != no; then
+      $run $rm "$lockfile"
+    fi
+
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool link mode
+  link | relink)
+    modename="$modename: link"
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args="$nonopt"
+    base_compile="$nonopt $@"
+    compile_command="$nonopt"
+    finalize_command="$nonopt"
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+
+    avoid_version=no
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -all-static | -static)
+	if test "X$arg" = "X-all-static"; then
+	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+	  fi
+	  if test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	else
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	fi
+	build_libtool_libs=no
+	build_old_libs=yes
+	prefer_static_libs=yes
+	break
+	;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+	;;
+      *) qarg=$arg ;;
+      esac
+      libtool_args="$libtool_args $qarg"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+	case $prev in
+	output)
+	  compile_command="$compile_command @OUTPUT@"
+	  finalize_command="$finalize_command @OUTPUT@"
+	  ;;
+	esac
+
+	case $prev in
+	dlfiles|dlprefiles)
+	  if test "$preload" = no; then
+	    # Add the symbol object into the linking commands.
+	    compile_command="$compile_command @SYMFILE@"
+	    finalize_command="$finalize_command @SYMFILE@"
+	    preload=yes
+	  fi
+	  case $arg in
+	  *.la | *.lo) ;;  # We handle these cases below.
+	  force)
+	    if test "$dlself" = no; then
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  self)
+	    if test "$prev" = dlprefiles; then
+	      dlself=yes
+	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+	      dlself=yes
+	    else
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  *)
+	    if test "$prev" = dlfiles; then
+	      dlfiles="$dlfiles $arg"
+	    else
+	      dlprefiles="$dlprefiles $arg"
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  esac
+	  ;;
+	expsyms)
+	  export_symbols="$arg"
+	  if test ! -f "$arg"; then
+	    $echo "$modename: symbol file \`$arg' does not exist"
+	    exit $EXIT_FAILURE
+	  fi
+	  prev=
+	  continue
+	  ;;
+	expsyms_regex)
+	  export_symbols_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	inst_prefix)
+	  inst_prefix_dir="$arg"
+	  prev=
+	  continue
+	  ;;
+	precious_regex)
+	  precious_files_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	release)
+	  release="-$arg"
+	  prev=
+	  continue
+	  ;;
+	objectlist)
+	  if test -f "$arg"; then
+	    save_arg=$arg
+	    moreargs=
+	    for fil in `cat $save_arg`
+	    do
+#	      moreargs="$moreargs $fil"
+	      arg=$fil
+	      # A libtool-controlled object.
+
+	      # Check to see that this really is a libtool object.
+	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+		pic_object=
+		non_pic_object=
+
+		# Read the .lo file
+		# If there is no directory component, then add one.
+		case $arg in
+		*/* | *\\*) . $arg ;;
+		*) . ./$arg ;;
+		esac
+
+		if test -z "$pic_object" || \
+		   test -z "$non_pic_object" ||
+		   test "$pic_object" = none && \
+		   test "$non_pic_object" = none; then
+		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+		  exit $EXIT_FAILURE
+		fi
+
+		# Extract subdirectory from the argument.
+		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+		if test "X$xdir" = "X$arg"; then
+		  xdir=
+		else
+		  xdir="$xdir/"
+		fi
+
+		if test "$pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  pic_object="$xdir$pic_object"
+
+		  if test "$prev" = dlfiles; then
+		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		      dlfiles="$dlfiles $pic_object"
+		      prev=
+		      continue
+		    else
+		      # If libtool objects are unsupported, then we need to preload.
+		      prev=dlprefiles
+		    fi
+		  fi
+
+		  # CHECK ME:  I think I busted this.  -Ossama
+		  if test "$prev" = dlprefiles; then
+		    # Preload the old-style object.
+		    dlprefiles="$dlprefiles $pic_object"
+		    prev=
+		  fi
+
+		  # A PIC object.
+		  libobjs="$libobjs $pic_object"
+		  arg="$pic_object"
+		fi
+
+		# Non-PIC object.
+		if test "$non_pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  non_pic_object="$xdir$non_pic_object"
+
+		  # A standard non-PIC object
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		  if test -z "$pic_object" || test "$pic_object" = none ; then
+		    arg="$non_pic_object"
+		  fi
+		fi
+	      else
+		# Only an error if not doing a dry-run.
+		if test -z "$run"; then
+		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+		  exit $EXIT_FAILURE
+		else
+		  # Dry-run case.
+
+		  # Extract subdirectory from the argument.
+		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+		  if test "X$xdir" = "X$arg"; then
+		    xdir=
+		  else
+		    xdir="$xdir/"
+		  fi
+
+		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+		  libobjs="$libobjs $pic_object"
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		fi
+	      fi
+	    done
+	  else
+	    $echo "$modename: link input file \`$save_arg' does not exist"
+	    exit $EXIT_FAILURE
+	  fi
+	  arg=$save_arg
+	  prev=
+	  continue
+	  ;;
+	rpath | xrpath)
+	  # We need an absolute path.
+	  case $arg in
+	  [\\/]* | [A-Za-z]:[\\/]*) ;;
+	  *)
+	    $echo "$modename: only absolute run-paths are allowed" 1>&2
+	    exit $EXIT_FAILURE
+	    ;;
+	  esac
+	  if test "$prev" = rpath; then
+	    case "$rpath " in
+	    *" $arg "*) ;;
+	    *) rpath="$rpath $arg" ;;
+	    esac
+	  else
+	    case "$xrpath " in
+	    *" $arg "*) ;;
+	    *) xrpath="$xrpath $arg" ;;
+	    esac
+	  fi
+	  prev=
+	  continue
+	  ;;
+	xcompiler)
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	xlinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $wl$qarg"
+	  prev=
+	  compile_command="$compile_command $wl$qarg"
+	  finalize_command="$finalize_command $wl$qarg"
+	  continue
+	  ;;
+	xcclinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	shrext)
+  	  shrext_cmds="$arg"
+	  prev=
+	  continue
+	  ;;
+	*)
+	  eval "$prev=\"\$arg\""
+	  prev=
+	  continue
+	  ;;
+	esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+	if test -n "$link_static_flag"; then
+	  compile_command="$compile_command $link_static_flag"
+	  finalize_command="$finalize_command $link_static_flag"
+	fi
+	continue
+	;;
+
+      -allow-undefined)
+	# FIXME: remove this flag sometime in the future.
+	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+	continue
+	;;
+
+      -avoid-version)
+	avoid_version=yes
+	continue
+	;;
+
+      -dlopen)
+	prev=dlfiles
+	continue
+	;;
+
+      -dlpreopen)
+	prev=dlprefiles
+	continue
+	;;
+
+      -export-dynamic)
+	export_dynamic=yes
+	continue
+	;;
+
+      -export-symbols | -export-symbols-regex)
+	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	  $echo "$modename: more than one -exported-symbols argument is not allowed"
+	  exit $EXIT_FAILURE
+	fi
+	if test "X$arg" = "X-export-symbols"; then
+	  prev=expsyms
+	else
+	  prev=expsyms_regex
+	fi
+	continue
+	;;
+
+      -inst-prefix-dir)
+	prev=inst_prefix
+	continue
+	;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+	case $with_gcc/$host in
+	no/*-*-irix* | /*-*-irix*)
+	  compile_command="$compile_command $arg"
+	  finalize_command="$finalize_command $arg"
+	  ;;
+	esac
+	continue
+	;;
+
+      -L*)
+	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  absdir=`cd "$dir" && pwd`
+	  if test -z "$absdir"; then
+	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  dir="$absdir"
+	  ;;
+	esac
+	case "$deplibs " in
+	*" -L$dir "*) ;;
+	*)
+	  deplibs="$deplibs -L$dir"
+	  lib_search_path="$lib_search_path $dir"
+	  ;;
+	esac
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  case :$dllsearchpath: in
+	  *":$dir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$dir";;
+	  esac
+	  ;;
+	esac
+	continue
+	;;
+
+      -l*)
+	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+	  case $host in
+	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
+	    # These systems don't actually have a C or math library (as such)
+	    continue
+	    ;;
+	  *-*-mingw* | *-*-os2*)
+	    # These systems don't actually have a C library (as such)
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-openbsd* | *-*-freebsd*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C and math libraries are in the System framework
+	    deplibs="$deplibs -framework System"
+	    continue
+	  esac
+	elif test "X$arg" = "X-lc_r"; then
+	 case $host in
+	 *-*-openbsd* | *-*-freebsd*)
+	   # Do not include libc_r directly, use -pthread flag.
+	   continue
+	   ;;
+	 esac
+	fi
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
+     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
+      -module)
+	module=yes
+	continue
+	;;
+
+      # gcc -m* arguments should be passed to the linker via $compiler_flags
+      # in order to pass architecture information to the linker
+      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
+      # but this is not reliable with gcc because gcc may use -mfoo to
+      # select a different linker, different libraries, etc, while
+      # -Wl,-mfoo simply passes -mfoo to the linker.
+      -m*)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+        compile_command="$compile_command $arg"
+        finalize_command="$finalize_command $arg"
+        if test "$with_gcc" = "yes" ; then
+          compiler_flags="$compiler_flags $arg"
+        fi
+        continue
+        ;;
+
+      -shrext)
+	prev=shrext
+	continue
+	;;
+
+      -no-fast-install)
+	fast_install=no
+	continue
+	;;
+
+      -no-install)
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  # The PATH hackery in wrapper scripts is required on Windows
+	  # in order for the loader to find any dlls it needs.
+	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+	  fast_install=no
+	  ;;
+	*) no_install=yes ;;
+	esac
+	continue
+	;;
+
+      -no-undefined)
+	allow_undefined=no
+	continue
+	;;
+
+      -objectlist)
+	prev=objectlist
+	continue
+	;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+	prev=precious_regex
+	continue
+	;;
+
+      -release)
+	prev=release
+	continue
+	;;
+
+      -rpath)
+	prev=rpath
+	continue
+	;;
+
+      -R)
+	prev=xrpath
+	continue
+	;;
+
+      -R*)
+	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  $echo "$modename: only absolute run-paths are allowed" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+	case "$xrpath " in
+	*" $dir "*) ;;
+	*) xrpath="$xrpath $dir" ;;
+	esac
+	continue
+	;;
+
+      -static)
+	# The effects of -static are defined in a previous loop.
+	# We used to do the same as -all-static on platforms that
+	# didn't have a PIC flag, but the assumption that the effects
+	# would be equivalent was wrong.  It would break on at least
+	# Digital Unix and AIX.
+	continue
+	;;
+
+      -thread-safe)
+	thread_safe=yes
+	continue
+	;;
+
+      -version-info)
+	prev=vinfo
+	continue
+	;;
+      -version-number)
+	prev=vinfo
+	vinfo_number=yes
+	continue
+	;;
+
+      -Wc,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case $flag in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Wl,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case $flag in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $wl$flag"
+	  linker_flags="$linker_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Xlinker)
+	prev=xlinker
+	continue
+	;;
+
+      -XCClinker)
+	prev=xcclinker
+	continue
+	;;
+
+      # Some other compiler flag.
+      -* | +*)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	;;
+
+      *.$objext)
+	# A standard object.
+	objs="$objs $arg"
+	;;
+
+      *.lo)
+	# A libtool-controlled object.
+
+	# Check to see that this really is a libtool object.
+	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  pic_object=
+	  non_pic_object=
+
+	  # Read the .lo file
+	  # If there is no directory component, then add one.
+	  case $arg in
+	  */* | *\\*) . $arg ;;
+	  *) . ./$arg ;;
+	  esac
+
+	  if test -z "$pic_object" || \
+	     test -z "$non_pic_object" ||
+	     test "$pic_object" = none && \
+	     test "$non_pic_object" = none; then
+	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  # Extract subdirectory from the argument.
+	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+	  if test "X$xdir" = "X$arg"; then
+	    xdir=
+ 	  else
+	    xdir="$xdir/"
+	  fi
+
+	  if test "$pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    pic_object="$xdir$pic_object"
+
+	    if test "$prev" = dlfiles; then
+	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		dlfiles="$dlfiles $pic_object"
+		prev=
+		continue
+	      else
+		# If libtool objects are unsupported, then we need to preload.
+		prev=dlprefiles
+	      fi
+	    fi
+
+	    # CHECK ME:  I think I busted this.  -Ossama
+	    if test "$prev" = dlprefiles; then
+	      # Preload the old-style object.
+	      dlprefiles="$dlprefiles $pic_object"
+	      prev=
+	    fi
+
+	    # A PIC object.
+	    libobjs="$libobjs $pic_object"
+	    arg="$pic_object"
+	  fi
+
+	  # Non-PIC object.
+	  if test "$non_pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    non_pic_object="$xdir$non_pic_object"
+
+	    # A standard non-PIC object
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	    if test -z "$pic_object" || test "$pic_object" = none ; then
+	      arg="$non_pic_object"
+	    fi
+	  fi
+	else
+	  # Only an error if not doing a dry-run.
+	  if test -z "$run"; then
+	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+	    exit $EXIT_FAILURE
+	  else
+	    # Dry-run case.
+
+	    # Extract subdirectory from the argument.
+	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+	    if test "X$xdir" = "X$arg"; then
+	      xdir=
+	    else
+	      xdir="$xdir/"
+	    fi
+
+	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+	    libobjs="$libobjs $pic_object"
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	  fi
+	fi
+	;;
+
+      *.$libext)
+	# An archive.
+	deplibs="$deplibs $arg"
+	old_deplibs="$old_deplibs $arg"
+	continue
+	;;
+
+      *.la)
+	# A libtool-controlled library.
+
+	if test "$prev" = dlfiles; then
+	  # This library was specified with -dlopen.
+	  dlfiles="$dlfiles $arg"
+	  prev=
+	elif test "$prev" = dlprefiles; then
+	  # The library was specified with -dlpreopen.
+	  dlprefiles="$dlprefiles $arg"
+	  prev=
+	else
+	  deplibs="$deplibs $arg"
+	fi
+	continue
+	;;
+
+      # Some other compiler argument.
+      *)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+      fi
+    done # argument parsing loop
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      compile_command="$compile_command $arg"
+      finalize_command="$finalize_command $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$output_objdir" = "X$output"; then
+      output_objdir="$objdir"
+    else
+      output_objdir="$output_objdir/$objdir"
+    fi
+    # Create the object directory.
+    if test ! -d "$output_objdir"; then
+      $show "$mkdir $output_objdir"
+      $run $mkdir $output_objdir
+      status=$?
+      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
+	exit $status
+      fi
+    fi
+
+    # Determine the type of output
+    case $output in
+    "")
+      $echo "$modename: you must specify an output file" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    case $host in
+    *cygwin* | *mingw* | *pw32*)
+      # don't eliminate duplications in $postdeps and $predeps
+      duplicate_compiler_generated_deps=yes
+      ;;
+    *)
+      duplicate_compiler_generated_deps=$duplicate_deps
+      ;;
+    esac
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if test "X$duplicate_deps" = "Xyes" ; then
+	case "$libs " in
+	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	esac
+      fi
+      libs="$libs $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
+	for pre_post_dep in $predeps $postdeps; do
+	  case "$pre_post_deps " in
+	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+	  esac
+	  pre_post_deps="$pre_post_deps $pre_post_dep"
+	done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    notinst_path= # paths that contain not-installed libtool libraries
+    case $linkmode in
+    lib)
+	passes="conv link"
+	for file in $dlfiles $dlprefiles; do
+	  case $file in
+	  *.la) ;;
+	  *)
+	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+	    exit $EXIT_FAILURE
+	    ;;
+	  esac
+	done
+	;;
+    prog)
+	compile_deplibs=
+	finalize_deplibs=
+	alldeplibs=no
+	newdlfiles=
+	newdlprefiles=
+	passes="conv scan dlopen dlpreopen link"
+	;;
+    *)  passes="conv"
+	;;
+    esac
+    for pass in $passes; do
+      if test "$linkmode,$pass" = "lib,link" ||
+	 test "$linkmode,$pass" = "prog,scan"; then
+	libs="$deplibs"
+	deplibs=
+      fi
+      if test "$linkmode" = prog; then
+	case $pass in
+	dlopen) libs="$dlfiles" ;;
+	dlpreopen) libs="$dlprefiles" ;;
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+	esac
+      fi
+      if test "$pass" = dlopen; then
+	# Collect dlpreopened libraries
+	save_deplibs="$deplibs"
+	deplibs=
+      fi
+      for deplib in $libs; do
+	lib=
+	found=no
+	case $deplib in
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    deplibs="$deplib $deplibs"
+	  fi
+	  continue
+	  ;;
+	-l*)
+	  if test "$linkmode" != lib && test "$linkmode" != prog; then
+	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+	    continue
+	  fi
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+	    for search_ext in .la $std_shrext .so .a; do
+	      # Search the libtool library
+	      lib="$searchdir/lib${name}${search_ext}"
+	      if test -f "$lib"; then
+		if test "$search_ext" = ".la"; then
+		  found=yes
+		else
+		  found=no
+		fi
+		break 2
+	      fi
+	    done
+	  done
+	  if test "$found" != yes; then
+	    # deplib doesn't seem to be a libtool library
+	    if test "$linkmode,$pass" = "prog,link"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
+	  else # deplib is a libtool library
+	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+	    # We need to do some special things here, and not later.
+	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	      case " $predeps $postdeps " in
+	      *" $deplib "*)
+		if (${SED} -e '2q' $lib |
+                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+		  library_names=
+		  old_library=
+		  case $lib in
+		  */* | *\\*) . $lib ;;
+		  *) . ./$lib ;;
+		  esac
+		  for l in $old_library $library_names; do
+		    ll="$l"
+		  done
+		  if test "X$ll" = "X$old_library" ; then # only static version available
+		    found=no
+		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+		    test "X$ladir" = "X$lib" && ladir="."
+		    lib=$ladir/$old_library
+		    if test "$linkmode,$pass" = "prog,link"; then
+		      compile_deplibs="$deplib $compile_deplibs"
+		      finalize_deplibs="$deplib $finalize_deplibs"
+		    else
+		      deplibs="$deplib $deplibs"
+		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+		    fi
+		    continue
+		  fi
+		fi
+	        ;;
+	      *) ;;
+	      esac
+	    fi
+	  fi
+	  ;; # -l
+	-L*)
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test "$pass" = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    ;;
+	  prog)
+	    if test "$pass" = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test "$pass" = scan; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    ;;
+	  *)
+	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+	    ;;
+	  esac # linkmode
+	  continue
+	  ;; # -L
+	-R*)
+	  if test "$pass" = link; then
+	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+	    # Make sure the xrpath contains only unique directories.
+	    case "$xrpath " in
+	    *" $dir "*) ;;
+	    *) xrpath="$xrpath $dir" ;;
+	    esac
+	  fi
+	  deplibs="$deplib $deplibs"
+	  continue
+	  ;;
+	*.la) lib="$deplib" ;;
+	*.$libext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  case $linkmode in
+	  lib)
+	    valid_a_lib=no
+	    case $deplibs_check_method in
+	      match_pattern*)
+		set dummy $deplibs_check_method
+	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+		if eval $echo \"$deplib\" 2>/dev/null \
+		    | $SED 10q \
+		    | $EGREP "$match_pattern_regex" > /dev/null; then
+		  valid_a_lib=yes
+		fi
+		;;
+	      pass_all)
+		valid_a_lib=yes
+		;;
+            esac
+	    if test "$valid_a_lib" != yes; then
+	      $echo
+	      $echo "*** Warning: Trying to link with static lib archive $deplib."
+	      $echo "*** I have the capability to make that library automatically link in when"
+	      $echo "*** you link to this library.  But I can only do this if you have a"
+	      $echo "*** shared version of the library, which you do not appear to have"
+	      $echo "*** because the file extensions .$libext of this argument makes me believe"
+	      $echo "*** that it is just a static archive that I should not used here."
+	    else
+	      $echo
+	      $echo "*** Warning: Linking the shared library $output against the"
+	      $echo "*** static library $deplib is not portable!"
+	      deplibs="$deplib $deplibs"
+	    fi
+	    continue
+	    ;;
+	  prog)
+	    if test "$pass" != link; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    continue
+	    ;;
+	  esac # linkmode
+	  ;; # *.$libext
+	*.lo | *.$objext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	  elif test "$linkmode" = prog; then
+	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	      # If there is no dlopen support or we're linking statically,
+	      # we need to preload.
+	      newdlprefiles="$newdlprefiles $deplib"
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      newdlfiles="$newdlfiles $deplib"
+	    fi
+	  fi
+	  continue
+	  ;;
+	%DEPLIBS%)
+	  alldeplibs=yes
+	  continue
+	  ;;
+	esac # case $deplib
+	if test "$found" = yes || test -f "$lib"; then :
+	else
+	  $echo "$modename: cannot find the library \`$lib'" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$ladir" = "X$lib" && ladir="."
+
+	dlname=
+	dlopen=
+	dlpreopen=
+	libdir=
+	library_names=
+	old_library=
+	# If the library was installed with an old release of libtool,
+	# it will not redefine variables installed, or shouldnotlink
+	installed=yes
+	shouldnotlink=no
+
+	# Read the .la file
+	case $lib in
+	*/* | *\\*) . $lib ;;
+	*) . ./$lib ;;
+	esac
+
+	if test "$linkmode,$pass" = "lib,link" ||
+	   test "$linkmode,$pass" = "prog,scan" ||
+	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+	fi
+
+	if test "$pass" = conv; then
+	  # Only check for convenience libraries
+	  deplibs="$lib $deplibs"
+	  if test -z "$libdir"; then
+	    if test -z "$old_library"; then
+	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	      exit $EXIT_FAILURE
+	    fi
+	    # It is a libtool convenience library, so add in its objects.
+	    convenience="$convenience $ladir/$objdir/$old_library"
+	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	    tmp_libs=
+	    for deplib in $dependency_libs; do
+	      deplibs="$deplib $deplibs"
+              if test "X$duplicate_deps" = "Xyes" ; then
+	        case "$tmp_libs " in
+	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	        esac
+              fi
+	      tmp_libs="$tmp_libs $deplib"
+	    done
+	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
+	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  continue
+	fi # $pass = conv
+
+
+	# Get the name of the library we link against.
+	linklib=
+	for l in $old_library $library_names; do
+	  linklib="$l"
+	done
+	if test -z "$linklib"; then
+	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# This library was specified with -dlopen.
+	if test "$pass" = dlopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  if test -z "$dlname" ||
+	     test "$dlopen_support" != yes ||
+	     test "$build_libtool_libs" = no; then
+	    # If there is no dlname, no dlopen support or we're linking
+	    # statically, we need to preload.  We also need to preload any
+	    # dependent libraries so libltdl's deplib preloader doesn't
+	    # bomb out in the load deplibs phase.
+	    dlprefiles="$dlprefiles $lib $dependency_libs"
+	  else
+	    newdlfiles="$newdlfiles $lib"
+	  fi
+	  continue
+	fi # $pass = dlopen
+
+	# We need an absolute path.
+	case $ladir in
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	*)
+	  abs_ladir=`cd "$ladir" && pwd`
+	  if test -z "$abs_ladir"; then
+	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+	    abs_ladir="$ladir"
+	  fi
+	  ;;
+	esac
+	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+	# Find the relevant object directory and library name.
+	if test "X$installed" = Xyes; then
+	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	  else
+	    dir="$libdir"
+	    absdir="$libdir"
+	  fi
+	else
+	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  else
+	    dir="$ladir/$objdir"
+	    absdir="$abs_ladir/$objdir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  fi
+	fi # $installed = yes
+	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+	# This library was specified with -dlpreopen.
+	if test "$pass" = dlpreopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  # Prefer using a static library (so that no silly _DYNAMIC symbols
+	  # are required to link).
+	  if test -n "$old_library"; then
+	    newdlprefiles="$newdlprefiles $dir/$old_library"
+	  # Otherwise, use the dlname, so that lt_dlopen finds it.
+	  elif test -n "$dlname"; then
+	    newdlprefiles="$newdlprefiles $dir/$dlname"
+	  else
+	    newdlprefiles="$newdlprefiles $dir/$linklib"
+	  fi
+	fi # $pass = dlpreopen
+
+	if test -z "$libdir"; then
+	  # Link the convenience library
+	  if test "$linkmode" = lib; then
+	    deplibs="$dir/$old_library $deplibs"
+	  elif test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$dir/$old_library $compile_deplibs"
+	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
+	  else
+	    deplibs="$lib $deplibs" # used for prog,scan pass
+	  fi
+	  continue
+	fi
+
+
+	if test "$linkmode" = prog && test "$pass" != link; then
+	  newlib_search_path="$newlib_search_path $ladir"
+	  deplibs="$lib $deplibs"
+
+	  linkalldeplibs=no
+	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
+	     test "$build_libtool_libs" = no; then
+	    linkalldeplibs=yes
+	  fi
+
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    case $deplib in
+	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+	    esac
+	    # Need to link against all dependency_libs?
+	    if test "$linkalldeplibs" = yes; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      # Need to hardcode shared library paths
+	      # or/and link against static libraries
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    if test "X$duplicate_deps" = "Xyes" ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done # for deplib
+	  continue
+	fi # $linkmode = prog...
+
+	if test "$linkmode,$pass" = "prog,link"; then
+	  if test -n "$library_names" &&
+	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+	    # We need to hardcode the library path
+	    if test -n "$shlibpath_var"; then
+	      # Make sure the rpath contains only unique directories.
+	      case "$temp_rpath " in
+	      *" $dir "*) ;;
+	      *" $absdir "*) ;;
+	      *) temp_rpath="$temp_rpath $dir" ;;
+	      esac
+	    fi
+
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi # $linkmode,$pass = prog,link...
+
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+	fi
+
+	link_static=no # Whether the deplib will be linked statically
+	if test -n "$library_names" &&
+	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+	  if test "$installed" = no; then
+	    notinst_deplibs="$notinst_deplibs $lib"
+	    need_relink=yes
+	  fi
+	  # This is a shared library
+
+	  # Warn about portability, can't link against -module's on
+	  # some systems (darwin)
+	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
+	    $echo
+	    if test "$linkmode" = prog; then
+	      $echo "*** Warning: Linking the executable $output against the loadable module"
+	    else
+	      $echo "*** Warning: Linking the shared library $output against the loadable module"
+	    fi
+	    $echo "*** $linklib is not portable!"
+	  fi
+	  if test "$linkmode" = lib &&
+	     test "$hardcode_into_libs" = yes; then
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi
+
+	  if test -n "$old_archive_from_expsyms_cmds"; then
+	    # figure out the soname
+	    set dummy $library_names
+	    realname="$2"
+	    shift; shift
+	    libname=`eval \\$echo \"$libname_spec\"`
+	    # use dlname if we got it. it's perfectly good, no?
+	    if test -n "$dlname"; then
+	      soname="$dlname"
+	    elif test -n "$soname_spec"; then
+	      # bleh windows
+	      case $host in
+	      *cygwin* | mingw*)
+		major=`expr $current - $age`
+		versuffix="-$major"
+		;;
+	      esac
+	      eval soname=\"$soname_spec\"
+	    else
+	      soname="$realname"
+	    fi
+
+	    # Make a new name for the extract_expsyms_cmds to use
+	    soroot="$soname"
+	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+	    # If the library has no export list, then create one now
+	    if test -f "$output_objdir/$soname-def"; then :
+	    else
+	      $show "extracting exported symbol list from \`$soname'"
+	      save_ifs="$IFS"; IFS='~'
+	      cmds=$extract_expsyms_cmds
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    # Create $newlib
+	    if test -f "$output_objdir/$newlib"; then :; else
+	      $show "generating import library for \`$soname'"
+	      save_ifs="$IFS"; IFS='~'
+	      cmds=$old_archive_from_expsyms_cmds
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # make sure the library variables are pointing to the new library
+	    dir=$output_objdir
+	    linklib=$newlib
+	  fi # test -n "$old_archive_from_expsyms_cmds"
+
+	  if test "$linkmode" = prog || test "$mode" != relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    lib_linked=yes
+	    case $hardcode_action in
+	    immediate | unsupported)
+	      if test "$hardcode_direct" = no; then
+		add="$dir/$linklib"
+		case $host in
+		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
+		  *-*-darwin* )
+		    # if the lib is a module then we can not link against
+		    # it, someone is ignoring the new warnings I added
+		    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
+		      $echo "** Warning, lib $linklib is a module, not a shared library"
+		      if test -z "$old_library" ; then
+		        $echo
+		        $echo "** And there doesn't seem to be a static archive available"
+		        $echo "** The link will probably fail, sorry"
+		      else
+		        add="$dir/$old_library"
+		      fi
+		    fi
+		esac
+	      elif test "$hardcode_minus_L" = no; then
+		case $host in
+		*-*-sunos*) add_shlibpath="$dir" ;;
+		esac
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = no; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    relink)
+	      if test "$hardcode_direct" = yes; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = yes; then
+		add_dir="-L$dir"
+		# Try looking first in the location we're being installed to.
+		if test -n "$inst_prefix_dir"; then
+		  case "$libdir" in
+		    [\\/]*)
+		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		      ;;
+		  esac
+		fi
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = yes; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    *) lib_linked=no ;;
+	    esac
+
+	    if test "$lib_linked" != yes; then
+	      $echo "$modename: configuration error: unsupported hardcode properties"
+	      exit $EXIT_FAILURE
+	    fi
+
+	    if test -n "$add_shlibpath"; then
+	      case :$compile_shlibpath: in
+	      *":$add_shlibpath:"*) ;;
+	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+	      esac
+	    fi
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	      if test "$hardcode_direct" != yes && \
+		 test "$hardcode_minus_L" != yes && \
+		 test "$hardcode_shlibpath_var" = yes; then
+		case :$finalize_shlibpath: in
+		*":$libdir:"*) ;;
+		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+		esac
+	      fi
+	    fi
+	  fi
+
+	  if test "$linkmode" = prog || test "$mode" = relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    # Finalize command for both is simple: just hardcode it.
+	    if test "$hardcode_direct" = yes; then
+	      add="$libdir/$linklib"
+	    elif test "$hardcode_minus_L" = yes; then
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    elif test "$hardcode_shlibpath_var" = yes; then
+	      case :$finalize_shlibpath: in
+	      *":$libdir:"*) ;;
+	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+	      esac
+	      add="-l$name"
+	    elif test "$hardcode_automatic" = yes; then
+	      if test -n "$inst_prefix_dir" &&
+		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
+	        add="$inst_prefix_dir$libdir/$linklib"
+	      else
+	        add="$libdir/$linklib"
+	      fi
+	    else
+	      # We cannot seem to hardcode it, guess we'll fake it.
+	      add_dir="-L$libdir"
+	      # Try looking first in the location we're being installed to.
+	      if test -n "$inst_prefix_dir"; then
+		case "$libdir" in
+		  [\\/]*)
+		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		    ;;
+		esac
+	      fi
+	      add="-l$name"
+	    fi
+
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	    fi
+	  fi
+	elif test "$linkmode" = prog; then
+	  # Here we assume that one of hardcode_direct or hardcode_minus_L
+	  # is not unsupported.  This is valid on all known static and
+	  # shared platforms.
+	  if test "$hardcode_direct" != unsupported; then
+	    test -n "$old_library" && linklib="$old_library"
+	    compile_deplibs="$dir/$linklib $compile_deplibs"
+	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
+	  else
+	    compile_deplibs="-l$name -L$dir $compile_deplibs"
+	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+	  fi
+	elif test "$build_libtool_libs" = yes; then
+	  # Not a shared library
+	  if test "$deplibs_check_method" != pass_all; then
+	    # We're trying link a shared library against a static one
+	    # but the system doesn't support it.
+
+	    # Just print a warning and add the library to dependency_libs so
+	    # that the program can be linked against the static library.
+	    $echo
+	    $echo "*** Warning: This system can not link to static lib archive $lib."
+	    $echo "*** I have the capability to make that library automatically link in when"
+	    $echo "*** you link to this library.  But I can only do this if you have a"
+	    $echo "*** shared version of the library, which you do not appear to have."
+	    if test "$module" = yes; then
+	      $echo "*** But as you try to build a module library, libtool will still create "
+	      $echo "*** a static module, that should work as long as the dlopening application"
+	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      if test -z "$global_symbol_pipe"; then
+		$echo
+		$echo "*** However, this would only work if libtool was able to extract symbol"
+		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		$echo "*** not find such a program.  So, this module is probably useless."
+		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	      fi
+	      if test "$build_old_libs" = no; then
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  else
+	    convenience="$convenience $dir/$old_library"
+	    old_convenience="$old_convenience $dir/$old_library"
+	    deplibs="$dir/$old_library $deplibs"
+	    link_static=yes
+	  fi
+	fi # link shared/static library?
+
+	if test "$linkmode" = lib; then
+	  if test -n "$dependency_libs" &&
+	     { test "$hardcode_into_libs" != yes ||
+	       test "$build_old_libs" = yes ||
+	       test "$link_static" = yes; }; then
+	    # Extract -R from dependency_libs
+	    temp_deplibs=
+	    for libdir in $dependency_libs; do
+	      case $libdir in
+	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+		   case " $xrpath " in
+		   *" $temp_xrpath "*) ;;
+		   *) xrpath="$xrpath $temp_xrpath";;
+		   esac;;
+	      *) temp_deplibs="$temp_deplibs $libdir";;
+	      esac
+	    done
+	    dependency_libs="$temp_deplibs"
+	  fi
+
+	  newlib_search_path="$newlib_search_path $absdir"
+	  # Link against this library
+	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  # ... and its dependency_libs
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    newdependency_libs="$deplib $newdependency_libs"
+	    if test "X$duplicate_deps" = "Xyes" ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done
+
+	  if test "$link_all_deplibs" != no; then
+	    # Add the search paths of all dependency libraries
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      -L*) path="$deplib" ;;
+	      *.la)
+		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+		test "X$dir" = "X$deplib" && dir="."
+		# We need an absolute path.
+		case $dir in
+		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		*)
+		  absdir=`cd "$dir" && pwd`
+		  if test -z "$absdir"; then
+		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+		    absdir="$dir"
+		  fi
+		  ;;
+		esac
+		if grep "^installed=no" $deplib > /dev/null; then
+		  path="$absdir/$objdir"
+		else
+		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  if test -z "$libdir"; then
+		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		    exit $EXIT_FAILURE
+		  fi
+		  if test "$absdir" != "$libdir"; then
+		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+		  fi
+		  path="$absdir"
+		fi
+		depdepl=
+		case $host in
+		*-*-darwin*)
+		  # we do not want to link against static libs,
+		  # but need to link against shared
+		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+		  if test -n "$deplibrary_names" ; then
+		    for tmp in $deplibrary_names ; do
+		      depdepl=$tmp
+		    done
+		    if test -f "$path/$depdepl" ; then
+		      depdepl="$path/$depdepl"
+		    fi
+		    # do not add paths which are already there
+		    case " $newlib_search_path " in
+		    *" $path "*) ;;
+		    *) newlib_search_path="$newlib_search_path $path";;
+		    esac
+		  fi
+		  path=""
+		  ;;
+		*)
+		  path="-L$path"
+		  ;;
+		esac
+		;;
+	      -l*)
+		case $host in
+		*-*-darwin*)
+		  # Again, we only want to link against shared libraries
+		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+		  for tmp in $newlib_search_path ; do
+		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
+		      eval depdepl="$tmp/lib$tmp_libs.dylib"
+		      break
+		    fi
+		  done
+		  path=""
+		  ;;
+		*) continue ;;
+		esac
+		;;
+	      *) continue ;;
+	      esac
+	      case " $deplibs " in
+	      *" $depdepl "*) ;;
+	      *) deplibs="$depdepl $deplibs" ;;
+	      esac
+	      case " $deplibs " in
+	      *" $path "*) ;;
+	      *) deplibs="$deplibs $path" ;;
+	      esac
+	    done
+	  fi # link_all_deplibs != no
+	fi # linkmode = lib
+      done # for deplib in $libs
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+	# Link the dlpreopened libraries before other libraries
+	for deplib in $save_deplibs; do
+	  deplibs="$deplib $deplibs"
+	done
+      fi
+      if test "$pass" != dlopen; then
+	if test "$pass" != conv; then
+	  # Make sure lib_search_path contains only unique directories.
+	  lib_search_path=
+	  for dir in $newlib_search_path; do
+	    case "$lib_search_path " in
+	    *" $dir "*) ;;
+	    *) lib_search_path="$lib_search_path $dir" ;;
+	    esac
+	  done
+	  newlib_search_path=
+	fi
+
+	if test "$linkmode,$pass" != "prog,link"; then
+	  vars="deplibs"
+	else
+	  vars="compile_deplibs finalize_deplibs"
+	fi
+	for var in $vars dependency_libs; do
+	  # Add libraries to $var in reverse order
+	  eval tmp_libs=\"\$$var\"
+	  new_libs=
+	  for deplib in $tmp_libs; do
+	    # FIXME: Pedantically, this is the right thing to do, so
+	    #        that some nasty dependency loop isn't accidentally
+	    #        broken:
+	    #new_libs="$deplib $new_libs"
+	    # Pragmatically, this seems to cause very few problems in
+	    # practice:
+	    case $deplib in
+	    -L*) new_libs="$deplib $new_libs" ;;
+	    -R*) ;;
+	    *)
+	      # And here is the reason: when a library appears more
+	      # than once as an explicit dependence of a library, or
+	      # is implicitly linked in more than once by the
+	      # compiler, it is considered special, and multiple
+	      # occurrences thereof are not removed.  Compare this
+	      # with having the same library being listed as a
+	      # dependency of multiple other libraries: in this case,
+	      # we know (pedantically, we assume) the library does not
+	      # need to be listed more than once, so we keep only the
+	      # last copy.  This is not always right, but it is rare
+	      # enough that we require users that really mean to play
+	      # such unportable linking tricks to link the library
+	      # using -Wl,-lname, so that libtool does not consider it
+	      # for duplicate removal.
+	      case " $specialdeplibs " in
+	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *)
+		case " $new_libs " in
+		*" $deplib "*) ;;
+		*) new_libs="$deplib $new_libs" ;;
+		esac
+		;;
+	      esac
+	      ;;
+	    esac
+	  done
+	  tmp_libs=
+	  for deplib in $new_libs; do
+	    case $deplib in
+	    -L*)
+	      case " $tmp_libs " in
+	      *" $deplib "*) ;;
+	      *) tmp_libs="$tmp_libs $deplib" ;;
+	      esac
+	      ;;
+	    *) tmp_libs="$tmp_libs $deplib" ;;
+	    esac
+	  done
+	  eval $var=\"$tmp_libs\"
+	done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+	case " $predeps $postdeps $compiler_lib_search_path " in
+	*" $i "*)
+	  i=""
+	  ;;
+	esac
+	if test -n "$i" ; then
+	  tmp_libs="$tmp_libs $i"
+	fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$deplibs"; then
+	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+      fi
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      objs="$objs$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+	eval shared_ext=\"$shrext_cmds\"
+	eval libname=\"$libname_spec\"
+	;;
+      *)
+	if test "$module" = no; then
+	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+	if test "$need_lib_prefix" != no; then
+	  # Add the "lib" prefix for modules if required
+	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+	  eval shared_ext=\"$shrext_cmds\"
+	  eval libname=\"$libname_spec\"
+	else
+	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+	fi
+	;;
+      esac
+
+      if test -n "$objs"; then
+	if test "$deplibs_check_method" != pass_all; then
+	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+	  exit $EXIT_FAILURE
+	else
+	  $echo
+	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
+	  $echo "*** objects $objs is not portable!"
+	  libobjs="$libobjs $objs"
+	fi
+      fi
+
+      if test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+      fi
+
+      set dummy $rpath
+      if test "$#" -gt 2; then
+	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+      fi
+      install_libdir="$2"
+
+      oldlibs=
+      if test -z "$rpath"; then
+	if test "$build_libtool_libs" = yes; then
+	  # Building a libtool convenience library.
+	  # Some compilers have problems with a `.al' extension so
+	  # convenience libraries should have the same extension an
+	  # archive normally would.
+	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
+	  build_libtool_libs=convenience
+	  build_old_libs=yes
+	fi
+
+	if test -n "$vinfo"; then
+	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
+	fi
+
+	if test -n "$release"; then
+	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+	fi
+      else
+
+	# Parse the version information argument.
+	save_ifs="$IFS"; IFS=':'
+	set dummy $vinfo 0 0 0
+	IFS="$save_ifs"
+
+	if test -n "$8"; then
+	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# convert absolute version numbers to libtool ages
+	# this retains compatibility with .la files and attempts
+	# to make the code below a bit more comprehensible
+
+	case $vinfo_number in
+	yes)
+	  number_major="$2"
+	  number_minor="$3"
+	  number_revision="$4"
+	  #
+	  # There are really only two kinds -- those that
+	  # use the current revision as the major version
+	  # and those that subtract age and use age as
+	  # a minor version.  But, then there is irix
+	  # which has an extra 1 added just for fun
+	  #
+	  case $version_type in
+	  darwin|linux|osf|windows)
+	    current=`expr $number_major + $number_minor`
+	    age="$number_minor"
+	    revision="$number_revision"
+	    ;;
+	  freebsd-aout|freebsd-elf|sunos)
+	    current="$number_major"
+	    revision="$number_minor"
+	    age="0"
+	    ;;
+	  irix|nonstopux)
+	    current=`expr $number_major + $number_minor - 1`
+	    age="$number_minor"
+	    revision="$number_minor"
+	    ;;
+	  esac
+	  ;;
+	no)
+	  current="$2"
+	  revision="$3"
+	  age="$4"
+	  ;;
+	esac
+
+	# Check that each of the things are valid numbers.
+	case $current in
+	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	case $revision in
+	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	case $age in
+	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	if test "$age" -gt "$current"; then
+	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Calculate the version variables.
+	major=
+	versuffix=
+	verstring=
+	case $version_type in
+	none) ;;
+
+	darwin)
+	  # Like Linux, but with the current version available in
+	  # verstring for coding it into the library header
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  # Darwin ld doesn't like 0 for these options...
+	  minor_current=`expr $current + 1`
+	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  ;;
+
+	freebsd-aout)
+	  major=".$current"
+	  versuffix=".$current.$revision";
+	  ;;
+
+	freebsd-elf)
+	  major=".$current"
+	  versuffix=".$current";
+	  ;;
+
+	irix | nonstopux)
+	  major=`expr $current - $age + 1`
+
+	  case $version_type in
+	    nonstopux) verstring_prefix=nonstopux ;;
+	    *)         verstring_prefix=sgi ;;
+	  esac
+	  verstring="$verstring_prefix$major.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$revision
+	  while test "$loop" -ne 0; do
+	    iface=`expr $revision - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring_prefix$major.$iface:$verstring"
+	  done
+
+	  # Before this point, $major must not contain `.'.
+	  major=.$major
+	  versuffix="$major.$revision"
+	  ;;
+
+	linux)
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  ;;
+
+	osf)
+	  major=.`expr $current - $age`
+	  versuffix=".$current.$age.$revision"
+	  verstring="$current.$age.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$age
+	  while test "$loop" -ne 0; do
+	    iface=`expr $current - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring:${iface}.0"
+	  done
+
+	  # Make executables depend on our current version.
+	  verstring="$verstring:${current}.0"
+	  ;;
+
+	sunos)
+	  major=".$current"
+	  versuffix=".$current.$revision"
+	  ;;
+
+	windows)
+	  # Use '-' rather than '.', since we only want one
+	  # extension on DOS 8.3 filesystems.
+	  major=`expr $current - $age`
+	  versuffix="-$major"
+	  ;;
+
+	*)
+	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
+	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	# Clear the version info if we defaulted, and they specified a release.
+	if test -z "$vinfo" && test -n "$release"; then
+	  major=
+	  case $version_type in
+	  darwin)
+	    # we can't check for "0.0" in archive_cmds due to quoting
+	    # problems, so we reset it completely
+	    verstring=
+	    ;;
+	  *)
+	    verstring="0.0"
+	    ;;
+	  esac
+	  if test "$need_version" = no; then
+	    versuffix=
+	  else
+	    versuffix=".0.0"
+	  fi
+	fi
+
+	# Remove version info from name if versioning should be avoided
+	if test "$avoid_version" = yes && test "$need_version" = no; then
+	  major=
+	  versuffix=
+	  verstring=""
+	fi
+
+	# Check to see if the archive will have undefined symbols.
+	if test "$allow_undefined" = yes; then
+	  if test "$allow_undefined_flag" = unsupported; then
+	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+	    build_libtool_libs=no
+	    build_old_libs=yes
+	  fi
+	else
+	  # Don't allow undefined symbols.
+	  allow_undefined_flag="$no_undefined_flag"
+	fi
+      fi
+
+      if test "$mode" != relink; then
+	# Remove our outputs, but don't remove object files since they
+	# may have been created when compiling PIC objects.
+	removelist=
+	tempremovelist=`$echo "$output_objdir/*"`
+	for p in $tempremovelist; do
+	  case $p in
+	    *.$objext)
+	       ;;
+	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+	       if test "X$precious_files_regex" != "X"; then
+	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+	         then
+		   continue
+		 fi
+	       fi
+	       removelist="$removelist $p"
+	       ;;
+	    *) ;;
+	  esac
+	done
+	if test -n "$removelist"; then
+	  $show "${rm}r $removelist"
+	  $run ${rm}r $removelist
+	fi
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+	oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+	# Transform .lo files to .o files.
+	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      for path in $notinst_path; do
+	lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
+	deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
+	dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
+      done
+
+      if test -n "$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	temp_xrpath=
+	for libdir in $xrpath; do
+	  temp_xrpath="$temp_xrpath -R$libdir"
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+	  dependency_libs="$temp_xrpath $dependency_libs"
+	fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+	case " $dlprefiles $dlfiles " in
+	*" $lib "*) ;;
+	*) dlfiles="$dlfiles $lib" ;;
+	esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+	case "$dlprefiles " in
+	*" $lib "*) ;;
+	*) dlprefiles="$dlprefiles $lib" ;;
+	esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+	if test -n "$rpath"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+	    # these systems don't actually have a c library (as such)!
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C library is in the System framework
+	    deplibs="$deplibs -framework System"
+	    ;;
+	  *-*-netbsd*)
+	    # Don't link with libc until the a.out ld.so is fixed.
+	    ;;
+	  *-*-openbsd* | *-*-freebsd*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+ 	  *)
+	    # Add libc to deplibs on all other systems if necessary.
+	    if test "$build_libtool_need_lc" = "yes"; then
+	      deplibs="$deplibs -lc"
+	    fi
+	    ;;
+	  esac
+	fi
+
+	# Transform deplibs into only deplibs that can be linked in shared.
+	name_save=$name
+	libname_save=$libname
+	release_save=$release
+	versuffix_save=$versuffix
+	major_save=$major
+	# I'm not sure if I'm treating the release correctly.  I think
+	# release should show up in the -l (ie -lgmp5) so we don't want to
+	# add it in twice.  Is that correct?
+	release=""
+	versuffix=""
+	major=""
+	newdeplibs=
+	droppeddeps=no
+	case $deplibs_check_method in
+	pass_all)
+	  # Don't check for shared/static.  Everything works.
+	  # This might be a little naive.  We might want to check
+	  # whether the library exists or not.  But this is on
+	  # osf3 & osf4 and I'm not really sure... Just
+	  # implementing what was already the behavior.
+	  newdeplibs=$deplibs
+	  ;;
+	test_compile)
+	  # This code stresses the "libraries are programs" paradigm to its
+	  # limits. Maybe even breaks it.  We compile a program, linking it
+	  # against the deplibs as a proxy for the library.  Then we can check
+	  # whether they linked in statically or dynamically with ldd.
+	  $rm conftest.c
+	  cat > conftest.c <<EOF
+	  int main() { return 0; }
+EOF
+	  $rm conftest
+	  $LTCC -o conftest conftest.c $deplibs
+	  if test "$?" -eq 0 ; then
+	    ldd_output=`ldd conftest`
+	    for i in $deplibs; do
+	      name="`expr $i : '-l\(.*\)'`"
+	      # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" -ne "0"; then
+		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		  case " $predeps $postdeps " in
+		  *" $i "*)
+		    newdeplibs="$newdeplibs $i"
+		    i=""
+		    ;;
+		  esac
+	        fi
+		if test -n "$i" ; then
+		  libname=`eval \\$echo \"$libname_spec\"`
+		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		  set dummy $deplib_matches
+		  deplib_match=$2
+		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		    newdeplibs="$newdeplibs $i"
+		  else
+		    droppeddeps=yes
+		    $echo
+		    $echo "*** Warning: dynamic linker does not accept needed library $i."
+		    $echo "*** I have the capability to make that library automatically link in when"
+		    $echo "*** you link to this library.  But I can only do this if you have a"
+		    $echo "*** shared version of the library, which I believe you do not have"
+		    $echo "*** because a test_compile did reveal that the linker did not use it for"
+		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
+		  fi
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  else
+	    # Error occurred in the first compile.  Let's try to salvage
+	    # the situation: Compile a separate program for each library.
+	    for i in $deplibs; do
+	      name="`expr $i : '-l\(.*\)'`"
+	      # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" != "0"; then
+		$rm conftest
+		$LTCC -o conftest conftest.c $i
+		# Did it work?
+		if test "$?" -eq 0 ; then
+		  ldd_output=`ldd conftest`
+		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		    case " $predeps $postdeps " in
+		    *" $i "*)
+		      newdeplibs="$newdeplibs $i"
+		      i=""
+		      ;;
+		    esac
+		  fi
+		  if test -n "$i" ; then
+		    libname=`eval \\$echo \"$libname_spec\"`
+		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		    set dummy $deplib_matches
+		    deplib_match=$2
+		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		      newdeplibs="$newdeplibs $i"
+		    else
+		      droppeddeps=yes
+		      $echo
+		      $echo "*** Warning: dynamic linker does not accept needed library $i."
+		      $echo "*** I have the capability to make that library automatically link in when"
+		      $echo "*** you link to this library.  But I can only do this if you have a"
+		      $echo "*** shared version of the library, which you do not appear to have"
+		      $echo "*** because a test_compile did reveal that the linker did not use this one"
+		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+		    fi
+		  fi
+		else
+		  droppeddeps=yes
+		  $echo
+		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
+		  $echo "***  make it link in!  You will probably need to install it or some"
+		  $echo "*** library that it depends on before this library will be fully"
+		  $echo "*** functional.  Installing it before continuing would be even better."
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  fi
+	  ;;
+	file_magic*)
+	  set dummy $deplibs_check_method
+	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name="`expr $a_deplib : '-l\(.*\)'`"
+	    # If $name is empty we are operating on a -L argument.
+            if test "$name" != "" && test  "$name" != "0"; then
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval \\$echo \"$libname_spec\"`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		      # Follow soft links.
+		      if ls -lLd "$potent_lib" 2>/dev/null \
+			 | grep " -> " >/dev/null; then
+			continue
+		      fi
+		      # The statement above tries to avoid entering an
+		      # endless loop below, in case of cyclic links.
+		      # We might still enter an endless loop, since a link
+		      # loop can be closed while we follow links,
+		      # but so what?
+		      potlib="$potent_lib"
+		      while test -h "$potlib" 2>/dev/null; do
+			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+			case $potliblink in
+			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+			esac
+		      done
+		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+			 | ${SED} 10q \
+			 | $EGREP "$file_magic_regex" > /dev/null; then
+			newdeplibs="$newdeplibs $a_deplib"
+			a_deplib=""
+			break 2
+		      fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		$echo
+		$echo "*** Warning: linker path does not have real file for library $a_deplib."
+		$echo "*** I have the capability to make that library automatically link in when"
+		$echo "*** you link to this library.  But I can only do this if you have a"
+		$echo "*** shared version of the library, which you do not appear to have"
+		$echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
+		else
+		  $echo "*** with $libname and none of the candidates passed a file format test"
+		  $echo "*** using a file magic. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	match_pattern*)
+	  set dummy $deplibs_check_method
+	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name="`expr $a_deplib : '-l\(.*\)'`"
+	    # If $name is empty we are operating on a -L argument.
+	    if test -n "$name" && test "$name" != "0"; then
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval \\$echo \"$libname_spec\"`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		    potlib="$potent_lib" # see symlink-check above in file_magic test
+		    if eval $echo \"$potent_lib\" 2>/dev/null \
+		        | ${SED} 10q \
+		        | $EGREP "$match_pattern_regex" > /dev/null; then
+		      newdeplibs="$newdeplibs $a_deplib"
+		      a_deplib=""
+		      break 2
+		    fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		$echo
+		$echo "*** Warning: linker path does not have real file for library $a_deplib."
+		$echo "*** I have the capability to make that library automatically link in when"
+		$echo "*** you link to this library.  But I can only do this if you have a"
+		$echo "*** shared version of the library, which you do not appear to have"
+		$echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+		else
+		  $echo "*** with $libname and none of the candidates passed a file format test"
+		  $echo "*** using a regex pattern. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	none | unknown | *)
+	  newdeplibs=""
+	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+	    -e 's/ -[LR][^ ]*//g'`
+	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	    for i in $predeps $postdeps ; do
+	      # can't use Xsed below, because $i might contain '/'
+	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
+	    done
+	  fi
+	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
+	    | grep . >/dev/null; then
+	    $echo
+	    if test "X$deplibs_check_method" = "Xnone"; then
+	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
+	    else
+	      $echo "*** Warning: inter-library dependencies are not known to be supported."
+	    fi
+	    $echo "*** All declared inter-library dependencies are being dropped."
+	    droppeddeps=yes
+	  fi
+	  ;;
+	esac
+	versuffix=$versuffix_save
+	major=$major_save
+	release=$release_save
+	libname=$libname_save
+	name=$name_save
+
+	case $host in
+	*-*-rhapsody* | *-*-darwin1.[012])
+	  # On Rhapsody replace the C library is the System framework
+	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	  ;;
+	esac
+
+	if test "$droppeddeps" = yes; then
+	  if test "$module" = yes; then
+	    $echo
+	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
+	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
+	    $echo "*** a static module, that should work as long as the dlopening"
+	    $echo "*** application is linked with the -dlopen flag."
+	    if test -z "$global_symbol_pipe"; then
+	      $echo
+	      $echo "*** However, this would only work if libtool was able to extract symbol"
+	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      $echo "*** not find such a program.  So, this module is probably useless."
+	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	    fi
+	    if test "$build_old_libs" = no; then
+	      oldlibs="$output_objdir/$libname.$libext"
+	      build_libtool_libs=module
+	      build_old_libs=yes
+	    else
+	      build_libtool_libs=no
+	    fi
+	  else
+	    $echo "*** The inter-library dependencies that have been dropped here will be"
+	    $echo "*** automatically added whenever a program is linked with this library"
+	    $echo "*** or is declared to -dlopen it."
+
+	    if test "$allow_undefined" = no; then
+	      $echo
+	      $echo "*** Since this library must not contain undefined symbols,"
+	      $echo "*** because either the platform does not support them or"
+	      $echo "*** it was explicitly requested with -no-undefined,"
+	      $echo "*** libtool will only create a static version of it."
+	      if test "$build_old_libs" = no; then
+		oldlibs="$output_objdir/$libname.$libext"
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  fi
+	fi
+	# Done checking deplibs!
+	deplibs=$newdeplibs
+      fi
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+	if test "$hardcode_into_libs" = yes; then
+	  # Hardcode the library paths
+	  hardcode_libdirs=
+	  dep_rpath=
+	  rpath="$finalize_rpath"
+	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+	  for libdir in $rpath; do
+	    if test -n "$hardcode_libdir_flag_spec"; then
+	      if test -n "$hardcode_libdir_separator"; then
+		if test -z "$hardcode_libdirs"; then
+		  hardcode_libdirs="$libdir"
+		else
+		  # Just accumulate the unique libdirs.
+		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		    ;;
+		  *)
+		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		    ;;
+		  esac
+		fi
+	      else
+		eval flag=\"$hardcode_libdir_flag_spec\"
+		dep_rpath="$dep_rpath $flag"
+	      fi
+	    elif test -n "$runpath_var"; then
+	      case "$perm_rpath " in
+	      *" $libdir "*) ;;
+	      *) perm_rpath="$perm_rpath $libdir" ;;
+	      esac
+	    fi
+	  done
+	  # Substitute the hardcoded libdirs into the rpath.
+	  if test -n "$hardcode_libdir_separator" &&
+	     test -n "$hardcode_libdirs"; then
+	    libdir="$hardcode_libdirs"
+	    if test -n "$hardcode_libdir_flag_spec_ld"; then
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+	    else
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+	    fi
+	  fi
+	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
+	    # We should set the runpath_var.
+	    rpath=
+	    for dir in $perm_rpath; do
+	      rpath="$rpath$dir:"
+	    done
+	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+	  fi
+	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+	fi
+
+	shlibpath="$finalize_shlibpath"
+	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	if test -n "$shlibpath"; then
+	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+	fi
+
+	# Get the real and link names of the library.
+	eval shared_ext=\"$shrext_cmds\"
+	eval library_names=\"$library_names_spec\"
+	set dummy $library_names
+	realname="$2"
+	shift; shift
+
+	if test -n "$soname_spec"; then
+	  eval soname=\"$soname_spec\"
+	else
+	  soname="$realname"
+	fi
+	if test -z "$dlname"; then
+	  dlname=$soname
+	fi
+
+	lib="$output_objdir/$realname"
+	for link
+	do
+	  linknames="$linknames $link"
+	done
+
+	# Use standard objects if they are pic
+	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+	# Prepare the list of exported symbols
+	if test -z "$export_symbols"; then
+	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+	    $show "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $run $rm $export_symbols
+	    cmds=$export_symbols_cmds
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $cmds; do
+	      IFS="$save_ifs"
+	      eval cmd=\"$cmd\"
+	      if len=`expr "X$cmd" : ".*"` &&
+	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	        $show "$cmd"
+	        $run eval "$cmd" || exit $?
+	        skipped_export=false
+	      else
+	        # The command line is too long to execute in one step.
+	        $show "using reloadable object file for export list..."
+	        skipped_export=:
+	      fi
+	    done
+	    IFS="$save_ifs"
+	    if test -n "$export_symbols_regex"; then
+	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+	fi
+
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+	fi
+
+	tmp_deplibs=
+	for test_deplib in $deplibs; do
+		case " $convenience " in
+		*" $test_deplib "*) ;;
+		*)
+			tmp_deplibs="$tmp_deplibs $test_deplib"
+			;;
+		esac
+	done
+	deplibs="$tmp_deplibs"
+
+	if test -n "$convenience"; then
+	  if test -n "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  else
+	    gentop="$output_objdir/${outputname}x"
+	    generated="$generated $gentop"
+
+	    func_extract_archives $gentop $convenience
+	    libobjs="$libobjs $func_extract_archives_result"
+	  fi
+	fi
+	
+	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	  eval flag=\"$thread_safe_flag_spec\"
+	  linker_flags="$linker_flags $flag"
+	fi
+
+	# Make a backup of the uninstalled library when relinking
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+	fi
+
+	# Do each of the archive commands.
+	if test "$module" = yes && test -n "$module_cmds" ; then
+	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	    eval test_cmds=\"$module_expsym_cmds\"
+	    cmds=$module_expsym_cmds
+	  else
+	    eval test_cmds=\"$module_cmds\"
+	    cmds=$module_cmds
+	  fi
+	else
+	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	  eval test_cmds=\"$archive_expsym_cmds\"
+	  cmds=$archive_expsym_cmds
+	else
+	  eval test_cmds=\"$archive_cmds\"
+	  cmds=$archive_cmds
+	  fi
+	fi
+
+	if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
+	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  :
+	else
+	  # The command line is too long to link in one step, link piecewise.
+	  $echo "creating reloadable object files..."
+
+	  # Save the value of $output and $libobjs because we want to
+	  # use them later.  If we have whole_archive_flag_spec, we
+	  # want to use save_libobjs as it was before
+	  # whole_archive_flag_spec was expanded, because we can't
+	  # assume the linker understands whole_archive_flag_spec.
+	  # This may have to be revisited, in case too many
+	  # convenience libraries get linked in and end up exceeding
+	  # the spec.
+	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	  fi
+	  save_output=$output
+
+	  # Clear the reloadable object creation command queue and
+	  # initialize k to one.
+	  test_cmds=
+	  concat_cmds=
+	  objlist=
+	  delfiles=
+	  last_robj=
+	  k=1
+	  output=$output_objdir/$save_output-${k}.$objext
+	  # Loop over the list of objects to be linked.
+	  for obj in $save_libobjs
+	  do
+	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+	    if test "X$objlist" = X ||
+	       { len=`expr "X$test_cmds" : ".*"` &&
+		 test "$len" -le "$max_cmd_len"; }; then
+	      objlist="$objlist $obj"
+	    else
+	      # The command $test_cmds is almost too long, add a
+	      # command to the queue.
+	      if test "$k" -eq 1 ; then
+		# The first file doesn't have a previous command to add.
+		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+	      else
+		# All subsequent reloadable object files will link in
+		# the last one created.
+		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+	      fi
+	      last_robj=$output_objdir/$save_output-${k}.$objext
+	      k=`expr $k + 1`
+	      output=$output_objdir/$save_output-${k}.$objext
+	      objlist=$obj
+	      len=1
+	    fi
+	  done
+	  # Handle the remaining objects by creating one last
+	  # reloadable object file.  All subsequent reloadable object
+	  # files will link in the last one created.
+	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+	  if ${skipped_export-false}; then
+	    $show "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $run $rm $export_symbols
+	    libobjs=$output
+	    # Append the command to create the export file.
+	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+          fi
+
+	  # Set up a command to remove the reloadale object files
+	  # after they are used.
+	  i=0
+	  while test "$i" -lt "$k"
+	  do
+	    i=`expr $i + 1`
+	    delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
+	  done
+
+	  $echo "creating a temporary reloadable object file: $output"
+
+	  # Loop through the commands generated above and execute them.
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $concat_cmds; do
+	    IFS="$save_ifs"
+	    $show "$cmd"
+	    $run eval "$cmd" || exit $?
+	  done
+	  IFS="$save_ifs"
+
+	  libobjs=$output
+	  # Restore the value of output.
+	  output=$save_output
+
+	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  fi
+	  # Expand the library linking commands again to reset the
+	  # value of $libobjs for piecewise linking.
+
+	  # Do each of the archive commands.
+	  if test "$module" = yes && test -n "$module_cmds" ; then
+	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	      cmds=$module_expsym_cmds
+	    else
+	      cmds=$module_cmds
+	    fi
+	  else
+	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	    cmds=$archive_expsym_cmds
+	  else
+	    cmds=$archive_cmds
+	    fi
+	  fi
+
+	  # Append the command to remove the reloadable object files
+	  # to the just-reset $cmds.
+	  eval cmds=\"\$cmds~\$rm $delfiles\"
+	fi
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $show "$cmd"
+	  $run eval "$cmd" || exit $?
+	done
+	IFS="$save_ifs"
+
+	# Restore the uninstalled library and exit
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+	  exit $EXIT_SUCCESS
+	fi
+
+	# Create links to the real library.
+	for linkname in $linknames; do
+	  if test "$realname" != "$linkname"; then
+	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+	  fi
+	done
+
+	# If -module or -export-dynamic was specified, set the dlname.
+	if test "$module" = yes || test "$export_dynamic" = yes; then
+	  # On all known operating systems, these are identical.
+	  dlname="$soname"
+	fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$deplibs"; then
+	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+      fi
+
+      case $output in
+      *.lo)
+	if test -n "$objs$old_deplibs"; then
+	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+	libobj="$output"
+	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+	;;
+      *)
+	libobj=
+	obj="$output"
+	;;
+      esac
+
+      # Delete the old objects.
+      $run $rm $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec
+      wl=
+
+      if test -n "$convenience"; then
+	if test -n "$whole_archive_flag_spec"; then
+	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+	else
+	  gentop="$output_objdir/${obj}x"
+	  generated="$generated $gentop"
+
+	  func_extract_archives $gentop $convenience
+	  reload_conv_objs="$reload_objs $func_extract_archives_result"
+	fi
+      fi
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      cmds=$reload_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	eval cmd=\"$cmd\"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	# Create an invalid libtool object if no PIC, so that we don't
+	# accidentally link it into a program.
+	# $show "echo timestamp > $libobj"
+	# $run eval "echo timestamp > $libobj" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+	# Only do commands if we really have different PIC objects.
+	reload_objs="$libobjs $reload_conv_objs"
+	output="$libobj"
+	cmds=$reload_cmds
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $show "$cmd"
+	  $run eval "$cmd" || exit $?
+	done
+	IFS="$save_ifs"
+      fi
+
+      if test -n "$gentop"; then
+	$show "${rm}r $gentop"
+	$run ${rm}r $gentop
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+      esac
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+      fi
+
+      if test "$preload" = yes; then
+	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+	   test "$dlopen_self_static" = unknown; then
+	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+	fi
+      fi
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+	# On Rhapsody replace the C library is the System framework
+	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	;;
+      esac
+
+      case $host in
+      *darwin*)
+        # Don't allow lazy linking, it breaks C++ global constructors
+        if test "$tagname" = CXX ; then
+        compile_command="$compile_command ${wl}-bind_at_load"
+        finalize_command="$finalize_command ${wl}-bind_at_load"
+        fi
+        ;;
+      esac
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	for libdir in $rpath $xrpath; do
+	  # This is the magic to use -rpath.
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) perm_rpath="$perm_rpath $libdir" ;;
+	  esac
+	fi
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  case :$dllsearchpath: in
+	  *":$libdir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$libdir";;
+	  esac
+	  ;;
+	esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$finalize_perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+	  esac
+	fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+	# Transform all the library objects into standard objects.
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+      fi
+
+      dlsyms=
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	if test -n "$NM" && test -n "$global_symbol_pipe"; then
+	  dlsyms="${outputname}S.c"
+	else
+	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+	fi
+      fi
+
+      if test -n "$dlsyms"; then
+	case $dlsyms in
+	"") ;;
+	*.c)
+	  # Discover the nlist of each of the dlfiles.
+	  nlist="$output_objdir/${outputname}.nm"
+
+	  $show "$rm $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+	  # Parse the name list into a source file.
+	  $show "creating $output_objdir/$dlsyms"
+
+	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+	  if test "$dlself" = yes; then
+	    $show "generating symbol list for \`$output'"
+
+	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+	    # Add our own program objects to the symbol list.
+	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	    for arg in $progfiles; do
+	      $show "extracting global C symbols from \`$arg'"
+	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+	    done
+
+	    if test -n "$exclude_expsyms"; then
+	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+	      $run eval '$mv "$nlist"T "$nlist"'
+	    fi
+
+	    if test -n "$export_symbols_regex"; then
+	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+	      $run eval '$mv "$nlist"T "$nlist"'
+	    fi
+
+	    # Prepare the list of exported symbols
+	    if test -z "$export_symbols"; then
+	      export_symbols="$output_objdir/$output.exp"
+	      $run $rm $export_symbols
+	      $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+	    else
+	      $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+	      $run eval 'mv "$nlist"T "$nlist"'
+	    fi
+	  fi
+
+	  for arg in $dlprefiles; do
+	    $show "extracting global C symbols from \`$arg'"
+	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+	    $run eval '$echo ": $name " >> "$nlist"'
+	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+	  done
+
+	  if test -z "$run"; then
+	    # Make sure we have at least an empty file.
+	    test -f "$nlist" || : > "$nlist"
+
+	    if test -n "$exclude_expsyms"; then
+	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+	      $mv "$nlist"T "$nlist"
+	    fi
+
+	    # Try sorting and uniquifying the output.
+	    if grep -v "^: " < "$nlist" |
+		if sort -k 3 </dev/null >/dev/null 2>&1; then
+		  sort -k 3
+		else
+		  sort +2
+		fi |
+		uniq > "$nlist"S; then
+	      :
+	    else
+	      grep -v "^: " < "$nlist" > "$nlist"S
+	    fi
+
+	    if test -f "$nlist"S; then
+	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+	    else
+	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
+	    fi
+
+	    $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+	    $echo >> "$output_objdir/$dlsyms" "\
+  {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+	  fi
+
+	  pic_flag_for_symtable=
+	  case $host in
+	  # compiling the symbol table file with pic_flag works around
+	  # a FreeBSD bug that causes programs to crash when -lm is
+	  # linked before any other PIC object.  But we must not use
+	  # pic_flag when linking with -static.  The problem exists in
+	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
+	    esac;;
+	  *-*-hpux*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag";;
+	    esac
+	  esac
+
+	  # Now compile the dynamic symbol file.
+	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+	  # Clean up the generated files.
+	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+	  # Transform the symbol file into the correct name.
+	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+	  ;;
+	*)
+	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+      else
+	# We keep going just in case the user didn't refer to
+	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+	# really was required.
+
+	# Nullify the symbol file.
+	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+      fi
+
+      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+	# Replace the output file specification.
+	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	link_command="$compile_command$compile_rpath"
+
+	# We have no uninstalled library dependencies, so finalize right now.
+	$show "$link_command"
+	$run eval "$link_command"
+	status=$?
+
+	# Delete the generated files.
+	if test -n "$dlsyms"; then
+	  $show "$rm $output_objdir/${outputname}S.${objext}"
+	  $run $rm "$output_objdir/${outputname}S.${objext}"
+	fi
+
+	exit $status
+      fi
+
+      if test -n "$shlibpath_var"; then
+	# We should set the shlibpath_var
+	rpath=
+	for dir in $temp_rpath; do
+	  case $dir in
+	  [\\/]* | [A-Za-z]:[\\/]*)
+	    # Absolute path.
+	    rpath="$rpath$dir:"
+	    ;;
+	  *)
+	    # Relative path: add a thisdir entry.
+	    rpath="$rpath\$thisdir/$dir:"
+	    ;;
+	  esac
+	done
+	temp_rpath="$rpath"
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+	if test -n "$perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+	if test -n "$finalize_perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $finalize_perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+      fi
+
+      if test "$no_install" = yes; then
+	# We don't need to create a wrapper script.
+	link_command="$compile_var$compile_command$compile_rpath"
+	# Replace the output file specification.
+	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	# Delete the old output file.
+	$run $rm $output
+	# Link the executable and exit
+	$show "$link_command"
+	$run eval "$link_command" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+	# Fast installation is not supported
+	link_command="$compile_var$compile_command$compile_rpath"
+	relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+	$echo "$modename: \`$output' will be relinked during installation" 1>&2
+      else
+	if test "$fast_install" != no; then
+	  link_command="$finalize_var$compile_command$finalize_rpath"
+	  if test "$fast_install" = yes; then
+	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+	  else
+	    # fast_install is set to needless
+	    relink_command=
+	  fi
+	else
+	  link_command="$compile_var$compile_command$compile_rpath"
+	  relink_command="$finalize_var$finalize_command$finalize_rpath"
+	fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      $show "$link_command"
+      $run eval "$link_command" || exit $?
+
+      # Now create the wrapper script.
+      $show "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+	# Preserve any variables that may affect compiler behavior
+	for var in $variables_saved_for_relink; do
+	  if eval test -z \"\${$var+set}\"; then
+	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	  elif eval var_value=\$$var; test -z "$var_value"; then
+	    relink_command="$var=; export $var; $relink_command"
+	  else
+	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	  fi
+	done
+	relink_command="(cd `pwd`; $relink_command)"
+	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Quote $echo for shipping.
+      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
+	case $progpath in
+	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+	esac
+	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if our run command is non-null.
+      if test -z "$run"; then
+	# win32 will think the script is a binary if it has
+	# a .exe suffix, so we strip it off here.
+	case $output in
+	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
+	esac
+	# test for cygwin because mv fails w/o .exe extensions
+	case $host in
+	  *cygwin*)
+	    exeext=.exe
+	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+	  *) exeext= ;;
+	esac
+	case $host in
+	  *cygwin* | *mingw* )
+	    cwrappersource=`$echo ${objdir}/lt-${output}.c`
+	    cwrapper=`$echo ${output}.exe`
+	    $rm $cwrappersource $cwrapper
+	    trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+	    cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+
+   Currently, it simply execs the wrapper *script* "/bin/sh $output",
+   but could eventually absorb all of the scripts functionality and
+   exec $objdir/$outputname directly.
+*/
+EOF
+	    cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+#define DIR_SEPARATOR '/'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+#define HAVE_DOS_BASED_FILE_SYSTEM
+#ifndef DIR_SEPARATOR_2
+#define DIR_SEPARATOR_2 '\\'
+#endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+char * basename (const char *name);
+char * fnqualify(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int i;
+
+  program_name = (char *) xstrdup ((char *) basename (argv[0]));
+  newargz = XMALLOC(char *, argc+2);
+EOF
+
+	    cat >> $cwrappersource <<EOF
+  newargz[0] = "$SHELL";
+EOF
+
+	    cat >> $cwrappersource <<"EOF"
+  newargz[1] = fnqualify(argv[0]);
+  /* we know the script has the same name, without the .exe */
+  /* so make sure newargz[1] doesn't end in .exe */
+  strendzap(newargz[1],".exe");
+  for (i = 1; i < argc; i++)
+    newargz[i+1] = xstrdup(argv[i]);
+  newargz[argc+1] = NULL;
+EOF
+
+	    cat >> $cwrappersource <<EOF
+  execv("$SHELL",newargz);
+EOF
+
+	    cat >> $cwrappersource <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+  void * p = (void *) malloc (num);
+  if (!p)
+    lt_fatal ("Memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+char *
+basename (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha (name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return (char *) base;
+}
+
+char *
+fnqualify(const char *path)
+{
+  size_t size;
+  char *p;
+  char tmp[LT_PATHMAX + 1];
+
+  assert(path != NULL);
+
+  /* Is it qualified already? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha (path[0]) && path[1] == ':')
+    return xstrdup (path);
+#endif
+  if (IS_DIR_SEPARATOR (path[0]))
+    return xstrdup (path);
+
+  /* prepend the current directory */
+  /* doesn't handle '~' */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal ("getcwd failed");
+  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
+  p = XMALLOC(char, size);
+  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
+  return p;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert(str != NULL);
+  assert(pat != NULL);
+
+  len = strlen(str);
+  patlen = strlen(pat);
+
+  if (patlen <= len)
+  {
+    str += len - patlen;
+    if (strcmp(str, pat) == 0)
+      *str = '\0';
+  }
+  return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+          const char * message, va_list ap)
+{
+  fprintf (stderr, "%s: %s: ", program_name, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  va_end (ap);
+}
+EOF
+	  # we should really use a build-platform specific compiler
+	  # here, but OTOH, the wrappers (shell script and this C one)
+	  # are only useful if you want to execute the "real" binary.
+	  # Since the "real" binary is built for $host, then this
+	  # wrapper might as well be built for $host, too.
+	  $run $LTCC -s -o $cwrapper $cwrappersource
+	  ;;
+	esac
+	$rm $output
+	trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+
+	$echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variable:
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$echo are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    echo=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$echo works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$echo will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+	$echo >> $output "\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+  done
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+	if test "$fast_install" = yes; then
+	  $echo >> $output "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" || \\
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $mkdir \"\$progdir\"
+    else
+      $rm \"\$progdir/\$file\"
+    fi"
+
+	  $echo >> $output "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+	$echo \"\$relink_command_output\" >&2
+	$rm \"\$progdir/\$file\"
+	exit $EXIT_FAILURE
+      fi
+    fi
+
+    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $rm \"\$progdir/\$program\";
+      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $rm \"\$progdir/\$file\"
+  fi"
+	else
+	  $echo >> $output "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+	fi
+
+	$echo >> $output "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+	# Export our shlibpath_var if we have one.
+	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	  $echo >> $output "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+	fi
+
+	# fixup the dll searchpath if we need to.
+	if test -n "$dllsearchpath"; then
+	  $echo >> $output "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
+	$echo >> $output "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+"
+	case $host in
+	# Backslashes separate directories on plain windows
+	*-*-mingw | *-*-os2*)
+	  $echo >> $output "\
+      exec \$progdir\\\\\$program \${1+\"\$@\"}
+"
+	  ;;
+
+	*)
+	  $echo >> $output "\
+      exec \$progdir/\$program \${1+\"\$@\"}
+"
+	  ;;
+	esac
+	$echo >> $output "\
+      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+      exit $EXIT_FAILURE
+    fi
+  else
+    # The program doesn't exist.
+    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+    \$echo \"This script is just a wrapper for \$program.\" 1>&2
+    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi\
+"
+	chmod +x $output
+      fi
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+	oldobjs="$libobjs_save"
+	addlibs="$convenience"
+	build_libtool_libs=no
+      else
+	if test "$build_libtool_libs" = module; then
+	  oldobjs="$libobjs_save"
+	  build_libtool_libs=no
+	else
+	  oldobjs="$old_deplibs $non_pic_objects"
+	fi
+	addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+	gentop="$output_objdir/${outputname}x"
+	generated="$generated $gentop"
+
+	func_extract_archives $gentop $addlibs
+	oldobjs="$oldobjs $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+       cmds=$old_archive_from_new_cmds
+      else
+	eval cmds=\"$old_archive_cmds\"
+
+	if len=`expr "X$cmds" : ".*"` &&
+	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  cmds=$old_archive_cmds
+	else
+	  # the command line is too long to link in one step, link in parts
+	  $echo "using piecewise archive linking..."
+	  save_RANLIB=$RANLIB
+	  RANLIB=:
+	  objlist=
+	  concat_cmds=
+	  save_oldobjs=$oldobjs
+	  # GNU ar 2.10+ was changed to match POSIX; thus no paths are
+	  # encoded into archives.  This makes 'ar r' malfunction in
+	  # this piecewise linking case whenever conflicting object
+	  # names appear in distinct ar calls; check, warn and compensate.
+	    if (for obj in $save_oldobjs
+	    do
+	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
+	    done | sort | sort -uc >/dev/null 2>&1); then
+	    :
+	  else
+	    $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
+	    $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
+	    AR_FLAGS=cq
+	  fi
+	  # Is there a better way of finding the last object in the list?
+	  for obj in $save_oldobjs
+	  do
+	    last_oldobj=$obj
+	  done
+	  for obj in $save_oldobjs
+	  do
+	    oldobjs="$objlist $obj"
+	    objlist="$objlist $obj"
+	    eval test_cmds=\"$old_archive_cmds\"
+	    if len=`expr "X$test_cmds" : ".*"` &&
+	       test "$len" -le "$max_cmd_len"; then
+	      :
+	    else
+	      # the above command should be used before it gets too long
+	      oldobjs=$objlist
+	      if test "$obj" = "$last_oldobj" ; then
+	        RANLIB=$save_RANLIB
+	      fi
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+	      objlist=
+	    fi
+	  done
+	  RANLIB=$save_RANLIB
+	  oldobjs=$objlist
+	  if test "X$oldobjs" = "X" ; then
+	    eval cmds=\"\$concat_cmds\"
+	  else
+	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+	  fi
+	fi
+      fi
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+        eval cmd=\"$cmd\"
+	IFS="$save_ifs"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$generated"; then
+      $show "${rm}r$generated"
+      $run ${rm}r$generated
+    fi
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      $show "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+	if eval test -z \"\${$var+set}\"; then
+	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	elif eval var_value=\$$var; test -z "$var_value"; then
+	  relink_command="$var=; export $var; $relink_command"
+	else
+	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      if test "$hardcode_automatic" = yes ; then
+	relink_command=
+      fi
+
+
+      # Only create the output if not a dry run.
+      if test -z "$run"; then
+	for installed in no yes; do
+	  if test "$installed" = yes; then
+	    if test -z "$install_libdir"; then
+	      break
+	    fi
+	    output="$output_objdir/$outputname"i
+	    # Replace all uninstalled libtool libraries with the installed ones
+	    newdependency_libs=
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      *.la)
+		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		if test -z "$libdir"; then
+		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		  exit $EXIT_FAILURE
+		fi
+		newdependency_libs="$newdependency_libs $libdir/$name"
+		;;
+	      *) newdependency_libs="$newdependency_libs $deplib" ;;
+	      esac
+	    done
+	    dependency_libs="$newdependency_libs"
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit $EXIT_FAILURE
+	      fi
+	      newdlfiles="$newdlfiles $libdir/$name"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit $EXIT_FAILURE
+	      fi
+	      newdlprefiles="$newdlprefiles $libdir/$name"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  else
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlfiles="$newdlfiles $abs"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlprefiles="$newdlprefiles $abs"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  fi
+	  $rm $output
+	  # place dlname in correct position for cygwin
+	  tdlname=$dlname
+	  case $host,$output,$installed,$module,$dlname in
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+	  esac
+	  $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+	  if test "$installed" = no && test "$need_relink" = yes; then
+	    $echo >> $output "\
+relink_command=\"$relink_command\""
+	  fi
+	done
+      fi
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool install mode
+  install)
+    modename="$modename: install"
+
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
+      # Aesthetically quote it.
+      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$arg "
+      arg="$1"
+      shift
+    else
+      install_prog=
+      arg="$nonopt"
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+    case $arg in
+    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+      arg="\"$arg\""
+      ;;
+    esac
+    install_prog="$install_prog$arg"
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    for arg
+    do
+      if test -n "$dest"; then
+	files="$files $dest"
+	dest="$arg"
+	continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f) prev="-f" ;;
+      -g) prev="-g" ;;
+      -m) prev="-m" ;;
+      -o) prev="-o" ;;
+      -s)
+	stripme=" -s"
+	continue
+	;;
+      -*) ;;
+
+      *)
+	# If the previous option needed an argument, then skip it.
+	if test -n "$prev"; then
+	  prev=
+	else
+	  dest="$arg"
+	  continue
+	fi
+	;;
+      esac
+
+      # Aesthetically quote the argument.
+      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$install_prog $arg"
+    done
+
+    if test -z "$install_prog"; then
+      $echo "$modename: you must specify an install program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prev' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+	$echo "$modename: no file or destination specified" 1>&2
+      else
+	$echo "$modename: you must specify a destination" 1>&2
+      fi
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Strip any trailing slash from the destination.
+    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+      test "X$destdir" = "X$dest" && destdir=.
+      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files
+      if test "$#" -gt 2; then
+	$echo "$modename: \`$dest' is not a directory" 1>&2
+	$echo "$help" 1>&2
+	exit $EXIT_FAILURE
+      fi
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+	case $file in
+	*.lo) ;;
+	*)
+	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+	# Do the static libraries later.
+	staticlibs="$staticlibs $file"
+	;;
+
+      *.la)
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	library_names=
+	old_library=
+	relink_command=
+	# If there is no directory component, then add one.
+	case $file in
+	*/* | *\\*) . $file ;;
+	*) . ./$file ;;
+	esac
+
+	# Add the libdir to current_libdirs if it is the destination.
+	if test "X$destdir" = "X$libdir"; then
+	  case "$current_libdirs " in
+	  *" $libdir "*) ;;
+	  *) current_libdirs="$current_libdirs $libdir" ;;
+	  esac
+	else
+	  # Note the libdir as a future libdir.
+	  case "$future_libdirs " in
+	  *" $libdir "*) ;;
+	  *) future_libdirs="$future_libdirs $libdir" ;;
+	  esac
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+	test "X$dir" = "X$file/" && dir=
+	dir="$dir$objdir"
+
+	if test -n "$relink_command"; then
+	  # Determine the prefix the user has applied to our future dir.
+	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+
+	  # Don't allow the user to place us outside of our expected
+	  # location b/c this prevents finding dependent libraries that
+	  # are installed to the same prefix.
+	  # At present, this check doesn't affect windows .dll's that
+	  # are installed into $libdir/../bin (currently, that works fine)
+	  # but it's something to keep an eye on.
+	  if test "$inst_prefix_dir" = "$destdir"; then
+	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  if test -n "$inst_prefix_dir"; then
+	    # Stick the inst_prefix_dir data into the link command.
+	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	  else
+	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+	  fi
+
+	  $echo "$modename: warning: relinking \`$file'" 1>&2
+	  $show "$relink_command"
+	  if $run eval "$relink_command"; then :
+	  else
+	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	fi
+
+	# See the names of the shared library.
+	set dummy $library_names
+	if test -n "$2"; then
+	  realname="$2"
+	  shift
+	  shift
+
+	  srcname="$realname"
+	  test -n "$relink_command" && srcname="$realname"T
+
+	  # Install the shared library and build the symlinks.
+	  $show "$install_prog $dir/$srcname $destdir/$realname"
+	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+	  if test -n "$stripme" && test -n "$striplib"; then
+	    $show "$striplib $destdir/$realname"
+	    $run eval "$striplib $destdir/$realname" || exit $?
+	  fi
+
+	  if test "$#" -gt 0; then
+	    # Delete the old symlinks, and create new ones.
+	    for linkname
+	    do
+	      if test "$linkname" != "$realname"; then
+		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+	      fi
+	    done
+	  fi
+
+	  # Do each command in the postinstall commands.
+	  lib="$destdir/$realname"
+	  cmds=$postinstall_cmds
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $cmds; do
+	    IFS="$save_ifs"
+	    eval cmd=\"$cmd\"
+	    $show "$cmd"
+	    $run eval "$cmd" || exit $?
+	  done
+	  IFS="$save_ifs"
+	fi
+
+	# Install the pseudo-library for information purposes.
+	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	instname="$dir/$name"i
+	$show "$install_prog $instname $destdir/$name"
+	$run eval "$install_prog $instname $destdir/$name" || exit $?
+
+	# Maybe install the static library, too.
+	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+	;;
+
+      *.lo)
+	# Install (i.e. copy) a libtool object.
+
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Deduce the name of the destination old-style object file.
+	case $destfile in
+	*.lo)
+	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+	  ;;
+	*.$objext)
+	  staticdest="$destfile"
+	  destfile=
+	  ;;
+	*)
+	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	# Install the libtool object if requested.
+	if test -n "$destfile"; then
+	  $show "$install_prog $file $destfile"
+	  $run eval "$install_prog $file $destfile" || exit $?
+	fi
+
+	# Install the old object if enabled.
+	if test "$build_old_libs" = yes; then
+	  # Deduce the name of the old-style object file.
+	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+	  $show "$install_prog $staticobj $staticdest"
+	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+	fi
+	exit $EXIT_SUCCESS
+	;;
+
+      *)
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	  destfile="$destdir/$destfile"
+	fi
+
+	# If the file is missing, and there is a .exe on the end, strip it
+	# because it is most likely a libtool script we actually want to
+	# install
+	stripped_ext=""
+	case $file in
+	  *.exe)
+	    if test ! -f "$file"; then
+	      file=`$echo $file|${SED} 's,.exe$,,'`
+	      stripped_ext=".exe"
+	    fi
+	    ;;
+	esac
+
+	# Do a test to see if this is really a libtool program.
+	case $host in
+	*cygwin*|*mingw*)
+	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
+	    ;;
+	*)
+	    wrapper=$file
+	    ;;
+	esac
+	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+	  notinst_deplibs=
+	  relink_command=
+
+	  # To insure that "foo" is sourced, and not "foo.exe",
+	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
+	  # which disallows the automatic-append-.exe behavior.
+	  case $build in
+	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
+	  *) wrapperdot=${wrapper} ;;
+	  esac
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . ${wrapperdot} ;;
+	  *) . ./${wrapperdot} ;;
+	  esac
+
+	  # Check the variables that should have been set.
+	  if test -z "$notinst_deplibs"; then
+	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  finalize=yes
+	  for lib in $notinst_deplibs; do
+	    # Check to see that each library is installed.
+	    libdir=
+	    if test -f "$lib"; then
+	      # If there is no directory component, then add one.
+	      case $lib in
+	      */* | *\\*) . $lib ;;
+	      *) . ./$lib ;;
+	      esac
+	    fi
+	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    if test -n "$libdir" && test ! -f "$libfile"; then
+	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+	      finalize=no
+	    fi
+	  done
+
+	  relink_command=
+	  # To insure that "foo" is sourced, and not "foo.exe",
+	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
+	  # which disallows the automatic-append-.exe behavior.
+	  case $build in
+	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
+	  *) wrapperdot=${wrapper} ;;
+	  esac
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . ${wrapperdot} ;;
+	  *) . ./${wrapperdot} ;;
+	  esac
+
+	  outputname=
+	  if test "$fast_install" = no && test -n "$relink_command"; then
+	    if test "$finalize" = yes && test -z "$run"; then
+	      tmpdir="/tmp"
+	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
+	      tmpdir="$tmpdir/libtool-$$"
+	      save_umask=`umask`
+	      umask 0077
+	      if $mkdir "$tmpdir"; then
+	        umask $save_umask
+	      else
+	        umask $save_umask
+		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
+		continue
+	      fi
+	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+	      outputname="$tmpdir/$file"
+	      # Replace the output file specification.
+	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+	      $show "$relink_command"
+	      if $run eval "$relink_command"; then :
+	      else
+		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+		${rm}r "$tmpdir"
+		continue
+	      fi
+	      file="$outputname"
+	    else
+	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
+	    fi
+	  else
+	    # Install the binary that we compiled earlier.
+	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+	  fi
+	fi
+
+	# remove .exe since cygwin /usr/bin/install will append another
+	# one anyways
+	case $install_prog,$host in
+	*/usr/bin/install*,*cygwin*)
+	  case $file:$destfile in
+	  *.exe:*.exe)
+	    # this is ok
+	    ;;
+	  *.exe:*)
+	    destfile=$destfile.exe
+	    ;;
+	  *:*.exe)
+	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
+	    ;;
+	  esac
+	  ;;
+	esac
+	$show "$install_prog$stripme $file $destfile"
+	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+	test -n "$outputname" && ${rm}r "$tmpdir"
+	;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      $show "$install_prog $file $oldlib"
+      $run eval "$install_prog \$file \$oldlib" || exit $?
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+	$show "$old_striplib $oldlib"
+	$run eval "$old_striplib $oldlib" || exit $?
+      fi
+
+      # Do each command in the postinstall commands.
+      cmds=$old_postinstall_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	eval cmd=\"$cmd\"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$future_libdirs"; then
+      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+    fi
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      test -n "$run" && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool finish mode
+  finish)
+    modename="$modename: finish"
+    libdirs="$nonopt"
+    admincmds=
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+	libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+	if test -n "$finish_cmds"; then
+	  # Do each command in the finish commands.
+	  cmds=$finish_cmds
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $cmds; do
+	    IFS="$save_ifs"
+	    eval cmd=\"$cmd\"
+	    $show "$cmd"
+	    $run eval "$cmd" || admincmds="$admincmds
+       $cmd"
+	  done
+	  IFS="$save_ifs"
+	fi
+	if test -n "$finish_eval"; then
+	  # Do the single finish_eval.
+	  eval cmds=\"$finish_eval\"
+	  $run eval "$cmds" || admincmds="$admincmds
+       $cmds"
+	fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    test "$show" = : && exit $EXIT_SUCCESS
+
+    $echo "----------------------------------------------------------------------"
+    $echo "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      $echo "   $libdir"
+    done
+    $echo
+    $echo "If you ever happen to want to link against installed libraries"
+    $echo "in a given directory, LIBDIR, you must either use libtool, and"
+    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    $echo "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      $echo "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+      $echo "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
+
+      $echo "   - use the \`$flag' linker flag"
+    fi
+    if test -n "$admincmds"; then
+      $echo "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    $echo
+    $echo "See any operating system documentation about shared libraries for"
+    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+    $echo "----------------------------------------------------------------------"
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool execute mode
+  execute)
+    modename="$modename: execute"
+
+    # The first argument is the command name.
+    cmd="$nonopt"
+    if test -z "$cmd"; then
+      $echo "$modename: you must specify a COMMAND" 1>&2
+      $echo "$help"
+      exit $EXIT_FAILURE
+    fi
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      if test ! -f "$file"; then
+	$echo "$modename: \`$file' is not a file" 1>&2
+	$echo "$help" 1>&2
+	exit $EXIT_FAILURE
+      fi
+
+      dir=
+      case $file in
+      *.la)
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Read the libtool library.
+	dlname=
+	library_names=
+
+	# If there is no directory component, then add one.
+	case $file in
+	*/* | *\\*) . $file ;;
+	*) . ./$file ;;
+	esac
+
+	# Skip this library if it cannot be dlopened.
+	if test -z "$dlname"; then
+	  # Warn if it was a shared library.
+	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+	  continue
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+
+	if test -f "$dir/$objdir/$dlname"; then
+	  dir="$dir/$objdir"
+	else
+	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+	;;
+
+      *.lo)
+	# Just add the directory containing the .lo file.
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+	;;
+
+      *)
+	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+	continue
+	;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+	eval "$shlibpath_var=\"\$dir\""
+      else
+	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -*) ;;
+      *)
+	# Do a test to see if this is really a libtool program.
+	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . $file ;;
+	  *) . ./$file ;;
+	  esac
+
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	fi
+	;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+      args="$args \"$file\""
+    done
+
+    if test -z "$run"; then
+      if test -n "$shlibpath_var"; then
+	# Export the shlibpath_var.
+	eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      if test "${save_LC_ALL+set}" = set; then
+	LC_ALL="$save_LC_ALL"; export LC_ALL
+      fi
+      if test "${save_LANG+set}" = set; then
+	LANG="$save_LANG"; export LANG
+      fi
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+	$echo "export $shlibpath_var"
+      fi
+      $echo "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool clean and uninstall mode
+  clean | uninstall)
+    modename="$modename: $mode"
+    rm="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) rm="$rm $arg"; rmforce=yes ;;
+      -*) rm="$rm $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    if test -z "$rm"; then
+      $echo "$modename: you must specify an RM program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    rmdirs=
+
+    origobjdir="$objdir"
+    for file in $files; do
+      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+      if test "X$dir" = "X$file"; then
+	dir=.
+	objdir="$origobjdir"
+      else
+	objdir="$dir/$origobjdir"
+      fi
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+      test "$mode" = uninstall && objdir="$dir"
+
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test "$mode" = clean; then
+	case " $rmdirs " in
+	  *" $objdir "*) ;;
+	  *) rmdirs="$rmdirs $objdir" ;;
+	esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if (test -L "$file") >/dev/null 2>&1 \
+	|| (test -h "$file") >/dev/null 2>&1 \
+	|| test -f "$file"; then
+	:
+      elif test -d "$file"; then
+	exit_status=1
+	continue
+      elif test "$rmforce" = yes; then
+	continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+	# Possibly a libtool archive, so verify it.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  . $dir/$name
+
+	  # Delete the libtool libraries and symlinks.
+	  for n in $library_names; do
+	    rmfiles="$rmfiles $objdir/$n"
+	  done
+	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+	  test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+
+	  if test "$mode" = uninstall; then
+	    if test -n "$library_names"; then
+	      # Do each command in the postuninstall commands.
+	      cmds=$postuninstall_cmds
+	      save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd"
+		if test "$?" -ne 0 && test "$rmforce" != yes; then
+		  exit_status=1
+		fi
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    if test -n "$old_library"; then
+	      # Do each command in the old_postuninstall commands.
+	      cmds=$old_postuninstall_cmds
+	      save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd"
+		if test "$?" -ne 0 && test "$rmforce" != yes; then
+		  exit_status=1
+		fi
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # FIXME: should reinstall the best remaining shared library.
+	  fi
+	fi
+	;;
+
+      *.lo)
+	# Possibly a libtool object, so verify it.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+
+	  # Read the .lo file
+	  . $dir/$name
+
+	  # Add PIC object to the list of files to remove.
+	  if test -n "$pic_object" \
+	     && test "$pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$pic_object"
+	  fi
+
+	  # Add non-PIC object to the list of files to remove.
+	  if test -n "$non_pic_object" \
+	     && test "$non_pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$non_pic_object"
+	  fi
+	fi
+	;;
+
+      *)
+	if test "$mode" = clean ; then
+	  noexename=$name
+	  case $file in
+	  *.exe)
+	    file=`$echo $file|${SED} 's,.exe$,,'`
+	    noexename=`$echo $name|${SED} 's,.exe$,,'`
+	    # $file with .exe has already been added to rmfiles,
+	    # add $file without .exe
+	    rmfiles="$rmfiles $file"
+	    ;;
+	  esac
+	  # Do a test to see if this is a libtool program.
+	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	    relink_command=
+	    . $dir/$noexename
+
+	    # note $name still contains .exe if it was in $file originally
+	    # as does the version of $file that was added into $rmfiles
+	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+	    if test "$fast_install" = yes && test -n "$relink_command"; then
+	      rmfiles="$rmfiles $objdir/lt-$name"
+	    fi
+	    if test "X$noexename" != "X$name" ; then
+	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+	    fi
+	  fi
+	fi
+	;;
+      esac
+      $show "$rm $rmfiles"
+      $run $rm $rmfiles || exit_status=1
+    done
+    objdir="$origobjdir"
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+	$show "rmdir $dir"
+	$run rmdir $dir >/dev/null 2>&1
+      fi
+    done
+
+    exit $exit_status
+    ;;
+
+  "")
+    $echo "$modename: you must specify a MODE" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+  esac
+
+  if test -z "$exec_cmd"; then
+    $echo "$modename: invalid operation mode \`$mode'" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+  eval exec $exec_cmd
+  exit $EXIT_FAILURE
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+    --config          show all configuration variables
+    --debug           enable verbose shell tracing
+-n, --dry-run         display commands without modifying any files
+    --features        display basic configuration information and exit
+    --finish          same as \`--mode=finish'
+    --help            display this help message and exit
+    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
+    --quiet           same as \`--silent'
+    --silent          don't print informational messages
+    --tag=TAG         use configuration variables from tag TAG
+    --version         print version information
+
+MODE must be one of the following:
+
+      clean           remove files from the build directory
+      compile         compile a source file into a libtool object
+      execute         automatically set library path, then run a program
+      finish          complete the installation of libtool libraries
+      install         install libraries or executables
+      link            create a library or an executable
+      uninstall       remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE.
+
+Report bugs to <bug-libtool at gnu.org>."
+  exit $EXIT_SUCCESS
+  ;;
+
+clean)
+  $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+compile)
+  $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
+  -static           always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+  ;;
+
+execute)
+  $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+  ;;
+
+finish)
+  $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+  ;;
+
+install)
+  $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+  ;;
+
+link)
+  $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+		    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+		    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -static           do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+		    specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+  ;;
+
+uninstall)
+  $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+*)
+  $echo "$modename: invalid operation mode \`$mode'" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+  ;;
+esac
+
+$echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit $EXIT_SUCCESS
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/config/missing b/config/missing
new file mode 100755
index 0000000..894e786
--- /dev/null
+++ b/config/missing
@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+#   Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# 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
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake at gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+	   sed 's/\.am$/.in/' |
+	   while read f; do touch "$f"; done
+    ;;
+
+  autom4te)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    if test -f "$file"; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo "#! /bin/sh"
+	echo "# Created by GNU Automake missing as a replacement of"
+	echo "#  $ $@"
+	echo "exit 0"
+	chmod +x $file
+	exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.y)
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.c
+	    fi
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.h
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f y.tab.h ]; then
+	echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+	echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.l)
+	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" lex.yy.c
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+	echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+	 you modified a dependency of a manual page.  You may need the
+	 \`Help2man' package in order for those modifications to take
+	 effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -f "$file" ]; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo ".ab help2man is required to generate this page"
+	exit 1
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+    fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
+    touch $file
+    ;;
+
+  tar)
+    shift
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+	case "$firstarg" in
+	*o*)
+	    firstarg=`echo "$firstarg" | sed s/o//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+	case "$firstarg" in
+	*h*)
+	    firstarg=`echo "$firstarg" | sed s/h//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequisites for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/configure b/configure
new file mode 100755
index 0000000..feb161e
--- /dev/null
+++ b/configure
@@ -0,0 +1,26642 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.61 for hdf-eos5 1.8.
+#
+# Report bugs to <null at bogus.email>.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+  if (eval ":") 2>/dev/null; then
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+
+  if test $as_have_required = yes && 	 (eval ":
+(as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=\$LINENO
+  as_lineno_2=\$LINENO
+  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+  :
+else
+  as_candidate_shells=
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  case $as_dir in
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+	   done;;
+       esac
+done
+IFS=$as_save_IFS
+
+
+      for as_shell in $as_candidate_shells $SHELL; do
+	 # Try only shells that exist, to save several forks.
+	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		{ ("$as_shell") 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+	       as_have_required=yes
+	       if { "$as_shell" 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+(as_func_return () {
+  (exit $1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+  break
+fi
+
+fi
+
+      done
+
+      if test "x$CONFIG_SHELL" != x; then
+  for as_var in BASH_ENV ENV
+        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+        done
+        export CONFIG_SHELL
+        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+    if test $as_have_required = no; then
+  echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+  echo No shell found that supports shell functions.
+  echo Please tell autoconf at gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
+}
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+    as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+	case $1 in
+        -*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+       echo_test_string="`eval $cmd`" &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "$0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+tagnames=${tagnames+${tagnames},}CXX
+
+tagnames=${tagnames+${tagnames},}F77
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME='hdf-eos5'
+PACKAGE_TARNAME='hdf-eos5'
+PACKAGE_VERSION='1.8'
+PACKAGE_STRING='hdf-eos5 1.8'
+PACKAGE_BUGREPORT='null at bogus.email'
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_default_prefix=`pwd`/hdfeos5
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+CYGPATH_W
+PACKAGE
+VERSION
+ACLOCAL
+AUTOCONF
+AUTOMAKE
+AUTOHEADER
+MAKEINFO
+install_sh
+STRIP
+INSTALL_STRIP_PROGRAM
+mkdir_p
+AWK
+SET_MAKE
+am__leading_dot
+AMTAR
+am__tar
+am__untar
+MAINTAINER_MODE_TRUE
+MAINTAINER_MODE_FALSE
+MAINT
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+DEPDIR
+am__include
+am__quote
+AMDEP_TRUE
+AMDEP_FALSE
+AMDEPBACKSLASH
+CCDEPMODE
+am__fastdepCC_TRUE
+am__fastdepCC_FALSE
+GREP
+EGREP
+LN_S
+ECHO
+AR
+RANLIB
+CPP
+CXX
+CXXFLAGS
+ac_ct_CXX
+CXXDEPMODE
+am__fastdepCXX_TRUE
+am__fastdepCXX_FALSE
+CXXCPP
+F77
+FFLAGS
+ac_ct_F77
+LIBTOOL
+FC
+FCFLAGS
+ac_ct_FC
+THREADSAFE_CONDITIONAL_TRUE
+THREADSAFE_CONDITIONAL_FALSE
+LIBOBJS
+TESTDRIVERS_CONDITIONAL_TRUE
+TESTDRIVERS_CONDITIONAL_FALSE
+INSTALL_INCLUDE_CONDITIONAL_TRUE
+INSTALL_INCLUDE_CONDITIONAL_FALSE
+F2CFORTRAN_CONDITIONAL_TRUE
+F2CFORTRAN_CONDITIONAL_FALSE
+F2CFORTRAN_90_CONDITIONAL_TRUE
+F2CFORTRAN_90_CONDITIONAL_FALSE
+F2CFORTRAN_32PTR_CONDITIONAL_TRUE
+F2CFORTRAN_32PTR_CONDITIONAL_FALSE
+SZIP_ENCODER_CONDITIONAL_TRUE
+SZIP_ENCODER_CONDITIONAL_FALSE
+LTLIBOBJS'
+ac_subst_files=''
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+CXX
+CXXFLAGS
+CCC
+CXXCPP
+F77
+FFLAGS
+FC
+FCFLAGS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *)	ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    eval enable_$ac_feature=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    eval enable_$ac_feature=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    eval with_$ac_package=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    eval with_$ac_package=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute directory names.
+for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
+		datadir sysconfdir sharedstatedir localstatedir includedir \
+		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+		libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; }
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  { echo "$as_me: error: Working directory cannot be determined" >&2
+   { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  { echo "$as_me: error: pwd does not report name of working directory" >&2
+   { (exit 1); exit 1; }; }
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$0" ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$0" : 'X\(//\)[^/]' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+   { (exit 1); exit 1; }; }
+	pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures hdf-eos5 1.8 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+			  [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+			  [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR          info documentation [DATAROOTDIR/info]
+  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR           man documentation [DATAROOTDIR/man]
+  --docdir=DIR           documentation root [DATAROOTDIR/doc/hdf-eos5]
+  --htmldir=DIR          html documentation [DOCDIR]
+  --dvidir=DIR           dvi documentation [DOCDIR]
+  --pdfdir=DIR           pdf documentation [DOCDIR]
+  --psdir=DIR            ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of hdf-eos5 1.8:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-maintainer-mode  enable make rules and dependencies not useful
+			  (and sometimes confusing) to the casual installer
+  --enable-shared[=PKGS]  build shared libraries [default=no]
+  --enable-static[=PKGS]  build static libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+  --enable-install-include
+                          HDF-EOS5 normally only installs libraries, assuming
+                          that users will use the headers in the include
+                          directories. Users who want the standard automake
+                          behavior of installing both libraries and header
+                          files should enable this option.
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-pic              try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-tags[=TAGS]      include additional configurations [automatic]
+  --with-zlib=DIR         Specify path to external zlib library. Linker must
+                          be able to find zlib if HDF5 was built with zlib.
+                          [default=yes]
+  --with-szlib=DIR        Use szlib library for external szlib I/O filter.
+                          Linker must be able to find szlib if HDF5 was build
+                          with szip. [default=no]
+  --with-hdf5=DIR         Specify path to HDF5 library to use while building
+                          [default=yes]
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  CXXCPP      C++ preprocessor
+  F77         Fortran 77 compiler command
+  FFLAGS      Fortran 77 compiler flags
+  FC          Fortran compiler command
+  FCFLAGS     Fortran compiler flags
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <null at bogus.email>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" || continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+hdf-eos5 configure 1.8
+generated by GNU Autoconf 2.61
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by hdf-eos5 $as_me 1.8, which was
+generated by GNU Autoconf 2.61.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      ac_configure_args="$ac_configure_args '$ac_arg'"
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+  set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+  set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+  set x "$ac_default_prefix/share/config.site" \
+	"$ac_default_prefix/etc/config.site"
+fi
+shift
+for ac_site_file
+do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+	ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_config_headers="$ac_config_headers include/HE5_config.h"
+
+
+ac_aux_dir=
+for ac_dir in config "$srcdir"/config; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+
+am__api_version="1.9"
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm -f conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+  SET_MAKE=
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='hdf-eos5'
+ VERSION='1.8'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; }
+    # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+  enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+  USE_MAINTAINER_MODE=no
+fi
+
+  { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; }
+
+
+if test $USE_MAINTAINER_MODE = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi
+
+  MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+# Disable shared libraries (for now)
+# Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=no
+fi
+
+
+
+
+# Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
+fi
+
+
+# Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+{ echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+echo "$as_me: error: invalid value of canonical build" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+echo "$as_me: error: invalid value of canonical host" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+
+
+{ echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+  enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort.  b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions.  Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+if test -z "$ac_file"; then
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	CFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c89=$ac_arg
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC"   am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
+if test "${lt_cv_path_SED+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && break
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+SED=$lt_cv_path_SED
+
+fi
+
+{ echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6; }
+
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in grep ggrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+    # Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_GREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in egrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+    # Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_EGREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+
+   fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+else
+  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+
+{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; }
+if test "${lt_cv_path_NM+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    tmp_nm="$ac_dir/${ac_tool_prefix}nm"
+    if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+      #   nm: unknown option "B" ignored
+      # Tru64's nm complains that /dev/null is an invalid object file
+      case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+      */dev/null* | *'Invalid file or object type'*)
+	lt_cv_path_NM="$tmp_nm -B"
+	break
+        ;;
+      *)
+	case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	*/dev/null*)
+	  lt_cv_path_NM="$tmp_nm -p"
+	  break
+	  ;;
+	*)
+	  lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	  continue # so that we can try to find one that supports BSD flags
+	  ;;
+	esac
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6; }
+NM="$lt_cv_path_NM"
+
+{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5
+echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | kfreebsd*-gnu)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case "$host_cpu" in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  case $host_cpu in
+  alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*)
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+  else
+    lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 4343 "configure"' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    case "`/usr/bin/file conftest.o`" in
+    *32-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+     cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  lt_cv_cc_needs_belf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	lt_cv_cc_needs_belf=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in dlfcn.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------- ##
+## Report this to null at bogus.email ##
+## ------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	CXXFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+depcc="$CXX"  am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; }
+if test -z "$CXXCPP"; then
+  if test "${ac_cv_prog_CXXCPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$F77"; then
+  ac_cv_prog_F77="$F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+F77=$ac_cv_prog_F77
+if test -n "$F77"; then
+  { echo "$as_me:$LINENO: result: $F77" >&5
+echo "${ECHO_T}$F77" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$F77" && break
+  done
+fi
+if test -z "$F77"; then
+  ac_ct_F77=$F77
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_F77"; then
+  ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_F77="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_F77=$ac_cv_prog_ac_ct_F77
+if test -n "$ac_ct_F77"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
+echo "${ECHO_T}$ac_ct_F77" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_F77" && break
+done
+
+  if test "x$ac_ct_F77" = x; then
+    F77=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    F77=$ac_ct_F77
+  fi
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+rm -f a.out
+
+# If we don't use `.F' as extension, the preprocessor is not run on the
+# input file.  (Note that this only needs to work for GNU compilers.)
+ac_save_ext=$ac_ext
+ac_ext=F
+{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; }
+if test "${ac_cv_f77_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+      program main
+#ifndef __GNUC__
+       choke me
+#endif
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_f77_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; }
+ac_ext=$ac_save_ext
+ac_test_FFLAGS=${FFLAGS+set}
+ac_save_FFLAGS=$FFLAGS
+FFLAGS=
+{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
+echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_f77_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  FFLAGS=-g
+cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_f77_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_prog_f77_g=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
+echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; }
+if test "$ac_test_FFLAGS" = set; then
+  FFLAGS=$ac_save_FFLAGS
+elif test $ac_cv_prog_f77_g = yes; then
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-g -O2"
+  else
+    FFLAGS="-g"
+  fi
+else
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-O2"
+  else
+    FFLAGS=
+  fi
+fi
+
+G77=`test $ac_compiler_gnu = yes && echo yes`
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+
+# find the maximum length of command line arguments
+{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+ *)
+    # If test is not a shell built-in, we'll probably end up computing a
+    # maximum length that is only half of the actual maximum length, but
+    # we can't tell.
+    while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
+	       = "XX$teststring") >/dev/null 2>&1 &&
+	    new_result=`expr "X$teststring" : ".*" 2>&1` &&
+	    lt_cv_sys_max_cmd_len=$new_result &&
+	    test $i != 17 # 1/2 MB should be enough
+    do
+      i=`expr $i + 1`
+      teststring=$teststring$teststring
+    done
+    teststring=
+    # Add a significant safety factor because C++ compilers can tack on massive
+    # amounts of additional arguments before passing them to the linker.
+    # It appears as though 1/2 is a usable value.
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    ;;
+  esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+  { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
+else
+  { echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6; }
+fi
+
+
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris* | sysv5*)
+  symcode='[BDRT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode$symcode*\)[ 	][ 	]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+	if grep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+	  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  { echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6; }
+else
+  { echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
+if test "${lt_cv_objdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+  ac_ct_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_AR="ar"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    AR=$ac_ct_AR
+  fi
+else
+  AR="$ac_cv_prog_AR"
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+    ;;
+  *)
+    old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    { echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+enable_dlopen=no
+enable_win32_dll=no
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then
+  withval=$with_pic; pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+#
+# Check for any special shared library compilation flags.
+#
+lt_prog_cc_shlib=
+if test "$GCC" = no; then
+  case $host_os in
+  sco3.2v5*)
+    lt_prog_cc_shlib='-belf'
+    ;;
+  esac
+fi
+if test -n "$lt_prog_cc_shlib"; then
+  { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5
+echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;}
+  if echo "$old_CC $old_CFLAGS " | grep "[ 	]$lt_prog_cc_shlib[ 	]" >/dev/null; then :
+  else
+    { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5
+echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;}
+    lt_cv_prog_cc_can_build_shared=no
+  fi
+fi
+
+
+#
+# Check to make sure the static flag actually works.
+#
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_prog_compiler_static"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+     else
+       lt_prog_compiler_static_works=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; }
+
+if test x"$lt_prog_compiler_static_works" = xyes; then
+    :
+else
+    lt_prog_compiler_static=
+fi
+
+
+
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:7019: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:7023: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      else
+	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    linux*)
+      case $CC in
+      icc* | ecc*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-KPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      lt_prog_compiler_pic='-Kpic'
+      lt_prog_compiler_static='-dn'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic='-Kconform_pic'
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:7252: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:7256: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       lt_prog_compiler_pic_works=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+case "$host_os" in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:7312: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:7316: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s out/conftest.err; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w .
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag=
+  enable_shared_with_static_runtimes=no
+  archive_cmds=
+  archive_expsym_cmds=
+  old_archive_From_new_cmds=
+  old_archive_from_expsyms_cmds=
+  export_dynamic_flag_spec=
+  whole_archive_flag_spec=
+  thread_safe_flag_spec=
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
+  hardcode_libdir_separator=
+  hardcode_direct=no
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  link_all_deplibs=unknown
+  hardcode_automatic=no
+  module_cmds=
+  module_expsym_cmds=
+  always_export_symbols=no
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs=no
+	cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+
+      # Samuel A. Falvo II <kc5tja at dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag=unsupported
+	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000  ${wl}--out-implib,$lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris* | sysv5*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	ld_shlibs=no
+	cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+  linux*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_cmds="$tmp_archive_cmds"
+      supports_anon_versioning=no
+      case `$LD -v 2>/dev/null` in
+        *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+        *\ 2.11.*) ;; # other 2.11 versions
+        *) supports_anon_versioning=yes ;;
+      esac
+      if test $supports_anon_versioning = yes; then
+        archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
+cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+$echo "local: *; };" >> $output_objdir/$libname.ver~
+        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+      else
+        archive_expsym_cmds="$tmp_archive_cmds"
+      fi
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs" = yes; then
+      runpath_var=LD_RUN_PATH
+      hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+      export_dynamic_flag_spec='${wl}--export-dynamic'
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ 	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec=
+      fi
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$link_static_flag"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.012|aix4.012.*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  hardcode_direct=yes
+	  else
+  	  # We have old collect2
+  	  hardcode_direct=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  hardcode_minus_L=yes
+  	  hardcode_libdir_flag_spec='-L$libdir'
+  	  hardcode_libdir_separator=
+	  fi
+	esac
+	shared_flag='-shared'
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+  	if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+  	fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag="-z nodefs"
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag=' ${wl}-bernotok'
+	  allow_undefined_flag=' ${wl}-berok'
+	  # -bexpall does not export symbols beginning with underscore (_)
+	  always_export_symbols=yes
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec=' '
+	  archive_cmds_need_lc=yes
+	  # This is similar to how AIX traditionally builds it's shared libraries.
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs=no
+      ;;
+
+    bsdi4*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      allow_undefined_flag=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
+    darwin* | rhapsody*)
+    if test "$GXX" = yes ; then
+      archive_cmds_need_lc=no
+      case "$host_os" in
+      rhapsody* | darwin1.[012])
+	allow_undefined_flag='-undefined suppress'
+	;;
+      *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+      	allow_undefined_flag='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[012])
+            allow_undefined_flag='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            allow_undefined_flag='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+	;;
+      esac
+    	lt_int_apple_cc_single_mod=no
+    	output_verbose_link_cmd='echo'
+    	if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+    	  lt_int_apple_cc_single_mod=yes
+    	fi
+    	if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+    	  archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+    	else
+        archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      fi
+      module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+        if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+          archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        else
+          archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        fi
+          module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      hardcode_direct=no
+      hardcode_automatic=yes
+      hardcode_shlibpath_var=unsupported
+      whole_archive_flag_spec='-all_load $convenience'
+      link_all_deplibs=yes
+    else
+      ld_shlibs=no
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | kfreebsd*-gnu)
+      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
+
+    hpux10* | hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case "$host_cpu" in
+	hppa*64*|ia64*)
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case "$host_cpu" in
+	hppa*64*|ia64*)
+	  archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  ;;
+	*)
+	  archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	case "$host_cpu" in
+	hppa*64*)
+	  hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	  hardcode_libdir_flag_spec_ld='+b $libdir'
+	  hardcode_libdir_separator=:
+	  hardcode_direct=no
+	  hardcode_shlibpath_var=no
+	  ;;
+	ia64*)
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_direct=no
+	  hardcode_shlibpath_var=no
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L=yes
+	  ;;
+	*)
+	  hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	  hardcode_libdir_separator=:
+	  hardcode_direct=yes
+	  export_dynamic_flag_spec='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_ld='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      link_all_deplibs=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
+
+    openbsd*)
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	export_dynamic_flag_spec='${wl}-E'
+      else
+       case $host_os in
+	 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	   archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	   hardcode_libdir_flag_spec='-R$libdir'
+	   ;;
+	 *)
+	   archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	   hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	   ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      hardcode_libdir_separator=:
+      ;;
+
+    sco3.2v5*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ;;
+
+    solaris*)
+      no_undefined_flag=' -z text'
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+	whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds='$CC -r -o $output$reload_objs'
+	  hardcode_direct=no
+        ;;
+	motorola)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4.2uw2*)
+      archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=no
+      hardcode_shlibpath_var=no
+      hardcode_runpath_var=yes
+      runpath_var=LD_RUN_PATH
+      ;;
+
+   sysv5OpenUNIX8* | sysv5UnixWare7* |  sysv5uw[78]* | unixware7*)
+      no_undefined_flag='${wl}-z ${wl}text'
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv5*)
+      no_undefined_flag=' -z text'
+      # $CC -shared without GNU ld will not create a library from C++
+      # object files and a static libstdc++, better avoid it by now
+      archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      hardcode_libdir_flag_spec=
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag
+        allow_undefined_flag=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc=no
+        else
+	  archive_cmds_need_lc=yes
+        fi
+        allow_undefined_flag=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.01* | freebsdelf3.01*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  *) # from 3.2 on
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case "$host_cpu" in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # find out which ABI we are using
+  libsuff=
+  case "$host_cpu" in
+  x86_64*|s390x*|powerpc64*)
+    echo '#line 8642 "configure"' > conftest.$ac_ext
+    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+      case `/usr/bin/file conftest.$ac_objext` in
+      *64-bit*)
+        libsuff=64
+        sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+        ;;
+      esac
+    fi
+    rm -rf conftest*
+    ;;
+  esac
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=yes
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var " || \
+   test "X$hardcode_automatic"="Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+       else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+       ;;
+   *)
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+    ;;
+  esac
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+   ;;
+
+  *)
+    { echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+if test "${ac_cv_func_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_shl_load || defined __stub___shl_load
+choke me
+#endif
+
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
+if test $ac_cv_func_shl_load = yes; then
+  lt_cv_dlopen="shl_load"
+else
+  { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dld_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dld_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
+if test $ac_cv_lib_dld_shl_load = yes; then
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  { echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+if test "${ac_cv_func_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_dlopen || defined __stub___dlopen
+choke me
+#endif
+
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
+if test $ac_cv_func_dlopen = yes; then
+  lt_cv_dlopen="dlopen"
+else
+  { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_svld_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_svld_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
+if test $ac_cv_lib_svld_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dld_dld_link=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dld_dld_link=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
+if test $ac_cv_lib_dld_dld_link = yes; then
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 9480 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 9578 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+# Report which librarie types wil actually be built
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+  darwin* | rhapsody*)
+  if test "$GCC" = yes; then
+    archive_cmds_need_lc=no
+    case "$host_os" in
+    rhapsody* | darwin1.[012])
+      allow_undefined_flag='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+      	allow_undefined_flag='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[012])
+            allow_undefined_flag='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            allow_undefined_flag='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+      ;;
+    esac
+    output_verbose_link_cmd='echo'
+    archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
+    module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+    # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+    archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag  -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    hardcode_direct=no
+    hardcode_automatic=yes
+    hardcode_shlibpath_var=unsupported
+    whole_archive_flag_spec='-all_load $convenience'
+    link_all_deplibs=yes
+  else
+    ld_shlibs=no
+  fi
+    ;;
+esac
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler \
+    CC \
+    LD \
+    lt_prog_compiler_wl \
+    lt_prog_compiler_pic \
+    lt_prog_compiler_static \
+    lt_prog_compiler_no_builtin_flag \
+    export_dynamic_flag_spec \
+    thread_safe_flag_spec \
+    whole_archive_flag_spec \
+    enable_shared_with_static_runtimes \
+    old_archive_cmds \
+    old_archive_from_new_cmds \
+    predep_objects \
+    postdep_objects \
+    predeps \
+    postdeps \
+    compiler_lib_search_path \
+    archive_cmds \
+    archive_expsym_cmds \
+    postinstall_cmds \
+    postuninstall_cmds \
+    old_archive_from_expsyms_cmds \
+    allow_undefined_flag \
+    no_undefined_flag \
+    export_symbols_cmds \
+    hardcode_libdir_flag_spec \
+    hardcode_libdir_flag_spec_ld \
+    hardcode_libdir_separator \
+    hardcode_automatic \
+    module_cmds \
+    module_expsym_cmds \
+    lt_cv_prog_compiler_c_o \
+    exclude_expsyms \
+    include_expsyms; do
+
+    case $var in
+    old_archive_cmds | \
+    old_archive_from_new_cmds | \
+    archive_cmds | \
+    archive_expsym_cmds | \
+    module_cmds | \
+    module_expsym_cmds | \
+    old_archive_from_expsyms_cmds | \
+    export_symbols_cmds | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  { echo "$as_me:$LINENO: creating $ofile" >&5
+echo "$as_me: creating $ofile" >&6;}
+
+  cat <<__EOF__ >> "$cfgfile"
+#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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 GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# A language-specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+# Check whether --with-tags was given.
+if test "${with_tags+set}" = set; then
+  withval=$with_tags; tagnames="$withval"
+fi
+
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;}
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;}
+    else
+      { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5
+echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;}
+    fi
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in
+    "") ;;
+    *)  { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5
+echo "$as_me: error: invalid tag name: $tagname" >&2;}
+   { (exit 1); exit 1; }; }
+	;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5
+echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+	if test -n "$CXX" && test "X$CXX" != "Xno"; then
+	  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_automatic_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+# Source file extension for C++ test sources.
+ac_ext=cc
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *) { return(0); }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+compiler_CXX=$CC
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+else
+  lt_prog_compiler_no_builtin_flag_CXX=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+else
+  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+	grep 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec_CXX=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+ld_shlibs_CXX=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	    ;;
+	  esac
+	done
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    archive_cmds_CXX=''
+    hardcode_direct_CXX=yes
+    hardcode_libdir_separator_CXX=':'
+    link_all_deplibs_CXX=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.012|aix4.012.*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  hardcode_direct_CXX=yes
+	else
+	  # We have old collect2
+	  hardcode_direct_CXX=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L_CXX=yes
+	  hardcode_libdir_flag_spec_CXX='-L$libdir'
+	  hardcode_libdir_separator_CXX=
+	fi
+      esac
+      shared_flag='-shared'
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	shared_flag='-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    always_export_symbols_CXX=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag_CXX='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+      hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+	hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+	allow_undefined_flag_CXX="-z nodefs"
+	archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+      else
+	# Determine the default libpath from the value encoded in an empty executable.
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	no_undefined_flag_CXX=' ${wl}-bernotok'
+	allow_undefined_flag_CXX=' ${wl}-berok'
+	# -bexpall does not export symbols beginning with underscore (_)
+	always_export_symbols_CXX=yes
+	# Exported symbols can be pulled into shared objects from archives
+	whole_archive_flag_spec_CXX=' '
+	archive_cmds_need_lc_CXX=yes
+	# This is similar to how AIX traditionally builds it's shared libraries.
+	archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+  chorus*)
+    case $cc_basename in
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+    # as there is no search path for DLLs.
+    hardcode_libdir_flag_spec_CXX='-L$libdir'
+    allow_undefined_flag_CXX=unsupported
+    always_export_symbols_CXX=no
+    enable_shared_with_static_runtimes_CXX=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname.def;
+      else
+	echo EXPORTS > $output_objdir/$soname.def;
+	cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+    else
+      ld_shlibs_CXX=no
+    fi
+  ;;
+
+  darwin* | rhapsody*)
+  if test "$GXX" = yes; then
+    archive_cmds_need_lc_CXX=no
+    case "$host_os" in
+    rhapsody* | darwin1.[012])
+      allow_undefined_flag_CXX='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+      	allow_undefined_flag_CXX='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[012])
+            allow_undefined_flag_CXX='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            allow_undefined_flag_CXX='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+      ;;
+    esac
+    lt_int_apple_cc_single_mod=no
+    output_verbose_link_cmd='echo'
+    if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+      lt_int_apple_cc_single_mod=yes
+    fi
+    if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+      archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+    else
+      archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+    fi
+    module_cmds_CXX='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+
+    # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+    if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+      archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    hardcode_direct_CXX=no
+    hardcode_automatic_CXX=yes
+    hardcode_shlibpath_var_CXX=unsupported
+    whole_archive_flag_spec_CXX='-all_load $convenience'
+    link_all_deplibs_CXX=yes
+  else
+    ld_shlibs_CXX=no
+  fi
+    ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      ghcx)
+	# Green Hills C++ Compiler
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  freebsd12*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    ld_shlibs_CXX=no
+    ;;
+  freebsd-elf*)
+    archive_cmds_need_lc_CXX=no
+    ;;
+  freebsd* | kfreebsd*-gnu)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    ld_shlibs_CXX=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator_CXX=:
+    export_dynamic_flag_spec_CXX='${wl}-E'
+    hardcode_direct_CXX=yes
+    hardcode_minus_L_CXX=yes # Not in the search PATH,
+				# but as the default
+				# location of the library.
+
+    case $cc_basename in
+    CC)
+      # FIXME: insert proper C++ library support
+      ld_shlibs_CXX=no
+      ;;
+    aCC)
+      archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      case "$host_cpu" in
+      hppa*64*)
+	hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+	hardcode_libdir_flag_spec_ld_CXX='+b $libdir'
+	hardcode_libdir_separator_CXX=:
+        ;;
+      ia64*)
+	hardcode_libdir_flag_spec_CXX='-L$libdir'
+        ;;
+      *)
+	hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_CXX=:
+	export_dynamic_flag_spec_CXX='${wl}-E'
+        ;;
+      esac
+    fi
+    case "$host_cpu" in
+    hppa*64*)
+      hardcode_direct_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      ;;
+    ia64*)
+      hardcode_direct_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      hardcode_minus_L_CXX=yes # Not in the search PATH,
+					      # but as the default
+					      # location of the library.
+      ;;
+    *)
+      hardcode_direct_CXX=yes
+      hardcode_minus_L_CXX=yes # Not in the search PATH,
+					      # but as the default
+					      # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      aCC)
+	case "$host_cpu" in
+	hppa*64*|ia64*)
+	  archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
+	  ;;
+	*)
+	  archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  ;;
+	esac
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test $with_gnu_ld = no; then
+	    case "$host_cpu" in
+	    ia64*|hppa*64*)
+	      archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
+	      ;;
+	    *)
+	      archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      ;;
+	    esac
+	  fi
+	else
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	fi
+	;;
+    esac
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC)
+	# SGI C++
+	archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+
+	# Archives containing C++ object files must be created using
+	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	;;
+      *)
+	if test "$GXX" = yes; then
+	  if test "$with_gnu_ld" = no; then
+	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+	  else
+	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+	  fi
+	fi
+	link_all_deplibs_CXX=yes
+	;;
+    esac
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator_CXX=:
+    ;;
+  linux*)
+    case $cc_basename in
+      KCC)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+	hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir'
+	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+	;;
+      icpc)
+	# Intel C++
+	with_gnu_ld=yes
+	archive_cmds_need_lc_CXX=no
+	archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	;;
+      cxx)
+	# Compaq C++
+	archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	runpath_var=LD_RUN_PATH
+	hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      hardcode_libdir_flag_spec_CXX='-R$libdir'
+      hardcode_direct_CXX=yes
+      hardcode_shlibpath_var_CXX=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+
+	;;
+      RCC)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      cxx)
+	allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	  archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+
+	  hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	  hardcode_libdir_separator_CXX=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	fi
+	;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC)
+	# Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	# KCC will only create a shared library if the output file
+	# ends with ".so" (or ".sl" for HP-UX), so rename the library
+	# to its proper name (with version) after linking.
+	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Archives containing C++ object files must be created using
+	# the KAI C++ compiler.
+	old_archive_cmds_CXX='$CC -o $oldlib $oldobjs'
+	;;
+      RCC)
+	# Rational C++ 2.4.1
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      cxx)
+	allow_undefined_flag_CXX=' -expect_unresolved \*'
+	archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+	archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	  echo "-hidden">> $lib.exp~
+	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry $objdir/so_locations -o $lib~
+	  $rm $lib.exp'
+
+	hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+	hardcode_libdir_separator_CXX=:
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	;;
+      *)
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	 archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+
+	  hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	  hardcode_libdir_separator_CXX=:
+
+	  # Commands to make compiler produce verbose output that lists
+	  # what "hidden" libraries, object files and flags are used when
+	  # linking a shared library.
+	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+	else
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	fi
+	;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  sco*)
+    archive_cmds_need_lc_CXX=no
+    case $cc_basename in
+      CC)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC)
+	# Sun C++ 4.x
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      lcc)
+	# Lucid
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC)
+	# Sun C++ 4.2, 5.x and Centerline C++
+	no_undefined_flag_CXX=' -zdefs'
+	archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	$CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	hardcode_libdir_flag_spec_CXX='-R$libdir'
+	hardcode_shlibpath_var_CXX=no
+	case $host_os in
+	  solaris2.0-5 | solaris2.0-5.*) ;;
+	  *)
+	    # The C++ compiler is used as linker so we must use $wl
+	    # flag to pass the commands to the underlying system
+	    # linker.
+	    # Supported since Solaris 2.6 (maybe 2.5.1?)
+	    whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	    ;;
+	esac
+	link_all_deplibs_CXX=yes
+
+	# Commands to make compiler produce verbose output that lists
+	# what "hidden" libraries, object files and flags are used when
+	# linking a shared library.
+	#
+	# There doesn't appear to be a way to prevent this compiler from
+	# explicitly linking system object files so we need to strip them
+	# from the output so that they don't get included in the library
+	# dependencies.
+	output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+	# Archives containing C++ object files must be created using
+	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+	;;
+      gcx)
+	# Green Hills C++ Compiler
+	archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	# The C++ compiler must be used to create the archive.
+	old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	;;
+      *)
+	# GNU C++ compiler with Solaris linker
+	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	  no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+	  if $CC --version | grep -v '^2\.7' > /dev/null; then
+	    archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  else
+	    # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	    # platform.
+	    archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  fi
+
+	  hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+	fi
+	;;
+    esac
+    ;;
+  sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*)
+    archive_cmds_need_lc_CXX=no
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC)
+	# NonStop-UX NCC 3.20
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+      *)
+	# FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+esac
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+GCC_CXX="$GXX"
+LD_CXX="$LD"
+
+
+cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+EOF
+
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`"
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+	  || test $p = "-R"; then
+	 prev=$p
+	 continue
+       else
+	 prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 case $p in
+	 -L* | -R*)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$compiler_lib_search_path_CXX"; then
+	     compiler_lib_search_path_CXX="${prev}${p}"
+	   else
+	     compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$postdeps_CXX"; then
+	   postdeps_CXX="${prev}${p}"
+	 else
+	   postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+	 fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$predep_objects_CXX"; then
+	   predep_objects_CXX="$p"
+	 else
+	   predep_objects_CXX="$predep_objects_CXX $p"
+	 fi
+       else
+	 if test -z "$postdep_objects_CXX"; then
+	   postdep_objects_CXX="$p"
+	 else
+	   postdep_objects_CXX="$postdep_objects_CXX $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$rm -f confest.$objext
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+
+lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    lt_prog_compiler_wl_CXX='-Wl,'
+    lt_prog_compiler_static_CXX='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_CXX='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_CXX='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      lt_prog_compiler_pic_CXX=
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_CXX=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+	;;
+      *)
+	lt_prog_compiler_pic_CXX='-fPIC'
+	;;
+      esac
+      ;;
+    *)
+      lt_prog_compiler_pic_CXX='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  lt_prog_compiler_static_CXX='-Bstatic'
+	else
+	  lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68)
+	  # Green Hills C++ Compiler
+	  # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      dgux*)
+	case $cc_basename in
+	  ec++)
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  ghcx)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | kfreebsd*-gnu)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+	    if test "$host_cpu" != ia64; then
+	      lt_prog_compiler_pic_CXX='+Z'
+	    fi
+	    ;;
+	  aCC)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+	    case "$host_cpu" in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      lt_prog_compiler_pic_CXX='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux*)
+	case $cc_basename in
+	  KCC)
+	    # KAI C++ Compiler
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    lt_prog_compiler_pic_CXX='-fPIC'
+	    ;;
+	  icpc)
+	    # Intel C++
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-static'
+	    ;;
+	  cxx)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx)
+	    lt_prog_compiler_pic_CXX='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd*)
+	;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC)
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    ;;
+	  RCC)
+	    # Rational C++ 2.4.1
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  cxx)
+	    # Digital/Compaq C++
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      sco*)
+	case $cc_basename in
+	  CC)
+	    lt_prog_compiler_pic_CXX='-fPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    lt_prog_compiler_wl_CXX='-Qoption ld '
+	    ;;
+	  gcx)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC)
+	    # Sun C++ 4.x
+	    lt_prog_compiler_pic_CXX='-pic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  lcc)
+	    # Lucid
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC)
+	    # NonStop-UX NCC 3.20
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      unixware*)
+	;;
+      vxworks*)
+	;;
+      *)
+	lt_prog_compiler_can_build_shared_CXX=no
+	;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_CXX=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:11753: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:11757: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       lt_prog_compiler_pic_works_CXX=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then
+    case $lt_prog_compiler_pic_CXX in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+     esac
+else
+    lt_prog_compiler_pic_CXX=
+     lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+case "$host_os" in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_CXX=
+    ;;
+  *)
+    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+    ;;
+esac
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:11813: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:11817: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s out/conftest.err; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w .
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    else
+      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    export_symbols_cmds_CXX="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  *)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_CXX=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_CXX in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_CXX
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+        allow_undefined_flag_CXX=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc_CXX=no
+        else
+	  archive_cmds_need_lc_CXX=yes
+        fi
+        allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.01* | freebsdelf3.01*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  *) # from 3.2 on
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case "$host_cpu" in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # find out which ABI we are using
+  libsuff=
+  case "$host_cpu" in
+  x86_64*|s390x*|powerpc64*)
+    echo '#line 12324 "configure"' > conftest.$ac_ext
+    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+      case `/usr/bin/file conftest.$ac_objext` in
+      *64-bit*)
+        libsuff=64
+        sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+        ;;
+      esac
+    fi
+    rm -rf conftest*
+    ;;
+  esac
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=yes
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" || \
+   test -n "$runpath_var CXX" || \
+   test "X$hardcode_automatic_CXX"="Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_CXX" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+     test "$hardcode_minus_L_CXX" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_CXX=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_CXX=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_CXX=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
+echo "${ECHO_T}$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+       else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+       ;;
+   *)
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+    ;;
+  esac
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+   ;;
+
+  *)
+    { echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+if test "${ac_cv_func_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_shl_load || defined __stub___shl_load
+choke me
+#endif
+
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
+if test $ac_cv_func_shl_load = yes; then
+  lt_cv_dlopen="shl_load"
+else
+  { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dld_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dld_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
+if test $ac_cv_lib_dld_shl_load = yes; then
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  { echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+if test "${ac_cv_func_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_dlopen || defined __stub___dlopen
+choke me
+#endif
+
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
+if test $ac_cv_func_dlopen = yes; then
+  lt_cv_dlopen="dlopen"
+else
+  { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_svld_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_svld_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
+if test $ac_cv_lib_svld_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dld_dld_link=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dld_dld_link=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
+if test $ac_cv_lib_dld_dld_link = yes; then
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 13162 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 13260 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_CXX \
+    CC_CXX \
+    LD_CXX \
+    lt_prog_compiler_wl_CXX \
+    lt_prog_compiler_pic_CXX \
+    lt_prog_compiler_static_CXX \
+    lt_prog_compiler_no_builtin_flag_CXX \
+    export_dynamic_flag_spec_CXX \
+    thread_safe_flag_spec_CXX \
+    whole_archive_flag_spec_CXX \
+    enable_shared_with_static_runtimes_CXX \
+    old_archive_cmds_CXX \
+    old_archive_from_new_cmds_CXX \
+    predep_objects_CXX \
+    postdep_objects_CXX \
+    predeps_CXX \
+    postdeps_CXX \
+    compiler_lib_search_path_CXX \
+    archive_cmds_CXX \
+    archive_expsym_cmds_CXX \
+    postinstall_cmds_CXX \
+    postuninstall_cmds_CXX \
+    old_archive_from_expsyms_cmds_CXX \
+    allow_undefined_flag_CXX \
+    no_undefined_flag_CXX \
+    export_symbols_cmds_CXX \
+    hardcode_libdir_flag_spec_CXX \
+    hardcode_libdir_flag_spec_ld_CXX \
+    hardcode_libdir_separator_CXX \
+    hardcode_automatic_CXX \
+    module_cmds_CXX \
+    module_expsym_cmds_CXX \
+    lt_cv_prog_compiler_c_o_CXX \
+    exclude_expsyms_CXX \
+    include_expsyms_CXX; do
+
+    case $var in
+    old_archive_cmds_CXX | \
+    old_archive_from_new_cmds_CXX | \
+    archive_cmds_CXX | \
+    archive_expsym_cmds_CXX | \
+    module_cmds_CXX | \
+    module_expsym_cmds_CXX | \
+    old_archive_from_expsyms_cmds_CXX | \
+    export_symbols_cmds_CXX | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# A language-specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_CXX
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_CXX
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_CXX
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_CXX"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+
+	else
+	  tagname=""
+	fi
+	;;
+
+      F77)
+	if test -n "$F77" && test "X$F77" != "Xno"; then
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+
+
+archive_cmds_need_lc_F77=no
+allow_undefined_flag_F77=
+always_export_symbols_F77=no
+archive_expsym_cmds_F77=
+export_dynamic_flag_spec_F77=
+hardcode_direct_F77=no
+hardcode_libdir_flag_spec_F77=
+hardcode_libdir_flag_spec_ld_F77=
+hardcode_libdir_separator_F77=
+hardcode_minus_L_F77=no
+hardcode_automatic_F77=no
+module_cmds_F77=
+module_expsym_cmds_F77=
+link_all_deplibs_F77=unknown
+old_archive_cmds_F77=$old_archive_cmds
+no_undefined_flag_F77=
+whole_archive_flag_spec_F77=
+enable_shared_with_static_runtimes_F77=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+objext_F77=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="      program t\n      end\n"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+compiler_F77=$CC
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+aix4* | aix5*)
+  test "$enable_shared" = yes && enable_static=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
+
+test "$ld_shlibs_F77" = no && can_build_shared=no
+
+GCC_F77="$G77"
+LD_F77="$LD"
+
+lt_prog_compiler_wl_F77=
+lt_prog_compiler_pic_F77=
+lt_prog_compiler_static_F77=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_F77='-Wl,'
+    lt_prog_compiler_static_F77='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_F77='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_F77='-fno-common'
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_F77=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_F77=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_F77='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic_F77='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_F77='-Bstatic'
+      else
+	lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_F77='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_F77='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    linux*)
+      case $CC in
+      icc* | ecc*)
+	lt_prog_compiler_wl_F77='-Wl,'
+	lt_prog_compiler_pic_F77='-KPIC'
+	lt_prog_compiler_static_F77='-static'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_F77='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_F77='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      lt_prog_compiler_pic_F77='-Kpic'
+      lt_prog_compiler_static_F77='-dn'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl_F77='-Qoption ld '
+      lt_prog_compiler_pic_F77='-PIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic_F77='-Kconform_pic'
+	lt_prog_compiler_static_F77='-Bstatic'
+      fi
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic_F77='-pic'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared_F77=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_F77"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_F77=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_F77"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:14087: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:14091: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       lt_prog_compiler_pic_works_F77=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_F77" = xyes; then
+    case $lt_prog_compiler_pic_F77 in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;;
+     esac
+else
+    lt_prog_compiler_pic_F77=
+     lt_prog_compiler_can_build_shared_F77=no
+fi
+
+fi
+case "$host_os" in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_F77=
+    ;;
+  *)
+    lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77"
+    ;;
+esac
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_F77=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:14147: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:14151: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s out/conftest.err; then
+       lt_cv_prog_compiler_c_o_F77=yes
+     fi
+   fi
+   chmod u+w .
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag_F77=
+  enable_shared_with_static_runtimes_F77=no
+  archive_cmds_F77=
+  archive_expsym_cmds_F77=
+  old_archive_From_new_cmds_F77=
+  old_archive_from_expsyms_cmds_F77=
+  export_dynamic_flag_spec_F77=
+  whole_archive_flag_spec_F77=
+  thread_safe_flag_spec_F77=
+  hardcode_libdir_flag_spec_F77=
+  hardcode_libdir_flag_spec_ld_F77=
+  hardcode_libdir_separator_F77=
+  hardcode_direct_F77=no
+  hardcode_minus_L_F77=no
+  hardcode_shlibpath_var_F77=unsupported
+  link_all_deplibs_F77=unknown
+  hardcode_automatic_F77=no
+  module_cmds_F77=
+  module_expsym_cmds_F77=
+  always_export_symbols_F77=no
+  export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_F77=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs_F77=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs_F77=no
+	cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+
+      # Samuel A. Falvo II <kc5tja at dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs_F77=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag_F77=unsupported
+	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      allow_undefined_flag_F77=unsupported
+      always_export_symbols_F77=no
+      enable_shared_with_static_runtimes_F77=yes
+      export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000  ${wl}--out-implib,$lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris* | sysv5*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	ld_shlibs_F77=no
+	cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    sunos4*)
+      archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+  linux*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_cmds_F77="$tmp_archive_cmds"
+      supports_anon_versioning=no
+      case `$LD -v 2>/dev/null` in
+        *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+        *\ 2.11.*) ;; # other 2.11 versions
+        *) supports_anon_versioning=yes ;;
+      esac
+      if test $supports_anon_versioning = yes; then
+        archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~
+cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+$echo "local: *; };" >> $output_objdir/$libname.ver~
+        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+      else
+        archive_expsym_cmds_F77="$tmp_archive_cmds"
+      fi
+    else
+      ld_shlibs_F77=no
+    fi
+    ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs_F77" = yes; then
+      runpath_var=LD_RUN_PATH
+      hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir'
+      export_dynamic_flag_spec_F77='${wl}--export-dynamic'
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ 	whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec_F77=
+      fi
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_F77=unsupported
+      always_export_symbols_F77=yes
+      archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_F77=yes
+      if test "$GCC" = yes && test -z "$link_static_flag"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct_F77=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds_F77=''
+      hardcode_direct_F77=yes
+      hardcode_libdir_separator_F77=':'
+      link_all_deplibs_F77=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.012|aix4.012.*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  hardcode_direct_F77=yes
+	  else
+  	  # We have old collect2
+  	  hardcode_direct_F77=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  hardcode_minus_L_F77=yes
+  	  hardcode_libdir_flag_spec_F77='-L$libdir'
+  	  hardcode_libdir_separator_F77=
+	  fi
+	esac
+	shared_flag='-shared'
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+  	if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+  	fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_F77=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag_F77='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+	archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag_F77="-z nodefs"
+	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag_F77=' ${wl}-bernotok'
+	  allow_undefined_flag_F77=' ${wl}-berok'
+	  # -bexpall does not export symbols beginning with underscore (_)
+	  always_export_symbols_F77=yes
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec_F77=' '
+	  archive_cmds_need_lc_F77=yes
+	  # This is similar to how AIX traditionally builds it's shared libraries.
+	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs_F77=no
+      ;;
+
+    bsdi4*)
+      export_dynamic_flag_spec_F77=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec_F77=' '
+      allow_undefined_flag_F77=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds_F77='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes_F77=yes
+      ;;
+
+    darwin* | rhapsody*)
+    if test "$GXX" = yes ; then
+      archive_cmds_need_lc_F77=no
+      case "$host_os" in
+      rhapsody* | darwin1.[012])
+	allow_undefined_flag_F77='-undefined suppress'
+	;;
+      *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+      	allow_undefined_flag_F77='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[012])
+            allow_undefined_flag_F77='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            allow_undefined_flag_F77='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+	;;
+      esac
+    	lt_int_apple_cc_single_mod=no
+    	output_verbose_link_cmd='echo'
+    	if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+    	  lt_int_apple_cc_single_mod=yes
+    	fi
+    	if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+    	  archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+    	else
+        archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      fi
+      module_cmds_F77='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+        if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+          archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        else
+          archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        fi
+          module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      hardcode_direct_F77=no
+      hardcode_automatic_F77=yes
+      hardcode_shlibpath_var_F77=unsupported
+      whole_archive_flag_spec_F77='-all_load $convenience'
+      link_all_deplibs_F77=yes
+    else
+      ld_shlibs_F77=no
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs_F77=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | kfreebsd*-gnu)
+      archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      hardcode_direct_F77=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_F77=yes
+      export_dynamic_flag_spec_F77='${wl}-E'
+      ;;
+
+    hpux10* | hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case "$host_cpu" in
+	hppa*64*|ia64*)
+	  archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case "$host_cpu" in
+	hppa*64*|ia64*)
+	  archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  ;;
+	*)
+	  archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	case "$host_cpu" in
+	hppa*64*)
+	  hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+	  hardcode_libdir_flag_spec_ld_F77='+b $libdir'
+	  hardcode_libdir_separator_F77=:
+	  hardcode_direct_F77=no
+	  hardcode_shlibpath_var_F77=no
+	  ;;
+	ia64*)
+	  hardcode_libdir_flag_spec_F77='-L$libdir'
+	  hardcode_direct_F77=no
+	  hardcode_shlibpath_var_F77=no
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L_F77=yes
+	  ;;
+	*)
+	  hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+	  hardcode_libdir_separator_F77=:
+	  hardcode_direct_F77=yes
+	  export_dynamic_flag_spec_F77='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L_F77=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_ld_F77='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      link_all_deplibs_F77=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    newsos6)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    openbsd*)
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+	export_dynamic_flag_spec_F77='${wl}-E'
+      else
+       case $host_os in
+	 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	   archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	   hardcode_libdir_flag_spec_F77='-R$libdir'
+	   ;;
+	 *)
+	   archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	   hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+	   ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+      allow_undefined_flag_F77=unsupported
+      archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag_F77=' -expect_unresolved \*'
+	archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag_F77=' -expect_unresolved \*'
+	archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec_F77='-rpath $libdir'
+      fi
+      hardcode_libdir_separator_F77=:
+      ;;
+
+    sco3.2v5*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_F77=no
+      export_dynamic_flag_spec_F77='${wl}-Bexport'
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ;;
+
+    solaris*)
+      no_undefined_flag_F77=' -z text'
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_shlibpath_var_F77=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+	whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;;
+      esac
+      link_all_deplibs_F77=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_F77=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds_F77='$CC -r -o $output$reload_objs'
+	  hardcode_direct_F77=no
+        ;;
+	motorola)
+	  archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_F77=no
+      export_dynamic_flag_spec_F77='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var_F77=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs_F77=yes
+      fi
+      ;;
+
+    sysv4.2uw2*)
+      archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=no
+      hardcode_shlibpath_var_F77=no
+      hardcode_runpath_var=yes
+      runpath_var=LD_RUN_PATH
+      ;;
+
+   sysv5OpenUNIX8* | sysv5UnixWare7* |  sysv5uw[78]* | unixware7*)
+      no_undefined_flag_F77='${wl}-z ${wl}text'
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv5*)
+      no_undefined_flag_F77=' -z text'
+      # $CC -shared without GNU ld will not create a library from C++
+      # object files and a static libstdc++, better avoid it by now
+      archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      hardcode_libdir_flag_spec_F77=
+      hardcode_shlibpath_var_F77=no
+      runpath_var='LD_RUN_PATH'
+      ;;
+
+    uts4*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    *)
+      ld_shlibs_F77=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
+echo "${ECHO_T}$ld_shlibs_F77" >&6; }
+test "$ld_shlibs_F77" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_F77" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_F77=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_F77 in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_F77
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_F77
+        allow_undefined_flag_F77=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc_F77=no
+        else
+	  archive_cmds_need_lc_F77=yes
+        fi
+        allow_undefined_flag_F77=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.01* | freebsdelf3.01*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  *) # from 3.2 on
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case "$host_cpu" in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # find out which ABI we are using
+  libsuff=
+  case "$host_cpu" in
+  x86_64*|s390x*|powerpc64*)
+    echo '#line 15457 "configure"' > conftest.$ac_ext
+    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+      case `/usr/bin/file conftest.$ac_objext` in
+      *64-bit*)
+        libsuff=64
+        sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+        ;;
+      esac
+    fi
+    rm -rf conftest*
+    ;;
+  esac
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=yes
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_F77=
+if test -n "$hardcode_libdir_flag_spec_F77" || \
+   test -n "$runpath_var F77" || \
+   test "X$hardcode_automatic_F77"="Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_F77" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no &&
+     test "$hardcode_minus_L_F77" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_F77=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_F77=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_F77=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
+echo "${ECHO_T}$hardcode_action_F77" >&6; }
+
+if test "$hardcode_action_F77" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+       else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+       ;;
+   *)
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+    ;;
+  esac
+fi
+
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_F77 \
+    CC_F77 \
+    LD_F77 \
+    lt_prog_compiler_wl_F77 \
+    lt_prog_compiler_pic_F77 \
+    lt_prog_compiler_static_F77 \
+    lt_prog_compiler_no_builtin_flag_F77 \
+    export_dynamic_flag_spec_F77 \
+    thread_safe_flag_spec_F77 \
+    whole_archive_flag_spec_F77 \
+    enable_shared_with_static_runtimes_F77 \
+    old_archive_cmds_F77 \
+    old_archive_from_new_cmds_F77 \
+    predep_objects_F77 \
+    postdep_objects_F77 \
+    predeps_F77 \
+    postdeps_F77 \
+    compiler_lib_search_path_F77 \
+    archive_cmds_F77 \
+    archive_expsym_cmds_F77 \
+    postinstall_cmds_F77 \
+    postuninstall_cmds_F77 \
+    old_archive_from_expsyms_cmds_F77 \
+    allow_undefined_flag_F77 \
+    no_undefined_flag_F77 \
+    export_symbols_cmds_F77 \
+    hardcode_libdir_flag_spec_F77 \
+    hardcode_libdir_flag_spec_ld_F77 \
+    hardcode_libdir_separator_F77 \
+    hardcode_automatic_F77 \
+    module_cmds_F77 \
+    module_expsym_cmds_F77 \
+    lt_cv_prog_compiler_c_o_F77 \
+    exclude_expsyms_F77 \
+    include_expsyms_F77; do
+
+    case $var in
+    old_archive_cmds_F77 | \
+    old_archive_from_new_cmds_F77 | \
+    archive_cmds_F77 | \
+    archive_expsym_cmds_F77 | \
+    module_cmds_F77 | \
+    module_expsym_cmds_F77 | \
+    old_archive_from_expsyms_cmds_F77 | \
+    export_symbols_cmds_F77 | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_F77
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# A language-specific compiler.
+CC=$lt_compiler_F77
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_F77
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_F77
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_F77
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_F77
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_F77
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_F77
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_F77
+archive_expsym_cmds=$lt_archive_expsym_cmds_F77
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_F77
+module_expsym_cmds=$lt_module_expsym_cmds_F77
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_F77
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_F77
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_F77
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_F77
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_F77
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_F77
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_F77
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_F77
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_F77
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_F77
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_F77
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_F77"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_F77
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_F77
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_F77
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_F77
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+	else
+	  tagname=""
+	fi
+	;;
+
+      GCJ)
+	if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+objext_GCJ=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+compiler_GCJ=$CC
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+archive_cmds_need_lc_GCJ=no
+
+
+lt_prog_compiler_no_builtin_flag_GCJ=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin'
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:16197: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:16201: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+lt_prog_compiler_wl_GCJ=
+lt_prog_compiler_pic_GCJ=
+lt_prog_compiler_static_GCJ=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_GCJ='-Wl,'
+    lt_prog_compiler_static_GCJ='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_GCJ='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_GCJ='-fno-common'
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_GCJ=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_GCJ=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_GCJ='-fPIC'
+	;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic_GCJ='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_GCJ='-Bstatic'
+      else
+	lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case "$host_cpu" in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_GCJ='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    linux*)
+      case $CC in
+      icc* | ecc*)
+	lt_prog_compiler_wl_GCJ='-Wl,'
+	lt_prog_compiler_pic_GCJ='-KPIC'
+	lt_prog_compiler_static_GCJ='-static'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_GCJ='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_GCJ='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      lt_prog_compiler_pic_GCJ='-Kpic'
+      lt_prog_compiler_static_GCJ='-dn'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl_GCJ='-Qoption ld '
+      lt_prog_compiler_pic_GCJ='-PIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic_GCJ='-Kconform_pic'
+	lt_prog_compiler_static_GCJ='-Bstatic'
+      fi
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic_GCJ='-pic'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared_GCJ=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_GCJ"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_GCJ=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_GCJ"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:16430: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:16434: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       lt_prog_compiler_pic_works_GCJ=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then
+    case $lt_prog_compiler_pic_GCJ in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;;
+     esac
+else
+    lt_prog_compiler_pic_GCJ=
+     lt_prog_compiler_can_build_shared_GCJ=no
+fi
+
+fi
+case "$host_os" in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_GCJ=
+    ;;
+  *)
+    lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ"
+    ;;
+esac
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_GCJ=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:16490: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:16494: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s out/conftest.err; then
+       lt_cv_prog_compiler_c_o_GCJ=yes
+     fi
+   fi
+   chmod u+w .
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag_GCJ=
+  enable_shared_with_static_runtimes_GCJ=no
+  archive_cmds_GCJ=
+  archive_expsym_cmds_GCJ=
+  old_archive_From_new_cmds_GCJ=
+  old_archive_from_expsyms_cmds_GCJ=
+  export_dynamic_flag_spec_GCJ=
+  whole_archive_flag_spec_GCJ=
+  thread_safe_flag_spec_GCJ=
+  hardcode_libdir_flag_spec_GCJ=
+  hardcode_libdir_flag_spec_ld_GCJ=
+  hardcode_libdir_separator_GCJ=
+  hardcode_direct_GCJ=no
+  hardcode_minus_L_GCJ=no
+  hardcode_shlibpath_var_GCJ=unsupported
+  link_all_deplibs_GCJ=unknown
+  hardcode_automatic_GCJ=no
+  module_cmds_GCJ=
+  module_expsym_cmds_GCJ=
+  always_export_symbols_GCJ=no
+  export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_GCJ=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs_GCJ=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs_GCJ=no
+	cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+
+      # Samuel A. Falvo II <kc5tja at dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs_GCJ=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag_GCJ=unsupported
+	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      allow_undefined_flag_GCJ=unsupported
+      always_export_symbols_GCJ=no
+      enable_shared_with_static_runtimes_GCJ=yes
+      export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000  ${wl}--out-implib,$lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris* | sysv5*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+	ld_shlibs_GCJ=no
+	cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    sunos4*)
+      archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+  linux*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_cmds_GCJ="$tmp_archive_cmds"
+      supports_anon_versioning=no
+      case `$LD -v 2>/dev/null` in
+        *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+        *\ 2.11.*) ;; # other 2.11 versions
+        *) supports_anon_versioning=yes ;;
+      esac
+      if test $supports_anon_versioning = yes; then
+        archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~
+cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+$echo "local: *; };" >> $output_objdir/$libname.ver~
+        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+      else
+        archive_expsym_cmds_GCJ="$tmp_archive_cmds"
+      fi
+    else
+      ld_shlibs_GCJ=no
+    fi
+    ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs_GCJ" = yes; then
+      runpath_var=LD_RUN_PATH
+      hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir'
+      export_dynamic_flag_spec_GCJ='${wl}--export-dynamic'
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ 	whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec_GCJ=
+      fi
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_GCJ=unsupported
+      always_export_symbols_GCJ=yes
+      archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_GCJ=yes
+      if test "$GCC" = yes && test -z "$link_static_flag"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct_GCJ=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+	  export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	  for ld_flag in $LDFLAGS; do
+  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+  	    aix_use_runtimelinking=yes
+  	    break
+  	  fi
+	  done
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds_GCJ=''
+      hardcode_direct_GCJ=yes
+      hardcode_libdir_separator_GCJ=':'
+      link_all_deplibs_GCJ=yes
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.012|aix4.012.*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" && \
+  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
+	  then
+  	  # We have reworked collect2
+  	  hardcode_direct_GCJ=yes
+	  else
+  	  # We have old collect2
+  	  hardcode_direct_GCJ=unsupported
+  	  # It fails to find uninstalled libraries when the uninstalled
+  	  # path is not listed in the libpath.  Setting hardcode_minus_L
+  	  # to unsupported forces relinking
+  	  hardcode_minus_L_GCJ=yes
+  	  hardcode_libdir_flag_spec_GCJ='-L$libdir'
+  	  hardcode_libdir_separator_GCJ=
+	  fi
+	esac
+	shared_flag='-shared'
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+  	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+  	if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+  	fi
+	fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_GCJ=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag_GCJ='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+	archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag_GCJ="-z nodefs"
+	  archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an empty executable.
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag_GCJ=' ${wl}-bernotok'
+	  allow_undefined_flag_GCJ=' ${wl}-berok'
+	  # -bexpall does not export symbols beginning with underscore (_)
+	  always_export_symbols_GCJ=yes
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec_GCJ=' '
+	  archive_cmds_need_lc_GCJ=yes
+	  # This is similar to how AIX traditionally builds it's shared libraries.
+	  archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs_GCJ=no
+      ;;
+
+    bsdi4*)
+      export_dynamic_flag_spec_GCJ=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec_GCJ=' '
+      allow_undefined_flag_GCJ=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds_GCJ='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes_GCJ=yes
+      ;;
+
+    darwin* | rhapsody*)
+    if test "$GXX" = yes ; then
+      archive_cmds_need_lc_GCJ=no
+      case "$host_os" in
+      rhapsody* | darwin1.[012])
+	allow_undefined_flag_GCJ='-undefined suppress'
+	;;
+      *) # Darwin 1.3 on
+      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+      	allow_undefined_flag_GCJ='-flat_namespace -undefined suppress'
+      else
+        case ${MACOSX_DEPLOYMENT_TARGET} in
+          10.[012])
+            allow_undefined_flag_GCJ='-flat_namespace -undefined suppress'
+            ;;
+          10.*)
+            allow_undefined_flag_GCJ='-undefined dynamic_lookup'
+            ;;
+        esac
+      fi
+	;;
+      esac
+    	lt_int_apple_cc_single_mod=no
+    	output_verbose_link_cmd='echo'
+    	if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
+    	  lt_int_apple_cc_single_mod=yes
+    	fi
+    	if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+    	  archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+    	else
+        archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      fi
+      module_cmds_GCJ='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+        if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+          archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        else
+          archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        fi
+          module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      hardcode_direct_GCJ=no
+      hardcode_automatic_GCJ=yes
+      hardcode_shlibpath_var_GCJ=unsupported
+      whole_archive_flag_spec_GCJ='-all_load $convenience'
+      link_all_deplibs_GCJ=yes
+    else
+      ld_shlibs_GCJ=no
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs_GCJ=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | kfreebsd*-gnu)
+      archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      hardcode_direct_GCJ=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_GCJ=yes
+      export_dynamic_flag_spec_GCJ='${wl}-E'
+      ;;
+
+    hpux10* | hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case "$host_cpu" in
+	hppa*64*|ia64*)
+	  archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case "$host_cpu" in
+	hppa*64*|ia64*)
+	  archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  ;;
+	*)
+	  archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	case "$host_cpu" in
+	hppa*64*)
+	  hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+	  hardcode_libdir_flag_spec_ld_GCJ='+b $libdir'
+	  hardcode_libdir_separator_GCJ=:
+	  hardcode_direct_GCJ=no
+	  hardcode_shlibpath_var_GCJ=no
+	  ;;
+	ia64*)
+	  hardcode_libdir_flag_spec_GCJ='-L$libdir'
+	  hardcode_direct_GCJ=no
+	  hardcode_shlibpath_var_GCJ=no
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L_GCJ=yes
+	  ;;
+	*)
+	  hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+	  hardcode_libdir_separator_GCJ=:
+	  hardcode_direct_GCJ=yes
+	  export_dynamic_flag_spec_GCJ='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L_GCJ=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      link_all_deplibs_GCJ=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+	archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    newsos6)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    openbsd*)
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+	export_dynamic_flag_spec_GCJ='${wl}-E'
+      else
+       case $host_os in
+	 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	   archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	   hardcode_libdir_flag_spec_GCJ='-R$libdir'
+	   ;;
+	 *)
+	   archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	   hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+	   ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+      allow_undefined_flag_GCJ=unsupported
+      archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag_GCJ=' -expect_unresolved \*'
+	archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag_GCJ=' -expect_unresolved \*'
+	archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec_GCJ='-rpath $libdir'
+      fi
+      hardcode_libdir_separator_GCJ=:
+      ;;
+
+    sco3.2v5*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_GCJ=no
+      export_dynamic_flag_spec_GCJ='${wl}-Bexport'
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ;;
+
+    solaris*)
+      no_undefined_flag_GCJ=' -z text'
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+	archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+	whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;;
+      esac
+      link_all_deplibs_GCJ=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_GCJ=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds_GCJ='$CC -r -o $output$reload_objs'
+	  hardcode_direct_GCJ=no
+        ;;
+	motorola)
+	  archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_GCJ=no
+      export_dynamic_flag_spec_GCJ='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var_GCJ=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs_GCJ=yes
+      fi
+      ;;
+
+    sysv4.2uw2*)
+      archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      hardcode_runpath_var=yes
+      runpath_var=LD_RUN_PATH
+      ;;
+
+   sysv5OpenUNIX8* | sysv5UnixWare7* |  sysv5uw[78]* | unixware7*)
+      no_undefined_flag_GCJ='${wl}-z ${wl}text'
+      if test "$GCC" = yes; then
+	archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv5*)
+      no_undefined_flag_GCJ=' -z text'
+      # $CC -shared without GNU ld will not create a library from C++
+      # object files and a static libstdc++, better avoid it by now
+      archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+  		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      hardcode_libdir_flag_spec_GCJ=
+      hardcode_shlibpath_var_GCJ=no
+      runpath_var='LD_RUN_PATH'
+      ;;
+
+    uts4*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    *)
+      ld_shlibs_GCJ=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
+echo "${ECHO_T}$ld_shlibs_GCJ" >&6; }
+test "$ld_shlibs_GCJ" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_GCJ" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_GCJ=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_GCJ in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_GCJ
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ
+        allow_undefined_flag_GCJ=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+	  archive_cmds_need_lc_GCJ=no
+        else
+	  archive_cmds_need_lc_GCJ=yes
+        fi
+        allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+kfreebsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.01* | freebsdelf3.01*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  *) # from 3.2 on
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case "$host_cpu" in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # find out which ABI we are using
+  libsuff=
+  case "$host_cpu" in
+  x86_64*|s390x*|powerpc64*)
+    echo '#line 17820 "configure"' > conftest.$ac_ext
+    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+      case `/usr/bin/file conftest.$ac_objext` in
+      *64-bit*)
+        libsuff=64
+        sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+        ;;
+      esac
+    fi
+    rm -rf conftest*
+    ;;
+  esac
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+knetbsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='GNU ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=yes
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_GCJ=
+if test -n "$hardcode_libdir_flag_spec_GCJ" || \
+   test -n "$runpath_var GCJ" || \
+   test "X$hardcode_automatic_GCJ"="Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_GCJ" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no &&
+     test "$hardcode_minus_L_GCJ" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_GCJ=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_GCJ=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_GCJ=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
+echo "${ECHO_T}$hardcode_action_GCJ" >&6; }
+
+if test "$hardcode_action_GCJ" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+       else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+       ;;
+   *)
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+    ;;
+  esac
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+   ;;
+
+  *)
+    { echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+if test "${ac_cv_func_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_shl_load || defined __stub___shl_load
+choke me
+#endif
+
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
+if test $ac_cv_func_shl_load = yes; then
+  lt_cv_dlopen="shl_load"
+else
+  { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dld_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dld_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
+if test $ac_cv_lib_dld_shl_load = yes; then
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  { echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+if test "${ac_cv_func_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_dlopen || defined __stub___dlopen
+choke me
+#endif
+
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
+if test $ac_cv_func_dlopen = yes; then
+  lt_cv_dlopen="dlopen"
+else
+  { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_svld_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_svld_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
+if test $ac_cv_lib_svld_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dld_dld_link=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dld_dld_link=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
+if test $ac_cv_lib_dld_dld_link = yes; then
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 18658 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 18756 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_GCJ \
+    CC_GCJ \
+    LD_GCJ \
+    lt_prog_compiler_wl_GCJ \
+    lt_prog_compiler_pic_GCJ \
+    lt_prog_compiler_static_GCJ \
+    lt_prog_compiler_no_builtin_flag_GCJ \
+    export_dynamic_flag_spec_GCJ \
+    thread_safe_flag_spec_GCJ \
+    whole_archive_flag_spec_GCJ \
+    enable_shared_with_static_runtimes_GCJ \
+    old_archive_cmds_GCJ \
+    old_archive_from_new_cmds_GCJ \
+    predep_objects_GCJ \
+    postdep_objects_GCJ \
+    predeps_GCJ \
+    postdeps_GCJ \
+    compiler_lib_search_path_GCJ \
+    archive_cmds_GCJ \
+    archive_expsym_cmds_GCJ \
+    postinstall_cmds_GCJ \
+    postuninstall_cmds_GCJ \
+    old_archive_from_expsyms_cmds_GCJ \
+    allow_undefined_flag_GCJ \
+    no_undefined_flag_GCJ \
+    export_symbols_cmds_GCJ \
+    hardcode_libdir_flag_spec_GCJ \
+    hardcode_libdir_flag_spec_ld_GCJ \
+    hardcode_libdir_separator_GCJ \
+    hardcode_automatic_GCJ \
+    module_cmds_GCJ \
+    module_expsym_cmds_GCJ \
+    lt_cv_prog_compiler_c_o_GCJ \
+    exclude_expsyms_GCJ \
+    include_expsyms_GCJ; do
+
+    case $var in
+    old_archive_cmds_GCJ | \
+    old_archive_from_new_cmds_GCJ | \
+    archive_cmds_GCJ | \
+    archive_expsym_cmds_GCJ | \
+    module_cmds_GCJ | \
+    module_expsym_cmds_GCJ | \
+    old_archive_from_expsyms_cmds_GCJ | \
+    export_symbols_cmds_GCJ | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_GCJ
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# A language-specific compiler.
+CC=$lt_compiler_GCJ
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_GCJ
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_GCJ
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_GCJ
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_GCJ
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_GCJ
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_GCJ
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_GCJ
+archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_GCJ
+module_expsym_cmds=$lt_module_expsym_cmds_GCJ
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_GCJ
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_GCJ
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_GCJ
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_GCJ
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_GCJ
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_GCJ
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_GCJ
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_GCJ
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_GCJ
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_GCJ"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_GCJ
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_GCJ
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_GCJ
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_GCJ
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+	else
+	  tagname=""
+	fi
+	;;
+
+      RC)
+
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+objext_RC=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+compiler_RC=$CC
+lt_cv_prog_compiler_c_o_RC=yes
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_RC \
+    CC_RC \
+    LD_RC \
+    lt_prog_compiler_wl_RC \
+    lt_prog_compiler_pic_RC \
+    lt_prog_compiler_static_RC \
+    lt_prog_compiler_no_builtin_flag_RC \
+    export_dynamic_flag_spec_RC \
+    thread_safe_flag_spec_RC \
+    whole_archive_flag_spec_RC \
+    enable_shared_with_static_runtimes_RC \
+    old_archive_cmds_RC \
+    old_archive_from_new_cmds_RC \
+    predep_objects_RC \
+    postdep_objects_RC \
+    predeps_RC \
+    postdeps_RC \
+    compiler_lib_search_path_RC \
+    archive_cmds_RC \
+    archive_expsym_cmds_RC \
+    postinstall_cmds_RC \
+    postuninstall_cmds_RC \
+    old_archive_from_expsyms_cmds_RC \
+    allow_undefined_flag_RC \
+    no_undefined_flag_RC \
+    export_symbols_cmds_RC \
+    hardcode_libdir_flag_spec_RC \
+    hardcode_libdir_flag_spec_ld_RC \
+    hardcode_libdir_separator_RC \
+    hardcode_automatic_RC \
+    module_cmds_RC \
+    module_expsym_cmds_RC \
+    lt_cv_prog_compiler_c_o_RC \
+    exclude_expsyms_RC \
+    include_expsyms_RC; do
+
+    case $var in
+    old_archive_cmds_RC | \
+    old_archive_from_new_cmds_RC | \
+    archive_cmds_RC | \
+    archive_expsym_cmds_RC | \
+    module_cmds_RC | \
+    module_expsym_cmds_RC | \
+    old_archive_from_expsyms_cmds_RC | \
+    export_symbols_cmds_RC | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_RC
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# A language-specific compiler.
+CC=$lt_compiler_RC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_RC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_RC
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_RC
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_RC
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_RC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_RC
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_RC
+archive_expsym_cmds=$lt_archive_expsym_cmds_RC
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_RC
+module_expsym_cmds=$lt_module_expsym_cmds_RC
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_RC
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_RC
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_RC
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_RC
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_RC
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_RC
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_RC
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_RC
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_RC
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_RC
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_RC
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_RC"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_RC
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_RC
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_RC
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_RC
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+	;;
+
+      *)
+	{ { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5
+echo "$as_me: error: Unsupported tag name: $tagname" >&2;}
+   { (exit 1); exit 1; }; }
+	;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5
+echo "$as_me: error: unable to update list of available tagged configurations." >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check for the math library that HDF5 needs
+
+{ echo "$as_me:$LINENO: checking for ceil in -lm" >&5
+echo $ECHO_N "checking for ceil in -lm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_m_ceil+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ceil ();
+int
+main ()
+{
+return ceil ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_m_ceil=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_m_ceil=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_ceil" >&5
+echo "${ECHO_T}$ac_cv_lib_m_ceil" >&6; }
+if test $ac_cv_lib_m_ceil = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+
+
+# Check whether zlib is enabled.
+# HDF-EOS5 doesn't use zlib, but HDF5 might.  If HDF5 does, it needs
+# to be given to the linker or there will be undefined symbols in HDF5.
+# Using h5cc avoids the need to specify zlib at configure time.
+
+# Check whether --with-zlib was given.
+if test "${with_zlib+set}" = set; then
+  withval=$with_zlib;
+else
+  withval=yes
+fi
+
+
+case $withval in
+  yes)
+    HAVE_ZLIB="yes"
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------- ##
+## Report this to null at bogus.email ##
+## ------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+{ echo "$as_me:$LINENO: checking for compress2 in -lz" >&5
+echo $ECHO_N "checking for compress2 in -lz... $ECHO_C" >&6; }
+if test "${ac_cv_lib_z_compress2+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char compress2 ();
+int
+main ()
+{
+return compress2 ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_z_compress2=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_z_compress2=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_compress2" >&5
+echo "${ECHO_T}$ac_cv_lib_z_compress2" >&6; }
+if test $ac_cv_lib_z_compress2 = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBZ 1
+_ACEOF
+
+  LIBS="-lz $LIBS"
+
+else
+  unset HAVE_ZLIB
+fi
+
+
+    if test -z "$HAVE_ZLIB"; then
+      { { echo "$as_me:$LINENO: error: couldn't find zlib library" >&5
+echo "$as_me: error: couldn't find zlib library" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+    ;;
+  no)
+    HAVE_ZLIB="no"
+    { echo "$as_me:$LINENO: checking for GNU zlib" >&5
+echo $ECHO_N "checking for GNU zlib... $ECHO_C" >&6; }
+    { echo "$as_me:$LINENO: result: suppressed" >&5
+echo "${ECHO_T}suppressed" >&6; }
+    ;;
+  *)
+    HAVE_ZLIB="yes"
+    case "$withval" in
+      *,*)
+        zlib_inc="`echo $withval |cut -f1 -d,`"
+        zlib_lib="`echo $withval |cut -f2 -d, -s`"
+        ;;
+      *)
+        if test -n "$withval"; then
+          zlib_inc="$withval/include"
+          zlib_lib="$withval/lib"
+        fi
+        ;;
+    esac
+
+            if test "X$zlib_inc" = "X/usr/include"; then
+      zlib_inc=""
+    fi
+    if test "X$zlib_lib" = "X/usr/lib"; then
+      zlib_lib=""
+    fi
+
+    saved_CPPFLAGS="$CPPFLAGS"
+    saved_LDFLAGS="$LDFLAGS"
+
+    if test -n "$zlib_inc"; then
+      CPPFLAGS="$CPPFLAGS -I$zlib_inc"
+    fi
+
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------- ##
+## Report this to null at bogus.email ##
+## ------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  CPPFLAGS="$saved_CPPFLAGS"
+fi
+
+done
+
+
+    if test -n "$zlib_lib"; then
+      LDFLAGS="$LDFLAGS -L$zlib_lib"
+    fi
+
+
+{ echo "$as_me:$LINENO: checking for compress2 in -lz" >&5
+echo $ECHO_N "checking for compress2 in -lz... $ECHO_C" >&6; }
+if test "${ac_cv_lib_z_compress2+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char compress2 ();
+int
+main ()
+{
+return compress2 ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_z_compress2=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_z_compress2=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_compress2" >&5
+echo "${ECHO_T}$ac_cv_lib_z_compress2" >&6; }
+if test $ac_cv_lib_z_compress2 = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBZ 1
+_ACEOF
+
+  LIBS="-lz $LIBS"
+
+else
+  LDFLAGS="$saved_LDFLAGS"; unset HAVE_ZLIB
+fi
+
+
+    if test -z "$HAVE_ZLIB"; then
+      { { echo "$as_me:$LINENO: error: couldn't find zlib library" >&5
+echo "$as_me: error: couldn't find zlib library" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+    ;;
+esac
+
+{ echo "$as_me:$LINENO: checking for fc2Fortran macro" >&5
+echo $ECHO_N "checking for fc2Fortran macro... $ECHO_C" >&6; }
+if test "${he5_cv_f2cFortran_defined+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+    int main(void)
+    {
+    #ifdef f2cFortran
+      return 0;
+    #else
+      return 1;
+    #endif
+    }
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  he5_cv_f2cFortran_defined=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+he5_cv_f2cFortran_defined=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+if test ${he5_cv_f2cFortran_defined} = "yes"; then
+  F2CFORTRAN_MACRO="yes"
+  { echo "$as_me:$LINENO: result: defined" >&5
+echo "${ECHO_T}defined" >&6; }
+else
+  F2CFORTRAN_MACRO="no"
+  { echo "$as_me:$LINENO: result: not defined" >&5
+echo "${ECHO_T}not defined" >&6; }
+fi
+
+if test ${he5_cv_f2cFortran_defined} = "yes"; then
+  { echo "$as_me:$LINENO: checking for int*" >&5
+echo $ECHO_N "checking for int*... $ECHO_C" >&6; }
+if test "${ac_cv_type_intp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef int* ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_intp=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_intp=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_intp" >&5
+echo "${ECHO_T}$ac_cv_type_intp" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of int*" >&5
+echo $ECHO_N "checking size of int*... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_intp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int* ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int* ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int* ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int* ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int* ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_intp=$ac_lo;;
+'') if test "$ac_cv_type_intp" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (int*)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int*)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_intp=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef int* ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+	return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof_intp=`cat conftest.val`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_intp" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (int*)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int*)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_intp=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_intp" >&5
+echo "${ECHO_T}$ac_cv_sizeof_intp" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INTP $ac_cv_sizeof_intp
+_ACEOF
+
+
+  if test "${he5_cv_32ptr+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+      int main(void)
+      {
+#ifdef SIZEOF_INTP
+	return SIZEOF_INTP == 4 ? 0 : 1;
+#else
+#error SIZEOF_INTP is not defined
+#endif
+      }
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  he5_cv_32ptr=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+he5_cv_32ptr=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+  if test ${he5_cv_32ptr} = "yes"; then
+    { echo "$as_me:$LINENO: possibly 32 bit system" >&5
+echo "$as_me: possibly 32 bit system" >&6;}
+    F2CFORTRAN_32PTR="yes"
+  else
+    { echo "$as_me:$LINENO: possibly 64 bit system" >&5
+echo "$as_me: possibly 64 bit system" >&6;}
+  fi
+
+  ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_FC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$FC"; then
+  ac_cv_prog_FC="$FC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_FC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+FC=$ac_cv_prog_FC
+if test -n "$FC"; then
+  { echo "$as_me:$LINENO: result: $FC" >&5
+echo "${ECHO_T}$FC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$FC" && break
+  done
+fi
+if test -z "$FC"; then
+  ac_ct_FC=$FC
+  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_FC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_FC"; then
+  ac_cv_prog_ac_ct_FC="$ac_ct_FC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_FC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_FC=$ac_cv_prog_ac_ct_FC
+if test -n "$ac_ct_FC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_FC" >&5
+echo "${ECHO_T}$ac_ct_FC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_FC" && break
+done
+
+  if test "x$ac_ct_FC" = x; then
+    FC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    FC=$ac_ct_FC
+  fi
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for Fortran compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+rm -f a.out
+
+# If we don't use `.F' as extension, the preprocessor is not run on the
+# input file.  (Note that this only needs to work for GNU compilers.)
+ac_save_ext=$ac_ext
+ac_ext=F
+{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU Fortran compiler... $ECHO_C" >&6; }
+if test "${ac_cv_fc_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+      program main
+#ifndef __GNUC__
+       choke me
+#endif
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_fc_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_fc_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_fc_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_fc_compiler_gnu" >&6; }
+ac_ext=$ac_save_ext
+ac_test_FFLAGS=${FCFLAGS+set}
+ac_save_FFLAGS=$FCFLAGS
+FCFLAGS=
+{ echo "$as_me:$LINENO: checking whether $FC accepts -g" >&5
+echo $ECHO_N "checking whether $FC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_fc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  FCFLAGS=-g
+cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_fc_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_fc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_prog_fc_g=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_fc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_fc_g" >&6; }
+if test "$ac_test_FFLAGS" = set; then
+  FCFLAGS=$ac_save_FFLAGS
+elif test $ac_cv_prog_fc_g = yes; then
+  if test "x$ac_cv_fc_compiler_gnu" = xyes; then
+    FCFLAGS="-g -O2"
+  else
+    FCFLAGS="-g"
+  fi
+else
+  if test "x$ac_cv_fc_compiler_gnu" = xyes; then
+    FCFLAGS="-O2"
+  else
+    FCFLAGS=
+  fi
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+  if test -n "$FC"; then
+    { echo "$as_me:$LINENO: checking for fortran compiler $FC" >&5
+echo $ECHO_N "checking for fortran compiler $FC... $ECHO_C" >&6; }
+    ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
+
+
+cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+	INTEGER :: I
+	REAL :: R
+	I=TRANSFER(R,I)
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_fc_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  he2_cv_fortran90_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	he2_cv_fortran90_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+    ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+    if test ${he2_cv_fortran90_compiler} = "yes"; then
+      { echo "$as_me:$LINENO: result: Fortran 90 code was successfully compiled; assume f90 or later" >&5
+echo "${ECHO_T}Fortran 90 code was successfully compiled; assume f90 or later" >&6; }
+      F2CFORTRAN_90="yes"
+    else
+      { echo "$as_me:$LINENO: result: Fortran 90 code format was not compiled; assume f77" >&5
+echo "${ECHO_T}Fortran 90 code format was not compiled; assume f77" >&6; }
+    fi
+    if test -n "$F77" -o -n "$FFLAGS"; then
+      { echo "$as_me:$LINENO: $FC, $FCFLAGS will override $F77, $FFLAGS." >&5
+echo "$as_me: $FC, $FCFLAGS will override $F77, $FFLAGS." >&6;}
+    fi
+    F77=$FC
+    FFLAGS=$FCFLAGS
+  else
+    { echo "$as_me:$LINENO: f90 or compatible was not detected." >&5
+echo "$as_me: f90 or compatible was not detected." >&6;}
+    ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$F77"; then
+  ac_cv_prog_F77="$F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+F77=$ac_cv_prog_F77
+if test -n "$F77"; then
+  { echo "$as_me:$LINENO: result: $F77" >&5
+echo "${ECHO_T}$F77" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$F77" && break
+  done
+fi
+if test -z "$F77"; then
+  ac_ct_F77=$F77
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_F77"; then
+  ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_F77="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_F77=$ac_cv_prog_ac_ct_F77
+if test -n "$ac_ct_F77"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
+echo "${ECHO_T}$ac_ct_F77" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_F77" && break
+done
+
+  if test "x$ac_ct_F77" = x; then
+    F77=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    F77=$ac_ct_F77
+  fi
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+rm -f a.out
+
+# If we don't use `.F' as extension, the preprocessor is not run on the
+# input file.  (Note that this only needs to work for GNU compilers.)
+ac_save_ext=$ac_ext
+ac_ext=F
+{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; }
+if test "${ac_cv_f77_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+      program main
+#ifndef __GNUC__
+       choke me
+#endif
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_f77_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; }
+ac_ext=$ac_save_ext
+ac_test_FFLAGS=${FFLAGS+set}
+ac_save_FFLAGS=$FFLAGS
+FFLAGS=
+{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
+echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_f77_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  FFLAGS=-g
+cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_f77_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_prog_f77_g=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
+echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; }
+if test "$ac_test_FFLAGS" = set; then
+  FFLAGS=$ac_save_FFLAGS
+elif test $ac_cv_prog_f77_g = yes; then
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-g -O2"
+  else
+    FFLAGS="-g"
+  fi
+else
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-O2"
+  else
+    FFLAGS=
+  fi
+fi
+
+G77=`test $ac_compiler_gnu = yes && echo yes`
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+    if test -n "$F77"; then
+      { echo "$as_me:$LINENO: f77 or compatible was detected. $F77 will be used to check Fortran testdrivers." >&5
+echo "$as_me: f77 or compatible was detected. $F77 will be used to check Fortran testdrivers." >&6;}
+    else
+      { { echo "$as_me:$LINENO: error: couldn't find fortran compiler. You may want to FC environment variable" >&5
+echo "$as_me: error: couldn't find fortran compiler. You may want to FC environment variable" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+
+# Check whether szlib (szip) is enabled.
+# HDF-EOS5 doesn't use szlib, but HDF5 might.  If HDF5 does, it needs
+# to be given to the linker or there will be undefined symbols in HDF5.
+# Using h5cc should avoid the need to specify szlib at configure time.
+
+# Check whether --with-szlib was given.
+if test "${with_szlib+set}" = set; then
+  withval=$with_szlib;
+else
+  withval=no
+fi
+
+
+case $withval in
+  yes)
+    HAVE_SZLIB="yes"
+
+for ac_header in szlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------- ##
+## Report this to null at bogus.email ##
+## ------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ HAVE_SZLIB_H="yes"
+fi
+
+done
+
+
+{ echo "$as_me:$LINENO: checking for SZ_BufftoBuffCompress in -lsz" >&5
+echo $ECHO_N "checking for SZ_BufftoBuffCompress in -lsz... $ECHO_C" >&6; }
+if test "${ac_cv_lib_sz_SZ_BufftoBuffCompress+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsz  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char SZ_BufftoBuffCompress ();
+int
+main ()
+{
+return SZ_BufftoBuffCompress ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_sz_SZ_BufftoBuffCompress=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_sz_SZ_BufftoBuffCompress=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5
+echo "${ECHO_T}$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; }
+if test $ac_cv_lib_sz_SZ_BufftoBuffCompress = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSZ 1
+_ACEOF
+
+  LIBS="-lsz $LIBS"
+
+else
+  unset HAVE_SZLIB
+fi
+
+
+    if test -z "$HAVE_SZLIB"; then
+      { { echo "$as_me:$LINENO: error: couldn't find szlib library, you may need to specify szip library path" >&5
+echo "$as_me: error: couldn't find szlib library, you may need to specify szip library path" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+    ;;
+  no)
+    HAVE_SZLIB="no"
+    { echo "$as_me:$LINENO: checking for szlib" >&5
+echo $ECHO_N "checking for szlib... $ECHO_C" >&6; }
+    { echo "$as_me:$LINENO: result: suppressed" >&5
+echo "${ECHO_T}suppressed" >&6; }
+    ;;
+  *)
+    HAVE_SZLIB="yes"
+    case "$withval" in
+      *,*)
+        szlib_inc="`echo $withval |cut -f1 -d,`"
+        szlib_lib="`echo $withval |cut -f2 -d, -s`"
+        ;;
+      *)
+        if test -n "$withval"; then
+          szlib_inc="$withval/include"
+          szlib_lib="$withval/lib"
+        fi
+        ;;
+    esac
+
+                as_ac_File=`echo "ac_cv_file_$szlib_inc/szlib.h" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $szlib_inc/szlib.h" >&5
+echo $ECHO_N "checking for $szlib_inc/szlib.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  test "$cross_compiling" = yes &&
+  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "$szlib_inc/szlib.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+ac_res=`eval echo '${'$as_ac_File'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+  :
+else
+  unset HAVE_SZLIB
+fi
+
+    if test -z "$HAVE_SZLIB"; then
+      { { echo "$as_me:$LINENO: error: couldn't find szlib.h, check szip library path" >&5
+echo "$as_me: error: couldn't find szlib.h, check szip library path" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+
+            if test "X$szlib_inc" = "X/usr/include"; then
+      szlib_inc=""
+    fi
+    if test "X$szlib_lib" = "X/usr/lib"; then
+      szlib_lib=""
+    fi
+
+    saved_CPPFLAGS="$CPPFLAGS"
+    saved_LDFLAGS="$LDFLAGS"
+
+    if test -n "$szlib_inc"; then
+      CPPFLAGS="$CPPFLAGS -I$szlib_inc"
+    fi
+
+
+for ac_header in szlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------- ##
+## Report this to null at bogus.email ##
+## ------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ HAVE_SZLIB_H="yes"
+else
+  CPPFLAGS="$saved_CPPFLAGS"
+fi
+
+done
+
+
+    if test -n "$szlib_lib"; then
+      LDFLAGS="$LDFLAGS -L$szlib_lib"
+    fi
+
+
+{ echo "$as_me:$LINENO: checking for SZ_BufftoBuffCompress in -lsz" >&5
+echo $ECHO_N "checking for SZ_BufftoBuffCompress in -lsz... $ECHO_C" >&6; }
+if test "${ac_cv_lib_sz_SZ_BufftoBuffCompress+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsz  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char SZ_BufftoBuffCompress ();
+int
+main ()
+{
+return SZ_BufftoBuffCompress ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_sz_SZ_BufftoBuffCompress=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_sz_SZ_BufftoBuffCompress=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5
+echo "${ECHO_T}$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; }
+if test $ac_cv_lib_sz_SZ_BufftoBuffCompress = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSZ 1
+_ACEOF
+
+  LIBS="-lsz $LIBS"
+
+else
+  LDFLAGS="$saved_LDFLAGS"; unset HAVE_SZLIB
+fi
+
+
+    if test -z "$HAVE_SZLIB" -a -n "$HDF5_CONFIG_ABORT"; then
+      { { echo "$as_me:$LINENO: error: couldn't find szlib library, check if szip library is valid" >&5
+echo "$as_me: error: couldn't find szlib library, check if szip library is valid" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+    ;;
+esac
+
+
+if test "X$HAVE_SZLIB" = "Xyes"; then
+
+
+    for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+
+    { echo "$as_me:$LINENO: checking for h5cc" >&5
+echo $ECHO_N "checking for h5cc... $ECHO_C" >&6; }
+    PURE_CC=""
+    if ($CC -show &> /dev/null); then
+		PURE_CC=`echo "$CC" | $AWK '{ split($1, array, " ") ; printf array[1] }'`
+	{ echo "$as_me:$LINENO: result: $PURE_CC" >&5
+echo "${ECHO_T}$PURE_CC" >&6; }
+    else
+	{ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+	{ { echo "$as_me:$LINENO: error: CC is not h5cc" >&5
+echo "$as_me: error: CC is not h5cc" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+
+    SZIP_CC=szip_cc
+    cat $PURE_CC | $AWK '{ if ( $0 ~ /^LDFLAGS=\"(.*)/ ) { print substr($0, 1, 9) " -L'$szlib_lib' " substr($0, 10) } else  { print } } ' > $SZIP_CC
+    chmod 755 $SZIP_CC
+    saved_CC="$CC"
+    CC=./$SZIP_CC
+
+    { echo "$as_me:$LINENO: checking for szlib encoder" >&5
+echo $ECHO_N "checking for szlib encoder... $ECHO_C" >&6; }
+
+    if test "${he5_cv_szlib_functional+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+	#include <stddef.h>
+        #include <szlib.h>
+
+        int main(void)
+        {
+            SZ_encoder_enabled();
+            exit(0);
+        }
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  he5_cv_szlib_functional=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+he5_cv_szlib_functional=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+
+    if test "${he5_cv_szlib_can_encode+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+	#include <stddef.h>
+        #include <szlib.h>
+
+        int main(void)
+        {
+            /* SZ_encoder_enabled returns 1 if encoder is present */
+            if(SZ_encoder_enabled() == 1)
+                exit(0);
+            else
+                exit(1);
+        }
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  he5_cv_szlib_can_encode=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+he5_cv_szlib_can_encode=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+
+    CC="$saved_CC"
+    rm -f $SZIP_CC
+
+    if test ${he5_cv_szlib_functional} = "no"; then
+        he5_cv_szlib_can_encode=broken
+    else
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_FILTER_SZIP 1
+_ACEOF
+
+        USE_FILTER_SZIP="yes"
+    fi
+
+    if test ${he5_cv_szlib_can_encode} = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_FILTER_SZIP_ENCODER 1
+_ACEOF
+
+	USE_SZIP_ENCODER="yes"
+        { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+    fi
+    if test ${he5_cv_szlib_can_encode} = "no"; then
+        { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+    fi
+    if test ${he5_cv_szlib_can_encode} = "broken"; then
+        { echo "$as_me:$LINENO: result: shared szlib doesn't work. disabling szip." >&5
+echo "${ECHO_T}shared szlib doesn't work. disabling szip." >&6; }
+    fi
+
+        if test ${he5_cv_szlib_can_encode} = "yes"; then
+        if test "X$EXTERNAL_FILTERS" != "X"; then
+            EXTERNAL_FILTERS="${EXTERNAL_FILTERS},"
+        fi
+        EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)"
+    fi
+    if test ${he5_cv_szlib_can_encode} = "no"; then
+        if test "X$EXTERNAL_FILTERS" != "X"; then
+            EXTERNAL_FILTERS="${EXTERNAL_FILTERS},"
+        fi
+        EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)"
+    fi
+fi
+
+# Check for the HDF5 library using the --with argument
+# Of course HDF5 is required, but the user may be using h5cc, in which case
+# they don't need to specify --with-hdf5.  They can also use
+# --with-hdf5=/path/to/hdf5 to give a specific path.
+HAVE_HDF5="yes"
+
+# Check whether --with-hdf5 was given.
+if test "${with_hdf5+set}" = set; then
+  withval=$with_hdf5;
+else
+  withval=yes
+fi
+
+
+case $withval in
+  yes)
+    ;;
+  no)
+    { { echo "$as_me:$LINENO: error: HDF5 disabled in confugre, but is required to build HDF-EOS5." >&5
+echo "$as_me: error: HDF5 disabled in confugre, but is required to build HDF-EOS5." >&2;}
+   { (exit 1); exit 1; }; }
+    ;;
+  *)
+    case "$withval" in
+      *,*)
+        hdf5_inc="`echo $withval |cut -f1 -d,`"
+        hdf5_lib="`echo $withval |cut -f2 -d, -s`"
+        ;;
+      *)
+        if test -n "$withval"; then
+          hdf5_inc="$withval/include"
+          hdf5_lib="$withval/lib"
+        fi
+        ;;
+    esac
+
+            if test "X$hdf5_inc" = "X/usr/include"; then
+      hdf5_inc=""
+    fi
+    if test "X$hdf5_lib" = "X/usr/lib"; then
+      hdf5_lib=""
+    fi
+
+    if test -n "$hdf5_inc"; then
+      CPPFLAGS="$CPPFLAGS -I$hdf5_inc"
+      CFLAGS="$CFLAGS -I$hdf5_inc"
+    fi
+
+    if test -n "$hdf5_lib"; then
+      LDFLAGS="$LDFLAGS -L$hdf5_lib"
+    fi
+    ;;
+esac
+
+
+for ac_header in hdf5.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------- ##
+## Report this to null at bogus.email ##
+## ------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  HAVE_HDF5="no"
+fi
+
+done
+
+
+{ echo "$as_me:$LINENO: checking for H5Fcreate in -lhdf5" >&5
+echo $ECHO_N "checking for H5Fcreate in -lhdf5... $ECHO_C" >&6; }
+if test "${ac_cv_lib_hdf5_H5Fcreate+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lhdf5_hl -lhdf5  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char H5Fcreate ();
+int
+main ()
+{
+return H5Fcreate ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_hdf5_H5Fcreate=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_hdf5_H5Fcreate=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_hdf5_H5Fcreate" >&5
+echo "${ECHO_T}$ac_cv_lib_hdf5_H5Fcreate" >&6; }
+if test $ac_cv_lib_hdf5_H5Fcreate = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBHDF5 1
+_ACEOF
+
+  LIBS="-lhdf5_hl -lhdf5 $LIBS"
+
+else
+  HAVE_HDF5="no"
+fi
+
+
+if test "X$HAVE_HDF5" = "Xno"; then
+  { { echo "$as_me:$LINENO: error: can't link against HDF5 library" >&5
+echo "$as_me: error: can't link against HDF5 library" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+# Check whether HDF5 threadsafety is enabled
+{ echo "$as_me:$LINENO: checking if HDF5 threadsafe mode is enabled" >&5
+echo $ECHO_N "checking if HDF5 threadsafe mode is enabled... $ECHO_C" >&6; }
+if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include "hdf5.h"
+
+int main(void) {
+#ifdef H5_HAVE_THREADSAFE
+  return 0;
+#else
+  return 1;
+#endif
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+   { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+    THREADSAFE="yes"
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+    THREADSAFE="no"
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+
+# Record threadsafe status in config.h and for Makefiles
+if test "X$THREADSAFE" = "Xyes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _HDFEOS5_THREADSAFE 1
+_ACEOF
+
+fi
+
+
+
+if test "X$THREADSAFE" = "Xyes"; then
+  THREADSAFE_CONDITIONAL_TRUE=
+  THREADSAFE_CONDITIONAL_FALSE='#'
+else
+  THREADSAFE_CONDITIONAL_TRUE='#'
+  THREADSAFE_CONDITIONAL_FALSE=
+fi
+
+
+
+if test "x$HAVE_HDF5" = "xyes"; then
+
+  { echo "$as_me:$LINENO: checking for hdf5 szip decoding filter" >&5
+echo $ECHO_N "checking for hdf5 szip decoding filter... $ECHO_C" >&6; }
+  if test "${he5_cv_hdf5_szip_can_decode+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+      #include <H5Ipublic.h>
+      #include <H5Zpublic.h>
+
+      int main(int argc, char **argv)
+      {
+              herr_t ret;
+              unsigned int flags = 0;
+              int decoder = 0;
+
+              ret = H5Zget_filter_info(H5Z_FILTER_SZIP, &flags);
+	      if (ret < 0) exit(1);
+              decoder = flags & H5Z_FILTER_CONFIG_DECODE_ENABLED;
+              if (decoder) exit(0);
+              else exit(1);
+      }
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  he5_cv_hdf5_szip_can_decode=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+he5_cv_hdf5_szip_can_decode=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+  if test ${he5_cv_hdf5_szip_can_decode} = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_HDF5_SZIP_DECODER 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define H5_HAVE_FILTER_SZIP 1
+_ACEOF
+
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+  else
+    { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+  fi
+
+  { echo "$as_me:$LINENO: checking for hdf5 szip encoding filter" >&5
+echo $ECHO_N "checking for hdf5 szip encoding filter... $ECHO_C" >&6; }
+  if test "${he5_cv_hdf5_szip_can_encode+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+      #include <H5Ipublic.h>
+      #include <H5Zpublic.h>
+
+      int main(int argc, char **argv)
+      {
+              herr_t ret;
+              unsigned int flags = 0;
+              int encoder = 0;
+
+              ret = H5Zget_filter_info(H5Z_FILTER_SZIP, &flags);
+	      if (ret < 0) exit(1);
+              encoder = flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED;
+              if (encoder) exit(0);
+              else exit(1);
+      }
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  he5_cv_hdf5_szip_can_encode=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+he5_cv_hdf5_szip_can_encode=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+
+  if test ${he5_cv_hdf5_szip_can_encode} = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_HDF5_SZIP_ENCODER 1
+_ACEOF
+
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+  else
+    { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+  fi
+
+    if test ${he5_cv_hdf5_szip_can_decode} = "no"; then
+    if test "X$HAVE_SZLIB" = "Xyes"; then
+      { { echo "$as_me:$LINENO: error: HDF5 was linked without SZIP, but --with-szlib was given" >&5
+echo "$as_me: error: HDF5 was linked without SZIP, but --with-szlib was given" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  else
+    if test "X$HAVE_SZLIB" != "Xyes"; then
+      { { echo "$as_me:$LINENO: error: HDF5 was linked with SZIP, but --with-szlib was not given" >&5
+echo "$as_me: error: HDF5 was linked with SZIP, but --with-szlib was not given" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+    if test ${he5_cv_szlib_functional} = "no"; then
+      { { echo "$as_me:$LINENO: error: SZIP specified in --with-szlib is not functional" >&5
+echo "$as_me: error: SZIP specified in --with-szlib is not functional" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+    if test ${he5_cv_hdf5_szip_can_encode} = "no"; then
+      if test ${he5_cv_szlib_can_encode} = "yes"; then
+	{ { echo "$as_me:$LINENO: error: HDF5 was linked without SZIP encoder, but yours has SZIP encoder" >&5
+echo "$as_me: error: HDF5 was linked without SZIP encoder, but yours has SZIP encoder" >&2;}
+   { (exit 1); exit 1; }; }
+      fi
+    else
+      if test ${he5_cv_szlib_can_encode} = "no"; then
+	{ { echo "$as_me:$LINENO: error: HDF5 was linked with SZIP encoder, but yours does not have SZIP encoder" >&5
+echo "$as_me: error: HDF5 was linked with SZIP encoder, but yours does not have SZIP encoder" >&2;}
+   { (exit 1); exit 1; }; }
+      fi
+    fi
+  fi
+fi
+
+# Set CFLAGS to prevent AC_PROG_CC from setting it
+CFLAGS=$CFLAGS
+
+# Checks for programs.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	CFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c89=$ac_arg
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC"   am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+  SET_MAKE=
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+# Checks for libraries.
+
+# Checks for header files.
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+
+
+
+
+for ac_header in malloc.h stdlib.h string.h limits.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------- ##
+## Report this to null at bogus.email ##
+## ------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
+if test "${ac_cv_c_const+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+  /* Ultrix mips cc rejects this.  */
+  typedef int charset[2];
+  const charset cs;
+  /* SunOS 4.1.1 cc rejects this.  */
+  char const *const *pcpcc;
+  char **ppc;
+  /* NEC SVR4.0.2 mips cc rejects this.  */
+  struct point {int x, y;};
+  static struct point const zero = {0,0};
+  /* AIX XL C 1.02.0.0 rejects this.
+     It does not let you subtract one const X* pointer from another in
+     an arm of an if-expression whose if-part is not a constant
+     expression */
+  const char *g = "string";
+  pcpcc = &g + (g ? g-g : 0);
+  /* HPUX 7.0 cc rejects these. */
+  ++pcpcc;
+  ppc = (char**) pcpcc;
+  pcpcc = (char const *const *) ppc;
+  { /* SCO 3.2v4 cc rejects this.  */
+    char *t;
+    char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+    *t++ = 0;
+    if (s) return 0;
+  }
+  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+    int x[] = {25, 17};
+    const int *foo = &x[0];
+    ++foo;
+  }
+  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+    typedef const int *iptr;
+    iptr p = 0;
+    ++p;
+  }
+  { /* AIX XL C 1.02.0.0 rejects this saying
+       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+    struct s { int j; const int *ap[3]; };
+    struct s *b; b->j = 5;
+  }
+  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+    const int foo = 10;
+    if (!foo) return 0;
+  }
+  return !cs[0] && !zero.x;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_c_const=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_c_const=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for off_t" >&5
+echo $ECHO_N "checking for off_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_off_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef off_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_off_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_off_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+echo "${ECHO_T}$ac_cv_type_off_t" >&6; }
+if test $ac_cv_type_off_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define off_t long int
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_size_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef size_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_size_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_size_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6; }
+if test $ac_cv_type_size_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+
+# Checks for library functions.
+
+for ac_header in stdlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------- ##
+## Report this to null at bogus.email ##
+## ------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+{ echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5
+echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6; }
+if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_malloc_0_nonnull=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *malloc ();
+#endif
+
+int
+main ()
+{
+return ! malloc (0);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_malloc_0_nonnull=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_malloc_0_nonnull=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5
+echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6; }
+if test $ac_cv_func_malloc_0_nonnull = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MALLOC 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_MALLOC 0
+_ACEOF
+
+   case " $LIBOBJS " in
+  *" malloc.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS malloc.$ac_objext"
+ ;;
+esac
+
+
+cat >>confdefs.h <<\_ACEOF
+#define malloc rpl_malloc
+_ACEOF
+
+fi
+
+
+
+{ echo "$as_me:$LINENO: checking for working memcmp" >&5
+echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6; }
+if test "${ac_cv_func_memcmp_working+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_memcmp_working=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+
+  /* Some versions of memcmp are not 8-bit clean.  */
+  char c0 = '\100', c1 = '\200', c2 = '\201';
+  if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
+    return 1;
+
+  /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+     or more and with at least one buffer not starting on a 4-byte boundary.
+     William Lewis provided this test program.   */
+  {
+    char foo[21];
+    char bar[21];
+    int i;
+    for (i = 0; i < 4; i++)
+      {
+	char *a = foo + i;
+	char *b = bar + i;
+	strcpy (a, "--------01111111");
+	strcpy (b, "--------10000000");
+	if (memcmp (a, b, 16) >= 0)
+	  return 1;
+      }
+    return 0;
+  }
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_memcmp_working=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_memcmp_working=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
+echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6; }
+test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
+  *" memcmp.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS memcmp.$ac_objext"
+ ;;
+esac
+
+
+
+for ac_header in stdlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------- ##
+## Report this to null at bogus.email ##
+## ------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+{ echo "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5
+echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6; }
+if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_realloc_0_nonnull=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *realloc ();
+#endif
+
+int
+main ()
+{
+return ! realloc (0, 0);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_realloc_0_nonnull=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_realloc_0_nonnull=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5
+echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6; }
+if test $ac_cv_func_realloc_0_nonnull = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_REALLOC 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_REALLOC 0
+_ACEOF
+
+   case " $LIBOBJS " in
+  *" realloc.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS realloc.$ac_objext"
+ ;;
+esac
+
+
+cat >>confdefs.h <<\_ACEOF
+#define realloc rpl_realloc
+_ACEOF
+
+fi
+
+
+
+{ echo "$as_me:$LINENO: checking for error_at_line" >&5
+echo $ECHO_N "checking for error_at_line... $ECHO_C" >&6; }
+if test "${ac_cv_lib_error_at_line+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <error.h>
+int
+main ()
+{
+error_at_line (0, 0, "", 0, "an error occurred");
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_error_at_line=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_error_at_line=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_error_at_line" >&5
+echo "${ECHO_T}$ac_cv_lib_error_at_line" >&6; }
+if test $ac_cv_lib_error_at_line = no; then
+  case " $LIBOBJS " in
+  *" error.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS error.$ac_objext"
+ ;;
+esac
+
+fi
+
+
+
+
+
+
+
+
+for ac_func in memchr memmove memset strchr strstr pow sqrt
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+# Check whether testdrivers directory is present.  The user might have
+# downloaded HDF-EOS5 but not the tests.
+{ echo "$as_me:$LINENO: checking for testdrivers directory" >&5
+echo $ECHO_N "checking for testdrivers directory... $ECHO_C" >&6; }
+if test -d "${srcdir}/testdrivers"; then
+  TESTDRIVERS_DIR="yes"
+  { echo "$as_me:$LINENO: result: present" >&5
+echo "${ECHO_T}present" >&6; }
+
+  # If the testdrivers directory is present, see if it contains a file named
+  # 'makefile'.  If so, rename the file so it doesn't cause confusion later
+  # on.
+  if test -e "testdrivers/makefile"; then
+    mv testdrivers/makefile testdrivers/makefile_orig
+  fi
+
+else
+  TESTDRIVERS_DIR="no"
+  { echo "$as_me:$LINENO: result: not found" >&5
+echo "${ECHO_T}not found" >&6; }
+  { echo "$as_me:$LINENO: WARNING: testdrivers directory is not present. Tests will not be run" >&5
+echo "$as_me: WARNING: testdrivers directory is not present. Tests will not be run" >&2;}
+fi
+
+# Check whether --enable-install-include was given.
+if test "${enable_install_include+set}" = set; then
+  enableval=$enable_install_include; INSTALL_INCLUDE=$enableval
+fi
+
+
+
+
+if test "X$TESTDRIVERS_DIR" = "Xyes"; then
+  TESTDRIVERS_CONDITIONAL_TRUE=
+  TESTDRIVERS_CONDITIONAL_FALSE='#'
+else
+  TESTDRIVERS_CONDITIONAL_TRUE='#'
+  TESTDRIVERS_CONDITIONAL_FALSE=
+fi
+
+
+
+if test "X$INSTALL_INCLUDE" = "Xyes"; then
+  INSTALL_INCLUDE_CONDITIONAL_TRUE=
+  INSTALL_INCLUDE_CONDITIONAL_FALSE='#'
+else
+  INSTALL_INCLUDE_CONDITIONAL_TRUE='#'
+  INSTALL_INCLUDE_CONDITIONAL_FALSE=
+fi
+
+
+
+if test "X$F2CFORTRAN_MACRO" = "Xyes"; then
+  F2CFORTRAN_CONDITIONAL_TRUE=
+  F2CFORTRAN_CONDITIONAL_FALSE='#'
+else
+  F2CFORTRAN_CONDITIONAL_TRUE='#'
+  F2CFORTRAN_CONDITIONAL_FALSE=
+fi
+
+
+
+if test "X$F2CFORTRAN_90" = "Xyes"; then
+  F2CFORTRAN_90_CONDITIONAL_TRUE=
+  F2CFORTRAN_90_CONDITIONAL_FALSE='#'
+else
+  F2CFORTRAN_90_CONDITIONAL_TRUE='#'
+  F2CFORTRAN_90_CONDITIONAL_FALSE=
+fi
+
+
+
+if test "X$F2CFORTRAN_32PTR" = "Xyes"; then
+  F2CFORTRAN_32PTR_CONDITIONAL_TRUE=
+  F2CFORTRAN_32PTR_CONDITIONAL_FALSE='#'
+else
+  F2CFORTRAN_32PTR_CONDITIONAL_TRUE='#'
+  F2CFORTRAN_32PTR_CONDITIONAL_FALSE=
+fi
+
+
+
+if test "X$USE_SZIP_ENCODER" = "Xyes"; then
+  SZIP_ENCODER_CONDITIONAL_TRUE=
+  SZIP_ENCODER_CONDITIONAL_FALSE='#'
+else
+  SZIP_ENCODER_CONDITIONAL_TRUE='#'
+  SZIP_ENCODER_CONDITIONAL_FALSE=
+fi
+
+
+ac_config_files="$ac_config_files Makefile include/Makefile src/Makefile gctp/Makefile gctp/include/Makefile gctp/src/Makefile samples/Makefile"
+
+
+if test "X$TESTDRIVERS_DIR" = "Xyes"; then
+  ac_config_files="$ac_config_files testdrivers/Makefile testdrivers/grid/Makefile testdrivers/point/Makefile testdrivers/swath/Makefile testdrivers/threads/Makefile testdrivers/za/Makefile"
+
+fi
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    test "x$cache_file" != "x/dev/null" &&
+      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
+    cat confcache >$cache_file
+  else
+    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${THREADSAFE_CONDITIONAL_TRUE}" && test -z "${THREADSAFE_CONDITIONAL_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"THREADSAFE_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"THREADSAFE_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${TESTDRIVERS_CONDITIONAL_TRUE}" && test -z "${TESTDRIVERS_CONDITIONAL_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"TESTDRIVERS_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"TESTDRIVERS_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${INSTALL_INCLUDE_CONDITIONAL_TRUE}" && test -z "${INSTALL_INCLUDE_CONDITIONAL_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"INSTALL_INCLUDE_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"INSTALL_INCLUDE_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${F2CFORTRAN_CONDITIONAL_TRUE}" && test -z "${F2CFORTRAN_CONDITIONAL_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"F2CFORTRAN_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"F2CFORTRAN_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${F2CFORTRAN_90_CONDITIONAL_TRUE}" && test -z "${F2CFORTRAN_90_CONDITIONAL_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"F2CFORTRAN_90_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"F2CFORTRAN_90_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${F2CFORTRAN_32PTR_CONDITIONAL_TRUE}" && test -z "${F2CFORTRAN_32PTR_CONDITIONAL_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"F2CFORTRAN_32PTR_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"F2CFORTRAN_32PTR_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${SZIP_ENCODER_CONDITIONAL_TRUE}" && test -z "${SZIP_ENCODER_CONDITIONAL_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"SZIP_ENCODER_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"SZIP_ENCODER_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+    as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+	case $1 in
+        -*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by hdf-eos5 $as_me 1.8, which was
+generated by GNU Autoconf 2.61.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+		   instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+		   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf at gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+hdf-eos5 config.status 1.8
+configured by $0, generated by GNU Autoconf 2.61,
+  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    echo "$ac_cs_version"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  CONFIG_SHELL=$SHELL
+  export CONFIG_SHELL
+  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "include/HE5_config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/HE5_config.h" ;;
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
+    "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+    "gctp/Makefile") CONFIG_FILES="$CONFIG_FILES gctp/Makefile" ;;
+    "gctp/include/Makefile") CONFIG_FILES="$CONFIG_FILES gctp/include/Makefile" ;;
+    "gctp/src/Makefile") CONFIG_FILES="$CONFIG_FILES gctp/src/Makefile" ;;
+    "samples/Makefile") CONFIG_FILES="$CONFIG_FILES samples/Makefile" ;;
+    "testdrivers/Makefile") CONFIG_FILES="$CONFIG_FILES testdrivers/Makefile" ;;
+    "testdrivers/grid/Makefile") CONFIG_FILES="$CONFIG_FILES testdrivers/grid/Makefile" ;;
+    "testdrivers/point/Makefile") CONFIG_FILES="$CONFIG_FILES testdrivers/point/Makefile" ;;
+    "testdrivers/swath/Makefile") CONFIG_FILES="$CONFIG_FILES testdrivers/swath/Makefile" ;;
+    "testdrivers/threads/Makefile") CONFIG_FILES="$CONFIG_FILES testdrivers/threads/Makefile" ;;
+    "testdrivers/za/Makefile") CONFIG_FILES="$CONFIG_FILES testdrivers/za/Makefile" ;;
+
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+#
+# Set up the sed scripts for CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+CYGPATH_W!$CYGPATH_W$ac_delim
+PACKAGE!$PACKAGE$ac_delim
+VERSION!$VERSION$ac_delim
+ACLOCAL!$ACLOCAL$ac_delim
+AUTOCONF!$AUTOCONF$ac_delim
+AUTOMAKE!$AUTOMAKE$ac_delim
+AUTOHEADER!$AUTOHEADER$ac_delim
+MAKEINFO!$MAKEINFO$ac_delim
+install_sh!$install_sh$ac_delim
+STRIP!$STRIP$ac_delim
+INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
+mkdir_p!$mkdir_p$ac_delim
+AWK!$AWK$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+am__leading_dot!$am__leading_dot$ac_delim
+AMTAR!$AMTAR$ac_delim
+am__tar!$am__tar$ac_delim
+am__untar!$am__untar$ac_delim
+MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim
+MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim
+MAINT!$MAINT$ac_delim
+build!$build$ac_delim
+build_cpu!$build_cpu$ac_delim
+build_vendor!$build_vendor$ac_delim
+build_os!$build_os$ac_delim
+host!$host$ac_delim
+host_cpu!$host_cpu$ac_delim
+host_vendor!$host_vendor$ac_delim
+host_os!$host_os$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+DEPDIR!$DEPDIR$ac_delim
+am__include!$am__include$ac_delim
+am__quote!$am__quote$ac_delim
+AMDEP_TRUE!$AMDEP_TRUE$ac_delim
+AMDEP_FALSE!$AMDEP_FALSE$ac_delim
+AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
+CCDEPMODE!$CCDEPMODE$ac_delim
+am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
+am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+LN_S!$LN_S$ac_delim
+ECHO!$ECHO$ac_delim
+AR!$AR$ac_delim
+RANLIB!$RANLIB$ac_delim
+CPP!$CPP$ac_delim
+CXX!$CXX$ac_delim
+CXXFLAGS!$CXXFLAGS$ac_delim
+ac_ct_CXX!$ac_ct_CXX$ac_delim
+CXXDEPMODE!$CXXDEPMODE$ac_delim
+am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
+_ACEOF
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim
+CXXCPP!$CXXCPP$ac_delim
+F77!$F77$ac_delim
+FFLAGS!$FFLAGS$ac_delim
+ac_ct_F77!$ac_ct_F77$ac_delim
+LIBTOOL!$LIBTOOL$ac_delim
+FC!$FC$ac_delim
+FCFLAGS!$FCFLAGS$ac_delim
+ac_ct_FC!$ac_ct_FC$ac_delim
+THREADSAFE_CONDITIONAL_TRUE!$THREADSAFE_CONDITIONAL_TRUE$ac_delim
+THREADSAFE_CONDITIONAL_FALSE!$THREADSAFE_CONDITIONAL_FALSE$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+TESTDRIVERS_CONDITIONAL_TRUE!$TESTDRIVERS_CONDITIONAL_TRUE$ac_delim
+TESTDRIVERS_CONDITIONAL_FALSE!$TESTDRIVERS_CONDITIONAL_FALSE$ac_delim
+INSTALL_INCLUDE_CONDITIONAL_TRUE!$INSTALL_INCLUDE_CONDITIONAL_TRUE$ac_delim
+INSTALL_INCLUDE_CONDITIONAL_FALSE!$INSTALL_INCLUDE_CONDITIONAL_FALSE$ac_delim
+F2CFORTRAN_CONDITIONAL_TRUE!$F2CFORTRAN_CONDITIONAL_TRUE$ac_delim
+F2CFORTRAN_CONDITIONAL_FALSE!$F2CFORTRAN_CONDITIONAL_FALSE$ac_delim
+F2CFORTRAN_90_CONDITIONAL_TRUE!$F2CFORTRAN_90_CONDITIONAL_TRUE$ac_delim
+F2CFORTRAN_90_CONDITIONAL_FALSE!$F2CFORTRAN_90_CONDITIONAL_FALSE$ac_delim
+F2CFORTRAN_32PTR_CONDITIONAL_TRUE!$F2CFORTRAN_32PTR_CONDITIONAL_TRUE$ac_delim
+F2CFORTRAN_32PTR_CONDITIONAL_FALSE!$F2CFORTRAN_32PTR_CONDITIONAL_FALSE$ac_delim
+SZIP_ENCODER_CONDITIONAL_TRUE!$SZIP_ENCODER_CONDITIONAL_TRUE$ac_delim
+SZIP_ENCODER_CONDITIONAL_FALSE!$SZIP_ENCODER_CONDITIONAL_FALSE$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 25; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[	 ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[	 ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+   { (exit 1); exit 1; }; };;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
+	 # because $ac_f cannot contain `:'.
+	 test -f "$ac_f" ||
+	   case $ac_f in
+	   [\\/$]*) false;;
+	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+	   esac ||
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+   { (exit 1); exit 1; }; };;
+      esac
+      ac_file_inputs="$ac_file_inputs $ac_f"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input="Generated from "`IFS=:
+	  echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    fi
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin";;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  { as_dir="$ac_dir"
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+    s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&2;}
+
+  rm -f "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out"; rm -f "$tmp/out";;
+  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+  esac
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+_ACEOF
+
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status.  If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless.  But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([	 #]*\\)[^	 ]*\\([	 ]*'
+ac_dB='\\)[	 (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+  sed -n '
+	t rset
+	:rset
+	s/^[	 ]*#[	 ]*define[	 ][	 ]*//
+	t ok
+	d
+	:ok
+	s/[\\&,]/\\&/g
+	s/^\('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+	s/^\('"$ac_word_re"'\)[	 ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+  ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then replace #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[	 #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is:	 sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is:	 sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be:	 sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
+do
+  # Write a here document:
+    cat >>$CONFIG_STATUS <<_ACEOF
+    # First, check the format of the line:
+    cat >"\$tmp/defines.sed" <<\\CEOF
+/^[	 ]*#[	 ]*undef[	 ][	 ]*$ac_word_re[	 ]*\$/b def
+/^[	 ]*#[	 ]*define[	 ][	 ]*$ac_word_re[(	 ]/b def
+b
+:def
+_ACEOF
+  sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+    sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+  ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+  sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+  grep . conftest.tail >/dev/null || break
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines conftest.tail
+
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
+cat >>$CONFIG_STATUS <<\_ACEOF
+  if test x"$ac_file" != x-; then
+    echo "/* $configure_input  */" >"$tmp/config.h"
+    cat "$ac_result" >>"$tmp/config.h"
+    if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      rm -f $ac_file
+      mv "$tmp/config.h" $ac_file
+    fi
+  else
+    echo "/* $configure_input  */"
+    cat "$ac_result"
+  fi
+  rm -f "$tmp/out12"
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $ac_file | $ac_file:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $ac_file" >`$as_dirname -- $ac_file ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X$ac_file : 'X\(//\)[^/]' \| \
+	 X$ac_file : 'X\(//\)$' \| \
+	 X$ac_file : 'X\(/\)' \| . 2>/dev/null ||
+echo X$ac_file |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+  :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$mf" : 'X\(//\)[^/]' \| \
+	 X"$mf" : 'X\(//\)$' \| \
+	 X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$file" : 'X\(//\)[^/]' \| \
+	 X"$file" : 'X\(//\)$' \| \
+	 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+    { as_dir=$dirpart/$fdir
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+
+  esac
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..5d48b43
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,609 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+# Prototype configure.ac for HDF-EOS
+# Created 5/2/06 by James Laird (jlaird at ncsa.uiuc.edu)
+
+AC_PREREQ([2.59])
+AC_INIT([hdf-eos5], [1.8], null at bogus.email)
+AM_CONFIG_HEADER([include/HE5_config.h])
+
+AC_CONFIG_AUX_DIR([config])
+
+AM_INIT_AUTOMAKE([foreign])
+AM_MAINTAINER_MODE
+
+# Disable shared libraries (for now)
+AC_DISABLE_SHARED
+
+AM_PROG_LIBTOOL
+
+dnl ----------------------------------------------------------------------
+dnl Set prefix default (install directory) to a directory in the build area.
+AC_PREFIX_DEFAULT([`pwd`/hdfeos5])
+
+# Check for the math library that HDF5 needs
+AC_CHECK_LIB([m], [ceil])
+
+# Check whether zlib is enabled.
+# HDF-EOS5 doesn't use zlib, but HDF5 might.  If HDF5 does, it needs
+# to be given to the linker or there will be undefined symbols in HDF5.
+# Using h5cc avoids the need to specify zlib at configure time.
+AC_ARG_WITH([zlib],
+            [AC_HELP_STRING([--with-zlib=DIR],
+                            [Specify path to external zlib library.
+                             Linker must be able to find zlib if HDF5
+                             was built with zlib.
+                             [default=yes]])],,
+            withval=yes)
+
+case $withval in
+  yes)
+    HAVE_ZLIB="yes"
+    AC_CHECK_HEADERS([zlib.h],)
+    AC_CHECK_LIB([z], [compress2],, [unset HAVE_ZLIB])
+
+    if test -z "$HAVE_ZLIB"; then
+      AC_MSG_ERROR([couldn't find zlib library])
+    fi
+    ;;
+  no)
+    HAVE_ZLIB="no"
+    AC_MSG_CHECKING([for GNU zlib])
+    AC_MSG_RESULT([suppressed])
+    ;;
+  *)
+    HAVE_ZLIB="yes"
+    case "$withval" in
+      *,*)
+        zlib_inc="`echo $withval |cut -f1 -d,`"
+        zlib_lib="`echo $withval |cut -f2 -d, -s`"
+        ;;
+      *)
+        if test -n "$withval"; then
+          zlib_inc="$withval/include"
+          zlib_lib="$withval/lib"
+        fi
+        ;;
+    esac
+
+    dnl Trying to include -I/usr/include and -L/usr/lib is redundant and
+    dnl can mess some compilers up.
+    if test "X$zlib_inc" = "X/usr/include"; then
+      zlib_inc=""
+    fi
+    if test "X$zlib_lib" = "X/usr/lib"; then
+      zlib_lib=""
+    fi
+
+    saved_CPPFLAGS="$CPPFLAGS"
+    saved_LDFLAGS="$LDFLAGS"
+
+    if test -n "$zlib_inc"; then
+      CPPFLAGS="$CPPFLAGS -I$zlib_inc"
+    fi
+
+    AC_CHECK_HEADERS([zlib.h], ,
+                     [CPPFLAGS="$saved_CPPFLAGS"])
+
+    if test -n "$zlib_lib"; then
+      LDFLAGS="$LDFLAGS -L$zlib_lib"
+    fi
+
+    AC_CHECK_LIB([z], [compress2],,
+                 [LDFLAGS="$saved_LDFLAGS"; unset HAVE_ZLIB])
+
+    if test -z "$HAVE_ZLIB"; then
+      AC_MSG_ERROR([couldn't find zlib library])
+    fi
+    ;;
+esac
+
+dnl --------------------------------------------------
+dnl Check if -Df2cFortran is specified
+dnl Running only the preprocessor may not be a good idea
+dnl because this can be hard-coded.
+AC_MSG_CHECKING([for fc2Fortran macro])
+AC_CACHE_VAL([he5_cv_f2cFortran_defined],
+    [AC_TRY_RUN([
+    int main(void)
+    {
+    #ifdef f2cFortran
+      return 0;
+    #else
+      return 1;
+    #endif
+    }
+    ], [he5_cv_f2cFortran_defined=yes], [he5_cv_f2cFortran_defined=no],)])
+if test ${he5_cv_f2cFortran_defined} = "yes"; then
+  F2CFORTRAN_MACRO="yes"
+  AC_MSG_RESULT([defined])
+else
+  F2CFORTRAN_MACRO="no"
+  AC_MSG_RESULT([not defined])
+fi
+
+if test ${he5_cv_f2cFortran_defined} = "yes"; then
+  AC_CHECK_SIZEOF([int*])
+  AC_CACHE_VAL([he5_cv_32ptr],
+      [AC_TRY_RUN([
+      int main(void)
+      {
+#ifdef SIZEOF_INTP
+	return SIZEOF_INTP == 4 ? 0 : 1;
+#else
+#error SIZEOF_INTP is not defined
+#endif
+      }
+      ], [he5_cv_32ptr=yes], [he5_cv_32ptr=no],)])
+  if test ${he5_cv_32ptr} = "yes"; then
+    AC_MSG_NOTICE([possibly 32 bit system])
+    F2CFORTRAN_32PTR="yes"
+  else
+    AC_MSG_NOTICE([possibly 64 bit system])
+  fi
+
+  AC_PROG_FC
+  if test -n "$FC"; then
+    AC_MSG_CHECKING([for fortran compiler $FC])
+    AC_LANG_PUSH([Fortran])
+    AC_TRY_LINK([], [
+	INTEGER :: I
+	REAL :: R
+	I=TRANSFER(R,I)
+	], [he2_cv_fortran90_compiler=yes], [he2_cv_fortran90_compiler=no])
+    AC_LANG_POP([Fortran])
+    if test ${he2_cv_fortran90_compiler} = "yes"; then
+      AC_MSG_RESULT([Fortran 90 code was successfully compiled; assume f90 or later])
+      F2CFORTRAN_90="yes"
+    else
+      AC_MSG_RESULT([Fortran 90 code format was not compiled; assume f77])
+    fi
+    if test -n "$F77" -o -n "$FFLAGS"; then
+      AC_MSG_NOTICE([$FC, $FCFLAGS will override $F77, $FFLAGS.])
+    fi
+    F77=$FC
+    FFLAGS=$FCFLAGS
+  else
+    AC_MSG_NOTICE([f90 or compatible was not detected.])
+    AC_PROG_F77
+    if test -n "$F77"; then
+      AC_MSG_NOTICE([f77 or compatible was detected. $F77 will be used to check Fortran testdrivers.])
+    else
+      AC_MSG_ERROR([couldn't find fortran compiler. You may want to FC environment variable])
+    fi
+  fi
+fi
+
+# Check whether szlib (szip) is enabled.
+# HDF-EOS5 doesn't use szlib, but HDF5 might.  If HDF5 does, it needs
+# to be given to the linker or there will be undefined symbols in HDF5.
+# Using h5cc should avoid the need to specify szlib at configure time.
+AC_ARG_WITH([szlib],
+            [AC_HELP_STRING([--with-szlib=DIR],
+                            [Use szlib library for external szlib I/O
+                             filter.  Linker must be able to find szlib
+                             if HDF5 was build with szip. [default=no]])],,
+            withval=no)
+
+case $withval in
+  yes)
+    HAVE_SZLIB="yes"
+    AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"])
+    AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZLIB])
+
+    if test -z "$HAVE_SZLIB"; then
+      AC_MSG_ERROR([couldn't find szlib library, you may need to specify szip library path])
+    fi
+    ;;
+  no)
+    HAVE_SZLIB="no"
+    AC_MSG_CHECKING([for szlib])
+    AC_MSG_RESULT([suppressed])
+    ;;
+  *)
+    HAVE_SZLIB="yes"
+    case "$withval" in
+      *,*)
+        szlib_inc="`echo $withval |cut -f1 -d,`"
+        szlib_lib="`echo $withval |cut -f2 -d, -s`"
+        ;;
+      *)
+        if test -n "$withval"; then
+          szlib_inc="$withval/include"
+          szlib_lib="$withval/lib"
+        fi
+        ;;
+    esac
+
+    dnl Check if szlib.h exists. We cannot use AC_CHECK_HEADERS here
+    dnl because it will use preprocessor. Preprocessor always succeeds in
+    dnl finding szlib.h because h4cc provides the path to szlib.h.
+    AC_CHECK_FILE($szlib_inc/szlib.h, , [unset HAVE_SZLIB])
+    if test -z "$HAVE_SZLIB"; then
+      AC_MSG_ERROR([couldn't find szlib.h, check szip library path])
+    fi
+    
+    dnl Trying to include -I/usr/include and -L/usr/lib is redundant and
+    dnl can mess some compilers up.
+    if test "X$szlib_inc" = "X/usr/include"; then
+      szlib_inc=""
+    fi 
+    if test "X$szlib_lib" = "X/usr/lib"; then
+      szlib_lib=""
+    fi
+    
+    saved_CPPFLAGS="$CPPFLAGS"
+    saved_LDFLAGS="$LDFLAGS"
+    
+    if test -n "$szlib_inc"; then
+      CPPFLAGS="$CPPFLAGS -I$szlib_inc"
+    fi
+    
+    AC_CHECK_HEADERS([szlib.h],
+                     [HAVE_SZLIB_H="yes"],
+                     [CPPFLAGS="$saved_CPPFLAGS"])
+    
+    if test -n "$szlib_lib"; then
+      LDFLAGS="$LDFLAGS -L$szlib_lib"
+    fi
+    
+    AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],,
+                 [LDFLAGS="$saved_LDFLAGS"; unset HAVE_SZLIB])
+    
+    if test -z "$HAVE_SZLIB" -a -n "$HDF5_CONFIG_ABORT"; then
+      AC_MSG_ERROR([couldn't find szlib library, check if szip library is valid])
+    fi
+    ;;
+esac
+
+
+if test "X$HAVE_SZLIB" = "Xyes"; then
+    dnl SZLIB library is available.  Check if it can encode
+
+    dnl Given that user specifies h5cc, LDFLAGS in h5cc should be overriden; otherwise,
+    dnl the encoding test will be performed on the SZIP library linked with HDF5, not
+    dnl the SZIP library user specifies. To suppress the SZIP library linked with HDF5,
+    dnl we prepend the user-specified SZIP library path to LDFLAGS in h5cc by using awk.
+
+    AC_PROG_AWK
+
+    AC_MSG_CHECKING([for h5cc])
+    PURE_CC=""
+    if ($CC -show &> /dev/null); then
+	dnl Since CC can be "h5cc -Df2cFortran", arguments should be removed
+	PURE_CC=`echo "$CC" | $AWK '{ split($1, array, " ") ; printf array[[1]] }'`
+	AC_MSG_RESULT([$PURE_CC])
+    else
+	AC_MSG_RESULT([$CC])
+	AC_MSG_ERROR([CC is not h5cc])
+    fi
+
+    SZIP_CC=szip_cc
+    cat $PURE_CC | $AWK '{ if ( $0 ~ /^LDFLAGS=\"(.*)/ ) { print substr($0, 1, 9) " -L'$szlib_lib' " substr($0, 10) } else  { print } } ' > $SZIP_CC
+    chmod 755 $SZIP_CC
+    saved_CC="$CC"
+    CC=./$SZIP_CC
+
+    AC_MSG_CHECKING([for szlib encoder])
+
+    AC_CACHE_VAL([he5_cv_szlib_functional],
+        [AC_TRY_RUN([
+	#include <stddef.h>
+        #include <szlib.h>
+
+        int main(void)
+        {
+            SZ_encoder_enabled();
+            exit(0);
+        }
+        ], [he5_cv_szlib_functional=yes], [he5_cv_szlib_functional=no],)])
+
+    AC_CACHE_VAL([he5_cv_szlib_can_encode],
+        [AC_TRY_RUN([
+	#include <stddef.h>
+        #include <szlib.h>
+
+        int main(void)
+        {
+            /* SZ_encoder_enabled returns 1 if encoder is present */
+            if(SZ_encoder_enabled() == 1)
+                exit(0);
+            else
+                exit(1);
+        }
+        ], [he5_cv_szlib_can_encode=yes], [he5_cv_szlib_can_encode=no],)])
+
+    CC="$saved_CC"
+    rm -f $SZIP_CC
+
+    if test ${he5_cv_szlib_functional} = "no"; then
+        he5_cv_szlib_can_encode=broken
+    else
+        AC_DEFINE(HAVE_FILTER_SZIP, 1,
+                [Define if support for szip filter is enabled])
+        USE_FILTER_SZIP="yes"
+    fi
+
+    if test ${he5_cv_szlib_can_encode} = "yes"; then
+    	AC_DEFINE(HAVE_FILTER_SZIP_ENCODER, 1,
+		[Define if support for szip encoder filter is enabled])
+	USE_SZIP_ENCODER="yes"
+        AC_MSG_RESULT([yes])
+    fi
+    if test ${he5_cv_szlib_can_encode} = "no"; then
+        AC_MSG_RESULT([no])
+    fi
+    if test ${he5_cv_szlib_can_encode} = "broken"; then
+        AC_MSG_RESULT([shared szlib doesn't work. disabling szip.])
+    fi
+
+    dnl Add "szip" to external filter list
+    if test ${he5_cv_szlib_can_encode} = "yes"; then
+        if test "X$EXTERNAL_FILTERS" != "X"; then
+            EXTERNAL_FILTERS="${EXTERNAL_FILTERS},"
+        fi
+        EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)"
+    fi
+    if test ${he5_cv_szlib_can_encode} = "no"; then
+        if test "X$EXTERNAL_FILTERS" != "X"; then
+            EXTERNAL_FILTERS="${EXTERNAL_FILTERS},"
+        fi
+        EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)"
+    fi
+fi
+
+# Check for the HDF5 library using the --with argument
+# Of course HDF5 is required, but the user may be using h5cc, in which case
+# they don't need to specify --with-hdf5.  They can also use
+# --with-hdf5=/path/to/hdf5 to give a specific path.
+HAVE_HDF5="yes"
+AC_ARG_WITH([hdf5],
+            [AC_HELP_STRING([--with-hdf5=DIR],
+                            [Specify path to HDF5 library to use while building
+                            [default=yes]])],,
+            withval=yes)
+
+case $withval in
+  yes)
+    ;;
+  no)
+    AC_MSG_ERROR([HDF5 disabled in confugre, but is required to build HDF-EOS5.])
+    ;;
+  *)
+    case "$withval" in
+      *,*)
+        hdf5_inc="`echo $withval |cut -f1 -d,`"
+        hdf5_lib="`echo $withval |cut -f2 -d, -s`"
+        ;;
+      *)
+        if test -n "$withval"; then
+          hdf5_inc="$withval/include"
+          hdf5_lib="$withval/lib"
+        fi
+        ;;
+    esac
+
+    dnl Trying to include -I/usr/include and -L/usr/lib is redundant and
+    dnl can mess some compilers up.
+    if test "X$hdf5_inc" = "X/usr/include"; then
+      hdf5_inc=""
+    fi
+    if test "X$hdf5_lib" = "X/usr/lib"; then
+      hdf5_lib=""
+    fi
+
+    if test -n "$hdf5_inc"; then
+      CPPFLAGS="$CPPFLAGS -I$hdf5_inc"
+      CFLAGS="$CFLAGS -I$hdf5_inc"
+    fi
+
+    if test -n "$hdf5_lib"; then
+      LDFLAGS="$LDFLAGS -L$hdf5_lib"
+    fi
+    ;;
+esac
+
+dnl See if we have a valid linking path to the HDF5 library, either because
+dnl it's in the user's path or because they provided the correct path using
+dnl --with-hdf5
+AC_CHECK_HEADERS([hdf5.h], , [HAVE_HDF5="no"])
+AC_CHECK_LIB(hdf5, H5Fcreate,, [HAVE_HDF5="no"])
+
+if test "X$HAVE_HDF5" = "Xno"; then
+  AC_MSG_ERROR([can't link against HDF5 library])
+fi
+
+
+# Check whether HDF5 threadsafety is enabled
+AC_MSG_CHECKING([if HDF5 threadsafe mode is enabled])
+AC_TRY_RUN([
+#include "hdf5.h"
+
+int main(void) {
+#ifdef H5_HAVE_THREADSAFE
+  return 0;
+#else
+  return 1;
+#endif
+} ], 
+  [ AC_MSG_RESULT([yes])
+    THREADSAFE="yes"],
+  [AC_MSG_RESULT([no])
+    THREADSAFE="no"])
+
+# Record threadsafe status in config.h and for Makefiles
+if test "X$THREADSAFE" = "Xyes"; then
+  AC_DEFINE([_HDFEOS5_THREADSAFE], [1],
+            [Define if threadsafe HDF-EOS is enabled])
+fi
+
+AM_CONDITIONAL([THREADSAFE_CONDITIONAL], [test "X$THREADSAFE" = "Xyes"])
+
+
+if test "x$HAVE_HDF5" = "xyes"; then
+  dnl Check if HDF5 is linked with SZIP encoder
+
+  AC_MSG_CHECKING([for hdf5 szip decoding filter])
+  AC_CACHE_VAL([he5_cv_hdf5_szip_can_decode],
+      [AC_TRY_RUN([
+      #include <H5Ipublic.h>
+      #include <H5Zpublic.h>
+      
+      int main(int argc, char **argv)
+      {
+              herr_t ret;
+              unsigned int flags = 0;
+              int decoder = 0;
+      
+              ret = H5Zget_filter_info(H5Z_FILTER_SZIP, &flags);
+	      if (ret < 0) exit(1);
+              decoder = flags & H5Z_FILTER_CONFIG_DECODE_ENABLED;
+              if (decoder) exit(0);
+              else exit(1);
+      }
+      ], [he5_cv_hdf5_szip_can_decode=yes], [he5_cv_hdf5_szip_can_decode=no],)])
+  if test ${he5_cv_hdf5_szip_can_decode} = "yes"; then
+    AC_DEFINE(HAVE_HDF5_SZIP_DECODER, 1,
+	    [Define if HDF5 has szip decoder filter])
+    AC_DEFINE(H5_HAVE_FILTER_SZIP, 1,
+	    [Define if HDF5 has szip any type of filter])
+    AC_MSG_RESULT([yes])
+  else
+    AC_MSG_RESULT([no])
+  fi
+
+  AC_MSG_CHECKING([for hdf5 szip encoding filter])
+  AC_CACHE_VAL([he5_cv_hdf5_szip_can_encode],
+      [AC_TRY_RUN([
+      #include <H5Ipublic.h>
+      #include <H5Zpublic.h>
+      
+      int main(int argc, char **argv)
+      {
+              herr_t ret;
+              unsigned int flags = 0;
+              int encoder = 0;
+      
+              ret = H5Zget_filter_info(H5Z_FILTER_SZIP, &flags);
+	      if (ret < 0) exit(1);
+              encoder = flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED;
+              if (encoder) exit(0);
+              else exit(1);
+      }
+      ], [he5_cv_hdf5_szip_can_encode=yes], [he5_cv_hdf5_szip_can_encode=no],)])
+
+  if test ${he5_cv_hdf5_szip_can_encode} = "yes"; then
+    AC_DEFINE(HAVE_HDF5_SZIP_ENCODER, 1,
+	    [Define if HDF5 has szip encoder filter])
+    AC_MSG_RESULT([yes])
+  else
+    AC_MSG_RESULT([no])
+  fi
+
+  dnl Check if SZIP linked with HDF5 has the same configuration as SZIP given by --with-szlib option has
+  if test ${he5_cv_hdf5_szip_can_decode} = "no"; then
+    if test "X$HAVE_SZLIB" = "Xyes"; then
+      AC_MSG_ERROR([HDF5 was linked without SZIP, but --with-szlib was given])
+    fi
+  else
+    if test "X$HAVE_SZLIB" != "Xyes"; then
+      AC_MSG_ERROR([HDF5 was linked with SZIP, but --with-szlib was not given])
+    fi
+    if test ${he5_cv_szlib_functional} = "no"; then
+      AC_MSG_ERROR([SZIP specified in --with-szlib is not functional])
+    fi
+    if test ${he5_cv_hdf5_szip_can_encode} = "no"; then
+      if test ${he5_cv_szlib_can_encode} = "yes"; then
+	AC_MSG_ERROR([HDF5 was linked without SZIP encoder, but yours has SZIP encoder])
+      fi
+    else
+      if test ${he5_cv_szlib_can_encode} = "no"; then
+	AC_MSG_ERROR([HDF5 was linked with SZIP encoder, but yours does not have SZIP encoder])
+      fi
+    fi
+  fi
+fi
+
+# Set CFLAGS to prevent AC_PROG_CC from setting it
+CFLAGS=$CFLAGS
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+
+# Checks for libraries.
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([malloc.h stdlib.h string.h limits.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_OFF_T
+AC_TYPE_SIZE_T
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_FUNC_MEMCMP
+AC_FUNC_REALLOC
+AC_FUNC_ERROR_AT_LINE
+AC_CHECK_FUNCS([memchr memmove memset strchr strstr pow sqrt])
+
+# Check whether testdrivers directory is present.  The user might have
+# downloaded HDF-EOS5 but not the tests.
+AC_MSG_CHECKING([for testdrivers directory])
+if test -d "${srcdir}/testdrivers"; then
+  TESTDRIVERS_DIR="yes"
+  AC_MSG_RESULT([present])
+
+  # If the testdrivers directory is present, see if it contains a file named
+  # 'makefile'.  If so, rename the file so it doesn't cause confusion later
+  # on.
+  if test -e "testdrivers/makefile"; then
+    mv testdrivers/makefile testdrivers/makefile_orig
+  fi
+
+else
+  TESTDRIVERS_DIR="no"
+  AC_MSG_RESULT([not found])
+  AC_MSG_WARN([testdrivers directory is not present. Tests will not be run])
+fi
+
+AC_ARG_ENABLE([install-include],
+              [AC_HELP_STRING([--enable-install-include],
+                              [HDF-EOS5 normally only installs libraries,
+                               assuming that users will use the headers in
+                               the include directories.
+                               Users who want the standard automake
+                               behavior of installing both libraries and
+                               header files should enable this option.])],
+              [INSTALL_INCLUDE=$enableval])
+
+AM_CONDITIONAL([TESTDRIVERS_CONDITIONAL], [test "X$TESTDRIVERS_DIR" = "Xyes"])
+AM_CONDITIONAL([INSTALL_INCLUDE_CONDITIONAL], [test "X$INSTALL_INCLUDE" = "Xyes"])
+AM_CONDITIONAL([F2CFORTRAN_CONDITIONAL], [test "X$F2CFORTRAN_MACRO" = "Xyes"])
+AM_CONDITIONAL([F2CFORTRAN_90_CONDITIONAL], [test "X$F2CFORTRAN_90" = "Xyes"])
+AM_CONDITIONAL([F2CFORTRAN_32PTR_CONDITIONAL], [test "X$F2CFORTRAN_32PTR" = "Xyes"])
+AM_CONDITIONAL([SZIP_ENCODER_CONDITIONAL], [test "X$USE_SZIP_ENCODER" = "Xyes"])
+
+AC_CONFIG_FILES([Makefile
+                 include/Makefile
+                 src/Makefile
+                 gctp/Makefile
+                 gctp/include/Makefile
+                 gctp/src/Makefile
+                 samples/Makefile])
+
+if test "X$TESTDRIVERS_DIR" = "Xyes"; then
+  AC_CONFIG_FILES([ testdrivers/Makefile
+                 testdrivers/grid/Makefile
+                 testdrivers/point/Makefile
+                 testdrivers/swath/Makefile
+                 testdrivers/threads/Makefile
+                 testdrivers/za/Makefile])
+fi
+
+AC_OUTPUT
diff --git a/doc/AUTOCONF_INSTALL b/doc/AUTOCONF_INSTALL
new file mode 100644
index 0000000..76f01b1
--- /dev/null
+++ b/doc/AUTOCONF_INSTALL
@@ -0,0 +1,227 @@
+Installing HDF-EOS5 using Autoconf/Automake
+
+1)  Quick Start (here we assume hdfeos5 directory is inside a directory 
+considered as <target-dir>, and that the brand is linux. You may replace 
+it with another supported brand name if you are installing hdfeos5 in a 
+different platform)
+
+To build HDF-EOS5 from <target-dir>/hdfeos5 and install the HDF-EOS5 library
+into <target-dir>/hdfeos5/lib/linux :
+    $ cd <target-dir>/hdfeos5
+    $ ./configure --with-hdf5=/path/to/hdf5 --libdir=<target-dir>/hdfeos5/lib/linux
+    $ make install
+
+If your HDF5 is 1.8.X version you will need -DH5_USE_16_API flag for compiling of HDF-EOS5.
+If you are using HDF5 1.6.X version, then this flag is not needed. There reason is that 
+with 1.8.X the HDF Group modified some HDF5 APIs, increasing number of their arguments. In
+HDFD-EOS5 we did not change the calls for those APIS, using the same number of arguments 
+as in HDF5-1.6.X releases. So HDF group provided this flag so that HDF5-1.8.X work as 
+HDF5-1.6.X, and let HDF-EOS5 compile without changing APIs.
+
+For example you may need to do the following before running ./configure
+
+    $ setenv CFLAGS "-g -DH5_USE_16_API"
+
+See also example in section 10 below.
+
+You may also need one of the following flags if you are using the corresponding platform:
+
+flag			platform
+--------               ---------
+DEC_ALPHA		dec alpha	
+IRIX			sgi
+SGI64			64-bit sgi compilation
+UNICOS			cray
+LINUX64			linux 64-bit compilation
+IA64			linux (in PC with itanium chip)
+MACINTOSH		power mac
+MACINTEL		intel mac (32 and 64-bit compilation)
+IBM6000			ibm
+CYGWIN			cygwin
+
+So for example for 64-bit linux compilation with HDF5-1.8.15 you will need to set:
+
+    $ setenv CFLAGS "-g -DH5_USE_16_API -DLINUX64"
+
+2)  Configuration
+
+HDF-EOS5 uses the GNU autoconf system for configuration, which detects various
+features of the host system and creates the Makefiles. On most systems with
+HDF-EOS5 installed it should be sufficient to say:
+
+    $ ./configure               OR      
+    $ sh configure
+
+The configuration process can be controlled through environment variables
+and command-line switches.  For a complete list of switches type:
+
+    $ ./configure --help
+
+Configure must be re-run for each platform, and the source tree can only be
+configured for one platform at a time.
+
+In 64-bit machines one must set the desired compiler flag for the compilation
+ mode before running ./configure. For example to install HDF-EOS5 in 32-bit
+ mode in SGI one must set CC as:
+setenv CC "cc  -n32"
+
+or to install HDF-EOS5 in 64-bit mode in SGI one must set CC as:
+setenv CC "cc  -64"
+
+In a 64-bit linux or Macs Intel the 32-bit flag is "-m32". So for 32-bit installation
+one must set CC as:
+setenv CC "gcc  -m32"
+
+The same is applied to the FORTRAN compiler flag.
+
+3)  Building against HDF5
+
+On systems without HDF5 installed, where HDF5 is not found automatically,
+or to link against a different version of the HDF5 library, the user must
+specify the path to HDF5.  This can be done either by giving the path to
+configure directly:
+
+    $ ./configure --with-hdf5=/path/to/hdf5
+
+or by setting the environment variable CC to be the h5cc script installed
+with HDF5:
+
+    $ H5CC=/path/to/hdf5/bin/h5cc
+    $ ./configure
+or 
+    $ setenv H5CC /path/to/hdf5/bin/h5cc
+    $ ./configure
+
+
+4)  Building against ZLIB and SZLIB
+
+HDF-EOS5 does not require the zlib and szlib libraries to build,
+but some of the tests in the testdrivers directory require them.  Their
+paths can be given to configure using the --with-zlib and --with-szlib
+switches:
+
+    $ ./configure --with-zlib=/usr/local/zlib --with-szlib=/usr/local/szlib
+
+
+5)  Specifying install locations
+
+The location where the HDF-EOS5 library will be installed is controlled by
+the --libdir switch.  To set the install location to
+<target-dir>/hdfeos5/lib/linux :
+
+    $ ./configure --libdir=<target-dir>/hdfeos5/lib/linux
+
+HDF-EOS5 tradionally installs libraries into the hdfeos5/lib/* directories
+and does not install header files.  Users who wish to install both libraries
+and header files should use the --enable-install-include switch to enable
+this feature and the --prefix switch to control where they are installed.
+To install into /usr/local/hdfeos5/include and /usr/local/hdfeos5/lib :
+
+    $ ./configure --enable-install-include --prefix=/usr/local/hdfeos5
+
+The default installation location if no flags are specified is a directory
+named hdfeos5 in the current directory, with libraries in hdfeos5/lib and
+include files in hdfeos5/include (if installing include files is enabled).
+
+
+6)  Building and Installing
+
+Once HDF-EOS5 has been configured, its makefiles can be used to build, test,
+and install.  To build the library:
+
+    $ make
+
+To run tests (if present):
+
+    $ make check
+
+To install to the location specified during configure:
+
+    $ make install
+
+These commands do not need to be run in order; if the library has not been
+built, 'make install' will build it before installing.  However, configure
+must always have been run on the current system before running make.
+
+
+7)  The Testdrivers Directory
+
+The testdrivers directory contains test to verify that HDF-EOS5 has built
+correctly.  Users who wish to run these tests should copy the testdrivers
+directory into the hdfeos5 directory before running configure.  Configure
+will detect the presence of this directory and 'make check' will run all
+the tests it contains.
+
+
+8)  For More Information
+
+For more information about using autoconf and automake, see the
+documentation online at
+http://sources.redhat.com/autobook/autobook/autobook.html
+or HDF5's documentation.
+
+
+9) Fortran compiler options
+This section explains what FCFLAGS is expected when you get errors.
+
+1. -fno-second-underscore option
+Linkers may complain undefined references; e.g.
+
+   undefined reference to `swrdfld__`
+
+Mostly, this error is caused by different name mangling methods.  In the
+HDF-EOS library, Fortran API functions have one underscore; e.g. 'swrdfld_'.
+However, some Fortran compilers assumes external functions have two
+underscores like 'swrdfld__', which doesn't exist in the library.
+
+Other Fortran compilers may have different name mangling methods, and the user
+may need to read their documents to match the name mangling method.
+
+2. Linking errors
+You may get some linking errors while Fortran testdrivers are built. Some
+systems may require additional libraries. Generally, h5cc can detect these
+additional libraries and pass them to the linker. That's the reason why you
+may not encounter linking errors while building the HDF-EOS5 library.
+
+To build Fortran testdrivers, however, pure Fortran compilers are used, which
+means there is no helper that can do what h5cc does. So, if you get some
+linking errors, you need to set additional libraries before executing
+configure script:
+
+    $ LIBS=<additional libraries>
+or
+    $ setenv LIBS <additional libraries>
+
+We got a problem under Solaris, and we had to set LIBS environment variable as
+the following:
+
+    $ LIBS=-lnsl
+or
+   $ setenv LIBS -lnsl
+
+
+10} Example
+
+1.  In 64-bit Linux  machine for 32-bit installation:
+
+>setenv CC "/tools/pgs/ataaheri/TOOLKIT/hdf5/linux32/hdf5-1.8.12/bin/h5cc -Df2cFortran -DH5_USE_16_API"
+>setenv FC "/usr/bin/g77 -fno-second-underscore -DH5_USE_16_API"
+>setenv CFLAGS -m32
+>setenv FCFLAGS -m32
+>setenv LDFLAGS -m32
+>./configure --libdir=/User_Home/hdfeos5_autoconfig/hdfeos/lib/linux32 --enable-install-include --prefix=/User_Home/hdfeos5_autoconfig/hdfeos --with-hdf5=/User_Home/TOOLKIT/hdf5/linux32/hdf5-1.8.12 --with-zlib=/User_Home/TOOLKIT/zlib/linux32/zlib-1.2.8 --with-szlib=/User_Home/TOOLKIT/szip/linux32/szip-2.1 --with-jpeg=/User_Home/TOOLKIT/jpeg/linux32/jpeg-6b
+>make
+>make check
+>make install
+
+2  In 64-bit Linux  machine for 64-bit installation:
+
+>setenv CC "/tools/pgs/ataaheri/TOOLKIT/hdf5/linux64/hdf5-1.8.12/bin/h5cc -Df2cFortran -DH5_USE_16_API"
+>setenv FC "/usr/bin/g77 -fno-second-underscore -DH5_USE_16_API"
+>setenv CFLAGS  -DLINUX64
+>setenv FCFLAGS  -DLINUX64
+>setenv LDFLAGS  -DLINUX64
+>./configure --libdir=/User_Home/hdfeos5_autoconfig/hdfeos/lib/linux64 --enable-install-include --prefix=/User_Home/hdfeos5_autoconfig/hdfeos --with-hdf5=/User_Home/TOOLKIT/hdf5/linux64/hdf5-1.8.12 --with-zlib=/User_Home/TOOLKIT/zlib/linux64/zlib-1.2.8 --with-szlib=/User_Home/TOOLKIT/szip/linux64/szip-2.1 --with-jpeg=/User_Home/TOOLKIT/jpeg/linux64/jpeg-6b
+>make
+>make check
+>make install
diff --git a/doc/Building_EOS5.doc b/doc/Building_EOS5.doc
new file mode 100755
index 0000000..d696fe9
Binary files /dev/null and b/doc/Building_EOS5.doc differ
diff --git a/doc/Compile_WIN.readme.txt b/doc/Compile_WIN.readme.txt
new file mode 100755
index 0000000..24a2242
--- /dev/null
+++ b/doc/Compile_WIN.readme.txt
@@ -0,0 +1,139 @@
+ 
+COMPILING A PROGRAM:
+-------------------
+                  
+Following are instructions for compiling an application program on the 
+window xp using the hdfeos binaries that we provide or you build.
+
+Make sure that you already have all of the following libraries before you 
+startto compile an application program:  libjpeg.lib, zlib.lib (or zdll.lib), 
+szlib.lib, hdf5.lib, hdf5_hl.lib, hdfeos5.lib, hdf5_fortran.lib, 
+hdf5_hl_fortran.lib, gctp.lib.
+
+NOTE: The current versions that we're using: jpeg6b, zlib1.2.8, szip2.1, 
+HDF5-1.8.12, HDFEOS5.1.15.
+If you want to use the latest versions of jpeg, zlib and szlib, 
+go to The HDF Group website (http://www.hdfgroup.org/release4/obtain.html and
+http://www.hdfgroup.org/HDF5/release/obtain5.html) to download.
+
+C or Fortran program :
+---------------------
+Using Microsoft "Visual C++ version 9.x (orlater)" for C program:
+Using Digitalt Visual Fortran version 9.x or later version for 
+
+
+==================== Using Microsoft Visual Studio 2008 =======================
+
+Example: runing the hdfeos testdrivers:
+
+Open Microsoft Visual Studio 2008 and create a project 
+(Visual C++ Project->Win32 Console Project). place a "testdriver" (for example
+/hdfeos/testdrivers/swath/testswath.c) in the "Source Files" directory (in the 
+Solution Explorer Window) and the tutils.h in the "Haeder Files" directory of 
+the project. Choose "Release" or "Debug" for the configuration setting (using 
+Build->"Configuration Manager" or the one showing on the toolbar).
+
+
+Click on project name in the project tree.
+Select Project->Properties:
+
+	Select "General" under "Configuration Properties". 
+		In the selection window for "Configuration Type" select 
+		"Application(.exe)" option to create output as executable.
+
+	Select folder C/C++->Preprocesssor
+		Add the following to "Preprocessor definitions":   
+		VISUAL_CPLUSPLUS, INTEL86, H5_USE_16_API  (if you are using 
+		HDF5-1.8.X this may be required to map a few depricated hdf5 
+		functions to their new formats)
+
+		If the followings were not already there, then add them:   
+		WIN32,_CONSOLE
+
+		For "Runtime Library" use "Multi-thread(/MT)"
+
+		For "precompiled Headers" choose 
+		"Create Precompiled Headers(/yc)"
+
+		For "Advanced"->"Compile As" choose "Compile as C Code (/TC)"
+
+
+	Select "Linker" folder.
+
+		Under "General" chose "output File" and specify the exectable 
+		and full path to it as "F:\MyHdfeos_bin\testswath.exe".
+
+		Under "Input" put the followings for the 
+		"Additional Dependencies":
+
+
+   		Swath & Point:
+   		==============
+      		wsock32.lib hdfeos5.lib hdf5_hl.lib hdf5.lib libjpeg.lib 
+		zdll.lib szlib.lib
+
+   		Grid
+   		====
+      		wsock32.lib hdfeos5.lib gctp.lib hdf5_hl.lib hdf5.lib 
+		libjpeg.lib zdll.lib szlib.lib
+
+   		The following libraries may (or may not) need to be included: 
+       		kernel32.lib user32.lib gdi32.lib winspool.lib comdig32.lib
+       		advapi32lib shell32.lib ole32.lib oleaut32.lib uuid.lib
+       		odbc32.lib odbccp32.lib
+
+   		NOTE: hdfeos5.lib and gctp.lib are Release Versions.
+      		hdfeos5d.lib and gctpd.lib are Debug versions.
+
+
+		Under "Advanced" type "main" for the "Entry Point"
+	This completes settings for "Linker". Click "Apply' then "OK" to 
+	close Property setting window.
+
+
+Select Tools->Options->Projects and Solutions->VC++ Directories->
+       "Show directories for"->"Include files", add the following directories:
+	$(VCInstallDir)include
+	$(VCInstallDir)atlmfc\include
+	$(WindowsSdkDir)\include
+	$(FrameworkSDKDir)include
+	F:<path to jpeg>\include  
+	F:<path to zlib>\include
+	F:<path to szlib>\include      
+        F:<path to HDF5>\include 
+        F:<path to HDFEOS5>\include 
+	
+
+Select Tools->Options->Projects and Solutions ->VC++Directories->
+       "Show directories for"->"Library files", add the following directories:
+
+        $(VCInstallDir)lib
+	$(VCInstallDir)atlmfc\lib
+	$(VCInstallDir)atlmfc\lib\i386
+	$(WindowsSdkDir)\lib
+	$(FrameworkSDKDir)lib
+	$(VSInstallDir)
+	$(VSInstallDir)lib
+	F:<path to jpeg>\lib 
+	F:<path to zlib>\lib
+	F:<path to szlib>\lib
+	F:<path to HDF5>\lib
+	F:<path to HDFEOS5>\lib
+
+
+Click "OK" to close "Options" window.
+
+Select Build and then "Build <project name>".
+
+To run the executable file, for example, testswath.exe
+
+Open MS-Dos, go to ../testdrivers/swath and run testswath.exe. 
+
+NOTE: Before running testpoint.exe, you should copy all ".txt" files to release
+      folder.
+
+
+
+
+
+
diff --git a/doc/HDFEOS-DEFINITION.TXT b/doc/HDFEOS-DEFINITION.TXT
new file mode 100755
index 0000000..30f9270
--- /dev/null
+++ b/doc/HDFEOS-DEFINITION.TXT
@@ -0,0 +1,169 @@
+
+Definition of HDF-EOS
+Doug Ilg and Larry Klein
+
+Abstract
+HDF-EOS is a software library designed to support EOS-specific 
+data structures, namely Grid, Point, and Swath. The new data structures 
+are constructed from standard HDF data objects, using EOS conventions, 
+through the use of a software library [1,4]. A key feature of HDF-EOS files 
+is that instrument-independent services, such as subsetting by geolocation, 
+can be applied to the files across a wide variety of data products. The 
+library is extensible and new data structures can be added.
+
+This document provides a basic specification of an HDF-EOS file, a 
+generalized description of file contents and a discussion of certain 
+limitations of the format.
+
+Definitions
+HDF-EOS is a software library that is an extension of National Center 
+for Supercomputing Applications (NCSA) HDF. The library supports the 
+construction of new data structures: Grid, Point and Swath.
+
+HDF-EOS File:
+An HDF-EOS file is any valid HDF file (i.e., any file created by the 
+NCSA HDF library [1]), that contains a family of global attributes called 
+"coremetadata.X", where ".X" is a sequence number beginning at 0 and running 
+as high as 9. Optional data objects which may appear in an HDF-EOS file 
+include another family of global attributes called "archivemetadata.X" and 
+any number of Point, Swath, and/or Grid data structures. The existence of 
+Point, Swath, or Grid structures in an HDF-EOS file implies the existence 
+of another family of global attributes called "StructMetadata.X", which is 
+automatically created, populated, and maintained by the HDF-EOS library. 
+Note that all attribute names are case sensitive.
+
+Core Metadata:
+Core metadata represent information to which system-wide services, such as 
+searching, will be applied. These metadata, which are defined in DID 311 [3], 
+are contained in the "coremetadata.X" family of global attributes within an 
+HDF-EOS file. The syntax of these metadata is compliant with the Object 
+Description Language (ODL) [4]. Tools for formatting, accessing and writing 
+core metadata are provided in the ECS Science Data Processing (SDP) Toolkit [2].
+
+Archive Metadata:
+Archive metadata represent information that, by definition, will not be 
+searchable. It contains whatever information the file creator considers 
+necessary to be in file, but to which system-wide services will not be 
+applied. These metadata are also accessed via SDP Toolkit [2] calls and 
+are written in ODL [4] syntax into the "archivemetadata.X" family of global 
+attribtes.
+
+Structural Metadata:
+Structural metadata describe the contents and structure of an HDF-EOS file. 
+These metadata are present in the file only if the HDF-EOS library has been 
+invoked to create a Grid, Point, or Swath structure. These metadata are stored 
+in the "StructMetadata.X" family of global attributes and created and maintained 
+by the HDF-EOS library. These metadata are not intended to be directly accessed 
+by data producers or users. Therefore, all access to these metadata should be 
+via appropriate function calls in the HDF-EOS library.
+
+General Limitations
+1.) External element implementations of HDF or HDF-EOS files are not supported 
+    by the ECS.
+2.) There is an absolute limit of two gigabytes on the size of a single HDF or 
+    HDF-EOS file [1].
+3.) Individual HDF and HDF-EOS character attributes are limited to 64 kilobytes 
+    in length. Hence the potential need for "families" of attributes [1].
+4.) The HDF-EOS library does not provide tools for creating, populating, or 
+    maintaining the "coremetadata" or "archivemetadata" families of attributes. 
+    Those tools appear in the SDP Toolkit [2, 3].
+5.) Any user-supplied names are case sensitive and may contain up to 64 
+    characters. Commas (","), forward slashes ("/"), and colons (":") are the 
+    only invalid characters in names.
+
+Point Structure
+Point structures are implemented as a hierarchy of Vgroups containing several 
+Vdatas. All Vgroups and Vdatas that are part of any Point structure carry the 
+class "POINT". Each level of data within a Point structure is implemented as 
+a single Vdata, with each data field being a named field in the Vdata. Hence, 
+the following limitations apply:
+
+1.) The reserved field names for special purpose geolocation fields are 
+    "Longitude", "Latitude", "Colatitude", and "Time" (case sensitive). These 
+    fields are subject to the following requirements:
+Field Name	Data Type		Format
+Longitude	float32 or float64	Decimal degrees on the range [-180.0, 180.0]
+Latitude	float32 or float64	Decimal degrees on the range [-90.0, 90.0]
+Colatitude	float32 or float64	Decimal degrees on the range [0.0, 180.0]
+Time		float64			TAI93 (seconds until(-)/since(+) midnight, 
+					1/1/93)
+These fields may be one- or two-dimensional.
+2.) Fields may only be one-dimensional.
+3.) Up to 8 levels may exist in a Point structure.
+
+Swath Structure
+Swath structures are implemented as a hierarchy of Vgroups containing a number 
+of Vdatas and/or SDSs. All Vgroups and Vdatas that are part of any Swath 
+structure carry the class "SWATH".
+
+Each one-dimensional field is implemented as a named field within its own Vdata. 
+One-dimensional fields that are the same length, and are specifically allowed 
+by the calling program, are merged into "communal" Vdatas, with each data field 
+occupying one field in the Vdata.
+
+Each multi-dimensional field is implemented as an SDS. Three-dimensional fields 
+which share the same dimensionality, dimension sizes, and data type and which 
+are specifically allowed by the calling program are merged into communal SDSs 
+with three dimensions. Two-dimensional arrays are merged as if they were 
+three-dimensional arrays with a first dimension of size 1. No merging is 
+performed on fields with more than three dimensions, on fields with an unlimited 
+dimension, or on compressed fields. 
+Accordingly, the following limitations apply:
+
+1.) The reserved field names for special purpose geolocation fields are 
+    "Longitude", "Latitude", "Colatitude", and "Time" (case sensitive). These 
+    fields are subject to the following requirements:
+Field Name	Data Type		Format
+Longitude	float32 or float64	Decimal degrees on the range [-180.0, 180.0]
+Latitude	float32 or float64	Decimal degrees on the range [-90.0, 90.0
+Colatitude	float32 or float64	Decimal degrees on the range [0.0, 180.0]
+Time		float64			TAI93 (seconds until(-)/since(+) midnight, 
+                                        1/1/93)
+These fields may be one- or two-dimensional.
+2.) Non-reserved fields may have up to 8 dimensions.
+3.) An "unlimited" dimension must be the first dimension (in C-order).
+4.) For all multi-dimensional fields in scan- or profile-oriented Swaths, the 
+    dimension representing the "along track" dimension must precede the dimension 
+    representing the scan or profile dimension(s).
+5.) Compression is selectable at the field level within a Swath. All 
+    HDF-supported 
+    compression methods are available through the HDF-EOS library. Specifying 
+    compression on a field prevents merging.
+
+Grid Structure
+Grid structures are implemented as a hierarchy of Vgroups containing several 
+SDSs. 
+All Vgroups that are part of any Grid structure carry the class "GRID". Each 
+data field within a Grid structure is implemented as a single SDS. Merging is 
+done the same way for Grid data fields as for multi-dimensional Swath 
+data fields. Therefore, the following limitations apply:
+1.) Fields may have from 2 to 8 dimensions.
+2.) Compression is selectable at the field level within a Grid. All 
+    HDF5-supported compression methods are available through the HDF-EOS5 
+    library. Specifying compression on a field prevents merging.
+
+References
+1.) Introduction to HDF5; HDF5 User's Guide, Version 1.4.5, 
+    August, 2007; HDF5 Reference Manual, for HDF5 Version 1.6.6, August, 2007;
+    See the The HDF Group site http://hdf.ncsa.uiuc.edu/HDF5/doc/index.html 
+    for documents on " HDF5 - A New Generation of HDF, The Hierarchical Data 
+    Format"
+2.) SDP Toolkit Users Guide for the ECS Project , October, 2007 [333-EMD-001]. 
+    Documentation and software are available at http://edhs1.gsfc.nasa.gov/
+3.) Release B SDPS Database Design and Database Schema Specifications , 
+    May 1996 [311-CD-008-001]; Science Data Processing Segment (SDPS) Database 
+    Design and Database Schema Specifications for the ECS Project, December 1995, 
+    [311-CD-002-004].
+4.) Object Descriptor Language reference: Planetary Data Sytems Standard Reference, 
+    Version 3.2, July 1995, JPL, California.
+
+For more specific information on the use of the HDF-EOS5 library, please 
+refer to the HDF-EOS5 User's Guide  for the ECS Project , October , 2007 
+[175-EMD-001, Rev 05].
+
+Referral:
+Refer comments to:
+Abe Taaheri
+EMD Project
+Abe_Taaheri at raytheon.com
+301-925-0783
diff --git a/doc/Install_HDFEOS5_WIN.readme.txt b/doc/Install_HDFEOS5_WIN.readme.txt
new file mode 100755
index 0000000..d4f3be7
--- /dev/null
+++ b/doc/Install_HDFEOS5_WIN.readme.txt
@@ -0,0 +1,252 @@
+#-----------------------------------------------------------------------------
+# filename:
+#       Install_HDFEOS5_WIN.README
+#
+# description:
+#       Installation instruction for HDFEOS5.1.15 on Windows xp
+#       
+# author:
+#       Phuong Nguyen/ L3 Communication, GSI.
+#       Abe Taaheri/ Raytheon SSI
+#
+# history:
+#       02-Aug-1999 Second version
+#       11-OCT-1999 Third version( with Fortran support)
+#	06-Jul-2005 Version 5.1.9
+#	19-Feb-2006 Version 5.1.10
+#	27-Feb-2008 Version 5.1.11
+#	15-jun-2009 Version 5.1.12
+#	19-Aug-2010 Version 5.1.13
+#	14-Dec-2011 Version 5.1.14
+#	05-Nov-2013 Version 5.1.15
+#-----------------------------------------------------------------------------
+              
+The instructions which follow assume that you will be using
+the 'zip' files that we provide: hdfeos5_1_15b.zip (binary file 
+for Windows xp) and hdfeos5_1_15.zip (source code file along with binaries). 
+Also we have been using "Microsoft Visual Studio 2008" for our windows 
+developement. 
+
+
+Building from Binary Code Release (hdfeos5_1_15b.zip)
+===============================================
+To install the HDFEOS with the prebuilt libraries, it is assumed that 
+you have done the following:      
+
+      NOTE: THE FOLLOWING INTSTRUTIONS SHOULD BE FINE FOR WIN xp
+
+      1. Go to the  ftp site 
+      ftp://edhs1.gsfc.nasa.gov/edhs/hdfeos5/latest_release/windows/, 
+         and download hdfeos5_1_15b.zip.
+
+      2. On your window, create a directory structure to unpack the 
+	source file. For example: 
+	F:\					(any drive)
+   	MyHDFEOS\				(any folder name)
+        
+
+      3. Copy the hdfeos5_1_15b.zip to that directory and unpack it by running 
+	WinZip on it. This should create the following directories: hdfeos5, 
+	hdf5-1.8.12-win32, jpeg6b-vs2008, zlib128-dll, and szip21-vs2008-noenc 
+	(no- encoder) and szip21-vs2008-enc (with encoder)
+
+	The libraries and include files for hdfeos5.1.15 are inside:
+	F:\MyHDFEOS\hdfeos5\lib		(Release versions of hdfeos and gctp
+					libraries (hdfeos.lib, gctp.lib))
+					(Debug versions of hdfeos and gctp
+					libraries (hdfeosd.lib, gctpd.lib))
+	
+	F:\MyHDFEOS\hdfeos5\include		( HDFEOS5 include files )
+
+	Inside the directories hdf5-1.8.12-win32, jpeg6b-vs2008, zlib128-dll, 
+	and szip21-vs2008-noenc ( or szip21-vs2008-enc) You can find their 
+	include files and libraries (hdf5.lib, hdf5_hl.lib, zdll.lib, 
+	hdf5_fortran.lib, hdf5_hl_fortran.lib, libjpeg.lib and szlib.lib).
+
+      4. Run your "Microsoft Visual Studio 2008" application.
+	If you are building an application that uses the HDFEOS5 library,
+	you must already have installed hdf5-1.8.12 (or use HDF5 binary provided
+	for your machine. 
+         
+	Assumed you have installed HDF5-1.8.12 on 
+            
+	F:\MyHDF\hdf5-1.8.12-win32\
+
+	To specify the header files and linking in the HDFEOS5 libraries:
+	Select Tools->Options->Projects and Solutions->VC++Directories->
+	"Show directories for"->"Include files", add the following directories:
+
+	$(VCInstallDir)include
+        $(VCInstallDir)atlmfc\include
+        $(WindowsSdkDir)\include
+        $(FrameworkSDKDir)include
+	F:\MyHDFEOS\jpeg6b-vs2008\include
+	F:\MyHDFEOS\zlib128-dll\include
+	F:\MyHDFEOS\szip21-vs2008-enc\include
+	F:\MyHDF\hdf5-1.8.12-win32\include
+	F:\MyHDFEOS\hdfeos5\include
+
+	Select Tools->Options->Projects and Solutions->VC++Directories->
+	"Show directories for"->"Library files", add the following directories:
+
+	F:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT
+	$(VCInstallDir)lib
+	$(VCInstallDir)atlmfc\lib
+	$(VCInstallDir)atlmfc\lib\i386
+	$(WindowsSdkDir)\lib
+	$(FrameworkSDKDir)lib
+	$(VSInstallDir)
+	$(VSInstallDir)lib
+	F:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT
+	F:\MyHDFEOS\jpeg6b-vs2008\lib
+	F:\MyHDFEOS\zlib128-dll\lib
+	F:\MyHDFEOS\szip21-vs2008-enc\lib
+	F:\MyHDF\hdf5-1.8.12-win32\lib
+	F:\MyHDFEOS\hdfeos5\lib\WIN
+
+	NOTE: you may need H5_USE_16_API in C/C++->Preprocesssor(if you are 
+	using HDF5-1.8.X this may be required to map a few depricated hdf5 
+	functions to their new formats). Please note that you may need some 
+	other include and lib directories, depending on your application. 
+	Please see Compile_WIN.readme.txt inside for more details.
+
+
+Building from Source Code Release (hdfeos5_1_15.zip)
+===============================================
+
+STEP I:  Preconditions
+
+To build the HDFEOS5, it is assumed that you have done the following:
+      
+      1. Installed MicroSoft Developer Studio 2008 (or higher)
+    
+      2. Installed jpeg, szip and zlib (see install_jpeg_zlib_szip.txt)
+         
+      3. Installed HDF5 version 1.8.12.
+
+      4. Set up a directory structure to unpack the library. For 
+      	example: 
+
+	    	F:\				(any drive)
+           	MyHDFEOS\			(any folder name)
+
+      5. Copy the source distribution archive to that directory and unpack 
+      it using the appropriate archiver options to create a directory 
+      hierarchy.
+         
+      Run WinZip on hdfeos5_1_15.zip. Exract 'hdfeos5' and
+      'hdfeos5_dev' directories into F:\MyHDFEOS5. The directory 'hdfeos5_dev' 
+      contains several files and directories for Windows, and the 'hdfeos5' 
+      directory hdfeos5 source code package.
+
+STEP II: Build HDFEOS5 library
+
+INSTRUCTIONS FOR INSTALLATION           
+
+      1. Open  F:\myHDFEOS5\hdfeos5_dev\hdfeos5.sln to begin building the 
+	Developer Studio project.
+         
+      2. Select Tools->Options->Projects and Solutions->VC++Directories->
+      "Show directories for"->"Include files", add the following directories:
+         
+	$(VCInstallDir)include
+        $(VCInstallDir)atlmfc\include
+        $(WindowsSdkDir)\include
+        $(FrameworkSDKDir)include
+	F:<path to jpeg>\include  
+	F:<path to zlib>\include
+	F:<path to szlib>\include      
+	F:<path to HDF5>\include 
+	F:<path to HDFEOS5>\include 
+	F:<path to HDFEOS5>\gctp\include
+
+	where for example <path to HDF5> is F:\MyHDF\hdf5-1.8.12-win32      
+	and <path to HDFEOS5> can be F:\myHDFEOS5\hdfeos5
+
+      3. Select Tools->Options->Projects and Solutions->VC++Directories->
+      "Show directories for"->"Library files", add the following directories:
+
+	F:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT
+	$(VCInstallDir)lib
+	$(VCInstallDir)atlmfc\lib
+	$(VCInstallDir)atlmfc\lib\i386
+	$(WindowsSdkDir)\lib
+	$(FrameworkSDKDir)lib
+	$(VSInstallDir)
+	$(VSInstallDir)lib
+	F:<path to jpeg lib>\jpeg  
+	F:<path to zlib>\lib
+	F:<path to szlib>\lib
+	F:<path to HDF5>\lib
+	F:<path to HDFEOS5>\lib\WIN
+
+      4. Select hffeos5 in the "Solution Explorer" window the select 
+      Project->Properties, 
+
+	Select "General" under "Configuration Properties". In the selection 
+	window for "Configuration Type" select "Static Library(.lib)" option 
+	to create output as library.
+
+	Select folder C/C++->Preprocesssor.
+	Add the following to "Preprocessor definitions" if they are not there 
+	alraedy: 
+	WIN32;NDEBUG;_LIB;INTEL86;VISUAL_CPLUSPLUS;_CRT_SECURE_NO_WARNINGS;
+	H5_USE_16_API	 
+
+      5. Now Select "Solution 'hdfeos5'" in the "Solution Explorer" windoW. 
+      Select "Build", then Select "Configuration Mangger".
+      Select "Debug" in "Active Solution Configuration" window, check mark 
+      hdfeos5 and gctp build boxes and change Configuration to Debug for both
+      projects.
+      Select "Build" and "Build Solutions" to build the Debug version of the 
+      hdfeos5 and gctp tree.
+
+      6. Select "Build", then Select "Configuration Mangger".
+      Select "Release" in "Active Solution Configuration" window, check mark 
+      hdfeos5 and gctp build boxes and change Configuration to Release for both
+      projects.
+      Select "Build" and "Build Solutions" to build the Release version of 
+      the hdfeos5 and gctp tree.
+
+      Please note that you have a choice of building gctp and hdfeos5 
+      separately.
+
+      7. Please check "Release" and "Debug" directories under 
+      F:\myHDFEOS5\hdfeos5_dev\hdfeos5 and F:\myHDFEOS5\hdfeos5_dev\gctp to 
+      make sure that libraries have been created sucessfully.
+
+      8. In command prompt window run the installation batch commands 
+      win32ins.bat in the directory F:\myHDFEOS5\hdfeos5_dev, Or double click 
+      on "F:\myHDFEOS5\hdfeos5_dev\win32ins.bat" file. This will copy *.lib 
+      files to F:\MyHDFEOS5\hdfeos5\lib directory and will remove some 
+      temporary files, debug and release directories, and all other lib 
+      directories under "F:\MyHDFEOS5\hdfeos5\lib" directory.
+
+      9. If you are building an application that uses the HDFEOS5 library,
+      Please refer to the 
+      <HDFEOS5 directory>\hdfeos5_dev\compile_WIN_readme.txt 
+      file for more information on compiling an application with the 
+      HDFEOS5 libraries on Windows.
+
+MORE HELPFUL POINTERS
+=====================
+
+Settings... details:
+  If you create your own project, the necessary settings can be
+  read from the hdfeos5.dsw file(as text), or from the
+  Project Settings in the Developer Studio project settings 
+  dialog.
+
+    Project
+	  Settings
+	      C/C++
+		  Category
+		     PreProcessor
+			 Code Generation
+			    Use run-time Library
+				   These are all set to use Single-Threaded.
+				   or Single-Threaded debug.
+
+
+
+
diff --git a/doc/README b/doc/README
new file mode 100755
index 0000000..f2695b0
--- /dev/null
+++ b/doc/README
@@ -0,0 +1,525 @@
+
+
+Copyright (C) 1996 Hughes and Applied Research Corporation
+
+Permission to use, modify, and distribute this software and its documentation 
+for any purpose without fee is hereby granted, provided that the above 
+copyright notice appear in all copies and that both that copyright notice and 
+this permission notice appear in supporting documentation.
+
+#-----------------------------------------------------------------------------
+# filename:	
+# 	README
+# 	
+# description:
+#       Installation instructions for HDFEOS5
+# 	
+# author:
+#	Mike Sucher / Applied Research Corp.
+# 	
+# history:
+#       18-Jun-1996 MES Initial version
+#	10-Apr-1997 DaW Updated for Release B0
+#	29-Oct-1997 DaW Updated for Release 2.1
+#	23-Mar-1998 MEDS Updated for Release 2.2
+#	16-Jun-1998 MEDS Updated for Release 2.3
+#	27-Aug-1998 MEDS Updated for Release 2.4
+#	 9-Nov-2000 DaW	 Updated for Beta-2 Release 5.0
+#	30-Oct-2002 Phuong Nguyen - Updated for Release 5.1.3
+#	10-Oct-2007 Abe Taaheri - Updated for Release 5.1.11
+#	10-Jun-2009 Abe Taaheri - Updated for Release 5.1.12
+#	19-Aug-2010 Abe Taaheri - Updated for Release 5.1.13
+#	14-Dec-2011 Abe Taaheri - Updated for Release 5.1.14
+#	05-Nov-2013 Abe Taaheri - Updated for Release 5.1.15
+#
+#-----------------------------------------------------------------------------
+
+Contents
+========
+
+
+    Installation Instructions
+
+        Preliminary
+
+        Unpacking the distribution file
+
+        Starting the installation procedure
+
+        User Account Setup
+
+        File Cleanup
+
+        Compiling and Linking with HDFEOS
+
+
+    Notes
+
+        Approved platforms
+
+        Architecture type names
+
+        Directory and file environment variables
+
+        Other environment variables
+
+        Copyright notice for cfortran.h
+
+
+
+
+
+Installation Instructions
+=========================
+
+    Preliminary
+    -----------
+
+    Before installing HDFEOS, you must already have installed HDF5,
+    version 1.8.12, on your host.  The installation script will prompt
+    for the paths to the HDF5 include and library directories.You also may 
+    need to install  zlib-1.2.8, szip-2.1, and jpeg.v6b.
+
+
+    Unpacking the distribution file
+    -------------------------------
+
+    1)  Select a location for the HDFEOS5 directory tree.  Installing
+        HDFEOS5 alone requires a disk partition with at least 35 Mb  
+        of free space.  
+
+    2)  Copy the file HDF-EOS5.1.15.tar.Z to the target directory by  
+        typing the command:
+    
+    	    cp HDF-EOS5.1.15.tar.Z <target-dir>
+    
+        where <target-dir> is the full pathname of your target directory.
+         
+    3)  Set your default directory to the target directory by typing 
+        the command:
+    
+            cd <target-dir>
+    
+    4)  Uncompress this file and extract the contents by typing the command:
+    
+    	    zcat HDF-EOS5.1.15.tar.Z | tar xvf -
+
+        This will create a subdirectory of the current directory 
+        called 'hdfeos5'.  This is the top-level HDFEOS directory,  
+        which contains the full HDFEOS directory structure.
+
+
+    Starting the installation procedure
+    -----------------------------------
+
+    1)  Set your default directory to the top-level HDFEOS directory by  
+        typing the command:
+    
+            cd hdfeos5
+
+	You can install hdfeos5 using the INSTALL-HDFEOS (see steps 2, and 3). 
+	However, starting with version 1.14 we added INSTALL script and some 
+	other related scripts to the bin directory for more robust installation 
+	of hdfeos5 in supported platforms. The INSTALL script interactively can 
+	install zlib, szip, jpeg, and hdf5 in addition to the hdfeos5. So we 
+	recommend that users use this script, rather than the INSTALL-HDFEOS 
+	script (the INSTALL-HDFEOS is internally used by INSTALL script). By 
+	using INSTALL script you will also have a chance to 
+	install hdf4 and hdfeos while installing hdf5 and hdfeos5.
+
+	To see INSTALL command options type:
+	    bin/INSTALL -h
+	For a simple installation you may type just type:
+	    bin/INSTALL -log MyLogfile
+
+	Please note that if you want to install zlib, jpeg, szip, hdf4, and 
+	hdfeos, you should also download relevant releases for these software 
+	from our ftp site, where you have downloaded the hdfeos5 distribution.
+
+	If you use INSTALL script, please skip steps 2 and 3 below.
+	
+	For all platforms (supported and unsupported) you may also use auto 
+	configuration (as for HDF5) and make.As stated above we prefer that you 
+	use INSTALL script for all supported platforms instead of auto 
+	configuration and make. If you would like to install hdfeos5 using auto 
+	configuration, please read AUTOCONF_INSTALL in hdfeos5/doc directory
+
+
+    2) Select installation options.Please note that cuurent version of 
+       HDF-EOS5 is not supported in SGI since HDF5-1.8.12 does not support it.
+       The following instruction concerning SGI are only for previous 
+       versions od HDF5 and HDF-EOS5.
+    
+       Currently, the only options are those specific to the SGI Power 
+       Challenge platform.
+ 
+       On the SGI Power Challenge, the default is to build HDFEOS in
+       64-bit mode.  The following table gives the option
+       to specify the appropriate architecture to be built:
+
+            binary format	architecture	<install-options>
+            -------------	------------	---------------
+            new-style 32 bit    sgi32		-sgi32
+            64 bit         	sgi64		<default>
+
+	Please note that the old-32-bit mode has been dropped as the default 
+	because it is no longer being supported by SGI, it is therefore 
+	recommended that all users migrate to new-style 32 bit or 64 bit mode.
+
+    3)  Run the installation script. 
+
+        Please note that the installation script for this release of  
+        HDFEOS requires user interaction.  Because of this, it should NOT 
+        be run as a background task.  
+        
+        3.0) (optional)
+            If you wish to generate a log of this session, use the Unix 
+            'script' command.  This command runs a sub-shell that saves 
+            all terminal output to the specified file.  
+            
+            To log the session, type:
+        
+              script <logfile-name>
+
+            where <logfile-name> is the name of the log file.
+
+        3.1) 
+           To run the installation script, type the command:
+    
+             bin/INSTALL-HDFEOS <install-options>
+    
+           where <install-options> is the list of options determined in
+           the previous step.
+
+           The installation script will then run.  It will output various
+           startup messages, beginning with:
+
+             HDFEOS installation starting at <date/time>
+
+        3.2) 
+           Enter the full pathnames for the HDF5 library and include  
+           directory paths, when the script prompts for them.  If there
+           is an error in the supplied paths, the script will exit.
+        
+          NOTE:
+            If the environment variables HDFLIB and/or HDFINC are set
+            in your shell, the script will use these for the default values.
+            If this is not the first run of the script, the default values
+            will be taken from the values used for the last run of the script.
+        
+            In either of these cases, the installation script will prompt with:
+        
+              Current value of the HDF library directory is: <path>
+              Accept [y]/n:  
+
+            and/or
+
+              Current value of the HDF include directory is: <path>
+              Accept [y]/n:  
+
+            Make sure to type 'n' and hit return, if the defaults do not 
+            point to the correct directories.  The script will then prompt 
+            for the new values.
+        
+
+         3.3) 
+            The installation script will finish with the following message:
+    
+              HDFEOS installation ending at <date/time>
+
+         3.4) (optional - see 3.0) 
+            If you ran the Unix 'script' command to create a log file, then
+            type 'exit' and hit return at the command prompt.  This will 
+            exit the sub-shell stated by 'script' and save the log file.
+        
+            HINT:
+              The log file generated by the script command may contain 'hard
+              return' characters at the end of each line.  These appear in
+              some text editors as "^M".   They can be removed with the 
+              following command:
+          
+                sed 's/.$//' <logfile-name> > <logfile-name>.new
+            
+              where <logfile-name> is the name of the log file.
+
+
+
+    User Account Setup
+    ------------------
+
+    Once HDFEOS5 has been installed, the accounts of HDFEOS5 users
+    must be set up to define environment variables needed to compile and
+    run code with HDFEOS (see parts 2 and 3 of the Notes section, below).
+    The type of setup depends on the user's login shell.
+    
+    1A) C shell (csh) users:
+
+        Edit the HDFEOS5 user's .cshrc file to include the
+        following line:
+
+ 	    source <HDFEOS5-home-dir>/bin/$BRAND/hdfeos_env.csh  
+	
+ 	where <HDFEOS5-home-dir> is the full path of the HDFEOS5 home 
+        directory, and $BRAND is an architecture-specific value for 
+        your host.  Please refer to part 2 of the Notes section, 
+        below, to determine the correct value.
+
+        The script hdfeos_env.csh sets up all the variables discussed in 
+        parts 2 and 3 of the Notes section, below, and it adds the HDFEOS 
+        bin directory to the user path. 
+
+        The environment variables will become available during all 
+        subsequent login sessions.  To activate them for the current 
+        session, simply type one of the two lines listed above, at the
+        Unix prompt.
+
+        Note regarding path setup with hdfeos_env.csh
+        ----------------------------------------------
+            The script hdfeos_env.csh also makes available a variable
+            called hdfeos_path.  This can be added to the user's path to
+            ensure that it accesses the directories necessary for the
+            compilers and other utilities used to generate executable
+            programs.  It is not added to the user path by default,
+            because in many cases it adds unnecessary complexity to
+            the user path.  To add hdfeos_path to the user path, modify
+            the HDFEOS user's .cshrc file to include the following:
+
+                set my_path = ($path)			# save path
+                source <HDFEOS5-HOME-DIR>/bin/$BRAND/hdfeos_env.csh # HDFEOS5 setup
+                set path = ($my_path $hdfeos_path)	# add hdfeos_path 
+
+            INSTEAD OF the line listed at the beginning of this step.  
+            Note that it is the user's responsibility to set up 
+            his or her own path so that it doesn't duplicate the 
+            directories set up in hdfeos_path.  Please also note that the 
+            hdfeos_path is added AFTER the user's path.  This way, the 
+            user's directories will be searched first when running Unix 
+            commands.
+
+    1B) Korn shell (ksh) users:
+
+        Edit the HDFEOS5 user's .profile file to include the following line:
+
+ 	    . <HDFEOS5-home-dir>/bin/$BRAND/hdfeos_env.ksh  
+	
+ 	where <HDFEOS5-home-dir> is the full path of the HDFEOS home 
+        directory, and $BRAND is an architecture-specific value for 
+        your host.  Please refer to part 2 of the Notes section, 
+        below, to determine the correct value.
+
+        The script hdfeos_env.ksh sets up all the variables discussed in 
+        part 2 and 3 of the Notes section, below, and it adds the HDFEOS 
+        bin directory to the user path. 
+
+        The environment variables will become available during all 
+        subsequent login sessions.  To activate them for the current 
+        session, simply type one of the two lines listed above, at the
+        Unix prompt.
+
+        Note regarding path setup with hdfeos_env.ksh
+        ----------------------------------------------
+            The script hdfeos_env.ksh also makes available a variable
+            called hdfeos_path.  This can be added to the user's path to
+            ensure that it accesses the directories necessary for the
+            compilers and other utilities used to generate executable
+            programs.  It is not added to the user path by default,
+            because in many cases it adds unnecessary complexity to
+            the user path.  To add hdfeos_path to the user path, modify
+            the HDFEOS user's .profile file to include the following:
+
+                my_path="$PATH"				    # save path
+                . <HDFEOS5-HOME-DIR>/bin/$BRAND/hdfeos_env.ksh # HDFEOS5 setup
+                PATH="$my_path:$hdfeos_path" ; export PATH     # add hdfeos_path 
+
+            INSTEAD OF the line listed at the beginning of this step.  
+            Note that it is the user's responsibility to set up 
+            his or her own path so that it doesn't duplicate the 
+            directories set up in hdfeos_path.  Please also note that the 
+            hdfeos_path is added AFTER the user's path.  This way, the 
+            user's directories will be searched first when running Unix 
+            commands.
+
+    1C) Bourne shell (sh) users:
+
+        Set up the required HDFEOS5 environment variables by appending  
+        the contents of the file <HDFEOS5-home-dir>/bin/$BRAND/hdfeos_env.ksh 
+        to the end of the HDFEOS5 user's .profile, where <HDFEOS5-home-dir> 
+        is the full path of the HDFEOS home directory, and $BRAND is an 
+        architecture-specific value for your host.  Please refer to part
+        2 of the Notes section, below, to determine the correct value.
+
+        The environment variables will become available during all 
+        subsequent login sessions.  To activate them, log out and
+        then log back in.
+    
+
+    File Cleanup
+    ------------
+
+    Once HDFEOS has been built and tested, you can delete certain 
+    temporary files and directories to save some disk space.   Note 
+    that once these files have been removed, you will need to unpack 
+    the original distribution file in order to re-do the installation.
+
+    To remove these files:
+    
+        cd <HDFEOS5-home-dir>/bin
+        rm -rf tmp
+        cd <HDFEOS5-home-dir>/lib
+        rm -rf tmp
+ 
+
+
+    Compiling and Linking with HDFEOS
+    ---------------------------------
+    
+    In order to compile and link programs with the HDFEOS you must
+    access the HDFEOS include and library files.   To do this be
+    sure that your makefiles include something like the following:
+
+
+    INCLUDE = -I. -I$(HDFEOS_INC) -I$(HDFINC)
+    LIBRARY = -L. -L$(HDFEOS_LIB) -L$(HDFLIB)
+
+
+    LDFLAGS = -lhe5_hdfeos -lGctp -lhdf5_hl -lhdf5 -lnsl -ljpeg -lz -lsz -lm (Sun platform)
+    LDFLAGS = -lhe5_hdfeos -lGctp -lhdf5_hl -lhdf5 -ljpeg -lz -lsz -lm	 (others)
+
+
+    The environment variables HDFEOS_INC, HDFEOS_LIB, HDFINC and HDFLIB
+    are set up by the HDFEOS environment scripts (see User Setup, above).
+    They refer to the include and library directories for HDFEOS and HDF,
+    respectively.
+    
+    The INCLUDE macro should be included in all compilation statements.
+    The LIBRARY an LDFLAGS macros should be included in all link statements.
+
+
+
+Notes
+=====
+
+    1)  Approved platforms
+
+        HDFEOS5 was built and tested in a multi-platform environment.
+        The list of approved platforms, which includes information about 
+        operating system and compiler versions, may be found in the
+        HDFEOS User's Guide.
+
+
+    2)  Architecture type names
+
+        To track architecture dependencies, HDFEOS defines the 
+        environment variable $BRAND.  Following is a list of valid values 
+        for this variable, which is referred to throughout this document:
+	(we officially does not support some platforms startinfg with
+	 HDF-EOS5.1.12, such as dec, hp, ibm, sgi, and sun5.8 and sun5.9 )
+
+        $BRAND		Architecture
+        ======		============
+
+        dec*       	DEC Alpha
+        hp*        	HP 9000, HPUX-11 9000/785
+        ibm*       	IBM RS-6000
+        sgi*      	IRIX 5.3;6.2
+        sgi32*     	SGI Power Challenge (new-style 32-bit mode)
+        sgi64*    	SGI Power Challenge (64-bit mode)
+        sun5.X    	Sun: SunOS 5.x (5.8*,5.9*,5.10)
+        linux      	Linux: Red Hat Enterprise
+        linux32    	64-bit linux platform in 32-bit mode
+        linux64    	64-bit linux platform in 64-bit mode
+        macintosh  	Darwin6.8
+	macintel32  	Darwin, Intel i386 32-bit mode
+	macintel64  	Darwin, Intel i386 64-bit mode
+        Windows   	Windows XP: Microsoft Visual C++ 2008
+        cygwin    	i686 cygwin 
+
+         * These platforms are not officially supported anymore
+
+    3)  Directory and file environment variables
+
+        In order to use the HDFEOS libraries and utilities, a number of
+        environment variables MUST be set up to point to HDFEOS directories
+        and files.  These variables are automatically set up in User Account 
+        Setup section of the installation instructions.  They are 
+        listed here for reference:
+
+	name			value			   description
+	====			=====			   ===========
+
+	HDFEOS5_HOME 		<install-path>/hdfeos	   top-level directory
+
+	(where <install-path> is the absolute directory path above hdfeos)
+
+	HDFEOS5_BIN 		$HDFEOS5_HOME/bin/$BRAND   executable files
+	HDFEOS5_INC 		$HDFEOS5_HOME/include      header files
+	HDFEOS5_LIB 		$HDFEOS5_HOME/lib/$BRAND   library files
+	HDFEOS5_OBJ 		$HDFEOS5_HOME/obj/$BRAND   object files
+	HDFEOS5_SRC 		$HDFEOS5_HOME/src          source files
+
+
+    4)  Other environment variables
+
+        In addition, the makefiles which are used to build the libraries
+        require certain machine-specific environment variables.  These set
+        compilers, compilation flags and libraries, allowing a single set of
+        makefiles to serve on multiple platforms.  The User Account Setup 
+        section of the installation instructions explains how to set them up.  
+        They are listed here for reference:
+       
+	name			description
+	====	 		===========
+
+	CC 			C compiler
+	CFLAGS 			default C flags (optimize, ANSI)
+	C_CFH 			C w/ cfortran.h callable from FORTRAN
+	CFHFLAGS 		CFLAGS + C_CFH
+	C_F77_CFH 		C w/ cfortran.h calling FORTRAN
+	C_F77_LIB 		FORTRAN lib called by C main
+	F77 			FORTRAN compiler
+	F77FLAGS		common FORTRAN flags
+	F77_CFH			FORTRAN callable from C w/ cfortran.h
+	F77_C_CFH 	 	FORTRAN calling C w/ cfortran.h
+	CFH_F77 		same as F77_C_CFH
+	F77_C_LIB  		C lib called by FORTRAN main
+
+	
+    5)  Tools provided with this release
+
+        For a complete list of the tools provided with this release of 
+        HDFEOS5, please refer to HDFEOS5 User's Guide.
+
+    6)  Copyright notice for cfortran.h
+
+        The majority of the HDFEOS functions are written in C.
+        These C-based tools include the file cfortran.h, using it to 
+        generate machine-independent FORTRAN bindings. The cfortran.h 
+        facility includes the following notice which must accompany
+        distributions that use it:
+
+THIS PACKAGE, I.E. CFORTRAN.H, THIS DOCUMENT, AND THE CFORTRAN.H EXAMPLE
+PROGRAMS ARE PROPERTY OF THE AUTHOR WHO RESERVES ALL RIGHTS. THIS PACKAGE AND
+THE CODE IT PRODUCES MAY BE FREELY DISTRIBUTED WITHOUT FEES, SUBJECT TO THE
+FOLLOWING RESTRICTIONS:
+- YOU MUST ACCOMPANY ANY COPIES OR DISTRIBUTION WITH THIS (UNALTERED) NOTICE.
+- YOU MAY NOT RECEIVE MONEY FOR THE DISTRIBUTION OR FOR ITS MEDIA 
+  (E.G. TAPE, DISK, COMPUTER, PAPER.)
+- YOU MAY NOT PREVENT OTHERS FROM COPYING IT FREELY.
+- YOU MAY NOT DISTRIBUTE MODIFIED VERSIONS WITHOUT CLEARLY DOCUMENTING YOUR
+  CHANGES AND NOTIFYING THE AUTHOR.
+- YOU MAY NOT MISREPRESENTED THE ORIGIN OF THIS SOFTWARE, EITHER BY EXPLICIT
+  CLAIM OR BY OMISSION.
+
+THE INTENT OF THE ABOVE TERMS IS TO ENSURE THAT THE CFORTRAN.H PACKAGE NOT BE
+USED FOR PROFIT MAKING ACTIVITIES UNLESS SOME ROYALTY ARRANGEMENT IS ENTERED
+INTO WITH ITS AUTHOR.
+              
+THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
+EXPRESSED OR IMPLIED. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST
+OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. THE AUTHOR IS NOT RESPONSIBLE
+FOR ANY SUPPORT OR SERVICE OF THE CFORTRAN.H PACKAGE.
+
+                                              Burkhard Burow 
+                                              burow at vxdesy.cern.ch
+
diff --git a/include/HE5_GctpFunc.h b/include/HE5_GctpFunc.h
new file mode 100755
index 0000000..0439108
--- /dev/null
+++ b/include/HE5_GctpFunc.h
@@ -0,0 +1,281 @@
+/*---------------------------------------------------------------------------------  
+ |        Copyright (C) 1999  Emergent IT Inc.  and Raytheon Systems Company      |    
+ |  Permission to use, modify, and distribute this software and its documentation |
+ |  for any purpose without fee is hereby granted, provided that the above        | 
+ |  copyright notice appear in all copies and that both that copyright notice and |
+ |  this permission notice appear in supporting documentation.                    |
+ |                                                                                |
+ |  BEGIN_FILE_PROLOG:                                                            |
+ |  FILENAME:                                                                     |
+ |  HE5_GCTPFUNC.H                                                                |
+ |  DESCRIPTION:                                                                  |
+ |	This file contains function prototypes that are specific to the GCTP          |
+ |  AUTHOR:                                                                       |
+ |	Alex Muslimov / Emergent Information Tecnologies, Inc.                        |
+ |  HISTORY:                                                                      |
+ |	14-May-01 AM Initial version                                                  |
+ | END_FILE_PROLOG:                                                               |
+ ----------------------------------------------------------------------------------
+ */
+
+#ifndef HE5_GctpFunc_h
+#define HE5_GctpFunc_h
+
+/*****************************************************************
+    Function prototypes.
+*****************************************************************/
+
+int stplnfor(double lon, double lat, double *x, double *y);
+int stplninv(double x, double y, double *lon, double *lat);
+int stplnforint(long zone, long sphere, char *fn27, char *fn83);
+int stplninvint(long zone, long sphere, char *fn27, char *fn83);
+int alberfor(double lon, double lat, double *x, double *y);
+int alberinv(double x, double y, double *lon, double *lat);
+int alberforint(double r_maj, double r_min, double lat1, double lat2, 
+                double lon0, double lat0, double false_east, 
+                double false_north);
+int alberinvint(double r_maj, double r_min, double lat1, double lat2, 
+                double lon0, double lat0, double false_east, 
+                double false_north);
+int lamccfor(double lon, double lat, double *x, double *y);
+int lamccinv(double x, double y, double *lon, double *lat);
+int lamccforint(double r_maj, double r_min, double lat1, double lat2, 
+                double c_lon, double c_lat, double false_east, 
+                double false_north);
+int lamccinvint(double r_maj, double r_min, double lat1, double lat2, 
+                double c_lon, double c_lat, double false_east, 
+                double false_north);
+int merfor(double lon, double lat, double *x, double *y);
+int merinv(double x, double y, double *lon, double *lat);
+int merforint(double r_maj, double r_min, double center_lon, 
+                double center_lat, double false_east, double false_north);
+int merinvint(double r_maj, double r_min, double center_lon, 
+                double center_lat, double false_east, double false_north);
+int psfor(double lon, double lat, double *x, double *y);
+int psinv(double x, double y, double *lon, double *lat);
+int psforint(double r_maj, double r_min, double c_lon, double c_lat, 
+                double false_east, double false_north);
+int psinvint(double r_maj, double r_min, double c_lon, double c_lat, 
+                double false_east, double false_north);
+int polyfor(double lon, double lat, double *x, double *y);
+int polyinv(double x, double y, double *lon, double *lat);
+int polyforint(double r_maj, double r_min, double center_lon, 
+                double center_lat, double false_east, double false_north);
+int polyinvint(double r_maj, double r_min, double center_lon, 
+                double center_lat, double false_east, double false_north);
+int eqconfor(double lon, double lat, double *x, double *y);
+int eqconinv(double x, double y, double *lon, double *lat);
+int eqconforint(double r_maj, double r_min, double lat1, double lat2, 
+                double center_lon, double center_lat, double false_east, 
+                double false_north, long mode);
+int eqconinvint(double r_maj, double r_min, double lat1, double lat2, 
+                double center_lon, double center_lat, double false_east, 
+                double false_north, long mode);
+int tmfor(double lon, double lat, double *x, double *y);
+int tminv(double x, double y, double *lon, double *lat);
+int tmforint(double r_maj, double r_min, double scale_fact, 
+                double center_lon, double center_lat, double false_east, 
+                double false_north);
+int tminvint(double r_maj, double r_min, double scale_fact, 
+                double center_lon, double center_lat, double false_east, 
+                double false_north);
+int sterfor(double lon, double lat, double *x, double *y);
+int sterinv(double x, double y, double *lon, double *lat);
+int sterforint(double r_maj, double center_lon, double center_lat, 
+                double false_east, double false_north);
+int sterinvint(double r_maj, double center_lon, double center_lat, 
+                double false_east, double false_north);
+int lamazfor(double lon, double lat, double *x, double *y);
+int lamazinv(double x, double y, double *lon, double *lat);
+int lamazforint(double r, double center_long, double center_lat, 
+                double false_east, double false_north);
+int lamazinvint(double r, double center_long, double center_lat, 
+                double false_east, double false_north);
+int azimfor(double lon, double lat, double *x, double *y);
+int aziminv(double x, double y, double *lon, double *lat);
+int azimforint(double r_maj, double center_lon, double center_lat, 
+                double false_east, double false_north);
+int aziminvint(double r_maj, double center_lon, double center_lat, 
+                double false_east, double false_north);
+int gnomfor(double lon, double lat, double *x, double *y);
+int gnominv(double x, double y, double *lon, double *lat);
+int gnomforint(double r, double center_long, double center_lat, 
+                double false_east, double false_north);
+int gnominvint(double r, double center_long, double center_lat, 
+                double false_east, double false_north);
+int orthfor(double lon, double lat, double *x, double *y);
+int orthinv(double x, double y, double *lon, double *lat);
+int orthforint(double r_maj, double center_lon, double center_lat, 
+                double false_east, double false_north);
+int orthinvint(double r_maj, double center_lon, double center_lat, 
+                double false_east, double false_north);
+int gvnspfor(double lon, double lat, double *x, double *y);
+int gvnspinv(double x, double y, double *lon, double *lat);
+int gvnspforint(double r, double h, double center_long, double center_lat, 
+                double false_east, double false_north);
+int gvnspinvint(double r, double h, double center_long, double center_lat, 
+                double false_east, double false_north);
+int sinfor(double lon, double lat, double *x, double *y);
+int sininv(double x, double y, double *lon, double *lat);
+int sinforint(double r, double center_long, double false_east, 
+                double false_north);
+int sininvint(double r, double center_long, double false_east, 
+                double false_north);
+int equifor(double lon, double lat, double *x, double *y);
+int equiinv(double x, double y, double *lon, double *lat);
+int equiforint(double r_maj, double center_lon, double lat1, 
+                double false_east, double false_north);
+int equiinvint(double r_maj, double center_lon, double lat1, 
+                double false_east, double false_north);
+int millfor(double lon, double lat, double *x, double *y);
+int millinv(double x, double y, double *lon, double *lat);
+int millforint(double r, double center_long, double false_east, 
+                double false_north);
+int millinvint(double r, double center_long, double false_east, 
+                double false_north);
+int vandgfor(double lon, double lat, double *x, double *y);
+int vandginv(double x, double y, double *lon, double *lat);
+int vandgforint(double r, double center_long, double false_east, 
+                double false_north);
+int vandginvint(double r, double center_long, double false_east, 
+                double false_north);
+int omerfor(double lon, double lat, double *x, double *y);
+int omerinv(double x, double y, double *lon, double *lat);
+int omerforint(double r_maj, double r_min, double scale_fact, 
+                double azimuth, double lon_orig, double lat_orig, 
+                double false_east, double false_north, double lon1, 
+                double lat1, double lon2, double lat2, long mode);
+int omerinvint(double r_maj, double r_min, double scale_fact, 
+                double azimuth, double lon_orig, double lat_orig, 
+                double false_east, double false_north, double lon1, 
+                double lat1, double lon2, double lat2, long mode);
+int somfor(double lon, double lat, double *x, double *y);
+int sominv(double x, double y, double *lon, double *lat);
+int somforint(double r_major, double r_minor, long satnum, long path, 
+                double alf_in, double lon, double false_east, 
+                double false_north, double time, long start1, long flag, 
+                double sat_ratio);
+int sominvint(double r_major, double r_minor, long satnum, long path, 
+                double alf_in, double lon, double false_east, 
+                double false_north, double time, long start1, long flag, 
+                double sat_ratio);
+int hamfor(double lon, double lat, double *x, double *y);
+int haminv(double x, double y, double *lon, double *lat);
+int hamforint(double r, double center_long, double false_east, 
+                double false_north);
+int haminvint(double r, double center_long, double false_east, 
+                double false_north);
+int robfor(double lon, double lat, double *x, double *y);
+int robinv(double x, double y, double *lon, double *lat);
+int robforint(double r, double center_long, double false_east, 
+                double false_north);
+int robinvint(double r, double center_long, double false_east, 
+                double false_north);
+int goodfor(double lon, double lat, double *x, double *y);
+int goodinv(double x, double y, double *lon, double *lat);
+int goodforint(double r);
+int goodinvint(double r);
+int molwfor(double lon, double lat, double *x, double *y);
+int molwinv(double x, double y, double *lon, double *lat);
+int molwforint(double r, double center_long, double false_east, 
+                double false_north);
+int molwinvint(double r, double center_long, double false_east, 
+                double false_north);
+int imolwfor(double lon, double lat, double *x, double *y);
+int imolwinv(double x, double y, double *lon, double *lat);
+int imolwforint(double r);
+int imolwinvint(double r);
+int alconfor(double lon, double lat, double *x, double *y);
+int alconinv(double x, double y, double *lon, double *lat);
+int alconforint(double r_maj, double r_min, double false_east, 
+                double false_north);
+int alconinvint(double r_maj, double r_min, double false_east, 
+                double false_north);
+int wivfor(double lon, double lat, double *x, double *y);
+int wivinv(double x, double y, double *lon, double *lat);
+int wivforint(double r, double center_long, double false_east, 
+                double false_north);
+int wivinvint(double r, double center_long, double false_east, 
+                double false_north);
+int wviifor(double lon, double lat, double *x, double *y);
+int wviiinv(double x, double y, double *lon, double *lat);
+int wviiforint(double r, double center_long, double false_east, 
+                double false_north);
+int wviiinvint(double r, double center_long, double false_east, 
+                double false_north);
+int obleqfor(double lon, double lat, double *x, double *y);
+int obleqinv(double x, double y, double *lon, double *lat);
+int obleqforint(double r, double center_long, double center_lat, 
+                double shape_m, double shape_n, double angle, 
+                double false_east, double false_north);
+int obleqinvint(double r, double center_long, double center_lat, 
+                double shape_m, double shape_n, double angle, 
+                double false_east, double false_north);
+int isinusfor(double lon, double lat, double *x, double *y);
+int isinusinv(double x, double y, double *lon, double *lat);
+long isinusforinit(double sphere, double lon_cen_mer, double false_east,
+                   double false_north, double dzone, double djustify);
+long isinusinvinit(double sphere, double lon_cen_mer, double false_east,
+                   double false_north, double dzone, double djustify);
+int utmfor(double lon, double lat, double *x, double *y);
+int utminv(double x, double y, double *lon, double *lat);
+int utmforint(double r_maj, double r_min, double scale_fact, long zone);
+int utminvint(double r_maj, double r_min, double scale_fact, long zone);
+long calc_utm_zone(double lon);
+int bceaforint(double r_maj, double center_lon, double center_lat,
+	       double false_east, double false_north);
+int bceafor(double lon, double lat, double *x, double *y);
+int bceainvint(double r_maj, double center_lon, double center_lat, 
+	       double false_east, double false_north);
+int bceainv(double x, double y, double *lon, double *lat);
+void p_error(char *what, char *where);
+void ptitle(char *A);
+void tsincos(double val, double *sin_val, double *cos_val);
+double msfnz(double eccent, double sinphi, double cosphi);
+double qsfnz(double eccent, double sinphi, double cosphi);
+double tsfnz(double eccent, double phi, double sinphi);
+void radius2(double A, double B);
+void radius(double A);
+void stanparl(double A, double B);
+void cenlonmer(double A);
+void cenlon(double A);
+void cenlat(double A);
+void origin(double A);
+void offsetp(double A, double B);
+double adjust_lon(double x);
+double phi1z(double eccent, double qs, long  *flag);
+double phi2z(double eccent, double ts, long *flag);
+double phi3z(double ml, double e0, double e1, double e2, 
+             double e3, long *flag);
+double phi4z(double eccent, double e0, double e1, double e2, 
+             double e3, double a, double b, double *c, double *phi);
+double asinz(double con);
+int sign(double x);
+double e0fn(double x);
+double e1fn(double x);
+double e2fn(double x);
+double e3fn(double x);
+double e4fn(double x);
+double mlfn(double e0, double e1, double e2, double e3, double phi);
+double paksz(double ang, long *iflg);
+double pakcz(double pak);
+void stparl1(double A);
+void genrpt(double A, char *S);
+void genrpt_long(long A, char *S);
+void pblank();
+
+#if defined(SGI64) || defined(UNICOS) || defined(LINUX64) || defined(IA64) || defined(MACINTOSH) || defined(MACINTEL) || defined(IBM6000) || defined(CYGWIN) || defined(DEC_ALPHA)
+void for_init(int a, int b, double c[], int d, char *str1, char *str2, int *e, int (**func)(double, double, double *, double *)); 
+
+void inv_init(int a,int b,double *c,int d,char *str1,char *str2,int *e,int (**func)(double, double, double*, double*));
+
+#else
+void for_init(long a, long b, double c[], long d, char *str1, char *str2, long *e, long (**func)(double, double, double *, double *)); 
+
+void inv_init(long a,long b,double *c,long d,char *str1,char *str2,long *e,long (**func)(double, double, double*, double*));
+#endif
+
+
+#endif
+
+
diff --git a/include/HE5_HdfEosDef.h b/include/HE5_HdfEosDef.h
new file mode 100755
index 0000000..9ed7881
--- /dev/null
+++ b/include/HE5_HdfEosDef.h
@@ -0,0 +1,981 @@
+/*----------------------------------------------------------------------------|
+|                                                                             |
+|        Copyright (C) 1999  Emergent IT Inc.  and Raytheon Systems Company   |
+|                                                                             |
+|Permission to use, modify, and distribute this software and its documentation|
+|for any purpose without fee is hereby granted, provided that the above       |
+|copyright notice appear in all copies and that both that copyright notice and|
+|this permission notice appear in supporting documentation.                   |
+|                                                                             |
+|-----------------------------------------------------------------------------|
+|                                                                             |
+| This is the main header file to be distributed with the HDF-EOS library.    |
+|                                                                             |
+| Last date updated: June 5, 2001                                             |
+|                    Aug 23, 2001  A.M. Added thread-safe related blocks.     |
+|                    May 29, 2002  S.Z  Added ZA interface                    |
+|                    August, 2003  S.Z  Added szip compression methods.       |
+|                    April,  2004  S.Z  Added a data type flag HE5T_CHARSTRING|
+|                    August, 2004  S.Z  Added field number type in            |
+|                                       HE5_CmpDTSinfo                        |
+-----------------------------------------------------------------------------*/
+
+
+#ifndef HE5_HDFEOSDEF_H_
+#define HE5_HDFEOSDEF_H_
+
+#include <hdf5.h>
+
+#ifdef H5_USE_16_API
+#include <H5DSpublic.h>
+#endif
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef __cplusplus
+#include  <cfortHdf.h>
+#endif
+
+#ifdef   _HDFEOS5_THREADSAFE
+#include <pthread.h>
+#endif
+
+
+#define HE5_HDFEOSVERSION "1.15"
+
+#define H5_USE_16_API 1
+
+#ifndef FALSE
+#   define FALSE 0
+#endif
+#ifndef TRUE
+#   define TRUE (!FALSE)
+#endif
+
+#ifndef SUCCEED
+#   define SUCCEED           0
+#endif
+
+#ifndef FAIL
+#   define FAIL            (-1)
+#endif
+
+#ifndef HDstrcmp
+#   define  HDstrcmp(X,Y)		strcmp(X,Y)
+#endif
+
+#ifndef  MAX
+#    define  MAX(X,Y)           ((X)>(Y)?(X):(Y))
+#endif
+
+#ifndef  MIN
+#    define  MIN(X,Y)           ((X)<(Y)?(X):(Y))
+#endif
+
+#define  CHECKPOINTER(p)    {                              \
+     status = HE5_EHchkptr((void *)p,#p);                  \
+     if (status == FAIL) goto COMPLETION;                  \
+}
+
+#define  CHECKNAME(p)    {                                 \
+     status = HE5_EHchkname((char *)p,#p);                 \
+     if (status == FAIL) goto COMPLETION;                  \
+}
+
+#ifndef HDFI_H
+typedef unsigned uintn;
+#endif
+
+#ifdef WIN32
+#define LONGLONG __int64
+#else
+#define LONGLONG long long
+#endif
+
+/*
+ ----------------------------------------------
+ |          HDF-EOS Defined Sizes             |
+ ----------------------------------------------
+ */
+
+#define HE5_DTSETRANKMAX         8
+#define HE5_FLDNUMBERMAX       500
+#define HE5_OBJNAMELENMAX      256
+#define HE5_BLKSIZE         640000
+#define HE5_CHUNKSIZE         1000
+#define HE5_DIMNUMBERMAX       500
+#define HE5_ATTRNUMBERMAX      100  /* max number of attr for each dim scale */
+
+#define HE5_HDFE_TYPESTRSIZE    80
+#define HE5_HDFE_DIMBUFSIZE    256
+#define HE5_HDFE_NAMBUFSIZE    256
+#define HE5_HDFE_ERRBUFSIZE    256
+#define HE5_HDFE_UTLBUFSIZE   1024
+
+/*
+ ----------------------------------------------
+ |     HDF-EOS Global Data Structures         |
+ ----------------------------------------------
+ */
+
+typedef struct
+{
+  hid_t  ID;     /* Field-associated dataset ID    */
+  char   *name;  /*      HDF-EOS field name        */
+}HE5_DTSinfo;    /* Field-associated dataset Info  */
+
+
+typedef struct
+{
+  char *attrname[HE5_ATTRNUMBERMAX]; /* attribute name  */
+  hid_t numtype[HE5_ATTRNUMBERMAX];
+  hsize_t count[HE5_ATTRNUMBERMAX][8];
+  uint8_t *datbuf[HE5_ATTRNUMBERMAX];
+  int dsnumberOfAttrs;               /* total number of attributes for one dim scale */
+}HE5_dimscaleAttr;
+
+
+
+/* 
+ ----------------------------------------------
+ |     Compound Dataset Information Data      |
+ |               Structure                    |
+ ----------------------------------------------
+ */
+
+typedef struct
+{
+  int            nfields;                  /* Number of data fields    */
+  int            rank[HE5_FLDNUMBERMAX];   /* Fields rank array        */
+  int            array[HE5_FLDNUMBERMAX];  /* Flag if field is an array*/
+  char           *fieldname[HE5_FLDNUMBERMAX];/* Array of field names     */
+                                              /* Array of dimension sizes */ 
+  size_t         dims[HE5_FLDNUMBERMAX][HE5_DTSETRANKMAX];
+  size_t         datasize;                 /* Size of data (bytes)     */
+  size_t         offset[HE5_FLDNUMBERMAX]; /* Array of field offsets   */
+  hid_t          dtype[HE5_FLDNUMBERMAX];  /* Array of field type IDs  */
+  hid_t          numtype[HE5_FLDNUMBERMAX];/* Array of field number type IDs */
+  H5T_class_t    dclass[HE5_FLDNUMBERMAX]; /* Array of field class IDs */
+}HE5_CmpDTSinfo;
+
+typedef  struct 
+{
+  long        count;     /* Object counter */
+  long        strsize;   /* Operator data  */
+  char        *name;     /* Object name    */ 
+}HE5_OBJINFO;
+
+/* File access flags for TOOLKIT */
+/* ----------------------------- */
+#ifndef HDF4_ACC_RDONLY
+#   define  HDF4_ACC_RDONLY 1
+#endif
+
+#ifndef HDF5_ACC_RDONLY
+#   define  HDF5_ACC_RDONLY 11
+#endif
+
+#ifndef HDF4_ACC_RDWR
+#   define  HDF4_ACC_RDWR 3
+#endif
+
+#ifndef HDF5_ACC_RDWR
+#   define  HDF5_ACC_RDWR 13
+#endif
+
+#ifndef HDF4_ACC_CREATE
+#   define  HDF4_ACC_CREATE 4
+#endif
+
+#ifndef HDF5_ACC_CREATE
+#   define  HDF5_ACC_CREATE 14
+#endif
+
+/* Data type flags for FORTRAN wrappers */
+/* ------------------------------------ */
+#ifndef    HE5F_ACC_RDWR
+#define    HE5F_ACC_RDWR           100 
+#endif
+#ifndef    HE5F_ACC_RDONLY
+#define    HE5F_ACC_RDONLY         101 
+#endif
+#ifndef    HE5F_ACC_TRUNC
+#define    HE5F_ACC_TRUNC          102 
+#endif
+
+#define    HE5T_NATIVE_INT           0 
+#define    HE5T_NATIVE_UINT          1 
+#define    HE5T_NATIVE_SHORT         2 
+#define    HE5T_NATIVE_USHORT        3 
+#define    HE5T_NATIVE_SCHAR         4 
+#define    HE5T_NATIVE_UCHAR         5 
+#define    HE5T_NATIVE_LONG          6 
+#define    HE5T_NATIVE_ULONG         7 
+#define    HE5T_NATIVE_LLONG         8 
+#define    HE5T_NATIVE_ULLONG        9 
+#define    HE5T_NATIVE_FLOAT        10 
+#define    HE5T_NATIVE_REAL         10
+#define    HE5T_NATIVE_DOUBLE       11 
+#define    HE5T_NATIVE_LDOUBLE      12 
+#define    HE5T_NATIVE_INT8         13 
+#define    HE5T_NATIVE_UINT8        14 
+#define    HE5T_NATIVE_INT16        15 
+#define    HE5T_NATIVE_UINT16       16 
+#define    HE5T_NATIVE_INT32        17 
+#define    HE5T_NATIVE_UINT32       18 
+#define    HE5T_NATIVE_INT64        19 
+#define    HE5T_NATIVE_UINT64       20 
+#define    HE5T_NATIVE_B8           21 
+#define    HE5T_NATIVE_B16          22 
+#define    HE5T_NATIVE_B32          23 
+#define    HE5T_NATIVE_B64          24 
+#define    HE5T_NATIVE_HSIZE        25 
+#define    HE5T_NATIVE_HERR         26 
+#define    HE5T_NATIVE_HBOOL        27 
+#define    HE5T_STD_I8BE            28 
+#define    HE5T_STD_I8LE            29 
+#define    HE5T_STD_I16BE           30 
+#define    HE5T_STD_I16LE           31 
+#define    HE5T_STD_I32BE           32 
+#define    HE5T_STD_I32LE           33 
+#define    HE5T_STD_I64BE           34 
+#define    HE5T_STD_I64LE           35 
+#define    HE5T_STD_U8BE            36 
+#define    HE5T_STD_U8LE            37 
+#define    HE5T_STD_U16BE           38 
+#define    HE5T_STD_U16LE           39 
+#define    HE5T_STD_U32BE           40 
+#define    HE5T_STD_U32LE           41 
+#define    HE5T_STD_U64BE           42 
+#define    HE5T_STD_U64LE           43 
+#define    HE5T_STD_B8BE            44 
+#define    HE5T_STD_B8LE            45 
+#define    HE5T_STD_B16BE           46 
+#define    HE5T_STD_B16LE           47 
+#define    HE5T_STD_B32BE           48 
+#define    HE5T_STD_B32LE           49 
+#define    HE5T_STD_B64BE           50 
+#define    HE5T_STD_B64LE           51 
+#define    HE5T_IEEE_F32BE          52                 
+#define    HE5T_IEEE_F32LE          53                 
+#define    HE5T_IEEE_F64BE          54                 
+#define    HE5T_IEEE_F64LE          55                 
+#define    HE5T_NATIVE_CHAR         56
+#define    HE5T_CHARSTRING          57
+
+#define    HE5S_UNLIMITED_F         -1 
+#define    HE5S_UNLIMITED_F_64      -1 
+
+
+/* Field Merge Flags   */
+/* ------------------- */
+#define HE5_HDFE_NOMERGE   0
+#define HE5_HDFE_AUTOMERGE 1
+
+
+/* XXentries Codes     */
+/* ------------------- */
+#define HE5_HDFE_NENTDIM   0
+#define HE5_HDFE_NENTMAP   1
+#define HE5_HDFE_NENTIMAP  2
+#define HE5_HDFE_NENTGFLD  3
+#define HE5_HDFE_NENTDFLD  4
+
+/* Angle Conversion Codes */
+/* ---------------------- */
+#define HE5_HDFE_RAD_DEG      0
+#define HE5_HDFE_DEG_RAD      1
+#define HE5_HDFE_DMS_DEG      2
+#define HE5_HDFE_DEG_DMS      3
+#define HE5_HDFE_RAD_DMS      4
+#define HE5_HDFE_DMS_RAD      5
+
+
+/* Swath Subset Modes       */
+/* ------------------------ */
+#define HE5_HDFE_MIDPOINT       0
+#define HE5_HDFE_ENDPOINT       1
+#define HE5_HDFE_ANYPOINT       2
+#define HE5_HDFE_INTERNAL       0
+#define HE5_HDFE_EXTERNAL       1
+#define HE5_HDFE_NOPREVSUB     -1
+
+
+/* Grid Origin Codes       */
+/* ----------------------- */
+#define HE5_HDFE_GD_UL         0
+#define HE5_HDFE_GD_UR         1
+#define HE5_HDFE_GD_LL         2
+#define HE5_HDFE_GD_LR         3
+
+
+/* Pixel Registration Codes */
+/* ------------------------ */
+#define HE5_HDFE_CENTER         0
+#define HE5_HDFE_CORNER         1
+
+
+/* GCTP Projection Codes */
+/* --------------------- */
+#define HE5_GCTP_GEO         0
+#define HE5_GCTP_UTM         1
+#define HE5_GCTP_SPCS        2
+#define HE5_GCTP_ALBERS      3
+#define HE5_GCTP_LAMCC       4
+#define HE5_GCTP_MERCAT      5
+#define HE5_GCTP_PS          6
+#define HE5_GCTP_POLYC       7
+#define HE5_GCTP_EQUIDC      8
+#define HE5_GCTP_TM          9
+#define HE5_GCTP_STEREO     10
+#define HE5_GCTP_LAMAZ      11
+#define HE5_GCTP_AZMEQD     12
+#define HE5_GCTP_GNOMON     13
+#define HE5_GCTP_ORTHO      14
+#define HE5_GCTP_GVNSP      15
+#define HE5_GCTP_SNSOID     16
+#define HE5_GCTP_EQRECT     17
+#define HE5_GCTP_MILLER     18
+#define HE5_GCTP_VGRINT     19
+#define HE5_GCTP_HOM        20
+#define HE5_GCTP_ROBIN      21
+#define HE5_GCTP_SOM        22
+#define HE5_GCTP_ALASKA     23
+#define HE5_GCTP_GOOD       24
+#define HE5_GCTP_MOLL       25
+#define HE5_GCTP_IMOLL      26
+#define HE5_GCTP_HAMMER     27
+#define HE5_GCTP_WAGIV      28
+#define HE5_GCTP_WAGVII     29
+#define HE5_GCTP_OBLEQA     30
+#define HE5_GCTP_CEA        97
+#define HE5_GCTP_BCEA       98
+#define HE5_GCTP_ISINUS     99
+
+
+/* Tiling Codes            */
+/* ----------------------- */
+#define HE5_HDFE_NOTILE        0
+#define HE5_HDFE_TILE          1
+
+
+/* Compression Methods       */
+/* ------------------------- */
+#define HE5_HDFE_COMP_NONE                0
+#define HE5_HDFE_COMP_RLE                 1
+#define HE5_HDFE_COMP_NBIT                2
+#define HE5_HDFE_COMP_SKPHUFF             3
+#define HE5_HDFE_COMP_DEFLATE             4
+#define HE5_HDFE_COMP_SZIP_CHIP           5
+#define HE5_HDFE_COMP_SZIP_K13            6
+#define HE5_HDFE_COMP_SZIP_EC             7
+#define HE5_HDFE_COMP_SZIP_NN             8
+#define HE5_HDFE_COMP_SZIP_K13orEC        9
+#define HE5_HDFE_COMP_SZIP_K13orNN       10
+#define HE5_HDFE_COMP_SHUF_DEFLATE       11 
+#define HE5_HDFE_COMP_SHUF_SZIP_CHIP     12
+#define HE5_HDFE_COMP_SHUF_SZIP_K13      13
+#define HE5_HDFE_COMP_SHUF_SZIP_EC       14
+#define HE5_HDFE_COMP_SHUF_SZIP_NN       15
+#define HE5_HDFE_COMP_SHUF_SZIP_K13orEC  16
+#define HE5_HDFE_COMP_SHUF_SZIP_K13orNN  17
+
+
+/* HDFEOS Group Codes              */
+/* ------------------------------- */
+#define HE5_HDFE_GEOGROUP           0
+#define HE5_HDFE_DATAGROUP          1
+#define HE5_HDFE_ATTRGROUP          2
+#define HE5_HDFE_GRPATTRGROUP       3
+#define HE5_HDFE_LOCATTRGROUP       4
+#define HE5_HDFE_PROFGROUP          5
+#define HE5_HDFE_PROFGRPATTRGROUP   6
+#define HE5_HDFE_GEOGRPATTRGROUP    7   
+
+
+/*
+ ----------------------------------------------
+ |    For  HDF-EOS5 Thread Safe Library       |
+ ----------------------------------------------
+ */
+
+#ifdef   _HDFEOS5_THREADSAFE
+
+typedef struct
+{
+  pthread_mutex_t  Lock;
+  pthread_t        *MasterThread;
+  pthread_cond_t   CondVar;
+  unsigned int     LockCount;
+} HE5_HDFE_MutexStruct;
+
+
+HE5_HDFE_MutexStruct   GlobalMutex;
+
+
+/* Macro for first thread initialization */
+/* ------------------------------------- */
+#define HE5_FIRST_THREAD_INIT  {                                             \
+   status = pthread_once(&HE5_HDFE_TS_FirstInit, HE5_TSinitfirst);           \
+}
+
+/* Macro for locking the mutex */
+/* --------------------------- */
+#define HE5_LOCK        {                                                    \
+   status = HE5_TSmutexlock(&GlobalMutex);                                   \
+     if (status != SUCCEED) goto COMPLETION;                                 \
+}
+
+/* Macro for unlocking the mutex */
+/* ----------------------------- */
+#define HE5_UNLOCK      {                                                    \
+   status = HE5_TSmutexunlock(&GlobalMutex);                                 \
+     if (status != SUCCEED) goto COMPLETION;                                 \
+}
+
+#else  /* -D_HDFEOS5_THREADSAFE */
+
+typedef struct
+{
+  int dummyVar;
+} HE5_HDFE_MutexStruct;
+
+/* disable any first thread init mechanism */
+/* --------------------------------------- */
+
+#define HE5_FIRST_THREAD_INIT
+
+/* disable locks */
+/* ------------- */
+#define HE5_LOCK
+#define HE5_UNLOCK
+
+#endif  /* -D_HDFEOS5_THREADSAFE */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Thread-safe function prototypes */
+/* ------------------------------- */
+void    
+HE5_TSinitfirst( void);
+herr_t   
+HE5_TSmutexlock(HE5_HDFE_MutexStruct *);
+herr_t   
+HE5_TSmutexunlock(HE5_HDFE_MutexStruct *);
+
+/* GCTP function prototypes */
+/* ------------------------ */
+#include  "HE5_GctpFunc.h"
+
+/* HDF5 Error handling function (from "H5private.h") */
+/* ------------------------------------------------- */
+herr_t   H5E_push(H5E_major_t maj_num, H5E_minor_t min_num, const char *func_name, const char *file_name, unsigned line, const char *desc);
+
+/*
+ **********************************************************************
+ *         E R R O R   H A N D L I N G    I N T E R F A C E           *
+ **********************************************************************
+ */
+
+
+/* File access/info routines */
+
+hid_t    HE5_EHopen(const char *filename, unsigned flags,  hid_t access_id);
+herr_t   HE5_EHclose(hid_t fid);
+herr_t   HE5_EHgetversion(hid_t fid, char *version);
+herr_t   HE5_EHchkfid(hid_t fid, const char *name, hid_t *HDFfid, hid_t *grpID, uintn *access);
+herr_t   HE5_EHidinfo(hid_t fid, hid_t *HDFfid, hid_t *gid);
+long     HE5_EHattrcat(hid_t fid,   char *grpname, char *objectlist, long *strbufsize);
+long     HE5_EHinquire(const char *filename, char *grpname, char *objectlist, long *strbufsize);
+hsize_t HE5_EHset_error_on(int flag, int err_level);
+
+/* PROTOTYPES: functions to turn HDFEOS5 error printing off */
+herr_t HE5_EHprint(char *errbuf, const char *file, unsigned line);
+
+
+/* Metadata access/info routines */
+
+char     *HE5_EHmetagroup(hid_t fid , char *structname, char *structcode, char *groupname, char *metaptrs[]);
+herr_t   HE5_EHgetmetavalue(char *metaptrs[], char *parameter, char *retstr);
+herr_t   HE5_EHinsertmeta(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]) ;
+herr_t   HE5_EHmetalist(char *instring, char *outstring);
+herr_t   HE5_EHupdatemeta(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]);
+
+/* Object info routines */
+
+long     HE5_EHcntOBJECT(char *metabuf[]);
+long     HE5_EHcntGROUP(char *metabuf[]);
+herr_t   HE5_EHattr( hid_t attgrpID, const char *attrname, hid_t ntype, hsize_t count[], char *wrcode, void *datbuf);
+herr_t   HE5_EHattrinfo( hid_t attgrpID, const char *attrname, hid_t ntype[], hsize_t *count);
+long     HE5_EHdatasetcat(hid_t fid,  char *grpname, char *objectlist, long  *strbufsize);
+int      HE5_EHobj_info(hid_t loc_id, const char *name, void *opdata);
+
+/* Utility routines */
+
+long     HE5_EHparsestr(const char *instring, char delim, char *pntr[], size_t len[]);
+long     HE5_EHstrwithin(char *target, char *search, char delim);
+herr_t   HE5_EHloadliststr(char *ptr[], long nentries, char *liststr, char delim);
+double   HE5_EHconvAng(double inAngle, int code);
+herr_t   HE5_EHrevflds(char *dimlist, char *revdimlist);
+herr_t   HE5_EHbisect(double(*func) (double[]), double funcParms[], long nParms, double limLft, double limRgt, double convCrit, double *root);
+hid_t    HE5_EHdtype2mtype(hid_t dtypeID);
+hid_t    HE5_EHdtype2numtype(hid_t dtype);
+hid_t    HE5_EHconvdatatype(int fortdatatype);
+herr_t   HE5_EHwriteglbattr(hid_t fid, const char *attrname, hid_t ntype, hsize_t  count[], void *datbuf);
+herr_t   HE5_EHreadglbattr(hid_t fid, const char *attrname, void * datbuf);
+herr_t   HE5_EHglbattrinfo(hid_t fid, const char *attrname, hid_t *ntype, hsize_t *count);
+long     HE5_EHinqglbattrs(hid_t fid, char *attrnames, long *strbufsize);
+herr_t   HE5_EHinqglbdatatype(hid_t fid, const char *attrname, hid_t *dtype, H5T_class_t *classid, H5T_order_t *order, size_t *size);
+int      HE5_szip_can_encode(void );
+
+/* Data type conversion wrappers */    
+                      
+long                 HE5_EHhid2long(hid_t invalue);
+long                 HE5_EHint2long(int invalue);
+int                  HE5_EHhid2int(hid_t invalue);
+hid_t                HE5_EHint2hid(int invalue);
+hid_t                HE5_EHlong2hid(long invalue);
+int                  HE5_EHlong2int(long invalue);
+
+hsize_t              HE5_EHhid2hsize(hid_t invalue);
+hsize_t              HE5_EHint2hsize(int invalue);
+hsize_t              HE5_EHlong2hsize(long invalue);
+hid_t                HE5_EHhsize2hid(hsize_t invalue);
+long                 HE5_EHhsize2long(hsize_t invalue);
+int                  HE5_EHhsize2int(hsize_t invalue);
+hssize_t             HE5_EHhsize2hssize(hsize_t invalue);
+
+hssize_t             HE5_EHhid2hssize(hid_t invalue);
+hssize_t             HE5_EHint2hssize(int invalue);
+hssize_t             HE5_EHlong2hssize(long invalue);
+hid_t                HE5_EHhssize2hid(hssize_t invalue);
+long                 HE5_EHhssize2long(hssize_t invalue);
+int                  HE5_EHhssize2int(hssize_t invalue);
+hsize_t              HE5_EHhssize2hsize(hssize_t invalue);
+
+unsigned LONGLONG    HE5_EHint2ullong(int invalue);
+long                 HE5_EHullong2long(unsigned LONGLONG invalue);
+
+herr_t               HE5_EHchkptr(void *p, char *name);
+herr_t               HE5_EHchkname(char *p, char *name);
+
+
+/*
+ **********************************************************************
+ *                    S W A T H    I N T E R F A C E                  *
+ **********************************************************************
+ */
+  
+
+
+/* File/Swath access routines */
+
+hid_t   HE5_SWopen(const char *filename, uintn flags);
+hid_t   HE5_SWcreate(hid_t fid, const char *swathname);
+hid_t   HE5_SWattach(hid_t fid, const char *swathname);
+herr_t  HE5_SWdetach(hid_t swathID);
+herr_t  HE5_SWclose(hid_t fid);
+
+
+/* Definition routines */
+
+herr_t  HE5_SWdefdim(hid_t swathID,  char *dimname, hsize_t dim);
+herr_t  HE5_SWdefdimmap(hid_t swathID, char *geodim, char *datadim, hsize_t offset, hsize_t increment);
+herr_t  HE5_SWdefidxmap(hid_t swathID, char *geodim, char *datadim, long index[]);
+herr_t  HE5_SWdefgeofield(hid_t swathID, const char *fieldname, char *dimlist, char *maxdimlist, hid_t ntype , int merge);
+herr_t  HE5_SWdefdatafield(hid_t swathID, const char *fieldname, char *dimlist, char *maxdimlist, hid_t ntype, int merge);
+herr_t  HE5_SWdefchunk(hid_t swathID, int ndims, const hsize_t *dim);
+herr_t  HE5_SWdefcomp(hid_t swathID, int compcode, int *compparm);
+herr_t  HE5_SWdefcomchunk(hid_t swathID, int compcode, int *compparm, int ndims, const hsize_t *dim);
+herr_t  HE5_SWsetfillvalue(hid_t swathID, char *fieldname, hid_t ntype, void *fillval);
+herr_t  HE5_SWsetalias(hid_t swathID, char *fieldname, const char *aliaslist);
+herr_t  HE5_SWdropalias(hid_t swathID, int fldgroup, const char *aliasname);
+herr_t  HE5_SWfldrename(hid_t swathID, char *oldfieldname, const char *newfieldname);
+herr_t  HE5_SWsetdimscale(hid_t swathID, char *fieldname, char *dimname,const hsize_t dimsize, hid_t numbertype, void * databuff);
+herr_t  HE5_SWdefdimscale(hid_t swathID, char *dimname, const hsize_t dimsize, hid_t numbertype, void * datbuff);
+
+/* I/O routines */
+
+herr_t  HE5_SWwritedatameta(hid_t swathID, const char *fieldname, char *dimlist, hid_t mvalue);
+herr_t  HE5_SWwriteattr(hid_t swathID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf);
+herr_t  HE5_SWwritegrpattr(hid_t swathID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf);
+herr_t  HE5_SWwritegeogrpattr(hid_t swathID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf);
+herr_t  HE5_SWwritelocattr(hid_t swathID, const char *fieldname, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf);
+herr_t  HE5_SWreadattr(hid_t swathID, const char *attrname, void *datbuf);
+herr_t  HE5_SWreadgrpattr(hid_t swathID, const char *attrname, void *datbuf);
+herr_t  HE5_SWreadgeogrpattr(hid_t swathID, const char *attrname, void *datbuf);
+herr_t  HE5_SWreadlocattr(hid_t swathID, const char *fieldname, const char *attrname, void *datbuf);
+herr_t  HE5_SWwritefield(hid_t swathID, char *fieldname, const hssize_t start[], const hsize_t stride[], const hsize_t edge[],  void *data);
+herr_t  HE5_SWreadfield(hid_t swathID, char *fieldname, const hssize_t start[], const hsize_t stride[], const hsize_t edge[],  void *data);
+herr_t  HE5_SWwritegeometa(hid_t swathID, const char *fieldname, char *dimlist, hid_t mvalue);
+herr_t  HE5_SWwritedscaleattr(hid_t swathID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t  count[],  void *datbuf);
+
+/* Inquiry routines */
+
+herr_t  HE5_SWchunkinfo(hid_t swathID, char *fieldname, int *ndims, hsize_t dims[]);
+hsize_t HE5_SWdiminfo(hid_t swathID, char *dimname);
+herr_t  HE5_SWmapinfo(hid_t swathID, char *geodim, char *datadim, long *offset, long *increment);
+hsize_t HE5_SWidxmapinfo(hid_t swathID, char *geodim, char *datadim, long index[]);
+int     HE5_SWfldsrch(hid_t swathID, char *fieldname, hid_t *fieldID, int *rank,  hsize_t dims[], hid_t *typeID);
+herr_t  HE5_SWfieldinfo(hid_t swathID, char *fieldname, int *rank, hsize_t dims[], hid_t ntype[], char *dimlist, char *maxdimlist);
+herr_t  HE5_SWcompinfo(hid_t swathID, char *fieldname, int *compcode, int compparm[]);
+herr_t  HE5_SWattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count);
+herr_t  HE5_SWgrpattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count);
+herr_t  HE5_SWgeogrpattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count);
+herr_t  HE5_SWlocattrinfo(hid_t swathID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count);
+herr_t  HE5_SWinqdatatype(hid_t swathID, const char *fieldname, const char *attrname, int group, hid_t *dtype, H5T_class_t *classid, H5T_order_t *order, size_t *size);
+long    HE5_SWinqdims(hid_t swathID, char *dimnames, hsize_t dims[]);
+long    HE5_SWinqmaps(hid_t swathID, char *dimmaps, long offset[], long increment[]);
+long    HE5_SWinqidxmaps(hid_t swathID, char *idxmaps, hsize_t idxsizes[]);
+long    HE5_SWinqgeofields(hid_t swathID, char *fieldlist, int rank[], hid_t ntype[]);
+long    HE5_SWinqdatafields(hid_t swathID, char *fieldlist, int rank[], hid_t ntype[]);
+long    HE5_SWinqattrs(hid_t swathID, char *attrnames, long *strbufsize);
+long    HE5_SWinqgrpattrs(hid_t swathID, char *attrnames, long *strbufsize);
+long    HE5_SWinqgeogrpattrs(hid_t swathID, char *attrnames, long *strbufsize);
+long    HE5_SWinqlocattrs(hid_t swathID, const char *fieldname, char *attrnames, long *strbufsize);
+long    HE5_SWnentries(hid_t swathID, int entrycode, long *strbufsize);
+long    HE5_SWinqswath(const char *filename, char *swathlist, long *strbufsize);
+herr_t  HE5_SWregioninfo(hid_t swathID, hid_t regionID, char *fieldname, hid_t *ntype, int *rank, hsize_t dims[], size_t *size);
+herr_t  HE5_SWperiodinfo(hid_t swathID, hid_t periodID, char *fieldname, hid_t *ntype, int *rank, hsize_t dims[], size_t *size);
+herr_t  HE5_SWgeomapinfo(hid_t swathID, char *geodim);
+herr_t  HE5_SWgetfillvalue(hid_t swathID, char *fieldname, void *fillval);
+herr_t  HE5_SWaliasinfo(hid_t swathID, int fldgroup, const char *aliasname, int *length, char *buffer);
+long    HE5_SWinqdfldalias(hid_t swathID, char *fldalias, long *strbufsize);
+long    HE5_SWinqgfldalias(hid_t swathID, char *fldalias, long *strbufsize);
+long    HE5_SWgetaliaslist(hid_t swathID, int fldgroup, char *aliaslist, long *strbufsize);
+long    HE5_SWgetdimscale(hid_t swathID, char *fieldname, char *dimname, hsize_t *dimsize, hid_t *numbertype, void * databuff);
+herr_t  HE5_SWdscaleattrinfo(hid_t swathID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count);
+herr_t  HE5_SWreaddscaleattr(hid_t swathID, const char *fieldname, const char *attrname, void *datbuf);
+long    HE5_SWinqdscaleattrs(hid_t swathID, const char *fieldname, char *attrnames, long *strbufsize);
+
+/* Subsetting/Retrieving routines */
+
+hid_t   HE5_SWdefboxregion(hid_t swathID, double cornerlon[], double cornerlat[], int mode);
+hid_t   HE5_SWdefvrtregion(hid_t swathID, hid_t regionID, char *vertObj, double range[]);
+hid_t   HE5_SWregionindex(hid_t swathID, double cornerlon[], double cornerlat[], int mode, char *geodim, hsize_t idxrange[]);
+hid_t   HE5_SWdupregion(hid_t oldregionID);
+hid_t   HE5_SWdeftimeperiod(hid_t swathID, double starttime, double stoptime, int mode);
+herr_t  HE5_SWextractregion(hid_t swathID, hid_t regionID, char *fieldname, int externalflag, void *buffer);
+herr_t  HE5_SWextractperiod(hid_t swathID, hid_t periodID, char *fieldname, int externalflag, void *buffer);
+long    HE5_SWupdateidxmap(hid_t swathID, hid_t regionID, long indexin[], long indexout[], long indicies[]);
+herr_t  HE5_SWupdatescene(hid_t swathID, hid_t regionID);
+herr_t  HE5_SWindexinfo(hid_t regionID, char *object, int *rank, char *dimlist, hsize_t *indices[HE5_DTSETRANKMAX]);
+
+/*
+ ********************************
+ *     PROFILE INTERFACE        *
+ ********************************
+ */ 
+
+herr_t  HE5_PRdefine(hid_t swathID, const char *profilename, char *dimlist, char *maxdimlist, hid_t datatype_id);
+herr_t  HE5_PRwrite(hid_t swathID, const char *profilename, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], size_t size, void *buffer);
+herr_t  HE5_PRread(hid_t swathID, const char *profilename, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void *buffer);
+herr_t  HE5_PRreclaimspace(hid_t swathID, const char *profilename, void *buffer);
+long    HE5_PRinquire(hid_t swathID, char *profnames, int *rank, H5T_class_t *classID);
+herr_t  HE5_PRinfo(hid_t swathID, const char *profname, int *rank, hsize_t dims[], hsize_t maxdims[], hid_t *ntype, char *dimlist, char *maxdimlist);
+herr_t  HE5_PRwritegrpattr(hid_t swathID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf);
+herr_t  HE5_PRreadgrpattr(hid_t swathID, const char *attrname, void *datbuf);
+herr_t  HE5_PRgrpattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count);
+long    HE5_PRinqgrpattrs(hid_t swathID, char *attrnames, long *strbufsize);
+
+
+/*
+ *******************************
+ *   EXTERNAL DATA FILES       *
+ *******************************
+ */
+
+herr_t  HE5_SWsetextdata(hid_t swathID, const char *filelist, off_t offset[], hsize_t size[]);
+int     HE5_SWgetextdata(hid_t swathID, char *fieldname, size_t namelength, char *filelist, off_t offset[], hsize_t size[]);
+
+
+/*
+ *******************************
+ *  MOUNTING EXTERNAL FILES    *
+ *******************************
+ */
+  
+hid_t   HE5_SWmountexternal(hid_t swathID, int fldgroup, const char *extfilename);
+herr_t  HE5_SWunmount(hid_t swathID, int fldgroup, hid_t fileID);
+herr_t  HE5_SWreadexternal(hid_t swathID, int fldgroup, const char *fieldname, void *buffer);
+
+
+/*
+ **********************************************************************
+ *                      G R I D    I N T E R F A C E                  *
+ **********************************************************************
+ */
+
+
+/* File/Grid access routines */
+
+hid_t    HE5_GDopen(const char *filename, uintn flags);
+hid_t    HE5_GDcreate(hid_t fid, const char *gridname, long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[]);
+hid_t    HE5_GDattach(hid_t fid, const char *gridname);
+herr_t   HE5_GDdetach(hid_t gridID);
+herr_t   HE5_GDclose(hid_t fid);
+
+
+/* Definition routines */
+
+herr_t   HE5_GDdefdim(hid_t gridID,  char *dimname, hsize_t dim);
+herr_t   HE5_GDdefproj(hid_t gridID, int projcode, int zonecode, int spherecode, double projparm[]);
+herr_t   HE5_GDdefcomp(hid_t gridID, int compcode, int compparm[]);
+herr_t   HE5_GDdeftile(hid_t gridID, int tilecode, int tilerank, const hsize_t *tiledims);
+herr_t   HE5_GDdefcomtile(hid_t gridID, int compcode, int compparm[], int tilerank, const hsize_t *tiledims);
+herr_t   HE5_GDdeforigin(hid_t gridID, int origincode);
+herr_t   HE5_GDdefpixreg(hid_t gridID, int pixregcode);
+herr_t   HE5_GDdeffield(hid_t gridID, const char *fieldname, char *dimlist, char *maxdimlist, hid_t ntype, int merge);
+herr_t   HE5_GDsetfillvalue(hid_t gridID, const char *fieldname, hid_t ntype, void *fillval);
+herr_t   HE5_GDsetalias(hid_t gridID, char *fieldname, const char *aliaslist);
+herr_t   HE5_GDdropalias(hid_t gridID, int fldgroup, const char *aliasname);
+herr_t   HE5_GDsetdimscale(hid_t gridID, char *fieldname, char *dimname,const hsize_t dimsize, hid_t numbertype, void * databuff);
+herr_t   HE5_GDdefdimscale(hid_t gridID, char *dimname, const hsize_t dimsize, hid_t numbertype, void * datbuff);
+
+/* I/O routines */
+
+herr_t   HE5_GDwritefieldmeta(hid_t gridID, const char *fieldname, char *dimlist, hid_t ntype);
+herr_t   HE5_GDwritefield(hid_t gridID, const char *fieldname, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void *data);
+herr_t   HE5_GDreadfield(hid_t gridID, const char *fieldname, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void * buffer);
+herr_t   HE5_GDwriteattr(hid_t gridID, const char *attrname, hid_t ntype, hsize_t  count[], void *datbuf);
+herr_t   HE5_GDwritegrpattr(hid_t gridID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf);
+herr_t   HE5_GDwritelocattr(hid_t gridID, const char *fieldname, const char *attrname, hid_t ntype, hsize_t  count[], void *datbuf);
+herr_t   HE5_GDreadattr(hid_t gridID, const char *attrname, void *datbuf);
+herr_t   HE5_GDreadgrpattr(hid_t gridID, const char *attrname, void *datbuf);
+herr_t   HE5_GDreadlocattr(hid_t gridID, const char *fieldname, const char *attrname, void *datbuf);
+herr_t   HE5_GDblkSOMoffset(hid_t gridID, long offset[], hsize_t count[], char *code);
+
+
+/* Inquiry routines */
+
+long     HE5_GDinqgrid(const char *filename, char *gridlist, long *strbufsize);
+hsize_t  HE5_GDdiminfo(hid_t gridID, char *dimname);
+herr_t   HE5_GDgridinfo(hid_t gridID, long *xdimsize, long *ydimsize, double upleftpt[], double lowrightpt[]);
+herr_t   HE5_GDprojinfo(hid_t gridID, int *projcode, int *zonecode, int *spherecode, double projparm[]);
+herr_t   HE5_GDorigininfo(hid_t gridID, int *origincode);
+herr_t   HE5_GDpixreginfo(hid_t gridID, int *pixregcode);
+herr_t   HE5_GDcompinfo(hid_t gridID, const char *fieldname, int *compcode, int compparm[]);
+herr_t   HE5_GDfieldinfo(hid_t gridID, const char *fieldname, int *rank, hsize_t dims[], hid_t ntype[], char *dimlist, char *maxdimlist);
+herr_t   HE5_GDregioninfo(hid_t gridID, hid_t regionID, const char *fieldname, hid_t *ntype, int *rank, hsize_t dims[], long *size, double upleftpt[], double lowrightpt[]);
+long     HE5_GDnentries(hid_t gridID, int entrycode, long *strbufsize);
+int      HE5_GDinqdims(hid_t gridID, char *dimnames, hsize_t  dims[]);
+herr_t   HE5_GDattrinfo(hid_t gridID, const char *attrname, hid_t *ntype, hsize_t *count);
+herr_t   HE5_GDgrpattrinfo(hid_t gridID, const char *attrname, hid_t *ntype, hsize_t *count);
+herr_t   HE5_GDlocattrinfo(hid_t gridID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count);
+long     HE5_GDinqattrs(hid_t gridID, char *attrnames, long *strbufsize);
+long     HE5_GDinqgrpattrs(hid_t gridID, char *attrnames, long *strbufsize);
+long     HE5_GDinqlocattrs(hid_t gridID, const char *fieldname, char *attrnames, long *strbufsize);
+int      HE5_GDinqfields(hid_t gridID, char *fieldlist, int rank[], hid_t ntype[]);
+herr_t   HE5_GDinqdatatype(hid_t gridID, const char *fieldname, const char *attrname, int fieldgroup, hid_t *dtype, H5T_class_t *classid, H5T_order_t *order, size_t *size);
+herr_t   HE5_GDgetfillvalue(hid_t gridID, const char *fieldname, void *fillval);
+herr_t   HE5_GDtileinfo(hid_t gridID, char *fieldname, int *tilecode, int *tilerank, hsize_t tiledims[]);
+herr_t   HE5_GDaliasinfo(hid_t gridID, int fldgroup, const char *aliasname, int *length, char *buffer);
+long     HE5_GDinqfldalias(hid_t gridID, char *fldalias, long *strbufsize);
+long     HE5_GDgetaliaslist(hid_t gridID, int fldgroup, char *aliaslist, long *strbufsize);
+long     HE5_GDgetdimscale(hid_t gridID, char *fieldname, char *dimname, hsize_t *dimsize, hid_t *numbertype, void * databuff);
+herr_t   HE5_GDwritedscaleattr(hid_t gridID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t  count[],  void *datbuf);
+herr_t   HE5_GDdscaleattrinfo(hid_t gridID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count);
+herr_t   HE5_GDreaddscaleattr(hid_t gridID, const char *fieldname, const char *attrname, void *datbuf);
+long     HE5_GDinqdscaleattrs(hid_t gridID, const char *fieldname, char *attrnames, long *strbufsize);
+
+/* Subsetting/Retrieving routines */
+
+hid_t    HE5_GDdefboxregion(hid_t gridID, double cornerlon[], double cornerlat[]);
+hid_t    HE5_GDdefvrtregion(hid_t gridID, hid_t regionID, char *vertObj, double range[]);
+herr_t   HE5_GDdeftimeperiod(hid_t gridID, hid_t periodID, double starttime, double stoptime);
+herr_t   HE5_GDextractregion(hid_t gridID, hid_t regionID, const char *fieldname, void *buffer);
+hid_t    HE5_GDdupregion(hid_t oldregionID);
+herr_t   HE5_GDgetpixels(hid_t gridID, long nLonLat, double lonVal[], double latVal[], long pixRow[], long pixCol[]);
+long     HE5_GDgetpixvalues(hid_t gridID, long nPixels, long pixRow[], long pixCol[], const char *fieldname, void * buffer);
+long     HE5_GDinterpolate(hid_t gridID, long nValues, double lonVal[], double latVal[], const char *fieldname, double interpVal[]);
+
+
+/* Utility routine */
+
+herr_t   HE5_GDij2ll(int, int, double[], int, long, long, double[], double[], long, long[], long[], double[], double[], int, int);
+herr_t   HE5_GDll2ij(int, int, double[], int, long, long, double[], double[], long, double[], double[], long[], long[], double[], double[]);
+herr_t   HE5_GDrs2ll(int projcode, double projparm[], long xdimsize, long ydimsize, double upleft[], double lowright[], int npnts, double r[], double s[], double longitude[], double latitude[], int pixcen, int pixcnr);
+
+
+/*
+ *******************************
+ *   EXTERNAL DATA FILES       *
+ *******************************
+ */
+
+herr_t  HE5_GDsetextdata(hid_t gridID, const char *filelist, off_t offset[], hsize_t size[]);
+int     HE5_GDgetextdata(hid_t gridID, char *fieldname, size_t namelength, char *filelist, off_t offset[], hsize_t size[]);
+
+
+
+/*
+ **********************************************************************
+ *                    P O I N T    I N T E R F A C E                  *
+ **********************************************************************
+ */
+
+
+/* File/Point access routine */
+
+hid_t    HE5_PTopen(const char *filename, uintn flags);
+hid_t    HE5_PTcreate(hid_t fid, const char *pointname);
+hid_t    HE5_PTattach(hid_t fid, const char *pointname);
+herr_t   HE5_PTdetach(hid_t pointID);
+herr_t   HE5_PTclose(hid_t fid);
+
+
+/* Definition routines */
+
+herr_t   HE5_PTdeflevel(hid_t pointID, const char *levelname, HE5_CmpDTSinfo *levelinfo);
+herr_t   HE5_PTdeflinkage(hid_t pointID, char *parent, char *child, char *linkfield);
+
+
+/* I/O routines */
+
+herr_t   HE5_PTwritelevel(hid_t pointID, int level, hsize_t count[], size_t *size, void *data);
+herr_t   HE5_PTupdatelevel(hid_t pointID, int level, char *fieldlist, hsize_t nrec, hssize_t recs[], void *data);
+herr_t   HE5_PTreadlevel(hid_t pointID, int level, HE5_CmpDTSinfo *inStruct, size_t *size, void *datbuf);
+herr_t   HE5_PTwriteattr(hid_t pointID, const char *attrname, hid_t ntype, hsize_t count[], void * datbuf);
+herr_t   HE5_PTwritegrpattr(hid_t pointID, const char *attrname, hid_t ntype, hsize_t count[], void * datbuf);
+herr_t   HE5_PTwritelocattr(hid_t pointID, const char *levelname, const char *attrname, hid_t ntype, hsize_t count[], void * datbuf);
+herr_t   HE5_PTreadattr(hid_t pointID, const char *attrname, void * datbuf);
+herr_t   HE5_PTreadgrpattr(hid_t pointID, const char *attrname, void * datbuf);
+herr_t   HE5_PTreadlocattr(hid_t pointID, const char *levelname, const char *attrname, void *datbuf);
+
+/* Inquiry routines */
+
+hsize_t  HE5_PTnrecs(hid_t pointID, int level);
+int      HE5_PTnlevels(hid_t pointID);
+int      HE5_PTnfields(hid_t pointID, int level, char *fieldlist, long *strbufsize);
+int      HE5_PTlevelindx(hid_t pointID, const char *levelname);
+herr_t   HE5_PTgetlevelname(hid_t pointID, int level, char *levelname, long *strbufsize);
+herr_t   HE5_PTbcklinkinfo(hid_t pointID, int level, char *linkfield);
+herr_t   HE5_PTfwdlinkinfo(hid_t pointID, int level, char *linkfield);
+herr_t   HE5_PTlevelinfo(hid_t pointID, int level, HE5_CmpDTSinfo *info);
+herr_t   HE5_PTinqdatatype(hid_t pointID, const char *levelname, const char *attrname, int fieldgroup, hid_t *dtype, H5T_class_t *classid, H5T_order_t *order, size_t *size);
+int      HE5_PTinqpoint(const char *filename, char *pointlist, long *strbufsize);
+herr_t   HE5_PTgetrecnums(hid_t pointID, int inlevel, int outlevel, hsize_t inNrec, hssize_t inRecs[], hsize_t * outNrec, hssize_t outRecs[]);
+herr_t   HE5_PTattrinfo(hid_t pointID, const char *attrname, hid_t *ntype, hsize_t *count);
+herr_t   HE5_PTgrpattrinfo(hid_t pointID, const char *attrname, hid_t *ntype, hsize_t *count);
+herr_t   HE5_PTlocattrinfo(hid_t pointID, const char *levelname, const char *attrname, hid_t *ntype, hsize_t *count);
+long     HE5_PTinqattrs(hid_t pointID, char *attrnames, long *strbufsize);
+long     HE5_PTinqgrpattrs(hid_t pointID, char *attrnames, long *strbufsize);
+long     HE5_PTinqlocattrs(hid_t pointID, const char *levelname, char *attrnames, long *strbufsize);
+
+
+/*
+ **********************************************************************
+ *                    Z A    I N T E R F A C E                        *
+ **********************************************************************
+ */
+ 
+ 
+/* File/ZA access routines */
+ 
+hid_t   HE5_ZAopen(const char *filename, uintn flags);
+hid_t   HE5_ZAcreate(hid_t fid, const char *zaname);
+hid_t   HE5_ZAattach(hid_t fid, const char *zaname);
+herr_t  HE5_ZAdetach(hid_t zaID);
+herr_t  HE5_ZAclose(hid_t fid);
+ 
+ 
+/* Definition routines */
+ 
+herr_t  HE5_ZAdefdim(hid_t zaID,  char *dimname, hsize_t dim);
+herr_t  HE5_ZAdefine(hid_t zaID, const char *za_name, char *dimlist, char *maxdimlist, hid_t dtype);
+herr_t  HE5_ZAdefchunk(hid_t zaID, int ndims, const hsize_t *dim);
+herr_t  HE5_ZAdefcomp(hid_t zaID, int compcode, int *compparm);
+herr_t  HE5_ZAdefcomchunk(hid_t zaID, int compcode, int *compparm, int ndims, const hsize_t *dim);
+herr_t  HE5_ZAsetfillvalue(hid_t zaID, char *fieldname, hid_t ntype, void *fillval);
+herr_t  HE5_ZAsetalias(hid_t zaID, char *fieldname, const char *aliaslist);
+herr_t  HE5_ZAdropalias(hid_t zaID, int fldgroup, const char *aliasname);
+herr_t  HE5_ZAfldrename(hid_t zaID, char *oldfieldname, const char *newfieldname);
+herr_t  HE5_ZAsetdimscale(hid_t zaID, char *fieldname, char *dimname, const hsize_t dimsize, hid_t numbertype, void * data);
+long    HE5_ZAgetdimscale(hid_t zaID, char *fieldname, char *dimname, hsize_t *dimsize, hid_t *numbertype, void * databuff);
+herr_t  HE5_ZAdefdimscale(hid_t zaID, char *dimname, const hsize_t dimsize, hid_t numbertype, void * datbuff);
+
+/* I/O routines */
+ 
+herr_t  HE5_ZAwritedatameta(hid_t zaID, const char *fieldname, char *dimlist, hid_t mvalue);
+herr_t  HE5_ZAwriteattr(hid_t zaID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf);
+herr_t  HE5_ZAwritegrpattr(hid_t zaID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf);
+herr_t  HE5_ZAwritelocattr(hid_t zaID, const char *fieldname, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf);
+herr_t  HE5_ZAreadattr(hid_t zaID, const char *attrname, void *datbuf);
+herr_t  HE5_ZAreadgrpattr(hid_t zaID, const char *attrname, void *datbuf);
+herr_t  HE5_ZAreadlocattr(hid_t zaID, const char *fieldname, const char *attrname, void *datbuf);
+herr_t  HE5_ZAwrite(hid_t zaID, char *za_name, const hssize_t start[], const hsize_t stride[], const hsize_t count[],  void *datbuf);
+herr_t  HE5_ZAread(hid_t zaID, char *za_name, const hssize_t start[], const hsize_t stride[], const hsize_t count[],  void *datbuf);
+herr_t HE5_ZAreaddscaleattr(hid_t zaID, const char *fieldname, const char *attrname, void *datbuf);
+herr_t HE5_ZAwritedscaleattr(hid_t zaID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t  count[],  void *datbuf); 
+ 
+/* Inquiry routines */
+ 
+hsize_t HE5_ZAdiminfo(hid_t zaID, char *dimname);
+int     HE5_ZAfldsrch(hid_t zaID, char *fieldname, hid_t *fieldID, int *rank,  hsize_t dims[], hid_t *typeID);
+herr_t  HE5_ZAinfo(hid_t zaID, char *za_name, int *rank, hsize_t dims[], hid_t dtype[], char *dimlist, char *maxdimlist);
+herr_t  HE5_ZAcompinfo(hid_t zaID, char *fieldname, int *compcode, int compparm[]);
+herr_t  HE5_ZAattrinfo(hid_t zaID, const char *attrname, hid_t *ntype, hsize_t *count);
+herr_t  HE5_ZAgrpattrinfo(hid_t zaID, const char *attrname, hid_t *ntype, hsize_t *count);
+herr_t  HE5_ZAlocattrinfo(hid_t zaID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count);
+herr_t  HE5_ZAinqdatatype(hid_t zaID, const char *fieldname, const char *attrname, int group, hid_t *dtype, H5T_class_t *classid, H5T_order_t *order, size_t *size);
+long    HE5_ZAinqdims(hid_t zaID, char *dimnames, hsize_t dims[]);
+long    HE5_ZAinquire(hid_t zaID, char *za_name_list, int rank[], hid_t dtype[]);
+long    HE5_ZAinqattrs(hid_t zaID, char *attrnames, long *strbufsize);
+long    HE5_ZAinqgrpattrs(hid_t zaID, char *attrnames, long *strbufsize);
+long    HE5_ZAinqlocattrs(hid_t zaID, const char *fieldname, char *attrnames, long *strbufsize);
+long    HE5_ZAnentries(hid_t zaID, int entrycode, long *strbufsize);
+long    HE5_ZAinqza(const char *filename, char *zalist, long *strbufsize);
+herr_t  HE5_ZAgetfillvalue(hid_t zaID, char *fieldname, void *fillval);
+herr_t  HE5_ZAaliasinfo(hid_t zaID, int fldgroup, const char *aliasname, int *length, char *buffer);
+long    HE5_ZAinqfldalias(hid_t zaID, char *fldalias, long *strbufsize);
+herr_t  HE5_ZAchunkinfo(hid_t zaID, char *fieldname, int *ndims, hsize_t dims[]);
+long    HE5_ZAgetaliaslist(hid_t zaID, int fldgroup, char *aliaslist, long *strbufsize);
+herr_t HE5_ZAdscaleattrinfo(hid_t zaID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count);
+long HE5_ZAinqdscaleattrs(hid_t zaID, const char *fieldname, char *attrnames, long *strbufsize);
+
+/*
+ *******************************
+ *   EXTERNAL DATA FILES       *
+ *******************************
+ */
+ 
+herr_t  HE5_ZAsetextdata(hid_t zaID, const char *filelist, off_t offset[], hsize_t size[]);
+int     HE5_ZAgetextdata(hid_t zaID, char *fieldname, size_t namelength, char *filelist, off_t offset[], hsize_t size[]);
+ 
+ 
+/*
+ *******************************
+ *  MOUNTING EXTERNAL FILES    *
+ *******************************
+ */
+ 
+hid_t   HE5_ZAmountexternal(hid_t zaID, int fldgroup, const char *extfilename);
+herr_t  HE5_ZAunmount(hid_t zaID, int fldgroup, hid_t fileID);
+herr_t  HE5_ZAreadexternal(hid_t zaID, int fldgroup, const char *fieldname, void *buffer);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* #ifndef HE5_HDFEOSDEF_H_ */
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/include/HE5_config.h.in b/include/HE5_config.h.in
new file mode 100644
index 0000000..49766ad
--- /dev/null
+++ b/include/HE5_config.h.in
@@ -0,0 +1,144 @@
+/* include/HE5_config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define if HDF5 has szip any type of filter */
+#undef H5_HAVE_FILTER_SZIP
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define if support for szip filter is enabled */
+#undef HAVE_FILTER_SZIP
+
+/* Define if support for szip encoder filter is enabled */
+#undef HAVE_FILTER_SZIP_ENCODER
+
+/* Define to 1 if you have the <hdf5.h> header file. */
+#undef HAVE_HDF5_H
+
+/* Define if HDF5 has szip decoder filter */
+#undef HAVE_HDF5_SZIP_DECODER
+
+/* Define if HDF5 has szip encoder filter */
+#undef HAVE_HDF5_SZIP_ENCODER
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `hdf5' library (-lhdf5). */
+#undef HAVE_LIBHDF5
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the `sz' library (-lsz). */
+#undef HAVE_LIBSZ
+
+/* Define to 1 if you have the `z' library (-lz). */
+#undef HAVE_LIBZ
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+   to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
+/* Define to 1 if you have the `memchr' function. */
+#undef HAVE_MEMCHR
+
+/* Define to 1 if you have the `memmove' function. */
+#undef HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the `pow' function. */
+#undef HAVE_POW
+
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+   and to 0 otherwise. */
+#undef HAVE_REALLOC
+
+/* Define to 1 if you have the `sqrt' function. */
+#undef HAVE_SQRT
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strstr' function. */
+#undef HAVE_STRSTR
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <szlib.h> header file. */
+#undef HAVE_SZLIB_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define if threadsafe HDF-EOS is enabled */
+#undef _HDFEOS5_THREADSAFE
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
+
+/* Define to `long' if <sys/types.h> does not define. */
+#undef off_t
+
+/* Define to rpl_realloc if the replacement function should be used. */
+#undef realloc
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100755
index 0000000..3de93db
--- /dev/null
+++ b/include/Makefile.am
@@ -0,0 +1,9 @@
+# gctp/include Makefile.am
+
+# Boilerplate include
+include $(top_srcdir)/config/include.am
+
+# Headers to install
+include_HEADERS = HE5_GctpFunc.h HE5_HdfEosDef.h HE5_config.h cproj.h ease.h \
+                  isin.h proj.h tutils.h cfortHdf.h
+
diff --git a/include/Makefile.in b/include/Makefile.in
new file mode 100644
index 0000000..a572128
--- /dev/null
+++ b/include/Makefile.in
@@ -0,0 +1,442 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+# gctp/include Makefile.am
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(include_HEADERS) $(srcdir)/HE5_config.h.in \
+	$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/config/include.am
+subdir = include
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = HE5_config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(includedir)"
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F2CFORTRAN_32PTR_CONDITIONAL_FALSE = @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@
+F2CFORTRAN_32PTR_CONDITIONAL_TRUE = @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@
+F2CFORTRAN_90_CONDITIONAL_FALSE = @F2CFORTRAN_90_CONDITIONAL_FALSE@
+F2CFORTRAN_90_CONDITIONAL_TRUE = @F2CFORTRAN_90_CONDITIONAL_TRUE@
+F2CFORTRAN_CONDITIONAL_FALSE = @F2CFORTRAN_CONDITIONAL_FALSE@
+F2CFORTRAN_CONDITIONAL_TRUE = @F2CFORTRAN_CONDITIONAL_TRUE@
+F77 = @F77@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_INCLUDE_CONDITIONAL_FALSE = @INSTALL_INCLUDE_CONDITIONAL_FALSE@
+INSTALL_INCLUDE_CONDITIONAL_TRUE = @INSTALL_INCLUDE_CONDITIONAL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SZIP_ENCODER_CONDITIONAL_FALSE = @SZIP_ENCODER_CONDITIONAL_FALSE@
+SZIP_ENCODER_CONDITIONAL_TRUE = @SZIP_ENCODER_CONDITIONAL_TRUE@
+TESTDRIVERS_CONDITIONAL_FALSE = @TESTDRIVERS_CONDITIONAL_FALSE@
+TESTDRIVERS_CONDITIONAL_TRUE = @TESTDRIVERS_CONDITIONAL_TRUE@
+THREADSAFE_CONDITIONAL_FALSE = @THREADSAFE_CONDITIONAL_FALSE@
+THREADSAFE_CONDITIONAL_TRUE = @THREADSAFE_CONDITIONAL_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la
+LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
+
+# Boilerplate include
+
+# Headers to install
+include_HEADERS = HE5_GctpFunc.h HE5_HdfEosDef.h HE5_config.h cproj.h ease.h \
+                  isin.h proj.h tutils.h cfortHdf.h
+
+all: HE5_config.h
+	$(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  include/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  include/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+HE5_config.h: stamp-h1
+	@if test ! -f $@; then \
+	  rm -f stamp-h1; \
+	  $(MAKE) stamp-h1; \
+	else :; fi
+
+stamp-h1: $(srcdir)/HE5_config.h.in $(top_builddir)/config.status
+	@rm -f stamp-h1
+	cd $(top_builddir) && $(SHELL) ./config.status include/HE5_config.h
+$(srcdir)/HE5_config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 
+	cd $(top_srcdir) && $(AUTOHEADER)
+	rm -f stamp-h1
+	touch $@
+
+distclean-hdr:
+	-rm -f HE5_config.h stamp-h1
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+	  $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+	done
+
+uninstall-includeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(includedir)/$$f"; \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES) HE5_config.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS) HE5_config.h.in $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES) HE5_config.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS) HE5_config.h.in $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(mkdir_p) $(distdir)/../config
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS) HE5_config.h
+installdirs:
+	for dir in "$(DESTDIR)$(includedir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-includeHEADERS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool ctags distclean distclean-generic distclean-hdr \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am \
+	install-includeHEADERS install-info install-info-am \
+	install-man install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags uninstall uninstall-am uninstall-includeHEADERS \
+	uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/include/cfortHdf.h b/include/cfortHdf.h
new file mode 100755
index 0000000..d4b7384
--- /dev/null
+++ b/include/cfortHdf.h
@@ -0,0 +1,1800 @@
+/*
+Copyright (C) 1996 Hughes and Applied Research Corporation
+
+Permission to use, modify, and distribute this software and its documentation 
+for any purpose without fee is hereby granted, provided that the above 
+copyright notice appear in all copies and that both that copyright notice and 
+this permission notice appear in supporting documentation.
+*/
+
+
+/* cfortran.h */ /* 2.8 */            /* anonymous ftp: zebra.desy.de */
+/* Burkhard Burow, burow at vxdesy.cern.ch, University of Toronto, 1993. */
+/* Feb 2008 Abe Taaheri extensed "fortran to C calls" to 15 argument funcs */
+
+#ifndef __CFORTRAN_LOADED
+#define __CFORTRAN_LOADED
+
+/* 
+   THIS FILE IS PROPERTY OF BURKHARD BUROW. IF YOU ARE USING THIS FILE YOU
+   SHOULD ALSO HAVE ACCESS TO CFORTRAN.DOC WHICH PROVIDES TERMS FOR USING,
+   MODIFYING, COPYING AND DISTRIBUTING THE CFORTRAN.H PACKAGE.
+*/
+
+/* Before using cfortran.h on CRAY, RS/6000, Apollo >=6.8, gcc -ansi,
+   or any other ANSI C compiler, you must once do:
+prompt> mv cfortran.h cf_temp.h && sed 's/\/\*\*\//\#\#/g' cf_temp.h >cfortran.h
+   i.e. we change the ' / * * / ' kludge to # #. */
+
+/* First prepare for the C compiler. */
+
+#if (defined(vax)&&defined(unix)) || (defined(__vax__)&&defined(__unix__))
+#define VAXUltrix
+#endif
+
+#include <stdio.h>     /* NULL [in all machines stdio.h]                      */
+#include <string.h>    /* strlen, memset, memcpy, memchr.                     */
+#if !( defined(VAXUltrix) || defined(sun) || (defined(apollo)&&!defined(__STDCPP__)) )
+#include <stdlib.h>    /* malloc,free                                         */
+#else
+#include <malloc.h>    
+#ifdef apollo
+#define __CF__APOLLO67 /* __STDCPP__ is in Apollo 6.8 (i.e. ANSI) and onwards */
+#endif
+#endif
+
+#if (!defined(__GNUC__) && (defined(sun)||defined(VAXUltrix)||defined(lynx)))
+#define __CF__KnR     /* Sun, LynxOS and VAX Ultrix cc only supports K&R.     */
+                      /* Manually define __CF__KnR for HP if desired/required.*/
+#endif                /*       i.e. We will generate Kernighan and Ritchie C. */
+/* Note that you may define __CF__KnR before #include cfortran.h, in order to
+generate K&R C instead of the default ANSI C. The differences are mainly in the
+function prototypes and declarations. All machines, except the Apollo, work
+with either style. The Apollo's argument promotion rules require ANSI or use of
+the obsolete std_$call which we have not implemented here. Hence on the Apollo,
+only C calling FORTRAN subroutines will work using K&R style.*/
+
+
+/* Remainder of cfortran.h depends on the Fortran compiler. */
+
+/* VAX/VMS does not let us \-split these long lines. */ 
+#if !(defined(NAGf90Fortran)||defined(f2cFortran)||defined(hpuxFortran)||defined(apolloFortran)||defined(sunFortran)||defined(IBMR2Fortran)||defined(CRAYFortran)||defined(mipsFortran)||defined(DECFortran)||defined(vmsFortran))
+/* If no Fortran compiler is given, we choose one for the machines we know.   */
+#if defined(lynx) || defined(VAXUltrix)
+#define f2cFortran    /* Lynx:      Only support f2c at the moment.
+                         VAXUltrix: f77 behaves like f2c.
+                           Support f2c or f77 with gcc, vcc with f2c. 
+                           f77 with vcc works, missing link magic for f77 I/O.*/
+#endif
+#if defined(__hpux)       /* 921107: Use __hpux instead of __hp9000s300 */
+#define       hpuxFortran /*         Should also allow hp9000s7/800 use.*/
+#endif
+#if       defined(apollo)
+#define           apolloFortran  /* __CF__APOLLO67 defines some behavior. */
+#endif
+#if          defined(sun)
+#define              sunFortran
+#endif
+#if       defined(_IBMR2)
+#define            IBMR2Fortran
+#endif
+#if        defined(_CRAY)
+#define             CRAYFortran  /* _CRAY2         defines some behavior. */
+#endif
+#if         defined(mips) || defined(__mips)
+#define             mipsFortran
+#endif
+#if          defined(vms) || defined(__vms)
+#define              vmsFortran
+#endif
+#if      defined(__alpha) && defined(__unix__)
+#define              DECFortran
+#endif
+#endif /* ...Fortran */
+
+
+
+#if defined(VAXC) && !defined(__VAXC)
+#define OLD_VAXC
+#pragma nostandard                       /* Prevent %CC-I-PARAMNOTUSED.       */
+#endif
+
+/* Throughout cfortran.h we use: UN = Uppercase Name.  LN = Lowercase Name.  */
+
+#if defined(f2cFortran) || defined(NAGf90Fortran) || defined(DECFortran) || defined(mipsFortran) || defined(apolloFortran) || defined(sunFortran) || defined(extname)
+#if defined(f2cFortran)
+#define CFC_(UN,LN)            LN##_  /* Lowercase FORTRAN symbols.        */
+#else
+#define CFC_(UN,LN)            LN##_   /* Lowercase FORTRAN symbols.        */
+#endif   /* f2cFortran */
+#define orig_fcallsc           CFC_
+#else 
+#ifdef CRAYFortran
+#define CFC_(UN,LN)            UN        /* Uppercase FORTRAN symbols.        */
+#define orig_fcallsc(UN,LN)    CFC_(UN,LN)  /* CRAY insists on arg.'s here.   */
+#else  /* For following machines one may wish to change the fcallsc default.  */
+#define CF_SAME_NAMESPACE
+#ifdef vmsFortran
+#define CFC_(UN,LN)            LN        /* Either case FORTRAN symbols.      */
+     /* BUT we usually use UN for C macro to FORTRAN routines, so use LN here,*/
+     /* because VAX/VMS doesn't do recursive macros.                          */
+#define orig_fcallsc(UN,LN)    UN      
+#else      /* HP-UX without +ppu or IBMR2 without -qextname. NOT reccomended. */
+#define CFC_(UN,LN)            LN        /* Lowercase FORTRAN symbols.        */
+#define orig_fcallsc           CFC_
+#endif /*  vmsFortran */
+#endif /* CRAYFortran */
+#endif /* ....Fortran */
+
+#define fcallsc                      orig_fcallsc
+#define preface_fcallsc(P,p,UN,LN)   CFC_(P##UN,p##LN)
+#define  append_fcallsc(P,p,UN,LN)   CFC_(UN##P,LN##p)
+
+#define C_FUNCTION                   fcallsc      
+#define FORTRAN_FUNCTION             CFC_
+#define COMMON_BLOCK                 CFC_
+
+#if defined(NAGf90Fortran) || defined(f2cFortran) || defined(mipsFortran)
+#define LOGICAL_STRICT      /* These have .eqv./.neqv. == .eq./.ne.   */
+#endif
+
+#ifdef CRAYFortran
+#if _CRAY
+#include <fortran.h>
+#else
+#include "fortran.h"  /* i.e. if crosscompiling assume user has file. */
+#endif
+#define DOUBLE_PRECISION long double
+#define PPFLOATVVVVVVV (float *)   /* Used for C calls FORTRAN.               */
+/* CRAY's double==float but CRAY says pointers to doubles and floats are diff.*/
+#define VOIDP0  (void *)  /* When FORTRAN calls C, we don't know if C routine 
+                            arg.'s have been declared float *, or double *.   */
+#else
+#define DOUBLE_PRECISION double
+#define PPFLOATVVVVVVV
+#define VOIDP0
+#endif
+
+#ifdef vmsFortran
+#if    defined(vms) || defined(__vms)
+#include <descrip.h>
+#else
+#include "descrip.h"  /* i.e. if crosscompiling assume user has file. */
+#endif
+#endif
+
+#ifdef sunFortran
+#if    sun
+#include <math.h>     /* Sun's FLOATFUNCTIONTYPE, ASSIGNFLOAT, RETURNFLOAT.  */
+#else
+#include "math.h"     /* i.e. if crosscompiling assume user has file. */
+#endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef apolloFortran
+#define COMMON_BLOCK_DEF(DEFINITION, NAME) extern DEFINITION NAME
+#define CF_NULL_PROTO
+#else                                         /* HP doesn't understand #elif. */
+/* Without ANSI prototyping, Apollo promotes float functions to double.    */
+/* Note that VAX/VMS, IBM, Mips choke on 'type function(...);' prototypes. */
+#define CF_NULL_PROTO ...
+#ifndef __CF__APOLLO67
+#define COMMON_BLOCK_DEF(DEFINITION, NAME) \
+ DEFINITION NAME __attribute((__section(NAME)))
+#else
+#define COMMON_BLOCK_DEF(DEFINITION, NAME) \
+ DEFINITION NAME #attribute[section(NAME)]
+#endif
+#endif
+
+#ifdef mipsFortran
+#define CF_DECLARE_GETARG         int f77argc; char **f77argv
+#define CF_SET_GETARG(ARGC,ARGV)  f77argc = ARGC; f77argv = ARGV
+#else
+#define CF_DECLARE_GETARG
+#define CF_SET_GETARG(ARGC,ARGV)
+#endif
+
+#ifdef OLD_VAXC                          /* Allow %CC-I-PARAMNOTUSED.         */
+#pragma standard                         
+#endif
+
+#define ACOMMA ,
+#define ACOLON ;
+
+/*-------------------------------------------------------------------------*/
+
+/*               UTILITIES USED WITHIN CFORTRAN.H                          */
+
+#define PGSMIN(A,B) (A<B?A:B)
+#define firstindexlength( A) (sizeof(A)     /sizeof(A[0]))
+#define secondindexlength(A) (sizeof((A)[0])/sizeof((A)[0][0]))
+#ifndef FALSE
+#define FALSE (1==0)
+#endif
+
+/* Behavior of FORTRAN LOGICAL. All machines' LOGICAL is same size as C's int.
+Conversion is automatic except for arrays which require F2CLOGICALV/C2FLOGICALV.
+f2c, MIPS f77 [DECstation, SGI], VAX Ultrix f77, CRAY-2, HP-UX f77:  as in C.
+VAX/VMS FORTRAN, VAX Ultrix fort, IBM RS/6000 xlf: LS Bit = 0/1 = TRUE/FALSE.
+Apollo, non CRAY-2                               : neg.   = TRUE, else FALSE. 
+[Apollo accepts -1 as TRUE for function values, but NOT all other neg. values.]
+[DECFortran for Ultrix RISC is also called f77 but is the same as VAX/VMS.]   
+[MIPS f77 treats .eqv./.neqv. as .eq./.ne. and hence requires LOGICAL_STRICT.]*/
+
+#define C2FLOGICALV(A,I) \
+ do {int __i; for(__i=0;__i<I;__i++) A[__i]=C2FLOGICAL(A[__i]); } while (FALSE)
+#define F2CLOGICALV(A,I) \
+ do {int __i; for(__i=0;__i<I;__i++) A[__i]=F2CLOGICAL(A[__i]); } while (FALSE)
+
+#if defined(apolloFortran) || (defined(CRAYFortran) && !defined(_CRAY2))
+#ifndef apolloFortran
+#define C2FLOGICAL(L) ((L)?(L)|(1<<sizeof(int)*8-1):(L)&~(1<<sizeof(int)*8-1))
+#else
+#define C2FLOGICAL(L) ((L)?-1:(L)&~(1<<sizeof(int)*8-1)) /* Apollo Exception  */
+#endif
+#define F2CLOGICAL(L) ((L)<0?(L):0) 
+#else
+#if defined(IBMR2Fortran) || defined(vmsFortran) || defined(DECFortran)
+#define C2FLOGICAL(L) ((L)?(L)|1:(L)&~(int)1)
+#define F2CLOGICAL(L) ((L)&1?(L):0)
+#else /* all other machines evaluate LOGICALs as C does. */
+#define C2FLOGICAL(L) (L)
+#define F2CLOGICAL(L) (L)
+#ifndef LOGICAL_STRICT
+#undef  C2FLOGICALV
+#undef  F2CLOGICALV
+#define C2FLOGICALV(A,I)
+#define F2CLOGICALV(A,I)
+#endif  /* LOGICAL_STRICT */
+#endif
+#endif
+
+#ifdef LOGICAL_STRICT
+/* Force C2FLOGICAL to generate only the values for either .TRUE. or .FALSE.
+   This is only needed if you want to do:
+     logical lvariable
+     if (lvariable .eq.  .true.) then       ! (1)
+   instead of
+     if (lvariable .eqv. .true.) then       ! (2)
+   - (1) may not even be FORTRAN/77 and that Apollo's f77 and IBM's xlf
+   refuse to compile (1), so you are probably well advised to stay away from 
+   (1) and from LOGICAL_STRICT.
+   - You pay a (slight) performance penalty for using LOGICAL_STRICT. */
+#undef C2FLOGICAL
+#if defined(apolloFortran) || (defined(CRAYFortran) && !defined(_CRAY2)) || defined(vmsFortran) || defined(DECFortran)
+#define C2FLOGICAL(L) ((L)?-1:0) /* These machines use -1/0 for .true./.false.*/
+#else
+#define C2FLOGICAL(L) ((L)? 1:0) /* All others     use +1/0 for .true./.false.*/
+#endif
+#endif /* LOGICAL_STRICT */
+
+/* Convert a vector of C strings into FORTRAN strings. */
+#ifndef __CF__KnR
+static char *c2fstrv(char* cstr, char *fstr, int elem_len, int sizeofcstr)
+#else
+static char *c2fstrv(      cstr,       fstr,     elem_len,     sizeofcstr)
+                     char* cstr; char *fstr; int elem_len; int sizeofcstr;
+#endif
+{ int i,j;
+/* elem_len includes \0 for C strings. Fortran strings don't have term. \0.
+   Useful size of string must be the same in both languages. */
+for (i=0; i<sizeofcstr/elem_len; i++) {
+  for (j=1; j<elem_len && *cstr; j++) *fstr++ = *cstr++;
+  cstr += 1+elem_len-j;
+  for (; j<elem_len; j++) *fstr++ = ' ';
+} return fstr-sizeofcstr+sizeofcstr/elem_len; }
+
+/* Convert a vector of FORTRAN strings into C strings. */
+#ifndef __CF__KnR
+static char *f2cstrv(char *fstr, char* cstr, int elem_len, int sizeofcstr)
+#else
+static char *f2cstrv(      fstr,       cstr,     elem_len,     sizeofcstr)
+                     char *fstr; char* cstr; int elem_len; int sizeofcstr; 
+#endif
+{ int i,j;
+/* elem_len includes \0 for C strings. Fortran strings don't have term. \0.
+   Useful size of string must be the same in both languages. */
+cstr += sizeofcstr;
+fstr += sizeofcstr - sizeofcstr/elem_len;
+for (i=0; i<sizeofcstr/elem_len; i++) {
+  *--cstr = '\0';
+  for (j=1; j<elem_len; j++) *--cstr = *--fstr;
+} return cstr; }
+
+/* kill the trailing char t's in string s. */
+#ifndef __CF__KnR
+static char *kill_trailing(char *s, char t)
+#else
+static char *kill_trailing(      s,      t) char *s; char t;
+#endif
+{char *e; 
+e = s + strlen(s);
+if (e>s) {                           /* Need this to handle NULL string.*/
+  while (e>s && *--e==t);            /* Don't follow t's past beginning. */
+  e[*e==t?0:1] = '\0';               /* Handle s[0]=t correctly.       */
+} return s; }
+
+/* kill_trailingn(s,t,e) will kill the trailing t's in string s. e normally 
+points to the terminating '\0' of s, but may actually point to anywhere in s.
+s's new '\0' will be placed at e or earlier in order to remove any trailing t's.
+If e<s string s is left unchanged. */ 
+#ifndef __CF__KnR
+static char *kill_trailingn(char *s, char t, char *e)
+#else
+static char *kill_trailingn(      s,      t,       e) char *s; char t; char *e;
+#endif
+{ 
+if (e==s) *e = '\0';                 /* Kill the string makes sense here.*/
+else if (e>s) {                      /* Watch out for neg. length string.*/
+  while (e>s && *--e==t);            /* Don't follow t's past beginning. */
+  e[*e==t?0:1] = '\0';               /* Handle s[0]=t correctly.       */
+} return s; }
+
+/* Note the following assumes that any element which has t's to be chopped off,
+does indeed fill the entire element. */
+#ifndef __CF__KnR
+static char *vkill_trailing(char* cstr, int elem_len, int sizeofcstr, char t)
+#else
+static char *vkill_trailing(      cstr,     elem_len,     sizeofcstr,      t)
+                            char* cstr; int elem_len; int sizeofcstr; char t;
+#endif
+{ int i;
+for (i=0; i<sizeofcstr/elem_len; i++) /* elem_len includes \0 for C strings. */
+  kill_trailingn(cstr+elem_len*i,t,cstr+elem_len*(i+1)-1);
+return cstr; }
+
+#ifdef vmsFortran
+typedef struct dsc$descriptor_s fstring;
+#define DSC$DESCRIPTOR_A(DIMCT)  		                               \
+struct {                                                                       \
+  unsigned short dsc$w_length;	        unsigned char	 dsc$b_dtype;	       \
+  unsigned char	 dsc$b_class;	                 char	*dsc$a_pointer;	       \
+           char	 dsc$b_scale;	        unsigned char	 dsc$b_digits;         \
+  struct {                                                                     \
+    unsigned		       : 3;	  unsigned dsc$v_fl_binscale : 1;      \
+    unsigned dsc$v_fl_redim    : 1;       unsigned dsc$v_fl_column   : 1;      \
+    unsigned dsc$v_fl_coeff    : 1;       unsigned dsc$v_fl_bounds   : 1;      \
+  } dsc$b_aflags;	                                                       \
+  unsigned char	 dsc$b_dimct;	        unsigned long	 dsc$l_arsize;	       \
+           char	*dsc$a_a0;	                 long	 dsc$l_m [DIMCT];      \
+  struct {                                                                     \
+    long dsc$l_l;                         long dsc$l_u;                        \
+  } dsc$bounds [DIMCT];                                                        \
+}
+typedef DSC$DESCRIPTOR_A(1) fstringvector;
+/*typedef DSC$DESCRIPTOR_A(2) fstringarrarr;
+  typedef DSC$DESCRIPTOR_A(3) fstringarrarrarr;*/
+#define initfstr(F,C,ELEMNO,ELEMLEN)                                           \
+( (F).dsc$l_arsize=  ( (F).dsc$w_length                        =(ELEMLEN) )    \
+                    *( (F).dsc$l_m[0]=(F).dsc$bounds[0].dsc$l_u=(ELEMNO)  ),   \
+  (F).dsc$a_a0    =  ( (F).dsc$a_pointer=(C) ) - (F).dsc$w_length          ,(F))
+
+#else
+#define _NUM_ELEMS      -1
+#define _NUM_ELEM_ARG   -2
+#define NUM_ELEMS(A)    A,_NUM_ELEMS
+#define NUM_ELEM_ARG(B) *A##B,_NUM_ELEM_ARG
+#define TERM_CHARS(A,B) A,B
+#ifndef __CF__KnR
+static int num_elem(char *strv, unsigned elem_len, int term_char, int num_term)
+#else
+static int num_elem(      strv,          elem_len,     term_char,     num_term)
+                    char *strv; unsigned elem_len; int term_char; int num_term;
+#endif
+/* elem_len is the number of characters in each element of strv, the FORTRAN
+vector of strings. The last element of the vector must begin with at least
+num_term term_char characters, so that this routine can determine how 
+many elements are in the vector. */
+{
+unsigned num,i;
+if (num_term == _NUM_ELEMS || num_term == _NUM_ELEM_ARG) 
+  return term_char;
+if (num_term <=0) num_term = elem_len;
+for (num=0; ; num++) {
+  for (i=0; (int) i<num_term && *strv==(char) term_char; i++,strv++);
+  if ((int) i==num_term) break;
+  else strv += elem_len-i;
+}
+return num;
+}
+#endif
+/*-------------------------------------------------------------------------*/
+
+/*           UTILITIES FOR C TO USE STRINGS IN FORTRAN COMMON BLOCKS       */
+
+/* C string TO Fortran Common Block STRing. */
+/* DIM is the number of DIMensions of the array in terms of strings, not
+   characters. e.g. char a[12] has DIM = 0, char a[12][4] has DIM = 1, etc. */
+#define C2FCBSTR(CSTR,FSTR,DIM)                                                \
+ c2fstrv((char *)CSTR, (char *)FSTR, sizeof(FSTR)/cfelementsof(FSTR,DIM)+1,    \
+         sizeof(FSTR)+cfelementsof(FSTR,DIM))
+
+/* Fortran Common Block string TO C STRing. */
+#define FCB2CSTR(FSTR,CSTR,DIM)                                                \
+ vkill_trailing(f2cstrv((char *)FSTR, (char *)CSTR,                            \
+                        sizeof(FSTR)/cfelementsof(FSTR,DIM)+1,                 \
+                        sizeof(FSTR)+cfelementsof(FSTR,DIM)),                  \
+                sizeof(FSTR)/cfelementsof(FSTR,DIM)+1,                         \
+                sizeof(FSTR)+cfelementsof(FSTR,DIM), ' ')
+
+#define cfDEREFERENCE0
+#define cfDEREFERENCE1 *
+#define cfDEREFERENCE2 **
+#define cfDEREFERENCE3 ***
+#define cfDEREFERENCE4 ****
+#define cfDEREFERENCE5 *****
+#define cfelementsof(A,D) (sizeof(A)/sizeof(cfDEREFERENCE##D(A)))
+
+/*-------------------------------------------------------------------------*/
+
+/*               UTILITIES FOR C TO CALL FORTRAN SUBROUTINES               */
+
+/* Define lookup tables for how to handle the various types of variables.  */
+
+#ifdef OLD_VAXC                                /* Prevent %CC-I-PARAMNOTUSED. */
+#pragma nostandard
+#endif
+
+static int __cfztringv[30];       /* => 30 == MAX # of arg.'s C can pass to a */
+#define ZTRINGV_NUM(I) I          /*          FORTRAN function.               */
+#define ZTRINGV_ARGF(I) __cfztringv[I]
+#define ZTRINGV_ARGS(I) B##I
+
+#define VPPBYTE         VPPINT
+#define VPPDOUBLE       VPPINT
+#define VPPFLOAT        VPPINT
+#define VPPINT(    A,B) int  B = (int)A;   /* For ZSTRINGV_ARGS */
+#define VPPLOGICAL(A,B) int *B;         /* Returning LOGICAL in FUNn and SUBn.*/
+#define VPPLONG         VPPINT
+#define VPPSHORT        VPPINT
+
+#define VCF(TN,I)       _INT(3,V,TN,A##I,B##I)
+#define VVCF(TN,AI,BI)  _INT(3,V,TN,AI,BI)
+#define VINT(       T,A,B) typeP##T##VVVVVVV B = A;
+#define VINTV(      T,A,B)
+#define VINTVV(     T,A,B)
+#define VINTVVV(    T,A,B)
+#define VINTVVVV(   T,A,B)
+#define VINTVVVVV(  T,A,B)
+#define VINTVVVVVV( T,A,B)
+#define VINTVVVVVVV(T,A,B)
+#define VPINT(      T,A,B) VP##T(A,B)
+#define VPVOID(     T,A,B)
+#ifdef apolloFortran
+#define VROUTINE(   T,A,B) void (*B)() = (void (*)())A;
+#else
+#define VROUTINE(   T,A,B)
+#endif
+#define VSIMPLE(    T,A,B)
+#ifdef vmsFortran
+#define VSTRING(    T,A,B) static struct {fstring f; unsigned clen;} B =       \
+                                       {{0,DSC$K_DTYPE_T,DSC$K_CLASS_S,NULL},0};
+#define VPSTRING(   T,A,B) static fstring B={0,DSC$K_DTYPE_T,DSC$K_CLASS_S,NULL};
+#define VSTRINGV(   T,A,B) static fstringvector B =                            \
+  {sizeof(A),DSC$K_DTYPE_T,DSC$K_CLASS_A,NULL,0,0,{0,0,1,1,1},1,0,NULL,0,{1,0}};
+#define VPSTRINGV(  T,A,B) static fstringvector B =                            \
+          {0,DSC$K_DTYPE_T,DSC$K_CLASS_A,NULL,0,0,{0,0,1,1,1},1,0,NULL,0,{1,0}};
+#else
+#define VSTRING(    T,A,B) struct {unsigned short clen, flen;} B;
+#define VSTRINGV(   T,A,B) struct {char *s, *fs; unsigned flen;} B;
+#define VPSTRING(   T,A,B) int     B;
+#define VPSTRINGV(  T,A,B) struct {char *fs; unsigned short sizeofA, flen;} B;
+#endif
+#define VZTRINGV         VSTRINGV
+#define VPZTRINGV        VPSTRINGV
+
+/* Note that the actions of the A table were performed inside the AA table.
+   VAX Ultrix vcc, and HP-UX cc, didn't evaluate arguments to functions left to
+   right, so we had to split the original table into the current robust two. */
+#define ACF(NAME,TN,AI,I)  STR_##TN(4,A,NAME,I,AI,B##I)
+#define ALOGICAL( M,I,A,B) B=C2FLOGICAL(B);
+#define APLOGICAL(M,I,A,B) A=C2FLOGICAL(A);
+#define ASTRING(  M,I,A,B) CSTRING(A,B,sizeof(A))
+#define APSTRING( M,I,A,B) CPSTRING(A,B,sizeof(A))
+#ifdef vmsFortran
+#define AATRINGV( M,I,A,B, sA,filA,silA)                                       \
+ initfstr(B,malloc((sA)-(filA)),(filA),(silA)-1),                              \
+          c2fstrv(A[0],B.dsc$a_pointer,(silA),(sA));
+#define APATRINGV(M,I,A,B, sA,filA,silA)                                       \
+ initfstr(B,A[0],(filA),(silA)-1),c2fstrv(A[0],A[0],(silA),(sA));
+#else
+#define AATRINGV( M,I,A,B, sA,filA,silA)                                       \
+ (B.s=malloc((sA)-(filA)),B.fs=c2fstrv(A[0],B.s,(B.flen=(silA)-1)+1,(sA)));
+#define APATRINGV(M,I,A,B, sA,filA,silA)                                       \
+ B.fs=c2fstrv(A[0],A[0],(B.flen=(silA)-1)+1,B.sizeofA=(sA));
+#endif
+#define ASTRINGV( M,I,A,B)                                                     \
+  AATRINGV( M,I,A,B,sizeof(A),firstindexlength(A),secondindexlength(A)) 
+#define APSTRINGV(M,I,A,B)                                                     \
+ APATRINGV( M,I,A,B,sizeof(A),firstindexlength(A),secondindexlength(A)) 
+#define AZTRINGV( M,I,A,B) AATRINGV( M,I,A,B,                                  \
+                    (M##_ELEMS_##I)*(( M##_ELEMLEN_##I)+1),            \
+                              (M##_ELEMS_##I),(M##_ELEMLEN_##I)+1) 
+#define APZTRINGV(M,I,A,B) APATRINGV( M,I,A,B,                                 \
+                    (M##_ELEMS_##I)*(( M##_ELEMLEN_##I)+1),            \
+                              (M##_ELEMS_##I),(M##_ELEMLEN_##I)+1) 
+
+#define AAPPBYTE(   A,B) &A
+#define AAPPDOUBLE( A,B) &A
+#define AAPPFLOAT(  A,B) PPFLOATVVVVVVV &A
+#define AAPPINT(    A,B) &A
+#define AAPPLOGICAL(A,B) B= &A         /* B used to keep a common W table. */
+#define AAPPLONG(   A,B) &A
+#define AAPPSHORT(  A,B) &A
+
+#define AACF(TN,AI,I,C) _SEP_(TN,C,COMMA) _INT(3,AA,TN,AI,B##I)
+#define AAINT(       T,A,B) &B
+#define AAINTV(      T,A,B) PP##T##VVVVVV A
+#define AAINTVV(     T,A,B) PP##T##VVVVV  A[0]
+#define AAINTVVV(    T,A,B) PP##T##VVVV   A[0][0]
+#define AAINTVVVV(   T,A,B) PP##T##VVV    A[0][0][0]
+#define AAINTVVVVV(  T,A,B) PP##T##VV     A[0][0][0][0]
+#define AAINTVVVVVV( T,A,B) PP##T##V      A[0][0][0][0][0]
+#define AAINTVVVVVVV(T,A,B) PP##T           A[0][0][0][0][0][0]
+#define AAPINT(      T,A,B) AAP##T(A,B)
+#define AAPVOID(     T,A,B) (void *) A
+#ifdef apolloFortran
+#define AAROUTINE(   T,A,B) &B
+#else
+#define AAROUTINE(   T,A,B)  (void(*)())A
+#endif
+#define AASTRING(    T,A,B) CCSTRING(T,A,B)
+#define AAPSTRING(   T,A,B) CCPSTRING(T,A,B)
+#ifdef vmsFortran
+#define AASTRINGV(   T,A,B) &B
+#else
+#ifdef CRAYFortran
+#define AASTRINGV(   T,A,B) _cptofcd(B.fs,B.flen)
+#else
+#define AASTRINGV(   T,A,B) B.fs
+#endif
+#endif
+#define AAPSTRINGV      AASTRINGV
+#define AAZTRINGV       AASTRINGV
+#define AAPZTRINGV      AASTRINGV
+
+#if defined(vmsFortran) || defined(CRAYFortran)
+#define JCF(TN,I)
+#else
+#define JCF(TN,I)    STR_##TN(1,J,B##I, 0,0,0)
+#define JLOGICAL( B)
+#define JPLOGICAL(B)
+#define JSTRING(  B) ,B.flen
+#define JPSTRING( B) ,B
+#define JSTRINGV     JSTRING
+#define JPSTRINGV    JSTRING
+#define JZTRINGV     JSTRING
+#define JPZTRINGV    JSTRING
+#endif
+
+#define WCF(TN,AN,I)   STR_##TN(2,W,AN,B##I, 0,0)
+#define WLOGICAL( A,B)
+#define WPLOGICAL(A,B) *B=F2CLOGICAL(*B);
+#define WSTRING(  A,B) (A[B.clen]!='\0'?A[B.clen]='\0':0); /* A?="constnt"*/
+#define WPSTRING( A,B) kill_trailing(A,' ');
+#ifdef vmsFortran
+#define WSTRINGV( A,B) free(B.dsc$a_pointer);
+#define WPSTRINGV(A,B)                                                         \
+  vkill_trailing(f2cstrv((char*)A, (char*)A,                                   \
+                           B.dsc$w_length+1, B.dsc$l_arsize+B.dsc$l_m[0]),     \
+                   B.dsc$w_length+1, B.dsc$l_arsize+B.dsc$l_m[0], ' ');
+#else
+#define WSTRINGV( A,B) free(B.s);
+#define WPSTRINGV(A,B) vkill_trailing(                                         \
+         f2cstrv((char*)A,(char*)A,B.flen+1,B.sizeofA), B.flen+1,B.sizeofA,' ');
+#endif
+#define WZTRINGV           WSTRINGV
+#define WPZTRINGV          WPSTRINGV
+
+#define   NCF(TN,I,C)  _SEP_(TN,C,COMMA) _INT(2,N,TN,A##I,0) 
+#define  NNCF          UUCF
+#define NNNCF(TN,I,C)  _SEP_(TN,C,COLON) _INT(2,N,TN,A##I,0) 
+#define NINT(       T,A) typeP##T##VVVVVVV * A
+#define NINTV(      T,A) typeP##T##VVVVVV  * A
+#define NINTVV(     T,A) typeP##T##VVVVV   * A
+#define NINTVVV(    T,A) typeP##T##VVVV    * A
+#define NINTVVVV(   T,A) typeP##T##VVV     * A
+#define NINTVVVVV(  T,A) typeP##T##VV      * A
+#define NINTVVVVVV( T,A) typeP##T##V       * A
+#define NINTVVVVVVV(T,A) typeP##T            * A
+#define NPINT(      T,A)  type##T##VVVVVVV * A
+#define NPVOID(     T,A) void *                  A
+#ifdef apolloFortran
+#define NROUTINE(   T,A) void (**A)()
+#else
+#define NROUTINE(   T,A) void ( *A)()
+#endif
+#ifdef vmsFortran
+#define NSTRING(    T,A) fstring *          A
+#define NSTRINGV(   T,A) fstringvector *    A
+#else
+#ifdef CRAYFortran
+#define NSTRING(    T,A) _fcd               A
+#define NSTRINGV(   T,A) _fcd               A
+#else
+#define NSTRING(    T,A) char *             A
+#define NSTRINGV(   T,A) char *             A
+#endif
+#endif
+#define NPSTRING(   T,A) NSTRING(T,A)   /* CRAY insists on arg.'s here. */
+#define NPNSTRING(  T,A) NSTRING(T,A)   /* CRAY insists on arg.'s here. */
+#define NPPSTRING(  T,A) NSTRING(T,A)   /* CRAY insists on arg.'s here. */
+#define NSTRVOID(    T,A) NSTRING(T,A)   /* CRAY insists on arg.'s here. */
+#define NPSTRINGV(  T,A) NSTRINGV(T,A)
+#define NZTRINGV(   T,A) NSTRINGV(T,A)
+#define NPZTRINGV(  T,A) NPSTRINGV(T,A)
+
+/* Note: Prevent compiler warnings, null #define PROTOCCALLSFSUB14/20 after 
+   #include-ing cfortran.h if calling the FORTRAN wrapper within the same 
+   source code where the wrapper is created. */
+#ifndef __CF__KnR
+#define PROTOCCALLSFSUB0(UN,LN)          extern void CFC_(UN,LN)();
+#define PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE)     \
+ extern void CFC_(UN,LN)(NCF(T1,1,0) NCF(T2,2,1) NCF(T3,3,1) NCF(T4,4,1)       \
+ NCF(T5,5,1) NCF(T6,6,1) NCF(T7,7,1) NCF(T8,8,1) NCF(T9,9,1) NCF(TA,A,1)       \
+ NCF(TB,B,1) NCF(TC,C,1) NCF(TD,D,1) NCF(TE,E,1) ,...);
+#define PROTOCCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK)\
+ extern void CFC_(UN,LN)(NCF(T1,1,0) NCF(T2,2,1) NCF(T3,3,1) NCF(T4,4,1)       \
+ NCF(T5,5,1) NCF(T6,6,1) NCF(T7,7,1) NCF(T8,8,1) NCF(T9,9,1) NCF(TA,A,1)       \
+ NCF(TB,B,1) NCF(TC,C,1) NCF(TD,D,1) NCF(TE,E,1) NCF(TF,F,1) NCF(TG,G,1)       \
+ NCF(TH,H,1) NCF(TI,I,1) NCF(TJ,J,1) NCF(TK,K,1) ,...);
+#else
+#define PROTOCCALLSFSUB0( UN,LN)
+#define PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE)
+#define PROTOCCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK)
+#endif
+
+#ifdef OLD_VAXC                                  /* Allow %CC-I-PARAMNOTUSED. */
+#pragma standard
+#endif
+
+/* do{...}while(FALSE) allows if(a==b) FORT(); else BORT(); */
+
+#define CCALLSFSUB0(UN,LN) \
+ do{PROTOCCALLSFSUB0(UN,LN) CFC_(UN,LN)();}while(FALSE)
+
+#define CCALLSFSUB1( UN,LN,T1,                        A1)         \
+        CCALLSFSUB5 (UN,LN,T1,CF_0,CF_0,CF_0,CF_0,A1,0,0,0,0)
+#define CCALLSFSUB2( UN,LN,T1,T2,                     A1,A2)      \
+        CCALLSFSUB5 (UN,LN,T1,T2,CF_0,CF_0,CF_0,A1,A2,0,0,0)
+#define CCALLSFSUB3( UN,LN,T1,T2,T3,                  A1,A2,A3)   \
+        CCALLSFSUB5 (UN,LN,T1,T2,T3,CF_0,CF_0,A1,A2,A3,0,0)
+#define CCALLSFSUB4( UN,LN,T1,T2,T3,T4,               A1,A2,A3,A4)\
+        CCALLSFSUB5 (UN,LN,T1,T2,T3,T4,CF_0,A1,A2,A3,A4,0)
+#define CCALLSFSUB5( UN,LN,T1,T2,T3,T4,T5,            A1,A2,A3,A4,A5)          \
+        CCALLSFSUB10(UN,LN,T1,T2,T3,T4,T5,CF_0,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,0,0,0,0,0)
+#define CCALLSFSUB6( UN,LN,T1,T2,T3,T4,T5,T6,         A1,A2,A3,A4,A5,A6)       \
+        CCALLSFSUB10(UN,LN,T1,T2,T3,T4,T5,T6,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,0,0,0,0)
+#define CCALLSFSUB7( UN,LN,T1,T2,T3,T4,T5,T6,T7,      A1,A2,A3,A4,A5,A6,A7)    \
+        CCALLSFSUB10(UN,LN,T1,T2,T3,T4,T5,T6,T7,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,0,0,0)
+#define CCALLSFSUB8( UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,   A1,A2,A3,A4,A5,A6,A7,A8) \
+        CCALLSFSUB10(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,0,0)
+#define CCALLSFSUB9( UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,A1,A2,A3,A4,A5,A6,A7,A8,A9)\
+        CCALLSFSUB10(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,0)
+#define CCALLSFSUB10(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA)\
+        CCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,0,0,0,0)
+#define CCALLSFSUB11(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB)\
+        CCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,0,0,0)
+#define CCALLSFSUB12(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC)\
+        CCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,0,0)
+#define CCALLSFSUB13(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD)\
+        CCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,0)
+
+#define CCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE)\
+do{VVCF(T1,A1,B1) VVCF(T2,A2,B2) VVCF(T3,A3,B3) VVCF(T4,A4,B4) VVCF(T5,A5,B5)  \
+   VVCF(T6,A6,B6) VVCF(T7,A7,B7) VVCF(T8,A8,B8) VVCF(T9,A9,B9) VVCF(TA,AA,BA)  \
+   VVCF(TB,AB,BB) VVCF(TC,AC,BC) VVCF(TD,AD,BD) VVCF(TE,AE,BE)                 \
+   PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE)          \
+   ACF(LN,T1,A1,1) ACF(LN,T2,A2,2) ACF(LN,T3,A3,3)                             \
+   ACF(LN,T4,A4,4) ACF(LN,T5,A5,5) ACF(LN,T6,A6,6) ACF(LN,T7,A7,7)             \
+   ACF(LN,T8,A8,8) ACF(LN,T9,A9,9) ACF(LN,TA,AA,A) ACF(LN,TB,AB,B)             \
+   ACF(LN,TC,AC,C) ACF(LN,TD,AD,D) ACF(LN,TE,AE,E)                             \
+   CFC_(UN,LN)(AACF(T1,A1,1,0) AACF(T2,A2,2,1) AACF(T3,A3,3,1)                 \
+               AACF(T4,A4,4,1) AACF(T5,A5,5,1) AACF(T6,A6,6,1) AACF(T7,A7,7,1) \
+               AACF(T8,A8,8,1) AACF(T9,A9,9,1) AACF(TA,AA,A,1) AACF(TB,AB,B,1) \
+               AACF(TC,AC,C,1) AACF(TD,AD,D,1) AACF(TE,AE,E,1)                 \
+      JCF(T1,1) JCF(T2,2) JCF(T3,3) JCF(T4,4) JCF(T5,5) JCF(T6,6) JCF(T7,7)    \
+      JCF(T8,8) JCF(T9,9) JCF(TA,A) JCF(TB,B) JCF(TC,C) JCF(TD,D) JCF(TE,E)  );\
+   WCF(T1,A1,1) WCF(T2,A2,2) WCF(T3,A3,3) WCF(T4,A4,4) WCF(T5,A5,5)            \
+   WCF(T6,A6,6) WCF(T7,A7,7) WCF(T8,A8,8) WCF(T9,A9,9) WCF(TA,AA,A)            \
+   WCF(TB,AB,B) WCF(TC,AC,C) WCF(TD,AD,D) WCF(TE,AE,E)             }while(FALSE)
+
+/* Apollo 6.7, CRAY, Sun, VAX/Ultrix vcc/cc and HP can't hack more than 31 arg's */
+#if !(defined(VAXUltrix)&&!defined(__GNUC__)) && !defined(__CF__APOLLO67) && !defined(sun) && !defined(__hpux) && !defined(_CRAY)
+#define CCALLSFSUB15(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF)\
+        CCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,CF_0,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,0,0,0,0,0)
+#define CCALLSFSUB16(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG)\
+        CCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,0,0,0,0)
+#define CCALLSFSUB17(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH)\
+        CCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,0,0,0)
+#define CCALLSFSUB18(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI)\
+        CCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,0,0)
+#define CCALLSFSUB19(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ)\
+        CCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,0)
+
+/* PROTOCCALLSFSUB20 is commented out, because it chokes the VAX VMS compiler.
+   It isn't required since we so far only pass pointers and integers to 
+   FORTRAN routines and these arg.'s aren't promoted to anything else.        */
+
+#define CCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH, \
+        TI,TJ,TK, A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK) \
+do{VVCF(T1,A1,B1) VVCF(T2,A2,B2) VVCF(T3,A3,B3) VVCF(T4,A4,B4) VVCF(T5,A5,B5)  \
+   VVCF(T6,A6,B6) VVCF(T7,A7,B7) VVCF(T8,A8,B8) VVCF(T9,A9,B9) VVCF(TA,AA,BA)  \
+   VVCF(TB,AB,BB) VVCF(TC,AC,BC) VVCF(TD,AD,BD) VVCF(TE,AE,BE) VVCF(TF,AF,BF)  \
+   VVCF(TG,AG,BG) VVCF(TH,AH,BH) VVCF(TI,AI,BI) VVCF(TJ,AJ,BJ) VVCF(TK,AK,BK)  \
+/*   PROTOCCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK)*/\
+   ACF(LN,T1,A1,1) ACF(LN,T2,A2,2) ACF(LN,T3,A3,3) ACF(LN,T4,A4,4)             \
+   ACF(LN,T5,A5,5) ACF(LN,T6,A6,6) ACF(LN,T7,A7,7) ACF(LN,T8,A8,8)             \
+   ACF(LN,T9,A9,9) ACF(LN,TA,AA,A) ACF(LN,TB,AB,B) ACF(LN,TC,AC,C)             \
+   ACF(LN,TD,AD,D) ACF(LN,TE,AE,E) ACF(LN,TF,AF,F) ACF(LN,TG,AG,G)             \
+   ACF(LN,TH,AH,H) ACF(LN,TI,AI,I) ACF(LN,TJ,AJ,J) ACF(LN,TK,AK,K)             \
+   CFC_(UN,LN)(AACF(T1,A1,1,0) AACF(T2,A2,2,1) AACF(T3,A3,3,1) AACF(T4,A4,4,1) \
+               AACF(T5,A5,5,1) AACF(T6,A6,6,1) AACF(T7,A7,7,1) AACF(T8,A8,8,1) \
+               AACF(T9,A9,9,1) AACF(TA,AA,A,1) AACF(TB,AB,B,1) AACF(TC,AC,C,1) \
+               AACF(TD,AD,D,1) AACF(TE,AE,E,1) AACF(TF,AF,F,1) AACF(TG,AG,G,1) \
+               AACF(TH,AH,H,1) AACF(TI,AI,I,1) AACF(TJ,AJ,J,1) AACF(TK,AK,K,1) \
+      JCF(T1,1) JCF(T2,2) JCF(T3,3) JCF(T4,4) JCF(T5,5) JCF(T6,6) JCF(T7,7)    \
+      JCF(T8,8) JCF(T9,9) JCF(TA,A) JCF(TB,B) JCF(TC,C) JCF(TD,D) JCF(TE,E)    \
+      JCF(TF,F) JCF(TG,G) JCF(TH,H) JCF(TI,I) JCF(TJ,J) JCF(TK,K)          );  \
+ WCF(T1,A1,1) WCF(T2,A2,2) WCF(T3,A3,3) WCF(T4,A4,4) WCF(T5,A5,5) WCF(T6,A6,6) \
+ WCF(T7,A7,7) WCF(T8,A8,8) WCF(T9,A9,9) WCF(TA,AA,A) WCF(TB,AB,B) WCF(TC,AC,C) \
+ WCF(TD,AD,D) WCF(TE,AE,E) WCF(TF,AF,F) WCF(TG,AG,G) WCF(TH,AH,H) WCF(TI,AI,I) \
+ WCF(TJ,AJ,J) WCF(TK,AK,K) }while(FALSE)
+#endif         /* Apollo 6.7, CRAY, Sun and HP can't hack more than 31 arg.'s */
+
+/*-------------------------------------------------------------------------*/
+
+/*               UTILITIES FOR C TO CALL FORTRAN FUNCTIONS                 */
+
+/*N.B. PROTOCCALLSFFUNn(..) generates code, whether or not the FORTRAN
+  function is called. Therefore, especially for creator's of C header files
+  for large FORTRAN libraries which include many functions, to reduce
+  compile time and object code size, it may be desirable to create
+  preprocessor directives to allow users to create code for only those
+  functions which they use.                                                */
+
+/* The following defines the maximum length string that a function can return.
+   Of course it may be undefine-d and re-define-d before individual
+   PROTOCCALLSFFUNn(..) as required. It would also be nice to have this derived
+   from the individual machines' limits.                                      */
+#define MAX_LEN_FORTRAN_FUNCTION_STRING 0x4FE
+
+/* The following defines a character used by CFORTRAN.H to flag the end of a
+   string coming out of a FORTRAN routine.                                 */
+#define CFORTRAN_NON_CHAR 0x7F
+
+#ifdef OLD_VAXC                                /* Prevent %CC-I-PARAMNOTUSED. */
+#pragma nostandard
+#endif
+
+#define _SEP_(TN,C,COMMA) __SEP_##C(TN,COMMA)
+#define __SEP_0(TN,COMMA)  
+#define __SEP_1(TN,COMMA)  _INT(2,SEP_,TN,COMMA,0)
+#define SEP_INT(T,B)   A##B
+#define SEP_INTV       SEP_INT
+#define SEP_INTVV      SEP_INT
+#define SEP_INTVVV     SEP_INT
+#define SEP_INTVVVV    SEP_INT
+#define SEP_INTVVVVV   SEP_INT
+#define SEP_INTVVVVVV  SEP_INT
+#define SEP_INTVVVVVVV SEP_INT
+#define SEP_PINT       SEP_INT
+#define SEP_PVOID      SEP_INT
+#define SEP_ROUTINE    SEP_INT
+#define SEP_SIMPLE     SEP_INT
+#define SEP_VOID       SEP_INT    /* Need for FORTRAN calls to C subroutines. */
+#define SEP_STRING     SEP_INT
+#define SEP_STRINGV    SEP_INT
+#define SEP_PSTRING    SEP_INT
+#define SEP_PSTRINGV   SEP_INT
+#define SEP_PNSTRING   SEP_INT
+#define SEP_PPSTRING   SEP_INT
+#define SEP_STRVOID     SEP_INT
+#define SEP_ZTRINGV    SEP_INT
+#define SEP_PZTRINGV   SEP_INT
+                         
+#if defined(SIGNED_BYTE) || !defined(UNSIGNED_BYTE)
+#ifdef OLD_VAXC
+#define INTEGER_BYTE               char    /* Old VAXC barfs on 'signed char' */
+#else
+#define INTEGER_BYTE        signed char    /* default */
+#endif
+#else
+#define INTEGER_BYTE        unsigned char
+#endif
+#define    typePBYTEVVVVVVV INTEGER_BYTE
+#define  typePDOUBLEVVVVVVV DOUBLE_PRECISION 
+#define   typePFLOATVVVVVVV float
+#define     typePINTVVVVVVV int
+#define typePLOGICALVVVVVVV int
+#define    typePLONGVVVVVVV long
+#define   typePSHORTVVVVVVV short
+
+#define CFARGS0(A,T,W,X,Y,Z) A##T
+#define CFARGS1(A,T,W,X,Y,Z) A##T(W)
+#define CFARGS2(A,T,W,X,Y,Z) A##T(W,X)
+#define CFARGS3(A,T,W,X,Y,Z) A##T(W,X,Y)
+#define CFARGS4(A,T,W,X,Y,Z) A##T(W,X,Y,Z)
+
+#define _INT(N,T,I,Y,Z)              INT_##I(N,T,I,Y,Z)
+#define INT_BYTE                     INT_DOUBLE
+#define INT_DOUBLE(       N,A,B,Y,Z) CFARGS##N(A,INT,B,Y,Z,0)
+#define INT_FLOAT                    INT_DOUBLE
+#define INT_INT                      INT_DOUBLE
+#define INT_LOGICAL                  INT_DOUBLE
+#define INT_LONG                     INT_DOUBLE
+#define INT_SHORT                    INT_DOUBLE
+#define INT_PBYTE                    INT_PDOUBLE
+#define INT_PDOUBLE(      N,A,B,Y,Z) CFARGS##N(A,PINT,B,Y,Z,0)
+#define INT_PFLOAT                   INT_PDOUBLE
+#define INT_PINT                     INT_PDOUBLE
+#define INT_PLOGICAL                 INT_PDOUBLE
+#define INT_PLONG                    INT_PDOUBLE
+#define INT_PSHORT                   INT_PDOUBLE
+#define INT_BYTEV                    INT_DOUBLEV
+#define INT_BYTEVV                   INT_DOUBLEVV
+#define INT_BYTEVVV                  INT_DOUBLEVVV
+#define INT_BYTEVVVV                 INT_DOUBLEVVVV
+#define INT_BYTEVVVVV                INT_DOUBLEVVVVV
+#define INT_BYTEVVVVVV               INT_DOUBLEVVVVVV
+#define INT_BYTEVVVVVVV              INT_DOUBLEVVVVVVV
+#define INT_DOUBLEV(      N,A,B,Y,Z) CFARGS##N(A,INTV,B,Y,Z,0)
+#define INT_DOUBLEVV(     N,A,B,Y,Z) CFARGS##N(A,INTVV,B,Y,Z,0)
+#define INT_DOUBLEVVV(    N,A,B,Y,Z) CFARGS##N(A,INTVVV,B,Y,Z,0)
+#define INT_DOUBLEVVVV(   N,A,B,Y,Z) CFARGS##N(A,INTVVVV,B,Y,Z,0)
+#define INT_DOUBLEVVVVV(  N,A,B,Y,Z) CFARGS##N(A,INTVVVVV,B,Y,Z,0)
+#define INT_DOUBLEVVVVVV( N,A,B,Y,Z) CFARGS##N(A,INTVVVVVV,B,Y,Z,0)
+#define INT_DOUBLEVVVVVVV(N,A,B,Y,Z) CFARGS##N(A,INTVVVVVVV,B,Y,Z,0)
+#define INT_FLOATV                   INT_DOUBLEV
+#define INT_FLOATVV                  INT_DOUBLEVV
+#define INT_FLOATVVV                 INT_DOUBLEVVV
+#define INT_FLOATVVVV                INT_DOUBLEVVVV
+#define INT_FLOATVVVVV               INT_DOUBLEVVVVV
+#define INT_FLOATVVVVVV              INT_DOUBLEVVVVVV
+#define INT_FLOATVVVVVVV             INT_DOUBLEVVVVVVV
+#define INT_INTV                     INT_DOUBLEV
+#define INT_INTVV                    INT_DOUBLEVV
+#define INT_INTVVV                   INT_DOUBLEVVV
+#define INT_INTVVVV                  INT_DOUBLEVVVV
+#define INT_INTVVVVV                 INT_DOUBLEVVVVV
+#define INT_INTVVVVVV                INT_DOUBLEVVVVVV
+#define INT_INTVVVVVVV               INT_DOUBLEVVVVVVV
+#define INT_LOGICALV                 INT_DOUBLEV
+#define INT_LOGICALVV                INT_DOUBLEVV
+#define INT_LOGICALVVV               INT_DOUBLEVVV
+#define INT_LOGICALVVVV              INT_DOUBLEVVVV
+#define INT_LOGICALVVVVV             INT_DOUBLEVVVVV
+#define INT_LOGICALVVVVVV            INT_DOUBLEVVVVVV
+#define INT_LOGICALVVVVVVV           INT_DOUBLEVVVVVVV
+#define INT_LONGV                    INT_DOUBLEV
+#define INT_LONGVV                   INT_DOUBLEVV
+#define INT_LONGVVV                  INT_DOUBLEVVV
+#define INT_LONGVVVV                 INT_DOUBLEVVVV
+#define INT_LONGVVVVV                INT_DOUBLEVVVVV
+#define INT_LONGVVVVVV               INT_DOUBLEVVVVVV
+#define INT_LONGVVVVVVV              INT_DOUBLEVVVVVVV
+#define INT_SHORTV                   INT_DOUBLEV
+#define INT_SHORTVV                  INT_DOUBLEVV
+#define INT_SHORTVVV                 INT_DOUBLEVVV
+#define INT_SHORTVVVV                INT_DOUBLEVVVV
+#define INT_SHORTVVVVV               INT_DOUBLEVVVVV
+#define INT_SHORTVVVVVV              INT_DOUBLEVVVVVV
+#define INT_SHORTVVVVVVV             INT_DOUBLEVVVVVVV
+#define INT_PVOID(        N,A,B,Y,Z) CFARGS##N(A,B,B,Y,Z,0)
+#define INT_ROUTINE                  INT_PVOID
+/*CRAY coughs on the first, i.e. the usual trouble of not being able to
+  define macros to macros with arguments. */
+/*#define INT_SIMPLE                   INT_PVOID*/
+#define INT_SIMPLE(       N,A,B,Y,Z) INT_PVOID(N,A,B,Y,Z)
+#define INT_VOID                     INT_PVOID
+#define INT_STRING                   INT_PVOID
+#define INT_STRINGV                  INT_PVOID
+#define INT_PSTRING                  INT_PVOID
+#define INT_PSTRINGV                 INT_PVOID
+#define INT_PNSTRING                 INT_PVOID
+#define INT_PPSTRING                 INT_PVOID
+#define INT_ZTRINGV                  INT_PVOID
+#define INT_PZTRINGV                 INT_PVOID
+#define INT_STRVOID                   INT_PVOID
+#define INT_CF_0(         N,A,B,Y,Z)
+                         
+#define   UCF(TN,I,C)  _SEP_(TN,C,COMMA) _INT(2,U,TN,A##I,0)
+#define  UUCF(TN,I,C)  _SEP_(TN,C,COMMA) _SEP_(TN,1,I) 
+#define UUUCF(TN,I,C)  _SEP_(TN,C,COLON) _INT(2,U,TN,A##I,0)
+#define UINT(       T,A) typeP##T##VVVVVVV  A
+#define UINTV(      T,A) typeP##T##VVVVVV  *A
+#define UINTVV(     T,A) typeP##T##VVVVV   *A
+#define UINTVVV(    T,A) typeP##T##VVVV    *A
+#define UINTVVVV(   T,A) typeP##T##VVV     *A
+#define UINTVVVVV(  T,A) typeP##T##VV      *A
+#define UINTVVVVVV( T,A) typeP##T##V       *A
+#define UINTVVVVVVV(T,A) typeP##T            *A
+#define UPINT(      T,A)  type##T##VVVVVVV *A
+#define UPVOID(     T,A) void *A 
+#define UROUTINE(   T,A) void (*A)() 
+#define UVOID(      T,A) void  A     /* Needed for C calls FORTRAN subroutines. */
+#define USTRING(    T,A) char *A     /*            via VOID and wrapper.        */
+#define USTRINGV(   T,A) char *A
+#define UPSTRING(   T,A) char *A
+#define UPSTRINGV(  T,A) char *A
+#define UZTRINGV(   T,A) char *A
+#define UPZTRINGV(  T,A) char *A
+
+/* VOID breaks U into U and UU. */
+#define UUINT(      T,A) typeP##T##VVVVVVV  A
+#define UUVOID(     T,A)           /* Needed for FORTRAN calls C subroutines. */
+#define UUSTRING(   T,A) char *A 
+
+/* Sun and VOID break U into U and PU. */
+#define PUBYTE(      A) INTEGER_BYTE     A
+#define PUDOUBLE(    A) DOUBLE_PRECISION A
+#ifndef sunFortran
+#define PUFLOAT(     A) float   A
+#else
+#define PUFLOAT(     A) FLOATFUNCTIONTYPE   A
+#endif
+#define PUINT(       A) int     A
+#define PULOGICAL(   A) int     A
+#define PULONG(      A) long    A
+#define PUSHORT(     A) short   A
+#define PUSTRING(    A) char   *A 
+#define PUVOID(      A) void    A
+
+#define EBYTE          INTEGER_BYTE     A0;
+#define EDOUBLE        DOUBLE_PRECISION A0;
+#ifndef sunFortran
+#define EFLOAT         float  A0;
+#else
+#define EFLOAT         float AA0;   FLOATFUNCTIONTYPE A0;
+#endif
+#define EINT           int    A0;
+#define ELOGICAL       int    A0;
+#define ELONG          long   A0;
+#define ESHORT         short  A0;
+#define EVOID
+#ifdef vmsFortran
+#define ESTRING        static char AA0[MAX_LEN_FORTRAN_FUNCTION_STRING+1];     \
+                       static fstring A0 =                                     \
+             {MAX_LEN_FORTRAN_FUNCTION_STRING,DSC$K_DTYPE_T,DSC$K_CLASS_S,AA0};\
+               memset(AA0, CFORTRAN_NON_CHAR, MAX_LEN_FORTRAN_FUNCTION_STRING);\
+                                    *(AA0+MAX_LEN_FORTRAN_FUNCTION_STRING)='\0';
+#else
+#ifdef CRAYFortran
+#define ESTRING        static char AA0[MAX_LEN_FORTRAN_FUNCTION_STRING+1];     \
+                   static _fcd A0; *(AA0+MAX_LEN_FORTRAN_FUNCTION_STRING)='\0';\
+                memset(AA0,CFORTRAN_NON_CHAR, MAX_LEN_FORTRAN_FUNCTION_STRING);\
+                            A0 = _cptofcd(AA0,MAX_LEN_FORTRAN_FUNCTION_STRING);
+#else
+#define ESTRING        static char A0[MAX_LEN_FORTRAN_FUNCTION_STRING+1];      \
+                       memset(A0, CFORTRAN_NON_CHAR,                           \
+                              MAX_LEN_FORTRAN_FUNCTION_STRING);                \
+                       *(A0+MAX_LEN_FORTRAN_FUNCTION_STRING)='\0';
+#endif
+#endif
+/* ESTRING must use static char. array which is guaranteed to exist after
+   function returns.                                                     */
+
+/* N.B.i) The diff. for 0 (Zero) and >=1 arguments.
+       ii)That the following create an unmatched bracket, i.e. '(', which
+          must of course be matched in the call.
+       iii)Commas must be handled very carefully                         */
+#define GZINT(    T,UN,LN) A0=CFC_(UN,LN)(
+#define GZVOID(   T,UN,LN)    CFC_(UN,LN)(
+#ifdef vmsFortran
+#define GZSTRING( T,UN,LN)    CFC_(UN,LN)(&A0
+#else
+#ifdef CRAYFortran
+#define GZSTRING( T,UN,LN)    CFC_(UN,LN)( A0
+#else
+#define GZSTRING( T,UN,LN)    CFC_(UN,LN)( A0,MAX_LEN_FORTRAN_FUNCTION_STRING
+#endif
+#endif
+
+#define GINT               GZINT
+#define GVOID              GZVOID
+#define GSTRING(  T,UN,LN) GZSTRING(T,UN,LN),
+
+#define    PPBYTEVVVVVVV
+#define     PPINTVVVVVVV     /* These complement PPFLOATVVVVVVV. */
+#define  PPDOUBLEVVVVVVV
+#define PPLOGICALVVVVVVV
+#define    PPLONGVVVVVVV
+#define   PPSHORTVVVVVVV
+
+#define BCF(TN,AN,C)   _SEP_(TN,C,COMMA) _INT(2,B,TN,AN,0)
+#define BINT(       T,A) (typeP##T##VVVVVVV) A
+#define BINTV(      T,A)            A
+#define BINTVV(     T,A)           (A)[0]
+#define BINTVVV(    T,A)           (A)[0][0]
+#define BINTVVVV(   T,A)           (A)[0][0][0]
+#define BINTVVVVV(  T,A)           (A)[0][0][0][0]
+#define BINTVVVVVV( T,A)           (A)[0][0][0][0][0]
+#define BINTVVVVVVV(T,A)           (A)[0][0][0][0][0][0]
+#define BPINT(      T,A) P##T##VVVVVVV  &A
+#define BSTRING(    T,A) (char *)   A
+#define BSTRINGV(   T,A) (char *)   A
+#define BPSTRING(   T,A) (char *)   A
+#define BPSTRINGV(  T,A) (char *)   A
+#define BPVOID(     T,A) (void *)   A
+#define BROUTINE(   T,A) (void(*)())A
+#define BZTRINGV(   T,A) (char *)   A
+#define BPZTRINGV(  T,A) (char *)   A
+                                                              	
+#define ZCF(TN,N,AN)   _INT(3,Z,TN,N,AN)
+#define ZINT(       T,I,A) (__cfztringv[I]=(int)A),
+#define ZPINT              ZINT
+#define ZINTV(      T,I,A)
+#define ZINTVV(     T,I,A)
+#define ZINTVVV(    T,I,A)
+#define ZINTVVVV(   T,I,A)
+#define ZINTVVVVV(  T,I,A)
+#define ZINTVVVVVV( T,I,A)
+#define ZINTVVVVVVV(T,I,A)
+#define ZSTRING(    T,I,A)
+#define ZSTRINGV(   T,I,A)
+#define ZPSTRING(   T,I,A)
+#define ZPSTRINGV(  T,I,A)
+#define ZPVOID(     T,I,A)
+#define ZROUTINE(   T,I,A)
+#define ZSIMPLE(    T,I,A)
+#define ZZTRINGV(   T,I,A)
+#define ZPZTRINGV(  T,I,A)
+
+#define SCF(TN,NAME,I,A) STR_##TN(3,S,NAME,I,A,0)
+#define SLOGICAL( M,I,A)
+#define SPLOGICAL(M,I,A)
+#define SSTRING(  M,I,A) ,sizeof(A)
+#define SSTRINGV( M,I,A) ,( (unsigned)0xFFFF*firstindexlength(A)               \
+                             +secondindexlength(A))
+#define SPSTRING( M,I,A) ,sizeof(A)
+#define SPSTRINGV          SSTRINGV
+#define SZTRINGV( M,I,A) ,( (unsigned)0xFFFF*M##_ELEMS_##I                 \
+                             +M##_ELEMLEN_##I+1)
+#define SPZTRINGV        SZTRINGV
+
+#define   HCF(TN,I)      STR_##TN(3,H,COMMA, H,C##I,0)
+#define  HHCF(TN,I)      STR_##TN(3,H,COMMA,HH,C##I,0)
+#define HHHCF(TN,I)      STR_##TN(3,H,COLON, H,C##I,0)
+#define  H_CF_SPECIAL    unsigned
+#define HH_CF_SPECIAL
+#define HLOGICAL( S,U,B)
+#define HPLOGICAL(S,U,B)
+#define HSTRING(  S,U,B) A##S U##_CF_SPECIAL B
+#define HSTRINGV         HSTRING    
+#define HPSTRING         HSTRING
+#define HPSTRINGV        HSTRING
+#define HPNSTRING        HSTRING
+#define HPPSTRING        HSTRING
+#define HSTRVOID          HSTRING
+#define HZTRINGV         HSTRING
+#define HPZTRINGV        HSTRING
+
+#define STR_BYTE(          N,T,A,B,C,D)
+#define STR_DOUBLE(        N,T,A,B,C,D)      /* Can't add spaces inside       */
+#define STR_FLOAT(         N,T,A,B,C,D)      /* expansion since it screws up  */
+#define STR_INT(           N,T,A,B,C,D)      /* macro catenation kludge.      */
+#define STR_LOGICAL(       N,T,A,B,C,D) CFARGS##N(T,LOGICAL,A,B,C,D)
+#define STR_LONG(          N,T,A,B,C,D)
+#define STR_SHORT(         N,T,A,B,C,D)
+#define STR_BYTEV(         N,T,A,B,C,D)
+#define STR_BYTEVV(        N,T,A,B,C,D)
+#define STR_BYTEVVV(       N,T,A,B,C,D)
+#define STR_BYTEVVVV(      N,T,A,B,C,D)
+#define STR_BYTEVVVVV(     N,T,A,B,C,D)
+#define STR_BYTEVVVVVV(    N,T,A,B,C,D)
+#define STR_BYTEVVVVVVV(   N,T,A,B,C,D)
+#define STR_DOUBLEV(       N,T,A,B,C,D)
+#define STR_DOUBLEVV(      N,T,A,B,C,D)
+#define STR_DOUBLEVVV(     N,T,A,B,C,D)
+#define STR_DOUBLEVVVV(    N,T,A,B,C,D)
+#define STR_DOUBLEVVVVV(   N,T,A,B,C,D)
+#define STR_DOUBLEVVVVVV(  N,T,A,B,C,D)
+#define STR_DOUBLEVVVVVVV( N,T,A,B,C,D)
+#define STR_FLOATV(        N,T,A,B,C,D)
+#define STR_FLOATVV(       N,T,A,B,C,D)
+#define STR_FLOATVVV(      N,T,A,B,C,D)
+#define STR_FLOATVVVV(     N,T,A,B,C,D)
+#define STR_FLOATVVVVV(    N,T,A,B,C,D)
+#define STR_FLOATVVVVVV(   N,T,A,B,C,D)
+#define STR_FLOATVVVVVVV(  N,T,A,B,C,D)
+#define STR_INTV(          N,T,A,B,C,D)
+#define STR_INTVV(         N,T,A,B,C,D)
+#define STR_INTVVV(        N,T,A,B,C,D)
+#define STR_INTVVVV(       N,T,A,B,C,D)
+#define STR_INTVVVVV(      N,T,A,B,C,D)
+#define STR_INTVVVVVV(     N,T,A,B,C,D)
+#define STR_INTVVVVVVV(    N,T,A,B,C,D)
+#define STR_LOGICALV(      N,T,A,B,C,D)
+#define STR_LOGICALVV(     N,T,A,B,C,D)
+#define STR_LOGICALVVV(    N,T,A,B,C,D)
+#define STR_LOGICALVVVV(   N,T,A,B,C,D)
+#define STR_LOGICALVVVVV(  N,T,A,B,C,D)
+#define STR_LOGICALVVVVVV( N,T,A,B,C,D)
+#define STR_LOGICALVVVVVVV(N,T,A,B,C,D)
+#define STR_LONGV(         N,T,A,B,C,D)
+#define STR_LONGVV(        N,T,A,B,C,D)
+#define STR_LONGVVV(       N,T,A,B,C,D)
+#define STR_LONGVVVV(      N,T,A,B,C,D)
+#define STR_LONGVVVVV(     N,T,A,B,C,D)
+#define STR_LONGVVVVVV(    N,T,A,B,C,D)
+#define STR_LONGVVVVVVV(   N,T,A,B,C,D)
+#define STR_SHORTV(        N,T,A,B,C,D)
+#define STR_SHORTVV(       N,T,A,B,C,D)
+#define STR_SHORTVVV(      N,T,A,B,C,D)
+#define STR_SHORTVVVV(     N,T,A,B,C,D)
+#define STR_SHORTVVVVV(    N,T,A,B,C,D)
+#define STR_SHORTVVVVVV(   N,T,A,B,C,D)
+#define STR_SHORTVVVVVVV(  N,T,A,B,C,D)
+#define STR_PBYTE(         N,T,A,B,C,D)
+#define STR_PDOUBLE(       N,T,A,B,C,D)
+#define STR_PFLOAT(        N,T,A,B,C,D)
+#define STR_PINT(          N,T,A,B,C,D)
+#define STR_PLOGICAL(      N,T,A,B,C,D) CFARGS##N(T,PLOGICAL,A,B,C,D)
+#define STR_PLONG(         N,T,A,B,C,D)
+#define STR_PSHORT(        N,T,A,B,C,D)
+#define STR_STRING(        N,T,A,B,C,D) CFARGS##N(T,STRING,A,B,C,D)
+#define STR_PSTRING(       N,T,A,B,C,D) CFARGS##N(T,PSTRING,A,B,C,D)
+#define STR_STRINGV(       N,T,A,B,C,D) CFARGS##N(T,STRINGV,A,B,C,D)
+#define STR_PSTRINGV(      N,T,A,B,C,D) CFARGS##N(T,PSTRINGV,A,B,C,D)
+#define STR_PNSTRING(      N,T,A,B,C,D) CFARGS##N(T,PNSTRING,A,B,C,D)
+#define STR_PPSTRING(      N,T,A,B,C,D) CFARGS##N(T,PPSTRING,A,B,C,D)
+#define STR_STRVOID(        N,T,A,B,C,D) CFARGS##N(T,STRVOID,A,B,C,D)
+#define STR_PVOID(         N,T,A,B,C,D)
+#define STR_ROUTINE(       N,T,A,B,C,D)
+#define STR_SIMPLE(        N,T,A,B,C,D)
+#define STR_ZTRINGV(       N,T,A,B,C,D) CFARGS##N(T,ZTRINGV,A,B,C,D)
+#define STR_PZTRINGV(      N,T,A,B,C,D) CFARGS##N(T,PZTRINGV,A,B,C,D)
+#define STR_CF_0(          N,T,A,B,C,D)               
+
+/* See ACF table comments, which explain why CCF was split into two. */
+#define CCF(TN,I)          STR_##TN(3,C,A##I,B##I,C##I,0)
+#define CLOGICAL( A,B,C)  A=C2FLOGICAL( A);
+#define CPLOGICAL(A,B,C) *A=C2FLOGICAL(*A);
+#ifdef vmsFortran
+#define CSTRING(  A,B,C) (B.clen=strlen(A),B.f.dsc$a_pointer=A,                \
+                    C==sizeof(char*)||C==B.clen+1?B.f.dsc$w_length=B.clen:     \
+          (memset((A)+B.clen,' ',C-B.clen-1),A[B.f.dsc$w_length=C-1]='\0'));
+#define CSTRINGV( A,B,C) (                                                     \
+          initfstr(B, malloc((C/0xFFFF)*(C%0xFFFF-1)), C/0xFFFF, C%0xFFFF-1),  \
+          c2fstrv(A,B.dsc$a_pointer,C%0xFFFF,(C/0xFFFF)*(C%0xFFFF)) );
+#define CPSTRING( A,B,C) (B.dsc$w_length=strlen(A),B.dsc$a_pointer=A,          \
+        C==sizeof(char*)?0:(memset((A)+B.dsc$w_length,' ',C-B.dsc$w_length-1), \
+                             A[B.dsc$w_length=C-1]='\0'));
+#define CPSTRINGV(A,B,C)  (initfstr(B, A, C/0xFFFF, C%0xFFFF-1),               \
+                             c2fstrv(A,A,C%0xFFFF,(C/0xFFFF)*(C%0xFFFF)) );
+#else
+#ifdef CRAYFortran
+#define CSTRING(  A,B,C) (B.clen=strlen(A),                                    \
+                          C==sizeof(char*)||C==B.clen+1?B.flen=B.clen:         \
+                        (memset((A)+B.clen,' ',C-B.clen-1),A[B.flen=C-1]='\0'));
+#define CSTRINGV( A,B,C) (B.s=malloc((C/0xFFFF)*(C%0xFFFF-1)),                 \
+                    c2fstrv(A,B.s,(B.flen=C%0xFFFF-1)+1,(C/0xFFFF)*(C%0xFFFF)));
+#define CPSTRING( A,B,C) (B=strlen(A), C==sizeof(char*)?0:                     \
+                            (memset((A)+B,' ',C-B-1),A[B=C-1]='\0'));
+#define CPSTRINGV(A,B,C) c2fstrv(A,A,(B.flen=C%0xFFFF-1)+1,                    \
+                                   B.sizeofA=(C/0xFFFF)*(C%0xFFFF));
+#else
+#define CSTRING(  A,B,C) (B.clen=strlen(A),                                    \
+                            C==sizeof(char*)||C==B.clen+1?B.flen=B.clen:       \
+                        (memset((A)+B.clen,' ',C-B.clen-1),A[B.flen=C-1]='\0'));
+#define CSTRINGV( A,B,C) (B.s=malloc((C/0xFFFF)*(C%0xFFFF-1)),                 \
+               B.fs=c2fstrv(A,B.s,(B.flen=C%0xFFFF-1)+1,(C/0xFFFF)*(C%0xFFFF)));
+#define CPSTRING( A,B,C) (B=strlen(A), C==sizeof(char*)?0:                     \
+                            (memset((A)+B,' ',C-B-1),A[B=C-1]='\0'));
+#define CPSTRINGV(A,B,C) B.fs=c2fstrv(A,A,(B.flen=C%0xFFFF-1)+1,               \
+                                        B.sizeofA=(C/0xFFFF)*(C%0xFFFF));
+#endif
+#endif
+#define CZTRINGV         CSTRINGV
+#define CPZTRINGV        CPSTRINGV
+
+#define CCCBYTE(    A,B) &A
+#define CCCDOUBLE(  A,B) &A
+#if !defined(__CF__KnR)
+#define CCCFLOAT(   A,B) &A
+                            /* Although the VAX doesn't, at least the         */
+#else                       /* HP and K&R mips promote float arg.'s of        */
+#define CCCFLOAT(   A,B) &B /* unprototyped functions to double. So we can't  */
+#endif                      /* use A here to pass the argument to FORTRAN.    */
+#define CCCINT(     A,B) &A
+#define CCCLOGICAL( A,B) &A
+#define CCCLONG(    A,B) &A
+#define CCCSHORT(   A,B) &A
+#define CCCPBYTE(   A,B)  A
+#define CCCPDOUBLE( A,B)  A
+#define CCCPFLOAT(  A,B)  A
+#define CCCPINT(    A,B)  A
+#define CCCPLOGICAL(A,B)  B=A       /* B used to keep a common W table. */
+#define CCCPLONG(   A,B)  A
+#define CCCPSHORT(  A,B)  A
+
+#define CCCF(TN,I,M)    _SEP_(TN,M,COMMA) _INT(3,CC,TN,A##I,B##I)
+#define CCINT(       T,A,B) CCC##T(A,B) 
+#define CCINTV(      T,A,B)  A
+#define CCINTVV(     T,A,B)  A
+#define CCINTVVV(    T,A,B)  A
+#define CCINTVVVV(   T,A,B)  A
+#define CCINTVVVVV(  T,A,B)  A
+#define CCINTVVVVVV( T,A,B)  A
+#define CCINTVVVVVVV(T,A,B)  A
+#define CCPINT(      T,A,B) CCC##T(A,B) 
+#define CCPVOID(     T,A,B)  A
+#ifdef apolloFortran
+#define CCROUTINE(   T,A,B) &A
+#else
+#define CCROUTINE(   T,A,B)  A
+#endif
+#define CCSIMPLE(    T,A,B)  A
+#ifdef vmsFortran
+#define CCSTRING(    T,A,B) &B.f
+#define CCSTRINGV(   T,A,B) &B
+#define CCPSTRING(   T,A,B) &B
+#define CCPSTRINGV(  T,A,B) &B
+#else
+#ifdef CRAYFortran
+#define CCSTRING(    T,A,B) _cptofcd(A,B.flen)
+#define CCSTRINGV(   T,A,B) _cptofcd(B.s,B.flen)
+#define CCPSTRING(   T,A,B) _cptofcd(A,B)
+#define CCPSTRINGV(  T,A,B) _cptofcd(A,B.flen)
+#else
+#define CCSTRING(    T,A,B)  A
+#define CCSTRINGV(   T,A,B)  B.fs
+#define CCPSTRING(   T,A,B)  A
+#define CCPSTRINGV(  T,A,B)  B.fs
+#endif
+#endif
+#define CCZTRINGV           CCSTRINGV
+#define CCPZTRINGV          CCPSTRINGV
+
+#define XBYTE          return A0;
+#define XDOUBLE        return A0;
+#ifndef sunFortran
+#define XFLOAT         return A0;
+#else
+#define XFLOAT         ASSIGNFLOAT(AA0,A0); return AA0;
+#endif
+#define XINT           return A0;
+#define XLOGICAL       return F2CLOGICAL(A0);
+#define XLONG          return A0;
+#define XSHORT         return A0;
+#define XVOID          return   ;
+#if defined(vmsFortran) || defined(CRAYFortran)
+#define XSTRING        return kill_trailing(                                   \
+                                      kill_trailing(AA0,CFORTRAN_NON_CHAR),' ');
+#else
+#define XSTRING        return kill_trailing(                                   \
+                                      kill_trailing( A0,CFORTRAN_NON_CHAR),' ');
+#endif
+
+#define CFFUN(NAME) __cf__##NAME
+
+/* Note that we don't use LN here, but we keep it for consistency. */
+#define CCALLSFFUN0(UN,LN) CFFUN(UN)()
+
+#ifdef OLD_VAXC                                  /* Allow %CC-I-PARAMNOTUSED. */
+#pragma standard
+#endif
+
+#define CCALLSFFUN1( UN,LN,T1,                        A1)         \
+        CCALLSFFUN5 (UN,LN,T1,CF_0,CF_0,CF_0,CF_0,A1,0,0,0,0)
+#define CCALLSFFUN2( UN,LN,T1,T2,                     A1,A2)      \
+        CCALLSFFUN5 (UN,LN,T1,T2,CF_0,CF_0,CF_0,A1,A2,0,0,0)
+#define CCALLSFFUN3( UN,LN,T1,T2,T3,                  A1,A2,A3)   \
+        CCALLSFFUN5 (UN,LN,T1,T2,T3,CF_0,CF_0,A1,A2,A3,0,0)
+#define CCALLSFFUN4( UN,LN,T1,T2,T3,T4,               A1,A2,A3,A4)\
+        CCALLSFFUN5 (UN,LN,T1,T2,T3,T4,CF_0,A1,A2,A3,A4,0)
+#define CCALLSFFUN5( UN,LN,T1,T2,T3,T4,T5,            A1,A2,A3,A4,A5)          \
+        CCALLSFFUN10(UN,LN,T1,T2,T3,T4,T5,CF_0,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,0,0,0,0,0)
+#define CCALLSFFUN6( UN,LN,T1,T2,T3,T4,T5,T6,         A1,A2,A3,A4,A5,A6)       \
+        CCALLSFFUN10(UN,LN,T1,T2,T3,T4,T5,T6,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,0,0,0,0)
+#define CCALLSFFUN7( UN,LN,T1,T2,T3,T4,T5,T6,T7,      A1,A2,A3,A4,A5,A6,A7)    \
+        CCALLSFFUN10(UN,LN,T1,T2,T3,T4,T5,T6,T7,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,0,0,0)
+#define CCALLSFFUN8( UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,   A1,A2,A3,A4,A5,A6,A7,A8) \
+        CCALLSFFUN10(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,0,0)
+#define CCALLSFFUN9( UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,A1,A2,A3,A4,A5,A6,A7,A8,A9)\
+        CCALLSFFUN10(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,0)
+
+#define CCALLSFFUN10(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA)\
+(ZCF(T1,1,A1) ZCF(T2,2,A2) ZCF(T3,3,A3) ZCF(T4,4,A4) ZCF(T5,5,A5)              \
+ ZCF(T6,6,A6) ZCF(T7,7,A7) ZCF(T8,8,A8) ZCF(T9,9,A9) ZCF(TA,A,AA)              \
+ (CFFUN(UN)(  BCF(T1,A1,0) BCF(T2,A2,1) BCF(T3,A3,1) BCF(T4,A4,1) BCF(T5,A5,1) \
+              BCF(T6,A6,1) BCF(T7,A7,1) BCF(T8,A8,1) BCF(T9,A9,1) BCF(TA,AA,1) \
+           SCF(T1,LN,1,A1) SCF(T2,LN,2,A2) SCF(T3,LN,3,A3) SCF(T4,LN,4,A4)     \
+           SCF(T5,LN,5,A5) SCF(T6,LN,6,A6) SCF(T7,LN,7,A7) SCF(T8,LN,8,A8)     \
+           SCF(T9,LN,9,A9) SCF(TA,LN,A,AA))))
+
+/*  N.B. Create a separate function instead of using (call function, function
+value here) because in order to create the variables needed for the input
+arg.'s which may be const.'s one has to do the creation within {}, but these
+can never be placed within ()'s. Therefore one must create wrapper functions.
+gcc, on the other hand may be able to avoid the wrapper functions. */
+
+/* Prototypes are needed to correctly handle the value returned correctly. N.B.
+Can only have prototype arg.'s with difficulty, a la G... table since FORTRAN
+functions returning strings have extra arg.'s. Don't bother, since this only
+causes a compiler warning to come up when one uses FCALLSCFUNn and CCALLSFFUNn
+for the same function in the same source code. Something done by the experts in
+debugging only.*/    
+
+#define PROTOCCALLSFFUN0(F,UN,LN)                                              \
+PU##F( CFC_(UN,LN))(CF_NULL_PROTO);                                          \
+static _INT(2,U,F,CFFUN(UN),0)() {E##F  _INT(3,GZ,F,UN,LN)); X##F}
+
+#define PROTOCCALLSFFUN1( T0,UN,LN,T1)                                         \
+        PROTOCCALLSFFUN5 (T0,UN,LN,T1,CF_0,CF_0,CF_0,CF_0)
+#define PROTOCCALLSFFUN2( T0,UN,LN,T1,T2)                                      \
+        PROTOCCALLSFFUN5 (T0,UN,LN,T1,T2,CF_0,CF_0,CF_0)
+#define PROTOCCALLSFFUN3( T0,UN,LN,T1,T2,T3)                                   \
+        PROTOCCALLSFFUN5 (T0,UN,LN,T1,T2,T3,CF_0,CF_0)
+#define PROTOCCALLSFFUN4( T0,UN,LN,T1,T2,T3,T4)                                \
+        PROTOCCALLSFFUN5 (T0,UN,LN,T1,T2,T3,T4,CF_0)
+#define PROTOCCALLSFFUN5( T0,UN,LN,T1,T2,T3,T4,T5)                             \
+        PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,CF_0,CF_0,CF_0,CF_0,CF_0)
+#define PROTOCCALLSFFUN6( T0,UN,LN,T1,T2,T3,T4,T5,T6)                          \
+        PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,T6,CF_0,CF_0,CF_0,CF_0)
+#define PROTOCCALLSFFUN7( T0,UN,LN,T1,T2,T3,T4,T5,T6,T7)                       \
+        PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,CF_0,CF_0,CF_0)
+#define PROTOCCALLSFFUN8( T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8)                    \
+        PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,CF_0,CF_0)
+#define PROTOCCALLSFFUN9( T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9)                 \
+        PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,CF_0)
+
+/* HP/UX 9.01 cc requires the blank between '_INT(3,G,T0,UN,LN) CCCF(T1,1,0)' */
+
+#ifndef __CF__KnR
+#define PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA)              \
+PU##T0(CFC_(UN,LN))(CF_NULL_PROTO);                                          \
+static _INT(2,U,T0,CFFUN(UN),0)(UCF(T1,1,0) UCF(T2,2,1) UCF(T3,3,1) UCF(T4,4,1)  \
+   UCF(T5,5,1) UCF(T6,6,1) UCF(T7,7,1) UCF(T8,8,1) UCF(T9,9,1) UCF(TA,A,1)     \
+                         HCF(T1,1) HCF(T2,2) HCF(T3,3) HCF(T4,4) HCF(T5,5)     \
+                         HCF(T6,6) HCF(T7,7) HCF(T8,8) HCF(T9,9) HCF(TA,A) )   \
+{VCF(T1,1) VCF(T2,2) VCF(T3,3) VCF(T4,4) VCF(T5,5)                             \
+ VCF(T6,6) VCF(T7,7) VCF(T8,8) VCF(T9,9) VCF(TA,A) E##T0                     \
+ CCF(T1,1) CCF(T2,2) CCF(T3,3) CCF(T4,4) CCF(T5,5)                             \
+ CCF(T6,6) CCF(T7,7) CCF(T8,8) CCF(T9,9) CCF(TA,A)                             \
+ _INT(3,G,T0,UN,LN) CCCF(T1,1,0) CCCF(T2,2,1) CCCF(T3,3,1) CCCF(T4,4,1) CCCF(T5,5,1)\
+                    CCCF(T6,6,1) CCCF(T7,7,1) CCCF(T8,8,1) CCCF(T9,9,1) CCCF(TA,A,1)\
+               JCF(T1,1) JCF(T2,2) JCF(T3,3) JCF(T4,4) JCF(T5,5)               \
+               JCF(T6,6) JCF(T7,7) JCF(T8,8) JCF(T9,9) JCF(TA,A));             \
+ WCF(T1,A1,1) WCF(T2,A2,2) WCF(T3,A3,3) WCF(T4,A4,4) WCF(T5,A5,5)              \
+ WCF(T6,A6,6) WCF(T7,A7,7) WCF(T8,A8,8) WCF(T9,A9,9) WCF(TA,AA,A) X##T0}
+#else
+#define PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA)              \
+PU##T0(CFC_(UN,LN))(CF_NULL_PROTO);                                          \
+static _INT(2,U,T0,CFFUN(UN),0)(UUCF(T1,1,0) UUCF(T2,2,1) UUCF(T3,3,1) UUCF(T4,4,1) \
+      UUCF(T5,5,1) UUCF(T6,6,1) UUCF(T7,7,1) UUCF(T8,8,1) UUCF(T9,9,1) UUCF(TA,A,1) \
+                       HHCF(T1,1) HHCF(T2,2) HHCF(T3,3) HHCF(T4,4) HHCF(T5,5)  \
+                       HHCF(T6,6) HHCF(T7,7) HHCF(T8,8) HHCF(T9,9) HHCF(TA,A)) \
+ UUUCF(T1,1,0) UUUCF(T2,2,1) UUUCF(T3,3,1) UUUCF(T4,4,1) UUUCF(T5,5,1)         \
+ UUUCF(T6,6,1) UUUCF(T7,7,1) UUUCF(T8,8,1) UUUCF(T9,9,1) UUUCF(TA,A,1)         \
+           HHHCF(T1,1) HHHCF(T2,2) HHHCF(T3,3) HHHCF(T4,4) HHHCF(T5,5)         \
+           HHHCF(T6,6) HHHCF(T7,7) HHHCF(T8,8) HHHCF(T9,9) HHHCF(TA,A);        \
+{VCF(T1,1) VCF(T2,2) VCF(T3,3) VCF(T4,4) VCF(T5,5)                             \
+ VCF(T6,6) VCF(T7,7) VCF(T8,8) VCF(T9,9) VCF(TA,A) E##T0                     \
+ CCF(T1,1) CCF(T2,2) CCF(T3,3) CCF(T4,4) CCF(T5,5)                             \
+ CCF(T6,6) CCF(T7,7) CCF(T8,8) CCF(T9,9) CCF(TA,A)                             \
+ _INT(3,G,T0,UN,LN) CCCF(T1,1,0) CCCF(T2,2,1) CCCF(T3,3,1) CCCF(T4,4,1) CCCF(T5,5,1)\
+                    CCCF(T6,6,1) CCCF(T7,7,1) CCCF(T8,8,1) CCCF(T9,9,1) CCCF(TA,A,1)\
+               JCF(T1,1) JCF(T2,2) JCF(T3,3) JCF(T4,4) JCF(T5,5)               \
+               JCF(T6,6) JCF(T7,7) JCF(T8,8) JCF(T9,9) JCF(TA,A) );            \
+ WCF(T1,A1,1) WCF(T2,A2,2) WCF(T3,A3,3) WCF(T4,A4,4) WCF(T5,A5,5)              \
+ WCF(T6,A6,6) WCF(T7,A7,7) WCF(T8,A8,8) WCF(T9,A9,9) WCF(TA,AA,A) X##T0}
+#endif
+
+/*-------------------------------------------------------------------------*/
+
+/*               UTILITIES FOR FORTRAN TO CALL C ROUTINES                  */
+
+#ifdef OLD_VAXC                                /* Prevent %CC-I-PARAMNOTUSED. */
+#pragma nostandard
+#endif
+
+#if defined(vmsFortran) || defined(CRAYFortran)
+#define   DCF(TN,I)
+#define  DDCF(TN,I)
+#define DDDCF(TN,I)
+#else
+#define   DCF                HCF
+#define  DDCF               HHCF
+#define DDDCF              HHHCF
+#endif
+
+#define QCF(TN,I)    STR_##TN(1,Q,B##I, 0,0,0)
+#define QLOGICAL( B)
+#define QPLOGICAL(B)
+#define QSTRINGV( B) char *B; unsigned int B##N;
+#define QSTRING(  B) char *B=NULL;
+#define QPSTRING( B) char *B=NULL;
+#define QPSTRINGV    QSTRINGV
+#define QPNSTRING(B) char *B=NULL;
+#define QPPSTRING(B)
+#define QSTRVOID(  B)
+
+#ifdef     apolloFortran
+#define ROUTINE_orig     (void *)*   /* Else, function value has to match. */
+#else  /* !apolloFortran */
+#ifdef     __sgi   /* Else SGI gives warning 182 contrary to its C LRM A.17.7 */
+#define ROUTINE_orig    *(void**)& 
+#else  /* !__sgi */
+#define ROUTINE_orig     (void *)  
+#endif /* __sgi */
+#endif /* apolloFortran */
+
+#define ROUTINE_1     ROUTINE_orig   
+#define ROUTINE_2     ROUTINE_orig   
+#define ROUTINE_3     ROUTINE_orig   
+#define ROUTINE_4     ROUTINE_orig   
+#define ROUTINE_5     ROUTINE_orig   
+#define ROUTINE_6     ROUTINE_orig   
+#define ROUTINE_7     ROUTINE_orig   
+#define ROUTINE_8     ROUTINE_orig   
+#define ROUTINE_9     ROUTINE_orig   
+#define ROUTINE_10    ROUTINE_orig  
+ 
+#define ROUTINE_11    ROUTINE_orig   
+#define ROUTINE_12    ROUTINE_orig   
+#define ROUTINE_13    ROUTINE_orig      
+#define ROUTINE_14    ROUTINE_orig
+#define ROUTINE_15    ROUTINE_orig
+
+#define TCF(NAME,TN,I,M)  _SEP_(TN,M,COMMA) T##TN(NAME,I,A##I,B##I,C##I)
+#define TBYTE(          M,I,A,B,D) *A
+#define TDOUBLE(        M,I,A,B,D) *A
+#define TFLOAT(         M,I,A,B,D) *A
+#define TINT(           M,I,A,B,D) *A
+#define TLOGICAL(       M,I,A,B,D)  F2CLOGICAL(*A)
+#define TLONG(          M,I,A,B,D) *A
+#define TSHORT(         M,I,A,B,D) *A
+#define TBYTEV(         M,I,A,B,D)  A
+#define TDOUBLEV(       M,I,A,B,D)  A
+#define TFLOATV(        M,I,A,B,D)  VOIDP0 A
+#define TINTV(          M,I,A,B,D)  A
+#define TLOGICALV(      M,I,A,B,D)  A
+#define TLONGV(         M,I,A,B,D)  A
+#define TSHORTV(        M,I,A,B,D)  A
+#define TBYTEVV(        M,I,A,B,D)  (void *)A /* We have to cast to void *,   */
+#define TBYTEVVV(       M,I,A,B,D)  (void *)A /* since we don't know the      */
+#define TBYTEVVVV(      M,I,A,B,D)  (void *)A /* dimensions of the array.     */
+#define TBYTEVVVVV(     M,I,A,B,D)  (void *)A /* i.e. Unfortunately, can't    */
+#define TBYTEVVVVVV(    M,I,A,B,D)  (void *)A /* check that the type matches  */
+#define TBYTEVVVVVVV(   M,I,A,B,D)  (void *)A /* with the prototype.          */
+#define TDOUBLEVV(      M,I,A,B,D)  (void *)A
+#define TDOUBLEVVV(     M,I,A,B,D)  (void *)A
+#define TDOUBLEVVVV(    M,I,A,B,D)  (void *)A
+#define TDOUBLEVVVVV(   M,I,A,B,D)  (void *)A
+#define TDOUBLEVVVVVV(  M,I,A,B,D)  (void *)A
+#define TDOUBLEVVVVVVV( M,I,A,B,D)  (void *)A
+#define TFLOATVV(       M,I,A,B,D)  (void *)A
+#define TFLOATVVV(      M,I,A,B,D)  (void *)A
+#define TFLOATVVVV(     M,I,A,B,D)  (void *)A
+#define TFLOATVVVVV(    M,I,A,B,D)  (void *)A
+#define TFLOATVVVVVV(   M,I,A,B,D)  (void *)A
+#define TFLOATVVVVVVV(  M,I,A,B,D)  (void *)A
+#define TINTVV(         M,I,A,B,D)  (void *)A  
+#define TINTVVV(        M,I,A,B,D)  (void *)A  
+#define TINTVVVV(       M,I,A,B,D)  (void *)A  
+#define TINTVVVVV(      M,I,A,B,D)  (void *)A
+#define TINTVVVVVV(     M,I,A,B,D)  (void *)A
+#define TINTVVVVVVV(    M,I,A,B,D)  (void *)A
+#define TLOGICALVV(     M,I,A,B,D)  (void *)A
+#define TLOGICALVVV(    M,I,A,B,D)  (void *)A
+#define TLOGICALVVVV(   M,I,A,B,D)  (void *)A
+#define TLOGICALVVVVV(  M,I,A,B,D)  (void *)A
+#define TLOGICALVVVVVV( M,I,A,B,D)  (void *)A
+#define TLOGICALVVVVVVV(M,I,A,B,D)  (void *)A
+#define TLONGVV(        M,I,A,B,D)  (void *)A
+#define TLONGVVV(       M,I,A,B,D)  (void *)A
+#define TLONGVVVV(      M,I,A,B,D)  (void *)A
+#define TLONGVVVVV(     M,I,A,B,D)  (void *)A
+#define TLONGVVVVVV(    M,I,A,B,D)  (void *)A
+#define TLONGVVVVVVV(   M,I,A,B,D)  (void *)A
+#define TSHORTVV(       M,I,A,B,D)  (void *)A
+#define TSHORTVVV(      M,I,A,B,D)  (void *)A
+#define TSHORTVVVV(     M,I,A,B,D)  (void *)A
+#define TSHORTVVVVV(    M,I,A,B,D)  (void *)A
+#define TSHORTVVVVVV(   M,I,A,B,D)  (void *)A
+#define TSHORTVVVVVVV(  M,I,A,B,D)  (void *)A
+#define TPBYTE(         M,I,A,B,D)  A
+#define TPDOUBLE(       M,I,A,B,D)  A
+#define TPFLOAT(        M,I,A,B,D)  VOIDP0 A
+#define TPINT(          M,I,A,B,D)  A
+#define TPLOGICAL(      M,I,A,B,D)  ((*A=F2CLOGICAL(*A)),A)
+#define TPLONG(         M,I,A,B,D)  A
+#define TPSHORT(        M,I,A,B,D)  A
+#define TPVOID(         M,I,A,B,D)  A
+#define TROUTINE(       M,I,A,B,D)  ROUTINE_##I  A
+/* A == pointer to the characters
+   D == length of the string, or of an element in an array of strings
+   E == number of elements in an array of strings                             */
+#define TTSTR(    A,B,D)                                                       \
+                  ((B=malloc(D+1))[D]='\0', memcpy(B,A,D), kill_trailing(B,' '))
+#define TTTTSTR(  A,B,D)   (!(D<4||A[0]||A[1]||A[2]||A[3]))?NULL:              \
+                            memchr(A,'\0',D)               ?A   : TTSTR(A,B,D)
+#define TTTTSTRV( A,B,D,E) (B##N=E,B=malloc(B##N*(D+1)), (void *)          \
+  vkill_trailing(f2cstrv(A,B,D+1, B##N*(D+1)), D+1,B##N*(D+1),' '))
+#ifdef vmsFortran
+#define TSTRING(        M,I,A,B,D)  TTTTSTR( A->dsc$a_pointer,B,A->dsc$w_length)
+#define TSTRINGV(       M,I,A,B,D)  TTTTSTRV(A->dsc$a_pointer, B,              \
+                                             A->dsc$w_length , A->dsc$l_m[0])
+#define TPSTRING(       M,I,A,B,D)    TTSTR( A->dsc$a_pointer,B,A->dsc$w_length)
+#define TPPSTRING(      M,I,A,B,D)           A->dsc$a_pointer
+#define TSTRVOID(        M,I,A,B,D)           A->dsc$a_pointer,A->dsc$w_length
+#else
+#ifdef CRAYFortran
+#define TSTRING(        M,I,A,B,D)  TTTTSTR( _fcdtocp(A),B,_fcdlen(A))
+#define TSTRINGV(       M,I,A,B,D)  TTTTSTRV(_fcdtocp(A),B,_fcdlen(A),         \
+                              num_elem(_fcdtocp(A),_fcdlen(A),M##_STRV_##A))
+#define TPSTRING(       M,I,A,B,D)    TTSTR( _fcdtocp(A),B,_fcdlen(A))
+#define TPPSTRING(      M,I,A,B,D)           _fcdtocp(A)
+#define TSTRVOID(        M,I,A,B,D)           _fcdtocp(A),_fcdlen(A)
+#else
+#define TSTRING(        M,I,A,B,D)  TTTTSTR( A,B,D)
+#define TSTRINGV(       M,I,A,B,D)  TTTTSTRV(A,B,D,                            \
+                                             num_elem(A,D,M##_STRV_##A))
+#define TPSTRING(       M,I,A,B,D)    TTSTR( A,B,D)
+#define TPPSTRING(      M,I,A,B,D)           A
+#define TSTRVOID(        M,I,A,B,D)           A,D
+#endif
+#endif
+#define TPNSTRING                   TSTRING
+#define TPSTRINGV                   TSTRINGV
+#define TCF_0(          M,I,A,B,D)
+
+#define RCF(TN,I)        STR_##TN(3,R,A##I,B##I,C##I,0)
+#define RLOGICAL( A,B,D)
+#define RPLOGICAL(A,B,D) *A=C2FLOGICAL(*A);
+#define RSTRING(  A,B,D) if (B) free(B);
+#define RSTRINGV( A,B,D) free(B);
+/* A and D as defined above for TSTRING(V) */
+#define RRRRPSTR( A,B,D) if (B) memcpy(A,B,PGSMIN(strlen(B),D)),                  \
+                  (D>strlen(B)?memset(A+strlen(B),' ', D-strlen(B)):0), free(B);
+#define RRRRPSTRV(A,B,D) c2fstrv(B,A,D+1,(D+1)*B##N), free(B);
+#ifdef vmsFortran
+#define RPSTRING( A,B,D) RRRRPSTR( A->dsc$a_pointer,B,A->dsc$w_length)
+#define RPSTRINGV(A,B,D) RRRRPSTRV(A->dsc$a_pointer,B,A->dsc$w_length)
+#else
+#ifdef CRAYFortran
+#define RPSTRING( A,B,D) RRRRPSTR( _fcdtocp(A),B,_fcdlen(A))
+#define RPSTRINGV(A,B,D) RRRRPSTRV(_fcdtocp(A),B,_fcdlen(A))
+#else
+#define RPSTRING( A,B,D) RRRRPSTR( A,B,D)
+#define RPSTRINGV(A,B,D) RRRRPSTRV(A,B,D)
+#endif
+#endif
+#define RPNSTRING(A,B,D) RPSTRING( A,B,D)
+#define RPPSTRING(A,B,D)
+#define RSTRVOID(  A,B,D)
+
+#define FZBYTE(   UN,LN) INTEGER_BYTE     fcallsc(UN,LN)(
+#define FZDOUBLE( UN,LN) DOUBLE_PRECISION fcallsc(UN,LN)(
+#define FZINT(    UN,LN) int   fcallsc(UN,LN)(
+#define FZLOGICAL(UN,LN) int   fcallsc(UN,LN)(
+#define FZLONG(   UN,LN) long  fcallsc(UN,LN)(
+#define FZSHORT(  UN,LN) short fcallsc(UN,LN)(
+#define FZVOID(   UN,LN) void  fcallsc(UN,LN)(
+#ifndef __CF__KnR
+/* The void is req'd by the Apollo, to make this an ANSI function declaration.
+   The Apollo promotes K&R float functions to double. */
+#define FZFLOAT(  UN,LN) float fcallsc(UN,LN)(void
+#ifdef vmsFortran
+#define FZSTRING( UN,LN) void  fcallsc(UN,LN)(fstring *AS
+#else
+#ifdef CRAYFortran
+#define FZSTRING( UN,LN) void  fcallsc(UN,LN)(_fcd     AS
+#else
+#define FZSTRING( UN,LN) void  fcallsc(UN,LN)(char    *AS, unsigned D0
+#endif
+#endif
+#else
+#ifndef sunFortran
+#define FZFLOAT(  UN,LN) float fcallsc(UN,LN)(
+#else
+#define FZFLOAT(  UN,LN) FLOATFUNCTIONTYPE fcallsc(UN,LN)(
+#endif
+#if defined(vmsFortran) || defined(CRAYFortran)
+#define FZSTRING( UN,LN) void  fcallsc(UN,LN)(AS
+#else
+#define FZSTRING( UN,LN) void  fcallsc(UN,LN)(AS, D0
+#endif
+#endif
+
+#define FBYTE            FZBYTE
+#define FDOUBLE          FZDOUBLE
+#ifndef __CF_KnR
+#define FFLOAT(  UN,LN)  float   fcallsc(UN,LN)(
+#else
+#define FFLOAT           FZFLOAT
+#endif
+#define FINT             FZINT
+#define FLOGICAL         FZLOGICAL
+#define FLONG            FZLONG
+#define FSHORT           FZSHORT
+#define FVOID            FZVOID
+#define FSTRING(  UN,LN) FZSTRING(UN,LN),
+
+#define FFINT
+#define FFVOID
+#ifdef vmsFortran
+#define FFSTRING          fstring *AS; 
+#else
+#ifdef CRAYFortran
+#define FFSTRING          _fcd     AS;
+#else
+#define FFSTRING          char    *AS; unsigned D0;
+#endif
+#endif
+
+#define LLINT              A0=
+#define LLSTRING           A0=
+#define LLVOID             
+
+#define KINT            
+#define KVOID
+/* KSTRING copies the string into the position provided by the caller. */
+#ifdef vmsFortran
+#define KSTRING                                                                \
+ memcpy(AS->dsc$a_pointer,A0, PGSMIN(AS->dsc$w_length,(A0==NULL?0:strlen(A0))) ); \
+ AS->dsc$w_length>(A0==NULL?0:strlen(A0))?                                     \
+  memset(AS->dsc$a_pointer+(A0==NULL?0:strlen(A0)),' ',                        \
+         AS->dsc$w_length-(A0==NULL?0:strlen(A0))):0;
+#else
+#ifdef CRAYFortran
+#define KSTRING                                                                \
+ memcpy(_fcdtocp(AS),A0, PGSMIN(_fcdlen(AS),(A0==NULL?0:strlen(A0))) );           \
+ _fcdlen(AS)>(A0==NULL?0:strlen(A0))?                                          \
+  memset(_fcdtocp(AS)+(A0==NULL?0:strlen(A0)),' ',                             \
+         _fcdlen(AS)-(A0==NULL?0:strlen(A0))):0;
+#else
+#define KSTRING          memcpy(AS,A0, PGSMIN(D0,(A0==NULL?0:strlen(A0))) );      \
+                 D0>(A0==NULL?0:strlen(A0))?memset(AS+(A0==NULL?0:strlen(A0)), \
+                                            ' ', D0-(A0==NULL?0:strlen(A0))):0;
+#endif
+#endif
+
+/* Note that K.. and I.. can't be combined since K.. has to access data before
+R.., in order for functions returning strings which are also passed in as
+arguments to work correctly. Note that R.. frees and hence may corrupt the
+string. */
+#define IBYTE          return A0;
+#define IDOUBLE        return A0;
+#ifndef sunFortran
+#define IFLOAT         return A0;
+#else
+#define IFLOAT         RETURNFLOAT(A0);
+#endif
+#define IINT           return A0;
+#define ILOGICAL       return C2FLOGICAL(A0);
+#define ILONG          return A0;
+#define ISHORT         return A0;
+#define ISTRING        return   ;
+#define IVOID          return   ;
+
+#ifdef OLD_VAXC                                  /* Allow %CC-I-PARAMNOTUSED. */
+#pragma standard
+#endif
+
+#define FCALLSCSUB0( CN,UN,LN)             FCALLSCFUN0(VOID,CN,UN,LN)
+#define FCALLSCSUB1( CN,UN,LN,T1)          FCALLSCFUN1(VOID,CN,UN,LN,T1)
+#define FCALLSCSUB2( CN,UN,LN,T1,T2)       FCALLSCFUN2(VOID,CN,UN,LN,T1,T2)
+#define FCALLSCSUB3( CN,UN,LN,T1,T2,T3)    FCALLSCFUN3(VOID,CN,UN,LN,T1,T2,T3)
+#define FCALLSCSUB4( CN,UN,LN,T1,T2,T3,T4) FCALLSCFUN4(VOID,CN,UN,LN,T1,T2,T3,T4)
+#define FCALLSCSUB5( CN,UN,LN,T1,T2,T3,T4,T5)                \
+    FCALLSCFUN5(VOID,CN,UN,LN,T1,T2,T3,T4,T5)
+#define FCALLSCSUB6( CN,UN,LN,T1,T2,T3,T4,T5,T6)             \
+    FCALLSCFUN6(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6)       
+#define FCALLSCSUB7( CN,UN,LN,T1,T2,T3,T4,T5,T6,T7)          \
+    FCALLSCFUN7(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7)
+#define FCALLSCSUB8( CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8)       \
+    FCALLSCFUN8(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8)
+#define FCALLSCSUB9( CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9)    \
+    FCALLSCFUN9(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9)
+#define FCALLSCSUB10(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA) \
+   FCALLSCFUN10(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA)
+#define FCALLSCSUB11(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB)	            \
+   FCALLSCFUN11(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB)
+#define FCALLSCSUB12(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC)	    \
+   FCALLSCFUN12(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC)
+#define FCALLSCSUB13(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD)	    \
+   FCALLSCFUN13(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD)
+#define FCALLSCSUB14(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE)    \
+   FCALLSCFUN14(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE)
+#define FCALLSCSUB15(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF) \
+   FCALLSCFUN15(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF)
+
+#define FCALLSCFUN1( T0,CN,UN,LN,T1)            \
+        FCALLSCFUN5 (T0,CN,UN,LN,T1,CF_0,CF_0,CF_0,CF_0)
+#define FCALLSCFUN2( T0,CN,UN,LN,T1,T2)         \
+        FCALLSCFUN5 (T0,CN,UN,LN,T1,T2,CF_0,CF_0,CF_0)
+#define FCALLSCFUN3( T0,CN,UN,LN,T1,T2,T3)      \
+        FCALLSCFUN5 (T0,CN,UN,LN,T1,T2,T3,CF_0,CF_0)
+#define FCALLSCFUN4( T0,CN,UN,LN,T1,T2,T3,T4)   \
+        FCALLSCFUN5 (T0,CN,UN,LN,T1,T2,T3,T4,CF_0)
+#define FCALLSCFUN5( T0,CN,UN,LN,T1,T2,T3,T4,T5)\
+        FCALLSCFUN10(T0,CN,UN,LN,T1,T2,T3,T4,T5,CF_0,CF_0,CF_0,CF_0,CF_0)
+#define FCALLSCFUN6( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6)          \
+        FCALLSCFUN10(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,CF_0,CF_0,CF_0,CF_0)
+#define FCALLSCFUN7( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7)       \
+        FCALLSCFUN10(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,CF_0,CF_0,CF_0)
+#define FCALLSCFUN8( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8)    \
+        FCALLSCFUN10(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,CF_0,CF_0)
+#define FCALLSCFUN9( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9) \
+        FCALLSCFUN10(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,CF_0)
+#define FCALLSCFUN10( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA) \
+        FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,CF_0,CF_0,CF_0,CF_0,CF_0)
+#define FCALLSCFUN11( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB) \
+        FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,CF_0,CF_0,CF_0,CF_0)
+#define FCALLSCFUN12( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC) \
+        FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,CF_0,CF_0,CF_0)
+#define FCALLSCFUN13( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD) \
+        FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,CF_0,CF_0)
+#define FCALLSCFUN14( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \
+        FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,CF_0)
+
+#ifndef __CF__KnR
+#define FCALLSCFUN0(T0,CN,UN,LN)                                               \
+FZ##T0(UN,LN)) {_INT(2,UU,T0,A0,0); _INT(0,LL,T0,0,0) CN(); _INT(0,K,T0,0,0) I##T0}
+
+#define FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF)  \
+F##T0(UN,LN) NCF(T1,1,0) NCF(T2,2,1) NCF(T3,3,1) NCF(T4,4,1) NCF(T5,5,1)     \
+               NCF(T6,6,1) NCF(T7,7,1) NCF(T8,8,1) NCF(T9,9,1) NCF(TA,A,1)    \
+           NCF(TB,B,1) NCF(TC,C,1) NCF(TD,D,1) NCF(TE,E,1) NCF(TF,F,1) \
+                        DCF(T1,1) DCF(T2,2) DCF(T3,3) DCF(T4,4) DCF(T5,5)      \
+                        DCF(T6,6) DCF(T7,7) DCF(T8,8) DCF(T9,9) DCF(TA,A)      \
+     DCF(TB,B) DCF(TC,C) DCF(TD,D) DCF(TE,E) DCF(TF,F) )		\
+ {QCF(T1,1) QCF(T2,2) QCF(T3,3) QCF(T4,4) QCF(T5,5)                            \
+  QCF(T6,6) QCF(T7,7) QCF(T8,8) QCF(T9,9) QCF(TA,A) \
+       QCF(TB,B) QCF(TC,C) QCF(TD,D) QCF(TE,E) QCF(TF,F) _INT(2,UU,T0,A0,0);        \
+ _INT(0,LL,T0,0,0) CN(TCF(LN,T1,1,0) TCF(LN,T2,2,1) TCF(LN,T3,3,1) TCF(LN,T4,4,1) \
+      TCF(LN,T5,5,1) TCF(LN,T6,6,1) TCF(LN,T7,7,1) TCF(LN,T8,8,1) TCF(LN,T9,9,1) \
+       TCF(LN,TA,A,1) TCF(LN,TB,B,1)  TCF(LN,TC,C,1) TCF(LN,TD,D,1) TCF(LN,TE,E,1) TCF(LN,TF,F,1));   \
+   _INT(0,K,T0,0,0) RCF(T1,1) RCF(T2,2) RCF(T3,3) RCF(T4,4)  \
+          RCF(T5,5) RCF(T6,6) RCF(T7,7) RCF(T8,8) RCF(T9,9)  RCF(TA,A) \
+   RCF(TB,B) RCF(TC,C) RCF(TD,D) RCF(TE,E) RCF(TF,F) I##T0}
+
+#else
+#define FCALLSCFUN0(T0,CN,UN,LN) FZ##T0(UN,LN)) _INT(0,FF,T0,0,0)            \
+{_INT(2,UU,T0,A0,0); _INT(0,LL,T0,0,0) CN(); _INT(0,K,T0,0,0) I##T0}
+
+#define FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF) \
+F##T0(UN,LN) NNCF(T1,1,0) NNCF(T2,2,1) NNCF(T3,3,1) NNCF(T4,4,1) NNCF(T5,5,1)\
+               NNCF(T6,6,1) NNCF(T7,7,1) NNCF(T8,8,1) NNCF(T9,9,1) \
+    NNCF(TA,A,1) NNCF(TB,B,1) NNCF(TC,C,1) NNCF(TD,D,1) NNCF(TE,E,1) NNCF(TF,F,1) \
+   DDCF(T1,1) DDCF(T2,2) DDCF(T3,3) DDCF(T4,4) DDCF(T5,5)                      \
+   DDCF(T6,6) DDCF(T7,7) DDCF(T8,8) DDCF(T9,9)  \
+  DDCF(TA,A) DDCF(TB,B) DDCF(TC,C) DDCF(TD,D) DDCF(TE,E) DDCF(TF,F)) _INT(0,FF,T0,0,0) \
+ NNNCF(T1,1,0) NNNCF(T2,2,1) NNNCF(T3,3,1) NNNCF(T4,4,1) NNNCF(T5,5,1)         \
+ NNNCF(T6,6,1) NNNCF(T7,7,1) NNNCF(T8,8,1) NNNCF(T9,9,1) \
+ NNNCF(TA,A,1) NNNCF(TB,B,1) NNNCF(TC,C,1) NNNCF(TD,D,1) NNNCF(TE,E,1) NNNCF(TF,F,1)        \
+ DDDCF(T1,1) DDDCF(T2,2) DDDCF(T3,3) DDDCF(T4,4) DDDCF(T5,5)                   \
+ DDDCF(T6,6) DDDCF(T7,7) DDDCF(T8,8) DDDCF(T9,9) \
+     DDDCF(TA,A) DDDCF(TB,B) DDDCF(TC,C) DDDCF(TD,D) DDDCF(TE,E) DDDCF(TF,F); \
+ {QCF(T1,1) QCF(T2,2) QCF(T3,3) QCF(T4,4) QCF(T5,5)                            \
+  QCF(T6,6) QCF(T7,7) QCF(T8,8) QCF(T9,9)  \
+  QCF(TA,A)  QCF(TB,B) QCF(TC,C) QCF(TD,D) QCF(TE,E) QCF(TF,F) _INT(2,UU,T0,A0,0);        \
+ _INT(0,LL,T0,0,0) CN( TCF(LN,T1,1,0) TCF(LN,T2,2,1) TCF(LN,T3,3,1)             \
+                      TCF(LN,T4,4,1) TCF(LN,T5,5,1) TCF(LN,T6,6,1)             \
+       TCF(LN,T7,7,1) TCF(LN,T8,8,1) TCF(LN,T9,9,1) \
+  TCF(LN,TA,A,1) TCF(LN,TB,B,1) TCF(LN,TC,C,1) TCF(LN,TD,D,1) TCF(LN,TE,E,1) TCF(LN,TF,F,1));           \
+ _INT(0,K,T0,0,0) RCF(T1,1) RCF(T2,2) RCF(T3,3) RCF(T4,4) RCF(T5,5)            \
+                  RCF(T6,6) RCF(T7,7) RCF(T8,8) RCF(T9,9)  \
+   RCF(TA,A) RCF(TB,B) RCF(TC,C) RCF(TD,D) RCF(TE,E) RCF(TF,F) I##T0}
+
+#endif
+
+#endif   /* VAX VMS or Ultrix, Mips, CRAY, Sun, Apollo, HP9000, LynxOS, IBMR2.
+            f2c, NAG f90. */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+
+
diff --git a/include/cproj.h b/include/cproj.h
new file mode 100755
index 0000000..769bb1c
--- /dev/null
+++ b/include/cproj.h
@@ -0,0 +1,38 @@
+#include <math.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define PI 	3.141592653589793238
+#define HALF_PI (PI*0.5)
+#define TWO_PI 	(PI*2.0)
+#define EPSLN	1.0e-10
+#define R2D     57.2957795131
+/*
+#define D2R     0.0174532925199
+*/
+#define D2R     1.745329251994328e-2
+#define S2R	4.848136811095359e-6
+
+#define OK	0
+#define ERROR  -1
+#define IN_BREAK -2
+
+/* Misc macros
+  -----------*/
+#define SQUARE(x)           ((x) * (x))   /* x**2 */
+#define CUBE(x)       ((x) * (x) * (x))   /* x**3 */
+#define QUAD(x) ((x) * (x) * (x) * (x))   /* x**4 */
+
+#define GMAX(A, B)      ((A) > (B) ? (A) : (B)) /* assign maximum of a and b */
+#define GMIN(A, B)      ((A) < (B) ? (A) : (B)) /* assign minimum of a and b */
+
+#define IMOD(A, B)      (A) - (((A) / (B)) * (B)) /* Integer mod function */
+
+  /*#include "cproj_prototypes.h"*/ /* causes problem to hdfeos5 clearcase Lastpass build */
+#include "HE5_GctpFunc.h"
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/include/ease.h b/include/ease.h
new file mode 100644
index 0000000..4f5225a
--- /dev/null
+++ b/include/ease.h
@@ -0,0 +1,18 @@
+#ifndef EASE_H_
+#define EASE_H_
+
+#include <math.h>
+#define BCEA_COLS25 1383 /* total number of columns for EASE grid */
+#define BCEA_ROWS25 586  /* total number of rows for EASE grid */
+#define BCEA_CELL_M 25067.525 /* Cell size for EASE grid */
+#define BCEA_RE_M 6371228.0 /* Earth radius used in GCTP projection tools for
+                               Behrmann Cylindrical Equal Area projection */
+#define DEFAULT_BCEA_LTRUESCALE 30.00  /*Latitude of true scale in DMS */
+#define BCEA_COS_PHI1 cos(DEFAULT_BCEA_LTRUESCALE *3.141592653589793238 /180.0)
+#define PI      3.141592653589793238
+#define EASE_GRID_DEFAULT_UPLEFT_LON -180.0
+#define EASE_GRID_DEFAULT_UPLEFT_LAT  86.72
+#define EASE_GRID_DEFAULT_LOWRGT_LON  180.0
+#define EASE_GRID_DEFAULT_LOWRGT_LAT -86.72
+
+#endif  /* #ifndef EASE_H_ */
diff --git a/include/hdfeos5.inc b/include/hdfeos5.inc
new file mode 100644
index 0000000..a6af5e8
--- /dev/null
+++ b/include/hdfeos5.inc
@@ -0,0 +1,411 @@
+! * ==========================================================
+! * File:       hdfeos5.inc
+! * Author:     A. Muslimov, Emergent Technology Services, Inc.
+! * Date:       March 11, 2002
+! * Purpose:    Fortran header file for HDFEOS5 routines
+! * ==========================================================
+! * Contents: 
+! *     HDFEOS5 data type tags
+! *     HDFEOS5 logical constants
+! *     HDFEOS5 file access tags
+! *     HDFEOS5/GCTP library codes   
+! *
+! * ===========================================================
+ 
+!          HDFEOS5  DATA TYPE TAGS 
+!          =======================
+
+           integer   HE5T_NATIVE_INT
+           integer   HE5T_NATIVE_UINT
+           integer   HE5T_NATIVE_SHORT
+           integer   HE5T_NATIVE_USHORT
+           integer   HE5T_NATIVE_SCHAR
+           integer   HE5T_NATIVE_UCHAR
+           integer   HE5T_NATIVE_LONG
+           integer   HE5T_NATIVE_ULONG
+           integer   HE5T_NATIVE_LLONG
+           integer   HE5T_NATIVE_ULLONG
+           integer   HE5T_NATIVE_FLOAT
+           integer   HE5T_NATIVE_REAL
+           integer   HE5T_NATIVE_DOUBLE
+           integer   HE5T_NATIVE_LDOUBLE
+           integer   HE5T_NATIVE_INT8
+           integer   HE5T_NATIVE_UINT8
+           integer   HE5T_NATIVE_INT16
+           integer   HE5T_NATIVE_UINT16
+           integer   HE5T_NATIVE_INT32
+           integer   HE5T_NATIVE_UINT32
+           integer   HE5T_NATIVE_INT64
+           integer   HE5T_NATIVE_UINT64
+           integer   HE5T_NATIVE_B8
+           integer   HE5T_NATIVE_B16
+           integer   HE5T_NATIVE_B32
+           integer   HE5T_NATIVE_B64
+           integer   HE5T_NATIVE_HSIZE
+           integer   HE5T_NATIVE_HERR
+           integer   HE5T_NATIVE_HBOOL
+
+           integer   HE5T_STD_I8BE
+           integer   HE5T_STD_I8LE
+           integer   HE5T_STD_I16BE
+           integer   HE5T_STD_I16LE
+           integer   HE5T_STD_I32BE
+           integer   HE5T_STD_I32LE
+           integer   HE5T_STD_I64BE
+           integer   HE5T_STD_I64LE
+           integer   HE5T_STD_U8BE
+           integer   HE5T_STD_U8LE
+           integer   HE5T_STD_U16BE
+           integer   HE5T_STD_U16LE
+           integer   HE5T_STD_U32BE
+           integer   HE5T_STD_U32LE
+           integer   HE5T_STD_U64BE
+           integer   HE5T_STD_U64LE
+           integer   HE5T_STD_B8BE
+           integer   HE5T_STD_B8LE
+           integer   HE5T_STD_B16BE
+           integer   HE5T_STD_B16LE
+           integer   HE5T_STD_B32BE
+           integer   HE5T_STD_B32LE
+           integer   HE5T_STD_B64BE
+           integer   HE5T_STD_B64LE
+
+           integer   HE5T_IEEE_F32BE                      
+           integer   HE5T_IEEE_F32LE                      
+           integer   HE5T_IEEE_F64BE                      
+           integer   HE5T_IEEE_F64LE                      
+           integer   HE5T_NATIVE_CHAR
+           integer   HE5T_CHARSTRING
+
+           parameter(HE5T_NATIVE_INT      = 0)
+           parameter(HE5T_NATIVE_UINT     = 1)
+           parameter(HE5T_NATIVE_SHORT    = 2)
+           parameter(HE5T_NATIVE_USHORT   = 3)
+           parameter(HE5T_NATIVE_SCHAR    = 4)
+           parameter(HE5T_NATIVE_UCHAR    = 5)
+           parameter(HE5T_NATIVE_LONG     = 6)
+           parameter(HE5T_NATIVE_ULONG    = 7)
+           parameter(HE5T_NATIVE_LLONG    = 8)
+           parameter(HE5T_NATIVE_ULLONG   = 9)
+           parameter(HE5T_NATIVE_FLOAT    =10)
+           parameter(HE5T_NATIVE_REAL     =10)
+           parameter(HE5T_NATIVE_DOUBLE   =11)
+           parameter(HE5T_NATIVE_LDOUBLE  =12)
+           parameter(HE5T_NATIVE_INT8     =13)
+           parameter(HE5T_NATIVE_UINT8    =14)
+           parameter(HE5T_NATIVE_INT16    =15)
+           parameter(HE5T_NATIVE_UINT16   =16)
+           parameter(HE5T_NATIVE_INT32    =17)
+           parameter(HE5T_NATIVE_UINT32   =18)
+           parameter(HE5T_NATIVE_INT64    =19)
+           parameter(HE5T_NATIVE_UINT64   =20)
+           parameter(HE5T_NATIVE_B8       =21)
+           parameter(HE5T_NATIVE_B16      =22)
+           parameter(HE5T_NATIVE_B32      =23)
+           parameter(HE5T_NATIVE_B64      =24)
+           parameter(HE5T_NATIVE_HSIZE    =25)
+           parameter(HE5T_NATIVE_HERR     =26)
+           parameter(HE5T_NATIVE_HBOOL    =27)
+
+           parameter(HE5T_STD_I8BE        =28)
+           parameter(HE5T_STD_I8LE        =29)
+           parameter(HE5T_STD_I16BE       =30)
+           parameter(HE5T_STD_I16LE       =31)
+           parameter(HE5T_STD_I32BE       =32)
+           parameter(HE5T_STD_I32LE       =33)
+           parameter(HE5T_STD_I64BE       =34)
+           parameter(HE5T_STD_I64LE       =35)
+           parameter(HE5T_STD_U8BE        =36)
+           parameter(HE5T_STD_U8LE        =37)
+           parameter(HE5T_STD_U16BE       =38)
+           parameter(HE5T_STD_U16LE       =39)
+           parameter(HE5T_STD_U32BE       =40)
+           parameter(HE5T_STD_U32LE       =41)
+           parameter(HE5T_STD_U64BE       =42)
+           parameter(HE5T_STD_U64LE       =43)
+           parameter(HE5T_STD_B8BE        =44)
+           parameter(HE5T_STD_B8LE        =45)
+           parameter(HE5T_STD_B16BE       =46)
+           parameter(HE5T_STD_B16LE       =47)
+           parameter(HE5T_STD_B32BE       =48)
+           parameter(HE5T_STD_B32LE       =49)
+           parameter(HE5T_STD_B64BE       =50)
+           parameter(HE5T_STD_B64LE       =51)
+
+           parameter(HE5T_IEEE_F32BE      =52)                
+           parameter(HE5T_IEEE_F32LE      =53)                
+           parameter(HE5T_IEEE_F64BE      =54)                
+           parameter(HE5T_IEEE_F64LE      =55)                
+
+           parameter(HE5T_NATIVE_CHAR     =56)                
+           parameter(HE5T_CHARSTRING      =57)
+
+           integer   HE5S_UNLIMITED_F
+           parameter(HE5S_UNLIMITED_F = -1)
+
+
+!          HDFEOS5 FILE ACCESS TAGS 
+!          ========================
+ 
+           integer   HE5F_ACC_RDWR
+           integer   HE5F_ACC_RDONLY
+           integer   HE5F_ACC_TRUNC
+
+           parameter(HE5F_ACC_RDWR   = 100)
+           parameter(HE5F_ACC_RDONLY = 101)
+           parameter(HE5F_ACC_TRUNC  = 102)
+
+!          TOOLKIT FILE ACCESS TAGS 
+!          ========================
+ 
+           integer   HDF4_ACC_RDONLY
+           integer   HDF4_ACC_RDWR
+           integer   HDF4_ACC_CREATE
+
+           integer   HDF5_ACC_RDONLY
+           integer   HDF5_ACC_RDWR
+           integer   HDF5_ACC_CREATE
+
+           parameter(HDF4_ACC_RDONLY = 1)
+           parameter(HDF4_ACC_RDWR   = 3)
+           parameter(HDF4_ACC_CREATE = 4)
+
+           parameter(HDF5_ACC_RDONLY = 11)
+           parameter(HDF5_ACC_RDWR   = 13)
+           parameter(HDF5_ACC_CREATE = 14)
+
+
+!          HDFEOS5  MERGE CODES 
+!          ====================
+
+           integer HE5_HDFE_NOMERGE
+           integer HE5_HDFE_AUTOMERGE
+
+           parameter(HE5_HDFE_NOMERGE   =0)
+           parameter(HE5_HDFE_AUTOMERGE =1)
+ 
+!          HDFEOS5 XXentries CODES 
+!          =======================
+
+           integer HE5_HDFE_NENTDIM
+           integer HE5_HDFE_NENTMAP
+           integer HE5_HDFE_NENTIMAP
+           integer HE5_HDFE_NENTGFLD
+           integer HE5_HDFE_NENTDFLD
+
+           parameter(HE5_HDFE_NENTDIM  =0)
+           parameter(HE5_HDFE_NENTMAP  =1)
+           parameter(HE5_HDFE_NENTIMAP =2)
+           parameter(HE5_HDFE_NENTGFLD =3)
+           parameter(HE5_HDFE_NENTDFLD =4)
+
+!          HDFEOS5 ANGLE CONVERSION CODES 
+!          ==============================
+
+           integer HE5_HDFE_RAD_DEG    
+           integer HE5_HDFE_DEG_RAD    
+           integer HE5_HDFE_DMS_DEG    
+           integer HE5_HDFE_DEG_DMS    
+           integer HE5_HDFE_RAD_DMS    
+           integer HE5_HDFE_DMS_RAD    
+
+           parameter(HE5_HDFE_RAD_DEG =0)
+           parameter(HE5_HDFE_DEG_RAD =1)
+           parameter(HE5_HDFE_DMS_DEG =2)
+           parameter(HE5_HDFE_DEG_DMS =3)
+           parameter(HE5_HDFE_RAD_DMS =4)
+           parameter(HE5_HDFE_DMS_RAD =5)
+
+
+!          HDFEOS5 SWATH SUBSET CODES 
+!          ==========================
+ 
+           integer HE5_HDFE_MIDPOINT 
+           integer HE5_HDFE_ENDPOINT 
+           integer HE5_HDFE_ANYPOINT 
+           integer HE5_HDFE_INTERNAL 
+           integer HE5_HDFE_EXTERNAL 
+           integer HE5_HDFE_NOPREVSUB
+
+           parameter(HE5_HDFE_MIDPOINT  =0) 
+           parameter(HE5_HDFE_ENDPOINT  =1) 
+           parameter(HE5_HDFE_ANYPOINT  =2) 
+           parameter(HE5_HDFE_INTERNAL  =0) 
+           parameter(HE5_HDFE_EXTERNAL  =1) 
+           parameter(HE5_HDFE_NOPREVSUB =-1) 
+
+
+!          HDFEOS5 GRID ORIGIN CODES 
+!          =========================
+
+           integer HE5_HDFE_GD_UL    
+           integer HE5_HDFE_GD_UR    
+           integer HE5_HDFE_GD_LL    
+           integer HE5_HDFE_GD_LR    
+ 
+           parameter(HE5_HDFE_GD_UL  =0) 
+           parameter(HE5_HDFE_GD_UR  =1) 
+           parameter(HE5_HDFE_GD_LL  =2) 
+           parameter(HE5_HDFE_GD_LR  =3) 
+
+
+!          HDFEOS5 PIXEL REGISTRATION CODES 
+!          ================================
+
+           integer HE5_HDFE_CENTER     
+           integer HE5_HDFE_CORNER     
+ 
+           parameter(HE5_HDFE_CENTER  =0)
+           parameter(HE5_HDFE_CORNER  =1)
+
+!          HDFEOS5 GCTP PROJECTION CODES 
+!          =============================
+
+           integer HE5_GCTP_GEO      
+           integer HE5_GCTP_UTM      
+           integer HE5_GCTP_SPCS     
+           integer HE5_GCTP_ALBERS   
+           integer HE5_GCTP_LAMCC     
+           integer HE5_GCTP_MERCAT    
+           integer HE5_GCTP_PS        
+           integer HE5_GCTP_POLYC     
+           integer HE5_GCTP_EQUIDC    
+           integer HE5_GCTP_TM        
+           integer HE5_GCTP_STEREO    
+           integer HE5_GCTP_LAMAZ     
+           integer HE5_GCTP_AZMEQD    
+           integer HE5_GCTP_GNOMON    
+           integer HE5_GCTP_ORTHO     
+           integer HE5_GCTP_GVNSP     
+           integer HE5_GCTP_SNSOID    
+           integer HE5_GCTP_EQRECT    
+           integer HE5_GCTP_MILLER    
+           integer HE5_GCTP_VGRINT    
+           integer HE5_GCTP_HOM       
+           integer HE5_GCTP_ROBIN     
+           integer HE5_GCTP_SOM       
+           integer HE5_GCTP_ALASKA    
+           integer HE5_GCTP_GOOD      
+           integer HE5_GCTP_MOLL      
+           integer HE5_GCTP_IMOLL     
+           integer HE5_GCTP_HAMMER    
+           integer HE5_GCTP_WAGIV     
+           integer HE5_GCTP_WAGVII    
+           integer HE5_GCTP_OBLEQA    
+           integer HE5_GCTP_ISINUS    
+
+           parameter(HE5_GCTP_GEO      =0)
+           parameter(HE5_GCTP_UTM      =1)
+           parameter(HE5_GCTP_SPCS     =2)
+           parameter(HE5_GCTP_ALBERS   =3)
+           parameter(HE5_GCTP_LAMCC    =4)
+           parameter(HE5_GCTP_MERCAT   =5)
+           parameter(HE5_GCTP_PS       =6)
+           parameter(HE5_GCTP_POLYC    =7)
+           parameter(HE5_GCTP_EQUIDC   =8)
+           parameter(HE5_GCTP_TM       =9)
+           parameter(HE5_GCTP_STEREO   =10)
+           parameter(HE5_GCTP_LAMAZ    =11)
+           parameter(HE5_GCTP_AZMEQD   =12)
+           parameter(HE5_GCTP_GNOMON   =13)
+           parameter(HE5_GCTP_ORTHO    =14)
+           parameter(HE5_GCTP_GVNSP    =15)
+           parameter(HE5_GCTP_SNSOID   =16)
+           parameter(HE5_GCTP_EQRECT   =17)
+           parameter(HE5_GCTP_MILLER   =18)
+           parameter(HE5_GCTP_VGRINT   =19)
+           parameter(HE5_GCTP_HOM      =20)
+           parameter(HE5_GCTP_ROBIN    =21)
+           parameter(HE5_GCTP_SOM      =22)
+           parameter(HE5_GCTP_ALASKA   =23)
+           parameter(HE5_GCTP_GOOD     =24)
+           parameter(HE5_GCTP_MOLL     =25)
+           parameter(HE5_GCTP_IMOLL    =26)
+           parameter(HE5_GCTP_HAMMER   =27)
+           parameter(HE5_GCTP_WAGIV    =28)
+           parameter(HE5_GCTP_WAGVII   =29)
+           parameter(HE5_GCTP_OBLEQA   =30)
+           parameter(HE5_GCTP_ISINUS   =99)
+ 
+ 
+!          HDFEOS5 TILIND/COMPRESSION CODES 
+!          ================================
+
+           integer HE5_HDFE_NOTILE       
+           integer HE5_HDFE_TILE         
+           integer HE5_HDFE_COMP_NONE    
+           integer HE5_HDFE_COMP_RLE     
+           integer HE5_HDFE_COMP_NBIT    
+           integer HE5_HDFE_COMP_SKPHUFF 
+           integer HE5_HDFE_COMP_DEFLATE 
+           integer HE5_HDFE_COMP_SZIP_CHIP
+           integer HE5_HDFE_COMP_SZIP_K13
+           integer HE5_HDFE_COMP_SZIP_EC
+           integer HE5_HDFE_COMP_SZIP_NN
+           integer HE5_HDFE_COMP_SZIP_K13orEC
+           integer HE5_HDFE_COMP_SZIP_K13orNN
+           integer HE5_HDFE_COMP_SHUF_DEFLATE
+           integer HE5_HDFE_COMP_SHUF_SZIP_CHIP
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13
+           integer HE5_HDFE_COMP_SHUF_SZIP_EC
+           integer HE5_HDFE_COMP_SHUF_SZIP_NN
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13orEC
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13orNN
+
+           parameter(HE5_HDFE_NOTILE                 =0)
+           parameter(HE5_HDFE_TILE                   =1)
+           parameter(HE5_HDFE_COMP_NONE              =0)
+           parameter(HE5_HDFE_COMP_RLE               =1)
+           parameter(HE5_HDFE_COMP_NBIT              =2)
+           parameter(HE5_HDFE_COMP_SKPHUFF           =3)
+           parameter(HE5_HDFE_COMP_DEFLATE           =4)
+           parameter(HE5_HDFE_COMP_SZIP_CHIP         =5)
+           parameter(HE5_HDFE_COMP_SZIP_K13          =6)
+           parameter(HE5_HDFE_COMP_SZIP_EC           =7)
+           parameter(HE5_HDFE_COMP_SZIP_NN           =8)
+           parameter(HE5_HDFE_COMP_SZIP_K13orEC      =9)
+           parameter(HE5_HDFE_COMP_SZIP_K13orNN      =10)
+           parameter(HE5_HDFE_COMP_SHUF_DEFLATE      =11)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_CHIP    =12)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13     =13)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_EC      =14)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_NN      =15)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orEC =16)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orNN =17)
+ 
+!          HDFEOS5 GROUP CODES 
+!          ===================
+
+           integer HE5_HDFE_GEOGROUP        
+           integer HE5_HDFE_DATAGROUP       
+           integer HE5_HDFE_ATTRGROUP       
+           integer HE5_HDFE_GRPATTRGROUP    
+           integer HE5_HDFE_LOCATTRGROUP    
+           integer HE5_HDFE_PROFGROUP       
+           integer HE5_HDFE_PROFGRPATTRGROUP
+           integer HE5_HDFE_GEOGRPATTRGROUP
+
+           parameter(HE5_HDFE_GEOGROUP       =0)
+           parameter(HE5_HDFE_DATAGROUP      =1)
+           parameter(HE5_HDFE_ATTRGROUP      =2)
+           parameter(HE5_HDFE_GRPATTRGROUP   =3)
+           parameter(HE5_HDFE_LOCATTRGROUP   =4)
+           parameter(HE5_HDFE_PROFGROUP      =5)
+           parameter(HE5_HDFE_PROFGRPATTRGROUP =6)
+           parameter(HE5_HDFE_GEOGRPATTRGROUP =7)
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/include/hdfeos5_64.inc b/include/hdfeos5_64.inc
new file mode 100644
index 0000000..cb8be09
--- /dev/null
+++ b/include/hdfeos5_64.inc
@@ -0,0 +1,16 @@
+! * ==========================================================
+! * File:       hdfeos5_64.inc
+! * Author:     A. Muslimov, Emergent Technology Services, Inc.
+! * Date:       March 19, 2002
+! * Purpose:    Fortran header file for HDFEOS5 routines on 64
+! *              bit platforms
+! * ==========================================================
+! * Contents: 
+! *
+! *
+! * ===========================================================
+ 
+
+           integer*8 HE5S_UNLIMITED_F_64
+
+           parameter(HE5S_UNLIMITED_F_64 = -1)
diff --git a/include/isin.h b/include/isin.h
new file mode 100755
index 0000000..94f6224
--- /dev/null
+++ b/include/isin.h
@@ -0,0 +1,108 @@
+/******************************************************************************
+NAME                                ISIN.H
+
+PURPOSE:    Integerized Sinusoidal Library Header - constants, data 
+            structures and prototypes for integerized sinusoidal library 
+            functions.
+
+PROGRAMMER                DATE          REASON
+----------                ----          ------
+Robert Wolfe (STX)        1-2-97        Initial version.
+Raj Gejjagaraguppe (ARC)  1-15-97       Modified the code to work with
+                                        GCTP software.
+ 
+D*****************************************************************************/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Status returned */
+
+#define ISIN_SUCCESS 0    /* Successful return */
+#define ISIN_ERROR -1	  /* Error return */
+#define ISIN_ERANGE -2	  /* Input variable out of range */
+
+/* Data Structures */
+
+/* Row Type; Information for Eash Row (longitudinal band) in Projection */
+
+typedef struct {
+  long ncol;              /* Number of columns */
+  long icol_cen;          /* Column number to left of center of grid */
+  double ncol_inv;        /* Number of columns inverse */
+} Isin_row_t;
+
+/* Handle Type; Values assigned in 'Isin_init' */
+
+typedef struct {
+  double false_east;	  /* Northing at projection origin */
+  double false_north;	  /* Easting at projection origin */
+  double sphere;	  /* Sphere radius (user's units) */
+  double sphere_inv;	  /* Sphere radius inverse (user's units) */
+  double ang_size_inv;	  /* Grid angular resolution inverse (1/rad)*/
+  long nrow;		  /* Number of rows (longitudinal zones) */
+  long nrow_half;	  /* Half of number of rows (longitudinal zones)*/
+  double ref_lon;	  /* Zero reference longitude (rad) */
+  double lon_cen_mer;	  /* Longitude of central meridian (rad) */
+  int ijustify;		  /* Justify flag (see Isin_init) */
+  double col_dist;	  /* Distance for one column in projection 
+  			   * (user's units) */
+  double col_dist_inv;	  /* Distance for one column in projection inverse
+  			   * (user's units) */
+  Isin_row_t *row;	  /* Row data structure */
+  long key;		  /* Data structure key */
+} Isin_t;
+
+
+/* Error Structure */
+ 
+typedef struct {
+  int num;             /* Error number */
+  char *str;           /* Error message */
+} error_t;
+ 
+
+/* Prototypes */
+ 
+/* Initialize integerized sinusoidal forward transformations */
+ 
+long isinusforinit(double , double, double, double, double, double); 
+ 
+Isin_t *Isin_for_init(double , double, double, double, long, int); 
+
+/* Initialize integerized sinusoidal inverse transformations */
+
+long isinusinvinit(double , double, double, double, double, double);
+
+Isin_t *Isin_inv_init(double , double, double, double, long, int);
+
+/* Forward mapping; converts geographic coordinates ('lon', 'lat')
+ * to map projection coordinates ('x', 'y') */
+
+long isinusfor(double, double, double *, double *);
+ 
+int Isin_fwd(const Isin_t *, double, double, double *, double *); 
+
+/* Inverse mapping; converts map projection coordinates ('x', 'y') to
+ * geographic coordinates ('lon', 'lat') */
+
+long isinusinv(double, double, double *, double *);
+ 
+int Isin_inv(const Isin_t *, double, double, double *, double *); 
+
+/* Deallocate the 'isin' data structure and array memory */
+
+int Isin_for_free(Isin_t *);
+
+int Isin_inv_free(Isin_t *);
+
+/* Private function to handle errors */
+
+static int Isin_error(const error_t *, const char *);
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/include/proj.h b/include/proj.h
new file mode 100755
index 0000000..bd34286
--- /dev/null
+++ b/include/proj.h
@@ -0,0 +1,93 @@
+/*
+   0 = Geographic
+   1 = Universal Transverse Mercator (UTM)
+   2 = State Plane Coordinates
+   3 = Albers Conical Equal Area
+   4 = Lambert Conformal Conic
+   5 = Mercator
+   6 = Polar Stereographic
+   7 = Polyconic
+   8 = Equidistant Conic
+   9 = Transverse Mercator
+  10 = Stereographic
+  11 = Lambert Azimuthal Equal Area
+  12 = Azimuthal Equidistant
+  13 = Gnomonic
+  14 = Orthographic
+  15 = General Vertical Near-Side Perspective
+  16 = Sinusiodal
+  17 = Equirectangular
+  18 = Miller Cylindrical
+  19 = Van der Grinten
+  20 = (Hotine) Oblique Mercator 
+  21 = Robinson
+  22 = Space Oblique Mercator (SOM)
+  23 = Alaska Conformal
+  24 = Interrupted Goode Homolosine 
+  25 = Mollweide
+  26 = Interrupted Mollweide
+  27 = Hammer
+  28 = Wagner IV
+  29 = Wagner VII
+  30 = Oblated Equal Area
+  31 = Integerized Sinusoidal Grid (the same as 99)
+  97 = Cylindrical Equal Area (Grid corners set in meters for EASE grid) 
+  98 = Cylindrical Equal Area (Grid corners set in DMS degs for EASE grid) 
+  99 = Integerized Sinusoidal Grid (added by Raj Gejjagaraguppe ARC for MODIS) 
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif 
+
+#define GEO 0
+#define UTM 1
+#define SPCS 2
+#define ALBERS 3
+#define LAMCC 4
+#define MERCAT 5
+#define PS 6
+#define POLYC 7
+#define EQUIDC 8
+#define TM 9
+#define STEREO 10
+#define LAMAZ 11
+#define AZMEQD 12
+#define GNOMON 13
+#define ORTHO 14
+#define GVNSP 15
+#define SNSOID 16
+#define EQRECT 17
+#define MILLER 18
+#define VGRINT 19
+#define HOM 20
+#define ROBIN 21
+#define SOM 22
+#define ALASKA 23
+#define GOODE 24
+#define MOLL 25
+#define IMOLL 26
+#define HAMMER 27
+#define WAGIV 28
+#define WAGVII 29
+#define OBEQA 30
+#define ISINUS1 31
+#define CEA 97
+#define BCEA 98
+#define ISINUS 99
+
+#define IN_BREAK -2
+#define COEFCT 15		/*  projection coefficient count	     */
+#define PROJCT 31		/*  projection count			     */
+#define DATMCT 20		/*  datum count				     */
+
+#define MAXPROJ 100 		/*  Maximum projection number */
+#define MAXUNIT 5		/*  Maximum unit code number */
+#define GEO_TERM 0		/*  Array index for print-to-term flag */
+#define GEO_FILE 1		/*  Array index for print-to-file flag */
+#define GEO_TRUE 1		/*  True value for geometric true/false flags */
+#define GEO_FALSE -1		/*  False val for geometric true/false flags */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/include/tutils.h b/include/tutils.h
new file mode 100644
index 0000000..72e8033
--- /dev/null
+++ b/include/tutils.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+ * NCSA HDF                                                                 *
+ * Software Development Group                                               *
+ * National Center for Supercomputing Applications                          *
+ * University of Illinois at Urbana-Champaign                               *
+ * 605 E. Springfield, Champaign IL 61820                                   *
+ *                                                                          *
+ * For conditions of distribution and use, see the accompanying             *
+ * hdf/COPYING file.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/* tutils.h,v 1.12 1995/10/05 16:17:28 koziol Exp */
+
+#ifndef _TUTILS_H
+#define _TUTILS_H
+
+/* Define these for use in all the tests */
+#ifndef TESTMASTER
+extern
+#endif
+int         num_errs
+#ifdef TESTMASTER
+= 0
+#endif
+,           Verbosity
+#ifdef TESTMASTER
+= 0
+#endif
+           ;
+
+#ifdef TEST_PC
+#define FAR far
+#else
+#ifndef FAR
+#define FAR     /* */
+#endif /* FAR */
+#endif /* TEST_PC */
+
+/* Use %ld to print the value because long could cover most cases. */
+/* Used to make certain a return value _is_not_ a value */
+#define CHECK(ret, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s returned %ld \n",where,(int)__LINE__,__FILE__,(long)ret);\
+if(ret == val) {printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", where, (long)ret, (int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+/* Used to make certain a return value _is_ a value */
+#define VERIFY(x, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s had value %ld \n",where,(int)__LINE__,__FILE__,(long)x);\
+if(x != val) {printf("*** UNEXPECTED VALUE from %s is %ld at line %4d in %s\n", where, (long)x,(int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+#define RESULT(a) \
+do { \
+if (Verbosity>8) printf("   Call to HDF routine: %15s at line %4d in %s returned %ld \n",a,(int)__LINE__,__FILE__,(long)ret); \
+if (Verbosity>9) HEprint(stdout,0); \
+if(ret == FAIL) {printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", a, (long)ret,(int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+#define MESSAGE(v,a) {if (Verbosity>=v) {a}}
+
+#endif /* _TUTILS_H */
diff --git a/lib/tmp/geolibCYGWIN.a b/lib/tmp/geolibCYGWIN.a
new file mode 100644
index 0000000..5d8f19f
Binary files /dev/null and b/lib/tmp/geolibCYGWIN.a differ
diff --git a/lib/tmp/geolibDEC.a b/lib/tmp/geolibDEC.a
new file mode 100755
index 0000000..42bc2f5
Binary files /dev/null and b/lib/tmp/geolibDEC.a differ
diff --git a/lib/tmp/geolibHP.a b/lib/tmp/geolibHP.a
new file mode 100755
index 0000000..7e5c764
Binary files /dev/null and b/lib/tmp/geolibHP.a differ
diff --git a/lib/tmp/geolibHP11.a b/lib/tmp/geolibHP11.a
new file mode 100644
index 0000000..a638fd6
Binary files /dev/null and b/lib/tmp/geolibHP11.a differ
diff --git a/lib/tmp/geolibIBM.a b/lib/tmp/geolibIBM.a
new file mode 100755
index 0000000..e1c40f9
Binary files /dev/null and b/lib/tmp/geolibIBM.a differ
diff --git a/lib/tmp/geolibIRIX53.a b/lib/tmp/geolibIRIX53.a
new file mode 100755
index 0000000..7e0a2b0
Binary files /dev/null and b/lib/tmp/geolibIRIX53.a differ
diff --git a/lib/tmp/geolibIRIX62-64.a b/lib/tmp/geolibIRIX62-64.a
new file mode 100755
index 0000000..ce0328c
Binary files /dev/null and b/lib/tmp/geolibIRIX62-64.a differ
diff --git a/lib/tmp/geolibIRIX62-64mips3.a b/lib/tmp/geolibIRIX62-64mips3.a
new file mode 100755
index 0000000..605a41a
Binary files /dev/null and b/lib/tmp/geolibIRIX62-64mips3.a differ
diff --git a/lib/tmp/geolibIRIX62-n32.a b/lib/tmp/geolibIRIX62-n32.a
new file mode 100755
index 0000000..2fa42ea
Binary files /dev/null and b/lib/tmp/geolibIRIX62-n32.a differ
diff --git a/lib/tmp/geolibIRIX65-64.a b/lib/tmp/geolibIRIX65-64.a
new file mode 100644
index 0000000..42decac
Binary files /dev/null and b/lib/tmp/geolibIRIX65-64.a differ
diff --git a/lib/tmp/geolibIRIX65-n32.a b/lib/tmp/geolibIRIX65-n32.a
new file mode 100644
index 0000000..ee5280a
Binary files /dev/null and b/lib/tmp/geolibIRIX65-n32.a differ
diff --git a/lib/tmp/geolibLINUX.a b/lib/tmp/geolibLINUX.a
new file mode 100755
index 0000000..1b464cf
Binary files /dev/null and b/lib/tmp/geolibLINUX.a differ
diff --git a/lib/tmp/geolibLINUX64.a b/lib/tmp/geolibLINUX64.a
new file mode 100644
index 0000000..348e827
Binary files /dev/null and b/lib/tmp/geolibLINUX64.a differ
diff --git a/lib/tmp/geolibLINUXIA64.a b/lib/tmp/geolibLINUXIA64.a
new file mode 100644
index 0000000..c4dcf59
Binary files /dev/null and b/lib/tmp/geolibLINUXIA64.a differ
diff --git a/lib/tmp/geolibMAC.a b/lib/tmp/geolibMAC.a
new file mode 100644
index 0000000..3d93776
Binary files /dev/null and b/lib/tmp/geolibMAC.a differ
diff --git a/lib/tmp/geolibMACIntel.a b/lib/tmp/geolibMACIntel.a
new file mode 100644
index 0000000..7987244
Binary files /dev/null and b/lib/tmp/geolibMACIntel.a differ
diff --git a/lib/tmp/geolibMACIntel64.a b/lib/tmp/geolibMACIntel64.a
new file mode 100644
index 0000000..374fe4a
Binary files /dev/null and b/lib/tmp/geolibMACIntel64.a differ
diff --git a/lib/tmp/geolibSOL210.a b/lib/tmp/geolibSOL210.a
new file mode 100644
index 0000000..5b6d2ac
Binary files /dev/null and b/lib/tmp/geolibSOL210.a differ
diff --git a/lib/tmp/geolibSOL24.a b/lib/tmp/geolibSOL24.a
new file mode 100755
index 0000000..08df71a
Binary files /dev/null and b/lib/tmp/geolibSOL24.a differ
diff --git a/lib/tmp/geolibSOL28.a b/lib/tmp/geolibSOL28.a
new file mode 100644
index 0000000..08df71a
Binary files /dev/null and b/lib/tmp/geolibSOL28.a differ
diff --git a/lib/tmp/geolibSOL29.a b/lib/tmp/geolibSOL29.a
new file mode 100644
index 0000000..51df1e4
Binary files /dev/null and b/lib/tmp/geolibSOL29.a differ
diff --git a/make/CLSInstall.sh b/make/CLSInstall.sh
new file mode 100755
index 0000000..7d35c83
--- /dev/null
+++ b/make/CLSInstall.sh
@@ -0,0 +1,21 @@
+#!/bin/csh
+ 
+################################################################################
+#
+#  CLS applications
+#
+################################################################################
+ 
+# create the directory structure
+ 
+echo "creating $SUBSYSTOP directory structure ..."
+ 
+mkdir -p $SUBSYSTOP/install/data
+ 
+# copy the data directories into the install data directory
+ 
+echo "copying data into $SUBSYSTOP/install/data directory ..."
+ 
+cp -r $SUBSYSTOP/DESKT/data/* $SUBSYSTOP/install/data
+ 
+
diff --git a/make/Makefile.instr b/make/Makefile.instr
new file mode 100755
index 0000000..30bf2e0
--- /dev/null
+++ b/make/Makefile.instr
@@ -0,0 +1,146 @@
+#########################################################################
+#
+# Name
+#	Makefile.template
+#
+# Purpose
+#
+#	Template makefile for the CSS subsystem. Copy this file to your
+#	directory and follow instructions to create your custom
+#	makefile.
+#	Once you are finished creating the custom makefile. Delete
+#	These instructions.
+#
+##########################################################################
+
+
+
+##############Define CSCI################################################
+## CSCI must be defined before including the options file.
+## CSCI	=   CF
+CSCI	=   
+
+##############Include options file#######################################
+include $(SUBSYSTOP)/make/make.options
+
+
+
+##############CUSTOM DEFINITIONS ########################################
+## Include here any custom definitions for the directory. Note that you
+## may want to use some of these definitions in the later portion of the
+## makefile to define source, header, binary files etc.
+##
+
+
+
+
+##############END OF CUSTOM DEFINITIONS##################################
+
+
+
+##############Define CXXSRCFILES#########################################
+## Define all .cxx files in your directory here. Example below:
+## CXXSRCFILES	= myFile.cxx
+##
+CXXSRCFILES	= 
+
+##############Define CSRCFILES###########################################
+## Define all .c files in your directory here. Example
+## CSRCFILES	= myFile.c
+##
+CSRCFILES	= 
+
+##############Define HFILES##############################################
+## Define all .h files for your directory. Note that these files 
+## go in the include directory for the CSCI. Example
+## HFILES	= $(INCDIR)/myFile.h
+## Note that INCDIR defines the CSCI include directory
+##
+HFILES		= 
+
+
+##############Define OBJFILES############################################
+## Defines object files created in this directory
+## OBJFILES = $(OBJDIR)/myFile.o
+## Note that OBJDIR defines the location for .o files for the CSCI.
+##
+OBJFILES	=
+
+##############Define LIBFILES############################################
+## Defines the libraries you build in your directory. Example:
+## LIBFILES	= $(LIBDIR)/libmylib.a $(LIBDIR)/libmylib.a
+## Note that LIBDIR is the CSCI lib directory
+##
+LIBFILES	=
+
+##############Define BINFILES############################################
+## Defines any executables you build in this directory.
+## BINFILES	= $(BINDIR)/myServer
+##
+BINFILES	=
+
+
+
+
+##############Define build targets#######################################
+## all must be the first target in your makefile. Which would build 
+## the directory. Follow the all definition by the rest of the custom
+## targets and dependency list.
+##
+
+all:	
+
+
+
+
+
+##############End of build target definitions############################
+
+
+
+##############Define variables for targets in the standard file #########
+
+##############CLEANFILES###############################################
+## Defines files to cleanup (delete) for this directory. Please 
+## include names of ONLY the files that you create (derived files).
+## All other files like core etc will be cleanup for you.
+## Include additional files in the following if needed.
+
+CLEANFILES  =	$(OBJFILES) $(LIBFILES) $(BINFILES) 
+
+##############INSTALLFILES#############################################
+## Defines files to be released for the world
+##
+
+## INSHFILES - header files to be released.
+INSHFILES	= $(HFILES)
+
+## Libraries to be released
+INSLIBFILES	= $(LIBFILES)
+
+## Binaries to be released
+INSBINFILES	= $(BINFILES)
+
+##############LABELFILES###############################################
+## DCM needs this target to label all the executables and libraries that
+## are created in the directory. Default definition is provided.
+## Modify if needed.
+
+LABELFILES = $(LIBFILES) $(BINFILES)
+
+
+##############TESTSUBDIRS##############################################
+## Defines all subdirectories that have test driver or unit test code.
+## Do not include the complete path but just the name of the directory.
+## include all test subdirectories.
+
+TESTSUBDIRS	= test
+
+
+##############Include the additional targets file########################
+include $(SUBSYSTOP)/make/make.targets
+
+
+
+
+
diff --git a/make/Makefile.template b/make/Makefile.template
new file mode 100755
index 0000000..f9a212b
--- /dev/null
+++ b/make/Makefile.template
@@ -0,0 +1,73 @@
+## Template Makefile. See instructions in Makefile.instr ##
+ 
+CSCI    =   hdfeos
+ 
+include $(SUBSYSTOP)/make/make.options
+ 
+ 
+##############CUSTOM DEFINITIONS ########################################
+ 
+ 
+##############END OF CUSTOM DEFINITIONS##################################
+ 
+CXXSRCFILES     =
+ 
+CSRCFILES       = EHapi.c SWapi.c GDapi.c PTapi.c TSapi.c ZAapi.c
+ 
+HFILES          = HE5_HdfEosDef.h cfortHdf.h
+ 
+OBJFILES        = EHapi.o SWapi.o GDapi.o PTapi.o TSapi.o ZAapi.o
+ 
+LIBFILES        = $(LIBDIR)/libhe5_hdfeos.a
+ 
+BINFILES        =
+ 
+ 
+all: libhe5_hdfeos.a
+
+libhe5_hdfeos.a:	EHapi.o SWapi.o GDapi.o PTapi.o TSapi.o ZAapi.o
+	${AR} $@ $?
+
+EHapi.o	: EHapi.c
+	${CC} ${INCLUDE} -c EHapi.c -o EHapi.o
+
+SWapi.o	: SWapi.c
+	${CC} ${INCLUDE} -c SWapi.c -o SWapi.o
+	rm SWapi.c
+
+GDapi.o	: GDapi.c
+	${CC} ${INCLUDE} -c GDapi.c -o GDapi.o
+	rm GDapi.c
+
+PTapi.o : PTapi.c
+        ${CC} ${INCLUDE} -c PTapi.c -o PTapi.o
+        rm PTapi.c
+
+TSapi.o	: TSapi.c
+	${CC} ${INCLUDE} -c TSapi.c -o TSapi.o
+	rm TSapi.c
+
+ZAapi.o : ZAapi.c
+        ${CC} ${INCLUDE} -c ZAapi.c -o ZAapi.o
+        rm ZAapi.c
+
+ 
+ 
+ 
+##############End of build target definitions############################
+ 
+ 
+CLEANFILES      = $(OBJFILES) $(LIBFILES) $(BINFILES)
+ 
+INSHFILES       = $(HFILES)
+ 
+INSLIBFILES     = $(LIBFILES)
+ 
+INSBINFILES     =
+ 
+LABELFILES      = $(LIBFILES)
+ 
+TESTSUBDIRS     = test
+ 
+include $(SUBSYSTOP)/make/make.targets
+
diff --git a/make/make.options b/make/make.options
new file mode 100755
index 0000000..acbe802
--- /dev/null
+++ b/make/make.options
@@ -0,0 +1,513 @@
+#########################################################################
+#
+# Name
+#	make.options
+#
+# Purpose
+#
+#	Sets make options for building DM code. All individual makefiles
+#	include this file.
+#
+# Level
+#
+#	CLS Subsystem
+#
+# Input
+#
+#	Variables to be set in the makefile before including this file
+#
+#	CSCI - indicates which CSCI is the makefile part of.
+#
+#	.buildrc must be sourced since variables set by that script
+#	are used in this file.
+#
+# Outputs
+#
+########################################################################
+
+
+###################### SET BUILDTOP BASED ON CSCI #####################
+#
+# Buildtop is the top level directory for the CSCI
+# The makefile must define CSCI before including this file
+#
+#######################################################################
+
+
+BUILDTOP    = $(SUBSYSTOP)/$(CSCI)
+
+
+###################### SET VARIOUS DIRECTORIES #########################
+#
+# THESE DIRECTORIES ARE BASED ON ARCHITECTURE
+#
+########################################################################
+
+
+## LIBDIR is the directory where the DM libraries reside
+LIBDIR		=  $(BUILDTOP)/lib/$(ARCH)
+
+## INCDIR is the directory where the DM include files reside
+INCDIR		= $(BUILDTOP)/include
+
+## BINDIR is the directory where the CSCI executables reside
+BINDIR		= $(BUILDTOP)/bin/$(ARCH)
+
+## SRCDIR is the directory where the CSCI source files reside
+SRCDIR		= $(BUILDTOP)/src
+
+## OBJDIR is the directory where the CSCI object files reside
+OBJDIR		= $(BUILDTOP)/obj/$(ARCH)
+
+## SUBSYSINCDIR is the location for CSCI common header files.
+SUBSYSINCDIR	= $(SUBSYSTOP)/common/include
+
+## ECSINCDIR is the location for ECS common header files (common software)
+ECSINCDIR	= /ecs/include
+
+## SUBSYSLIBDIR is the location for CSCI common library files.
+SUBSYSLIBDIR	= $(SUBSYSTOP)/common/lib/$(ARCH)
+
+## ECSLIBDIR is the location for ECS common library files (common software)
+ECSLIBDIR	= /ecs/lib/$(ARCH)
+
+
+###################### CONFIGURATION DEPENDENCY ########################
+#
+# CR_DEPENDENCIES are the files to be included in the 
+# Configuration Record.
+#
+########################################################################
+
+CR_DEPENDENCIES	= \
+		$(SUBSYSTOP)/.buildrc \
+		$(SUBSYSTOP)/make/.bldhost.$(ARCH) \
+		$(SUBSYSTOP)/make/make.options \
+		./Makefile
+
+
+
+###################### COMMON FLAGS FOR C/C++ ##########################
+#
+# These flags are common for both C and C++ compilation (based on ARCH).
+#
+########################################################################
+
+## PLATFORM_FLAG is used for writing platform specific ecs code (must be 
+## used with caution and justification).
+
+PLATFORM_FLAG_hp	= -DHPUX9X
+PLATFORM_FLAG_sgi	= -DIRIX5X
+PLATFORM_FLAG_sun5	= -DSUNOS5X
+
+PLATFORM_FLAG		= $(PLATFORM_FLAG_$(ARCH))
+
+
+## DEBUG_FLAG specifies whether code is optimized or set for the debugger
+## as well as defining debug flags needed for conditional compilation
+
+DEBUG_FLAG_hp	= -g
+DEBUG_FLAG_sgi	= -g
+DEBUG_FLAG_sun5	= -g
+
+DEBUG_FLAG	= $(DEBUG_FLAG_$(ARCH))
+
+
+## ANSI_FLAG is to specify ANSI compliance
+ANSI_FLAG_hp	    = -Aa +a1 +eh
+ANSI_FLAG_sgi	    = 
+ANSI_FLAG_sun5     = 
+
+ANSI_FLAG	    = $(ANSI_FLAG_$(ARCH))
+
+
+## INCLUDE_PATH is the common include path.
+INCLUDE_PATH		= -I$(SUBSYSINCDIR) -I$(INCDIR) -I$(ECSINCDIR)
+
+## COMMON_FLAGS is a handy macro to include all the flags above
+COMMON_FLAGS	= $(DEBUG_FLAG) $(ANSI_FLAG) $(PLATFORM_FLAG) \
+		    $(INCLUDE_PATH) $(LOCAL_COMMON_FLAGS)
+
+X11_MOTIF_FLAGS_sun5	= -I/opt/SUNWmotif/include \
+			-I/usr/openwin/include -D_REENTRANT -DSYSV
+X11_MOTIF_FLAGS_sgi	= -I/usr/include/X11 -I/usr/include/Xm
+X11_MOTIF_FLAGS_hp	= -I/usr/include/X11R5 \
+			  -I/usr/include/Motif1.2 \
+			  -DHP9000 -D_POSIX_SOURCE \
+			  -D_HPUX_SOURCE -D_REENTRANT \
+			-DMOTIF1_2 -I/usr/include/reentrant
+X11_MOTIF_FLAGS		= $(X11_MOTIF_FLAGS_$(ARCH))
+
+EPAK_FLAGS_sun5		= -I/tools/bx50/epak3/include -I/tools/bx50/epak3/include/X11
+EPAK_FLAGS_sgi		= -I/tools/bx50/epak3/include -I/tools/bx50/epak3/include/X11
+
+EPAK_FLAGS_hp		= -I/tools/bx50/include
+EPAK_FLAGS		= $(EPAK_FLAGS_$(ARCH))
+
+ROGUEWAVE_FLAGS_sun5	=
+ROGUEWAVE_FLAGS_hp	= -I/tools/rogue -DRWDEBUG
+ROGUEWAVE_FLAGS_sgi	= -I/tools/rogue -DRWDEBUG
+ROGUEWAVE_FLAGS		= $(ROGUEWAVE_FLAGS_$(ARCH))
+
+ECS_COMMON_DIR		= /ecs/formal/COMMON
+ECS_COMMON_INC		= -I$(ECS_COMMON_DIR)/include
+
+## COMMON_FLAGS are the flags common for both C source and C++ source.
+LOCAL_COMMON_FLAGS	= -I. $(X11_MOTIF_FLAGS) $(EPAK_FLAGS) $(ROGUEWAVE_FLAGS) \
+				$(ECS_COMMON_INC) -DLOGIN -DFUNCPROTO -DXTFUNCPROTO
+
+
+###################### C COMPILER SETUP ##################################
+#
+# Following flags setup the common options for the C compiler based on ARCH
+#
+##########################################################################
+
+## CC is the name of the C compiler to use
+CC_hp		= cc
+CC_sgi		= cc
+CC_sun5		= cc
+CC		= $(CC_$(ARCH))
+
+
+## CCOMMON_FLAG are other common C flags
+CCOMMON_FLAGS_hp    = -c
+CCOMMON_FLAGS_sgi   = -c
+CCOMMON_FLAGS_sun5  = -c
+
+CCOMMON_FLAGS	    = $(CCOMMON_FLAGS_$(ARCH))
+
+## CFLAGS is a combination of all the above. The applications can include
+## additional CFLAGS in the makefile.
+CFLAGS		    = $(COMMON_FLAGS) $(CCOMMON_FLAGS)
+
+
+###################### C++ COMPILER SETUP ################################
+#
+# Following flags setup the common options for the C++ compiler based on ARCH
+#
+##########################################################################
+
+## CXX is the name of the C++ compiler to use
+CXX_hp		= CC
+CXX_sgi		= CC
+CXX_sun5	= CC
+
+CXX		= $(CXX_$(ARCH))
+
+
+## CXXCOMMON_FLAG are other common C flags
+CXXCOMMON_FLAGS_hp    = -c
+CXXCOMMON_FLAGS_sgi   = -c -x
+CXXCOMMON_FLAGS_sun5  = -c
+
+CXXCOMMON_FLAGS	    = $(CXXCOMMON_FLAGS_$(ARCH))
+
+## CXXFLAGS is a combination of all the above. The applications can include
+## additional CXXFLAGS in the makefile.
+
+CXXFLAGS    = $(TEMPLATE_OPTION) $(COMMON_FLAGS)  $(CXXCOMMON_FLAGS)
+
+
+###################### Library setup #####################################
+#
+# Building libraries etc.
+#
+##########################################################################
+
+
+## AR is the name of the archive utility
+AR_hp	    = ar
+AR_sgi	    = ar
+AR_sun5	    = ar
+
+AR	    = $(AR_$(ARCH))
+
+
+## AR_FLAGS are the flags to use for archive command.
+
+AR_FLAGS_hp	= -r
+AR_FLAGS_sgi	= -r
+AR_FLAGS_sun5	= -r
+
+AR_FLAGS	= $(AR_FLAGS_$(ARCH))
+
+
+
+###################### LINKER SETUP ######################################
+#
+# Following flags setup the common options for the linker
+#
+##########################################################################
+
+
+## LD is the name of the linker to use
+LD_hp		= $(CXX)
+LD_sgi		= $(CXX)
+LD_sun5		= /opt/SUNWspro/bin/CC
+
+LD		= $(LD_$(ARCH))
+
+
+## LIB_PATH is the path for ecs specific libraries
+LIB_PATH		= -L$(SUBSYSLIBDIR) -L$(LIBDIR) -L$(ECSLIBDIR)
+
+## Motif Libraries
+X11_MOTIF_LIB_sun5	= -L/usr/openwin/lib -L/opt/SUNWmotif/lib \
+				-lXm -lXt -lX11 -lnsl -lgen
+X11_MOTIF_LIB_sgi	= -L/usr/lib -lXm -lXt -lX11
+X11_MOTIF_LIB_hp	= -L/usr/lib/Motif1.2 -L/usr/lib/X11R5	\
+				-lXm -lXt -lX11 -lC
+X11_MOTIF_LIB		= $(X11_MOTIF_LIB_$(ARCH))
+
+## EPak Libraries
+EPAK_LIB_sun5		= /tools/bx50/epak3/lib/libEPak.a
+EPAK_LIB_sgi		= /tools/bx50/epak3/lib/libEPak.a
+EPAK_LIB_hp		= /tools/bx50/lib/libXiWidgets.a
+EPAK_LIB		= $(EPAK_LIB_$(ARCH))
+
+## ROGUEWAVE Libraries
+ROGUEWAVE_LIB_sun5	= -lrwtool
+ROGUEWAVE_LIB_sgi	= -L/tools/rogue/lib -lrwtoolg
+ROGUEWAVE_LIB_hp	= -DRW_POSIX_THREADS -L/tools/rogue/lib -lrwtoolg_mteh
+ROGUEWAVE_LIB		= $(ROGUEWAVE_LIB_$(ARCH))
+
+## LDCOMMON_FLAGS are other common flags used
+LDCOMMON_FLAGS_hp	= 
+LDCOMMON_FLAGS_sgi	= -lc
+LDCOMMON_FLAGS_sun5	= -lm -lc
+
+LDCOMMON_FLAGS		= $(LDCOMMON_FLAGS_$(ARCH))
+
+
+## LD_FLAGS are common linker flags
+LD_FLAGS	= $(LIB_PATH) $(EPAK_LIB) $(X11_MOTIF_LIB) $(LDCOMMON_FLAGS) $(ROGUEWAVE_LIB)
+
+
+###################### IDL SETUP #########################################
+#
+# Idl files compilation rules etc (this is for DCE)
+#
+##########################################################################
+
+
+## command for idl compiler
+IDL_hp          = idl
+IDL_sgi		= idl
+IDL_sun5	= idl
+
+IDL		= $(IDL_$(ARCH))
+
+
+## Flags for the idl compiler
+IDL_FLAGS_hp	= -keep c_source
+IDL_FLAGS_sgi	=
+IDL_FLAGS_sun5	= -keep c_source
+
+IDL_FLAGS	= $(IDL_FLAGS_$(ARCH))
+
+
+###################### IDL++ SETUP #######################################
+#
+# Idl files compilation rules etc (this is for OODCE)
+#
+##########################################################################
+
+
+## command for idl++ compiler (not supported on SGI)
+IDLXX_hp	    = idl++
+IDLXX_sun5	    = idl++
+
+IDLXX		    = $(IDLXX_$(ARCH))
+
+
+## Flags for the idl compiler
+IDLXXFLAGS_hp		= -keep source
+IDLXXFLAGS_sun5		= -keep source
+
+IDLXXFLAGS	= $(IDLXXFLAGS_$(ARCH))
+
+
+###################### DCE SETUP #########################################
+#
+# These are popular options for building DCE applications
+#
+##########################################################################
+
+## COMPILER Options
+
+DCECFLAGS_hp	    = -I. -D_POSIX_SOURCE  -D_REENTRANT  +z -q
+DCECFLAGS_sgi	    = -I.
+DCECFLAGS_sun5	    = -I.
+
+
+DCECFLAGS	    = $(DCECFLAGS_$(ARCH))
+
+### Linker options. These to be included before object files
+DCELDFLAGS_hp	    = -Wl,-a,archive_shared
+DCELDFLAGS_sun5	    = 
+DCELDFLAGS_sgi	    = 
+
+DCELDFLAGS	    = $(DCELDFLAGS_$(ARCH))
+
+## Libraries
+DCELIBS_hp	    = -lbb -ldce -lm -lc_r
+DCELIBS_sgi	    =
+DCELIBS_sun5	    = -lnsl -ldce -lsocket -lthread -lm
+
+DCELIBS		    = $(DCELIBS_$(ARCH))
+
+
+###################### OODCE SETUP #######################################
+#
+# These are popular options for building OODCE applications.
+#
+##########################################################################
+
+## C COMPILER Options
+
+OODCECFLAGS_hp	    = -I. -D_POSIX_SOURCE  -D_REENTRANT  +z -q
+OODCECFLAGS_sgi	    =
+OODCECFLAGS_sun5    = -I. -DREENTRANT
+
+
+OODCECFLAGS	    = $(OODCECFLAGS_$(ARCH))
+
+## C++ COMPILER Options
+
+OODCECXXFLAGS_hp	    = -I. -I/usr/include/reentrant +eh \
+				-Dunix -DNIDL_PROTOTYPES -D__STDC__ \
+				-D_HPUX_SOURCE -D_CMA_PROTO_ -D_REENTRANT
+ODCECXXFLAGS_sgi	    =
+OODCECXXFLAGS_sun5	    = -I. -I/opt/SUNWspro/SC3.0.1/include/CC -mt \
+				-Dunix -DNIDL_PROTOTYPES -D_CMA_PROTO_ -DSYSV
+
+OODCECXXFLAGS	    = $(OODCECXXFLAGS_$(ARCH))
+
+### Linker options. These to be included before object files
+OODCELDFLAGS_hp	    = +eh -g -Wl,-aarchive
+OODCELDFLAGS_sgi    =
+OODCELDFLAGS_sun5   =
+
+
+OODCELDFLAGS	    = $(OODCELDFLAGS_$(ARCH))
+
+## Libraries
+OODCELIBS_hp	    = -loodce -lbb -ldce -lm -lc_r
+OODCELIBS_sgi	    =
+OODCELIBS_sun5	    = -loodce -ldce -lthread -lnsl -lsocket -lm -lc
+
+OODCELIBS	    = $(OODCELIBS_$(ARCH))
+
+
+###################### CLEANUP SUPPORT ###################################
+#
+# DEFINE COMMANDS TO DELETE FILES ETC. USED BY THE CLEAN TARGET.
+#
+##########################################################################
+
+DELFILES    =	rm -f
+
+
+###################### Suffix setup and default rules ####################
+#
+# Add ecs specific suffixes and common rules for building object files.
+#
+##########################################################################
+
+
+## Define custom ecs suffixes (.cxx is a c++ source file)
+.SUFFIXES: .cxx .C .cpp .idl $(SUFFIXES)
+
+
+## Define how to convert c++ file to object. Note that all object
+## files are copied to the OBJDIR.
+## Individual makefiles may define CSTM_CXXFLAGS to include
+## custom C++ flags in compilation.
+
+ifdef SILENTMODE
+$(OBJDIR)/%.o: %.cxx
+	@echo Compiling $< ...
+	@rm -f $@
+	@$(CXX) $(CXXFLAGS) $(CSTM_CXXFLAGS) $< -o $@
+
+$(OBJDIR)/%.o: %.cpp
+	@echo Compiling $< ...
+	@rm -f $@
+	@$(CXX) $(CXXFLAGS) $(CSTM_CXXFLAGS) $< -o $@
+
+
+$(OBJDIR)/%.o: %.C
+	@echo Compiling $< ...
+	@rm -f $@
+	@$(CXX) $(CXXFLAGS) $(CSTM_CXXFLAGS) $< -o $@
+
+%.o: %.C
+	@echo Compiling $< ...
+	@rm -f $@
+	@$(CXX) $(CXXFLAGS) $(CSTM_CXXFLAGS) $< -o $@
+%.o: %.cpp
+	@echo Compiling $< ...
+	@rm -f $@
+	@$(CXX) $(CXXFLAGS) $(CSTM_CXXFLAGS) $< -o $@
+%.o: %.cxx
+	@echo Compiling $< ...
+	@rm -f $@
+	@$(CXX) $(CXXFLAGS) $(CSTM_CXXFLAGS) $< -o $@
+else
+$(OBJDIR)/%.o: %.cxx
+	rm -f $@
+	$(CXX) $(CXXFLAGS) $(CSTM_CXXFLAGS) $< -o $@
+
+$(OBJDIR)/%.o: %.cpp
+	rm -f $@
+	$(CXX) $(CXXFLAGS) $(CSTM_CXXFLAGS) $< -o $@
+
+$(OBJDIR)/%.o: %.C
+	rm -f $@
+	$(CXX) $(CXXFLAGS) $(CSTM_CXXFLAGS) $< -o $@
+
+%.o: %.C
+	rm -f $@
+	$(CXX) $(CXXFLAGS) $(CSTM_CXXFLAGS) $< -o $@
+%.o: %.cxx
+	rm -f $@
+	$(CXX) $(CXXFLAGS) $(CSTM_CXXFLAGS) $< -o $@
+%.o: %.cpp
+	rm -f $@
+	$(CXX) $(CXXFLAGS) $(CSTM_CXXFLAGS) $< -o $@
+endif
+
+## Define how to convert c file to object. Note that all object
+## files are copied to the OBJDIR.
+## Individual makefiles may define CSTM_CFLAGS to include
+## custom C flags in compilation.
+
+ifdef SILENTMODE
+$(OBJDIR)/%.o: %.c
+	@echo Compiling $< ...
+	@rm -f $@
+	@$(CC) $(CFLAGS) $(CSTM_CFLAGS) $< -o $@
+%.o: %.c
+	@echo Compiling $< ...
+	@rm -f $@
+	@$(CC) $(CFLAGS) $(CSTM_CFLAGS) $< -o $@
+
+else
+$(OBJDIR)/%.o: %.c
+	rm -f $@
+	$(CC) $(CFLAGS) $(CSTM_CFLAGS) $< -o $@
+%.o: %.c
+	rm -f $@
+	$(CC) $(CFLAGS) $(CSTM_CFLAGS) $< -o $@
+
+endif
+
+include $(CMTOP)/COMMON/make/makecm.options
+ 
+## DO NOT ADD ANYTHING AFTER THIS LINE ##
+
+
+
+
+
diff --git a/make/make.targets b/make/make.targets
new file mode 100755
index 0000000..a065ae4
--- /dev/null
+++ b/make/make.targets
@@ -0,0 +1,76 @@
+#########################################################################
+#
+# Name
+#	make.targets
+#
+# Purpose
+#
+#	Common targets for build. Must be included in the Makefile at
+#	the end. See the template makefile for instructions.
+#
+##########################################################################
+
+
+###############install####################################################
+## Installs the files to release directory. CM use only.
+
+LIBRARYFILES    := $(strip $(INSLIBFILES) )
+BINARYFILES    := $(strip $(INSBINFILES) )
+HEADERFILES    := $(strip $(INSHFILES) )
+DOCUMENTATIONFILES := $(strip $(INSDOCFILES) )
+EMPTY       := $(strip, " ")
+
+install:: installbinaryfiles \
+	installlibraryfiles
+
+installbinaryfiles::
+	@echo "$(B) Checking for binary files to Install ..."
+	@if [ "$(BINARYFILES)" = "$(EMPTY)" ] ; then \
+		echo "$(B) No binary files to Install ..." ; \
+	else \
+		if [ ! -d $(SUBSYSTOP)/install/bin ] ; then \
+			mkdir -p $(SUBSYSTOP)/install/bin ; \
+		fi ; \
+		echo "$(B) Installing $(INSBINFILES) ..." ; \
+		cp $(INSBINFILES) $(SUBSYSTOP)/install/bin ; \
+		chmod ug+w $(SUBSYSTOP)/install/bin/* ; \
+	fi
+
+installlibraryfiles::
+	@echo "$(B) Checking for library files to Install ..."
+	@if [ "$(LIBRARYFILES)" = "$(EMPTY)" ] ; then \
+		echo "$(B) No library files to Install ..." ; \
+	else \
+		echo "$(B) Installing $(INSLIBFILES) ..." ; \
+		cd $(SUBSYSTOP)/lib/$(ARCH) ; \
+		$(CMTOP)/COMMON/make/instvobele.sh $(INSLIBFILES) ; \
+	fi
+
+
+###############installdir#################################################
+## install for te directory (access to others ??)
+installdir:
+	@echo Installdir target executed ! Nothing done !!
+
+
+###############test#######################################################
+## builds all the test subdirectories recursively. Uses variable
+## TESTSUBDIRS specified in the makefile.
+
+test::
+	@for DIR in $(TESTSUBDIRS); do \
+		(echo "$B Building directory $$DIR ..." ; B="${B}  "; export B; cd $$DIR; $(MAKECMD) ) \
+	done
+ 
+	
+###############testclean##################################################
+## cleans all the test subdirectories recursively. Uses variable
+## TESTSUBDIRS specified in the makefile.
+
+testclean::
+	@for DIR in $(TESTSUBDIRS); do \
+		(echo "$B Cleaning $$DIR ..."; B="${B}  "; export B; cd $$DIR; $(MAKECMD) clean ) \
+	done
+ 
+
+include $(CMTOP)/COMMON/make/makecm.targets
diff --git a/make/makeidl.include b/make/makeidl.include
new file mode 100755
index 0000000..0fc30c0
--- /dev/null
+++ b/make/makeidl.include
@@ -0,0 +1,103 @@
+# Must define the following variables
+# MYPARENT - where the idl files are located
+# NAME1 - name of the first idl file (minus the .idl extension)
+# NAME2 -
+# NAME3 -
+# CSTM_IDLFLAGS - additionla idl flags if any
+# CSTM_CFLAGS - custom c flags if any
+# MAKECMD - environment variable must be set (done by buildrc)
+#   An acf file (even if dummy must be defined)
+
+IDLMAKECMD	= clearmake -C gnu -f ../Makefile idltarget
+
+IDLNAME		=   NAME.idl
+IDLNAMEH	=   NAME.h
+IDLNAMEC	=   NAME_cstub.c \
+		    NAME_sstub.c
+IDLNAMEO	=   $(IDLNAMEC:.c=.o)
+ACFNAME		=   NAME.acf
+
+ifdef NAME1
+IDLFILE1        :=   $(subst NAME, $(NAME1), $(IDLNAME))
+IDLGENH1        :=   $(subst NAME, $(NAME1), $(IDLNAMEH))
+IDLGENC1	:=   $(subst NAME, $(NAME1), $(IDLNAMEC))
+IDLGENO1	:=   $(subst NAME, $(NAME1), $(IDLNAMEO))
+ACF1		:=   $(subst NAME, $(NAME1), $(ACFNAME))
+else
+IDLFILE1        =
+IDLGENH1        =
+IDLGENC1	=
+IDLGENO1	=
+ACF1		=
+endif
+
+ifdef NAME2
+IDLFILE2        :=   $(subst NAME, $(NAME2), $(IDLNAME))
+IDLGENH2        :=   $(subst NAME, $(NAME2), $(IDLNAMEH))
+IDLGENC2	:=   $(subst NAME, $(NAME2), $(IDLNAMEC))
+IDLGENO2	:=   $(subst NAME, $(NAME2), $(IDLNAMEO))
+ACF2		:=   $(subst NAME, $(NAME2), $(ACFNAME))
+else
+IDLFILE2        =
+IDLGENH2        =
+IDLGENC2	=
+IDLGENO2	=
+ACF2		=
+endif
+
+ifdef NAME3
+IDLFILE3        :=   $(subst NAME, $(NAME3), $(IDLNAME))
+IDLGENH3        :=   $(subst NAME, $(NAME3), $(IDLNAMEH))
+IDLGENC3	:=   $(subst NAME, $(NAME3), $(IDLNAMEC))
+IDLGENO3	:=   $(subst NAME, $(NAME3), $(IDLNAMEO))
+
+ACF3		:=   $(subst NAME, $(NAME3), $(ACFNAME))
+else
+IDLFILE3        =
+IDLGENH3        =
+IDLGENC3	=
+IDLGENO3	=
+ACF3		=
+endif
+
+IDLFILES	:=  $(IDLFILE1)	$(IDLFILE2) $(IDLFILE3)
+IDLHFILES	:=  $(IDLGENH1) $(IDLGENH2) $(IDLGENH3)
+IDLCFILES	:=  $(IDLGENC1) $(IDLGENC2) $(IDLGENC3) 
+IDLOBJFILES	:=  $(IDLGENO1) $(IDLGENO2) $(IDLGENO3)
+ACFFILES	:=  $(ACF1) $(ACF2) $(ACF3)
+
+IDLHFILES	:= $(IDLGENH1) $(IDLGENH2)$(IDLGENH3)
+
+IDLGENFILES	:=  $(IDLFILES) \
+		    $(ACFFILES) \
+		    $(IDLHFILES) \
+		    $(IDLCFILES) \
+		    $(IDLOBJFILES)
+
+IDLDGENFILES	:=  $(patsubst %, $(ARCH)/%, $(IDLGENFILES))
+
+
+ifdef MYPARENT
+%.idl:	$(MYPARENT)/%.idl
+	rm -f $@; \
+	cp $(MYPARENT)/$@ $@
+
+%.acf:	$(MYPARENT)/%.acf
+	rm -f $@; \
+	cp $(MYPARENT)/$@ $@
+
+%.h:	%.idl
+	$(IDL) ${IDL_FLAGS} $(CSTM_IDLFLAGS) $<
+endif
+
+makeidl:
+	(cd $(ARCH); $(IDLMAKECMD))
+
+idltarget:  $(IDLHFILES)
+
+
+
+
+
+
+
diff --git a/make/makeidlxx.include b/make/makeidlxx.include
new file mode 100755
index 0000000..d2d4731
--- /dev/null
+++ b/make/makeidlxx.include
@@ -0,0 +1,107 @@
+# Must define the following variables
+# MYPARENT - where the idl files are located
+# NAME1 - name of the first idl file (minus the .idl extension)
+# NAME2 -
+# NAME3 -
+# CSTM_IDLXXFLAGS - additionla idl flags if any
+# CSTM_CFLAGS - custom c flags if any
+# MAKECMD - environment variable must be set (done by buildrc)
+#   An acf file (even if dummy must be defined)
+
+IDLXXMAKECMD	= clearmake -C gnu -f ../Makefile idltarget
+
+IDLXXNAME		=   NAME.idl
+IDLXXNAMEH	=   NAME.h \
+		    NAMEC.H \
+		    NAMES.H
+IDLXXNAMEC	=   NAME_cstub.c \
+		    NAME_sstub.c \
+		    NAMEE.C \
+		    NAMEC.C
+IDLXXNAMEO	=   $(IDLXXNAMEC:.c=.o)
+ACFNAME		=   NAME.acf
+
+ifdef NAME1
+IDLXXFILE1        :=   $(subst NAME, $(NAME1), $(IDLXXNAME))
+IDLXXGENH1        :=   $(subst NAME, $(NAME1), $(IDLXXNAMEH))
+IDLXXGENC1	:=   $(subst NAME, $(NAME1), $(IDLXXNAMEC))
+IDLXXGENO1	:=   $(subst NAME, $(NAME1), $(IDLXXNAMEO))
+ACF1		:=   $(subst NAME, $(NAME1), $(ACFNAME))
+else
+IDLXXFILE1        =
+IDLXXGENH1        =
+IDLXXGENC1	=
+IDLXXGENO1	=
+ACF1		=
+endif
+
+ifdef NAME2
+IDLXXFILE2        :=   $(subst NAME, $(NAME2), $(IDLXXNAME))
+IDLXXGENH2        :=   $(subst NAME, $(NAME2), $(IDLXXNAMEH))
+IDLXXGENC2	:=   $(subst NAME, $(NAME2), $(IDLXXNAMEC))
+IDLXXGENO2	:=   $(subst NAME, $(NAME2), $(IDLXXNAMEO))
+ACF2		:=   $(subst NAME, $(NAME2), $(ACFNAME))
+else
+IDLXXFILE2        =
+IDLXXGENH2        =
+IDLXXGENC2	=
+IDLXXGENO2	=
+ACF2		=
+endif
+
+ifdef NAME3
+IDLXXFILE3        :=   $(subst NAME, $(NAME3), $(IDLXXNAME))
+IDLXXGENH3        :=   $(subst NAME, $(NAME3), $(IDLXXNAMEH))
+IDLXXGENC3	:=   $(subst NAME, $(NAME3), $(IDLXXNAMEC))
+IDLXXGENO3	:=   $(subst NAME, $(NAME3), $(IDLXXNAMEO))
+
+ACF3		:=   $(subst NAME, $(NAME3), $(ACFNAME))
+else
+IDLXXFILE3        =
+IDLXXGENH3        =
+IDLXXGENC3	=
+IDLXXGENO3	=
+ACF3		=
+endif
+
+IDLXXFILES	:=  $(IDLXXFILE1)	$(IDLXXFILE2) $(IDLXXFILE3)
+IDLXXHFILES	:=  $(IDLXXGENH1) $(IDLXXGENH2) $(IDLXXGENH3)
+IDLXXCFILES	:=  $(IDLXXGENC1) $(IDLXXGENC2) $(IDLXXGENC3) 
+IDLXXOBJFILES	:=  $(IDLXXGENO1) $(IDLXXGENO2) $(IDLXXGENO3)
+ACFFILES	:=  $(ACF1) $(ACF2) $(ACF3)
+
+IDLXXHFILES	:= $(IDLXXGENH1) $(IDLXXGENH2)$(IDLXXGENH3)
+
+IDLXXGENFILES	:=  $(IDLXXFILES) \
+		    $(ACFFILES) \
+		    $(IDLXXHFILES) \
+		    $(IDLXXCFILES) \
+		    $(IDLXXOBJFILES)
+
+IDLXXDGENFILES	:=  $(patsubst %, $(ARCH)/%, $(IDLXXGENFILES))
+
+
+ifdef MYPARENT
+%.idl:	$(MYPARENT)/%.idl
+	rm -f $@; \
+	cp $(MYPARENT)/$@ $@
+
+%.acf:	$(MYPARENT)/%.acf
+	rm -f $@; \
+	cp $(MYPARENT)/$@ $@
+
+%.h:	%.idl
+	$(IDLXX) ${IDLXXFLAGS} $(CSTM_IDLXXFLAGS) $<
+endif
+
+makeidl:
+	(cd $(ARCH); $(IDLXXMAKECMD))
+
+idltarget:  $(IDLXXHFILES)
+
+
+
+
+
+
+
diff --git a/make/makerec.include b/make/makerec.include
new file mode 100755
index 0000000..d479c69
--- /dev/null
+++ b/make/makerec.include
@@ -0,0 +1,71 @@
+#########################################################################
+#
+# Name
+#	makerec/include
+#
+# Purpose
+#
+#	Make include file for building subdirectories recursively.
+#	This file will be included by Makefile at the src level
+#	which recursively builds all CSCs.
+#
+# Inputs
+#
+#	Set the following variables in the original makefile:
+#	    SUBDIRS - all the CSC subdirectories
+#	    TESTDIRS - all CSC test subdirectories
+#
+# Instructions
+#	make command builds all subsirectories (CSCs)
+#	make test command builds all test directories
+#	make clean command cleans all CSC subdirs
+#	make testclean cleans all test subdirs
+#
+##########################################################################
+
+##########################################################################
+#
+# THESE VALUES CAN BE USED FOR COMPARISON IN THE MAKEFILES
+#
+##########################################################################
+
+ARCH_hp		=	hp
+ARCH_sgi	=	sgi
+ARCH_sun5	=	sun5
+
+##########################################################################
+IDLMAKECMD	= clearmake -C gnu -f Makefile makeidl
+
+CLEANTARGET	=   clean
+TESTTARGET	=   test
+
+ifdef IDLDIRS
+all::	$(IDLDIRS) $(SUBDIRS)
+else
+all:: $(SUBDIRS)
+endif
+
+$(SUBDIRS)::
+	@echo "$B Building directory $@ ..."
+	@(B="${B}  "; export B; cd $@; $(MAKECMD))
+
+$(IDLDIRS)::
+	@echo "$B Building IDL directory $@ ..."
+	@(B="${B}  "; export B; cd $@; $(IDLMAKECMD))
+
+install::
+	@for DIR in $(SUBDIRS); do \
+		(echo "$B Installing directory $$DIR ..."; B="${B}  "; export B; cd $$DIR; $(MAKECMD) $@ ) \
+	done
+
+test::
+	@for DIR in $(SUBDIRS); do \
+		(echo "$B Building directory $$DIR ..."; B="${B}  "; export B; cd $$DIR; $(MAKECMD) $@ ) \
+	done
+
+testclean::
+	@for DIR in $(SUBDIRS); do \
+		(echo "$B Cleaning directory $$DIR ..."; B="${B}  "; export B; cd $$DIR; $(MAKECMD)  $@) \
+	done
+
+include $(CMTOP)/COMMON/make/makerec.cm
diff --git a/make/makerec.template b/make/makerec.template
new file mode 100755
index 0000000..5881534
--- /dev/null
+++ b/make/makerec.template
@@ -0,0 +1,23 @@
+#########################################################################
+#
+# Name
+#	makerec.template
+#
+# Purpose
+#
+#	Template makefile for recursive make.
+#	Delete all these comments after copying as Makefile.
+#
+##########################################################################
+
+## Define the variable below and you are done.
+
+
+## SUBDIRS lists all subdirectories under this directory.
+SUBDIRS	    = 
+
+
+
+include $(SUBSYSTOP)/make/makerec.include
+
+
diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt
new file mode 100644
index 0000000..0e004bd
--- /dev/null
+++ b/samples/CMakeLists.txt
@@ -0,0 +1,409 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDFEOS5_SAMPLES)
+
+#-----------------------------------------------------------------------------
+# Define Sources
+#-----------------------------------------------------------------------------
+SET (samples
+    he5_gd_datainfo
+    he5_gd_defexternalfld
+    he5_gd_definefields
+    he5_gd_defunlimfld
+    he5_gd_info
+    he5_gd_rdexternaldata
+    he5_gd_readdata
+    he5_gd_writedata
+    he5_gd_setup
+    he5_gd_subset
+    he5_gd_wrexternaldata
+    he5_gd_wrunlimfld
+    he5_pt_datainfo
+    he5_pt_definelevels
+    he5_pt_readattrs
+    he5_pt_readdata
+    he5_pt_setup
+    he5_pt_updatelevels
+    he5_pt_writeattrs
+    he5_pt_writedata
+    he5_sw_datainfo
+    he5_sw_defexternalfld
+    he5_sw_definefields
+    he5_sw_defunlimfld
+    he5_sw_info
+    he5_sw_rdexternaldata
+    he5_sw_readdata
+    he5_sw_setup
+    he5_sw_subset
+    he5_sw_wrextendrd
+    he5_sw_wrexternaldata
+    he5_sw_writedata
+    he5_sw_wrunlimfld
+    he5_za_datainfo
+    he5_za_defexternalfld
+    he5_za_definefields
+    he5_za_info
+    he5_za_rdexternaldata
+    he5_za_readdata
+    he5_za_setup
+    he5_za_wrexternaldata
+    he5_za_writedata
+)
+
+FOREACH (sample ${samples})
+  ADD_EXECUTABLE (${sample} ${PROJECT_SOURCE_DIR}/${sample}.c)
+  TARGET_NAMING (${sample} ${LIB_TYPE})
+  TARGET_LINK_LIBRARIES (${sample} ${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_GCTP_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDFOREACH (sample ${samples})
+
+IF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+  # make test dir
+  FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+
+  SET (fort_samples
+    he5_gd_definefields
+    he5_gd_info
+    he5_gd_readdata
+    he5_gd_writedata
+    he5_gd_setup
+    he5_gd_subset
+    he5_pt_datainfo
+    he5_pt_definelevels
+    he5_pt_readattrs
+    he5_pt_readdata
+    he5_pt_setup
+    he5_pt_updatelevels
+    he5_pt_writeattrs
+    he5_pt_writedata
+    he5_sw_defexternalfld
+#    he5_sw_definefields
+    he5_sw_info
+    he5_sw_rdexternaldata
+    he5_sw_readdata
+    he5_sw_setup
+    he5_sw_subset
+    he5_sw_wrexternaldata
+    he5_sw_writedata
+    he5_za_defexternalfld
+    he5_za_definefields
+    he5_za_info
+    he5_za_rdexternaldata
+    he5_za_readdata
+    he5_za_setup
+    he5_za_wrexternaldata
+    he5_za_writedata
+  )
+
+  FOREACH (sample ${fort_samples})
+    IF (F2CFORTRAN_32PTR)
+      ADD_EXECUTABLE (f_${sample} ${PROJECT_SOURCE_DIR}/${sample}F_32.f)
+    ELSE (F2CFORTRAN_32PTR)
+      ADD_EXECUTABLE (f_${sample} ${PROJECT_SOURCE_DIR}/${sample}F_64.f)
+    ENDIF (F2CFORTRAN_32PTR)
+    TARGET_NAMING (f_${sample} ${LIB_TYPE})
+    TARGET_FORTRAN_WIN_PROPERTIES (f_${sample} "")
+    SET_TARGET_PROPERTIES (f_${sample} PROPERTIES LINKER_LANGUAGE Fortran)
+    TARGET_LINK_LIBRARIES (f_${sample} ${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_GCTP_SRC_LIB_TARGET} ${LINK_LIBS})
+  ENDFOREACH (sample ${fort_samples})
+
+  #special test for he5_sw_definefields
+  IF (HDF5_ENABLE_SZIP_SUPPORT)
+    IF (F2CFORTRAN_32PTR)
+      ADD_EXECUTABLE (f_he5_sw_definefields ${PROJECT_SOURCE_DIR}/he5_sw_definefields_szipF_32.f)
+    ELSE (F2CFORTRAN_32PTR)
+      ADD_EXECUTABLE (f_he5_sw_definefields ${PROJECT_SOURCE_DIR}/he5_sw_definefields_szipF_64.f)
+    ENDIF (F2CFORTRAN_32PTR)
+  ELSE (HDF5_ENABLE_SZIP_SUPPORT)
+    IF (F2CFORTRAN_32PTR)
+      ADD_EXECUTABLE (f_he5_sw_definefields ${PROJECT_SOURCE_DIR}/he5_sw_definefieldsF_32.f)
+    ELSE (F2CFORTRAN_32PTR)
+      ADD_EXECUTABLE (f_he5_sw_definefields ${PROJECT_SOURCE_DIR}/he5_sw_definefieldsF_64.f)
+    ENDIF (F2CFORTRAN_32PTR)
+  ENDIF (HDF5_ENABLE_SZIP_SUPPORT)
+  TARGET_NAMING (f_he5_sw_definefields ${LIB_TYPE})
+  TARGET_FORTRAN_WIN_PROPERTIES (f_he5_sw_definefields "")
+  SET_TARGET_PROPERTIES (f_he5_sw_definefields PROPERTIES LINKER_LANGUAGE Fortran)
+  TARGET_LINK_LIBRARIES (f_he5_sw_definefields ${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_GCTP_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+  
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+IF (BUILD_TESTING)
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME gd_write_test-clearall-objects
+      COMMAND    ${CMAKE_COMMAND} -E remove  Grid.h5
+  )
+  SET (gdwt_last_test "gd_write_test-clearall-objects")
+
+  SET (gd_write_test
+    he5_gd_setup
+    he5_gd_definefields
+    he5_gd_writedata
+    he5_gd_readdata
+    he5_gd_info
+    he5_gd_datainfo
+    he5_gd_subset
+  )
+  FOREACH (sample ${gd_write_test})
+    ADD_TEST (NAME gd_write_test_${sample} COMMAND $<TARGET_FILE:${sample}>)
+    IF (NOT "${gdwt_last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (gd_write_test_${sample} PROPERTIES DEPENDS ${gdwt_last_test})
+    ENDIF (NOT "${gdwt_last_test}" STREQUAL "")
+    SET (gdwt_last_test "gd_write_test_${sample}")
+  ENDFOREACH (sample ${gd_write_test})
+  
+  # make test dir
+  FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/unlim")
+
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME gd_unlim_test-clearall-objects
+      COMMAND    ${CMAKE_COMMAND} -E remove  Grid.h5
+  )
+  SET_TESTS_PROPERTIES (gd_unlim_test-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/unlim")
+  SET (gdut_last_test "gd_unlim_test-clearall-objects")
+
+  SET (gd_unlim_test
+    he5_gd_setup
+    he5_gd_defunlimfld
+    he5_gd_wrunlimfld
+  )
+  FOREACH (sample ${gd_unlim_test})
+    ADD_TEST (NAME gd_unlim_test_${sample} COMMAND $<TARGET_FILE:${sample}>)
+    SET_TESTS_PROPERTIES (gd_unlim_test_${sample} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/unlim")
+    IF (NOT "${gdut_last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (gd_unlim_test_${sample} PROPERTIES DEPENDS ${gdut_last_test})
+    ENDIF (NOT "${gdut_last_test}" STREQUAL "")
+    SET (gdut_last_test "gd_unlim_test_${sample}")
+  ENDFOREACH (sample ${gd_unlim_test})
+
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME pt_write_test-clearall-objects
+      COMMAND    ${CMAKE_COMMAND} -E remove Point.h5
+  )
+  SET (ptwt_last_test "pt_write_test-clearall-objects")
+
+  SET (pt_write_test
+    he5_pt_setup
+    he5_pt_definelevels
+    he5_pt_writedata
+    he5_pt_writeattrs
+    he5_pt_readdata
+    he5_pt_readattrs
+    he5_pt_updatelevels
+    he5_pt_datainfo
+  )
+ 
+  FOREACH (sample ${pt_write_test})
+    ADD_TEST (NAME pt_write_test_${sample} COMMAND $<TARGET_FILE:${sample}>)
+    SET_TESTS_PROPERTIES (pt_write_test_${sample} PROPERTIES ENVIRONMENT "srcdir=${PROJECT_SOURCE_DIR}")
+    IF (NOT "${ptwt_last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (pt_write_test_${sample} PROPERTIES DEPENDS ${ptwt_last_test})
+    ENDIF (NOT "${ptwt_last_test}" STREQUAL "")
+    SET (ptwt_last_test "pt_write_test_${sample}")
+  ENDFOREACH (sample ${pt_write_test})
+
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME sw_write_test-clearall-objects
+      COMMAND    ${CMAKE_COMMAND} -E remove  Swath.h5
+  )
+  SET (swwt_last_test "sw_write_test-clearall-objects")
+
+  SET (sw_write_test
+    he5_sw_setup
+    he5_sw_definefields
+    he5_sw_writedata
+    he5_sw_readdata
+    he5_sw_info
+    he5_sw_datainfo
+    he5_sw_subset
+  )
+  FOREACH (sample ${sw_write_test})
+    ADD_TEST (NAME sw_write_test_${sample} COMMAND $<TARGET_FILE:${sample}>)
+    IF (NOT "${swwt_last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (sw_write_test_${sample} PROPERTIES DEPENDS ${swwt_last_test})
+    ENDIF (NOT "${swwt_last_test}" STREQUAL "")
+    SET (swwt_last_test "sw_write_test_${sample}")
+  ENDFOREACH (sample ${sw_write_test})
+  
+  # make test dir
+#  FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/unlim")
+
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME sw_unlim_test-clearall-objects
+      COMMAND    ${CMAKE_COMMAND} -E remove  Swath.h5
+  )
+  SET_TESTS_PROPERTIES (sw_unlim_test-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/unlim")
+  SET (swut_last_test "sw_unlim_test-clearall-objects")
+
+  SET (sw_unlim_test
+    he5_sw_setup
+    he5_sw_defunlimfld
+    he5_sw_wrunlimfld
+    he5_sw_subset
+  )
+  FOREACH (sample ${sw_unlim_test})
+    ADD_TEST (NAME sw_unlim_test_${sample} COMMAND $<TARGET_FILE:${sample}>)
+    SET_TESTS_PROPERTIES (sw_unlim_test_${sample} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/unlim")
+    IF (NOT "${swut_last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (sw_unlim_test_${sample} PROPERTIES DEPENDS ${swut_last_test})
+    ENDIF (NOT "${swut_last_test}" STREQUAL "")
+    SET (swut_last_test "sw_unlim_test_${sample}")
+  ENDFOREACH (sample ${sw_unlim_test})
+  
+  # make test dir
+  FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/extend")
+
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME sw_extend_test-clearall-objects
+      COMMAND    ${CMAKE_COMMAND} -E remove  Swath.h5
+  )
+  SET_TESTS_PROPERTIES (sw_extend_test-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/extend")
+  SET (swxt_last_test "sw_extend_test-clearall-objects")
+
+  SET (sw_extend_test
+    he5_gd_setup
+    he5_gd_defunlimfld
+    he5_gd_wrunlimfld
+  )
+  FOREACH (sample ${sw_extend_test})
+    ADD_TEST (NAME sw_extend_test_${sample} COMMAND $<TARGET_FILE:${sample}>)
+    SET_TESTS_PROPERTIES (sw_extend_test_${sample} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/extend")
+    IF (NOT "${swxt_last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (sw_extend_test_${sample} PROPERTIES DEPENDS ${swxt_last_test})
+    ENDIF (NOT "${swxt_last_test}" STREQUAL "")
+    SET (swxt_last_test "sw_extend_test_${sample}")
+  ENDFOREACH (sample ${sw_extend_test})
+
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME za_write_test-clearall-objects
+      COMMAND    ${CMAKE_COMMAND} -E remove  ZA.h5
+  )
+  SET (zawt_last_test "za_write_test-clearall-objects")
+
+  SET (za_write_test
+    he5_za_setup
+    he5_za_definefields
+    he5_za_writedata
+    he5_za_readdata
+    he5_za_info
+    he5_za_datainfo
+  )
+  FOREACH (sample ${za_write_test})
+    ADD_TEST (NAME za_write_test_${sample} COMMAND $<TARGET_FILE:${sample}>)
+    IF (NOT "${zawt_last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (za_write_test_${sample} PROPERTIES DEPENDS ${zawt_last_test})
+    ENDIF (NOT "${zawt_last_test}" STREQUAL "")
+    SET (zawt_last_test "za_write_test_${sample}")
+  ENDFOREACH (sample ${za_write_test})
+
+  IF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+    # Remove any output file left over from previous test run
+    ADD_TEST (
+        NAME gd_write_test_fortran-clearall-objects
+        COMMAND    ${CMAKE_COMMAND} -E remove Grid.h5
+    )
+    SET_TESTS_PROPERTIES (gd_write_test_fortran-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+    SET (gdwtf_last_test "gd_write_test_fortran-clearall-objects")
+
+    SET (gd_write_test_fortran
+      he5_gd_setup
+      he5_gd_definefields
+      he5_gd_writedata
+      he5_gd_readdata
+      he5_gd_info
+      he5_gd_subset
+    )
+    FOREACH (sample ${gd_write_test_fortran})
+      ADD_TEST (NAME gd_write_test_fortran_${sample} COMMAND $<TARGET_FILE:f_${sample}>)
+      SET_TESTS_PROPERTIES (gd_write_test_fortran_${sample} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+      IF (NOT "${gdwtf_last_test}" STREQUAL "")
+        SET_TESTS_PROPERTIES (gd_write_test_fortran_${sample} PROPERTIES DEPENDS ${gdwtf_last_test})
+      ENDIF (NOT "${gdwtf_last_test}" STREQUAL "")
+      SET (gdwtf_last_test "gd_write_test_fortran_${sample}")
+    ENDFOREACH (sample ${gd_write_test_fortran})
+
+    # Remove any output file left over from previous test run
+    ADD_TEST (
+        NAME pt_write_test_fortran-clearall-objects
+        COMMAND    ${CMAKE_COMMAND} -E remove Point.h5
+    )
+    SET_TESTS_PROPERTIES (pt_write_test_fortran-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+    SET (ptwtf_last_test "pt_write_test_fortran-clearall-objects")
+
+    SET (pt_write_test_fortran
+      he5_pt_setup
+      he5_pt_definelevels
+      he5_pt_writedata
+      he5_pt_writeattrs
+      he5_pt_readdata
+      he5_pt_readattrs
+      he5_pt_updatelevels
+      he5_pt_datainfo
+    )
+    FOREACH (sample ${pt_write_test_fortran})
+      ADD_TEST (NAME pt_write_test_fortran_${sample} COMMAND $<TARGET_FILE:f_${sample}>)
+      IF (NOT "${ptwtf_last_test}" STREQUAL "")
+        SET_TESTS_PROPERTIES (pt_write_test_fortran_${sample} PROPERTIES DEPENDS ${ptwtf_last_test})
+      ENDIF (NOT "${ptwtf_last_test}" STREQUAL "")
+      SET (ptwtf_last_test "pt_write_test_fortran_${sample}")
+    ENDFOREACH (sample ${pt_write_test_fortran})
+
+    # Remove any output file left over from previous test run
+    ADD_TEST (
+        NAME sw_write_test_fortran-clearall-objects
+        COMMAND    ${CMAKE_COMMAND} -E remove  Swath.h5
+    )
+    SET_TESTS_PROPERTIES (sw_write_test_fortran-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+    SET (swwtf_last_test "sw_write_test_fortran-clearall-objects")
+
+    SET (sw_write_test_fortran
+      he5_sw_setup
+      he5_sw_definefields
+      he5_sw_writedata
+      he5_sw_readdata
+      he5_sw_info
+      he5_sw_subset
+    )
+    FOREACH (sample ${sw_write_test_fortran})
+      ADD_TEST (NAME sw_write_test_fortran_${sample} COMMAND $<TARGET_FILE:f_${sample}>)
+      IF (NOT "${swwtf_last_test}" STREQUAL "")
+        SET_TESTS_PROPERTIES (sw_write_test_fortran_${sample} PROPERTIES DEPENDS ${swwtf_last_test})
+      ENDIF (NOT "${swwtf_last_test}" STREQUAL "")
+      SET (swwtf_last_test "sw_write_test_fortran_${sample}")
+    ENDFOREACH (sample ${sw_write_test_fortran})
+
+    # Remove any output file left over from previous test run
+    ADD_TEST (
+        NAME za_write_test_fortran-clearall-objects
+        COMMAND    ${CMAKE_COMMAND} -E remove  Za.h5
+    )
+    SET_TESTS_PROPERTIES (za_write_test_fortran-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+    SET (zawtf_last_test "za_write_test_fortran-clearall-objects")
+
+    SET (za_write_test_fortran
+      he5_za_setup
+      he5_za_definefields
+      he5_za_writedata
+      he5_za_readdata
+      he5_za_info
+    )
+    FOREACH (sample ${za_write_test_fortran})
+      ADD_TEST (NAME za_write_test_fortran_${sample} COMMAND $<TARGET_FILE:f_${sample}>)
+      IF (NOT "${zawtf_last_test}" STREQUAL "")
+        SET_TESTS_PROPERTIES (za_write_test_fortran_${sample} PROPERTIES DEPENDS ${zawtf_last_test})
+      ENDIF (NOT "${zawtf_last_test}" STREQUAL "")
+      SET (zawtf_last_test "za_write_test_fortran_${sample}")
+    ENDFOREACH (sample ${za_write_test_fortran})
+
+  ENDIF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+
+ENDIF (BUILD_TESTING)
diff --git a/samples/Makefile.am b/samples/Makefile.am
new file mode 100644
index 0000000..e3f5351
--- /dev/null
+++ b/samples/Makefile.am
@@ -0,0 +1,293 @@
+# samples Makefile.am
+# Sample programs for HDF-EOS5
+
+# Boilerplate definitions file
+include $(top_srcdir)/config/include.am
+
+# Link against GCTP library and HDF-EOS5
+INCLUDES=-I$(top_srcdir)/include -I$(top_srcdir)/gctp/include
+
+LDADD=$(LIBHDFEOS5) $(LIBGCTP)
+
+# The sample programs to be built when the user types 'make check'
+check_PROGRAMS=he5_gd_datainfo he5_gd_defexternalfld he5_gd_definefields     \
+      he5_gd_defunlimfld he5_gd_info he5_gd_rdexternaldata he5_gd_readdata   \
+      he5_gd_writedata he5_gd_setup he5_gd_subset he5_gd_wrexternaldata he5_gd_wrunlimfld     \
+      he5_pt_datainfo he5_pt_definelevels he5_pt_readattrs he5_pt_readdata   \
+      he5_pt_setup he5_pt_updatelevels he5_pt_writeattrs he5_pt_writedata    \
+      he5_sw_datainfo he5_sw_defexternalfld he5_sw_definefields              \
+      he5_sw_defunlimfld he5_sw_info he5_sw_rdexternaldata he5_sw_readdata   \
+      he5_sw_setup he5_sw_subset he5_sw_wrextendrd he5_sw_wrexternaldata     \
+      he5_sw_writedata he5_sw_wrunlimfld he5_za_datainfo                     \
+      he5_za_defexternalfld he5_za_definefields he5_za_info                  \
+      he5_za_rdexternaldata he5_za_readdata he5_za_setup                     \
+      he5_za_wrexternaldata he5_za_writedata
+if F2CFORTRAN_CONDITIONAL
+if F2CFORTRAN_32PTR_CONDITIONAL
+check_PROGRAMS += \
+	he5_gd_definefieldsF_32 \
+	he5_gd_infoF_32 \
+	he5_gd_readdataF_32 \
+	he5_gd_setupF_32 \
+	he5_gd_subsetF_32 \
+	he5_gd_writedataF_32 \
+	he5_pt_datainfoF_32 \
+	he5_pt_definelevelsF_32 \
+	he5_pt_readattrsF_32 \
+	he5_pt_readdataF_32 \
+	he5_pt_setupF_32 \
+	he5_pt_updatelevelsF_32 \
+	he5_pt_writeattrsF_32 \
+	he5_pt_writedataF_32 \
+	he5_sw_defexternalfldF_32 \
+	he5_sw_definefieldsF_32 \
+	he5_sw_infoF_32 \
+	he5_sw_rdexternaldataF_32 \
+	he5_sw_readdataF_32 \
+	he5_sw_setupF_32 \
+	he5_sw_subsetF_32 \
+	he5_sw_wrexternaldataF_32 \
+	he5_sw_writedataF_32 \
+	he5_za_defexternalfldF_32 \
+	he5_za_definefieldsF_32 \
+	he5_za_infoF_32 \
+	he5_za_rdexternaldataF_32 \
+	he5_za_readdataF_32 \
+	he5_za_setupF_32 \
+	he5_za_wrexternaldataF_32 \
+	he5_za_writedataF_32
+he5_gd_definefieldsF_32_SOURCES = he5_gd_definefieldsF_32.f
+he5_gd_infoF_32_SOURCES = he5_gd_infoF_32.f
+he5_gd_readdataF_32_SOURCES = he5_gd_readdataF_32.f
+he5_gd_setupF_32_SOURCES = he5_gd_setupF_32.f
+he5_gd_subsetF_32_SOURCES = he5_gd_subsetF_32.f
+he5_gd_writedataF_32_SOURCES = he5_gd_writedataF_32.f
+he5_pt_datainfoF_32_SOURCES = he5_pt_datainfoF_32.f
+he5_pt_definelevelsF_32_SOURCES = he5_pt_definelevelsF_32.f
+he5_pt_readattrsF_32_SOURCES = he5_pt_readattrsF_32.f
+he5_pt_readdataF_32_SOURCES = he5_pt_readdataF_32.f
+he5_pt_setupF_32_SOURCES = he5_pt_setupF_32.f
+he5_pt_updatelevelsF_32_SOURCES = he5_pt_updatelevelsF_32.f
+he5_pt_writeattrsF_32_SOURCES = he5_pt_writeattrsF_32.f
+he5_pt_writedataF_32_SOURCES = he5_pt_writedataF_32.f
+he5_sw_defexternalfldF_32_SOURCES = he5_sw_defexternalfldF_32.f
+if SZIP_ENCODER_CONDITIONAL
+he5_sw_definefieldsF_32_SOURCES = he5_sw_definefields_szipF_32.f
+else
+he5_sw_definefieldsF_32_SOURCES = he5_sw_definefieldsF_32.f
+endif
+he5_sw_infoF_32_SOURCES = he5_sw_infoF_32.f
+he5_sw_rdexternaldataF_32_SOURCES = he5_sw_rdexternaldataF_32.f
+he5_sw_readdataF_32_SOURCES = he5_sw_readdataF_32.f
+he5_sw_setupF_32_SOURCES = he5_sw_setupF_32.f
+he5_sw_subsetF_32_SOURCES = he5_sw_subsetF_32.f
+he5_sw_wrexternaldataF_32_SOURCES = he5_sw_wrexternaldataF_32.f
+he5_sw_writedataF_32_SOURCES = he5_sw_writedataF_32.f
+he5_za_defexternalfldF_32_SOURCES = he5_za_defexternalfldF_32.f
+he5_za_definefieldsF_32_SOURCES = he5_za_definefieldsF_32.f
+he5_za_infoF_32_SOURCES = he5_za_infoF_32.f
+he5_za_rdexternaldataF_32_SOURCES = he5_za_rdexternaldataF_32.f
+he5_za_readdataF_32_SOURCES = he5_za_readdataF_32.f
+he5_za_setupF_32_SOURCES = he5_za_setupF_32.f
+he5_za_wrexternaldataF_32_SOURCES = he5_za_wrexternaldataF_32.f
+he5_za_writedataF_32_SOURCES = he5_za_writedataF_32.f
+else
+check_PROGRAMS += \
+	he5_gd_definefieldsF_64 \
+	he5_gd_infoF_64 \
+	he5_gd_readdataF_64 \
+	he5_gd_setupF_64 \
+	he5_gd_subsetF_64 \
+	he5_gd_writedataF_64 \
+	he5_pt_datainfoF_64 \
+	he5_pt_definelevelsF_64 \
+	he5_pt_readattrsF_64 \
+	he5_pt_readdataF_64 \
+	he5_pt_setupF_64 \
+	he5_pt_updatelevelsF_64 \
+	he5_pt_writeattrsF_64 \
+	he5_pt_writedataF_64 \
+	he5_sw_defexternalfldF_64 \
+	he5_sw_definefieldsF_64 \
+	he5_sw_infoF_64 \
+	he5_sw_rdexternaldataF_64 \
+	he5_sw_readdataF_64 \
+	he5_sw_setupF_64 \
+	he5_sw_subsetF_64 \
+	he5_sw_wrexternaldataF_64 \
+	he5_sw_writedataF_64 \
+	he5_za_defexternalfldF_64 \
+	he5_za_definefieldsF_64 \
+	he5_za_infoF_64 \
+	he5_za_rdexternaldataF_64 \
+	he5_za_readdataF_64 \
+	he5_za_setupF_64 \
+	he5_za_wrexternaldataF_64 \
+	he5_za_writedataF_64
+he5_gd_definefieldsF_64_SOURCES = he5_gd_definefieldsF_64.f
+he5_gd_infoF_64_SOURCES = he5_gd_infoF_64.f
+he5_gd_readdataF_64_SOURCES = he5_gd_readdataF_64.f
+he5_gd_setupF_64_SOURCES = he5_gd_setupF_64.f
+he5_gd_subsetF_64_SOURCES = he5_gd_subsetF_64.f
+he5_gd_writedataF_64_SOURCES = he5_gd_writedataF_64.f
+he5_pt_datainfoF_64_SOURCES = he5_pt_datainfoF_64.f
+he5_pt_definelevelsF_64_SOURCES = he5_pt_definelevelsF_64.f
+he5_pt_readattrsF_64_SOURCES = he5_pt_readattrsF_64.f
+he5_pt_readdataF_64_SOURCES = he5_pt_readdataF_64.f
+he5_pt_setupF_64_SOURCES = he5_pt_setupF_64.f
+he5_pt_updatelevelsF_64_SOURCES = he5_pt_updatelevelsF_64.f
+he5_pt_writeattrsF_64_SOURCES = he5_pt_writeattrsF_64.f
+he5_pt_writedataF_64_SOURCES = he5_pt_writedataF_64.f
+he5_sw_defexternalfldF_64_SOURCES = he5_sw_defexternalfldF_64.f
+if SZIP_ENCODER_CONDITIONAL
+he5_sw_definefieldsF_64_SOURCES = he5_sw_definefields_szipF_64.f
+else
+he5_sw_definefieldsF_64_SOURCES = he5_sw_definefieldsF_64.f
+endif
+he5_sw_infoF_64_SOURCES = he5_sw_infoF_64.f
+he5_sw_rdexternaldataF_64_SOURCES = he5_sw_rdexternaldataF_64.f
+he5_sw_readdataF_64_SOURCES = he5_sw_readdataF_64.f
+he5_sw_setupF_64_SOURCES = he5_sw_setupF_64.f
+he5_sw_subsetF_64_SOURCES = he5_sw_subsetF_64.f
+he5_sw_wrexternaldataF_64_SOURCES = he5_sw_wrexternaldataF_64.f
+he5_sw_writedataF_64_SOURCES = he5_sw_writedataF_64.f
+he5_za_defexternalfldF_64_SOURCES = he5_za_defexternalfldF_64.f
+he5_za_definefieldsF_64_SOURCES = he5_za_definefieldsF_64.f
+he5_za_infoF_64_SOURCES = he5_za_infoF_64.f
+he5_za_rdexternaldataF_64_SOURCES = he5_za_rdexternaldataF_64.f
+he5_za_readdataF_64_SOURCES = he5_za_readdataF_64.f
+he5_za_setupF_64_SOURCES = he5_za_setupF_64.f
+he5_za_wrexternaldataF_64_SOURCES = he5_za_wrexternaldataF_64.f
+he5_za_writedataF_64_SOURCES = he5_za_writedataF_64.f
+endif
+endif
+ 
+# Tests consist of several programs run in succession.  Each of these
+# names is the name of such a "sequence" of tests.
+TEST_SEQUENCES=gd_write_test gd_unlim_test pt_write_test sw_write_test \
+       sw_unlim_test sw_extend_test za_write_test
+if F2CFORTRAN_CONDITIONAL
+if F2CFORTRAN_32PTR_CONDITIONAL
+TEST_SEQUENCES+=gd_write_test_32f pt_write_test_32f sw_write_test_32f za_write_test_32f
+else
+TEST_SEQUENCES+=gd_write_test_64f pt_write_test_64f sw_write_test_64f za_write_test_64f
+endif
+endif
+
+# 'make check' should run each of the test sequences above
+check-local: $(TEST_SEQUENCES)
+
+# Manually list the tests to be run in order for each test sequence.
+gd_write_test: $(check_PROGRAMS)
+	./he5_gd_setup
+	./he5_gd_definefields
+	./he5_gd_writedata
+	./he5_gd_readdata
+	./he5_gd_info
+	./he5_gd_datainfo
+	./he5_gd_subset
+gd_write_test_32f: $(check_PROGRAMS)
+	./he5_gd_setupF_32
+	./he5_gd_definefieldsF_32
+	./he5_gd_writedataF_32
+	./he5_gd_readdataF_32
+	./he5_gd_infoF_32
+	./he5_gd_subsetF_32
+gd_write_test_64f: $(check_PROGRAMS)
+	./he5_gd_setupF_64
+	./he5_gd_definefieldsF_64
+	./he5_gd_writedataF_64
+	./he5_gd_readdataF_64
+	./he5_gd_infoF_64
+	./he5_gd_subsetF_64
+
+gd_unlim_test: $(check_PROGRAMS)
+	./he5_gd_setup
+	./he5_gd_defunlimfld
+	./he5_gd_wrunlimfld
+
+pt_write_test: $(check_PROGRAMS)
+	./he5_pt_setup
+	./he5_pt_definelevels
+	srcdir=$(srcdir) ./he5_pt_writedata
+	./he5_pt_writeattrs
+	./he5_pt_readdata
+	./he5_pt_readattrs
+	./he5_pt_updatelevels
+	./he5_pt_datainfo
+pt_write_test_32f: $(check_PROGRAMS)
+	./he5_pt_setupF_32
+	./he5_pt_definelevelsF_32
+	srcdir=$(srcdir) ./he5_pt_writedataF_32
+	./he5_pt_writeattrsF_32
+	./he5_pt_readdataF_32
+	./he5_pt_readattrsF_32
+	./he5_pt_updatelevelsF_32
+	./he5_pt_datainfoF_32
+pt_write_test_64f: $(check_PROGRAMS)
+	./he5_pt_setupF_64
+	./he5_pt_definelevelsF_64
+	srcdir=$(srcdir) ./he5_pt_writedataF_64
+	./he5_pt_writeattrsF_64
+	./he5_pt_readdataF_64
+	./he5_pt_readattrsF_64
+	./he5_pt_updatelevelsF_64
+	./he5_pt_datainfoF_64
+
+sw_write_test: $(check_PROGRAMS)
+	./he5_sw_setup
+	./he5_sw_definefields
+	./he5_sw_writedata
+	./he5_sw_readdata
+	./he5_sw_info
+	./he5_sw_datainfo
+	./he5_sw_subset
+sw_write_test_32f: $(check_PROGRAMS)
+	./he5_sw_setupF_32
+	./he5_sw_definefieldsF_32
+	./he5_sw_writedataF_32
+	./he5_sw_readdataF_32
+	./he5_sw_infoF_32
+	./he5_sw_subsetF_32
+sw_write_test_64f: $(check_PROGRAMS)
+	./he5_sw_setupF_64
+	./he5_sw_definefieldsF_64
+	./he5_sw_writedataF_64
+	./he5_sw_readdataF_64
+	./he5_sw_infoF_64
+	./he5_sw_subsetF_64
+
+sw_unlim_test: $(check_PROGRAMS)
+	./he5_sw_setup
+	./he5_sw_defunlimfld
+	./he5_sw_wrunlimfld
+	./he5_sw_subset
+
+sw_extend_test: $(check_PROGRAMS)
+	./he5_sw_setup
+	./he5_sw_definefields
+	./he5_sw_wrextendrd
+
+za_write_test: $(check_PROGRAMS)
+	./he5_za_setup
+	./he5_za_definefields
+	./he5_za_writedata
+	./he5_za_readdata
+	./he5_za_info
+	./he5_za_datainfo
+za_write_test_32f: $(check_PROGRAMS)
+	./he5_za_setupF_32
+	./he5_za_definefieldsF_32
+	./he5_za_writedataF_32
+	./he5_za_readdataF_32
+	./he5_za_infoF_32
+za_write_test_64f: $(check_PROGRAMS)
+	./he5_za_setupF_64
+	./he5_za_definefieldsF_64
+	./he5_za_writedataF_64
+	./he5_za_readdataF_64
+	./he5_za_infoF_64
+
+# This avoids any confusion between the names of the sequences and
+# files with the same names.
+.PHONY: $(TEST_SEQUENCES)
diff --git a/samples/Makefile.in b/samples/Makefile.in
new file mode 100644
index 0000000..59331dd
--- /dev/null
+++ b/samples/Makefile.in
@@ -0,0 +1,1904 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+# samples Makefile.am
+# Sample programs for HDF-EOS5
+SOURCES = he5_gd_datainfo.c he5_gd_defexternalfld.c he5_gd_definefields.c $(he5_gd_definefieldsF_32_SOURCES) $(he5_gd_definefieldsF_64_SOURCES) he5_gd_defunlimfld.c he5_gd_info.c $(he5_gd_infoF_32_SOURCES) $(he5_gd_infoF_64_SOURCES) he5_gd_rdexternaldata.c he5_gd_readdata.c $(he5_gd_readdataF_32_SOURCES) $(he5_gd_readdataF_64_SOURCES) he5_gd_setup.c $(he5_gd_setupF_32_SOURCES) $(he5_gd_setupF_64_SOURCES) he5_gd_subset.c $(he5_gd_subsetF_32_SOURCES) $(he5_gd_subsetF_64_SOURCES) he5_gd_wre [...]
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/config/include.am
+check_PROGRAMS = he5_gd_datainfo$(EXEEXT) \
+	he5_gd_defexternalfld$(EXEEXT) he5_gd_definefields$(EXEEXT) \
+	he5_gd_defunlimfld$(EXEEXT) he5_gd_info$(EXEEXT) \
+	he5_gd_rdexternaldata$(EXEEXT) he5_gd_readdata$(EXEEXT) \
+	he5_gd_writedata$(EXEEXT) he5_gd_setup$(EXEEXT) \
+	he5_gd_subset$(EXEEXT) he5_gd_wrexternaldata$(EXEEXT) \
+	he5_gd_wrunlimfld$(EXEEXT) he5_pt_datainfo$(EXEEXT) \
+	he5_pt_definelevels$(EXEEXT) he5_pt_readattrs$(EXEEXT) \
+	he5_pt_readdata$(EXEEXT) he5_pt_setup$(EXEEXT) \
+	he5_pt_updatelevels$(EXEEXT) he5_pt_writeattrs$(EXEEXT) \
+	he5_pt_writedata$(EXEEXT) he5_sw_datainfo$(EXEEXT) \
+	he5_sw_defexternalfld$(EXEEXT) he5_sw_definefields$(EXEEXT) \
+	he5_sw_defunlimfld$(EXEEXT) he5_sw_info$(EXEEXT) \
+	he5_sw_rdexternaldata$(EXEEXT) he5_sw_readdata$(EXEEXT) \
+	he5_sw_setup$(EXEEXT) he5_sw_subset$(EXEEXT) \
+	he5_sw_wrextendrd$(EXEEXT) he5_sw_wrexternaldata$(EXEEXT) \
+	he5_sw_writedata$(EXEEXT) he5_sw_wrunlimfld$(EXEEXT) \
+	he5_za_datainfo$(EXEEXT) he5_za_defexternalfld$(EXEEXT) \
+	he5_za_definefields$(EXEEXT) he5_za_info$(EXEEXT) \
+	he5_za_rdexternaldata$(EXEEXT) he5_za_readdata$(EXEEXT) \
+	he5_za_setup$(EXEEXT) he5_za_wrexternaldata$(EXEEXT) \
+	he5_za_writedata$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2)
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_1 = \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_definefieldsF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_infoF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_readdataF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_setupF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_subsetF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_writedataF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_datainfoF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_definelevelsF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_readattrsF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_readdataF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_setupF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_updatelevelsF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_writeattrsF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_writedataF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_defexternalfldF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_definefieldsF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_infoF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_rdexternaldataF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_readdataF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_setupF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_subsetF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_wrexternaldataF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_writedataF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_defexternalfldF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_definefieldsF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_infoF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_rdexternaldataF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_readdataF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_setupF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_wrexternaldataF_32 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_writedataF_32
+
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_2 = \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_definefieldsF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_infoF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_readdataF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_setupF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_subsetF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_writedataF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_datainfoF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_definelevelsF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_readattrsF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_readdataF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_setupF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_updatelevelsF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_writeattrsF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_writedataF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_defexternalfldF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_definefieldsF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_infoF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_rdexternaldataF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_readdataF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_setupF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_subsetF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_wrexternaldataF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_writedataF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_defexternalfldF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_definefieldsF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_infoF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_rdexternaldataF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_readdataF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_setupF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_wrexternaldataF_64 \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_writedataF_64
+
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_3 = gd_write_test_32f pt_write_test_32f sw_write_test_32f za_write_test_32f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_4 = gd_write_test_64f pt_write_test_64f sw_write_test_64f za_write_test_64f
+subdir = samples
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/HE5_config.h
+CONFIG_CLEAN_FILES =
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__EXEEXT_1 = he5_gd_definefieldsF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_infoF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_readdataF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_setupF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_subsetF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_writedataF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_datainfoF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_definelevelsF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_readattrsF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_readdataF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_setupF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_updatelevelsF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_writeattrsF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_writedataF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_defexternalfldF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_definefieldsF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_infoF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_rdexternaldataF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_readdataF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_setupF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_subsetF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_wrexternaldataF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_writedataF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_defexternalfldF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_definefieldsF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_infoF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_rdexternaldataF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_readdataF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_setupF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_wrexternaldataF_32$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_writedataF_32$(EXEEXT)
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__EXEEXT_2 = he5_gd_definefieldsF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_infoF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_readdataF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_setupF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_subsetF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_gd_writedataF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_datainfoF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_definelevelsF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_readattrsF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_readdataF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_setupF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_updatelevelsF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_writeattrsF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_pt_writedataF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_defexternalfldF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_definefieldsF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_infoF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_rdexternaldataF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_readdataF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_setupF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_subsetF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_wrexternaldataF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_sw_writedataF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_defexternalfldF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_definefieldsF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_infoF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_rdexternaldataF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_readdataF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_setupF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_wrexternaldataF_64$(EXEEXT) \
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@	he5_za_writedataF_64$(EXEEXT)
+he5_gd_datainfo_SOURCES = he5_gd_datainfo.c
+he5_gd_datainfo_OBJECTS = he5_gd_datainfo.$(OBJEXT)
+he5_gd_datainfo_LDADD = $(LDADD)
+am__DEPENDENCIES_1 = $(top_builddir)/src/libhe5_hdfeos.la
+am__DEPENDENCIES_2 = $(top_builddir)/gctp/src/libGctp.la
+he5_gd_datainfo_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_gd_defexternalfld_SOURCES = he5_gd_defexternalfld.c
+he5_gd_defexternalfld_OBJECTS = he5_gd_defexternalfld.$(OBJEXT)
+he5_gd_defexternalfld_LDADD = $(LDADD)
+he5_gd_defexternalfld_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_gd_definefields_SOURCES = he5_gd_definefields.c
+he5_gd_definefields_OBJECTS = he5_gd_definefields.$(OBJEXT)
+he5_gd_definefields_LDADD = $(LDADD)
+he5_gd_definefields_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_gd_definefieldsF_32_SOURCES_DIST = he5_gd_definefieldsF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_gd_definefieldsF_32_OBJECTS = he5_gd_definefieldsF_32.$(OBJEXT)
+he5_gd_definefieldsF_32_OBJECTS =  \
+	$(am_he5_gd_definefieldsF_32_OBJECTS)
+he5_gd_definefieldsF_32_LDADD = $(LDADD)
+he5_gd_definefieldsF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_gd_definefieldsF_64_SOURCES_DIST = he5_gd_definefieldsF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_gd_definefieldsF_64_OBJECTS = he5_gd_definefieldsF_64.$(OBJEXT)
+he5_gd_definefieldsF_64_OBJECTS =  \
+	$(am_he5_gd_definefieldsF_64_OBJECTS)
+he5_gd_definefieldsF_64_LDADD = $(LDADD)
+he5_gd_definefieldsF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_gd_defunlimfld_SOURCES = he5_gd_defunlimfld.c
+he5_gd_defunlimfld_OBJECTS = he5_gd_defunlimfld.$(OBJEXT)
+he5_gd_defunlimfld_LDADD = $(LDADD)
+he5_gd_defunlimfld_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_gd_info_SOURCES = he5_gd_info.c
+he5_gd_info_OBJECTS = he5_gd_info.$(OBJEXT)
+he5_gd_info_LDADD = $(LDADD)
+he5_gd_info_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am__he5_gd_infoF_32_SOURCES_DIST = he5_gd_infoF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_gd_infoF_32_OBJECTS = he5_gd_infoF_32.$(OBJEXT)
+he5_gd_infoF_32_OBJECTS = $(am_he5_gd_infoF_32_OBJECTS)
+he5_gd_infoF_32_LDADD = $(LDADD)
+he5_gd_infoF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_gd_infoF_64_SOURCES_DIST = he5_gd_infoF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_gd_infoF_64_OBJECTS = he5_gd_infoF_64.$(OBJEXT)
+he5_gd_infoF_64_OBJECTS = $(am_he5_gd_infoF_64_OBJECTS)
+he5_gd_infoF_64_LDADD = $(LDADD)
+he5_gd_infoF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_gd_rdexternaldata_SOURCES = he5_gd_rdexternaldata.c
+he5_gd_rdexternaldata_OBJECTS = he5_gd_rdexternaldata.$(OBJEXT)
+he5_gd_rdexternaldata_LDADD = $(LDADD)
+he5_gd_rdexternaldata_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_gd_readdata_SOURCES = he5_gd_readdata.c
+he5_gd_readdata_OBJECTS = he5_gd_readdata.$(OBJEXT)
+he5_gd_readdata_LDADD = $(LDADD)
+he5_gd_readdata_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_gd_readdataF_32_SOURCES_DIST = he5_gd_readdataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_gd_readdataF_32_OBJECTS = he5_gd_readdataF_32.$(OBJEXT)
+he5_gd_readdataF_32_OBJECTS = $(am_he5_gd_readdataF_32_OBJECTS)
+he5_gd_readdataF_32_LDADD = $(LDADD)
+he5_gd_readdataF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_gd_readdataF_64_SOURCES_DIST = he5_gd_readdataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_gd_readdataF_64_OBJECTS = he5_gd_readdataF_64.$(OBJEXT)
+he5_gd_readdataF_64_OBJECTS = $(am_he5_gd_readdataF_64_OBJECTS)
+he5_gd_readdataF_64_LDADD = $(LDADD)
+he5_gd_readdataF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_gd_setup_SOURCES = he5_gd_setup.c
+he5_gd_setup_OBJECTS = he5_gd_setup.$(OBJEXT)
+he5_gd_setup_LDADD = $(LDADD)
+he5_gd_setup_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_gd_setupF_32_SOURCES_DIST = he5_gd_setupF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_gd_setupF_32_OBJECTS = he5_gd_setupF_32.$(OBJEXT)
+he5_gd_setupF_32_OBJECTS = $(am_he5_gd_setupF_32_OBJECTS)
+he5_gd_setupF_32_LDADD = $(LDADD)
+he5_gd_setupF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_gd_setupF_64_SOURCES_DIST = he5_gd_setupF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_gd_setupF_64_OBJECTS = he5_gd_setupF_64.$(OBJEXT)
+he5_gd_setupF_64_OBJECTS = $(am_he5_gd_setupF_64_OBJECTS)
+he5_gd_setupF_64_LDADD = $(LDADD)
+he5_gd_setupF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_gd_subset_SOURCES = he5_gd_subset.c
+he5_gd_subset_OBJECTS = he5_gd_subset.$(OBJEXT)
+he5_gd_subset_LDADD = $(LDADD)
+he5_gd_subset_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_gd_subsetF_32_SOURCES_DIST = he5_gd_subsetF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_gd_subsetF_32_OBJECTS = he5_gd_subsetF_32.$(OBJEXT)
+he5_gd_subsetF_32_OBJECTS = $(am_he5_gd_subsetF_32_OBJECTS)
+he5_gd_subsetF_32_LDADD = $(LDADD)
+he5_gd_subsetF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_gd_subsetF_64_SOURCES_DIST = he5_gd_subsetF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_gd_subsetF_64_OBJECTS = he5_gd_subsetF_64.$(OBJEXT)
+he5_gd_subsetF_64_OBJECTS = $(am_he5_gd_subsetF_64_OBJECTS)
+he5_gd_subsetF_64_LDADD = $(LDADD)
+he5_gd_subsetF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_gd_wrexternaldata_SOURCES = he5_gd_wrexternaldata.c
+he5_gd_wrexternaldata_OBJECTS = he5_gd_wrexternaldata.$(OBJEXT)
+he5_gd_wrexternaldata_LDADD = $(LDADD)
+he5_gd_wrexternaldata_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_gd_writedata_SOURCES = he5_gd_writedata.c
+he5_gd_writedata_OBJECTS = he5_gd_writedata.$(OBJEXT)
+he5_gd_writedata_LDADD = $(LDADD)
+he5_gd_writedata_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_gd_writedataF_32_SOURCES_DIST = he5_gd_writedataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_gd_writedataF_32_OBJECTS = he5_gd_writedataF_32.$(OBJEXT)
+he5_gd_writedataF_32_OBJECTS = $(am_he5_gd_writedataF_32_OBJECTS)
+he5_gd_writedataF_32_LDADD = $(LDADD)
+he5_gd_writedataF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_gd_writedataF_64_SOURCES_DIST = he5_gd_writedataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_gd_writedataF_64_OBJECTS = he5_gd_writedataF_64.$(OBJEXT)
+he5_gd_writedataF_64_OBJECTS = $(am_he5_gd_writedataF_64_OBJECTS)
+he5_gd_writedataF_64_LDADD = $(LDADD)
+he5_gd_writedataF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_gd_wrunlimfld_SOURCES = he5_gd_wrunlimfld.c
+he5_gd_wrunlimfld_OBJECTS = he5_gd_wrunlimfld.$(OBJEXT)
+he5_gd_wrunlimfld_LDADD = $(LDADD)
+he5_gd_wrunlimfld_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_pt_datainfo_SOURCES = he5_pt_datainfo.c
+he5_pt_datainfo_OBJECTS = he5_pt_datainfo.$(OBJEXT)
+he5_pt_datainfo_LDADD = $(LDADD)
+he5_pt_datainfo_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_datainfoF_32_SOURCES_DIST = he5_pt_datainfoF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_datainfoF_32_OBJECTS = he5_pt_datainfoF_32.$(OBJEXT)
+he5_pt_datainfoF_32_OBJECTS = $(am_he5_pt_datainfoF_32_OBJECTS)
+he5_pt_datainfoF_32_LDADD = $(LDADD)
+he5_pt_datainfoF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_datainfoF_64_SOURCES_DIST = he5_pt_datainfoF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_datainfoF_64_OBJECTS = he5_pt_datainfoF_64.$(OBJEXT)
+he5_pt_datainfoF_64_OBJECTS = $(am_he5_pt_datainfoF_64_OBJECTS)
+he5_pt_datainfoF_64_LDADD = $(LDADD)
+he5_pt_datainfoF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_pt_definelevels_SOURCES = he5_pt_definelevels.c
+he5_pt_definelevels_OBJECTS = he5_pt_definelevels.$(OBJEXT)
+he5_pt_definelevels_LDADD = $(LDADD)
+he5_pt_definelevels_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_definelevelsF_32_SOURCES_DIST = he5_pt_definelevelsF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_definelevelsF_32_OBJECTS = he5_pt_definelevelsF_32.$(OBJEXT)
+he5_pt_definelevelsF_32_OBJECTS =  \
+	$(am_he5_pt_definelevelsF_32_OBJECTS)
+he5_pt_definelevelsF_32_LDADD = $(LDADD)
+he5_pt_definelevelsF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_definelevelsF_64_SOURCES_DIST = he5_pt_definelevelsF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_definelevelsF_64_OBJECTS = he5_pt_definelevelsF_64.$(OBJEXT)
+he5_pt_definelevelsF_64_OBJECTS =  \
+	$(am_he5_pt_definelevelsF_64_OBJECTS)
+he5_pt_definelevelsF_64_LDADD = $(LDADD)
+he5_pt_definelevelsF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_pt_readattrs_SOURCES = he5_pt_readattrs.c
+he5_pt_readattrs_OBJECTS = he5_pt_readattrs.$(OBJEXT)
+he5_pt_readattrs_LDADD = $(LDADD)
+he5_pt_readattrs_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_readattrsF_32_SOURCES_DIST = he5_pt_readattrsF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_readattrsF_32_OBJECTS = he5_pt_readattrsF_32.$(OBJEXT)
+he5_pt_readattrsF_32_OBJECTS = $(am_he5_pt_readattrsF_32_OBJECTS)
+he5_pt_readattrsF_32_LDADD = $(LDADD)
+he5_pt_readattrsF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_readattrsF_64_SOURCES_DIST = he5_pt_readattrsF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_readattrsF_64_OBJECTS = he5_pt_readattrsF_64.$(OBJEXT)
+he5_pt_readattrsF_64_OBJECTS = $(am_he5_pt_readattrsF_64_OBJECTS)
+he5_pt_readattrsF_64_LDADD = $(LDADD)
+he5_pt_readattrsF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_pt_readdata_SOURCES = he5_pt_readdata.c
+he5_pt_readdata_OBJECTS = he5_pt_readdata.$(OBJEXT)
+he5_pt_readdata_LDADD = $(LDADD)
+he5_pt_readdata_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_readdataF_32_SOURCES_DIST = he5_pt_readdataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_readdataF_32_OBJECTS = he5_pt_readdataF_32.$(OBJEXT)
+he5_pt_readdataF_32_OBJECTS = $(am_he5_pt_readdataF_32_OBJECTS)
+he5_pt_readdataF_32_LDADD = $(LDADD)
+he5_pt_readdataF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_readdataF_64_SOURCES_DIST = he5_pt_readdataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_readdataF_64_OBJECTS = he5_pt_readdataF_64.$(OBJEXT)
+he5_pt_readdataF_64_OBJECTS = $(am_he5_pt_readdataF_64_OBJECTS)
+he5_pt_readdataF_64_LDADD = $(LDADD)
+he5_pt_readdataF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_pt_setup_SOURCES = he5_pt_setup.c
+he5_pt_setup_OBJECTS = he5_pt_setup.$(OBJEXT)
+he5_pt_setup_LDADD = $(LDADD)
+he5_pt_setup_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_setupF_32_SOURCES_DIST = he5_pt_setupF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_setupF_32_OBJECTS = he5_pt_setupF_32.$(OBJEXT)
+he5_pt_setupF_32_OBJECTS = $(am_he5_pt_setupF_32_OBJECTS)
+he5_pt_setupF_32_LDADD = $(LDADD)
+he5_pt_setupF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_setupF_64_SOURCES_DIST = he5_pt_setupF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_setupF_64_OBJECTS = he5_pt_setupF_64.$(OBJEXT)
+he5_pt_setupF_64_OBJECTS = $(am_he5_pt_setupF_64_OBJECTS)
+he5_pt_setupF_64_LDADD = $(LDADD)
+he5_pt_setupF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_pt_updatelevels_SOURCES = he5_pt_updatelevels.c
+he5_pt_updatelevels_OBJECTS = he5_pt_updatelevels.$(OBJEXT)
+he5_pt_updatelevels_LDADD = $(LDADD)
+he5_pt_updatelevels_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_updatelevelsF_32_SOURCES_DIST = he5_pt_updatelevelsF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_updatelevelsF_32_OBJECTS = he5_pt_updatelevelsF_32.$(OBJEXT)
+he5_pt_updatelevelsF_32_OBJECTS =  \
+	$(am_he5_pt_updatelevelsF_32_OBJECTS)
+he5_pt_updatelevelsF_32_LDADD = $(LDADD)
+he5_pt_updatelevelsF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_updatelevelsF_64_SOURCES_DIST = he5_pt_updatelevelsF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_updatelevelsF_64_OBJECTS = he5_pt_updatelevelsF_64.$(OBJEXT)
+he5_pt_updatelevelsF_64_OBJECTS =  \
+	$(am_he5_pt_updatelevelsF_64_OBJECTS)
+he5_pt_updatelevelsF_64_LDADD = $(LDADD)
+he5_pt_updatelevelsF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_pt_writeattrs_SOURCES = he5_pt_writeattrs.c
+he5_pt_writeattrs_OBJECTS = he5_pt_writeattrs.$(OBJEXT)
+he5_pt_writeattrs_LDADD = $(LDADD)
+he5_pt_writeattrs_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_writeattrsF_32_SOURCES_DIST = he5_pt_writeattrsF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_writeattrsF_32_OBJECTS = he5_pt_writeattrsF_32.$(OBJEXT)
+he5_pt_writeattrsF_32_OBJECTS = $(am_he5_pt_writeattrsF_32_OBJECTS)
+he5_pt_writeattrsF_32_LDADD = $(LDADD)
+he5_pt_writeattrsF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_writeattrsF_64_SOURCES_DIST = he5_pt_writeattrsF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_writeattrsF_64_OBJECTS = he5_pt_writeattrsF_64.$(OBJEXT)
+he5_pt_writeattrsF_64_OBJECTS = $(am_he5_pt_writeattrsF_64_OBJECTS)
+he5_pt_writeattrsF_64_LDADD = $(LDADD)
+he5_pt_writeattrsF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_pt_writedata_SOURCES = he5_pt_writedata.c
+he5_pt_writedata_OBJECTS = he5_pt_writedata.$(OBJEXT)
+he5_pt_writedata_LDADD = $(LDADD)
+he5_pt_writedata_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_writedataF_32_SOURCES_DIST = he5_pt_writedataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_writedataF_32_OBJECTS = he5_pt_writedataF_32.$(OBJEXT)
+he5_pt_writedataF_32_OBJECTS = $(am_he5_pt_writedataF_32_OBJECTS)
+he5_pt_writedataF_32_LDADD = $(LDADD)
+he5_pt_writedataF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_pt_writedataF_64_SOURCES_DIST = he5_pt_writedataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_pt_writedataF_64_OBJECTS = he5_pt_writedataF_64.$(OBJEXT)
+he5_pt_writedataF_64_OBJECTS = $(am_he5_pt_writedataF_64_OBJECTS)
+he5_pt_writedataF_64_LDADD = $(LDADD)
+he5_pt_writedataF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_sw_datainfo_SOURCES = he5_sw_datainfo.c
+he5_sw_datainfo_OBJECTS = he5_sw_datainfo.$(OBJEXT)
+he5_sw_datainfo_LDADD = $(LDADD)
+he5_sw_datainfo_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_sw_defexternalfld_SOURCES = he5_sw_defexternalfld.c
+he5_sw_defexternalfld_OBJECTS = he5_sw_defexternalfld.$(OBJEXT)
+he5_sw_defexternalfld_LDADD = $(LDADD)
+he5_sw_defexternalfld_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_defexternalfldF_32_SOURCES_DIST =  \
+	he5_sw_defexternalfldF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_defexternalfldF_32_OBJECTS = he5_sw_defexternalfldF_32.$(OBJEXT)
+he5_sw_defexternalfldF_32_OBJECTS =  \
+	$(am_he5_sw_defexternalfldF_32_OBJECTS)
+he5_sw_defexternalfldF_32_LDADD = $(LDADD)
+he5_sw_defexternalfldF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_defexternalfldF_64_SOURCES_DIST =  \
+	he5_sw_defexternalfldF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_defexternalfldF_64_OBJECTS = he5_sw_defexternalfldF_64.$(OBJEXT)
+he5_sw_defexternalfldF_64_OBJECTS =  \
+	$(am_he5_sw_defexternalfldF_64_OBJECTS)
+he5_sw_defexternalfldF_64_LDADD = $(LDADD)
+he5_sw_defexternalfldF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_sw_definefields_SOURCES = he5_sw_definefields.c
+he5_sw_definefields_OBJECTS = he5_sw_definefields.$(OBJEXT)
+he5_sw_definefields_LDADD = $(LDADD)
+he5_sw_definefields_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_definefieldsF_32_SOURCES_DIST = he5_sw_definefieldsF_32.f \
+	he5_sw_definefields_szipF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE at am_he5_sw_definefieldsF_32_OBJECTS = he5_sw_definefieldsF_32.$(OBJEXT)
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE at am_he5_sw_definefieldsF_32_OBJECTS = he5_sw_definefields_szipF_32.$(OBJEXT)
+he5_sw_definefieldsF_32_OBJECTS =  \
+	$(am_he5_sw_definefieldsF_32_OBJECTS)
+he5_sw_definefieldsF_32_LDADD = $(LDADD)
+he5_sw_definefieldsF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_definefieldsF_64_SOURCES_DIST = he5_sw_definefieldsF_64.f \
+	he5_sw_definefields_szipF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE at am_he5_sw_definefieldsF_64_OBJECTS = he5_sw_definefieldsF_64.$(OBJEXT)
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE at am_he5_sw_definefieldsF_64_OBJECTS = he5_sw_definefields_szipF_64.$(OBJEXT)
+he5_sw_definefieldsF_64_OBJECTS =  \
+	$(am_he5_sw_definefieldsF_64_OBJECTS)
+he5_sw_definefieldsF_64_LDADD = $(LDADD)
+he5_sw_definefieldsF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_sw_defunlimfld_SOURCES = he5_sw_defunlimfld.c
+he5_sw_defunlimfld_OBJECTS = he5_sw_defunlimfld.$(OBJEXT)
+he5_sw_defunlimfld_LDADD = $(LDADD)
+he5_sw_defunlimfld_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_sw_info_SOURCES = he5_sw_info.c
+he5_sw_info_OBJECTS = he5_sw_info.$(OBJEXT)
+he5_sw_info_LDADD = $(LDADD)
+he5_sw_info_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am__he5_sw_infoF_32_SOURCES_DIST = he5_sw_infoF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_infoF_32_OBJECTS = he5_sw_infoF_32.$(OBJEXT)
+he5_sw_infoF_32_OBJECTS = $(am_he5_sw_infoF_32_OBJECTS)
+he5_sw_infoF_32_LDADD = $(LDADD)
+he5_sw_infoF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_infoF_64_SOURCES_DIST = he5_sw_infoF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_infoF_64_OBJECTS = he5_sw_infoF_64.$(OBJEXT)
+he5_sw_infoF_64_OBJECTS = $(am_he5_sw_infoF_64_OBJECTS)
+he5_sw_infoF_64_LDADD = $(LDADD)
+he5_sw_infoF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_sw_rdexternaldata_SOURCES = he5_sw_rdexternaldata.c
+he5_sw_rdexternaldata_OBJECTS = he5_sw_rdexternaldata.$(OBJEXT)
+he5_sw_rdexternaldata_LDADD = $(LDADD)
+he5_sw_rdexternaldata_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_rdexternaldataF_32_SOURCES_DIST =  \
+	he5_sw_rdexternaldataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_rdexternaldataF_32_OBJECTS = he5_sw_rdexternaldataF_32.$(OBJEXT)
+he5_sw_rdexternaldataF_32_OBJECTS =  \
+	$(am_he5_sw_rdexternaldataF_32_OBJECTS)
+he5_sw_rdexternaldataF_32_LDADD = $(LDADD)
+he5_sw_rdexternaldataF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_rdexternaldataF_64_SOURCES_DIST =  \
+	he5_sw_rdexternaldataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_rdexternaldataF_64_OBJECTS = he5_sw_rdexternaldataF_64.$(OBJEXT)
+he5_sw_rdexternaldataF_64_OBJECTS =  \
+	$(am_he5_sw_rdexternaldataF_64_OBJECTS)
+he5_sw_rdexternaldataF_64_LDADD = $(LDADD)
+he5_sw_rdexternaldataF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_sw_readdata_SOURCES = he5_sw_readdata.c
+he5_sw_readdata_OBJECTS = he5_sw_readdata.$(OBJEXT)
+he5_sw_readdata_LDADD = $(LDADD)
+he5_sw_readdata_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_readdataF_32_SOURCES_DIST = he5_sw_readdataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_readdataF_32_OBJECTS = he5_sw_readdataF_32.$(OBJEXT)
+he5_sw_readdataF_32_OBJECTS = $(am_he5_sw_readdataF_32_OBJECTS)
+he5_sw_readdataF_32_LDADD = $(LDADD)
+he5_sw_readdataF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_readdataF_64_SOURCES_DIST = he5_sw_readdataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_readdataF_64_OBJECTS = he5_sw_readdataF_64.$(OBJEXT)
+he5_sw_readdataF_64_OBJECTS = $(am_he5_sw_readdataF_64_OBJECTS)
+he5_sw_readdataF_64_LDADD = $(LDADD)
+he5_sw_readdataF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_sw_setup_SOURCES = he5_sw_setup.c
+he5_sw_setup_OBJECTS = he5_sw_setup.$(OBJEXT)
+he5_sw_setup_LDADD = $(LDADD)
+he5_sw_setup_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_setupF_32_SOURCES_DIST = he5_sw_setupF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_setupF_32_OBJECTS = he5_sw_setupF_32.$(OBJEXT)
+he5_sw_setupF_32_OBJECTS = $(am_he5_sw_setupF_32_OBJECTS)
+he5_sw_setupF_32_LDADD = $(LDADD)
+he5_sw_setupF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_setupF_64_SOURCES_DIST = he5_sw_setupF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_setupF_64_OBJECTS = he5_sw_setupF_64.$(OBJEXT)
+he5_sw_setupF_64_OBJECTS = $(am_he5_sw_setupF_64_OBJECTS)
+he5_sw_setupF_64_LDADD = $(LDADD)
+he5_sw_setupF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_sw_subset_SOURCES = he5_sw_subset.c
+he5_sw_subset_OBJECTS = he5_sw_subset.$(OBJEXT)
+he5_sw_subset_LDADD = $(LDADD)
+he5_sw_subset_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_subsetF_32_SOURCES_DIST = he5_sw_subsetF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_subsetF_32_OBJECTS = he5_sw_subsetF_32.$(OBJEXT)
+he5_sw_subsetF_32_OBJECTS = $(am_he5_sw_subsetF_32_OBJECTS)
+he5_sw_subsetF_32_LDADD = $(LDADD)
+he5_sw_subsetF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_subsetF_64_SOURCES_DIST = he5_sw_subsetF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_subsetF_64_OBJECTS = he5_sw_subsetF_64.$(OBJEXT)
+he5_sw_subsetF_64_OBJECTS = $(am_he5_sw_subsetF_64_OBJECTS)
+he5_sw_subsetF_64_LDADD = $(LDADD)
+he5_sw_subsetF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_sw_wrextendrd_SOURCES = he5_sw_wrextendrd.c
+he5_sw_wrextendrd_OBJECTS = he5_sw_wrextendrd.$(OBJEXT)
+he5_sw_wrextendrd_LDADD = $(LDADD)
+he5_sw_wrextendrd_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_sw_wrexternaldata_SOURCES = he5_sw_wrexternaldata.c
+he5_sw_wrexternaldata_OBJECTS = he5_sw_wrexternaldata.$(OBJEXT)
+he5_sw_wrexternaldata_LDADD = $(LDADD)
+he5_sw_wrexternaldata_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_wrexternaldataF_32_SOURCES_DIST =  \
+	he5_sw_wrexternaldataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_wrexternaldataF_32_OBJECTS = he5_sw_wrexternaldataF_32.$(OBJEXT)
+he5_sw_wrexternaldataF_32_OBJECTS =  \
+	$(am_he5_sw_wrexternaldataF_32_OBJECTS)
+he5_sw_wrexternaldataF_32_LDADD = $(LDADD)
+he5_sw_wrexternaldataF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_wrexternaldataF_64_SOURCES_DIST =  \
+	he5_sw_wrexternaldataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_wrexternaldataF_64_OBJECTS = he5_sw_wrexternaldataF_64.$(OBJEXT)
+he5_sw_wrexternaldataF_64_OBJECTS =  \
+	$(am_he5_sw_wrexternaldataF_64_OBJECTS)
+he5_sw_wrexternaldataF_64_LDADD = $(LDADD)
+he5_sw_wrexternaldataF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_sw_writedata_SOURCES = he5_sw_writedata.c
+he5_sw_writedata_OBJECTS = he5_sw_writedata.$(OBJEXT)
+he5_sw_writedata_LDADD = $(LDADD)
+he5_sw_writedata_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_writedataF_32_SOURCES_DIST = he5_sw_writedataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_writedataF_32_OBJECTS = he5_sw_writedataF_32.$(OBJEXT)
+he5_sw_writedataF_32_OBJECTS = $(am_he5_sw_writedataF_32_OBJECTS)
+he5_sw_writedataF_32_LDADD = $(LDADD)
+he5_sw_writedataF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_sw_writedataF_64_SOURCES_DIST = he5_sw_writedataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_sw_writedataF_64_OBJECTS = he5_sw_writedataF_64.$(OBJEXT)
+he5_sw_writedataF_64_OBJECTS = $(am_he5_sw_writedataF_64_OBJECTS)
+he5_sw_writedataF_64_LDADD = $(LDADD)
+he5_sw_writedataF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_sw_wrunlimfld_SOURCES = he5_sw_wrunlimfld.c
+he5_sw_wrunlimfld_OBJECTS = he5_sw_wrunlimfld.$(OBJEXT)
+he5_sw_wrunlimfld_LDADD = $(LDADD)
+he5_sw_wrunlimfld_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_za_datainfo_SOURCES = he5_za_datainfo.c
+he5_za_datainfo_OBJECTS = he5_za_datainfo.$(OBJEXT)
+he5_za_datainfo_LDADD = $(LDADD)
+he5_za_datainfo_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_za_defexternalfld_SOURCES = he5_za_defexternalfld.c
+he5_za_defexternalfld_OBJECTS = he5_za_defexternalfld.$(OBJEXT)
+he5_za_defexternalfld_LDADD = $(LDADD)
+he5_za_defexternalfld_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_defexternalfldF_32_SOURCES_DIST =  \
+	he5_za_defexternalfldF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_defexternalfldF_32_OBJECTS = he5_za_defexternalfldF_32.$(OBJEXT)
+he5_za_defexternalfldF_32_OBJECTS =  \
+	$(am_he5_za_defexternalfldF_32_OBJECTS)
+he5_za_defexternalfldF_32_LDADD = $(LDADD)
+he5_za_defexternalfldF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_defexternalfldF_64_SOURCES_DIST =  \
+	he5_za_defexternalfldF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_defexternalfldF_64_OBJECTS = he5_za_defexternalfldF_64.$(OBJEXT)
+he5_za_defexternalfldF_64_OBJECTS =  \
+	$(am_he5_za_defexternalfldF_64_OBJECTS)
+he5_za_defexternalfldF_64_LDADD = $(LDADD)
+he5_za_defexternalfldF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_za_definefields_SOURCES = he5_za_definefields.c
+he5_za_definefields_OBJECTS = he5_za_definefields.$(OBJEXT)
+he5_za_definefields_LDADD = $(LDADD)
+he5_za_definefields_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_definefieldsF_32_SOURCES_DIST = he5_za_definefieldsF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_definefieldsF_32_OBJECTS = he5_za_definefieldsF_32.$(OBJEXT)
+he5_za_definefieldsF_32_OBJECTS =  \
+	$(am_he5_za_definefieldsF_32_OBJECTS)
+he5_za_definefieldsF_32_LDADD = $(LDADD)
+he5_za_definefieldsF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_definefieldsF_64_SOURCES_DIST = he5_za_definefieldsF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_definefieldsF_64_OBJECTS = he5_za_definefieldsF_64.$(OBJEXT)
+he5_za_definefieldsF_64_OBJECTS =  \
+	$(am_he5_za_definefieldsF_64_OBJECTS)
+he5_za_definefieldsF_64_LDADD = $(LDADD)
+he5_za_definefieldsF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_za_info_SOURCES = he5_za_info.c
+he5_za_info_OBJECTS = he5_za_info.$(OBJEXT)
+he5_za_info_LDADD = $(LDADD)
+he5_za_info_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am__he5_za_infoF_32_SOURCES_DIST = he5_za_infoF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_infoF_32_OBJECTS = he5_za_infoF_32.$(OBJEXT)
+he5_za_infoF_32_OBJECTS = $(am_he5_za_infoF_32_OBJECTS)
+he5_za_infoF_32_LDADD = $(LDADD)
+he5_za_infoF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_infoF_64_SOURCES_DIST = he5_za_infoF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_infoF_64_OBJECTS = he5_za_infoF_64.$(OBJEXT)
+he5_za_infoF_64_OBJECTS = $(am_he5_za_infoF_64_OBJECTS)
+he5_za_infoF_64_LDADD = $(LDADD)
+he5_za_infoF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_za_rdexternaldata_SOURCES = he5_za_rdexternaldata.c
+he5_za_rdexternaldata_OBJECTS = he5_za_rdexternaldata.$(OBJEXT)
+he5_za_rdexternaldata_LDADD = $(LDADD)
+he5_za_rdexternaldata_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_rdexternaldataF_32_SOURCES_DIST =  \
+	he5_za_rdexternaldataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_rdexternaldataF_32_OBJECTS = he5_za_rdexternaldataF_32.$(OBJEXT)
+he5_za_rdexternaldataF_32_OBJECTS =  \
+	$(am_he5_za_rdexternaldataF_32_OBJECTS)
+he5_za_rdexternaldataF_32_LDADD = $(LDADD)
+he5_za_rdexternaldataF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_rdexternaldataF_64_SOURCES_DIST =  \
+	he5_za_rdexternaldataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_rdexternaldataF_64_OBJECTS = he5_za_rdexternaldataF_64.$(OBJEXT)
+he5_za_rdexternaldataF_64_OBJECTS =  \
+	$(am_he5_za_rdexternaldataF_64_OBJECTS)
+he5_za_rdexternaldataF_64_LDADD = $(LDADD)
+he5_za_rdexternaldataF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_za_readdata_SOURCES = he5_za_readdata.c
+he5_za_readdata_OBJECTS = he5_za_readdata.$(OBJEXT)
+he5_za_readdata_LDADD = $(LDADD)
+he5_za_readdata_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_readdataF_32_SOURCES_DIST = he5_za_readdataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_readdataF_32_OBJECTS = he5_za_readdataF_32.$(OBJEXT)
+he5_za_readdataF_32_OBJECTS = $(am_he5_za_readdataF_32_OBJECTS)
+he5_za_readdataF_32_LDADD = $(LDADD)
+he5_za_readdataF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_readdataF_64_SOURCES_DIST = he5_za_readdataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_readdataF_64_OBJECTS = he5_za_readdataF_64.$(OBJEXT)
+he5_za_readdataF_64_OBJECTS = $(am_he5_za_readdataF_64_OBJECTS)
+he5_za_readdataF_64_LDADD = $(LDADD)
+he5_za_readdataF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_za_setup_SOURCES = he5_za_setup.c
+he5_za_setup_OBJECTS = he5_za_setup.$(OBJEXT)
+he5_za_setup_LDADD = $(LDADD)
+he5_za_setup_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_setupF_32_SOURCES_DIST = he5_za_setupF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_setupF_32_OBJECTS = he5_za_setupF_32.$(OBJEXT)
+he5_za_setupF_32_OBJECTS = $(am_he5_za_setupF_32_OBJECTS)
+he5_za_setupF_32_LDADD = $(LDADD)
+he5_za_setupF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_setupF_64_SOURCES_DIST = he5_za_setupF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_setupF_64_OBJECTS = he5_za_setupF_64.$(OBJEXT)
+he5_za_setupF_64_OBJECTS = $(am_he5_za_setupF_64_OBJECTS)
+he5_za_setupF_64_LDADD = $(LDADD)
+he5_za_setupF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_za_wrexternaldata_SOURCES = he5_za_wrexternaldata.c
+he5_za_wrexternaldata_OBJECTS = he5_za_wrexternaldata.$(OBJEXT)
+he5_za_wrexternaldata_LDADD = $(LDADD)
+he5_za_wrexternaldata_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_wrexternaldataF_32_SOURCES_DIST =  \
+	he5_za_wrexternaldataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_wrexternaldataF_32_OBJECTS = he5_za_wrexternaldataF_32.$(OBJEXT)
+he5_za_wrexternaldataF_32_OBJECTS =  \
+	$(am_he5_za_wrexternaldataF_32_OBJECTS)
+he5_za_wrexternaldataF_32_LDADD = $(LDADD)
+he5_za_wrexternaldataF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_wrexternaldataF_64_SOURCES_DIST =  \
+	he5_za_wrexternaldataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_wrexternaldataF_64_OBJECTS = he5_za_wrexternaldataF_64.$(OBJEXT)
+he5_za_wrexternaldataF_64_OBJECTS =  \
+	$(am_he5_za_wrexternaldataF_64_OBJECTS)
+he5_za_wrexternaldataF_64_LDADD = $(LDADD)
+he5_za_wrexternaldataF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+he5_za_writedata_SOURCES = he5_za_writedata.c
+he5_za_writedata_OBJECTS = he5_za_writedata.$(OBJEXT)
+he5_za_writedata_LDADD = $(LDADD)
+he5_za_writedata_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_writedataF_32_SOURCES_DIST = he5_za_writedataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_writedataF_32_OBJECTS = he5_za_writedataF_32.$(OBJEXT)
+he5_za_writedataF_32_OBJECTS = $(am_he5_za_writedataF_32_OBJECTS)
+he5_za_writedataF_32_LDADD = $(LDADD)
+he5_za_writedataF_32_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+am__he5_za_writedataF_64_SOURCES_DIST = he5_za_writedataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_he5_za_writedataF_64_OBJECTS = he5_za_writedataF_64.$(OBJEXT)
+he5_za_writedataF_64_OBJECTS = $(am_he5_za_writedataF_64_OBJECTS)
+he5_za_writedataF_64_LDADD = $(LDADD)
+he5_za_writedataF_64_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -DH5_USE_16_API
+LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS) -DH5_USE_16_API
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS) -DH5_USE_16_API
+LTF77COMPILE = $(LIBTOOL) --mode=compile --tag=F77 $(F77) $(AM_FFLAGS) \
+	$(FFLAGS) -DH5_USE_16_API
+F77LD = $(F77)
+F77LINK = $(LIBTOOL) --mode=link --tag=F77 $(F77LD) $(AM_FFLAGS) \
+	$(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = he5_gd_datainfo.c he5_gd_defexternalfld.c \
+	he5_gd_definefields.c $(he5_gd_definefieldsF_32_SOURCES) \
+	$(he5_gd_definefieldsF_64_SOURCES) he5_gd_defunlimfld.c \
+	he5_gd_info.c $(he5_gd_infoF_32_SOURCES) \
+	$(he5_gd_infoF_64_SOURCES) he5_gd_rdexternaldata.c \
+	he5_gd_readdata.c $(he5_gd_readdataF_32_SOURCES) \
+	$(he5_gd_readdataF_64_SOURCES) he5_gd_setup.c \
+	$(he5_gd_setupF_32_SOURCES) $(he5_gd_setupF_64_SOURCES) \
+	he5_gd_subset.c $(he5_gd_subsetF_32_SOURCES) \
+	$(he5_gd_subsetF_64_SOURCES) he5_gd_wrexternaldata.c \
+	he5_gd_writedata.c $(he5_gd_writedataF_32_SOURCES) \
+	$(he5_gd_writedataF_64_SOURCES) he5_gd_wrunlimfld.c \
+	he5_pt_datainfo.c $(he5_pt_datainfoF_32_SOURCES) \
+	$(he5_pt_datainfoF_64_SOURCES) he5_pt_definelevels.c \
+	$(he5_pt_definelevelsF_32_SOURCES) \
+	$(he5_pt_definelevelsF_64_SOURCES) he5_pt_readattrs.c \
+	$(he5_pt_readattrsF_32_SOURCES) \
+	$(he5_pt_readattrsF_64_SOURCES) he5_pt_readdata.c \
+	$(he5_pt_readdataF_32_SOURCES) $(he5_pt_readdataF_64_SOURCES) \
+	he5_pt_setup.c $(he5_pt_setupF_32_SOURCES) \
+	$(he5_pt_setupF_64_SOURCES) he5_pt_updatelevels.c \
+	$(he5_pt_updatelevelsF_32_SOURCES) \
+	$(he5_pt_updatelevelsF_64_SOURCES) he5_pt_writeattrs.c \
+	$(he5_pt_writeattrsF_32_SOURCES) \
+	$(he5_pt_writeattrsF_64_SOURCES) he5_pt_writedata.c \
+	$(he5_pt_writedataF_32_SOURCES) \
+	$(he5_pt_writedataF_64_SOURCES) he5_sw_datainfo.c \
+	he5_sw_defexternalfld.c $(he5_sw_defexternalfldF_32_SOURCES) \
+	$(he5_sw_defexternalfldF_64_SOURCES) he5_sw_definefields.c \
+	$(he5_sw_definefieldsF_32_SOURCES) \
+	$(he5_sw_definefieldsF_64_SOURCES) he5_sw_defunlimfld.c \
+	he5_sw_info.c $(he5_sw_infoF_32_SOURCES) \
+	$(he5_sw_infoF_64_SOURCES) he5_sw_rdexternaldata.c \
+	$(he5_sw_rdexternaldataF_32_SOURCES) \
+	$(he5_sw_rdexternaldataF_64_SOURCES) he5_sw_readdata.c \
+	$(he5_sw_readdataF_32_SOURCES) $(he5_sw_readdataF_64_SOURCES) \
+	he5_sw_setup.c $(he5_sw_setupF_32_SOURCES) \
+	$(he5_sw_setupF_64_SOURCES) he5_sw_subset.c \
+	$(he5_sw_subsetF_32_SOURCES) $(he5_sw_subsetF_64_SOURCES) \
+	he5_sw_wrextendrd.c he5_sw_wrexternaldata.c \
+	$(he5_sw_wrexternaldataF_32_SOURCES) \
+	$(he5_sw_wrexternaldataF_64_SOURCES) he5_sw_writedata.c \
+	$(he5_sw_writedataF_32_SOURCES) \
+	$(he5_sw_writedataF_64_SOURCES) he5_sw_wrunlimfld.c \
+	he5_za_datainfo.c he5_za_defexternalfld.c \
+	$(he5_za_defexternalfldF_32_SOURCES) \
+	$(he5_za_defexternalfldF_64_SOURCES) he5_za_definefields.c \
+	$(he5_za_definefieldsF_32_SOURCES) \
+	$(he5_za_definefieldsF_64_SOURCES) he5_za_info.c \
+	$(he5_za_infoF_32_SOURCES) $(he5_za_infoF_64_SOURCES) \
+	he5_za_rdexternaldata.c $(he5_za_rdexternaldataF_32_SOURCES) \
+	$(he5_za_rdexternaldataF_64_SOURCES) he5_za_readdata.c \
+	$(he5_za_readdataF_32_SOURCES) $(he5_za_readdataF_64_SOURCES) \
+	he5_za_setup.c $(he5_za_setupF_32_SOURCES) \
+	$(he5_za_setupF_64_SOURCES) he5_za_wrexternaldata.c \
+	$(he5_za_wrexternaldataF_32_SOURCES) \
+	$(he5_za_wrexternaldataF_64_SOURCES) he5_za_writedata.c \
+	$(he5_za_writedataF_32_SOURCES) \
+	$(he5_za_writedataF_64_SOURCES)
+DIST_SOURCES = he5_gd_datainfo.c he5_gd_defexternalfld.c \
+	he5_gd_definefields.c \
+	$(am__he5_gd_definefieldsF_32_SOURCES_DIST) \
+	$(am__he5_gd_definefieldsF_64_SOURCES_DIST) \
+	he5_gd_defunlimfld.c he5_gd_info.c \
+	$(am__he5_gd_infoF_32_SOURCES_DIST) \
+	$(am__he5_gd_infoF_64_SOURCES_DIST) he5_gd_rdexternaldata.c \
+	he5_gd_readdata.c $(am__he5_gd_readdataF_32_SOURCES_DIST) \
+	$(am__he5_gd_readdataF_64_SOURCES_DIST) he5_gd_setup.c \
+	$(am__he5_gd_setupF_32_SOURCES_DIST) \
+	$(am__he5_gd_setupF_64_SOURCES_DIST) he5_gd_subset.c \
+	$(am__he5_gd_subsetF_32_SOURCES_DIST) \
+	$(am__he5_gd_subsetF_64_SOURCES_DIST) he5_gd_wrexternaldata.c \
+	he5_gd_writedata.c $(am__he5_gd_writedataF_32_SOURCES_DIST) \
+	$(am__he5_gd_writedataF_64_SOURCES_DIST) he5_gd_wrunlimfld.c \
+	he5_pt_datainfo.c $(am__he5_pt_datainfoF_32_SOURCES_DIST) \
+	$(am__he5_pt_datainfoF_64_SOURCES_DIST) he5_pt_definelevels.c \
+	$(am__he5_pt_definelevelsF_32_SOURCES_DIST) \
+	$(am__he5_pt_definelevelsF_64_SOURCES_DIST) he5_pt_readattrs.c \
+	$(am__he5_pt_readattrsF_32_SOURCES_DIST) \
+	$(am__he5_pt_readattrsF_64_SOURCES_DIST) he5_pt_readdata.c \
+	$(am__he5_pt_readdataF_32_SOURCES_DIST) \
+	$(am__he5_pt_readdataF_64_SOURCES_DIST) he5_pt_setup.c \
+	$(am__he5_pt_setupF_32_SOURCES_DIST) \
+	$(am__he5_pt_setupF_64_SOURCES_DIST) he5_pt_updatelevels.c \
+	$(am__he5_pt_updatelevelsF_32_SOURCES_DIST) \
+	$(am__he5_pt_updatelevelsF_64_SOURCES_DIST) \
+	he5_pt_writeattrs.c $(am__he5_pt_writeattrsF_32_SOURCES_DIST) \
+	$(am__he5_pt_writeattrsF_64_SOURCES_DIST) he5_pt_writedata.c \
+	$(am__he5_pt_writedataF_32_SOURCES_DIST) \
+	$(am__he5_pt_writedataF_64_SOURCES_DIST) he5_sw_datainfo.c \
+	he5_sw_defexternalfld.c \
+	$(am__he5_sw_defexternalfldF_32_SOURCES_DIST) \
+	$(am__he5_sw_defexternalfldF_64_SOURCES_DIST) \
+	he5_sw_definefields.c \
+	$(am__he5_sw_definefieldsF_32_SOURCES_DIST) \
+	$(am__he5_sw_definefieldsF_64_SOURCES_DIST) \
+	he5_sw_defunlimfld.c he5_sw_info.c \
+	$(am__he5_sw_infoF_32_SOURCES_DIST) \
+	$(am__he5_sw_infoF_64_SOURCES_DIST) he5_sw_rdexternaldata.c \
+	$(am__he5_sw_rdexternaldataF_32_SOURCES_DIST) \
+	$(am__he5_sw_rdexternaldataF_64_SOURCES_DIST) \
+	he5_sw_readdata.c $(am__he5_sw_readdataF_32_SOURCES_DIST) \
+	$(am__he5_sw_readdataF_64_SOURCES_DIST) he5_sw_setup.c \
+	$(am__he5_sw_setupF_32_SOURCES_DIST) \
+	$(am__he5_sw_setupF_64_SOURCES_DIST) he5_sw_subset.c \
+	$(am__he5_sw_subsetF_32_SOURCES_DIST) \
+	$(am__he5_sw_subsetF_64_SOURCES_DIST) he5_sw_wrextendrd.c \
+	he5_sw_wrexternaldata.c \
+	$(am__he5_sw_wrexternaldataF_32_SOURCES_DIST) \
+	$(am__he5_sw_wrexternaldataF_64_SOURCES_DIST) \
+	he5_sw_writedata.c $(am__he5_sw_writedataF_32_SOURCES_DIST) \
+	$(am__he5_sw_writedataF_64_SOURCES_DIST) he5_sw_wrunlimfld.c \
+	he5_za_datainfo.c he5_za_defexternalfld.c \
+	$(am__he5_za_defexternalfldF_32_SOURCES_DIST) \
+	$(am__he5_za_defexternalfldF_64_SOURCES_DIST) \
+	he5_za_definefields.c \
+	$(am__he5_za_definefieldsF_32_SOURCES_DIST) \
+	$(am__he5_za_definefieldsF_64_SOURCES_DIST) he5_za_info.c \
+	$(am__he5_za_infoF_32_SOURCES_DIST) \
+	$(am__he5_za_infoF_64_SOURCES_DIST) he5_za_rdexternaldata.c \
+	$(am__he5_za_rdexternaldataF_32_SOURCES_DIST) \
+	$(am__he5_za_rdexternaldataF_64_SOURCES_DIST) \
+	he5_za_readdata.c $(am__he5_za_readdataF_32_SOURCES_DIST) \
+	$(am__he5_za_readdataF_64_SOURCES_DIST) he5_za_setup.c \
+	$(am__he5_za_setupF_32_SOURCES_DIST) \
+	$(am__he5_za_setupF_64_SOURCES_DIST) he5_za_wrexternaldata.c \
+	$(am__he5_za_wrexternaldataF_32_SOURCES_DIST) \
+	$(am__he5_za_wrexternaldataF_64_SOURCES_DIST) \
+	he5_za_writedata.c $(am__he5_za_writedataF_32_SOURCES_DIST) \
+	$(am__he5_za_writedataF_64_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F2CFORTRAN_32PTR_CONDITIONAL_FALSE = @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@
+F2CFORTRAN_32PTR_CONDITIONAL_TRUE = @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@
+F2CFORTRAN_90_CONDITIONAL_FALSE = @F2CFORTRAN_90_CONDITIONAL_FALSE@
+F2CFORTRAN_90_CONDITIONAL_TRUE = @F2CFORTRAN_90_CONDITIONAL_TRUE@
+F2CFORTRAN_CONDITIONAL_FALSE = @F2CFORTRAN_CONDITIONAL_FALSE@
+F2CFORTRAN_CONDITIONAL_TRUE = @F2CFORTRAN_CONDITIONAL_TRUE@
+F77 = @F77@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_INCLUDE_CONDITIONAL_FALSE = @INSTALL_INCLUDE_CONDITIONAL_FALSE@
+INSTALL_INCLUDE_CONDITIONAL_TRUE = @INSTALL_INCLUDE_CONDITIONAL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SZIP_ENCODER_CONDITIONAL_FALSE = @SZIP_ENCODER_CONDITIONAL_FALSE@
+SZIP_ENCODER_CONDITIONAL_TRUE = @SZIP_ENCODER_CONDITIONAL_TRUE@
+TESTDRIVERS_CONDITIONAL_FALSE = @TESTDRIVERS_CONDITIONAL_FALSE@
+TESTDRIVERS_CONDITIONAL_TRUE = @TESTDRIVERS_CONDITIONAL_TRUE@
+THREADSAFE_CONDITIONAL_FALSE = @THREADSAFE_CONDITIONAL_FALSE@
+THREADSAFE_CONDITIONAL_TRUE = @THREADSAFE_CONDITIONAL_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la
+LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
+
+# Boilerplate definitions file
+
+# Link against GCTP library and HDF-EOS5
+INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/gctp/include
+LDADD = $(LIBHDFEOS5) $(LIBGCTP)
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_gd_definefieldsF_32_SOURCES = he5_gd_definefieldsF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_gd_infoF_32_SOURCES = he5_gd_infoF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_gd_readdataF_32_SOURCES = he5_gd_readdataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_gd_setupF_32_SOURCES = he5_gd_setupF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_gd_subsetF_32_SOURCES = he5_gd_subsetF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_gd_writedataF_32_SOURCES = he5_gd_writedataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_datainfoF_32_SOURCES = he5_pt_datainfoF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_definelevelsF_32_SOURCES = he5_pt_definelevelsF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_readattrsF_32_SOURCES = he5_pt_readattrsF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_readdataF_32_SOURCES = he5_pt_readdataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_setupF_32_SOURCES = he5_pt_setupF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_updatelevelsF_32_SOURCES = he5_pt_updatelevelsF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_writeattrsF_32_SOURCES = he5_pt_writeattrsF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_writedataF_32_SOURCES = he5_pt_writedataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_defexternalfldF_32_SOURCES = he5_sw_defexternalfldF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE at he5_sw_definefieldsF_32_SOURCES = he5_sw_definefieldsF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE at he5_sw_definefieldsF_32_SOURCES = he5_sw_definefields_szipF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_infoF_32_SOURCES = he5_sw_infoF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_rdexternaldataF_32_SOURCES = he5_sw_rdexternaldataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_readdataF_32_SOURCES = he5_sw_readdataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_setupF_32_SOURCES = he5_sw_setupF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_subsetF_32_SOURCES = he5_sw_subsetF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_wrexternaldataF_32_SOURCES = he5_sw_wrexternaldataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_writedataF_32_SOURCES = he5_sw_writedataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_defexternalfldF_32_SOURCES = he5_za_defexternalfldF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_definefieldsF_32_SOURCES = he5_za_definefieldsF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_infoF_32_SOURCES = he5_za_infoF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_rdexternaldataF_32_SOURCES = he5_za_rdexternaldataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_readdataF_32_SOURCES = he5_za_readdataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_setupF_32_SOURCES = he5_za_setupF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_wrexternaldataF_32_SOURCES = he5_za_wrexternaldataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_writedataF_32_SOURCES = he5_za_writedataF_32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_gd_definefieldsF_64_SOURCES = he5_gd_definefieldsF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_gd_infoF_64_SOURCES = he5_gd_infoF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_gd_readdataF_64_SOURCES = he5_gd_readdataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_gd_setupF_64_SOURCES = he5_gd_setupF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_gd_subsetF_64_SOURCES = he5_gd_subsetF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_gd_writedataF_64_SOURCES = he5_gd_writedataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_datainfoF_64_SOURCES = he5_pt_datainfoF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_definelevelsF_64_SOURCES = he5_pt_definelevelsF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_readattrsF_64_SOURCES = he5_pt_readattrsF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_readdataF_64_SOURCES = he5_pt_readdataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_setupF_64_SOURCES = he5_pt_setupF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_updatelevelsF_64_SOURCES = he5_pt_updatelevelsF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_writeattrsF_64_SOURCES = he5_pt_writeattrsF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_pt_writedataF_64_SOURCES = he5_pt_writedataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_defexternalfldF_64_SOURCES = he5_sw_defexternalfldF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE at he5_sw_definefieldsF_64_SOURCES = he5_sw_definefieldsF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE at he5_sw_definefieldsF_64_SOURCES = he5_sw_definefields_szipF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_infoF_64_SOURCES = he5_sw_infoF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_rdexternaldataF_64_SOURCES = he5_sw_rdexternaldataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_readdataF_64_SOURCES = he5_sw_readdataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_setupF_64_SOURCES = he5_sw_setupF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_subsetF_64_SOURCES = he5_sw_subsetF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_wrexternaldataF_64_SOURCES = he5_sw_wrexternaldataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_sw_writedataF_64_SOURCES = he5_sw_writedataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_defexternalfldF_64_SOURCES = he5_za_defexternalfldF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_definefieldsF_64_SOURCES = he5_za_definefieldsF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_infoF_64_SOURCES = he5_za_infoF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_rdexternaldataF_64_SOURCES = he5_za_rdexternaldataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_readdataF_64_SOURCES = he5_za_readdataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_setupF_64_SOURCES = he5_za_setupF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_wrexternaldataF_64_SOURCES = he5_za_wrexternaldataF_64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at he5_za_writedataF_64_SOURCES = he5_za_writedataF_64.f
+
+# Tests consist of several programs run in succession.  Each of these
+# names is the name of such a "sequence" of tests.
+TEST_SEQUENCES = gd_write_test gd_unlim_test pt_write_test \
+	sw_write_test sw_unlim_test sw_extend_test za_write_test \
+	$(am__append_3) $(am__append_4)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .f .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  samples/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  samples/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+he5_gd_datainfo$(EXEEXT): $(he5_gd_datainfo_OBJECTS) $(he5_gd_datainfo_DEPENDENCIES) 
+	@rm -f he5_gd_datainfo$(EXEEXT)
+	$(LINK) $(he5_gd_datainfo_LDFLAGS) $(he5_gd_datainfo_OBJECTS) $(he5_gd_datainfo_LDADD) $(LIBS)
+he5_gd_defexternalfld$(EXEEXT): $(he5_gd_defexternalfld_OBJECTS) $(he5_gd_defexternalfld_DEPENDENCIES) 
+	@rm -f he5_gd_defexternalfld$(EXEEXT)
+	$(LINK) $(he5_gd_defexternalfld_LDFLAGS) $(he5_gd_defexternalfld_OBJECTS) $(he5_gd_defexternalfld_LDADD) $(LIBS)
+he5_gd_definefields$(EXEEXT): $(he5_gd_definefields_OBJECTS) $(he5_gd_definefields_DEPENDENCIES) 
+	@rm -f he5_gd_definefields$(EXEEXT)
+	$(LINK) $(he5_gd_definefields_LDFLAGS) $(he5_gd_definefields_OBJECTS) $(he5_gd_definefields_LDADD) $(LIBS)
+he5_gd_definefieldsF_32$(EXEEXT): $(he5_gd_definefieldsF_32_OBJECTS) $(he5_gd_definefieldsF_32_DEPENDENCIES) 
+	@rm -f he5_gd_definefieldsF_32$(EXEEXT)
+	$(F77LINK) $(he5_gd_definefieldsF_32_LDFLAGS) $(he5_gd_definefieldsF_32_OBJECTS) $(he5_gd_definefieldsF_32_LDADD) $(LIBS)
+he5_gd_definefieldsF_64$(EXEEXT): $(he5_gd_definefieldsF_64_OBJECTS) $(he5_gd_definefieldsF_64_DEPENDENCIES) 
+	@rm -f he5_gd_definefieldsF_64$(EXEEXT)
+	$(F77LINK) $(he5_gd_definefieldsF_64_LDFLAGS) $(he5_gd_definefieldsF_64_OBJECTS) $(he5_gd_definefieldsF_64_LDADD) $(LIBS)
+he5_gd_defunlimfld$(EXEEXT): $(he5_gd_defunlimfld_OBJECTS) $(he5_gd_defunlimfld_DEPENDENCIES) 
+	@rm -f he5_gd_defunlimfld$(EXEEXT)
+	$(LINK) $(he5_gd_defunlimfld_LDFLAGS) $(he5_gd_defunlimfld_OBJECTS) $(he5_gd_defunlimfld_LDADD) $(LIBS)
+he5_gd_info$(EXEEXT): $(he5_gd_info_OBJECTS) $(he5_gd_info_DEPENDENCIES) 
+	@rm -f he5_gd_info$(EXEEXT)
+	$(LINK) $(he5_gd_info_LDFLAGS) $(he5_gd_info_OBJECTS) $(he5_gd_info_LDADD) $(LIBS)
+he5_gd_infoF_32$(EXEEXT): $(he5_gd_infoF_32_OBJECTS) $(he5_gd_infoF_32_DEPENDENCIES) 
+	@rm -f he5_gd_infoF_32$(EXEEXT)
+	$(F77LINK) $(he5_gd_infoF_32_LDFLAGS) $(he5_gd_infoF_32_OBJECTS) $(he5_gd_infoF_32_LDADD) $(LIBS)
+he5_gd_infoF_64$(EXEEXT): $(he5_gd_infoF_64_OBJECTS) $(he5_gd_infoF_64_DEPENDENCIES) 
+	@rm -f he5_gd_infoF_64$(EXEEXT)
+	$(F77LINK) $(he5_gd_infoF_64_LDFLAGS) $(he5_gd_infoF_64_OBJECTS) $(he5_gd_infoF_64_LDADD) $(LIBS)
+he5_gd_rdexternaldata$(EXEEXT): $(he5_gd_rdexternaldata_OBJECTS) $(he5_gd_rdexternaldata_DEPENDENCIES) 
+	@rm -f he5_gd_rdexternaldata$(EXEEXT)
+	$(LINK) $(he5_gd_rdexternaldata_LDFLAGS) $(he5_gd_rdexternaldata_OBJECTS) $(he5_gd_rdexternaldata_LDADD) $(LIBS)
+he5_gd_readdata$(EXEEXT): $(he5_gd_readdata_OBJECTS) $(he5_gd_readdata_DEPENDENCIES) 
+	@rm -f he5_gd_readdata$(EXEEXT)
+	$(LINK) $(he5_gd_readdata_LDFLAGS) $(he5_gd_readdata_OBJECTS) $(he5_gd_readdata_LDADD) $(LIBS)
+he5_gd_readdataF_32$(EXEEXT): $(he5_gd_readdataF_32_OBJECTS) $(he5_gd_readdataF_32_DEPENDENCIES) 
+	@rm -f he5_gd_readdataF_32$(EXEEXT)
+	$(F77LINK) $(he5_gd_readdataF_32_LDFLAGS) $(he5_gd_readdataF_32_OBJECTS) $(he5_gd_readdataF_32_LDADD) $(LIBS)
+he5_gd_readdataF_64$(EXEEXT): $(he5_gd_readdataF_64_OBJECTS) $(he5_gd_readdataF_64_DEPENDENCIES) 
+	@rm -f he5_gd_readdataF_64$(EXEEXT)
+	$(F77LINK) $(he5_gd_readdataF_64_LDFLAGS) $(he5_gd_readdataF_64_OBJECTS) $(he5_gd_readdataF_64_LDADD) $(LIBS)
+he5_gd_setup$(EXEEXT): $(he5_gd_setup_OBJECTS) $(he5_gd_setup_DEPENDENCIES) 
+	@rm -f he5_gd_setup$(EXEEXT)
+	$(LINK) $(he5_gd_setup_LDFLAGS) $(he5_gd_setup_OBJECTS) $(he5_gd_setup_LDADD) $(LIBS)
+he5_gd_setupF_32$(EXEEXT): $(he5_gd_setupF_32_OBJECTS) $(he5_gd_setupF_32_DEPENDENCIES) 
+	@rm -f he5_gd_setupF_32$(EXEEXT)
+	$(F77LINK) $(he5_gd_setupF_32_LDFLAGS) $(he5_gd_setupF_32_OBJECTS) $(he5_gd_setupF_32_LDADD) $(LIBS)
+he5_gd_setupF_64$(EXEEXT): $(he5_gd_setupF_64_OBJECTS) $(he5_gd_setupF_64_DEPENDENCIES) 
+	@rm -f he5_gd_setupF_64$(EXEEXT)
+	$(F77LINK) $(he5_gd_setupF_64_LDFLAGS) $(he5_gd_setupF_64_OBJECTS) $(he5_gd_setupF_64_LDADD) $(LIBS)
+he5_gd_subset$(EXEEXT): $(he5_gd_subset_OBJECTS) $(he5_gd_subset_DEPENDENCIES) 
+	@rm -f he5_gd_subset$(EXEEXT)
+	$(LINK) $(he5_gd_subset_LDFLAGS) $(he5_gd_subset_OBJECTS) $(he5_gd_subset_LDADD) $(LIBS)
+he5_gd_subsetF_32$(EXEEXT): $(he5_gd_subsetF_32_OBJECTS) $(he5_gd_subsetF_32_DEPENDENCIES) 
+	@rm -f he5_gd_subsetF_32$(EXEEXT)
+	$(F77LINK) $(he5_gd_subsetF_32_LDFLAGS) $(he5_gd_subsetF_32_OBJECTS) $(he5_gd_subsetF_32_LDADD) $(LIBS)
+he5_gd_subsetF_64$(EXEEXT): $(he5_gd_subsetF_64_OBJECTS) $(he5_gd_subsetF_64_DEPENDENCIES) 
+	@rm -f he5_gd_subsetF_64$(EXEEXT)
+	$(F77LINK) $(he5_gd_subsetF_64_LDFLAGS) $(he5_gd_subsetF_64_OBJECTS) $(he5_gd_subsetF_64_LDADD) $(LIBS)
+he5_gd_wrexternaldata$(EXEEXT): $(he5_gd_wrexternaldata_OBJECTS) $(he5_gd_wrexternaldata_DEPENDENCIES) 
+	@rm -f he5_gd_wrexternaldata$(EXEEXT)
+	$(LINK) $(he5_gd_wrexternaldata_LDFLAGS) $(he5_gd_wrexternaldata_OBJECTS) $(he5_gd_wrexternaldata_LDADD) $(LIBS)
+he5_gd_writedata$(EXEEXT): $(he5_gd_writedata_OBJECTS) $(he5_gd_writedata_DEPENDENCIES) 
+	@rm -f he5_gd_writedata$(EXEEXT)
+	$(LINK) $(he5_gd_writedata_LDFLAGS) $(he5_gd_writedata_OBJECTS) $(he5_gd_writedata_LDADD) $(LIBS)
+he5_gd_writedataF_32$(EXEEXT): $(he5_gd_writedataF_32_OBJECTS) $(he5_gd_writedataF_32_DEPENDENCIES) 
+	@rm -f he5_gd_writedataF_32$(EXEEXT)
+	$(F77LINK) $(he5_gd_writedataF_32_LDFLAGS) $(he5_gd_writedataF_32_OBJECTS) $(he5_gd_writedataF_32_LDADD) $(LIBS)
+he5_gd_writedataF_64$(EXEEXT): $(he5_gd_writedataF_64_OBJECTS) $(he5_gd_writedataF_64_DEPENDENCIES) 
+	@rm -f he5_gd_writedataF_64$(EXEEXT)
+	$(F77LINK) $(he5_gd_writedataF_64_LDFLAGS) $(he5_gd_writedataF_64_OBJECTS) $(he5_gd_writedataF_64_LDADD) $(LIBS)
+he5_gd_wrunlimfld$(EXEEXT): $(he5_gd_wrunlimfld_OBJECTS) $(he5_gd_wrunlimfld_DEPENDENCIES) 
+	@rm -f he5_gd_wrunlimfld$(EXEEXT)
+	$(LINK) $(he5_gd_wrunlimfld_LDFLAGS) $(he5_gd_wrunlimfld_OBJECTS) $(he5_gd_wrunlimfld_LDADD) $(LIBS)
+he5_pt_datainfo$(EXEEXT): $(he5_pt_datainfo_OBJECTS) $(he5_pt_datainfo_DEPENDENCIES) 
+	@rm -f he5_pt_datainfo$(EXEEXT)
+	$(LINK) $(he5_pt_datainfo_LDFLAGS) $(he5_pt_datainfo_OBJECTS) $(he5_pt_datainfo_LDADD) $(LIBS)
+he5_pt_datainfoF_32$(EXEEXT): $(he5_pt_datainfoF_32_OBJECTS) $(he5_pt_datainfoF_32_DEPENDENCIES) 
+	@rm -f he5_pt_datainfoF_32$(EXEEXT)
+	$(F77LINK) $(he5_pt_datainfoF_32_LDFLAGS) $(he5_pt_datainfoF_32_OBJECTS) $(he5_pt_datainfoF_32_LDADD) $(LIBS)
+he5_pt_datainfoF_64$(EXEEXT): $(he5_pt_datainfoF_64_OBJECTS) $(he5_pt_datainfoF_64_DEPENDENCIES) 
+	@rm -f he5_pt_datainfoF_64$(EXEEXT)
+	$(F77LINK) $(he5_pt_datainfoF_64_LDFLAGS) $(he5_pt_datainfoF_64_OBJECTS) $(he5_pt_datainfoF_64_LDADD) $(LIBS)
+he5_pt_definelevels$(EXEEXT): $(he5_pt_definelevels_OBJECTS) $(he5_pt_definelevels_DEPENDENCIES) 
+	@rm -f he5_pt_definelevels$(EXEEXT)
+	$(LINK) $(he5_pt_definelevels_LDFLAGS) $(he5_pt_definelevels_OBJECTS) $(he5_pt_definelevels_LDADD) $(LIBS)
+he5_pt_definelevelsF_32$(EXEEXT): $(he5_pt_definelevelsF_32_OBJECTS) $(he5_pt_definelevelsF_32_DEPENDENCIES) 
+	@rm -f he5_pt_definelevelsF_32$(EXEEXT)
+	$(F77LINK) $(he5_pt_definelevelsF_32_LDFLAGS) $(he5_pt_definelevelsF_32_OBJECTS) $(he5_pt_definelevelsF_32_LDADD) $(LIBS)
+he5_pt_definelevelsF_64$(EXEEXT): $(he5_pt_definelevelsF_64_OBJECTS) $(he5_pt_definelevelsF_64_DEPENDENCIES) 
+	@rm -f he5_pt_definelevelsF_64$(EXEEXT)
+	$(F77LINK) $(he5_pt_definelevelsF_64_LDFLAGS) $(he5_pt_definelevelsF_64_OBJECTS) $(he5_pt_definelevelsF_64_LDADD) $(LIBS)
+he5_pt_readattrs$(EXEEXT): $(he5_pt_readattrs_OBJECTS) $(he5_pt_readattrs_DEPENDENCIES) 
+	@rm -f he5_pt_readattrs$(EXEEXT)
+	$(LINK) $(he5_pt_readattrs_LDFLAGS) $(he5_pt_readattrs_OBJECTS) $(he5_pt_readattrs_LDADD) $(LIBS)
+he5_pt_readattrsF_32$(EXEEXT): $(he5_pt_readattrsF_32_OBJECTS) $(he5_pt_readattrsF_32_DEPENDENCIES) 
+	@rm -f he5_pt_readattrsF_32$(EXEEXT)
+	$(F77LINK) $(he5_pt_readattrsF_32_LDFLAGS) $(he5_pt_readattrsF_32_OBJECTS) $(he5_pt_readattrsF_32_LDADD) $(LIBS)
+he5_pt_readattrsF_64$(EXEEXT): $(he5_pt_readattrsF_64_OBJECTS) $(he5_pt_readattrsF_64_DEPENDENCIES) 
+	@rm -f he5_pt_readattrsF_64$(EXEEXT)
+	$(F77LINK) $(he5_pt_readattrsF_64_LDFLAGS) $(he5_pt_readattrsF_64_OBJECTS) $(he5_pt_readattrsF_64_LDADD) $(LIBS)
+he5_pt_readdata$(EXEEXT): $(he5_pt_readdata_OBJECTS) $(he5_pt_readdata_DEPENDENCIES) 
+	@rm -f he5_pt_readdata$(EXEEXT)
+	$(LINK) $(he5_pt_readdata_LDFLAGS) $(he5_pt_readdata_OBJECTS) $(he5_pt_readdata_LDADD) $(LIBS)
+he5_pt_readdataF_32$(EXEEXT): $(he5_pt_readdataF_32_OBJECTS) $(he5_pt_readdataF_32_DEPENDENCIES) 
+	@rm -f he5_pt_readdataF_32$(EXEEXT)
+	$(F77LINK) $(he5_pt_readdataF_32_LDFLAGS) $(he5_pt_readdataF_32_OBJECTS) $(he5_pt_readdataF_32_LDADD) $(LIBS)
+he5_pt_readdataF_64$(EXEEXT): $(he5_pt_readdataF_64_OBJECTS) $(he5_pt_readdataF_64_DEPENDENCIES) 
+	@rm -f he5_pt_readdataF_64$(EXEEXT)
+	$(F77LINK) $(he5_pt_readdataF_64_LDFLAGS) $(he5_pt_readdataF_64_OBJECTS) $(he5_pt_readdataF_64_LDADD) $(LIBS)
+he5_pt_setup$(EXEEXT): $(he5_pt_setup_OBJECTS) $(he5_pt_setup_DEPENDENCIES) 
+	@rm -f he5_pt_setup$(EXEEXT)
+	$(LINK) $(he5_pt_setup_LDFLAGS) $(he5_pt_setup_OBJECTS) $(he5_pt_setup_LDADD) $(LIBS)
+he5_pt_setupF_32$(EXEEXT): $(he5_pt_setupF_32_OBJECTS) $(he5_pt_setupF_32_DEPENDENCIES) 
+	@rm -f he5_pt_setupF_32$(EXEEXT)
+	$(F77LINK) $(he5_pt_setupF_32_LDFLAGS) $(he5_pt_setupF_32_OBJECTS) $(he5_pt_setupF_32_LDADD) $(LIBS)
+he5_pt_setupF_64$(EXEEXT): $(he5_pt_setupF_64_OBJECTS) $(he5_pt_setupF_64_DEPENDENCIES) 
+	@rm -f he5_pt_setupF_64$(EXEEXT)
+	$(F77LINK) $(he5_pt_setupF_64_LDFLAGS) $(he5_pt_setupF_64_OBJECTS) $(he5_pt_setupF_64_LDADD) $(LIBS)
+he5_pt_updatelevels$(EXEEXT): $(he5_pt_updatelevels_OBJECTS) $(he5_pt_updatelevels_DEPENDENCIES) 
+	@rm -f he5_pt_updatelevels$(EXEEXT)
+	$(LINK) $(he5_pt_updatelevels_LDFLAGS) $(he5_pt_updatelevels_OBJECTS) $(he5_pt_updatelevels_LDADD) $(LIBS)
+he5_pt_updatelevelsF_32$(EXEEXT): $(he5_pt_updatelevelsF_32_OBJECTS) $(he5_pt_updatelevelsF_32_DEPENDENCIES) 
+	@rm -f he5_pt_updatelevelsF_32$(EXEEXT)
+	$(F77LINK) $(he5_pt_updatelevelsF_32_LDFLAGS) $(he5_pt_updatelevelsF_32_OBJECTS) $(he5_pt_updatelevelsF_32_LDADD) $(LIBS)
+he5_pt_updatelevelsF_64$(EXEEXT): $(he5_pt_updatelevelsF_64_OBJECTS) $(he5_pt_updatelevelsF_64_DEPENDENCIES) 
+	@rm -f he5_pt_updatelevelsF_64$(EXEEXT)
+	$(F77LINK) $(he5_pt_updatelevelsF_64_LDFLAGS) $(he5_pt_updatelevelsF_64_OBJECTS) $(he5_pt_updatelevelsF_64_LDADD) $(LIBS)
+he5_pt_writeattrs$(EXEEXT): $(he5_pt_writeattrs_OBJECTS) $(he5_pt_writeattrs_DEPENDENCIES) 
+	@rm -f he5_pt_writeattrs$(EXEEXT)
+	$(LINK) $(he5_pt_writeattrs_LDFLAGS) $(he5_pt_writeattrs_OBJECTS) $(he5_pt_writeattrs_LDADD) $(LIBS)
+he5_pt_writeattrsF_32$(EXEEXT): $(he5_pt_writeattrsF_32_OBJECTS) $(he5_pt_writeattrsF_32_DEPENDENCIES) 
+	@rm -f he5_pt_writeattrsF_32$(EXEEXT)
+	$(F77LINK) $(he5_pt_writeattrsF_32_LDFLAGS) $(he5_pt_writeattrsF_32_OBJECTS) $(he5_pt_writeattrsF_32_LDADD) $(LIBS)
+he5_pt_writeattrsF_64$(EXEEXT): $(he5_pt_writeattrsF_64_OBJECTS) $(he5_pt_writeattrsF_64_DEPENDENCIES) 
+	@rm -f he5_pt_writeattrsF_64$(EXEEXT)
+	$(F77LINK) $(he5_pt_writeattrsF_64_LDFLAGS) $(he5_pt_writeattrsF_64_OBJECTS) $(he5_pt_writeattrsF_64_LDADD) $(LIBS)
+he5_pt_writedata$(EXEEXT): $(he5_pt_writedata_OBJECTS) $(he5_pt_writedata_DEPENDENCIES) 
+	@rm -f he5_pt_writedata$(EXEEXT)
+	$(LINK) $(he5_pt_writedata_LDFLAGS) $(he5_pt_writedata_OBJECTS) $(he5_pt_writedata_LDADD) $(LIBS)
+he5_pt_writedataF_32$(EXEEXT): $(he5_pt_writedataF_32_OBJECTS) $(he5_pt_writedataF_32_DEPENDENCIES) 
+	@rm -f he5_pt_writedataF_32$(EXEEXT)
+	$(F77LINK) $(he5_pt_writedataF_32_LDFLAGS) $(he5_pt_writedataF_32_OBJECTS) $(he5_pt_writedataF_32_LDADD) $(LIBS)
+he5_pt_writedataF_64$(EXEEXT): $(he5_pt_writedataF_64_OBJECTS) $(he5_pt_writedataF_64_DEPENDENCIES) 
+	@rm -f he5_pt_writedataF_64$(EXEEXT)
+	$(F77LINK) $(he5_pt_writedataF_64_LDFLAGS) $(he5_pt_writedataF_64_OBJECTS) $(he5_pt_writedataF_64_LDADD) $(LIBS)
+he5_sw_datainfo$(EXEEXT): $(he5_sw_datainfo_OBJECTS) $(he5_sw_datainfo_DEPENDENCIES) 
+	@rm -f he5_sw_datainfo$(EXEEXT)
+	$(LINK) $(he5_sw_datainfo_LDFLAGS) $(he5_sw_datainfo_OBJECTS) $(he5_sw_datainfo_LDADD) $(LIBS)
+he5_sw_defexternalfld$(EXEEXT): $(he5_sw_defexternalfld_OBJECTS) $(he5_sw_defexternalfld_DEPENDENCIES) 
+	@rm -f he5_sw_defexternalfld$(EXEEXT)
+	$(LINK) $(he5_sw_defexternalfld_LDFLAGS) $(he5_sw_defexternalfld_OBJECTS) $(he5_sw_defexternalfld_LDADD) $(LIBS)
+he5_sw_defexternalfldF_32$(EXEEXT): $(he5_sw_defexternalfldF_32_OBJECTS) $(he5_sw_defexternalfldF_32_DEPENDENCIES) 
+	@rm -f he5_sw_defexternalfldF_32$(EXEEXT)
+	$(F77LINK) $(he5_sw_defexternalfldF_32_LDFLAGS) $(he5_sw_defexternalfldF_32_OBJECTS) $(he5_sw_defexternalfldF_32_LDADD) $(LIBS)
+he5_sw_defexternalfldF_64$(EXEEXT): $(he5_sw_defexternalfldF_64_OBJECTS) $(he5_sw_defexternalfldF_64_DEPENDENCIES) 
+	@rm -f he5_sw_defexternalfldF_64$(EXEEXT)
+	$(F77LINK) $(he5_sw_defexternalfldF_64_LDFLAGS) $(he5_sw_defexternalfldF_64_OBJECTS) $(he5_sw_defexternalfldF_64_LDADD) $(LIBS)
+he5_sw_definefields$(EXEEXT): $(he5_sw_definefields_OBJECTS) $(he5_sw_definefields_DEPENDENCIES) 
+	@rm -f he5_sw_definefields$(EXEEXT)
+	$(LINK) $(he5_sw_definefields_LDFLAGS) $(he5_sw_definefields_OBJECTS) $(he5_sw_definefields_LDADD) $(LIBS)
+he5_sw_definefieldsF_32$(EXEEXT): $(he5_sw_definefieldsF_32_OBJECTS) $(he5_sw_definefieldsF_32_DEPENDENCIES) 
+	@rm -f he5_sw_definefieldsF_32$(EXEEXT)
+	$(F77LINK) $(he5_sw_definefieldsF_32_LDFLAGS) $(he5_sw_definefieldsF_32_OBJECTS) $(he5_sw_definefieldsF_32_LDADD) $(LIBS)
+he5_sw_definefieldsF_64$(EXEEXT): $(he5_sw_definefieldsF_64_OBJECTS) $(he5_sw_definefieldsF_64_DEPENDENCIES) 
+	@rm -f he5_sw_definefieldsF_64$(EXEEXT)
+	$(F77LINK) $(he5_sw_definefieldsF_64_LDFLAGS) $(he5_sw_definefieldsF_64_OBJECTS) $(he5_sw_definefieldsF_64_LDADD) $(LIBS)
+he5_sw_defunlimfld$(EXEEXT): $(he5_sw_defunlimfld_OBJECTS) $(he5_sw_defunlimfld_DEPENDENCIES) 
+	@rm -f he5_sw_defunlimfld$(EXEEXT)
+	$(LINK) $(he5_sw_defunlimfld_LDFLAGS) $(he5_sw_defunlimfld_OBJECTS) $(he5_sw_defunlimfld_LDADD) $(LIBS)
+he5_sw_info$(EXEEXT): $(he5_sw_info_OBJECTS) $(he5_sw_info_DEPENDENCIES) 
+	@rm -f he5_sw_info$(EXEEXT)
+	$(LINK) $(he5_sw_info_LDFLAGS) $(he5_sw_info_OBJECTS) $(he5_sw_info_LDADD) $(LIBS)
+he5_sw_infoF_32$(EXEEXT): $(he5_sw_infoF_32_OBJECTS) $(he5_sw_infoF_32_DEPENDENCIES) 
+	@rm -f he5_sw_infoF_32$(EXEEXT)
+	$(F77LINK) $(he5_sw_infoF_32_LDFLAGS) $(he5_sw_infoF_32_OBJECTS) $(he5_sw_infoF_32_LDADD) $(LIBS)
+he5_sw_infoF_64$(EXEEXT): $(he5_sw_infoF_64_OBJECTS) $(he5_sw_infoF_64_DEPENDENCIES) 
+	@rm -f he5_sw_infoF_64$(EXEEXT)
+	$(F77LINK) $(he5_sw_infoF_64_LDFLAGS) $(he5_sw_infoF_64_OBJECTS) $(he5_sw_infoF_64_LDADD) $(LIBS)
+he5_sw_rdexternaldata$(EXEEXT): $(he5_sw_rdexternaldata_OBJECTS) $(he5_sw_rdexternaldata_DEPENDENCIES) 
+	@rm -f he5_sw_rdexternaldata$(EXEEXT)
+	$(LINK) $(he5_sw_rdexternaldata_LDFLAGS) $(he5_sw_rdexternaldata_OBJECTS) $(he5_sw_rdexternaldata_LDADD) $(LIBS)
+he5_sw_rdexternaldataF_32$(EXEEXT): $(he5_sw_rdexternaldataF_32_OBJECTS) $(he5_sw_rdexternaldataF_32_DEPENDENCIES) 
+	@rm -f he5_sw_rdexternaldataF_32$(EXEEXT)
+	$(F77LINK) $(he5_sw_rdexternaldataF_32_LDFLAGS) $(he5_sw_rdexternaldataF_32_OBJECTS) $(he5_sw_rdexternaldataF_32_LDADD) $(LIBS)
+he5_sw_rdexternaldataF_64$(EXEEXT): $(he5_sw_rdexternaldataF_64_OBJECTS) $(he5_sw_rdexternaldataF_64_DEPENDENCIES) 
+	@rm -f he5_sw_rdexternaldataF_64$(EXEEXT)
+	$(F77LINK) $(he5_sw_rdexternaldataF_64_LDFLAGS) $(he5_sw_rdexternaldataF_64_OBJECTS) $(he5_sw_rdexternaldataF_64_LDADD) $(LIBS)
+he5_sw_readdata$(EXEEXT): $(he5_sw_readdata_OBJECTS) $(he5_sw_readdata_DEPENDENCIES) 
+	@rm -f he5_sw_readdata$(EXEEXT)
+	$(LINK) $(he5_sw_readdata_LDFLAGS) $(he5_sw_readdata_OBJECTS) $(he5_sw_readdata_LDADD) $(LIBS)
+he5_sw_readdataF_32$(EXEEXT): $(he5_sw_readdataF_32_OBJECTS) $(he5_sw_readdataF_32_DEPENDENCIES) 
+	@rm -f he5_sw_readdataF_32$(EXEEXT)
+	$(F77LINK) $(he5_sw_readdataF_32_LDFLAGS) $(he5_sw_readdataF_32_OBJECTS) $(he5_sw_readdataF_32_LDADD) $(LIBS)
+he5_sw_readdataF_64$(EXEEXT): $(he5_sw_readdataF_64_OBJECTS) $(he5_sw_readdataF_64_DEPENDENCIES) 
+	@rm -f he5_sw_readdataF_64$(EXEEXT)
+	$(F77LINK) $(he5_sw_readdataF_64_LDFLAGS) $(he5_sw_readdataF_64_OBJECTS) $(he5_sw_readdataF_64_LDADD) $(LIBS)
+he5_sw_setup$(EXEEXT): $(he5_sw_setup_OBJECTS) $(he5_sw_setup_DEPENDENCIES) 
+	@rm -f he5_sw_setup$(EXEEXT)
+	$(LINK) $(he5_sw_setup_LDFLAGS) $(he5_sw_setup_OBJECTS) $(he5_sw_setup_LDADD) $(LIBS)
+he5_sw_setupF_32$(EXEEXT): $(he5_sw_setupF_32_OBJECTS) $(he5_sw_setupF_32_DEPENDENCIES) 
+	@rm -f he5_sw_setupF_32$(EXEEXT)
+	$(F77LINK) $(he5_sw_setupF_32_LDFLAGS) $(he5_sw_setupF_32_OBJECTS) $(he5_sw_setupF_32_LDADD) $(LIBS)
+he5_sw_setupF_64$(EXEEXT): $(he5_sw_setupF_64_OBJECTS) $(he5_sw_setupF_64_DEPENDENCIES) 
+	@rm -f he5_sw_setupF_64$(EXEEXT)
+	$(F77LINK) $(he5_sw_setupF_64_LDFLAGS) $(he5_sw_setupF_64_OBJECTS) $(he5_sw_setupF_64_LDADD) $(LIBS)
+he5_sw_subset$(EXEEXT): $(he5_sw_subset_OBJECTS) $(he5_sw_subset_DEPENDENCIES) 
+	@rm -f he5_sw_subset$(EXEEXT)
+	$(LINK) $(he5_sw_subset_LDFLAGS) $(he5_sw_subset_OBJECTS) $(he5_sw_subset_LDADD) $(LIBS)
+he5_sw_subsetF_32$(EXEEXT): $(he5_sw_subsetF_32_OBJECTS) $(he5_sw_subsetF_32_DEPENDENCIES) 
+	@rm -f he5_sw_subsetF_32$(EXEEXT)
+	$(F77LINK) $(he5_sw_subsetF_32_LDFLAGS) $(he5_sw_subsetF_32_OBJECTS) $(he5_sw_subsetF_32_LDADD) $(LIBS)
+he5_sw_subsetF_64$(EXEEXT): $(he5_sw_subsetF_64_OBJECTS) $(he5_sw_subsetF_64_DEPENDENCIES) 
+	@rm -f he5_sw_subsetF_64$(EXEEXT)
+	$(F77LINK) $(he5_sw_subsetF_64_LDFLAGS) $(he5_sw_subsetF_64_OBJECTS) $(he5_sw_subsetF_64_LDADD) $(LIBS)
+he5_sw_wrextendrd$(EXEEXT): $(he5_sw_wrextendrd_OBJECTS) $(he5_sw_wrextendrd_DEPENDENCIES) 
+	@rm -f he5_sw_wrextendrd$(EXEEXT)
+	$(LINK) $(he5_sw_wrextendrd_LDFLAGS) $(he5_sw_wrextendrd_OBJECTS) $(he5_sw_wrextendrd_LDADD) $(LIBS)
+he5_sw_wrexternaldata$(EXEEXT): $(he5_sw_wrexternaldata_OBJECTS) $(he5_sw_wrexternaldata_DEPENDENCIES) 
+	@rm -f he5_sw_wrexternaldata$(EXEEXT)
+	$(LINK) $(he5_sw_wrexternaldata_LDFLAGS) $(he5_sw_wrexternaldata_OBJECTS) $(he5_sw_wrexternaldata_LDADD) $(LIBS)
+he5_sw_wrexternaldataF_32$(EXEEXT): $(he5_sw_wrexternaldataF_32_OBJECTS) $(he5_sw_wrexternaldataF_32_DEPENDENCIES) 
+	@rm -f he5_sw_wrexternaldataF_32$(EXEEXT)
+	$(F77LINK) $(he5_sw_wrexternaldataF_32_LDFLAGS) $(he5_sw_wrexternaldataF_32_OBJECTS) $(he5_sw_wrexternaldataF_32_LDADD) $(LIBS)
+he5_sw_wrexternaldataF_64$(EXEEXT): $(he5_sw_wrexternaldataF_64_OBJECTS) $(he5_sw_wrexternaldataF_64_DEPENDENCIES) 
+	@rm -f he5_sw_wrexternaldataF_64$(EXEEXT)
+	$(F77LINK) $(he5_sw_wrexternaldataF_64_LDFLAGS) $(he5_sw_wrexternaldataF_64_OBJECTS) $(he5_sw_wrexternaldataF_64_LDADD) $(LIBS)
+he5_sw_writedata$(EXEEXT): $(he5_sw_writedata_OBJECTS) $(he5_sw_writedata_DEPENDENCIES) 
+	@rm -f he5_sw_writedata$(EXEEXT)
+	$(LINK) $(he5_sw_writedata_LDFLAGS) $(he5_sw_writedata_OBJECTS) $(he5_sw_writedata_LDADD) $(LIBS)
+he5_sw_writedataF_32$(EXEEXT): $(he5_sw_writedataF_32_OBJECTS) $(he5_sw_writedataF_32_DEPENDENCIES) 
+	@rm -f he5_sw_writedataF_32$(EXEEXT)
+	$(F77LINK) $(he5_sw_writedataF_32_LDFLAGS) $(he5_sw_writedataF_32_OBJECTS) $(he5_sw_writedataF_32_LDADD) $(LIBS)
+he5_sw_writedataF_64$(EXEEXT): $(he5_sw_writedataF_64_OBJECTS) $(he5_sw_writedataF_64_DEPENDENCIES) 
+	@rm -f he5_sw_writedataF_64$(EXEEXT)
+	$(F77LINK) $(he5_sw_writedataF_64_LDFLAGS) $(he5_sw_writedataF_64_OBJECTS) $(he5_sw_writedataF_64_LDADD) $(LIBS)
+he5_sw_wrunlimfld$(EXEEXT): $(he5_sw_wrunlimfld_OBJECTS) $(he5_sw_wrunlimfld_DEPENDENCIES) 
+	@rm -f he5_sw_wrunlimfld$(EXEEXT)
+	$(LINK) $(he5_sw_wrunlimfld_LDFLAGS) $(he5_sw_wrunlimfld_OBJECTS) $(he5_sw_wrunlimfld_LDADD) $(LIBS)
+he5_za_datainfo$(EXEEXT): $(he5_za_datainfo_OBJECTS) $(he5_za_datainfo_DEPENDENCIES) 
+	@rm -f he5_za_datainfo$(EXEEXT)
+	$(LINK) $(he5_za_datainfo_LDFLAGS) $(he5_za_datainfo_OBJECTS) $(he5_za_datainfo_LDADD) $(LIBS)
+he5_za_defexternalfld$(EXEEXT): $(he5_za_defexternalfld_OBJECTS) $(he5_za_defexternalfld_DEPENDENCIES) 
+	@rm -f he5_za_defexternalfld$(EXEEXT)
+	$(LINK) $(he5_za_defexternalfld_LDFLAGS) $(he5_za_defexternalfld_OBJECTS) $(he5_za_defexternalfld_LDADD) $(LIBS)
+he5_za_defexternalfldF_32$(EXEEXT): $(he5_za_defexternalfldF_32_OBJECTS) $(he5_za_defexternalfldF_32_DEPENDENCIES) 
+	@rm -f he5_za_defexternalfldF_32$(EXEEXT)
+	$(F77LINK) $(he5_za_defexternalfldF_32_LDFLAGS) $(he5_za_defexternalfldF_32_OBJECTS) $(he5_za_defexternalfldF_32_LDADD) $(LIBS)
+he5_za_defexternalfldF_64$(EXEEXT): $(he5_za_defexternalfldF_64_OBJECTS) $(he5_za_defexternalfldF_64_DEPENDENCIES) 
+	@rm -f he5_za_defexternalfldF_64$(EXEEXT)
+	$(F77LINK) $(he5_za_defexternalfldF_64_LDFLAGS) $(he5_za_defexternalfldF_64_OBJECTS) $(he5_za_defexternalfldF_64_LDADD) $(LIBS)
+he5_za_definefields$(EXEEXT): $(he5_za_definefields_OBJECTS) $(he5_za_definefields_DEPENDENCIES) 
+	@rm -f he5_za_definefields$(EXEEXT)
+	$(LINK) $(he5_za_definefields_LDFLAGS) $(he5_za_definefields_OBJECTS) $(he5_za_definefields_LDADD) $(LIBS)
+he5_za_definefieldsF_32$(EXEEXT): $(he5_za_definefieldsF_32_OBJECTS) $(he5_za_definefieldsF_32_DEPENDENCIES) 
+	@rm -f he5_za_definefieldsF_32$(EXEEXT)
+	$(F77LINK) $(he5_za_definefieldsF_32_LDFLAGS) $(he5_za_definefieldsF_32_OBJECTS) $(he5_za_definefieldsF_32_LDADD) $(LIBS)
+he5_za_definefieldsF_64$(EXEEXT): $(he5_za_definefieldsF_64_OBJECTS) $(he5_za_definefieldsF_64_DEPENDENCIES) 
+	@rm -f he5_za_definefieldsF_64$(EXEEXT)
+	$(F77LINK) $(he5_za_definefieldsF_64_LDFLAGS) $(he5_za_definefieldsF_64_OBJECTS) $(he5_za_definefieldsF_64_LDADD) $(LIBS)
+he5_za_info$(EXEEXT): $(he5_za_info_OBJECTS) $(he5_za_info_DEPENDENCIES) 
+	@rm -f he5_za_info$(EXEEXT)
+	$(LINK) $(he5_za_info_LDFLAGS) $(he5_za_info_OBJECTS) $(he5_za_info_LDADD) $(LIBS)
+he5_za_infoF_32$(EXEEXT): $(he5_za_infoF_32_OBJECTS) $(he5_za_infoF_32_DEPENDENCIES) 
+	@rm -f he5_za_infoF_32$(EXEEXT)
+	$(F77LINK) $(he5_za_infoF_32_LDFLAGS) $(he5_za_infoF_32_OBJECTS) $(he5_za_infoF_32_LDADD) $(LIBS)
+he5_za_infoF_64$(EXEEXT): $(he5_za_infoF_64_OBJECTS) $(he5_za_infoF_64_DEPENDENCIES) 
+	@rm -f he5_za_infoF_64$(EXEEXT)
+	$(F77LINK) $(he5_za_infoF_64_LDFLAGS) $(he5_za_infoF_64_OBJECTS) $(he5_za_infoF_64_LDADD) $(LIBS)
+he5_za_rdexternaldata$(EXEEXT): $(he5_za_rdexternaldata_OBJECTS) $(he5_za_rdexternaldata_DEPENDENCIES) 
+	@rm -f he5_za_rdexternaldata$(EXEEXT)
+	$(LINK) $(he5_za_rdexternaldata_LDFLAGS) $(he5_za_rdexternaldata_OBJECTS) $(he5_za_rdexternaldata_LDADD) $(LIBS)
+he5_za_rdexternaldataF_32$(EXEEXT): $(he5_za_rdexternaldataF_32_OBJECTS) $(he5_za_rdexternaldataF_32_DEPENDENCIES) 
+	@rm -f he5_za_rdexternaldataF_32$(EXEEXT)
+	$(F77LINK) $(he5_za_rdexternaldataF_32_LDFLAGS) $(he5_za_rdexternaldataF_32_OBJECTS) $(he5_za_rdexternaldataF_32_LDADD) $(LIBS)
+he5_za_rdexternaldataF_64$(EXEEXT): $(he5_za_rdexternaldataF_64_OBJECTS) $(he5_za_rdexternaldataF_64_DEPENDENCIES) 
+	@rm -f he5_za_rdexternaldataF_64$(EXEEXT)
+	$(F77LINK) $(he5_za_rdexternaldataF_64_LDFLAGS) $(he5_za_rdexternaldataF_64_OBJECTS) $(he5_za_rdexternaldataF_64_LDADD) $(LIBS)
+he5_za_readdata$(EXEEXT): $(he5_za_readdata_OBJECTS) $(he5_za_readdata_DEPENDENCIES) 
+	@rm -f he5_za_readdata$(EXEEXT)
+	$(LINK) $(he5_za_readdata_LDFLAGS) $(he5_za_readdata_OBJECTS) $(he5_za_readdata_LDADD) $(LIBS)
+he5_za_readdataF_32$(EXEEXT): $(he5_za_readdataF_32_OBJECTS) $(he5_za_readdataF_32_DEPENDENCIES) 
+	@rm -f he5_za_readdataF_32$(EXEEXT)
+	$(F77LINK) $(he5_za_readdataF_32_LDFLAGS) $(he5_za_readdataF_32_OBJECTS) $(he5_za_readdataF_32_LDADD) $(LIBS)
+he5_za_readdataF_64$(EXEEXT): $(he5_za_readdataF_64_OBJECTS) $(he5_za_readdataF_64_DEPENDENCIES) 
+	@rm -f he5_za_readdataF_64$(EXEEXT)
+	$(F77LINK) $(he5_za_readdataF_64_LDFLAGS) $(he5_za_readdataF_64_OBJECTS) $(he5_za_readdataF_64_LDADD) $(LIBS)
+he5_za_setup$(EXEEXT): $(he5_za_setup_OBJECTS) $(he5_za_setup_DEPENDENCIES) 
+	@rm -f he5_za_setup$(EXEEXT)
+	$(LINK) $(he5_za_setup_LDFLAGS) $(he5_za_setup_OBJECTS) $(he5_za_setup_LDADD) $(LIBS)
+he5_za_setupF_32$(EXEEXT): $(he5_za_setupF_32_OBJECTS) $(he5_za_setupF_32_DEPENDENCIES) 
+	@rm -f he5_za_setupF_32$(EXEEXT)
+	$(F77LINK) $(he5_za_setupF_32_LDFLAGS) $(he5_za_setupF_32_OBJECTS) $(he5_za_setupF_32_LDADD) $(LIBS)
+he5_za_setupF_64$(EXEEXT): $(he5_za_setupF_64_OBJECTS) $(he5_za_setupF_64_DEPENDENCIES) 
+	@rm -f he5_za_setupF_64$(EXEEXT)
+	$(F77LINK) $(he5_za_setupF_64_LDFLAGS) $(he5_za_setupF_64_OBJECTS) $(he5_za_setupF_64_LDADD) $(LIBS)
+he5_za_wrexternaldata$(EXEEXT): $(he5_za_wrexternaldata_OBJECTS) $(he5_za_wrexternaldata_DEPENDENCIES) 
+	@rm -f he5_za_wrexternaldata$(EXEEXT)
+	$(LINK) $(he5_za_wrexternaldata_LDFLAGS) $(he5_za_wrexternaldata_OBJECTS) $(he5_za_wrexternaldata_LDADD) $(LIBS)
+he5_za_wrexternaldataF_32$(EXEEXT): $(he5_za_wrexternaldataF_32_OBJECTS) $(he5_za_wrexternaldataF_32_DEPENDENCIES) 
+	@rm -f he5_za_wrexternaldataF_32$(EXEEXT)
+	$(F77LINK) $(he5_za_wrexternaldataF_32_LDFLAGS) $(he5_za_wrexternaldataF_32_OBJECTS) $(he5_za_wrexternaldataF_32_LDADD) $(LIBS)
+he5_za_wrexternaldataF_64$(EXEEXT): $(he5_za_wrexternaldataF_64_OBJECTS) $(he5_za_wrexternaldataF_64_DEPENDENCIES) 
+	@rm -f he5_za_wrexternaldataF_64$(EXEEXT)
+	$(F77LINK) $(he5_za_wrexternaldataF_64_LDFLAGS) $(he5_za_wrexternaldataF_64_OBJECTS) $(he5_za_wrexternaldataF_64_LDADD) $(LIBS)
+he5_za_writedata$(EXEEXT): $(he5_za_writedata_OBJECTS) $(he5_za_writedata_DEPENDENCIES) 
+	@rm -f he5_za_writedata$(EXEEXT)
+	$(LINK) $(he5_za_writedata_LDFLAGS) $(he5_za_writedata_OBJECTS) $(he5_za_writedata_LDADD) $(LIBS)
+he5_za_writedataF_32$(EXEEXT): $(he5_za_writedataF_32_OBJECTS) $(he5_za_writedataF_32_DEPENDENCIES) 
+	@rm -f he5_za_writedataF_32$(EXEEXT)
+	$(F77LINK) $(he5_za_writedataF_32_LDFLAGS) $(he5_za_writedataF_32_OBJECTS) $(he5_za_writedataF_32_LDADD) $(LIBS)
+he5_za_writedataF_64$(EXEEXT): $(he5_za_writedataF_64_OBJECTS) $(he5_za_writedataF_64_DEPENDENCIES) 
+	@rm -f he5_za_writedataF_64$(EXEEXT)
+	$(F77LINK) $(he5_za_writedataF_64_LDFLAGS) $(he5_za_writedataF_64_OBJECTS) $(he5_za_writedataF_64_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_gd_datainfo.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_gd_defexternalfld.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_gd_definefields.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_gd_defunlimfld.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_gd_info.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_gd_rdexternaldata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_gd_readdata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_gd_setup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_gd_subset.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_gd_wrexternaldata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_gd_writedata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_gd_wrunlimfld.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_pt_datainfo.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_pt_definelevels.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_pt_readattrs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_pt_readdata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_pt_setup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_pt_updatelevels.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_pt_writeattrs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_pt_writedata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_datainfo.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_defexternalfld.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_definefields.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_defunlimfld.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_info.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_rdexternaldata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_readdata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_setup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_subset.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_wrextendrd.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_wrexternaldata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_writedata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_wrunlimfld.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_za_datainfo.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_za_defexternalfld.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_za_definefields.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_za_info.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_za_rdexternaldata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_za_readdata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_za_setup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_za_wrexternaldata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_za_writedata.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+.f.o:
+	$(F77COMPILE) -c -o $@ $<
+
+.f.obj:
+	$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.f.lo:
+	$(LTF77COMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(mkdir_p) $(distdir)/../config
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+	$(MAKE) $(AM_MAKEFLAGS) check-local
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \
+	clean-checkPROGRAMS clean-generic clean-libtool ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am
+
+
+# 'make check' should run each of the test sequences above
+check-local: $(TEST_SEQUENCES)
+
+# Manually list the tests to be run in order for each test sequence.
+gd_write_test: $(check_PROGRAMS)
+	./he5_gd_setup
+	./he5_gd_definefields
+	./he5_gd_writedata
+	./he5_gd_readdata
+	./he5_gd_info
+	./he5_gd_datainfo
+	./he5_gd_subset
+gd_write_test_32f: $(check_PROGRAMS)
+	./he5_gd_setupF_32
+	./he5_gd_definefieldsF_32
+	./he5_gd_writedataF_32
+	./he5_gd_readdataF_32
+	./he5_gd_infoF_32
+	./he5_gd_subsetF_32
+gd_write_test_64f: $(check_PROGRAMS)
+	./he5_gd_setupF_64
+	./he5_gd_definefieldsF_64
+	./he5_gd_writedataF_64
+	./he5_gd_readdataF_64
+	./he5_gd_infoF_64
+	./he5_gd_subsetF_64
+
+gd_unlim_test: $(check_PROGRAMS)
+	./he5_gd_setup
+	./he5_gd_defunlimfld
+	./he5_gd_wrunlimfld
+
+pt_write_test: $(check_PROGRAMS)
+	./he5_pt_setup
+	./he5_pt_definelevels
+	srcdir=$(srcdir) ./he5_pt_writedata
+	./he5_pt_writeattrs
+	./he5_pt_readdata
+	./he5_pt_readattrs
+	./he5_pt_updatelevels
+	./he5_pt_datainfo
+pt_write_test_32f: $(check_PROGRAMS)
+	./he5_pt_setupF_32
+	./he5_pt_definelevelsF_32
+	srcdir=$(srcdir) ./he5_pt_writedataF_32
+	./he5_pt_writeattrsF_32
+	./he5_pt_readdataF_32
+	./he5_pt_readattrsF_32
+	./he5_pt_updatelevelsF_32
+	./he5_pt_datainfoF_32
+pt_write_test_64f: $(check_PROGRAMS)
+	./he5_pt_setupF_64
+	./he5_pt_definelevelsF_64
+	srcdir=$(srcdir) ./he5_pt_writedataF_64
+	./he5_pt_writeattrsF_64
+	./he5_pt_readdataF_64
+	./he5_pt_readattrsF_64
+	./he5_pt_updatelevelsF_64
+	./he5_pt_datainfoF_64
+
+sw_write_test: $(check_PROGRAMS)
+	./he5_sw_setup
+	./he5_sw_definefields
+	./he5_sw_writedata
+	./he5_sw_readdata
+	./he5_sw_info
+	./he5_sw_datainfo
+	./he5_sw_subset
+sw_write_test_32f: $(check_PROGRAMS)
+	./he5_sw_setupF_32
+	./he5_sw_definefieldsF_32
+	./he5_sw_writedataF_32
+	./he5_sw_readdataF_32
+	./he5_sw_infoF_32
+	./he5_sw_subsetF_32
+sw_write_test_64f: $(check_PROGRAMS)
+	./he5_sw_setupF_64
+	./he5_sw_definefieldsF_64
+	./he5_sw_writedataF_64
+	./he5_sw_readdataF_64
+	./he5_sw_infoF_64
+	./he5_sw_subsetF_64
+
+sw_unlim_test: $(check_PROGRAMS)
+	./he5_sw_setup
+	./he5_sw_defunlimfld
+	./he5_sw_wrunlimfld
+	./he5_sw_subset
+
+sw_extend_test: $(check_PROGRAMS)
+	./he5_sw_setup
+	./he5_sw_definefields
+	./he5_sw_wrextendrd
+
+za_write_test: $(check_PROGRAMS)
+	./he5_za_setup
+	./he5_za_definefields
+	./he5_za_writedata
+	./he5_za_readdata
+	./he5_za_info
+	./he5_za_datainfo
+za_write_test_32f: $(check_PROGRAMS)
+	./he5_za_setupF_32
+	./he5_za_definefieldsF_32
+	./he5_za_writedataF_32
+	./he5_za_readdataF_32
+	./he5_za_infoF_32
+za_write_test_64f: $(check_PROGRAMS)
+	./he5_za_setupF_64
+	./he5_za_definefieldsF_64
+	./he5_za_writedataF_64
+	./he5_za_readdataF_64
+	./he5_za_infoF_64
+
+# This avoids any confusion between the names of the sequences and
+# files with the same names.
+.PHONY: $(TEST_SEQUENCES)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/samples/README b/samples/README
new file mode 100755
index 0000000..0d130c9
--- /dev/null
+++ b/samples/README
@@ -0,0 +1,395 @@
+**********************************************************************
+*    This directory provides sample programs for the user to run to  *
+*    check if the HDFEOS_5 library installed correctly. Below is a   *
+*     description of what routines are available and the order in    *
+*                which the routines should be run.                   *
+*    Updated: 06/20/01  A.M.                                         *
+*             Aug 02    S.Z                                          *
+**********************************************************************
+
+
+                   Swath Demonstration Programs
+                   ----------------------------
+
+A. C - programs
+~~~~~~~~~~~~~~~   
+   	he5_sw_setup        --- creates HDFEOS_5 swath file "Swath.h5"; 
+                            sets a single swath structure "Swath1"; 
+                            defines dimensions and the geolocation 
+                            relations between them.
+	
+	he5_sw_definefields	--- defines a number of fields within the swath.
+	
+	he5_sw_writedata    --- writes data to the "Longitude", "Latitude", 
+                            and "Spectra" fields; sets up global, group, 
+			                and local attributes.
+
+	he5_sw_readdata     --- reads data from the "Longitude" field; reads 
+                            global, group, and local attributes.
+
+	he5_sw_info         --- retrieves and displays information on the 
+                            swath dimensions, geolocation relations, 
+                            swath fields, and (global/group/local) 
+                            attributes.
+
+    he5_sw_datainfo     --- retrieves data type information for a 
+                            specified object (field, attribute).
+
+	he5_sw_subset       --- demonstrates subsetting on the "Spectra" field.
+
+
+    he5_sw_defunlimfld  --- same as 'he5_sw_definefields' but defines 
+                            "Spectra" field as having unlimited dimension.
+
+    he5_sw_wrunlimfld   --- same as 'he5_sw_writedata' but writes data to 
+                            the "Spectra" field twice.
+
+    he5_sw_wrextendrd   --- demonstrates usage of unlimited dimension for 
+                            appendible field "Count".
+
+
+    Sequence of calls:
+                     
+          1. he5_sw_setup
+             he5_sw_definefields
+             he5_sw_writedata 
+             he5_sw_readdata 
+             he5_sw_info 
+             he5_sw_datainfo 
+             he5_sw_subset   
+
+          2. he5_sw_setup
+             he5_sw_defunlimfld
+             he5_sw_wrunlimfld
+             he5_sw_subset
+
+          3. he5_sw_setup
+             he5_sw_definefields
+             he5_sw_wrextendrd
+
+
+	Example of working with external data files
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	he5_sw_setup               ---   creates HDFEOS_5 swath file "Swath.h5"; 
+                                     sets a single swath structure "Swath1"; 
+                                     defines dimensions (including dimension 
+                                     of external data set) and the geolocation 
+                                     relations between them.
+    he5_sw_defexternalfld      ---   defines external field (data set)
+    he5_sw_rdexternaldata      ---   reads data from external data file(s) to 
+                                     the external field
+    he5_sw_wrexternaldata      ---   writes data to external field/data file(s)  
+
+
+
+B. FORTRAN-77 programs
+~~~~~~~~~~~~~~~~~~~~~~
+	he5_sw_setupF_64          ---  see 'he5_sw_setup', creates "swath.h5" file.
+	(he5_sw_setupF_32)
+  
+    he5_sw_definefieldsF_64   ---  see  'he5_sw_definefields'
+    (he5_sw_definefieldsF_32)
+
+    he5_sw_writedataF_64      ---  see  'he5_sw_writedata'
+    (he5_sw_writedataF_32)
+
+    he5_sw_readdataF_64       ---  see  'he5_sw_readdata'
+    (he5_sw_readdataF_32)
+
+    he5_sw_infoF_64           ---  see  'he5_sw_info'
+    (he5_sw_infoF_32)
+
+    he5_sw_subsetF_64         ---  see  'he5_sw_subset'
+    (he5_sw_subsetF_32)
+  
+
+	Sequence of calls:
+
+	      he5_sw_setupF_64         (...F_32)
+          he5_sw_definefieldsF_64  (...F_32)
+          he5_sw_writedataF_64     (...F_32)
+          he5_sw_readdataF_64      (...F_32)
+          he5_sw_infoF_64          (...F_32)
+          he5_sw_subsetF_64        (...F_32)
+
+
+
+
+===========================================================================
+
+                   Grid Demonstration Programs
+                   ---------------------------
+
+A. C - programs
+~~~~~~~~~~~~~~~   
+   	he5_gd_setup        --- creates HDFEOS_5 grid file "Grid.h5"; 
+                            sets two grid structures. 
+	
+	he5_gd_definefields	--- defines fields within the two grids.
+	
+	he5_gd_writedata    --- writes data to the fields within the two 
+                            grids; sets up global, group, and local 
+                            attributes. 
+
+	he5_gd_readdata     --- reads data from the fields; reads 
+                            global, group, and local attributes.
+
+	he5_gd_info         --- retrieves and displays information on the 
+                            grid dimensions, projections, grid fields, 
+                            and (global/group/local) attributes.
+
+    he5_gd_datainfo     --- retrieves data type information for a 
+                            specified object (field, attribute).
+
+	he5_gd_subset       --- demonstrates subsetting on the "Temperature" 
+                            field in the "PolarGrid" grid.
+
+
+    he5_gd_defunlimfld  --- defines "Vegetation" field having unlimited 
+                            dimension.
+
+    he5_gd_wrunlimfld   --- sequentially writes data buffers of different 
+                            size to the "Vegetation" field.
+
+    Sequence of calls:
+                     
+          1. he5_gd_setup
+             he5_gd_definefields
+             he5_gd_writedata 
+             he5_gd_readdata 
+             he5_gd_info 
+             he5_gd_datainfo 
+             he5_gd_subset   
+
+          2. he5_gd_setup
+             he5_gd_defunlimfld
+             he5_gd_wrunlimfld
+
+
+	Example of working with external data files
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	he5_gd_setup               ---   creates HDFEOS_5 grid file "Grid.h5"; 
+                                     sets two grid structures; defines 
+                                     dimensions (including dimension of 
+                                     external data set).
+    he5_gd_defexternalfld      ---   defines external field (data set)
+    he5_gd_rdexternaldata      ---   reads data from external data file(s) to 
+                                     the external field
+    he5_gd_wrexternaldata      ---   writes data to external field/data file(s)  
+
+
+B. FORTRAN-77 programs
+~~~~~~~~~~~~~~~~~~~~~~
+	he5_gd_setupF_64          ---  see 'he5_gd_setup'; creates "grid.h5" file.
+	(he5_gd_setupF_32)
+  
+    he5_gd_definefieldsF_64   ---  see  'he5_gd_definefields'
+    (he5_gd_definefieldsF_32)
+
+    he5_gd_writedataF_64      ---  see  'he5_gd_writedata'
+    (he5_gd_writedataF_32)
+
+    he5_gd_readdataF_64       ---  see  'he5_gd_readdata'
+    (he5_gd_readdataF_32)
+
+    he5_gd_infoF_64           ---  see  'he5_gd_info'
+    (he5_gd_infoF_32)
+
+    he5_gd_subsetF_64         ---  see  'he5_gd_subset'
+    (he5_gd_subsetF_32)
+  
+
+	Sequence of calls:
+
+	      he5_gd_setupF_64            (...F_32)
+          he5_gd_definefieldsF_64     (...F_32)
+          he5_gd_writedataF_64        (...F_32)
+          he5_gd_readdataF_64         (...F_32)
+          he5_gd_infoF_64             (...F_32)
+          he5_gd_subsetF_64           (...F_32)
+
+===========================================================================
+
+
+                   Point Demonstration Programs
+                   ----------------------------
+
+The sample codes described below use the following input data files 
+(make sure these files are in the same directory with the sample codes) :
+
+	fixedBuoy0.txt
+	fixedBuoy1s.txt
+	floatBuoy1.txt
+	fixedBuoy1.txt
+	floatBuoy0.txt
+	simple.txt
+
+
+A. C - programs
+~~~~~~~~~~~~~~~   
+   	he5_pt_setup        --- creates HDFEOS_5 point file "Point.h5"; 
+	
+	he5_pt_definelevels	--- defines levels within the point.
+	
+	he5_pt_writedata    --- writes data to the specified levels.
+
+	he5_pt_writeattrs   --- writes attributes.
+
+	he5_pt_readdata     --- reads data from a level.
+
+	he5_pt_readattrs    --- reads attributes.
+
+	he5_pt_updatelevels --- updates level data.
+
+    he5_pt_datainfo     --- retrieves data type information for a 
+                            specified object within point.
+
+    Sequence of calls:
+                     
+             he5_pt_setup
+             he5_pt_definelevels
+             he5_pt_writedata 
+               he5_pt_writeattrs 
+             he5_pt_readdata 
+               he5_pt_readattrs 
+             he5_pt_updatelevels
+             he5_pt_datainfo 
+
+
+B. FORTRAN-77 programs
+~~~~~~~~~~~~~~~~~~~~~~
+	he5_pt_setupF_64          ---  see 'he5_pt_setup'; creates "point.h5" file.
+	(he5_pt_setupF_32)
+  
+    he5_pt_definelevelsF_64   ---  see  'he5_pt_definelevels'
+    (he5_pt_definelevelsF_32)
+
+    he5_pt_writedataF_64      ---  see  'he5_pt_writedata'
+    (he5_pt_writedataF_32)
+
+		he5_pt_writeattrsF_64      ---  see  'he5_pt_writeattrs'
+		(he5_pt_writeattrsF_32)
+
+    he5_pt_readdataF_64       ---  see  'he5_pt_readdata'
+    (he5_pt_readdataF_32)
+
+		he5_pt_readattrsF_64       ---  see  'he5_pt_readattrs'
+		(he5_pt_readattrsF_32)
+
+    he5_pt_updatelevelsF_64   ---  see  'he5_pt_updatelevels'
+    (he5_pt_updatelevelsF_32)
+
+    he5_pt_datainfoF_64       ---  see  'he5_pt_datainfo'
+    (he5_pt_datainfoF_32)
+  
+
+	Sequence of calls:
+
+	      he5_pt_setupF_64            (...F_32)
+          he5_pt_definelevelsF_64     (...F_32)
+          he5_pt_writedataF_64        (...F_32)
+          he5_pt_writeattrsF_64       (...F_32)
+          he5_pt_readdataF_64         (...F_32)
+          he5_pt_readattrsF_64        (...F_32)
+          he5_pt_updatelevelsF_64     (...F_32)
+          he5_pt_datainfoF_64         (...F_32)
+
+
+         
+=====================================================================
+
+
+                   ZA Demonstration Programs
+                   -------------------------
+ 
+A. C - programs
+~~~~~~~~~~~~~~
+        he5_za_setup        --- creates HDFEOS_5 za file "ZA.h5";
+                            sets a single za structure "ZA1";
+                            defines dimensions.
+ 
+        he5_za_definefields --- defines a number of fields within the za.
+ 
+        he5_za_writedata    --- writes data to the "Spectra" field;
+                            sets up global, group, and local attributes.
+ 
+        he5_za_readdata     --- reads data from the "Spectra" field; reads
+                            global, group, and local attributes.
+ 
+        he5_za_info         --- retrieves and displays information on the
+                            za dimensions, and (global/group/local)
+                            attributes.
+ 
+        he5_za_datainfo     --- retrieves data type information for a
+                            specified object (field, attribute).
+ 
+ 
+    Sequence of calls:
+ 
+        he5_za_setup
+        he5_za_definefields
+        he5_za_writedata
+        he5_za_readdata
+        he5_za_info
+        he5_za_datainfo
+ 
+
+    Example of working with external data files
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    he5_za_setup               ---   creates HDFEOS_5 za file "ZA.h5";
+                                     sets a single za structure "ZA1";
+                                     defines dimensions (including dimension
+                                     of external data set). 
+    he5_za_defexternalfld      ---   defines external field (data set)
+    he5_za_rdexternaldata      ---   reads data from external data file(s) to
+                                     the external field
+    he5_za_wrexternaldata      ---   writes data to external field/data file(s)
+ 
+
+ 
+B. FORTRAN-77 programs
+~~~~~~~~~~~~~~~~~~~~~
+    he5_za_setupF_64          ---  see 'he5_za_setup', creates "za.he5" file.
+    (he5_za_setupF_32)
+ 
+    he5_za_definefieldsF_64   ---  see  'he5_za_definefields'
+    (he5_za_definefieldsF_32)
+ 
+    he5_za_writedataF_64      ---  see  'he5_za_writedata'
+    (he5_za_writedataF_32)
+ 
+    he5_za_readdataF_64       ---  see  'he5_za_readdata'
+    (he5_za_readdataF_32)
+ 
+    he5_za_infoF_64           ---  see  'he5_za_info'
+    (he5_za_infoF_32)
+ 
+ 
+ 
+        Sequence of calls:
+ 
+          he5_za_setupF_64         (...F_32)
+          he5_za_definefieldsF_64  (...F_32)
+          he5_za_writedataF_64     (...F_32)
+          he5_za_readdataF_64      (...F_32)
+          he5_za_infoF_64          (...F_32)
+ 
+
+======================================================================================
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/external_1.data b/samples/external_1.data
new file mode 100755
index 0000000..1ad3874
Binary files /dev/null and b/samples/external_1.data differ
diff --git a/samples/external_1g.data b/samples/external_1g.data
new file mode 100755
index 0000000..1ad3874
Binary files /dev/null and b/samples/external_1g.data differ
diff --git a/samples/external_2.data b/samples/external_2.data
new file mode 100755
index 0000000..50cdc37
Binary files /dev/null and b/samples/external_2.data differ
diff --git a/samples/external_2g.data b/samples/external_2g.data
new file mode 100755
index 0000000..50cdc37
Binary files /dev/null and b/samples/external_2g.data differ
diff --git a/samples/external_3.data b/samples/external_3.data
new file mode 100755
index 0000000..a1ce92d
Binary files /dev/null and b/samples/external_3.data differ
diff --git a/samples/external_3g.data b/samples/external_3g.data
new file mode 100755
index 0000000..a1ce92d
Binary files /dev/null and b/samples/external_3g.data differ
diff --git a/samples/fixedBuoy0.txt b/samples/fixedBuoy0.txt
new file mode 100755
index 0000000..2bd764a
--- /dev/null
+++ b/samples/fixedBuoy0.txt
@@ -0,0 +1,3 @@
+Pacific  -140.2520148  -10.3024294 891218 P
+Atlantic  -54.8270879   43.1362228 900228 A 
+Indian     71.7147412    7.4254709 900912 I  
diff --git a/samples/fixedBuoy1.txt b/samples/fixedBuoy1.txt
new file mode 100755
index 0000000..ee1eee2
--- /dev/null
+++ b/samples/fixedBuoy1.txt
@@ -0,0 +1,20 @@
+   83422000.0     1.1   21.63   P
+   83555918.7     0.7   24.21   A
+   83726878.2     2.7   23.83   P
+   83842994.7     4.3   22.63   P
+   84013712.3     0.7   20.35   A
+   84063571.3     2.8   20.84   P
+   84245234.1     1.7   24.52   I
+   84251741.0     1.4   20.98   I
+   84412971.8     3.6   20.41   A
+   84419483.0     1.8   22.01   P
+   84452408.0     3.4   23.20   P
+   84623981.3     4.0   23.91   I
+   84655020.8     3.2   21.79   A
+   84736992.5     4.6   23.61   P
+   84835587.2     3.6   20.38   A
+   84915081.1     5.1   20.10   P
+   84970587.0     1.1   24.63   P
+   85058206.4     1.3   22.98   I
+   85076367.6     2.7   22.62   P
+   85111729.5     1.0   22.01   P
diff --git a/samples/fixedBuoy1s.txt b/samples/fixedBuoy1s.txt
new file mode 100755
index 0000000..0e679a4
--- /dev/null
+++ b/samples/fixedBuoy1s.txt
@@ -0,0 +1,20 @@
+   83555918.7     0.7   24.21   A
+   84013712.3     0.7   20.35   A
+   84412971.8     3.6   20.41   A
+   84655020.8     3.2   21.79   A
+   84835587.2     3.6   20.38   A
+   84245234.1     1.7   24.52   I
+   84251741.0     1.4   20.98   I
+   84623981.3     4.0   23.91   I
+   85058206.4     1.3   22.98   I
+   83422000.0     1.1   21.63   P
+   83726878.2     2.7   23.83   P
+   83842994.7     4.3   22.63   P
+   84063571.3     2.8   20.84   P
+   84419483.0     1.8   22.01   P
+   84452408.0     3.4   23.20   P
+   84736992.5     4.6   23.61   P
+   84915081.1     5.1   20.10   P
+   84970587.0     1.1   24.63   P
+   85076367.6     2.7   22.62   P
+   85111729.5     1.0   22.01   P
diff --git a/samples/floatBuoy0.txt b/samples/floatBuoy0.txt
new file mode 100755
index 0000000..e370dcf
--- /dev/null
+++ b/samples/floatBuoy0.txt
@@ -0,0 +1,3 @@
+Pacific   901023   1200  P
+Atlantic  890419   2550  A
+Indian    900605    800  I
diff --git a/samples/floatBuoy1.txt b/samples/floatBuoy1.txt
new file mode 100755
index 0000000..0c17bd1
--- /dev/null
+++ b/samples/floatBuoy1.txt
@@ -0,0 +1,25 @@
+   34532000.0   -56.795451    46.929101     3.5   22.74   A
+   34655930.8   -51.144523    39.393151     0.3   22.25   A
+   34761777.4    73.005232     4.068124     3.9   22.60   I
+   34924857.4   -51.289537    47.272357     0.6   24.23   A
+   35010197.1  -137.896588   -10.438813     3.1   23.24   P
+   35113965.3    70.943919     4.989471     3.7   21.05   I
+   35146430.0  -141.334164    -8.035026     0.9   23.16   P
+   35180802.9   -51.291848    47.940175     4.6   21.68   A
+   35286334.7  -141.921518    -9.133087     1.1   20.25   P
+   35359789.3  -139.960931   -11.797505     1.8   24.37   P
+   35510873.5   -56.995840    44.141150     3.7   23.12   A
+   35583198.0    73.083084    10.349487     3.0   24.63   I
+   35741969.4  -138.607937   -10.352329     4.3   24.05   P
+   35811504.6   -52.535794    38.967934     1.1   23.50   A
+   35890062.6    71.995167     6.438556     1.5   23.14   I
+   36015258.2   -51.100562    39.280490     1.9   20.31   A
+   36176650.2  -141.603094   -10.410025     2.9   21.33   P
+   36292709.9   -53.052534    44.477106     2.1   23.65   A
+   36307577.3   -53.937608    38.710016     5.0   20.06   A
+   36384294.9   -55.381183    41.246119     4.0   23.34   A
+   36576747.4  -141.588561    -9.158308     0.5   20.79   P
+   36725342.2   -51.199441    38.061798     2.4   20.01   A
+   36758333.4  -138.998487    -8.706307     0.3   22.07   P
+   36841499.9    72.256089     8.036737     3.9   24.41   I
+   37021357.5  -139.961167   -11.094212     0.6   23.02   P
diff --git a/samples/hdfeos5.inc b/samples/hdfeos5.inc
new file mode 100755
index 0000000..a6af5e8
--- /dev/null
+++ b/samples/hdfeos5.inc
@@ -0,0 +1,411 @@
+! * ==========================================================
+! * File:       hdfeos5.inc
+! * Author:     A. Muslimov, Emergent Technology Services, Inc.
+! * Date:       March 11, 2002
+! * Purpose:    Fortran header file for HDFEOS5 routines
+! * ==========================================================
+! * Contents: 
+! *     HDFEOS5 data type tags
+! *     HDFEOS5 logical constants
+! *     HDFEOS5 file access tags
+! *     HDFEOS5/GCTP library codes   
+! *
+! * ===========================================================
+ 
+!          HDFEOS5  DATA TYPE TAGS 
+!          =======================
+
+           integer   HE5T_NATIVE_INT
+           integer   HE5T_NATIVE_UINT
+           integer   HE5T_NATIVE_SHORT
+           integer   HE5T_NATIVE_USHORT
+           integer   HE5T_NATIVE_SCHAR
+           integer   HE5T_NATIVE_UCHAR
+           integer   HE5T_NATIVE_LONG
+           integer   HE5T_NATIVE_ULONG
+           integer   HE5T_NATIVE_LLONG
+           integer   HE5T_NATIVE_ULLONG
+           integer   HE5T_NATIVE_FLOAT
+           integer   HE5T_NATIVE_REAL
+           integer   HE5T_NATIVE_DOUBLE
+           integer   HE5T_NATIVE_LDOUBLE
+           integer   HE5T_NATIVE_INT8
+           integer   HE5T_NATIVE_UINT8
+           integer   HE5T_NATIVE_INT16
+           integer   HE5T_NATIVE_UINT16
+           integer   HE5T_NATIVE_INT32
+           integer   HE5T_NATIVE_UINT32
+           integer   HE5T_NATIVE_INT64
+           integer   HE5T_NATIVE_UINT64
+           integer   HE5T_NATIVE_B8
+           integer   HE5T_NATIVE_B16
+           integer   HE5T_NATIVE_B32
+           integer   HE5T_NATIVE_B64
+           integer   HE5T_NATIVE_HSIZE
+           integer   HE5T_NATIVE_HERR
+           integer   HE5T_NATIVE_HBOOL
+
+           integer   HE5T_STD_I8BE
+           integer   HE5T_STD_I8LE
+           integer   HE5T_STD_I16BE
+           integer   HE5T_STD_I16LE
+           integer   HE5T_STD_I32BE
+           integer   HE5T_STD_I32LE
+           integer   HE5T_STD_I64BE
+           integer   HE5T_STD_I64LE
+           integer   HE5T_STD_U8BE
+           integer   HE5T_STD_U8LE
+           integer   HE5T_STD_U16BE
+           integer   HE5T_STD_U16LE
+           integer   HE5T_STD_U32BE
+           integer   HE5T_STD_U32LE
+           integer   HE5T_STD_U64BE
+           integer   HE5T_STD_U64LE
+           integer   HE5T_STD_B8BE
+           integer   HE5T_STD_B8LE
+           integer   HE5T_STD_B16BE
+           integer   HE5T_STD_B16LE
+           integer   HE5T_STD_B32BE
+           integer   HE5T_STD_B32LE
+           integer   HE5T_STD_B64BE
+           integer   HE5T_STD_B64LE
+
+           integer   HE5T_IEEE_F32BE                      
+           integer   HE5T_IEEE_F32LE                      
+           integer   HE5T_IEEE_F64BE                      
+           integer   HE5T_IEEE_F64LE                      
+           integer   HE5T_NATIVE_CHAR
+           integer   HE5T_CHARSTRING
+
+           parameter(HE5T_NATIVE_INT      = 0)
+           parameter(HE5T_NATIVE_UINT     = 1)
+           parameter(HE5T_NATIVE_SHORT    = 2)
+           parameter(HE5T_NATIVE_USHORT   = 3)
+           parameter(HE5T_NATIVE_SCHAR    = 4)
+           parameter(HE5T_NATIVE_UCHAR    = 5)
+           parameter(HE5T_NATIVE_LONG     = 6)
+           parameter(HE5T_NATIVE_ULONG    = 7)
+           parameter(HE5T_NATIVE_LLONG    = 8)
+           parameter(HE5T_NATIVE_ULLONG   = 9)
+           parameter(HE5T_NATIVE_FLOAT    =10)
+           parameter(HE5T_NATIVE_REAL     =10)
+           parameter(HE5T_NATIVE_DOUBLE   =11)
+           parameter(HE5T_NATIVE_LDOUBLE  =12)
+           parameter(HE5T_NATIVE_INT8     =13)
+           parameter(HE5T_NATIVE_UINT8    =14)
+           parameter(HE5T_NATIVE_INT16    =15)
+           parameter(HE5T_NATIVE_UINT16   =16)
+           parameter(HE5T_NATIVE_INT32    =17)
+           parameter(HE5T_NATIVE_UINT32   =18)
+           parameter(HE5T_NATIVE_INT64    =19)
+           parameter(HE5T_NATIVE_UINT64   =20)
+           parameter(HE5T_NATIVE_B8       =21)
+           parameter(HE5T_NATIVE_B16      =22)
+           parameter(HE5T_NATIVE_B32      =23)
+           parameter(HE5T_NATIVE_B64      =24)
+           parameter(HE5T_NATIVE_HSIZE    =25)
+           parameter(HE5T_NATIVE_HERR     =26)
+           parameter(HE5T_NATIVE_HBOOL    =27)
+
+           parameter(HE5T_STD_I8BE        =28)
+           parameter(HE5T_STD_I8LE        =29)
+           parameter(HE5T_STD_I16BE       =30)
+           parameter(HE5T_STD_I16LE       =31)
+           parameter(HE5T_STD_I32BE       =32)
+           parameter(HE5T_STD_I32LE       =33)
+           parameter(HE5T_STD_I64BE       =34)
+           parameter(HE5T_STD_I64LE       =35)
+           parameter(HE5T_STD_U8BE        =36)
+           parameter(HE5T_STD_U8LE        =37)
+           parameter(HE5T_STD_U16BE       =38)
+           parameter(HE5T_STD_U16LE       =39)
+           parameter(HE5T_STD_U32BE       =40)
+           parameter(HE5T_STD_U32LE       =41)
+           parameter(HE5T_STD_U64BE       =42)
+           parameter(HE5T_STD_U64LE       =43)
+           parameter(HE5T_STD_B8BE        =44)
+           parameter(HE5T_STD_B8LE        =45)
+           parameter(HE5T_STD_B16BE       =46)
+           parameter(HE5T_STD_B16LE       =47)
+           parameter(HE5T_STD_B32BE       =48)
+           parameter(HE5T_STD_B32LE       =49)
+           parameter(HE5T_STD_B64BE       =50)
+           parameter(HE5T_STD_B64LE       =51)
+
+           parameter(HE5T_IEEE_F32BE      =52)                
+           parameter(HE5T_IEEE_F32LE      =53)                
+           parameter(HE5T_IEEE_F64BE      =54)                
+           parameter(HE5T_IEEE_F64LE      =55)                
+
+           parameter(HE5T_NATIVE_CHAR     =56)                
+           parameter(HE5T_CHARSTRING      =57)
+
+           integer   HE5S_UNLIMITED_F
+           parameter(HE5S_UNLIMITED_F = -1)
+
+
+!          HDFEOS5 FILE ACCESS TAGS 
+!          ========================
+ 
+           integer   HE5F_ACC_RDWR
+           integer   HE5F_ACC_RDONLY
+           integer   HE5F_ACC_TRUNC
+
+           parameter(HE5F_ACC_RDWR   = 100)
+           parameter(HE5F_ACC_RDONLY = 101)
+           parameter(HE5F_ACC_TRUNC  = 102)
+
+!          TOOLKIT FILE ACCESS TAGS 
+!          ========================
+ 
+           integer   HDF4_ACC_RDONLY
+           integer   HDF4_ACC_RDWR
+           integer   HDF4_ACC_CREATE
+
+           integer   HDF5_ACC_RDONLY
+           integer   HDF5_ACC_RDWR
+           integer   HDF5_ACC_CREATE
+
+           parameter(HDF4_ACC_RDONLY = 1)
+           parameter(HDF4_ACC_RDWR   = 3)
+           parameter(HDF4_ACC_CREATE = 4)
+
+           parameter(HDF5_ACC_RDONLY = 11)
+           parameter(HDF5_ACC_RDWR   = 13)
+           parameter(HDF5_ACC_CREATE = 14)
+
+
+!          HDFEOS5  MERGE CODES 
+!          ====================
+
+           integer HE5_HDFE_NOMERGE
+           integer HE5_HDFE_AUTOMERGE
+
+           parameter(HE5_HDFE_NOMERGE   =0)
+           parameter(HE5_HDFE_AUTOMERGE =1)
+ 
+!          HDFEOS5 XXentries CODES 
+!          =======================
+
+           integer HE5_HDFE_NENTDIM
+           integer HE5_HDFE_NENTMAP
+           integer HE5_HDFE_NENTIMAP
+           integer HE5_HDFE_NENTGFLD
+           integer HE5_HDFE_NENTDFLD
+
+           parameter(HE5_HDFE_NENTDIM  =0)
+           parameter(HE5_HDFE_NENTMAP  =1)
+           parameter(HE5_HDFE_NENTIMAP =2)
+           parameter(HE5_HDFE_NENTGFLD =3)
+           parameter(HE5_HDFE_NENTDFLD =4)
+
+!          HDFEOS5 ANGLE CONVERSION CODES 
+!          ==============================
+
+           integer HE5_HDFE_RAD_DEG    
+           integer HE5_HDFE_DEG_RAD    
+           integer HE5_HDFE_DMS_DEG    
+           integer HE5_HDFE_DEG_DMS    
+           integer HE5_HDFE_RAD_DMS    
+           integer HE5_HDFE_DMS_RAD    
+
+           parameter(HE5_HDFE_RAD_DEG =0)
+           parameter(HE5_HDFE_DEG_RAD =1)
+           parameter(HE5_HDFE_DMS_DEG =2)
+           parameter(HE5_HDFE_DEG_DMS =3)
+           parameter(HE5_HDFE_RAD_DMS =4)
+           parameter(HE5_HDFE_DMS_RAD =5)
+
+
+!          HDFEOS5 SWATH SUBSET CODES 
+!          ==========================
+ 
+           integer HE5_HDFE_MIDPOINT 
+           integer HE5_HDFE_ENDPOINT 
+           integer HE5_HDFE_ANYPOINT 
+           integer HE5_HDFE_INTERNAL 
+           integer HE5_HDFE_EXTERNAL 
+           integer HE5_HDFE_NOPREVSUB
+
+           parameter(HE5_HDFE_MIDPOINT  =0) 
+           parameter(HE5_HDFE_ENDPOINT  =1) 
+           parameter(HE5_HDFE_ANYPOINT  =2) 
+           parameter(HE5_HDFE_INTERNAL  =0) 
+           parameter(HE5_HDFE_EXTERNAL  =1) 
+           parameter(HE5_HDFE_NOPREVSUB =-1) 
+
+
+!          HDFEOS5 GRID ORIGIN CODES 
+!          =========================
+
+           integer HE5_HDFE_GD_UL    
+           integer HE5_HDFE_GD_UR    
+           integer HE5_HDFE_GD_LL    
+           integer HE5_HDFE_GD_LR    
+ 
+           parameter(HE5_HDFE_GD_UL  =0) 
+           parameter(HE5_HDFE_GD_UR  =1) 
+           parameter(HE5_HDFE_GD_LL  =2) 
+           parameter(HE5_HDFE_GD_LR  =3) 
+
+
+!          HDFEOS5 PIXEL REGISTRATION CODES 
+!          ================================
+
+           integer HE5_HDFE_CENTER     
+           integer HE5_HDFE_CORNER     
+ 
+           parameter(HE5_HDFE_CENTER  =0)
+           parameter(HE5_HDFE_CORNER  =1)
+
+!          HDFEOS5 GCTP PROJECTION CODES 
+!          =============================
+
+           integer HE5_GCTP_GEO      
+           integer HE5_GCTP_UTM      
+           integer HE5_GCTP_SPCS     
+           integer HE5_GCTP_ALBERS   
+           integer HE5_GCTP_LAMCC     
+           integer HE5_GCTP_MERCAT    
+           integer HE5_GCTP_PS        
+           integer HE5_GCTP_POLYC     
+           integer HE5_GCTP_EQUIDC    
+           integer HE5_GCTP_TM        
+           integer HE5_GCTP_STEREO    
+           integer HE5_GCTP_LAMAZ     
+           integer HE5_GCTP_AZMEQD    
+           integer HE5_GCTP_GNOMON    
+           integer HE5_GCTP_ORTHO     
+           integer HE5_GCTP_GVNSP     
+           integer HE5_GCTP_SNSOID    
+           integer HE5_GCTP_EQRECT    
+           integer HE5_GCTP_MILLER    
+           integer HE5_GCTP_VGRINT    
+           integer HE5_GCTP_HOM       
+           integer HE5_GCTP_ROBIN     
+           integer HE5_GCTP_SOM       
+           integer HE5_GCTP_ALASKA    
+           integer HE5_GCTP_GOOD      
+           integer HE5_GCTP_MOLL      
+           integer HE5_GCTP_IMOLL     
+           integer HE5_GCTP_HAMMER    
+           integer HE5_GCTP_WAGIV     
+           integer HE5_GCTP_WAGVII    
+           integer HE5_GCTP_OBLEQA    
+           integer HE5_GCTP_ISINUS    
+
+           parameter(HE5_GCTP_GEO      =0)
+           parameter(HE5_GCTP_UTM      =1)
+           parameter(HE5_GCTP_SPCS     =2)
+           parameter(HE5_GCTP_ALBERS   =3)
+           parameter(HE5_GCTP_LAMCC    =4)
+           parameter(HE5_GCTP_MERCAT   =5)
+           parameter(HE5_GCTP_PS       =6)
+           parameter(HE5_GCTP_POLYC    =7)
+           parameter(HE5_GCTP_EQUIDC   =8)
+           parameter(HE5_GCTP_TM       =9)
+           parameter(HE5_GCTP_STEREO   =10)
+           parameter(HE5_GCTP_LAMAZ    =11)
+           parameter(HE5_GCTP_AZMEQD   =12)
+           parameter(HE5_GCTP_GNOMON   =13)
+           parameter(HE5_GCTP_ORTHO    =14)
+           parameter(HE5_GCTP_GVNSP    =15)
+           parameter(HE5_GCTP_SNSOID   =16)
+           parameter(HE5_GCTP_EQRECT   =17)
+           parameter(HE5_GCTP_MILLER   =18)
+           parameter(HE5_GCTP_VGRINT   =19)
+           parameter(HE5_GCTP_HOM      =20)
+           parameter(HE5_GCTP_ROBIN    =21)
+           parameter(HE5_GCTP_SOM      =22)
+           parameter(HE5_GCTP_ALASKA   =23)
+           parameter(HE5_GCTP_GOOD     =24)
+           parameter(HE5_GCTP_MOLL     =25)
+           parameter(HE5_GCTP_IMOLL    =26)
+           parameter(HE5_GCTP_HAMMER   =27)
+           parameter(HE5_GCTP_WAGIV    =28)
+           parameter(HE5_GCTP_WAGVII   =29)
+           parameter(HE5_GCTP_OBLEQA   =30)
+           parameter(HE5_GCTP_ISINUS   =99)
+ 
+ 
+!          HDFEOS5 TILIND/COMPRESSION CODES 
+!          ================================
+
+           integer HE5_HDFE_NOTILE       
+           integer HE5_HDFE_TILE         
+           integer HE5_HDFE_COMP_NONE    
+           integer HE5_HDFE_COMP_RLE     
+           integer HE5_HDFE_COMP_NBIT    
+           integer HE5_HDFE_COMP_SKPHUFF 
+           integer HE5_HDFE_COMP_DEFLATE 
+           integer HE5_HDFE_COMP_SZIP_CHIP
+           integer HE5_HDFE_COMP_SZIP_K13
+           integer HE5_HDFE_COMP_SZIP_EC
+           integer HE5_HDFE_COMP_SZIP_NN
+           integer HE5_HDFE_COMP_SZIP_K13orEC
+           integer HE5_HDFE_COMP_SZIP_K13orNN
+           integer HE5_HDFE_COMP_SHUF_DEFLATE
+           integer HE5_HDFE_COMP_SHUF_SZIP_CHIP
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13
+           integer HE5_HDFE_COMP_SHUF_SZIP_EC
+           integer HE5_HDFE_COMP_SHUF_SZIP_NN
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13orEC
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13orNN
+
+           parameter(HE5_HDFE_NOTILE                 =0)
+           parameter(HE5_HDFE_TILE                   =1)
+           parameter(HE5_HDFE_COMP_NONE              =0)
+           parameter(HE5_HDFE_COMP_RLE               =1)
+           parameter(HE5_HDFE_COMP_NBIT              =2)
+           parameter(HE5_HDFE_COMP_SKPHUFF           =3)
+           parameter(HE5_HDFE_COMP_DEFLATE           =4)
+           parameter(HE5_HDFE_COMP_SZIP_CHIP         =5)
+           parameter(HE5_HDFE_COMP_SZIP_K13          =6)
+           parameter(HE5_HDFE_COMP_SZIP_EC           =7)
+           parameter(HE5_HDFE_COMP_SZIP_NN           =8)
+           parameter(HE5_HDFE_COMP_SZIP_K13orEC      =9)
+           parameter(HE5_HDFE_COMP_SZIP_K13orNN      =10)
+           parameter(HE5_HDFE_COMP_SHUF_DEFLATE      =11)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_CHIP    =12)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13     =13)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_EC      =14)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_NN      =15)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orEC =16)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orNN =17)
+ 
+!          HDFEOS5 GROUP CODES 
+!          ===================
+
+           integer HE5_HDFE_GEOGROUP        
+           integer HE5_HDFE_DATAGROUP       
+           integer HE5_HDFE_ATTRGROUP       
+           integer HE5_HDFE_GRPATTRGROUP    
+           integer HE5_HDFE_LOCATTRGROUP    
+           integer HE5_HDFE_PROFGROUP       
+           integer HE5_HDFE_PROFGRPATTRGROUP
+           integer HE5_HDFE_GEOGRPATTRGROUP
+
+           parameter(HE5_HDFE_GEOGROUP       =0)
+           parameter(HE5_HDFE_DATAGROUP      =1)
+           parameter(HE5_HDFE_ATTRGROUP      =2)
+           parameter(HE5_HDFE_GRPATTRGROUP   =3)
+           parameter(HE5_HDFE_LOCATTRGROUP   =4)
+           parameter(HE5_HDFE_PROFGROUP      =5)
+           parameter(HE5_HDFE_PROFGRPATTRGROUP =6)
+           parameter(HE5_HDFE_GEOGRPATTRGROUP =7)
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/hdfeos5_64.inc b/samples/hdfeos5_64.inc
new file mode 100644
index 0000000..cb8be09
--- /dev/null
+++ b/samples/hdfeos5_64.inc
@@ -0,0 +1,16 @@
+! * ==========================================================
+! * File:       hdfeos5_64.inc
+! * Author:     A. Muslimov, Emergent Technology Services, Inc.
+! * Date:       March 19, 2002
+! * Purpose:    Fortran header file for HDFEOS5 routines on 64
+! *              bit platforms
+! * ==========================================================
+! * Contents: 
+! *
+! *
+! * ===========================================================
+ 
+
+           integer*8 HE5S_UNLIMITED_F_64
+
+           parameter(HE5S_UNLIMITED_F_64 = -1)
diff --git a/samples/he5_eh_readglobalattr.c b/samples/he5_eh_readglobalattr.c
new file mode 100755
index 0000000..d8478e6
--- /dev/null
+++ b/samples/he5_eh_readglobalattr.c
@@ -0,0 +1,309 @@
+
+/* Sample code to read Global Attributes from and HDF5 file */
+
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <HE5_HdfEosDef.h>
+
+#define BUF_SIZE 4096
+#define MAX_GD 256
+#define MAX_ATT 256
+
+static void HE5ParseName(char names_in[], char hdf_names[][256], long n_names)
+{
+  int i;
+  char *tmp,*tmp2;
+  
+  tmp = names_in;
+  for(i = 0; i < n_names; i++)
+    {
+      if((tmp2 = strchr(tmp,','))!= 0)
+        {
+	  *tmp2 = '\0';
+        }
+      strcpy(hdf_names[i], tmp);
+      
+      tmp2 = tmp;
+      while(*tmp2 != '\0')
+        {
+	  if(!isalnum(*tmp2))
+            {
+	      *tmp2 = '_';
+            }
+	  tmp2++;
+        }
+      tmp = tmp2 + 1;
+    }    
+}
+
+int main(int argc, char **argv)
+{
+  hid_t HE5_GDfid = 0;
+  int i;
+  long ngd;
+  long ngrp_atts;
+  long ns;
+  long str_buf_size;
+ 
+  int max_gd = MAX_GD;
+  char gd_hdf_names[MAX_GD][256];
+  
+  int max_att = MAX_ATT;
+  char att_hdf_names[MAX_ATT][256];
+  
+  hid_t att_type;
+  hsize_t att_size;
+  int cur_buf_size = BUF_SIZE;
+  char *buffer;
+
+  char *charstrs = NULL;
+  char *orig_charstrs = NULL;
+  unsigned char *rdbuffer = NULL;
+  unsigned char *orig_rdbuffer;
+  double *drdbuffer = NULL;
+  float *frdbuffer = NULL;
+  double *orig_drdbuffer = NULL;
+  float *orig_frdbuffer = NULL;
+  unsigned int * irdbuffer = NULL;
+  unsigned int * orig_irdbuffer = NULL;
+  
+  int         n, k;
+  int         statusr;
+  herr_t      he5_status;
+  hid_t       dtype;
+  H5T_class_t classid;
+  H5T_order_t order;
+  size_t      size;
+  hsize_t     size_count;
+  int         count;
+  
+  char path[] = "/tools/pgs/ataaheri/DATA/OMI-Aura_L3-OMLER_2005m01-2009m12_v003-2010m0503t063707.he5";
+  /* char path[] = "/tools/pgs/ataaheri/DATA/OMI-Aura_L3-OMSO2e_2004m1027_v003-2012m0409t095845.he5";*/
+  
+  ngd = HE5_GDinqgrid(path,NULL,&str_buf_size);
+  
+  while(ngd > max_gd)
+    max_gd *= 2;
+  
+  if(str_buf_size >= cur_buf_size)
+    {
+      while(str_buf_size >= cur_buf_size)
+	cur_buf_size *= 2;
+    }
+  
+  buffer = malloc(cur_buf_size);
+  ngd = HE5_GDinqgrid(path,buffer,&str_buf_size);
+  HE5ParseName(buffer,gd_hdf_names,ngd);
+  buffer[str_buf_size] = '\0';
+  
+  HE5_GDfid = HE5_GDopen(path,H5F_ACC_RDONLY);
+  
+  /*
+   *global attributes from file
+   */
+  ngrp_atts = HE5_EHinqglbattrs(HE5_GDfid,NULL,&str_buf_size);
+  
+  if(1 > ngrp_atts)
+    {
+      fprintf(stderr, "\nfile: %s, line: %d\n", __FILE__, __LINE__);
+      fprintf(stderr, "\tngrp_atts %ld is too small\n\n", ngrp_atts);
+      return -1;
+    }
+  
+  if (str_buf_size >= cur_buf_size)
+    {
+      while(str_buf_size >= cur_buf_size)
+	cur_buf_size *= 2;
+      buffer = realloc(buffer, cur_buf_size);
+    }
+       
+       ngrp_atts = HE5_EHinqglbattrs(HE5_GDfid,buffer,&str_buf_size);
+  if(max_att < ngrp_atts)
+    {
+      fprintf(stderr, "\nfile: %s, line: %d\n", __FILE__, __LINE__);
+      fprintf(stderr, "\tngrp_atts %ld is bigger than MAX_ATT: %d\n\n",
+	      ngrp_atts, MAX_ATT);
+      return -2;
+    }
+  
+  buffer[str_buf_size] = '\0';
+  HE5ParseName(buffer, att_hdf_names, ngrp_atts);
+  
+  for(k = 0; k < ngrp_atts; ++k)
+    {
+      /* Note: att_size should be number of elements in attribute array */
+      if(HE5_EHglbattrinfo(HE5_GDfid,att_hdf_names[k],&att_type,&att_size)==0)
+	{
+	  if(HE5T_CHARSTRING == att_type)
+	    {
+	      hsize_t      size_count;
+	      int count;
+	      
+	      fprintf(stderr, "\nAtt No. %d, name: <%s>, array_size = %ld, type = %ld\n",
+		      k, att_hdf_names[k], (long)att_size, (long)att_type);
+	      
+	      /* Note: size should be datatype size in bytes (max number of charcters for character string arrays */
+	      he5_status = HE5_EHinqglbdatatype(HE5_GDfid, att_hdf_names[k], &dtype, &classid, &order, &size);
+	      fprintf(stderr, "\the5_status = %ld, dtype = %ld, classid = %ld, order = %ld, array_element_Byte_size = %ld\n",
+		      (long) he5_status, (long) dtype, (long) classid, (long) order, (long) size);
+	      
+	      
+	      /* Note: size_count should be number of elements in attribute array */
+	      he5_status = HE5_EHglbattrinfo(HE5_GDfid, att_hdf_names[k], &att_type,  &size_count);
+	      
+	      printf("=============== size_count=%d\n",(int)size_count);
+	      
+	      charstrs = (char *)calloc((size_count+1) * size, sizeof(char));
+	      orig_charstrs = charstrs;
+	      if(HE5_EHreadglbattr(HE5_GDfid,att_hdf_names[k],(void *)charstrs) == 0)
+		{
+		  for(count=0; count < size_count; count++)
+		    { 
+		      fprintf(stderr, "\tvalue: <%s>\n", charstrs);
+		      charstrs=charstrs+size;
+		    }
+		}
+	      if(charstrs != NULL)
+		{
+		  free(orig_charstrs);
+		  orig_charstrs = NULL;
+		  charstrs = orig_charstrs;
+		}
+	    }
+	  else
+	    {
+	      fprintf(stderr, "\n+++++++++++++++++++++++++++++ None-String Attribute ++++++++++++++++++++++++\n");
+	      fprintf(stderr, "Att No. %d, name: <%s>, array_size = %ld, type = %ld,\n",
+		      k, att_hdf_names[k], (long)att_size, (long)att_type);
+	      he5_status = HE5_EHinqglbdatatype(HE5_GDfid, att_hdf_names[k], &dtype, &classid, &order, &size);
+	      fprintf(stderr, "\the5_status = %ld, dtype = %ld, classid = %ld, order = %ld, array_element_Byte_size = %ld\n",
+		      (long) he5_status, (long) dtype, (long) classid, (long) order, (long) size);
+	      
+	      /* Note: size_count should be number of elements in attribute array */
+	      he5_status = HE5_EHglbattrinfo(HE5_GDfid, att_hdf_names[k], &att_type,  &size_count);
+	      printf("=============== size_count=%d\n",(int)size_count);
+	      if(att_type == 11 )
+		{
+		  drdbuffer = calloc((size_count) * size, 1);
+		  orig_drdbuffer = drdbuffer;
+		  statusr=(int)HE5_EHreadglbattr(HE5_GDfid,att_hdf_names[k],(void *)drdbuffer);
+		}
+	      else if(att_type == 10)
+		{
+		  frdbuffer = calloc((size_count) * size, 1);
+		  orig_frdbuffer = frdbuffer;
+		  statusr=(int)HE5_EHreadglbattr(HE5_GDfid,att_hdf_names[k],(void *)frdbuffer);
+		}
+	      else if(att_type == 7 || att_type == 6 || att_type == 3 || 
+		      att_type == 2 || att_type == 1 || att_type == 0 ) // uint/int types
+		{
+		  irdbuffer = calloc((size_count) * size, 1);
+		  orig_irdbuffer = irdbuffer;
+		  statusr=(int)HE5_EHreadglbattr(HE5_GDfid,att_hdf_names[k],(void *)irdbuffer);
+		}
+	      else // int8/uint8 types 
+		{
+		  rdbuffer = calloc((size_count) * size, 1);
+		  orig_rdbuffer = rdbuffer;
+		  statusr=(int)HE5_EHreadglbattr(HE5_GDfid,att_hdf_names[k],(void *)rdbuffer);
+		}
+	      
+	      if(statusr == 0)
+		
+		{
+		  for(count=0; count < size_count; count++)
+		    { 
+		      if(att_type == 11) // double
+			{
+			  fprintf(stderr, "\tvalue: <%lf>\n", (double)*drdbuffer);
+			  drdbuffer=drdbuffer+size;
+			}
+		      if(att_type == 10) // float
+			{
+			  fprintf(stderr, "\tvalue: <%f>\n", (float)*frdbuffer);
+			  frdbuffer=frdbuffer+size;
+			}
+		      else if(att_type == 5) // unsigned int8 
+			{
+			  fprintf(stderr, "\tvalue: <%d>\n", (uint)*rdbuffer);
+			  rdbuffer=rdbuffer+size;
+			}
+		      else if(att_type == 13) // int8 
+			{
+			  fprintf(stderr, "\tvalue: <%d>\n", (int)*rdbuffer);
+			  rdbuffer=rdbuffer+size;
+			}
+		      else if(att_type == 6) // long 
+			{
+			  fprintf(stderr, "\tvalue: <%d>\n", (int)*irdbuffer);
+			  irdbuffer=irdbuffer+size;
+			}
+		      else if(att_type == 7) // unsigned long 
+			{
+			  fprintf(stderr, "\tvalue: <%d>\n", (uint)*irdbuffer);
+			  irdbuffer=irdbuffer+size;
+			}
+		      else if(att_type == 3) // unsigned int 16
+			{
+			  fprintf(stderr, "\tvalue: <%d>\n", (uint)*irdbuffer);
+			  irdbuffer=irdbuffer+size;
+			}
+		      else if(att_type == 2) // int 16
+			{
+			  fprintf(stderr, "\tvalue: <%d>\n", (int)*irdbuffer);
+			  irdbuffer=irdbuffer+size;
+			}
+		      else if(att_type == 1) //  unsigned int
+			{
+			  fprintf(stderr, "\tvalue: <%d>\n", (uint)*irdbuffer);
+			  irdbuffer=irdbuffer+size;
+			}
+		      else if(att_type == 0) // int
+			{
+			  fprintf(stderr, "\tvalue: <%d>\n", (int)*irdbuffer);
+			  irdbuffer=irdbuffer+size;
+			}
+		    }
+		}
+	      if(rdbuffer != NULL)
+		{
+		  free(orig_rdbuffer);
+		  orig_rdbuffer = NULL;
+		  rdbuffer = orig_rdbuffer;
+		}
+	      if(drdbuffer != NULL)
+		{
+		  free(orig_drdbuffer);
+		  orig_drdbuffer = NULL;
+		  drdbuffer = orig_drdbuffer;
+		}
+	      if(frdbuffer != NULL)
+		{
+		  free(orig_frdbuffer);
+		  orig_frdbuffer = NULL;
+		  frdbuffer = orig_frdbuffer;
+		}
+	      if(irdbuffer != NULL)
+		{
+		  free(orig_irdbuffer);
+		  orig_irdbuffer = NULL;
+		  irdbuffer = orig_irdbuffer;
+		}
+	      fprintf(stderr, "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
+	    }
+	}
+    }
+  fprintf(stderr, "\n======================================================================\n");
+  fprintf(stderr, "======================================================================\n");
+  fprintf(stderr, "\t Done writing all attributes Totla Number ngrp_atts=%d\n", ngrp_atts);
+  fprintf(stderr, "======================================================================\n");
+  fprintf(stderr, "======================================================================\n");
+  HE5_GDclose(HE5_GDfid);
+  
+  free(buffer);
+  
+  return 0;
+}
+
+
diff --git a/samples/he5_gd_datainfo.c b/samples/he5_gd_datainfo.c
new file mode 100755
index 0000000..44e1142
--- /dev/null
+++ b/samples/he5_gd_datainfo.c
@@ -0,0 +1,91 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |  
+ ----------------------------------------------------------------------------  
+ */
+
+#include   <HE5_HdfEosDef.h>
+
+#define FILENAME   "Grid.h5"
+#define OBJECT     "UTMGrid"
+#define FIELDNAME  "Vegetation"
+
+int main(void)
+{
+  herr_t       status     = FAIL;
+
+  int          fieldgroup = FAIL;
+
+  hid_t        fid        = FAIL;
+  hid_t        GDid       = FAIL;
+  hid_t        datatype   = FAIL;
+
+  H5T_class_t  classid    = H5T_NO_CLASS;     
+  H5T_order_t  order      = H5T_ORDER_ERROR;
+
+  size_t       size       = 0;
+
+  fid = HE5_GDopen(FILENAME, H5F_ACC_RDONLY);
+  printf("File ID returned by HE5_GDopen() :         %d \n", fid);
+    
+  GDid = HE5_GDattach(fid, OBJECT);
+  printf("Grid ID returned by HE5_GDattach() :       %d \n", GDid);
+
+  fieldgroup = HE5_HDFE_DATAGROUP;
+  status = HE5_GDinqdatatype(GDid, FIELDNAME, NULL, fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_GDinqdatatype() :   %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", (int)datatype);
+	  printf("\tclass ID:    %d \n", (int)classid);
+	  printf("\torder:       %d \n", (int)order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  fieldgroup = HE5_HDFE_ATTRGROUP;
+  status = HE5_GDinqdatatype(GDid, NULL, "GlobalAttribute", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_GDinqdatatype() :   %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", (int)datatype);
+	  printf("\tclass ID:    %d \n", (int)classid);
+	  printf("\torder:       %d \n", (int)order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  fieldgroup = HE5_HDFE_GRPATTRGROUP;
+  status = HE5_GDinqdatatype(GDid, NULL, "GroupAttribute", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_GDinqdatatype() :   %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", (int)datatype);
+	  printf("\tclass ID:    %d \n", (int)classid);
+	  printf("\torder:       %d \n", (int)order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  fieldgroup = HE5_HDFE_LOCATTRGROUP;
+  status = HE5_GDinqdatatype(GDid, FIELDNAME, "LocalAttribute", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_GDinqdatatype() :   %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", (int)datatype);
+	  printf("\tclass ID:    %d \n", (int)classid);
+	  printf("\torder:       %d \n", (int)order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  status = HE5_GDdetach(GDid);
+  printf("Status returned by HE5_GDdetach() :        %d \n", status);
+
+  status = HE5_GDclose(fid);
+  printf("Status returned by HE5_GDclose() :         %d \n", status);
+    
+  return(0);
+}
+
+
+
+
+
+
diff --git a/samples/he5_gd_defexternalfld.c b/samples/he5_gd_defexternalfld.c
new file mode 100755
index 0000000..d6db3af
--- /dev/null
+++ b/samples/he5_gd_defexternalfld.c
@@ -0,0 +1,70 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include    <HE5_HdfEosDef.h>
+
+/*
+ * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to
+ * the "UTMGrid" grid, and (3) define the external data field "ExtData".
+ */
+
+int main()
+{  
+  herr_t          status = FAIL;
+
+  hid_t           gdfid  = FAIL;
+  hid_t           GDid   = FAIL;
+
+  off_t           offset[3];
+ 
+  hsize_t         size[3];
+  
+  
+  /* Open the file, "Grid.h5", using the H5F_ACC_RDWR access code */
+  /* ------------------------------------------------------------- */
+  gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR);
+  if (gdfid != FAIL)
+    {	  
+	  /* Attach to the "UTMgrid" grid */
+	  /* ---------------------------- */
+	  GDid = HE5_GDattach(gdfid, "UTMGrid");
+	  if (GDid != FAIL)
+		{
+		  /* Set the data sizes and offsets in external files */
+		  /* ------------------------------------------------ */
+		  size[0] = 10 * sizeof(int);       offset[0] = 0;
+		  size[1] = 20 * sizeof(int);       offset[1] = 40;
+		  size[2] = 30 * sizeof(int);       offset[2] = 80;
+		  
+		  /* Set external data files first */
+		  /* ----------------------------- */
+		  status = HE5_GDsetextdata(GDid, "external_1g.data,external_2g.data,external_3g.data", offset, size);
+		  printf("Status returned by HE5_GDsetextdata(...) :             %d\n",status);
+ 
+		  /* Define field containing external data */
+		  /* ------------------------------------- */
+		  status = HE5_GDdeffield(GDid, "ExtData", "ExtDim", NULL, H5T_NATIVE_INT, 0);
+		  printf("Status returned by HE5_GDdeffield(...\"ExtData\",..) :   %d\n",status);              
+		}
+	}
+  
+  /* Detach from the swath */
+  /* --------------------- */
+  status = HE5_GDdetach(GDid);
+  printf("Status returned by HE5_GDdetach(...) :                 %d\n",status);
+
+  /* Close the file */
+  /* -------------- */
+  status = HE5_GDclose(gdfid);
+  printf("Status returned by HE5_GDclose(...) :                  %d\n",status);
+  
+
+  return 0;
+}
+
+
+
diff --git a/samples/he5_gd_definefields.c b/samples/he5_gd_definefields.c
new file mode 100755
index 0000000..92587f7
--- /dev/null
+++ b/samples/he5_gd_definefields.c
@@ -0,0 +1,127 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include      <HE5_config.h>
+#include      <HE5_HdfEosDef.h>
+
+/*
+ * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to
+ * the "Grid1" grid, and (3) define the grid fields.
+ */
+
+int main()
+{  
+  herr_t          status = FAIL;
+
+  hid_t           gdfid = FAIL;
+  hid_t           GDid1 = FAIL;
+  hid_t           GDid2 = FAIL;
+  hid_t           GDid3 = FAIL;
+  float           fillval1 = -7.;
+  float           fillval2 = -9999.;
+
+  int             tilerank, compcode = 16;
+  int             compparm[5] = {0, 0, 0, 0, 0};
+  hsize_t         tiledims[8];
+ 
+  /*
+   * We first open the HDF-EOS grid file, "Grid.h5".  Because this file
+   * already exist and we wish to write to it, we use the H5F_ACC_RDWR access
+   * code in the open statement.  The HE5_GDopen routine returns the grid file
+   * id, gdfid, which is used to identify the file in subsequent routines.
+   */ 
+  gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR);
+ 
+  /*
+   * If the grid file cannot be found, HE5_GDopen will return -1 for the file
+   * handle (gdfid).  We there check that this is not the case before
+   * proceeding with the other routines.
+   * 
+   * The HE5_GDattach routine returns the handle to the existing grid "Grid1",
+   * GDid.  If the grid is not found, HE5_GDattach returns -1 for the handle.
+   */ 
+  if (gdfid != FAIL)
+    {	  
+	  GDid1 = HE5_GDattach(gdfid, "UTMGrid");
+
+ 
+          status = HE5_GDsetfillvalue(GDid1, "Pollution", H5T_NATIVE_FLOAT, &fillval1);
+          printf("Status returned by HE5_GDsetfillvalue(...,\"Pollusion\",...) : %d \n", status);
+
+          status = HE5_GDdeffield(GDid1, "Pollution", "Time,YDim,XDim", NULL, H5T_NATIVE_FLOAT, 0);
+          printf("Status returned by HE5_GDdeffield(..., \"Pollution\",...) :    %d \n", status);
+
+          /* Define appendable field "Vegetation"  */
+          tilerank    = 2;
+          tiledims[0] = 100;
+          tiledims[1] = 60;
+          compparm[0] = 8;
+ 
+          status = HE5_GDdeftile(GDid1,HE5_HDFE_TILE,tilerank,tiledims);
+          printf("Status returned by HE5_GDdeftile():                %d\n", status);
+ 
+#ifdef HAVE_FILTER_SZIP_ENCODER
+	  status = HE5_GDdefcomp(GDid1,compcode, compparm);
+	  printf("Status returned by HE5_GDdefcomp():                %d\n", status);
+#else
+	  printf("SZIP encoder is not available. The data compression test is skipped.\n");
+#endif
+ 
+          status = HE5_GDdeffield(GDid1, "Vegetation", "YDim,XDim",NULL,H5T_NATIVE_FLOAT, 0);
+          printf("Status returned by HE5_GDdeffield(\"Vegetation\"):   %d\n", status);
+
+	  GDid2 = HE5_GDattach(gdfid, "PolarGrid");
+
+	  status = HE5_GDdeffield(GDid2, "Temperature", "YDim,XDim", NULL, H5T_NATIVE_FLOAT, 0);
+	  printf("Status returned by HE5_GDdeffield(..., \"Temperature\",...) :  %d \n", status);
+	  
+	  status = HE5_GDsetfillvalue(GDid2, "Pressure", H5T_NATIVE_FLOAT, &fillval2);
+	  printf("Status returned by HE5_GDsetfillvalue(...,\"Pressure\",...) :  %d \n", status);
+	  
+	  status = HE5_GDdeffield(GDid2, "Pressure", "YDim,XDim", NULL, H5T_NATIVE_INT, 0);
+	  printf("Status returned by HE5_GDdeffield(..., \"Pressure\",...) :     %d \n", status);
+
+
+	  status = HE5_GDdeffield(GDid2, "Soil Dryness", "YDim,XDim", NULL, H5T_NATIVE_FLOAT, 0);
+	  printf("Status returned by HE5_GDdeffield(..., \"Soil Dryness\",...) : %d \n", status);
+
+	  status = HE5_GDdeffield(GDid2, "Spectra", "Bands,YDim,XDim", NULL, H5T_NATIVE_DOUBLE, 0);
+	  printf("Status returned by HE5_GDdeffield(..., \"Spectra\",...) :      %d \n", status);
+
+	  status = HE5_GDdetach(GDid1);
+	  status = HE5_GDdetach(GDid2);
+
+	  GDid3 = HE5_GDattach(gdfid, "GEOGrid");
+	  if (GDid3 == -1)
+	    {
+	      printf("\t\tError: Cannot attach to grid \"GEOGrid\"\n");
+	      return -1;
+	    }
+	  status = HE5_GDsetfillvalue(GDid3, "GeoSpectra", H5T_NATIVE_FLOAT, &fillval2);
+	  if (status == -1)
+	    {
+	      printf("\t\tError: Cannot define fill value for field \"Pressure\"\n");
+	      return -1;
+	    }
+	  status = HE5_GDdeffield(GDid3, "GeoSpectra", "YDim,XDim", NULL, H5T_NATIVE_FLOAT, 0);
+	  if (status == -1)
+	    {
+	      printf("\t\tError: Cannot define field \"GeoSpectra\"\n");
+	      return -1;
+	    }
+
+	  HE5_GDdetach(GDid3);
+
+    }
+
+  status = HE5_GDclose(gdfid);
+
+  return 0;
+}
+
+
+
diff --git a/samples/he5_gd_definefieldsF_32.f b/samples/he5_gd_definefieldsF_32.f
new file mode 100755
index 0000000..8cb5680
--- /dev/null
+++ b/samples/he5_gd_definefieldsF_32.f
@@ -0,0 +1,120 @@
+      program   he5_gd_definefldsF_32
+
+      implicit  none
+
+      include   'hdfeos5.inc'
+
+      integer   status
+      integer   he5_gdopen
+      integer   he5_gddeffld
+      integer   he5_gdsetfill
+      integer   he5_gddeftle
+      integer   he5_gddefcomp
+      integer   he5_gdattach
+      integer   he5_gddetach
+      integer   he5_gdclose
+      integer   gdfid, gdid1, gdid2  
+
+      integer   tilecode, tilerank
+      integer*4 tiledims(2)
+      integer   compparm(1)
+      
+      real*4    fillval1, fillval2
+	
+      fillval1 = -7.0
+      fillval2 = -9999.0
+
+c     Open HDF-EOS file "grid.he5" 
+c     ----------------------------	  
+	  gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_gdopen():  ',gdfid
+
+c     Attach to the UTM grid
+c     ----------------------
+	  gdid1 = he5_gdattach(gdfid, "UTMGrid")
+      write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid1
+
+c     Define Fields
+c     -------------
+
+      status = he5_gdsetfill(gdid1,"Pollution",
+     1     HE5T_NATIVE_FLOAT,fillval1)
+      write(*,*) 'Status returned by he5_gdsetfill():  ',status
+
+      status = he5_gddeffld(gdid1,"Pollution",
+     1     "XDim,YDim,Time"," ", HE5T_NATIVE_FLOAT, 0)
+      write(*,*) 'Status returned by he5_gddeffld():  ',status
+
+                tilerank = 2
+                tiledims(1) = 60
+                tiledims(2) = 100
+                compparm(1) = 6
+
+      status = he5_gddeftle(gdid1,HE5_HDFE_TILE,tilerank,tiledims)
+      write(*,*) 'Status returned by he5_gddeftle(): ',status
+
+      status = he5_gddefcomp(gdid1,HE5_HDFE_COMP_DEFLATE,compparm)
+      write(*,*) 'Status returned by he5_gddefcomp():  ',status
+
+      status = he5_gddeffld(gdid1, "Vegetation", "XDim,YDim",
+     1     " ", HE5T_NATIVE_FLOAT, 0)
+      write(*,*) 'Status returned by he5_gddeffld():  ',status
+
+
+c     Attach to the POLAR grid
+c     ------------------------
+	  gdid2 = he5_gdattach(gdfid, "PolarGrid")
+      write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid2
+
+      
+c     Define Fields
+c     -------------	  
+      status = he5_gddeffld(gdid2, "Temperature", "XDim,YDim",
+     1     " ", HE5T_NATIVE_FLOAT, 0)
+      write(*,*) 'Status returned by he5_gddeffld():  ',status
+
+c     Set fill value for "Pressure" field
+c     -----------------------------------
+      status = he5_gdsetfill(gdid2,"Pressure",
+     1     HE5T_NATIVE_FLOAT,fillval2)
+      write(*,*) 'Status returned by he5_gdsetfill():  ',status
+
+      status = he5_gddeffld(gdid2, "Pressure", "XDim,YDim",
+     1     " ", HE5T_NATIVE_FLOAT, 0)
+      write(*,*) 'Status returned by he5_gddeffld():  ',status
+
+c     Define Fields
+c     -------------	  
+      status = he5_gddeffld(gdid2, "Soil Dryness", "XDim,YDim",
+     1     " ", HE5T_NATIVE_FLOAT, 0)
+      write(*,*) 'Status returned by he5_gddeffld():  ',status
+
+      
+      status = he5_gddeffld(gdid2, "Spectra", "XDim,YDim,Bands",
+     1     " ", HE5T_NATIVE_DOUBLE, 0)
+      write(*,*) 'Status returned by he5_gddeffld():  ',status
+
+
+c     Detach from the grids
+c     ---------------------
+	  status = he5_gddetach(gdid1)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+	  status = he5_gddetach(gdid2)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+      
+c     Close the file
+c     --------------
+	  status = he5_gdclose(gdfid)
+      write(*,*) 'Status returned by he5_gdclose():  ',status
+
+	  stop
+	  end
+      
+      
+
+
+
+
+
diff --git a/samples/he5_gd_definefieldsF_64.f b/samples/he5_gd_definefieldsF_64.f
new file mode 100755
index 0000000..fa3b960
--- /dev/null
+++ b/samples/he5_gd_definefieldsF_64.f
@@ -0,0 +1,105 @@
+      program   he5_gd_definefieldsF_64
+  
+      implicit  none
+
+      include   'hdfeos5.inc'
+     
+	  integer   status, he5_gddeffld, he5_gdsetfill
+	  integer   he5_gdattach, he5_gddetach, he5_gdclose
+          integer   he5_gddeftle, he5_gddefcomp
+	  integer   gdfid, gdid1, gdid2, he5_gdopen 
+    
+          integer   tilecode, tilerank
+          integer*8 tiledims(2)
+          integer   compparm(1)
+
+	  real*4    fillval1, fillval2
+	
+	  fillval1 = -7.0
+	  fillval2 = -9999.0
+
+c     Open HDF-EOS file "grid.he5" 
+c     ----------------------------	  
+	  gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_gdopen():  ',gdfid
+
+c     Attach to the UTM grid
+c     ----------------------
+	  gdid1 = he5_gdattach(gdfid, "UTMGrid")
+      write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid1 
+
+c     Define Fields
+c     -------------	  
+      status = he5_gdsetfill(gdid1,"Pollution",
+     1HE5T_NATIVE_FLOAT,fillval1)
+      write(*,*) 'Status returned by he5_gdsetfill():  ',status
+
+      status = he5_gddeffld(gdid1, "Pollution", 
+     1"XDim,YDim,Time"," ", HE5T_NATIVE_FLOAT, 0)
+      write(*,*) 'Status returned by he5_gddeffld():  ',status
+      
+                tilerank = 2
+                tiledims(1) = 60
+                tiledims(2) = 100
+                compparm(1) = 6
+ 
+      status = he5_gddeftle(gdid1,HE5_HDFE_TILE,tilerank,tiledims)
+      write(*,*) 'Status returned by he5_gddeftle(): ',status
+ 
+      status = he5_gddefcomp(gdid1,HE5_HDFE_COMP_DEFLATE,compparm)
+      write(*,*) 'Status returned by he5_gddefcomp():  ',status
+
+      status = he5_gddeffld(gdid1, "Vegetation",
+     1"XDim,YDim"," ", HE5T_NATIVE_FLOAT, 0)
+      write(*,*) 'Status returned by he5_gddeffld():  ',status
+
+c     Attach to the POLAR grid
+c     ------------------------
+	  gdid2 = he5_gdattach(gdfid, "PolarGrid")
+      write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid2
+
+c     Define Fields
+c     -------------	  
+      status = he5_gddeffld(gdid2, "Temperature",
+     1"XDim,YDim"," ", HE5T_NATIVE_FLOAT, 0)
+      write(*,*) 'Status returned by he5_gddeffld():  ',status
+
+c     Set fill value for "Pressure" field
+c     -----------------------------------
+      status = he5_gdsetfill(gdid2,"Pressure",
+     1HE5T_NATIVE_FLOAT,fillval2)
+      write(*,*) 'Status returned by he5_gdsetfill():  ',status
+
+      status = he5_gddeffld(gdid2, "Pressure", 
+     1"XDim,YDim"," ", HE5T_NATIVE_FLOAT, 0)
+      write(*,*) 'Status returned by he5_gddeffld():  ',status
+
+c     Define Fields
+c     -------------	  
+      status = he5_gddeffld(gdid2, "Soil Dryness", 
+     1"XDim,YDim"," ", HE5T_NATIVE_FLOAT, 0)
+      write(*,*) 'Status returned by he5_gddeffld():  ',status
+      
+      status = he5_gddeffld(gdid2, "Spectra", 
+     1"XDim,YDim,Bands"," ", HE5T_NATIVE_DOUBLE, 0)
+      write(*,*) 'Status returned by he5_gddeffld():  ',status
+      
+c     Detach from the grids
+c     ---------------------
+	  status = he5_gddetach(gdid1)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+	  status = he5_gddetach(gdid2)
+      write(*,*) 'Status returned by he5_gddetach():  ',status     
+
+c     Close the file
+c     --------------
+	  status = he5_gdclose(gdfid)
+      write(*,*) 'Status returned by he5_gdclose():  ',status
+	  
+	  stop
+	  end
+
+
+
+
diff --git a/samples/he5_gd_defunlimfld.c b/samples/he5_gd_defunlimfld.c
new file mode 100755
index 0000000..6902fde
--- /dev/null
+++ b/samples/he5_gd_defunlimfld.c
@@ -0,0 +1,128 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include    <HE5_HdfEosDef.h>
+
+
+/*
+ * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to
+ * the "Grid1" grid, and (3) define the grid appendable field.
+ */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  int             tilerank, compcode = 4;    
+  int             compparm[5] = {0, 0, 0, 0, 0};
+
+  hid_t           gdfid = FAIL;
+  hid_t           GDid1 = FAIL;
+  hid_t           GDid2 = FAIL;
+
+  hsize_t         tiledims[8];
+    
+  float           fillval1 = -7., fillval2 = -9999.;
+ 
+
+  /*
+   * We first open the HDF-EOS grid file, "Grid.h5".  Because this file
+   * already exist and we wish to write to it, we use the H5F_ACC_RDWR access
+   * code in the open statement.  The HE5_GDopen routine returns the grid file
+   * id, gdfid, which is used to identify the file in subsequent routines.
+   */
+  gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR);
+
+  /*
+   * If the grid file cannot be found, HE5_GDopen will return -1 for the file
+   * handle (gdfid).  We there check that this is not the case before
+   * proceeding with the other routines.
+   * 
+   * The HE5_GDattach routine returns the handle to the existing grid "Grid1",
+   * GDid.  If the grid is not found, HE5_GDattach returns -1 for the handle.
+   */
+  if (gdfid != FAIL)
+    {
+	  GDid1 = HE5_GDattach(gdfid, "UTMGrid");
+	  printf("Grid ID returned by HE5_GDattach(,\"UTMGrid\"):      %d\n", GDid1);
+	
+	  /* Define appendable field "Vegetation"  */
+	  tilerank    = 2;
+	  tiledims[0] = 100;
+	  tiledims[1] = 60;
+	  compparm[0] = 6;
+        
+	  status = HE5_GDdeftile(GDid1,HE5_HDFE_TILE,tilerank,tiledims);
+	  printf("Status returned by HE5_GDdeftile():                %d\n", status);
+
+	  status = HE5_GDdefcomp(GDid1,compcode, compparm);
+	  printf("Status returned by HE5_GDdefcomp():                %d\n", status);
+	
+	  status = HE5_GDdeffield(GDid1, "Vegetation", "YDim,XDim","Unlim,Unlim",H5T_NATIVE_FLOAT, 0);
+	  printf("Status returned by HE5_GDdeffield(\"Vegetation\"):   %d\n", status);
+	
+	  GDid2 = HE5_GDattach(gdfid, "PolarGrid");
+	  printf("Grid ID returned by HE5_GDattach(\"PolarGrid\"):     %d\n", GDid2);
+
+	  status = HE5_GDdeffield(GDid2, "Temperature", "YDim,XDim", NULL, H5T_NATIVE_FLOAT, 0);
+	  printf("Status returned by HE5_GDdeffield(\"Temperature\"):  %d\n", status);
+
+	  status = HE5_GDdeffield(GDid2, "Pressure", "YDim,XDim", NULL, H5T_NATIVE_FLOAT, 0);
+	  printf("Status returned by HE5_GDdeffield(\"Pressure\"):     %d\n", status);
+
+	  status = HE5_GDsetfillvalue(GDid2, "Pressure", H5T_NATIVE_FLOAT, &fillval2);
+	  printf("Status returned by HE5_GDsetfillvalue(\"Pressure\'): %d\n", status);
+
+	  status = HE5_GDdetach(GDid1);
+	  status = HE5_GDdetach(GDid2);
+	
+    }
+
+  status = HE5_GDclose(gdfid);
+  
+  return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_gd_info.c b/samples/he5_gd_info.c
new file mode 100755
index 0000000..b519bc9
--- /dev/null
+++ b/samples/he5_gd_info.c
@@ -0,0 +1,206 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+
+#include     <HE5_HdfEosDef.h>
+
+/*
+ * In this example we will retrieve information about (1) dimensions,
+ * (2) dimension mappings (geolocation relations), (3) grid fields, 
+ * and (4) (global/group/local) grid attributes.
+ */
+
+
+int main()
+{
+
+  herr_t          status = FAIL;
+
+  int             i, rank[32], tilerank;
+  int             projcode, zonecode, spherecode, tilecode;
+  int             ndim = FAIL, nflds = FAIL;
+
+  hid_t           gdfid = FAIL;
+  hid_t           GDid1 = FAIL;
+  hid_t           GDid2 = FAIL;
+
+  hid_t           *ntype;
+  hid_t           *ntype1;
+
+  hsize_t         Dims[32], dimsize, count = 0, tiledims[8];
+
+  long            xdimsize, ydimsize, n, strbufsize;
+
+  double          upleftpt[2], lowrightpt[2], projparm[16];
+    
+  char            version[80];
+  char            dimname[1024], fieldlist[1024];
+  char            attrlist[80];
+
+  int             level[ 5 ]      = { 0, 0, 0, 0, 0 };
+  int             code            = 0;
+    
+
+  /*
+   * Open the Grid File for read only access
+   */	
+  gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDONLY);
+  if (gdfid != FAIL)
+    {
+	  HE5_EHgetversion(gdfid,version);
+	  printf("Version:   \"%s\" \n", version);
+	  
+	  /* Attach the grid */
+
+	  GDid1 = HE5_GDattach(gdfid, "UTMGrid");
+	  GDid2 = HE5_GDattach(gdfid, "PolarGrid");
+	  
+	  ndim = HE5_GDinqdims(GDid1, dimname, Dims);
+	  printf("Dimension list (UTMGrid): %s\n", dimname);
+          for (i = 0; i < ndim; i++) printf("dim size: %li \n", (long)Dims[i]);
+	  
+	  ndim = HE5_GDinqdims(GDid2, dimname, Dims);
+	  printf("Dimension list (PolarGrid): %s\n", dimname);
+          for (i = 0; i < ndim; i++) printf("dim size: %li \n", (long)Dims[i]);
+	  
+
+	  dimsize = HE5_GDdiminfo(GDid1, "Time");
+	  printf("Size of \"Time\" Array: %lu\n", (unsigned long)dimsize);
+
+	  dimsize = HE5_GDdiminfo(GDid2, "Bands");
+	  printf("Size of \"Bands\" Array: %lu\n", (unsigned long)dimsize);
+	
+	  status = HE5_GDgridinfo(GDid1, &xdimsize, &ydimsize,upleftpt, lowrightpt);
+	  printf("X dim size, Y dim size (UTMGrid): %li %li\n",  xdimsize, ydimsize);
+	  printf("Up left pt (UTMGrid): %lf %lf\n", upleftpt[0], upleftpt[1]);
+	  printf("Low right pt (UTMGrid): %lf %lf\n",  lowrightpt[0], lowrightpt[1]);
+	  
+	  status = HE5_GDgridinfo(GDid2, &xdimsize, &ydimsize, upleftpt, lowrightpt);
+	  printf("X dim size, Y dim size (PolarGrid): %li %li\n",  xdimsize, ydimsize);
+	  printf("Up left pt (PolarGrid): %lf %lf\n",  upleftpt[0], upleftpt[1]);
+	  printf("Low right pt (PolarGrid): %lf %lf\n",  lowrightpt[0], lowrightpt[1]);
+	  
+	       
+	  status = HE5_GDprojinfo(GDid1, &projcode, &zonecode, &spherecode, NULL);
+	  printf("projcode , zonecode (UTMGrid): %d %d\n", projcode, zonecode);
+	  printf("spherecode (UTMGrid): %d\n", spherecode);	
+
+	  status = HE5_GDprojinfo(GDid2, &projcode, NULL, &spherecode, projparm);
+	  printf("projcode (PolarGrid): %d\n", projcode);	
+	  printf("spherecode (PolarGrid): %d\n", spherecode);	
+	  for (i = 0; i < 13; i++)
+	    printf("Projection Parameter: %d %lf\n",i,projparm[i]);
+	
+	  ntype1 = (hid_t *)calloc(10, sizeof(hid_t)); 
+	  nflds = HE5_GDinqfields(GDid1, fieldlist, rank, ntype1);
+	  if (nflds != FAIL)
+		{
+		  printf("Data fields (UTMGrid): %s\n", fieldlist);
+		  for (i = 0; i < nflds;i++)
+			printf("Rank:   %i   Data type:   %i\n",rank[i], (int)ntype1[i]);
+		}
+	  
+	  nflds = HE5_GDinqfields(GDid2, fieldlist, rank, ntype1);
+	  if (nflds != FAIL)
+		{
+		  printf("Data fields (PolarGrid): %s\n", fieldlist);
+		  for (i = 0; i < nflds;i++)
+			printf("Rank:   %i   Data type:   %i\n",rank[i],(int)ntype1[i]);
+		}
+	
+	  
+	  status = HE5_GDfieldinfo(GDid2, "Spectra", rank, Dims, ntype1, dimname, NULL);
+	  printf("Spectra rank: %d\n",rank[0]);
+	  printf("Spectra dimensions:  \n");
+	  for (i = 0; i < rank[0]; i++)
+		printf("   %lu\n",(unsigned long)Dims[i]);
+	  printf("Spectra dimension list: \n");
+	  printf("   %s\n", dimname);
+	  
+          ntype = (hid_t *)calloc(10, sizeof(hid_t));
+	  printf(" \n");
+	  printf("Global Attributes \n");	
+	  status = HE5_GDattrinfo(GDid1, "GlobalAttribute", ntype, &count);
+	  printf("\tNumber of attribute elements: %lu \n", (unsigned long)count);
+	  printf("\tData type of attribute:       %d \n", (int)*ntype);
+	  
+	  printf(" \n");
+	  printf("Group Attributes \n");	
+	  status = HE5_GDgrpattrinfo(GDid1, "GroupAttribute", ntype, &count);
+	  printf("\tNumber of attribute elements: %lu \n", (unsigned long)count);
+	  printf("\tData type of attribute:       %d \n", (int)*ntype);
+	  
+	  printf(" \n");
+	  printf("Local Attributes \n");	
+	  status = HE5_GDlocattrinfo(GDid1, "Vegetation", "LocalAttribute", ntype, &count);
+	  printf("\tNumber of attribute elements: %lu \n", (unsigned long)count);
+	  printf("\tData type of attribute:       %d \n", (int)*ntype);
+	  
+	  
+	  printf(" \n");
+	  printf("Global Attributes \n");	
+	  n = HE5_GDinqattrs(GDid1, NULL, &strbufsize);
+	  printf("\tNumber of attributes:                    %li \n", n);
+	  printf("\tSize of attribute list:                  %li \n", strbufsize);
+	  n = HE5_GDinqattrs(GDid1, attrlist, &strbufsize);
+	  printf("\tAttribute list:                          %s \n", attrlist);
+	  
+	  
+	  printf(" \n");
+	  printf("Group Attributes \n");	
+	  n = HE5_GDinqgrpattrs(GDid1, NULL, &strbufsize);
+	  printf("\tNumber of attributes:                    %li \n", n);
+	  printf("\tSize of attribute list:                  %li \n", strbufsize);
+	  n = HE5_GDinqgrpattrs(GDid1, attrlist, &strbufsize);
+	  printf("\tAttribute list:                          %s \n", attrlist);
+	  
+	  
+	  printf(" \n");
+	  printf("Local Attributes \n");	
+	  n = HE5_GDinqlocattrs(GDid1, "Vegetation", NULL, &strbufsize);
+	  printf("\tNumber of attributes:                    %li \n", n);
+	  printf("\tSize of attribute list:                  %li \n", strbufsize);
+	  n = HE5_GDinqlocattrs(GDid1, "Vegetation", attrlist, &strbufsize);
+	  printf("\tAttribute list:                          %s \n", attrlist);
+	  
+	  
+	  free(ntype);
+          free(ntype1);
+	  
+	  n = HE5_GDnentries(GDid1, HE5_HDFE_NENTDIM, &strbufsize);
+	  printf("Number of dimension entries (UTMGrid): %li \n", n);
+	  printf("Length of Dimension List (UTMGrid):    %li \n", strbufsize);
+	  
+	  n = HE5_GDnentries(GDid1, HE5_HDFE_NENTDFLD, &strbufsize);
+	  printf("Number of data fields (UTMGrid):       %li \n", n);
+	  printf("Length of Field List (UTMGrid):        %li \n", strbufsize);	
+
+          status = HE5_GDtileinfo(GDid1,"Vegetation",&tilecode,&tilerank,tiledims);
+          printf("\n");
+          printf("\t\t Vegetation tile code: %d\n", tilecode);
+          printf("\t\t Vegetation tile rank: %d\n", tilerank);
+          for (i = 0; i < tilerank; i++)
+               printf("\t\t Vegetation tile dimension %d: %lu\n",i+1, (unsigned long)tiledims[i]);
+
+          status = HE5_GDcompinfo(GDid1,"Vegetation",&code,level);
+          printf("\t\t Compression scheme       Compression level\n");
+          printf("\t\t    %d,                      %d\n", code, level[0]);
+	  
+	}
+
+	
+  status = HE5_GDdetach(GDid1);
+  status = HE5_GDdetach(GDid2);
+  status = HE5_GDclose(gdfid);
+	
+  return 0;
+}
+
+
+
+
+
diff --git a/samples/he5_gd_infoF_32.f b/samples/he5_gd_infoF_32.f
new file mode 100755
index 0000000..6285303
--- /dev/null
+++ b/samples/he5_gd_infoF_32.f
@@ -0,0 +1,348 @@
+      program       he5_gd_infoF_32
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+	  integer       status
+	  integer       i
+      integer       he5_gdopen
+      integer       he5_gdattach
+      integer       he5_gdfldinfo
+      integer       he5_gdprojinfo
+      integer       he5_gdgridinfo
+      integer       he5_gdinqflds
+      integer       he5_gdtileinfo
+      integer       he5_gddetach
+      integer       he5_gdclose
+      integer       gdfid
+      integer       gdid1
+      integer       gdid2
+      integer       nflds  
+      integer       rk(32)
+      integer       nt(32)
+      integer       spherecode
+      integer       projcode
+      integer       zonecode
+
+      integer*4     he5_gddiminfo
+      integer*4     he5_gdinqdims
+      integer*4     he5_gdnentries
+      integer*4     he5_gdinqgrid
+      integer*4     ndim
+      integer*4     dims(32)
+      integer*4     xdimsize
+      integer*4     ydimsize
+      integer*4     dimsize 
+	  integer*4     n, strbufsize 
+    
+      real*8        upleftpt(2)
+      real*8        lowrightpt(2)
+      real*8        projparm(13)
+	  
+      character*256 dimname
+      character*256 mxdimname
+      character*256 fieldlist
+      character*256 gridlist
+
+      integer       tilecode
+      integer       tilerank
+      integer*4     tiledims(32)
+
+      integer       FAIL
+      parameter     (FAIL=-1)
+
+
+c     Open HDF-EOS "grid.he5" file
+c     ----------------------------	  
+      gdfid = he5_gdopen('grid.he5',HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_gdopen():  ',gdfid
+
+      if (gdfid .ne. FAIL) then
+		 
+c     Attach to the UTM and POLAR grids
+c     ---------------------------------
+      gdid1 = he5_gdattach(gdfid, 'UTMGrid')
+      write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid1
+
+      gdid2 = he5_gdattach(gdfid, 'PolarGrid')
+      write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid2
+
+c     Inquire dimensions
+c     ------------------		 
+      ndim = he5_gdinqdims(gdid1, dimname, dims)
+      write(*,*) 'Dimension list (UTMGrid): ', dimname
+      do i=1,ndim
+         write(*,*) 'dim size: ', dims(i)
+      enddo
+      
+      ndim = he5_gdinqdims(gdid2, dimname, dims)
+      write(*,*) 'Dimension list (PolarGrid): ', dimname
+      do i=1,ndim
+         write(*,*) 'dim size: ', dims(i)
+      enddo
+      
+c     Get the sizes of certain dimensions
+c     -----------------------------------         
+      dimsize = he5_gddiminfo(gdid1, 'Time')
+      write(*,*) 'Size of "Time" Array: ', dimsize
+		 
+      dimsize = he5_gddiminfo(gdid2, 'Bands')
+      write(*,*) 'Size of "Bands" Array: ', dimsize
+      
+c     Get grid parameters
+c     -------------------
+      status = he5_gdgridinfo(gdid1,xdimsize,ydimsize,
+     1     upleftpt,lowrightpt)
+      write(*,*)'X dim size, Y dim size (UTMGrid): ',
+     2     xdimsize,ydimsize
+      
+      write(*,*) 'Up left pt (UTMGrid): ',upleftpt(1),
+     1     upleftpt(2)
+      write(*,*) 'Low right pt (UTMGrid): ',lowrightpt(1),
+     2     lowrightpt(2)
+	   
+      status = he5_gdgridinfo(gdid2,xdimsize,ydimsize,
+     1     upleftpt,lowrightpt)
+      write(*,*) 'X dim size, Y dim size (PolarGrid): ',
+     2     xdimsize,ydimsize
+      
+      write(*,*) 'Up left pt (PolarGrid): ',upleftpt(1),
+     1        upleftpt(2)
+      write(*,*) 'Low right pt (PolarGrid): ',lowrightpt(1),
+     2     lowrightpt(2)
+      
+c     Get projection parameters
+c     -------------------------		 
+      status = he5_gdprojinfo(gdid1,projcode,zonecode,
+     1     spherecode,projparm)
+      write(*,*) 'projcode,zonecode (UTMGrid): ',projcode,
+     2     zonecode
+      write(*,*) 'spherecode (UTMGrid): ', spherecode	
+      
+      status = he5_gdprojinfo(gdid2,projcode,zonecode,
+     1     spherecode,projparm)
+      write(*,*) 'projcode (PolarGrid): ', projcode
+      write(*,*) 'spherecode (PolarGrid): ', spherecode
+      do i=1,13
+         write(*,*) 'Projection Parameter: ',i,projparm(i)
+      enddo
+      
+c     Get information about fields
+c     ----------------------------
+      nflds = he5_gdinqflds(gdid1, fieldlist, rk, nt)
+      if (nflds .ne. 0) then
+         write(*,*) 'Data fields (UTMGrid): ', fieldlist
+         do i=1,nflds
+            write(*,*) 'rank type: ',rk(i),nt(i)
+         enddo
+      endif
+
+      status = he5_gdtileinfo(gdid1,"Vegetation",tilecode,tilerank,
+     1         tiledims)
+              write(*,*) 'Vegetation Tile Code: ', tilecode
+              write(*,*) 'Vegetation Tile Rank: ', tilerank
+              do i=1,tilerank
+                         write(*,*) 'Tile Dimension ',i,tiledims(i)
+              enddo
+
+	         
+      nflds = he5_gdinqflds(gdid2, fieldlist, rk, nt)
+      if (nflds .ne. 0) then
+         write(*,*) 'Data fields (PolarGrid): ', fieldlist
+         do i=1,nflds
+            write(*,*) 'rank type: ',rk(i),nt(i)
+         enddo
+      endif	
+      
+      status = he5_gdfldinfo(gdid2,'Spectra',rk,dims,nt,
+     1     dimname,mxdimname)
+      write(*,*) 'Spectra rank dims: ',rk(1)
+      write(*,*) 'Spectra dim names: ',dimname
+      write(*,*) 'Spectra max. dim names: ',mxdimname
+      do i=1,rk(1)
+         write(*,*) 'Spectra dims: ',i,dims(i)
+      enddo
+      
+c     Get number of grid dimensions and dim. list length
+c     --------------------------------------------------
+      n = he5_gdnentries(gdid1, HE5_HDFE_NENTDIM, strbufsize)
+      write(*,*) 'Number of dimension entries (UTMGrid): ', n
+      write(*,*) 'Length of Dimension List (UTMGrid): ',strbufsize
+      
+c     Get number of data fields and field list length
+c     -----------------------------------------------
+      n = he5_gdnentries(gdid1, HE5_HDFE_NENTDFLD, strbufsize)
+      write(*,*) 'Number of data fields (UTMGrid): ', n
+      write(*,*) 'Length of Field List (UTMGrid): ',strbufsize
+      
+      endif
+	  
+c     Detach from the grids
+c     ---------------------
+      status = he5_gddetach(gdid1)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+      status = he5_gddetach(gdid2)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+      
+c     Close the file
+c     --------------
+      status = he5_gdclose(gdfid)
+      write(*,*) 'Status returned by he5_gdclose():  ',status
+	  
+      stop
+      end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_gd_infoF_64.f b/samples/he5_gd_infoF_64.f
new file mode 100755
index 0000000..f9f983b
--- /dev/null
+++ b/samples/he5_gd_infoF_64.f
@@ -0,0 +1,348 @@
+      program       he5_gd_infoF_64
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+	  integer       status
+	  integer       i,n
+      integer       he5_gdopen
+      integer       he5_gdattach
+      integer       he5_gdfldinfo
+      integer       he5_gdprojinfo
+      integer       he5_gdgridinfo
+      integer       he5_gdinqflds
+      integer       he5_gdtileinfo
+      integer       he5_gddetach
+      integer       he5_gdclose
+      integer       gdfid
+      integer       gdid1
+      integer       gdid2
+      integer       nflds  
+      integer       rk(32)
+      integer       nt(32)
+      integer       spherecode
+      integer       projcode
+      integer       zonecode
+
+      integer*8     he5_gddiminfo
+      integer*8     he5_gdinqdims
+      integer*8     he5_gdnentries
+      integer*8     ndim
+      integer*8     dims(32)
+      integer*8     xdimsize
+      integer*8     ydimsize
+      integer*8     dimsize 
+
+	  integer*8     strbufsize 
+    
+      real*8        upleftpt(2)
+      real*8        lowrightpt(2)
+      real*8        projparm(13)
+	  
+      character*72  dimname
+      character*72  mxdimname
+      character*72  fieldlist
+	  
+      integer       tilecode
+      integer       tilerank
+      integer*8     tiledims(32)
+
+      integer       FAIL
+      parameter     (FAIL=-1)
+
+c     Open HDF-EOS "grid.he5" file
+c     -----------------------------	  
+      gdfid = he5_gdopen('grid.he5',HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_gdopen():  ',gdfid
+
+      if (gdfid .ne. FAIL) then
+		 
+c     Attach to the UTM and POLAR grids
+c     ---------------------------------
+      gdid1 = he5_gdattach(gdfid, 'UTMGrid')
+      write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid1
+
+      gdid2 = he5_gdattach(gdfid, 'PolarGrid')
+      write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid2
+
+c     Inquire dimensions
+c     ------------------		 
+      ndim = he5_gdinqdims(gdid1, dimname, dims)
+      write(*,*) 'Dimension list (UTMGrid): ',dimname
+      do i=1,ndim
+         write(*,*) 'dim size: ', dims(i)
+      enddo
+		 
+      ndim = he5_gdinqdims(gdid2, dimname, dims)
+      write(*,*) 'Dimension list (PolarGrid): ',dimname
+      do i=1,ndim
+         write(*,*) 'dim size: ', dims(i)
+      enddo
+
+c     Get the sizes of certain dimensions
+c        -----------------------------------         
+      dimsize = he5_gddiminfo(gdid1, 'Time')
+      write(*,*) 'Size of "Time" Array: ', dimsize
+		 
+      dimsize = he5_gddiminfo(gdid2, 'Bands')
+      write(*,*) 'Size of "Bands" Array: ', dimsize
+	
+c     Get grid parameters
+c     -------------------
+      status = he5_gdgridinfo(gdid1,xdimsize,ydimsize,
+     1upleftpt,lowrightpt)
+      write(*,*)'X dim size, Y dim size (UTMGrid): ',
+     1xdimsize,ydimsize
+	   
+      write(*,*) 'Up left pt (UTMGrid): ',
+     1upleftpt(1),upleftpt(2)
+      write(*,*) 'Low right pt (UTMGrid): ',
+     1lowrightpt(1),lowrightpt(2)
+	   
+      status = he5_gdgridinfo(gdid2,xdimsize,ydimsize,
+     1upleftpt,lowrightpt)
+      write(*,*) 'X dim size, Y dim size (PolarGrid): ',
+     1xdimsize,ydimsize
+		 
+      write(*,*) 'Up left pt (PolarGrid): ',
+     1upleftpt(1),upleftpt(2)
+      write(*,*) 'Low right pt (PolarGrid): ',
+     1lowrightpt(1),lowrightpt(2)
+
+c     Get projection parameters
+c     -------------------------		 
+      status = he5_gdprojinfo(gdid1,projcode,zonecode,
+     1     spherecode,projparm)
+      write(*,*) 'projcode,zonecode (UTMGrid): ',
+     1     projcode,zonecode
+      write(*,*) 'spherecode (UTMGrid): ', spherecode	
+	   
+      status = he5_gdprojinfo(gdid2,projcode,zonecode,
+     1     spherecode,projparm)
+      write(*,*) 'projcode (PolarGrid): ', projcode
+      write(*,*) 'spherecode (PolarGrid): ', spherecode
+      do i=1,13
+         write(*,*) 'Projection Parameter: ',i,projparm(i)
+      enddo
+         
+c     Get information about fields
+c     ----------------------------
+      nflds = he5_gdinqflds(gdid1, fieldlist, rk, nt)
+      if (nflds .ne. 0) then
+         write(*,*) 'Data fields (UTMGrid): ', fieldlist
+         do i=1,nflds
+            write(*,*) 'rank type: ',rk(i),nt(i)
+         enddo
+      endif
+	         
+      status = he5_gdtileinfo(gdid1,"Vegetation",tilecode,tilerank,
+     1         tiledims)
+              write(*,*) 'Vegetation Tile Code: ', tilecode
+              write(*,*) 'Vegetation Tile Rank: ', tilerank
+              do i=1,tilerank
+                         write(*,*) 'Tile Dimension ',i,tiledims(i)
+              enddo
+
+      nflds = he5_gdinqflds(gdid2, fieldlist, rk, nt)
+      if (nflds .ne. 0) then
+         write(*,*) 'Data fields (PolarGrid): ',fieldlist
+         do i=1,nflds
+            write(*,*) 'rank type: ',rk(i),nt(i)
+         enddo
+      endif	
+      
+      status = he5_gdfldinfo(gdid2,'Spectra',rk,dims,nt,
+     1     dimname,mxdimname)
+      write(*,*) 'Spectra rank dims: ',rk(1)
+      write(*,*) 'Spectra dim names: ',dimname
+      write(*,*) 'Spectra max. dim names: ',mxdimname
+      do i=1,rk(1)
+         write(*,*) 'Spectra dims: ',i,dims(i)
+      enddo
+         
+c     Get number of grid dimensions and dim. list length
+c     --------------------------------------------------
+      n = he5_gdnentries(gdid1, HE5_HDFE_NENTDIM, strbufsize)
+      write(*,*) 'Number of dimension entries (UTMGrid): ', n
+      write(*,*) 'Length of Dimension List (UTMGrid): ', 
+     1     strbufsize
+	   
+c     Get number of data fields and field list length
+c     -----------------------------------------------
+      n = he5_gdnentries(gdid1, HE5_HDFE_NENTDFLD, 
+     1     strbufsize)
+      write(*,*) 'Number of data fields (UTMGrid): ', n
+      write(*,*) 'Length of Field List (UTMGrid): ', 
+     1     strbufsize
+        
+      endif
+	  
+c     Detach from the grids
+c     ---------------------
+      status = he5_gddetach(gdid1)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+      status = he5_gddetach(gdid2)
+      write(*,*) 'Status returned by he5_gddetach():  ',status     
+
+c     Close the file
+c     --------------
+      status = he5_gdclose(gdfid)
+      write(*,*) 'Status returned by he5_gdclose():  ',status  
+
+      stop
+      end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_gd_rdexternaldata.c b/samples/he5_gd_rdexternaldata.c
new file mode 100755
index 0000000..8df8e84
--- /dev/null
+++ b/samples/he5_gd_rdexternaldata.c
@@ -0,0 +1,147 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+
+#include    <HE5_HdfEosDef.h>
+
+#define  DIMIN    100
+#define  DIMOUT   60
+
+/*
+ * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to
+ * the "UTMGrid", (3) read external data
+ */
+
+
+int main()
+{
+  FILE            *in_1, *in_2, *in_3;
+
+  herr_t          status = FAIL;
+
+  int             i;
+  int             data_in_1[DIMIN];
+  int             data_in_2[DIMIN];
+  int             data_in_3[DIMIN];
+  int             data_out[DIMOUT];
+  int             nfiles = FAIL;
+
+  hid_t           gdfid  = FAIL;
+  hid_t           GDid   = FAIL;
+
+  size_t          namelength = 48;
+ 
+  off_t           offset[3];
+
+  char            filelist[256];
+
+  hssize_t        start[2];
+
+  hsize_t         count[2];
+  hsize_t         size[3];
+
+
+
+  /* Create the external data sets */
+  /* ----------------------------- */
+  for (i = 0; i < DIMIN; i++)
+	{
+	  data_in_1[i] = 1000 + i + 1;
+	  data_in_2[i] = 2000 + i + 1;
+	  data_in_3[i] = 3000 + i + 1;
+	}
+
+  /* Open the external data files */
+  /* ---------------------------- */
+  in_1 = fopen("external_1g.data", "w");
+  in_2 = fopen("external_2g.data", "w");
+  in_3 = fopen("external_3g.data", "w");
+
+
+  /* Write data buffers to the external data files */
+  /* --------------------------------------------- */
+  fwrite(data_in_1, sizeof(int), DIMIN, in_1);
+  fwrite(data_in_2, sizeof(int), DIMIN, in_2);
+  fwrite(data_in_3, sizeof(int), DIMIN, in_3);
+
+  /* Close the external data files */
+  /* ----------------------------- */
+  fclose(in_1);
+  fclose(in_2);
+  fclose(in_3);
+  
+
+  /*
+   * Open the HDF grid file, "Grid.h5".
+   */
+  gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR);
+  if (gdfid != FAIL)
+    {
+	  /*
+	   * Attach the "UTMGrid".
+	   */
+	  GDid = HE5_GDattach(gdfid, "UTMGrid");
+	  if (GDid != FAIL)
+		{
+		  /* Read the external data field */
+		  /* ---------------------------- */
+		  start[0] = 0;
+		  count[0] = DIMOUT;
+		  status = HE5_GDreadfield(GDid, "ExtData", start, NULL, count, data_out);
+		  printf("Status returned by HE5_GDreadfield() :    %d \n", status);
+	    
+		  /* Display external data set */
+		  /* ------------------------- */
+		  printf(" \n");
+		  for (i = 0; i < DIMOUT; i++)
+			printf("%d ", data_out[i]);
+		  
+		  /* Get the number of external files */
+		  /* -------------------------------- */
+		  nfiles = HE5_GDgetextdata(GDid, "ExtData", namelength, filelist, offset, size);
+		  printf(" \n");
+		  printf(" \n");
+		  printf("Number of external files returned by HE5_GDgetextdata() :     %d \n", nfiles);
+		  if (nfiles > 0)
+			{
+			  printf(" \n");
+			  printf("External files: \"%s\"  \n", filelist);
+			  printf(" \n");
+			  printf("offsets:  ");
+			  for (i = 0; i < nfiles; i++)
+				printf("%d ", (int)offset[i]);
+
+			  printf(" \n");
+			  printf("sizes:    ");
+			  for (i = 0; i < nfiles; i++)
+				printf("%lu ", (unsigned long)size[i]);
+			  printf(" \n");
+			  printf(" \n");
+			}
+		}
+	}
+  
+  /* Detach from the Grid */
+  /* -------------------- */
+  status = HE5_GDdetach(GDid);
+  printf("Status returned by HE5_GDdetach() :       %d \n", status);
+  
+  /* Close the file */
+  /* -------------- */
+  status = HE5_GDclose(gdfid);
+  printf("Status returned by HE5_GDclose() :        %d \n", status);
+
+  return 0;
+}
+
+
+
+
+
+
+
+
diff --git a/samples/he5_gd_readdata.c b/samples/he5_gd_readdata.c
new file mode 100755
index 0000000..000ae4d
--- /dev/null
+++ b/samples/he5_gd_readdata.c
@@ -0,0 +1,80 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+
+#include      <HE5_HdfEosDef.h>
+
+
+/*
+ * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to
+ * the "UTMGrid", (3) read data from the "Vegetation" field. and (4) read 
+ * global, group, and  local attributes.
+ */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  int             i, j;
+  int             grpattr[3] = {-9,-9,-9};         /* group attribute  */
+
+  hid_t           gdfid = FAIL;
+  hid_t           GDid  = FAIL;
+
+  float           flt     = -999.;	               /* global attribute */
+  float           attr[4] = {-9.9,-9.9,-9.9,-9.9}; /* local attribute  */
+  float           veg[200][120];
+      
+  hssize_t        start[2] ={0, 0};
+    
+  hsize_t         edge[2] = {200, 100};
+
+  /*
+   * Open the HDF grid file, "Grid.h5".
+   */
+  gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR);
+  if (gdfid != FAIL)
+    {
+	  /*
+	   * Attach the "UTMGrid".
+	   */
+	  GDid = HE5_GDattach(gdfid, "UTMGrid");
+	  if (GDid != FAIL)
+		{
+		  status = HE5_GDreadfield(GDid, "Vegetation", start, NULL, edge, veg);
+		  printf("Status returned by HE5_GDreadfield() :    %d \n", status );
+		  for (i = 0; i < 5; i++)
+			for (j = 0; j < 10; j++)
+			  printf("\t\t %f \n", veg[i][j]);
+	  
+		  status = HE5_GDreadattr(GDid, "GlobalAttribute", &flt);
+		  printf("Status returned by HE5_GDreadattr() :     %d \n", status );
+		  printf("\tGlobal attribute reads: \n");
+		  printf("\t\t %f \n", flt);
+
+		  status = HE5_GDreadgrpattr(GDid, "GroupAttribute", grpattr);
+		  printf("Status returned by HE5_GDreadgrpattr() :  %d \n", status );
+		  printf("\tGroup attribute reads: \n");
+		  for (i = 0; i < 3; i++)
+			printf("\t\t %d \n", grpattr[i]);
+
+		  status = HE5_GDreadlocattr(GDid, "Vegetation","LocalAttribute", attr);
+		  printf("Status returned by HE5_GDreadlocattr() :  %d \n", status );
+		  printf("\tLocal attribute reads: \n");
+		  for (i = 0; i < 4; i++)
+			printf("\t\t %f \n", attr[i]);
+		  
+		}
+    }
+
+  status = HE5_GDdetach(GDid);
+  status = HE5_GDclose(gdfid);
+
+  return 0;
+}
+
diff --git a/samples/he5_gd_readdataF_32.f b/samples/he5_gd_readdataF_32.f
new file mode 100755
index 0000000..6b16285
--- /dev/null
+++ b/samples/he5_gd_readdataF_32.f
@@ -0,0 +1,77 @@
+      program       he5_gd_readdataF_32
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+	  integer       status
+	  integer       gdfid 
+      integer       gdid
+	  integer       he5_gdopen
+      integer       he5_gdattach
+      integer       he5_gdrdfld
+      integer       he5_gdrdattr
+      integer       he5_gddetach 
+	  integer       he5_gdclose
+
+	  integer*4     start(2)
+      integer*4     stride(2)
+      integer*4     count(2)
+
+	  real*4        f
+      real*4        veg(120,200)
+
+      integer       FAIL
+      parameter     (FAIL=-1)
+
+c     Open HDF-EOS "grid.he5" file
+c     -----------------------------
+	  gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_gdopen():  ',gdid
+	  
+	  if (gdfid .ne. FAIL) then 
+		 
+c        Attach to the UTM grid 
+c        ----------------------
+		 gdid = he5_gdattach(gdfid, "UTMGrid")
+         write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid
+		 
+		 if (gdid .ne. FAIL) then			
+			start(1)  = 0
+			start(2)  = 0
+			stride(1) = 1
+			stride(2) = 1
+			count(1)  = 120
+			count(2)  = 200
+
+c           Read the data from "Vegetation" field
+c           -------------------------------------
+			status = he5_gdrdfld(gdid,"Vegetation",
+     1           start,stride,count,veg)
+            write(*,*) 'Status returned by he5_gdrdfld():  ',status
+
+
+c           Read global attribute "float"
+c           -----------------------------	      
+			status = he5_gdrdattr(gdid, "float", f)
+            write(*,*) 'Status returned by he5_gdrdattr():  ',status
+			write(*,*) 'global attribute value: ', f
+		 endif
+	  endif
+
+c     Detach from the grid
+c     --------------------	  
+	  status = he5_gddetach(gdid)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+c     Close the file
+c     --------------
+	  status = he5_gdclose(gdfid)
+      write(*,*) 'Status returned by he5_gdclose():  ',status
+	  
+	  stop
+	  end
+
+
+
+
diff --git a/samples/he5_gd_readdataF_64.f b/samples/he5_gd_readdataF_64.f
new file mode 100755
index 0000000..c6392f6
--- /dev/null
+++ b/samples/he5_gd_readdataF_64.f
@@ -0,0 +1,76 @@
+      program       he5_gd_readdataF_64
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+	  integer       status
+	  integer       gdfid 
+      integer       gdid
+	  integer       he5_gdopen
+      integer       he5_gdattach
+      integer       he5_gdrdfld
+      integer       he5_gdrdattr
+      integer       he5_gddetach 
+	  integer       he5_gdclose
+
+	  integer*8     start(2)
+      integer*8     stride(2)
+      integer*8     count(2)
+
+	  real*4        f
+      real*4        veg(120,200)
+
+      integer       FAIL
+      parameter     (FAIL=-1)
+
+c     Open HDF-EOS "grid.he5" file
+c     -----------------------------
+	  gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_gdopen():  ',gdid
+  
+	  if (gdfid .ne. FAIL) then 
+		 
+c        Attach to the UTM grid 
+c        ----------------------
+		 gdid = he5_gdattach(gdfid, "UTMGrid")
+         write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid
+		 
+		 if (gdid .ne. FAIL) then			
+			start(1)  = 0
+			start(2)  = 0
+			stride(1) = 1
+			stride(2) = 1
+			count(1)  = 120
+			count(2)  = 200
+
+c           Read the data from "Vegetation" field
+c           -------------------------------------
+			status = he5_gdrdfld(gdid,"Vegetation",
+     1           start,stride,count,veg)
+            write(*,*) 'Status returned by he5_gdrdfld():  ',status
+
+c           Read global attribute "float"
+c           -----------------------------	      
+			status = he5_gdrdattr(gdid, "float", f)
+            write(*,*) 'Status returned by he5_gdrdattr():  ',status
+			write(*,*) 'global attribute value: ', f
+		 endif
+	  endif
+
+c     Detach from the grid
+c     --------------------	  
+	  status = he5_gddetach(gdid)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+c     Close the file
+c     --------------
+	  status = he5_gdclose(gdfid)
+      write(*,*) 'Status returned by he5_gdclose():  ',status
+	  
+	  stop
+	  end
+
+
+
+
diff --git a/samples/he5_gd_readdimscale.c b/samples/he5_gd_readdimscale.c
new file mode 100644
index 0000000..b75e3de
--- /dev/null
+++ b/samples/he5_gd_readdimscale.c
@@ -0,0 +1,189 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Raytheon Systems Company                         |
+ ----------------------------------------------------------------------------
+ */
+
+#include     <HE5_HdfEosDef.h>
+
+/*
+ * In this example we will open an HDF-EOS file and attach to UTM and Polar
+ * Stereographic grid structures within the file to read a dimension scales
+ * and its attributes
+ */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+  hid_t           gdfid = FAIL;
+  hid_t           GDid1 = FAIL;
+  int             i,j;
+  int             bufsize;
+  double         *databuff;
+  long            nattr;
+  long            strbufsize;
+  char           *attrlist;
+  size_t          fldnmlen[HE5_HDFE_NAMBUFSIZE];
+  char           *fldnm[HE5_HDFE_NAMBUFSIZE];
+  char           *attrname = (char *)NULL;
+  hid_t          *ntype;
+  hsize_t        count = 0;
+  void           *attr;
+  int            *attr_int;
+  float          *attr_flt;
+  char           *attr_char;
+  hsize_t         dimsize;
+  hid_t           numtype;
+
+  /*
+   * Open the HDF grid file, "Grid.h5".
+   */
+
+  gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR);
+ 
+  /*
+   * If the grid file cannot be found, HE5_GDopen will return -1 for the file
+   * handle (gdfid).  We there check that this is not the case before
+   * proceeding with the other routines.
+   * 
+   * The HE5_GDattach routine returns the handle to the existing grid "Grid1",
+   * GDid.  If the grid is not found, HE5_GDattach returns -1 for the handle.
+   */ 
+
+  if (gdfid != FAIL)
+    {	  
+      GDid1 = HE5_GDattach(gdfid, "UTMGrid");
+
+      /* the field Pollution has Time,YDim,XDim dimensions. 
+	 xdim = 120;
+	 ydim = 200;
+	 Time dim is set to 10
+      */
+
+      if (GDid1 == FAIL)
+	{
+	  printf("\t\tError: Cannot attach to grid \"UTMGrid\"\n");
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+
+      bufsize = HE5_GDgetdimscale(GDid1, "Pollution", "XDim", &dimsize, &numtype, NULL);
+      if (bufsize == -1)
+	{
+	  printf("\t\tError: Cannot get Dimension Scale size for XDim dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      else
+	{
+	  printf ("bufsize = %d \n",(int)bufsize);
+	  printf ("dimsize = %d \n",(int)dimsize);
+	  printf ("numtype = %d\n", (int)numtype);
+	}
+      databuff = (double *) malloc(bufsize);
+      bufsize = HE5_GDgetdimscale(GDid1, "Pollution", "XDim", &dimsize, &numtype, (void *)databuff);
+
+      if (bufsize == -1)
+	{
+	  printf("\t\tError: Cannot get Dimension Scale for XDim dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  free(databuff);
+	  return -1;
+	}
+      else
+	{
+	  printf ("First 10 values are:\n");
+	  for( i = 0; i < 10; i++)
+	    {
+	      printf ("DimscaleValue[%d] = %lf\n",i,databuff[i]);
+	    }
+	}
+
+      nattr = HE5_GDinqdscaleattrs(GDid1, "XDim", NULL, &strbufsize);
+      if ( nattr < 0 )
+	{
+	  printf("\t\tError: Cannot get Dimension Scale attribute list for \"XDim\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  free(attrlist);
+	  return -1;
+	}
+
+      attrlist = (char *) calloc(strbufsize + 2, sizeof(char));
+      nattr = HE5_GDinqdscaleattrs(GDid1, "XDim", attrlist, &strbufsize);
+      if ( nattr < 0 )
+	{
+	  printf("\t\tError: Cannot get Dimension Scale attribute list for \"XDim\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  free(attrlist);
+	  return -1;
+	}
+	  printf(" \n");
+	  printf("Dimension scale for \"XDim\" Attribute: \n");
+      nattr = HE5_EHparsestr(attrlist, ',', fldnm, fldnmlen);
+      if(nattr != FAIL)
+	{
+	  for( i = 0; i < nattr; i++)
+	    {
+	      attrname = (char *)calloc(fldnmlen[i] + 1, sizeof(char));
+	      memmove(attrname,fldnm[i],fldnmlen[i]);
+	      ntype = (hid_t *)calloc(1, sizeof(hid_t));
+	      if(strcmp(attrname, "REFERENCE_LIST") ==0 ) continue;
+	      status = HE5_GDdscaleattrinfo(GDid1,"XDim", attrname, ntype, &count);
+	      if( (int)*ntype == 0) {
+		attr_int = (int *)malloc(count*sizeof(int));
+		attr = (void *) attr_int;
+	      }
+
+	      if( (int)*ntype == 10) {
+		attr_flt = (float *)malloc(count*sizeof(float));
+		attr = (void *) attr_flt;
+	      }
+
+	      if( (int)*ntype == 57) {
+		attr_char = (char *)malloc((count+1)*sizeof(char));
+		attr = (void *) attr_char;
+	      }
+	      status = HE5_GDreaddscaleattr(GDid1,"XDim", attrname, attr);
+	      printf("\n");
+	      printf("Status returned by HE5_GDreaddscaleattr() :  %d \n", status );
+	      printf("\tAttribute Name:               %s  \n",attrname);
+	      printf("\tNumber of attribute elements: %lu \n", (unsigned long)count);
+	      printf("\tData type of attribute:       %d \n", (int)*ntype);
+
+	      if( (int)*ntype == 0) {
+		attr_int = (int *)attr;
+		for (j = 0; j < count; j++)
+		  {
+		    printf("\tAttrvalue[%d]:                 %d \n", j,attr_int[j]);
+		  }
+	      }
+
+	      if( (int)*ntype == 10) {
+		attr_flt = (float *)attr;
+		for (j = 0; j < count; j++)
+		  {
+		    printf("\tAttrvalue[%d]:                 %f \n", j,attr_flt[j]);
+		  }
+	      }
+
+	      if( (int)*ntype == 57) {
+		attr_char = (char *)attr;
+		attr_char[count]='\0';
+		printf("\tAttrvalue:                    %s \n", attr_char);
+		free(attr_char);
+	      }
+	    }
+	}
+      
+      HE5_GDdetach(GDid1);
+      
+      HE5_GDclose(gdfid);
+      
+      return 0;
+    }
+}
diff --git a/samples/he5_gd_readdimscaleF_32.f b/samples/he5_gd_readdimscaleF_32.f
new file mode 100644
index 0000000..6398fce
--- /dev/null
+++ b/samples/he5_gd_readdimscaleF_32.f
@@ -0,0 +1,185 @@
+      program     he5_gd_readdimscaleF_32
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     i, j, jj
+      integer     he5_gdopen
+      integer     he5_gdattach
+      integer     he5_gdwrfld
+      integer     he5_gdwrattr
+      integer     he5_gdwrgattr
+      integer     he5_ehwrglatt
+      integer     he5_gdwrlattr 
+      integer     he5_gddetach
+      integer     he5_gdclose
+      integer     HE5_GDdscaleattrinfo, HE5_GDreaddscaleattr
+      integer     HE5_GDgetdimscale, HE5_GDinqdscaleattrs
+      integer     ntype
+      integer     gdfid,gdid1
+      real*4      datbuf_f(1) 
+      integer*4   start(2), stride(2), count(2)
+      integer*4   datbuf_i(3)
+      real*8      veg1(120),veg2(200), temp1(100),temp2(100)
+      real*4      geospecf(4)
+      character*10    attr4
+      character*100   attr5
+      integer*4   nbands
+      integer     bands(3)
+      integer*4   datbuf_i2(2) 
+      
+      integer         attr_int(25)
+      real*4          attr_flt(25)
+      real*8          attr_dbl(25)
+      character       attr_char(25)
+      integer         dimsize
+      integer         bufsize, nattr 
+      integer     FAIL
+      parameter   (FAIL=-1)
+      character*100     attrlist
+      character*100     strbufsize
+      character*15      attrname(10)
+      integer         numtype
+
+!  /*
+!   * Open the HDF grid file, "Grid.h5".
+!   */
+
+      gdfid = HE5_GDopen("grid.he5", HE5F_ACC_RDWR)
+ 
+!  /*
+!   * If the grid file cannot be found, HE5_GDopen will return -1 for the file
+!   * handle (gdfid).  We there check that this is not the case before
+!   * proceeding with the other routines.
+!   * 
+!   * The HE5_GDattach routine returns the handle to the existing grid "Grid1",
+!   * GDid.  If the grid is not found, HE5_GDattach returns -1 for the handle.
+!   */ 
+
+      if (gdfid .ne. FAIL) then
+     
+         GDid1 = HE5_GDattach(gdfid, "UTMGrid")
+
+!      /* the field Pollution has Time,YDim,XDim dimensions. 
+!	 xdim = 120
+!	 ydim = 200
+!	 Time dim is set to 10
+!      */
+
+         if (GDid1 .eq. FAIL) then
+            
+            write(*,*) 'Error: Cannot attach to grid UTMGrid'
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+
+         bufsize = HE5_GDgetdimscale(GDid1, "Pollution", "XDim", 
+     1        dimsize, numtype, veg1)
+         if (bufsize .eq. -1) then
+	
+            write(*,*) 'Error:Cannot get Dimension Scale size for XDim',
+     1           ' dimemnsion in field Pollution'
+            status = HE5_GDdetach(GDid1)
+            status = HE5_GDclose(gdfid)
+            stop
+            
+         else
+            
+            write(*,*) 'bufsize = ',bufsize
+            write(*,*) 'dimsize = ',dimsize
+            write(*,*) 'numtype = ',numtype
+            
+            write(*,*) 'First 10 values are:'
+            do i = 1,10
+               write(*,*) 'DimscaleValue[',i,'] = ',veg1(i)
+            enddo
+         endif
+         
+         nattr = HE5_GDinqdscaleattrs(GDid1, "XDim", attrlist, 
+     1        strbufsize)
+         if ( nattr .lt. 0 ) then
+            
+            write(*,*) 'Error: Cannot get Dimension Scale attribute',
+     1           ' list for XDim'
+            status = HE5_GDdetach(GDid1)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         write(*,*) ' '
+         write(*,*) 'Dimension scale for XDim Attribute:'
+
+         attrname(1) = 'label'
+         attrname(2) = 'unit'
+         attrname(3) = 'format'
+         attrname(4) = 'MissingValue'
+         attrname(5) = 'IntValues'
+         do j = 1,5
+            attr_char = ''
+            count(1)= 0
+            count(2)= 0
+
+            status = HE5_GDdscaleattrinfo(GDid1,"XDim", attrname(j), 
+     1        ntype, count)
+                              
+            if( ntype .eq. 0) then
+               status = HE5_GDreaddscaleattr(GDid1,"XDim", attrname(j), 
+     1              attr_int)
+            endif
+
+            if( ntype .eq. 10) then
+               status = HE5_GDreaddscaleattr(GDid1,"XDim", attrname(j), 
+     1              attr_flt)
+            endif
+            
+            if( ntype .eq. 11) then
+               status = HE5_GDreaddscaleattr(GDid1,"XDim", attrname(j), 
+     1              attr_dbl)
+            endif
+            
+            if( ntype .eq. 57) then
+               status = HE5_GDreaddscaleattr(GDid1,"XDim", attrname(j), 
+     1              attr_char)
+            endif
+
+            write(*,*) ' '
+            write(*,*) 'Status returned by HE5_GDreaddscaleattr() :', 
+     1           status
+            write(*,*) 'Attribute Name: ',attrname(j)
+            write(*,*) 'Number of attribute elements: ', count(1), 
+     1           '  ', count(2)
+
+            write(*,*) 'Data type of attribute: ', ntype
+            
+            if( ntype .eq. 0) then
+               do jj = 1,count(1)
+                  write(*,*) 'Attrvalue[',jj,']: ', attr_int(jj)
+               enddo
+            endif
+            
+            if( ntype .eq. 10) then
+               do jj = 1,count(1)
+                  write(*,*) 'Attrvalue[',jj,']: ',attr_flt(jj)
+               enddo
+            endif
+
+            if( ntype .eq. 11) then
+               do jj = 1,count(1)
+                  write(*,*) 'Attrvalue[',jj,']: ',attr_dbl(jj)
+               enddo
+            endif
+
+            if( ntype .eq. 57) then
+               write(*,*) 'Attrvalue: ', attr_char
+            endif
+         enddo
+      endif
+
+      status = HE5_GDdetach(GDid1)
+      
+      status = HE5_GDclose(gdfid)
+      
+      stop
+      end
+
diff --git a/samples/he5_gd_setup.c b/samples/he5_gd_setup.c
new file mode 100755
index 0000000..1e992e9
--- /dev/null
+++ b/samples/he5_gd_setup.c
@@ -0,0 +1,169 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+#include     <HE5_HdfEosDef.h>
+
+/*
+ * In this example we will open an HDF-EOS file and create UTM and Polar
+ * Stereographic grid structures within the file.
+ */
+
+
+int main()
+{
+
+  herr_t    status = FAIL;
+
+  hid_t     gdfid  = FAIL;
+  hid_t     GDid   = FAIL;
+  hid_t     GDid2  = FAIL;
+  hid_t     GDid3  = FAIL;
+
+  int       i, j;
+  int       zonecode, projcode, spherecode, dummy = 0;
+
+  long      xdim, ydim;
+
+  double    projparm[16], uplft[2], lowrgt[2];
+    
+  /*
+   * We first open the HDF grid file, "Grid.h5".  Because this file
+   * does not already exist, we use the H5F_ACC_TRUNC access code in the
+   * open statement.  The GDopen routine returns the grid file id, gdfid,
+   * which is used to identify the file in subsequent routines in the
+   * library.
+   */
+  gdfid = HE5_GDopen("Grid.h5", H5F_ACC_TRUNC);
+
+  /*
+   * Create UTM Grid
+   * 
+   * Region is bounded by 54 E and 60 E longitude and 20 N and 30 N latitude.
+   * UTM Zone 40
+   * 
+   * Use default spheriod (Clarke 1866 - spherecode = 0)
+   * 
+   * Grid into 120 bins along x-axis and 200 bins along y-axis
+   *                   (approx 3' by 3' bins)
+   */
+
+  zonecode   = 40;
+  spherecode = 0;
+
+  /* Upper Left and Lower Right points in meters */
+  /* ------------------------------------------- */
+  uplft[0]   =   210584.50041;
+  uplft[1]   =  3322395.95445;
+  lowrgt[0]  =  813931.10959;
+  lowrgt[1]  = 2214162.53278;
+
+  xdim = 120;
+  ydim = 200;
+    
+  GDid   = HE5_GDcreate(gdfid, "UTMGrid", xdim, ydim, uplft, lowrgt);
+  printf("Grid ID returned by HE5_GDcreate :                    %d \n", GDid);
+
+  status = HE5_GDdefproj(GDid, HE5_GCTP_UTM, zonecode, spherecode, projparm);
+  printf("status returned by HE5_GDdefproj(...\"HE5_GCTP_UTM\"...) :  %d \n", status);
+
+  /* Define "Time" Dimension */
+  status = HE5_GDdefdim(GDid, "Time", 10);
+  printf("status returned by HE5_GDdefdim(...\"Time\"...) :       %d \n", status);
+
+  /* Define "External" Dimension */
+  /* --------------------------- */
+  status = HE5_GDdefdim(GDid, "ExtDim", 60);
+  printf("status returned by HE5_GDdefdim(...\"ExtDim\"...):      %d \n", status);
+
+  /* Define "Unlim" Dimension */
+  status = HE5_GDdefdim(GDid, "Unlim", H5S_UNLIMITED);
+  printf("status returned by HE5_GDdefdim(...\"Unlim\"...) :      %d \n", status);
+
+  /*
+   * Create polar stereographic grid
+   * 
+   * Northern Hemisphere  (True Scale at 90 N, 0 Longitude below pole)
+   * 
+   * Use International 1967 spheriod (spherecode = 3)
+   * 
+   * Grid into 100 bins along x-axis and y-axis
+   */
+
+  spherecode = 3;
+
+  /* Define GCTP Projection Parameters */
+  /* --------------------------------- */
+  for (i = 0; i < 16; i++)
+	projparm[i] = 0;
+
+  /* Set Longitude below pole & true scale in DDDMMMSSS.SSS format) */
+  projparm[4] = 0.0;
+  projparm[5] = 90000000.00;
+    
+
+  xdim = 100;
+  ydim = 100;
+
+  GDid2  = HE5_GDcreate(gdfid, "PolarGrid", xdim, ydim, NULL, NULL);
+  printf("Grid ID returned by HE5_GDcreate() :                  %d \n", GDid2);
+
+  status = HE5_GDdefproj(GDid2, HE5_GCTP_PS, dummy, spherecode, projparm);
+  printf("status returned by HE5_GDdefproj(...\"HE5_GCTP_PS\"...) :   %d \n", status);
+
+  status = HE5_GDdeforigin(GDid2, HE5_HDFE_GD_LR);
+  printf("status returned by HE5_GDdeforigin() :                %d \n", status);
+
+    
+  /* Define "Bands" Dimension */
+  status = HE5_GDdefdim(GDid2, "Bands", 3);
+  printf("status returned by HE5_GDdefdim(...\"Bands\"...) :      %d \n", status);
+
+  /*
+   * Create geographic (linear scale) grid
+   * 
+   * 0 - 15 degrees longitude,  20 - 30 degrees latitude
+   *
+   */
+    
+  xdim = 60;
+  ydim = 40;
+
+  uplft[0]  = HE5_EHconvAng(0.,  HE5_HDFE_DEG_DMS);
+  uplft[1]  = HE5_EHconvAng(30., HE5_HDFE_DEG_DMS);
+  lowrgt[0] = HE5_EHconvAng(15., HE5_HDFE_DEG_DMS);
+  lowrgt[1] = HE5_EHconvAng(20., HE5_HDFE_DEG_DMS);
+    
+  GDid3  = HE5_GDcreate(gdfid, "GEOGrid", xdim, ydim, uplft, lowrgt);
+  printf("Grid ID returned by HE5_GDcreate() :                  %d \n", GDid3);
+
+  status = HE5_GDdefproj(GDid3, HE5_GCTP_GEO, dummy, dummy, NULL);
+  printf("status returned by HE5_GDdefproj(...\"HE5_GCTP_GEO\"...) :  %d \n", status);
+
+  /*
+   * We now close the grid interface with the GDdetach routine.  This step
+   * is necessary to properly store the grid information within the file
+   * AND SHOULD BE DONE BEFORE WRITING OR READING DATA TO OR FROM THE FIELD.
+   */    
+  status = HE5_GDdetach(GDid);
+  status = HE5_GDdetach(GDid2);
+  status = HE5_GDdetach(GDid3);
+
+  /*
+   * Finally, we close the grid file using the HE5_GDclose routine.  This will
+   * release the grid file handles established by HE5_GDopen.
+   */
+  status = HE5_GDclose(gdfid);
+
+  return 0;
+}
+
+
+
+
+
+
+
+
diff --git a/samples/he5_gd_setupF_32.f b/samples/he5_gd_setupF_32.f
new file mode 100755
index 0000000..869af79
--- /dev/null
+++ b/samples/he5_gd_setupF_32.f
@@ -0,0 +1,173 @@
+c     In this code we open an HDF-EOS file and create UTM, 
+c     Polar Stereographic, and Geographic grids in the file
+c     =====================================================
+
+      program     he5_gd_setupF_32
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status, gdfid, i 
+      integer     he5_gdcreate, he5_gdopen 
+      integer     he5_gddefdim, he5_gddefproj
+      integer     he5_gddeforigin
+      integer     he5_gddetach, he5_gdclose
+      integer     gdid, gdid2, gdid3
+      integer     zonecode, spherecode
+
+      integer*4   xdim, ydim, dim
+
+      real*8      uplft(2), lowrgt(2)
+      real*8      projparm(16), he5_ehconvang
+
+c     Open the HDF-EOS grid file, "grid.he5"
+c     --------------------------------------
+      gdfid = he5_gdopen('grid.he5',HE5F_ACC_TRUNC)
+      write(*,*) 'File ID returned by he5_gdopen():  ',gdfid
+    
+c     Create UTM Grid     
+c     ---------------
+
+c --------------------------------------------------- c
+c  Region is bounded by 54 E and 60 E longitudes and  c
+c  20 N and 30 N latitudes. UTM Zone: 40.             c
+c  Use default spheriod (Clarke 1866: spherecode = 0) c
+c                                                     c
+c  Grid into 120 bins along x-axis and 200 bins       c
+c  along y-axis  (approx 3' by 3' bins).              c
+c --------------------------------------------------- c
+
+      zonecode   = 40
+      spherecode = 0
+
+c    Upper Left and Lower Right points in meters
+c    -------------------------------------------
+      uplft(1)  =   210584.50041
+      uplft(2)  =  3322395.95445
+      lowrgt(1) =  813931.10959
+      lowrgt(2) = 2214162.53278
+
+      xdim = 120
+      ydim = 200
+
+c     Define GCTP Projection Parameters
+c     ---------------------------------
+      do i=1,16
+         projparm(i) = 0.d0
+      enddo
+    
+      gdid   = he5_gdcreate(gdfid, "UTMGrid", 
+     1     xdim, ydim, uplft, lowrgt)
+      write(*,*) 'Grid ID returned by he5_gdcreate():  ',gdid
+
+      status = he5_gddefproj(gdid,HE5_GCTP_UTM,
+     1     zonecode,spherecode,projparm)
+      write(*,*) 'Status returned by he5_gddefproj():  ',status
+         
+c     Define "Time" Dimension
+c     -----------------------
+      dim    = 10
+      status = he5_gddefdim(gdid, "Time", dim)
+      write(*,*) 'Status returned by he5_gddefdim():  ',status
+     
+c     Create polar stereographic grid 
+c     -------------------------------
+    
+c --------------------------------------------------- c
+c   Northern Hemisphere (True Scale at 90 N, 0        c
+c   Longitude below pole).                            c
+c   Use International 1967 spheriod (spherecode = 3)  c
+c   Grid into 100 bins along x-axis and y-axis.       c
+c --------------------------------------------------- c
+      
+      xdim = 100
+      ydim = 100
+      
+      spherecode = 3
+      
+c     Set Longitude below pole & true scale in DDDMMMSSS.SSS format)
+c     --------------------------------------------------------------
+      projparm(5) = 0.0
+      projparm(6) = 90000000.00
+
+c     Use default boundaries for Polar Stereographic (hemisphere)
+c     -----------------------------------------------------------
+      uplft(1)    =  0
+      uplft(2)    =  0
+      lowrgt(1)   =  0
+      lowrgt(2)   =  0
+
+      zonecode   = 0
+      
+      gdid2  = he5_gdcreate(gdfid,"PolarGrid",
+     1     xdim,ydim,uplft,lowrgt)
+      write(*,*) 'Grid ID returned by he5_gdcreate():  ',gdid2
+
+      status = he5_gddefproj(gdid2,HE5_GCTP_PS,zonecode,
+     1     spherecode,projparm)
+      write(*,*) 'Status returned by he5_gddefproj():  ',status
+
+      status = he5_gddeforigin(gdid2, HE5_HDFE_GD_LR)
+      write(*,*) 'Status returned by he5_gddeforigin():  ',status
+            
+c     Define "Bands" Dimension
+c     ------------------------
+      dim    = 3
+      status = he5_gddefdim(gdid2, "Bands", dim)
+      write(*,*) 'Status returned by he5_gddefdim():  ',status
+            
+c     Create geographic (linear scale) grid
+c     -------------------------------------
+
+c --------------------------------------------------- c 
+c   0-15 degrees longitude, 20-30 degrees latitude    c
+c --------------------------------------------------- c
+
+      xdim = 60
+      ydim = 40
+
+      uplft(1)  = he5_ehconvAng(0.d0,  HE5_HDFE_DEG_DMS)
+      uplft(2)  = he5_ehconvAng(30.d0, HE5_HDFE_DEG_DMS)
+      lowrgt(1) = he5_ehconvAng(15.d0, HE5_HDFE_DEG_DMS)
+      lowrgt(2) = he5_ehconvAng(20.d0, HE5_HDFE_DEG_DMS)
+
+      do i=1,16
+         projparm(i) = 0.d0
+      enddo
+      
+      zonecode   = 0
+      spherecode = 0
+
+      gdid3 =he5_gdcreate(gdfid,"GEOGrid",xdim,ydim,uplft,lowrgt)
+      write(*,*) 'Grid ID returned by he5_gdcreate():  ',gdid3
+
+      status=he5_gddefproj(gdid3,HE5_GCTP_GEO,zonecode,spherecode,
+     1projparm)
+      write(*,*) 'Status returned by he5_gddefproj():  ',status
+
+c     Detach from the created grids
+c     -----------------------------
+      status = he5_gddetach(gdid)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+      status = he5_gddetach(gdid2)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+      status = he5_gddetach(gdid3)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+          
+c     Finally, close the grid file
+c     ----------------------------
+      status = he5_gdclose(gdfid)
+      write(*,*) 'Status returned by he5_gdclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
+
diff --git a/samples/he5_gd_setupF_64.f b/samples/he5_gd_setupF_64.f
new file mode 100755
index 0000000..435c33e
--- /dev/null
+++ b/samples/he5_gd_setupF_64.f
@@ -0,0 +1,172 @@
+c     In this code we open an HDF-EOS file and create UTM, Polar 
+c     Stereographic, and Geographic grids within the file
+c     =========================================================
+
+      program     he5_gd_setupF_64
+ 
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status, gdfid, i 
+      integer     he5_gdcreate, he5_gdopen 
+      integer     he5_gddefdim, he5_gddefproj
+      integer     he5_gddeforigin
+      integer     he5_gddetach, he5_gdclose
+      integer     gdid, gdid2, gdid3
+      integer     zonecode, spherecode
+
+      integer*8   xdim, ydim, dim
+
+      real*8      uplft(2), lowrgt(2)
+      real*8      projparm(16), he5_ehconvang
+
+c     Open the HDF-EOS grid file, "grid.he5"
+c     -------------------------------------
+      gdfid = he5_gdopen('grid.he5',HE5F_ACC_TRUNC)
+      write(*,*) 'File ID returned by he5_gdopen():  ',gdfid
+    
+c     Create UTM Grid     
+c     ---------------
+
+c --------------------------------------------------- c
+c  Region is bounded by 54 E and 60 E longitudes and  c
+c  20 N and 30 N latitudes. UTM Zone: 40.             c
+c  Use default spheriod (Clarke 1866: spherecode = 0) c
+c                                                     c
+c  Grid into 120 bins along x-axis and 200 bins       c
+c  along y-axis  (approx 3' by 3' bins).              c
+c --------------------------------------------------- c
+
+      zonecode   = 40
+      spherecode = 0
+
+c    Upper Left and Lower Right points in meters
+c    -------------------------------------------
+      uplft(1)  =   210584.50041
+      uplft(2)  =  3322395.95445
+      lowrgt(1) =  813931.10959
+      lowrgt(2) = 2214162.53278
+
+      xdim = 120
+      ydim = 200
+
+c     Define GCTP Projection Parameters
+c     ---------------------------------
+      do i=1,16
+         projparm(i) = 0.d0
+      enddo
+    
+      gdid   = he5_gdcreate(gdfid, "UTMGrid", 
+     1     xdim, ydim, uplft, lowrgt)
+      write(*,*) 'Grid ID returned by he5_gdcreate():  ',gdid
+
+      status = he5_gddefproj(gdid,HE5_GCTP_UTM,
+     1     zonecode,spherecode,projparm)
+      write(*,*) 'Status returned by he5_gddefproj():  ',status
+         
+c     Define "Time" Dimension
+c     -----------------------
+      dim    = 10
+      status = he5_gddefdim(gdid, "Time", dim)
+      write(*,*) 'Status returned by he5_gddefdim():  ',status
+     
+c     Create polar stereographic grid 
+c     -------------------------------
+    
+c --------------------------------------------------- c
+c   Northern Hemisphere (True Scale at 90 N, 0        c
+c   Longitude below pole).                            c
+c   Use International 1967 spheriod (spherecode = 3)  c
+c   Grid into 100 bins along x-axis and y-axis.       c
+c --------------------------------------------------- c
+      
+      xdim = 100
+      ydim = 100
+      
+      spherecode = 3
+      
+c     Set Longitude below pole & true scale in DDDMMMSSS.SSS format)
+c     --------------------------------------------------------------
+      projparm(5) = 0.0
+      projparm(6) = 90000000.00
+
+c     Use default boundaries for Polar Stereographic (hemisphere)
+c     -----------------------------------------------------------
+      uplft(1)    =  0
+      uplft(2)    =  0
+      lowrgt(1)   =  0
+      lowrgt(2)   =  0
+
+      zonecode   = 0
+      
+      gdid2  = he5_gdcreate(gdfid,"PolarGrid",
+     1     xdim,ydim,uplft,lowrgt)
+      write(*,*) 'Grid ID returned by he5_gdcreate():  ',gdid2
+
+      status = he5_gddefproj(gdid2,HE5_GCTP_PS,
+     1     zonecode,spherecode,projparm)
+      write(*,*) 'Status returned by he5_gddefproj():  ',status
+
+      status = he5_gddeforigin(gdid2, HE5_HDFE_GD_LR)
+      write(*,*) 'Status returned by he5_gddeforigin():  ',status
+            
+c     Define "Bands" Dimension
+c     ------------------------
+      dim    = 3
+      status = he5_gddefdim(gdid2, "Bands", dim)
+      write(*,*) 'Status returned by he5_gddefdim():  ',status
+            
+c     Create geographic (linear scale) grid
+c     -------------------------------------
+
+c --------------------------------------------------- c 
+c   0-15 degrees longitude, 20-30 degrees latitude    c
+c --------------------------------------------------- c
+
+      xdim = 60
+      ydim = 40
+
+      uplft(1)  = he5_ehconvAng(0.d0, HE5_HDFE_DEG_DMS)
+      uplft(2)  = he5_ehconvAng(30.d0,HE5_HDFE_DEG_DMS)
+      lowrgt(1) = he5_ehconvAng(15.d0,HE5_HDFE_DEG_DMS)
+      lowrgt(2) = he5_ehconvAng(20.d0,HE5_HDFE_DEG_DMS)
+
+      do i=1,16
+         projparm(i) = 0.d0
+      enddo
+      
+      zonecode   = 0
+      spherecode = 0
+
+      gdid3 =he5_gdcreate(gdfid,"GEOGrid",
+     1     xdim,ydim,uplft,lowrgt)
+      write(*,*) 'Grid ID returned by he5_gdcreate():  ',gdid3
+
+      status=he5_gddefproj(gdid3,HE5_GCTP_GEO,
+     1     zonecode,spherecode,projparm)
+      write(*,*) 'Status returned by he5_gddefproj():  ',status
+
+c     Detach from the created grids
+c     -----------------------------
+      status = he5_gddetach(gdid)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+      status = he5_gddetach(gdid2)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+      status = he5_gddetach(gdid3)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+          
+c     Finally, close the grid file
+c     ----------------------------
+      status = he5_gdclose(gdfid)
+      write(*,*) 'Status returned by he5_gdclose():  ',status
+
+      stop
+      end
+
+
+
+
+
diff --git a/samples/he5_gd_subset.c b/samples/he5_gd_subset.c
new file mode 100755
index 0000000..a72f9d4
--- /dev/null
+++ b/samples/he5_gd_subset.c
@@ -0,0 +1,84 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+
+#include    <HE5_HdfEosDef.h>
+
+
+/*
+ * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to
+ * the "PolarGrid", and (3) subset data from the "Temperature" field.
+ */
+
+
+int main()
+{
+  herr_t          status   = FAIL;
+
+  int             rank     = FAIL;
+  int             i;
+
+  hid_t           gdfid    = FAIL;
+  hid_t           GDid     = FAIL;
+  hid_t           regionID = FAIL;
+
+  hid_t           *ntype;
+    
+  long            size;
+
+  hsize_t         dims[8];
+
+  float           *datbuf;
+    
+  double          cornerlon[2], cornerlat[2];
+  double          upleft[2], lowright[2];
+    
+
+  /*
+   * Open the HDF-EOS grid file, "Grid.h5".
+   */
+  gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR);
+  if (gdfid != FAIL)
+    {
+	  GDid = HE5_GDattach(gdfid, "PolarGrid");
+	  if (GDid != FAIL)
+		{
+		  cornerlon[0] = 57.;  cornerlat[0] = 23.;
+		  cornerlon[1] = 59.;  cornerlat[1] = 35.;
+		  cornerlon[0] = 0.;   cornerlat[0] = 90.;
+		  cornerlon[1] = 90.;  cornerlat[1] = 0.;
+
+		  regionID = HE5_GDdefboxregion(GDid, cornerlon, cornerlat);
+		  printf("Region ID returned by HE5_GDdefboxregion() :    %d \n", regionID);
+
+		  ntype = (hid_t *)calloc(1, sizeof(hid_t));    
+		  status = HE5_GDregioninfo(GDid, regionID, "Temperature", ntype,&rank, dims, &size, upleft, lowright);
+		  printf("Status returned by HE5_GDregioninfo() :         %d \n", status);
+		  printf("Byte size of region data buffer:            %d\n",(int)size);
+      
+		  datbuf = (float *)malloc(size);    
+		  status = HE5_GDextractregion(GDid, regionID, "Temperature", datbuf);
+		  printf("Status returned by HE5_GDextractregion() :      %d \n", status);
+		  printf("First 20 values of data buffer: \n");
+		  for (i = 0; i < 20; i++)
+			printf("\t\t %f \n", datbuf[ i ]);
+		  
+		  free(datbuf);
+		  free(ntype);   
+		}
+    }
+  status = HE5_GDdetach(GDid);
+  printf("Status returned by HE5_GDdetach() :             %d \n", status);
+  
+  status = HE5_GDclose(gdfid);
+  printf("Status returned by HE5_GDclose() :              %d \n", status);
+
+  return 0;
+}
+
+
+
diff --git a/samples/he5_gd_subsetF_32.f b/samples/he5_gd_subsetF_32.f
new file mode 100755
index 0000000..ae67ebe
--- /dev/null
+++ b/samples/he5_gd_subsetF_32.f
@@ -0,0 +1,95 @@
+c     In this example we will (1) open the "grid.he5" HDF-EOS file
+c     (2) attach to the "PolarGrid" grid, and (3) subset data from 
+c     the "Temperature" field.
+c     ============================================================
+ 
+      program      he5_gd_subsetF_32
+
+      implicit     none
+
+      include      'hdfeos5.inc'
+
+      integer      status
+      integer      gdfid
+      integer      gdid
+      integer      rgid
+      integer      he5_gdopen
+      integer      he5_gdattach
+      integer      he5_gdreginfo
+      integer      he5_gddefboxreg
+      integer      he5_gdextreg
+      integer      he5_gddetach
+      integer      he5_gdclose
+      integer      rk
+      integer      nt
+
+      integer*4    dims(8)
+      integer*4    size
+
+      real*8       cornerlon(2)
+      real*8       cornerlat(2)
+      real*8       upleft(2)
+      real*8       lowright(2)
+
+      real*4       datbuf(100*100)
+	
+      integer      FAIL
+      parameter    (FAIL=-1)
+
+c     Open the HDF-EOS grid file, "grid.he5"
+c     -------------------------------------- 
+      gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_gdopen():  ',gdfid
+
+      if (gdfid .NE. FAIL) then
+
+c        Attach to the POLAR grid
+c        ------------------------
+         gdid = he5_gdattach(gdfid, "PolarGrid")
+         write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid
+
+         if (gdid .NE. FAIL) then
+            cornerlon(1) = 0.
+            cornerlat(1) = 90.
+            cornerlon(2) = 90.
+            cornerlat(2) = 0.
+
+c           Define box region
+c           -----------------
+            rgid   = he5_gddefboxreg(gdid,cornerlon, 
+     1           cornerlat)
+            write(*,*) 'Region ID returned by he5_gddefboxreg():  ',
+     1           rgid
+
+
+c           Get region information
+c           ----------------------            
+            status = he5_gdreginfo(gdid,rgid,"Temperature",
+     1           nt,rk, dims, size, upleft, lowright)
+            write(*,*) dims(1), dims(2), rk, nt
+
+c           Extract region
+c           --------------
+            status = he5_gdextreg(gdid,rgid,"Temperature",
+     1           datbuf)
+            write(*,*) 'Status returned by he5_gdextreg():  ',status
+
+         endif
+         
+c        Detach from the grid
+c        --------------------
+         status = he5_gddetach(gdid)
+         write(*,*) 'Status returned by he5_gddetach():  ',status
+
+c        Close the file
+c        --------------
+         status = he5_gdclose(gdfid)
+         write(*,*) 'Status returned by he5_gdclose():  ',status
+         
+      endif
+      stop
+      end
+	
+
+
+
diff --git a/samples/he5_gd_subsetF_64.f b/samples/he5_gd_subsetF_64.f
new file mode 100755
index 0000000..9b6dfbb
--- /dev/null
+++ b/samples/he5_gd_subsetF_64.f
@@ -0,0 +1,90 @@
+c  In this example we will (1) open the "grid.he5" HDF-EOS file, (2) attach to
+c  the "PolarGrid" grid, and (3) subset data from the "Temperature" field.
+ 
+      program      he5_gd_subsetF_64
+
+      implicit     none
+
+      include      'hdfeos5.inc'
+
+      integer      status
+      integer      gdfid
+      integer      gdid
+      integer      rgid
+      integer      he5_gdopen
+      integer      he5_gdattach
+      integer      he5_gdreginfo
+      integer      he5_gddefboxreg
+      integer      he5_gdextreg
+      integer      he5_gddetach
+      integer      he5_gdclose
+      integer      rk,nt
+
+      integer*8    dims(8)
+      integer*8    size
+
+      real*8       cornerlon(2)
+      real*8       cornerlat(2)
+      real*8       upleft(2)
+      real*8       lowright(2)
+
+      real*4       datbuf(100*100)
+	
+      integer      FAIL
+      parameter    (FAIL=-1)
+
+c     Open the HDF-EOS grid file, "grid.he5"
+c     --------------------------------------- 
+      gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_gdopen():  ',gdfid
+
+      if (gdfid .NE. FAIL) then
+
+c        Attach to the POLAR grid
+c        ------------------------
+         gdid = he5_gdattach(gdfid,"PolarGrid")
+         write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid
+
+         if (gdid .NE. FAIL) then
+            cornerlon(1) = 0.
+            cornerlat(1) = 90.
+            cornerlon(2) = 90.
+            cornerlat(2) = 0.
+
+c           Define box region
+c           -----------------
+            rgid   = he5_gddefboxreg(gdid,
+     1           cornerlon,cornerlat)
+            write(*,*) 'Region ID returned by he5_gddefboxreg():  ',
+     1           rgid
+
+c           Get region information
+c           ----------------------            
+            status = he5_gdreginfo(gdid,rgid,"Temperature",
+     1           nt,rk, dims, size, upleft, lowright)
+            write(*,*) dims(1), dims(2), rk, nt
+
+c           Extract region
+c           --------------
+            status = he5_gdextreg(gdid,rgid,"Temperature",
+     1           datbuf)
+            write(*,*) 'Status returned by he5_gdextreg():  ',status
+         endif
+         
+c        Detach from the grid
+c        --------------------
+         status = he5_gddetach(gdid)
+         write(*,*) 'Status returned by he5_gddetach():  ',status
+
+c        Close the file
+c        --------------
+         status = he5_gdclose(gdfid)
+         write(*,*) 'Status returned by he5_gdclose():  ',status        
+
+      endif
+      stop
+      end
+	
+
+
+
diff --git a/samples/he5_gd_wrexternaldata.c b/samples/he5_gd_wrexternaldata.c
new file mode 100755
index 0000000..993b00c
--- /dev/null
+++ b/samples/he5_gd_wrexternaldata.c
@@ -0,0 +1,121 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include    <HE5_HdfEosDef.h>
+
+
+#define  DIM      100
+#define  DIMTOT   60
+
+int main()
+{
+  FILE            *in_1, *in_2, *in_3;
+
+  herr_t          status = FAIL;
+
+  int             i;
+  int             data_out_1[DIM];
+  int             data_out_2[DIM];
+  int             data_out_3[DIM];
+  int             data[DIMTOT];
+
+  hid_t           gdfid = FAIL;
+  hid_t           GDid  = FAIL;
+
+  hssize_t        start[2];
+  hsize_t         count[2];
+
+
+  
+  /* Create new data buffer */
+  /* ---------------------- */
+  for (i = 0; i < DIMTOT; i++)
+	data[ i ] = 9999;
+
+  /*
+   * Open the HDF grid file, "Grid.h5".
+   */
+  gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR);
+  if (gdfid != FAIL)
+    {
+	  /*
+	   * Attach the "UTMGrid".
+	   */
+	  GDid = HE5_GDattach(gdfid, "UTMGrid");
+	  if (GDid != FAIL)
+		{
+		  /* Write new data to the external files */
+		  /* ------------------------------------ */
+		  start[0] = 0;
+		  count[0] = DIMTOT;
+		  status = HE5_GDwritefield(GDid, "ExtData", start, NULL, count, data);
+		  printf("Status returned by HE5_GDwritefield() :    %d \n", status);
+	    
+		  /* Open the external data files */
+		  /* ---------------------------- */
+		  in_1 = fopen("external_1g.data", "r");
+		  in_2 = fopen("external_2g.data", "r");
+		  in_3 = fopen("external_3g.data", "r");
+
+		  /* Read data from external data files */
+		  /* ---------------------------------- */
+		  fread(data_out_1, sizeof(int), DIM, in_1);
+		  fread(data_out_2, sizeof(int), DIM, in_2);
+		  fread(data_out_3, sizeof(int), DIM, in_3);
+		  
+		  /* Close the external data files */
+		  /* ----------------------------- */
+		  fclose(in_1);
+		  fclose(in_2);
+		  fclose(in_3);
+  
+		  /* Check the contents of external files */
+		  /* ------------------------------------ */
+		  printf(" \n");
+		  printf("Reading data from 1st file: \n");
+		  printf(" \n");
+		  for (i = 0; i < DIM; i++)
+			printf("%d ", data_out_1[i]);
+		  
+		  printf(" \n");
+		  printf(" \n");
+		  printf("Reading data from 2d file: \n");
+		  printf(" \n");
+		  for (i = 0; i < DIM; i++)
+			printf("%d ", data_out_2[i]);
+		  
+		  printf(" \n");
+		  printf(" \n");
+		  printf("Reading data from 3d file: \n");
+		  printf(" \n"); 
+		  for (i = 0; i < DIM; i++)
+			printf("%d ", data_out_3[i]);
+		  printf(" \n");
+		  printf(" \n");
+		}
+	}
+
+  /* Detach from the grid  */
+  /* --------------------- */
+  status = HE5_GDdetach(GDid);
+  printf("Status returned by HE5_GDdetach() :        %d \n", status);
+
+  /* Close the file */
+  /* -------------- */
+  status = HE5_GDclose(gdfid);
+  printf("Status returned by HE5_GDclose() :         %d \n", status); 
+  
+  return 0;
+}
+
+
+
+
+
+
+
+
diff --git a/samples/he5_gd_writeAlldimscale.c b/samples/he5_gd_writeAlldimscale.c
new file mode 100644
index 0000000..3b59c06
--- /dev/null
+++ b/samples/he5_gd_writeAlldimscale.c
@@ -0,0 +1,322 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Raytheon Systems Company                         |
+ ----------------------------------------------------------------------------
+ */
+
+#include     <HE5_HdfEosDef.h>
+
+/*
+ * In this example we will open an HDF-EOS file and attach to UTM and Polar
+ * Stereographic grid structures within the file to write a dimension scales
+ */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  hid_t           gdfid = FAIL;
+  hid_t           GDid1 = FAIL;
+  hid_t           GDid2 = FAIL;
+  hid_t           GDid3 = FAIL;
+  int             data[10]={3,6,9,12,15,18,23,26,29,32};
+  int             bands[10]={12,14,18};
+  char            label[16];
+  char            unit[16];
+  char            format[16];
+  long            xdim, ydim;
+  int             ntime;
+  hsize_t         count[3];
+
+  /*
+   * We first open the HDF-EOS grid file, "Grid.h5".  Because this file
+   * already exist and we wish to write to it, we use the H5F_ACC_RDWR access
+   * code in the open statement.  The HE5_GDopen routine returns the grid file
+   * id, gdfid, which is used to identify the file in subsequent routines.
+   */ 
+
+  gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR);
+ 
+  /*
+   * If the grid file cannot be found, HE5_GDopen will return -1 for the file
+   * handle (gdfid).  We there check that this is not the case before
+   * proceeding with the other routines.
+   * 
+   * The HE5_GDattach routine returns the handle to the existing grid "Grid1",
+   * GDid.  If the grid is not found, HE5_GDattach returns -1 for the handle.
+   */ 
+
+  if (gdfid != FAIL)
+    {	  
+      GDid1 = HE5_GDattach(gdfid, "UTMGrid");
+
+      /* the field Pollution has Time,YDim,XDim dimensions. 
+	 xdim = 120;
+	 ydim = 200;
+	 Time dim is set to 10
+      */
+
+      if (GDid1 == -1)
+	{
+	  printf("\t\tError: Cannot attach to grid \"UTMGrid\"\n");
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      xdim = 120;
+      ydim = 200;
+      ntime = 10;
+      
+      status = HE5_GDdefdimscale(GDid1, "XDim", xdim, H5T_NATIVE_DOUBLE, NULL);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale for XDim dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      status = HE5_GDdefdimscale(GDid1, "Time", ntime, H5T_NATIVE_INT, data);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale for Time dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      status = HE5_GDdefdimscale(GDid1, "XDim", xdim, H5T_NATIVE_DOUBLE, NULL);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale for XDim dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+
+      status = HE5_GDdefdimscale(GDid1, "YDim", ydim, H5T_NATIVE_DOUBLE, NULL);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale for XDim dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      strcpy(label, "X Dimension");
+      strcpy(unit, "meters");
+      strcpy(format, "F7.2");
+      
+      count[0]= 12;
+      status = HE5_GDwritedscaleattr(GDid1, "XDim", "label", H5T_NATIVE_CHAR, count, label);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for XDim dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+
+      count[0]= 6;
+      status = HE5_GDwritedscaleattr(GDid1, "XDim", "unit", H5T_NATIVE_CHAR, count, unit);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for XDim dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      count[0]= 4;
+      status = HE5_GDwritedscaleattr(GDid1, "XDim", "format", H5T_NATIVE_CHAR, count, format);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for XDim dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+         
+      float datbuf_f[1] = {-999.0};
+      count[0]= 1;
+      status = HE5_GDwritedscaleattr(GDid1, "XDim", "MissingValue", H5T_NATIVE_FLOAT, count, datbuf_f);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for XDim dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      int datbuf_i[3] = {-999,0,999};
+      count[0]= 3;
+      status = HE5_GDwritedscaleattr(GDid1, "XDim", "IntValues", H5T_NATIVE_INT, count, datbuf_i);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for XDim dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+
+      strcpy(label, "Time Dim");
+      strcpy(unit, "s");
+      strcpy(format, "F2.3");
+      
+      count[0]= 8;
+      status = HE5_GDwritedscaleattr(GDid1, "Time", "label", H5T_NATIVE_CHAR, count, label);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Time dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      count[0]= 1;
+      status = HE5_GDwritedscaleattr(GDid1, "Time", "unit", H5T_NATIVE_CHAR, count, unit);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Time dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      count[0]= 4;
+      status = HE5_GDwritedscaleattr(GDid1, "Time", "format", H5T_NATIVE_CHAR, count, format);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Time dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      int datbuf_i2[2] = {-999, +999};
+      count[0] = 2;
+      status = HE5_GDwritedscaleattr(GDid1, "Time", "MissingValue", H5T_NATIVE_INT, count, datbuf_i2);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Time dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      HE5_GDdetach(GDid1);
+      
+      /* the field Spectra has Bands,YDim,XDim dimensions. 
+	 xdim = 100;
+	 ydim = 100;
+	 Bands dim is set to 3
+      */
+      
+      GDid2 = HE5_GDattach(gdfid, "PolarGrid");
+      if (GDid2 == -1)
+	{
+	  printf("\t\tError: Cannot attach to grid \"PolarGrid\"\n");
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      ydim = 100;
+      int nbands = 3;
+      
+      status = HE5_GDdefdimscale(GDid2, "YDim", ydim, H5T_NATIVE_DOUBLE, NULL);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale for YDim dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid2);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      
+      status = HE5_GDdefdimscale(GDid2, "Bands", nbands, H5T_NATIVE_INT, bands);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale for Bands dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid2);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      
+      strcpy(label, "Y Dim");
+      strcpy(unit, "meters");
+      strcpy(format, "F7.2");
+      
+      count[0]= 5;
+      status = HE5_GDwritedscaleattr(GDid2, "YDim", "Label", H5T_NATIVE_CHAR, count, label);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for XDim dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid2);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+	  
+      strcpy(label, "Bands");
+      strcpy(unit, "None");
+      strcpy(format, "F7.2");
+      
+      count[0] = 4;
+      status = HE5_GDwritedscaleattr(GDid2, "Bands", "Units", H5T_NATIVE_CHAR, count, unit);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Time dimemnsion in grid fields\n");
+	  HE5_GDdetach(GDid2);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      HE5_GDdetach(GDid2);
+      
+      /* the field GeoSpectra has YDim,XDim dimensions. 
+	 xdim = 100;
+	 ydim = 100;
+	 Bands dim is set to 3
+      */
+      
+	xdim = 60;
+	ydim = 40;
+	
+	GDid3 = HE5_GDattach(gdfid, "GEOGrid");
+	if (GDid3 == -1)
+	  {
+	    printf("\t\tError: Cannot attach to grid \"GEOGrid\"\n");
+	    HE5_GDclose(gdfid);
+	    return -1;
+	  }
+	status = HE5_GDdefdimscale(GDid3, "YDim", ydim, H5T_NATIVE_DOUBLE, NULL);
+	if (status == -1)
+	  {
+	    printf("\t\tError: Cannot set Dimension Scale for YDim dimemnsion in grid fields\n");
+	    HE5_GDdetach(GDid3);
+	    HE5_GDclose(gdfid);
+	    return -1;
+	  }
+	
+	strcpy(label, "Y Dimension");
+	strcpy(unit, "Decimal Degrees");
+	strcpy(format, "F7.2");
+
+	count[0] = 15;
+	status = HE5_GDwritedscaleattr(GDid3, "YDim", "Units", H5T_NATIVE_CHAR, count, unit);
+	if (status == -1)
+	  {
+	    printf("\t\tError: Cannot set Dimension Scale strs for YDim dimemnsion in grid fields\n");
+	    HE5_GDdetach(GDid3);
+	    HE5_GDclose(gdfid);
+	    return -1;
+	  }
+	
+	
+	HE5_GDdetach(GDid3);
+	
+      HE5_GDclose(gdfid);
+      
+      return 0;
+    }
+}
diff --git a/samples/he5_gd_writedata.c b/samples/he5_gd_writedata.c
new file mode 100755
index 0000000..3f25ed5
--- /dev/null
+++ b/samples/he5_gd_writedata.c
@@ -0,0 +1,111 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include    <HE5_HdfEosDef.h>
+
+/*
+ * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to
+ * the "UTMGrid", and (3) write data to the "Vegetation" field.  We will
+ * then attach to the "PolarGrid" and write to the "Temperature" field.
+ */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  int             i, j;
+  int             grpattr[3] = {3,7,11};       /* group attr  */
+
+  hid_t           gdfid = FAIL;
+  hid_t           GDid  = FAIL;
+
+  float           flt = 3.1415;	               /* global attr */
+  float           attr[4] = {1.1,2.2,3.3,4.4}; /* local attr  */
+  float           veg[200][120];
+  float           temp[100][100];
+  
+  hssize_t        start[3];
+  
+  hsize_t         edge[3];
+  
+  
+  /* Fill veg array */
+  for (i = 0; i < 200; i++)
+	for (j = 0; j < 120; j++)
+	  veg[i][j] = (float)(10+i);
+	
+  /* Fill temp array */
+  for (i = 0; i < 100; i++)
+	for (j = 0; j < 100; j++)
+	  temp[i][j] = (float)(100*i+j);
+  
+  
+  /*
+   * Open the HDF grid file, "Grid.h5".
+   */
+  gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR);
+  if (gdfid != FAIL)
+    {
+	  
+	  /*
+	   * Attach the "UTMGrid".
+	   */
+	  GDid = HE5_GDattach(gdfid, "UTMGrid");
+	  if (GDid != FAIL)
+		{
+          /* Data Field "Vegetation" */
+          /* ----------------------  */
+		  start[0] = 0;     start[1] = 0;
+		  edge[0]  = 200;   edge[1]  = 120;
+		  status = HE5_GDwritefield(GDid, "Vegetation", start, NULL, edge, veg);
+		  printf("Status returned by HE5_GDwritefield() :    %d \n", status);
+		  
+		  /* Global attribute */
+		  /* ---------------- */
+		  edge[0] = 1;
+		  status = HE5_GDwriteattr(GDid, "GlobalAttribute", H5T_NATIVE_FLOAT, edge, &flt);
+		  printf("Status returned by HE5_GDwriteattr() :     %d \n", status);
+		  
+		  /* Group attribute */
+		  /* --------------- */
+		  edge[0] = 3;
+		  status = HE5_GDwritegrpattr(GDid, "GroupAttribute", H5T_NATIVE_INT, edge, grpattr);
+		  printf("Status returned by HE5_GDwritegrpattr() :  %d \n", status);
+
+		  /* Local attribute */
+		  /* --------------- */
+		  edge[0] = 4;
+		  status = HE5_GDwritelocattr(GDid, "Vegetation", "LocalAttribute", H5T_NATIVE_FLOAT, edge, attr);
+		  printf("Status returned by HE5_GDwritelocattr() :  %d \n", status);         
+		}
+	  
+	  status = HE5_GDdetach(GDid);
+	  
+	  GDid = HE5_GDattach(gdfid, "PolarGrid");
+	  if (GDid != FAIL)
+		{
+          /* Data field "Temperature" */
+          /* -----------------------  */
+		  start[0] = 0;    start[1] = 0;
+		  edge[0]  = 100;  edge[1]  = 100;
+		  status = HE5_GDwritefield(GDid, "Temperature", start, NULL, edge, temp);
+		  printf("Status returned by HE5_GDwritefield() :    %d \n", status);
+		  
+		}
+	  status = HE5_GDdetach(GDid);
+    }
+  
+  status = HE5_GDclose(gdfid);
+  
+  return 0;
+}
+
+
+
+
+
diff --git a/samples/he5_gd_writedataF_32.f b/samples/he5_gd_writedataF_32.f
new file mode 100755
index 0000000..515edf9
--- /dev/null
+++ b/samples/he5_gd_writedataF_32.f
@@ -0,0 +1,148 @@
+      program     he5_gd_writedataF_32
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+	  integer     status
+	  integer     i, j
+      integer     he5_gdopen
+      integer     he5_gdattach
+      integer     he5_gdwrfld
+	  integer     he5_gdwrattr
+      integer     he5_gdwrgattr
+      integer     he5_ehwrglatt
+      integer     he5_gdwrlattr 
+      integer     he5_gddetach
+      integer     he5_gdclose
+	  integer     gdfid,gdid
+
+	  integer*4   start(2), stride(2), count(2)
+
+	  real*4      f, veg(120,200), temp(100,100)
+      character*10    attr4
+      character*100   attr5
+
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+c     Create data buffers 
+c     -------------------      
+	  do i=1,200
+		 do j=1,120
+			veg(j,i) = 10 + i
+		 enddo
+	  enddo
+	  
+	  do i=1,100
+		 do j=1,100
+			temp(j,i) = 100*(i-1) + j
+		 enddo
+	  enddo
+
+c     Open HDF-EOS file "grid.he5" 
+c     ---------------------------      
+	  gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_gdopen():  ',gdfid
+
+	  if (gdfid .ne. FAIL) then
+
+c        Attach to the UTM grid
+c        ----------------------         
+		 gdid = he5_gdattach(gdfid, "UTMGrid")
+         write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid
+
+		 if (gdid .ne. FAIL) then
+			start(1)  = 0
+			start(2)  = 0
+			stride(1) = 1
+			stride(2) = 1
+			count(1)  = 120
+			count(2)  = 200
+
+c           Write data to the field "Vegetation"
+c           ------------------------------------
+			status = he5_gdwrfld(gdid,"Vegetation",
+     1           start,stride,count,veg)
+            write(*,*) 'Status returned by he5_gdwrfld():  ',status
+      
+			f        = 1
+			count(1) = 1
+
+c           Write global attribute "float"
+c           ------------------------------
+			status = he5_gdwrattr(gdid,"float",
+     1      HE5T_NATIVE_FLOAT,count,f)
+            write(*,*) 'Status returned by he5_gdwrattr():  ',status
+
+		attr4 = "ABCDEFGH"
+		count(1) = 8
+		status = he5_gdwrattr(gdid,"GLOBAL_CHAR_ATTR",HE5T_NATIVE_CHAR,
+	1	count,attr4)
+	write(*,*) 'Status returned by he5_gdwrattr():  ',status
+
+		attr4 = "111"
+		count(1) = 3
+		status = he5_gdwrgattr(gdid,"GLOBAL_CHAR_ATTR_1",HE5T_NATIVE_CHAR,
+	1	count,attr4)
+	write(*,*) 'Status returned by he5_gdwrgattr():  ',status
+
+		attr4 = "222222"
+		count(1) = 6
+		status = he5_ehwrglatt(gdfid,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR,
+	1	count,attr4)
+	write(*,*) 'Status returned by he5_ehwrglatt():  ',status
+
+		attr5 = "abcdefgh111111111111"
+		count(1) = 20
+		status = he5_gdwrlattr(gdid,"Vegetation","LocalAttribute_0",
+	1	HE5T_NATIVE_CHAR,count,attr5)
+	write(*,*) 'Status returned by he5_gdwrlattr():  ',status
+
+		 endif
+	  endif
+
+c     Detach from the grid
+c     --------------------	  
+	  status = he5_gddetach(gdid)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+
+c     Attach to the POLAR grid 
+c     ------------------------	  
+	  gdid = he5_gdattach(gdfid, "PolarGrid")
+      write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid
+
+	  if (gdid .ne. FAIL) then
+		 start(1)  = 0
+		 start(2)  = 0
+		 stride(1) = 1
+		 stride(2) = 1
+		 count(1)  = 100
+		 count(2)  = 100
+
+c        Write data to the "Temperature" field
+c        -------------------------------------         
+		 status = he5_gdwrfld(gdid,"Temperature",
+     1        start,stride,count,temp)
+         write(*,*) 'Status returned by he5_gdwrfld():  ',status
+
+	  endif
+
+c     Detach from the grid
+c     --------------------
+	  status = he5_gddetach(gdid)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+c     Close the file 
+c     --------------	  
+	  status = he5_gdclose(gdfid)
+      write(*,*) 'Status returned by he5_gdclose():  ',status
+
+	  stop
+	  end
+
+
+
+
+
diff --git a/samples/he5_gd_writedataF_64.f b/samples/he5_gd_writedataF_64.f
new file mode 100755
index 0000000..eff04f5
--- /dev/null
+++ b/samples/he5_gd_writedataF_64.f
@@ -0,0 +1,142 @@
+      program     he5_gd_writedataF_64
+ 
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+	  integer     i, j, status
+      integer     he5_gdopen
+      integer     he5_gdattach
+      integer     he5_gdwrfld
+	  integer     he5_gdwrattr
+      integer     he5_gdwrgattr
+      integer     he5_ehwrglatt
+      integer     he5_gdwrlattr
+      integer     he5_gddetach
+      integer     he5_gdclose
+	  integer     gdfid, gdid
+
+	  integer*8   start(2),stride(2),count(2)
+
+	  real*4      f,veg(120,200),temp(100,100)
+      character*10    attr4
+      character*100   attr5
+
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+
+c     Create data buffers 
+c     -------------------      
+	  do i=1,200
+		 do j=1,120
+			veg(j,i) = 10 + i
+		 enddo
+	  enddo
+	  
+	  do i=1,100
+		 do j=1,100
+			temp(j,i) = 100*(i-1) + j
+		 enddo
+	  enddo
+
+c     Open HDF-EOS file "grid.he5" 
+c     ---------------------------      
+	  gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_gdopen():  ',gdfid
+
+	  if (gdfid .ne. FAIL) then
+
+c        Attach to the UTM grid
+c        ----------------------         
+		 gdid = he5_gdattach(gdfid, "UTMGrid")
+         write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid
+
+		 if (gdid .ne. FAIL) then
+			start(1)  = 0
+			start(2)  = 0
+			stride(1) = 1
+			stride(2) = 1
+			count(1)  = 120
+			count(2)  = 200
+
+c           Write data to the field "Vegetation"
+c           ------------------------------------
+			status = he5_gdwrfld(gdid,"Vegetation",
+     1           start,stride,count,veg)
+            write(*,*) 'Status returned by he5_gdwrfld():  ',status
+      
+			f        = 1
+			count(1) = 1
+
+c           Write global attribute "float"
+c           ------------------------------
+			status = he5_gdwrattr(gdid,"float",
+     1      HE5T_NATIVE_FLOAT,count,f)
+            write(*,*) 'Status returned by he5_gdwrattr():  ',status
+
+		attr4 = "ABCDEFGH"
+		count(1) = 8
+		status = he5_gdwrattr(gdid,"GLOBAL_CHAR_ATTR",HE5T_NATIVE_CHAR,
+	1	count,attr4)
+	write(*,*) 'Status returned by he5_gdwrattr():  ',status
+
+		attr4 = "111"
+		count(1) = 3
+		status = he5_gdwrgattr(gdid,"GLOBAL_CHAR_ATTR_1",HE5T_NATIVE_CHAR,
+	1	count,attr4)
+	write(*,*) 'Status returned by he5_gdwrgattr():  ',status
+
+		attr4 = "222222"
+		count(1) = 6
+		status = he5_ehwrglatt(gdfid,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR,
+	1	count,attr4)
+	write(*,*) 'Status returned by he5_ehwrglatt():  ',status
+
+		attr5 = "abcdefgh111111111111"
+		count(1) = 20
+		status = he5_gdwrlattr(gdid,"Vegetation","LocalAttribute_0",
+	1	HE5T_NATIVE_CHAR,count,attr5)
+	write(*,*) 'Status returned by he5_gdwrlattr():  ',status
+
+		 endif
+	  endif
+
+c     Detach from the grid
+c     --------------------	  
+	  status = he5_gddetach(gdid)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+c     Attach to the POLAR grid 
+c     ------------------------	  
+	  gdid = he5_gdattach(gdfid, "PolarGrid")
+      write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid
+
+	  if (gdid .ne. FAIL) then
+		 start(1)  = 0
+		 start(2)  = 0
+		 stride(1) = 1
+		 stride(2) = 1
+		 count(1)  = 100
+		 count(2)  = 100
+
+c        Write data to the "Temperature" field
+c        -------------------------------------         
+		 status = he5_gdwrfld(gdid,"Temperature",
+     1        start,stride,count,temp)
+         write(*,*) 'Status returned by he5_gdwrfld():  ',status
+
+	  endif
+
+c     Detach from the grid
+c     --------------------
+	  status = he5_gddetach(gdid)
+      write(*,*) 'Status returned by he5_gddetach():  ',status
+
+c     Close the file 
+c     --------------	  
+	  status = he5_gdclose(gdfid)
+      write(*,*) 'Status returned by he5_gdclose():  ',status
+
+	  stop
+	  end
diff --git a/samples/he5_gd_writedimscale.c b/samples/he5_gd_writedimscale.c
new file mode 100644
index 0000000..0fd1479
--- /dev/null
+++ b/samples/he5_gd_writedimscale.c
@@ -0,0 +1,322 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Raytheon Systems Company                         |
+ ----------------------------------------------------------------------------
+ */
+
+#include     <HE5_HdfEosDef.h>
+
+/*
+ * In this example we will open an HDF-EOS file and attach to UTM and Polar
+ * Stereographic grid structures within the file to write a dimension scales
+ */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  hid_t           gdfid = FAIL;
+  hid_t           GDid1 = FAIL;
+  hid_t           GDid2 = FAIL;
+  hid_t           GDid3 = FAIL;
+  int             data[10]={3,6,9,12,15,18,23,26,29,32};
+  int             bands[10]={12,14,18};
+  char            label[16];
+  char            unit[16];
+  char            format[16];
+  long            xdim, ydim;
+  int             ntime;
+  hsize_t         count[3];
+
+  /*
+   * We first open the HDF-EOS grid file, "Grid.h5".  Because this file
+   * already exist and we wish to write to it, we use the H5F_ACC_RDWR access
+   * code in the open statement.  The HE5_GDopen routine returns the grid file
+   * id, gdfid, which is used to identify the file in subsequent routines.
+   */ 
+
+  gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR);
+ 
+  /*
+   * If the grid file cannot be found, HE5_GDopen will return -1 for the file
+   * handle (gdfid).  We there check that this is not the case before
+   * proceeding with the other routines.
+   * 
+   * The HE5_GDattach routine returns the handle to the existing grid "Grid1",
+   * GDid.  If the grid is not found, HE5_GDattach returns -1 for the handle.
+   */ 
+
+  if (gdfid != FAIL)
+    {	  
+      GDid1 = HE5_GDattach(gdfid, "UTMGrid");
+
+      /* the field Pollution has Time,YDim,XDim dimensions. 
+	 xdim = 120;
+	 ydim = 200;
+	 Time dim is set to 10
+      */
+
+      if (GDid1 == -1)
+	{
+	  printf("\t\tError: Cannot attach to grid \"UTMGrid\"\n");
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      xdim = 120;
+      ydim = 200;
+      ntime = 10;
+      
+      status = HE5_GDsetdimscale(GDid1, "Pollution", "XDim", xdim, H5T_NATIVE_DOUBLE, NULL);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale for XDim dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      status = HE5_GDsetdimscale(GDid1, "Pollution", "Time", ntime, H5T_NATIVE_INT, data);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale for Time dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      status = HE5_GDsetdimscale(GDid1, "Vegetation", "XDim", xdim, H5T_NATIVE_DOUBLE, NULL);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale for XDim dimemnsion in field \"Vegetation\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+
+      status = HE5_GDsetdimscale(GDid1, "Vegetation", "YDim", ydim, H5T_NATIVE_DOUBLE, NULL);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale for XDim dimemnsion in field \"Vegetation\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      strcpy(label, "X Dimension");
+      strcpy(unit, "meters");
+      strcpy(format, "F7.2");
+      
+      count[0]= 12;
+      status = HE5_GDwritedscaleattr(GDid1, "XDim", "label", H5T_NATIVE_CHAR, count, label);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for XDim dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+
+      count[0]= 6;
+      status = HE5_GDwritedscaleattr(GDid1, "XDim", "unit", H5T_NATIVE_CHAR, count, unit);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for XDim dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      count[0]= 4;
+      status = HE5_GDwritedscaleattr(GDid1, "XDim", "format", H5T_NATIVE_CHAR, count, format);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for XDim dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+         
+      float datbuf_f[1] = {-999.0};
+      count[0]= 1;
+      status = HE5_GDwritedscaleattr(GDid1, "XDim", "MissingValue", H5T_NATIVE_FLOAT, count, datbuf_f);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for XDim dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      int datbuf_i[3] = {-999,0,999};
+      count[0]= 3;
+      status = HE5_GDwritedscaleattr(GDid1, "XDim", "IntValues", H5T_NATIVE_INT, count, datbuf_i);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for XDim dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+
+      strcpy(label, "Time Dim");
+      strcpy(unit, "s");
+      strcpy(format, "F2.3");
+      
+      count[0]= 8;
+      status = HE5_GDwritedscaleattr(GDid1, "Time", "label", H5T_NATIVE_CHAR, count, label);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Time dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      count[0]= 1;
+      status = HE5_GDwritedscaleattr(GDid1, "Time", "unit", H5T_NATIVE_CHAR, count, unit);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Time dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      count[0]= 4;
+      status = HE5_GDwritedscaleattr(GDid1, "Time", "format", H5T_NATIVE_CHAR, count, format);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Time dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      int datbuf_i2[2] = {-999, +999};
+      count[0] = 2;
+      status = HE5_GDwritedscaleattr(GDid1, "Time", "MissingValue", H5T_NATIVE_INT, count, datbuf_i2);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Time dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid1);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      HE5_GDdetach(GDid1);
+      
+      /* the field Spectra has Bands,YDim,XDim dimensions. 
+	 xdim = 100;
+	 ydim = 100;
+	 Bands dim is set to 3
+      */
+      
+      GDid2 = HE5_GDattach(gdfid, "PolarGrid");
+      if (GDid2 == -1)
+	{
+	  printf("\t\tError: Cannot attach to grid \"PolarGrid\"\n");
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      ydim = 100;
+      int nbands = 3;
+      
+      status = HE5_GDsetdimscale(GDid2, "Spectra", "YDim", ydim, H5T_NATIVE_DOUBLE, NULL);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale for YDim dimemnsion in field \"Spectra\"\n");
+	  HE5_GDdetach(GDid2);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      
+      status = HE5_GDsetdimscale(GDid2, "Spectra", "Bands", nbands, H5T_NATIVE_INT, bands);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_GDdetach(GDid2);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      
+      strcpy(label, "Y Dim");
+      strcpy(unit, "meters");
+      strcpy(format, "F7.2");
+      
+      count[0]= 5;
+      status = HE5_GDwritedscaleattr(GDid2, "YDim", "Label", H5T_NATIVE_CHAR, count, label);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for XDim dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid2);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+	  
+      strcpy(label, "Bands");
+      strcpy(unit, "None");
+      strcpy(format, "F7.2");
+      
+      count[0] = 4;
+      status = HE5_GDwritedscaleattr(GDid2, "Bands", "Units", H5T_NATIVE_CHAR, count, unit);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Time dimemnsion in field \"Pollution\"\n");
+	  HE5_GDdetach(GDid2);
+	  HE5_GDclose(gdfid);
+	  return -1;
+	}
+      
+      HE5_GDdetach(GDid2);
+      
+      /* the field GeoSpectra has YDim,XDim dimensions. 
+	 xdim = 100;
+	 ydim = 100;
+	 Bands dim is set to 3
+      */
+      
+	xdim = 60;
+	ydim = 40;
+	
+	GDid3 = HE5_GDattach(gdfid, "GEOGrid");
+	if (GDid3 == -1)
+	  {
+	    printf("\t\tError: Cannot attach to grid \"GEOGrid\"\n");
+	    HE5_GDclose(gdfid);
+	    return -1;
+	  }
+	status = HE5_GDsetdimscale(GDid3, "GeoSpectra", "YDim", ydim, H5T_NATIVE_DOUBLE, NULL);
+	if (status == -1)
+	  {
+	    printf("\t\tError: Cannot set Dimension Scale for YDim dimemnsion in field \"GeoSpectra\"\n");
+	    HE5_GDdetach(GDid3);
+	    HE5_GDclose(gdfid);
+	    return -1;
+	  }
+	
+	strcpy(label, "Y Dimension");
+	strcpy(unit, "Decimal Degrees");
+	strcpy(format, "F7.2");
+
+	count[0] = 15;
+	status = HE5_GDwritedscaleattr(GDid3, "YDim", "Units", H5T_NATIVE_CHAR, count, unit);
+	if (status == -1)
+	  {
+	    printf("\t\tError: Cannot set Dimension Scale strs for YDim dimemnsion in field \"GeoSpectra\"\n");
+	    HE5_GDdetach(GDid3);
+	    HE5_GDclose(gdfid);
+	    return -1;
+	  }
+	
+	
+	HE5_GDdetach(GDid3);
+	
+      HE5_GDclose(gdfid);
+      
+      return 0;
+    }
+}
diff --git a/samples/he5_gd_writedimscaleF_32.f b/samples/he5_gd_writedimscaleF_32.f
new file mode 100644
index 0000000..c876111
--- /dev/null
+++ b/samples/he5_gd_writedimscaleF_32.f
@@ -0,0 +1,385 @@
+      program     he5_gd_writedimscaleF_32
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     i, j
+      integer     he5_gdopen
+      integer     he5_gdattach
+      integer     he5_gdwrfld
+      integer     he5_gdwrattr
+      integer     he5_gdwrgattr
+      integer     he5_ehwrglatt
+      integer     he5_gdwrlattr 
+      integer     he5_gddetach
+      integer     he5_gdclose
+      integer     HE5_GDsetdimscale
+      integer     HE5_GDwritedscaleattr
+      integer     he5_gddeffld
+
+      integer     gdfid,gdid1,gdid2,gdid3
+      real*4      datbuf_f(1) 
+      integer*4   datbuf_i(3)
+      real*4      veg1(120),veg2(200), temp1(100),temp2(100)
+      real*4      geospecf(4)
+      integer*4   nbands
+      integer     bands(3)
+      integer*4   datbuf_i2(2)
+      integer     count(2)
+      integer     xdim, ydim, ntime
+      integer     data(10)
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+!  /*
+!   * We first open the HDF-EOS grid file, "Grid.h5".  Because this file
+!   * already exist and we wish to write to it, we use the H5F_ACC_RDWR access
+!   * code in the open statement.  The HE5_GDopen routine returns the grid file
+!   * id, gdfid, which is used to identify the file in subsequent routines.
+!   */ 
+      do j=1,10
+         data(j)=(j+1)*2
+      enddo
+
+      gdfid = HE5_GDopen("grid.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_gdopen(): ',gdfid
+!  /*
+!   * If the grid file cannot be found, HE5_GDopen will return -1 for the file
+!   * handle (gdfid).  We there check that this is not the case before
+!   * proceeding with the other routines.
+!   * 
+!   * The HE5_GDattach routine returns the handle to the existing grid "Grid1",
+!   * GDid.  If the grid is not found, HE5_GDattach returns -1 for the handle.
+!   */ 
+
+      if (gdfid .ne. FAIL) then
+ 
+         GDid1 = HE5_GDattach(gdfid, "UTMGrid")
+         write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid1
+
+!   /* the field Pollution has Time,YDim,XDim dimensions. 
+!    * xdim = 120
+!    * ydim = 200
+!    * Time dim is set to 10
+!    */
+
+         if (GDid1 .eq. -1) then
+            
+            write(*,*) 'Error: Cannot attach to grid UTMGrid. Stpped.'
+            status = HE5_GDclose(gdfid)
+            stop
+            
+         endif
+         
+         xdim = 120
+         ydim = 200 
+         ntime = 10
+         
+         status = HE5_GDsetdimscale(GDid1, "Pollution", "XDim", 
+     1       xdim, HE5T_NATIVE_DOUBLE, veg1)
+         write(*,*) 'Status returned by HE5_GDsetdimscale: ',status
+         
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error: Cannot set Dimension Scale for XDim',
+     1                ' dimemnsion in field Pollution'
+            status = HE5_GDdetach(GDid1)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         status = HE5_GDsetdimscale(GDid1, "Pollution", "Time", ntime,
+     1                               HE5T_NATIVE_INT, data)
+         write(*,*) 'Status returned by HE5_GDsetdimscale: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error: Cannot set Dimension Scale for Time',
+     1           ' dimemnsion in field Pollution'
+            status = HE5_GDdetach(GDid1)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         status = HE5_GDsetdimscale(GDid1, "Vegetation", "XDim", xdim,
+     1                               HE5T_NATIVE_DOUBLE, veg1)
+         write(*,*) 'Status returned by HE5_GDsetdimscale: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error: Cannot set Dimension Scale for XDim',
+     1                 ' dimemnsion in field Vegetation'
+            status = HE5_GDdetach(GDid1)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+
+         status = HE5_GDsetdimscale(GDid1, "Vegetation", "YDim", ydim,
+     1                               HE5T_NATIVE_DOUBLE, veg2)
+         write(*,*) 'Status returned by HE5_GDsetdimscale: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error: Cannot set Dimension Scale for XDim',
+     1                 ' dimemnsion in field Vegetation'
+            status = HE5_GDdetach(GDid1)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+
+         count(1)= 12
+         status = HE5_GDwritedscaleattr(GDid1, "XDim", "label", 
+     1                         HE5T_NATIVE_CHAR, count, "X Dimension")
+         write(*,*) 'Status returned by HE5_GDwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale strs for XDim',
+     1                ' dimemnsion in field Pollution'
+            status = HE5_GDdetach(GDid1)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         count(1)= 6
+         status = HE5_GDwritedscaleattr(GDid1, "XDim", "unit", 
+     1                              HE5T_NATIVE_CHAR, count, "meters")
+         write(*,*) 'Status returned by HE5_GDwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale strs for XDim',
+     1                 ' dimemnsion in field Pollution'
+            status = HE5_GDdetach(GDid1)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         count(1)= 4
+         status = HE5_GDwritedscaleattr(GDid1, "XDim", "format", 
+     1                                 HE5T_NATIVE_CHAR, count, "F7.2")
+         write(*,*) 'Status returned by HE5_GDwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale strs for XDim',
+     1                 ' dimemnsion in field Pollution'
+            status = HE5_GDdetach(GDid1)
+            status =  HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         datbuf_f(1) =  -999.0
+         count(1)= 1
+         status = HE5_GDwritedscaleattr(GDid1, "XDim", "MissingValue",
+     1                               HE5T_NATIVE_FLOAT, count, datbuf_f)
+         write(*,*) 'Status returned by HE5_GDwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale strs for XDim',
+     1                 ' dimemnsion in field Pollution'
+            status = HE5_GDdetach(GDid1)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         datbuf_i(1) =  -999
+         datbuf_i(2) =  0
+         datbuf_i(3) =  999
+
+
+         count(1)= 3
+         status = HE5_GDwritedscaleattr(GDid1, "XDim", "IntValues", 
+     1                               HE5T_NATIVE_INT, count, datbuf_i)
+         write(*,*) 'Status returned by HE5_GDwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale strs for XDim',
+     1         ' dimemnsion in field Pollution'
+            status = HE5_GDdetach(GDid1)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         count(1)= 8
+         status = HE5_GDwritedscaleattr(GDid1, "Time", "label", 
+     1                             HE5T_NATIVE_CHAR, count, "Time Dim")
+         write(*,*) 'Status returned by HE5_GDwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error: Cannot set Dimension Scale strs for',
+     1                ' Time dimemnsion in field Pollution'
+            status = HE5_GDdetach(GDid1)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         count(1)= 1
+         status = HE5_GDwritedscaleattr(GDid1, "Time", "unit", 
+     1                                 HE5T_NATIVE_CHAR, count, "s")
+         write(*,*) 'Status returned by HE5_GDwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error: Cannot set Dimension Scale strs for',
+     1                ' Time dimemnsion in field Pollution'
+            status = HE5_GDdetach(GDid1)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         count(1)= 4
+         status = HE5_GDwritedscaleattr(GDid1, "Time", "format", 
+     1                                HE5T_NATIVE_CHAR, count, "F2.3")
+         write(*,*) 'Status returned by HE5_GDwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error: Cannot set Dimension Scale strs for',
+     1                ' Time dimemnsion in field Pollution'
+            status = HE5_GDdetach(GDid1)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         datbuf_i2(1) =  -999
+         datbuf_i2(2) =  999
+         count(1) = 2
+         status = HE5_GDwritedscaleattr(GDid1, "Time", "MissingValue", 
+     1                                HE5T_NATIVE_INT, count, datbuf_i2)
+         write(*,*) 'Status returned by HE5_GDwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error: Cannot set Dimension Scale strs for',
+     1                ' Time dimemnsion in field Pollution'
+            status = HE5_GDdetach(GDid1)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         status = HE5_GDdetach(GDid1)
+         write(*,*) 'Status returned by he5_gddetach(): ',status
+
+! -----------------------------------------------------------------
+
+!         /* the field Spectra has Bands,YDim,XDim dimensions. 
+!	 xdim = 100
+!	 ydim = 100
+!	 Bands dim is set to 3
+!         */
+!         
+         GDid2 = HE5_GDattach(gdfid, "PolarGrid")
+         write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid2
+         if (GDid2 .eq. -1) then
+            
+            write(*,*) 'Error: Cannot attach to grid PolarGrid'
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         ydim = 100
+         nbands = 3
+         
+         status = HE5_GDsetdimscale(GDid2, "Spectra", "YDim", ydim, 
+     1                              HE5T_NATIVE_DOUBLE, temp1)
+         write(*,*) 'Status returned by HE5_GDsetdimscale: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error: Cannot set Dimension Scale for YDim',
+     1                 ' dimemnsion in field Spectra'
+            status = HE5_GDdetach(GDid2)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         bands(1) = 5
+         bands(2) = 8
+         bands(3) = 9
+
+         status = HE5_GDsetdimscale(GDid2, "Spectra", "Bands", 
+     1                               nbands, HE5T_NATIVE_INT, bands)
+         write(*,*) 'Status returned by HE5_GDsetdimscale: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error: Cannot set Dimension Scale for',
+     1                ' Bands dimemnsion in field Spectra'
+            status = HE5_GDdetach(GDid2)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         count(1)= 5
+         status = HE5_GDwritedscaleattr(GDid2, "YDim", "Label", 
+     1                              HE5T_NATIVE_CHAR, count, "Y Dim")
+         write(*,*) 'Status returned by HE5_GDwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error: Cannot set Dimension Scale strs for',
+     1                ' XDim dimemnsion in field Pollution'
+            status = HE5_GDdetach(GDid2)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         count(1) = 4
+         status = HE5_GDwritedscaleattr(GDid2, "Bands", "Units", 
+     1                                HE5T_NATIVE_CHAR, count, "None")
+         write(*,*) 'Status returned by HE5_GDwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error: Cannot set Dimension Scale strs for',
+     1                ' Time dimemnsion in field Pollution '
+            status = HE5_GDdetach(GDid2)
+            status = HE5_GDclose(gdfid)
+            stop
+         endif
+         
+         status = HE5_GDdetach(GDid2)
+! -----------------------------------------------------------------         
+         xdim = 60
+         ydim = 40
+
+         GDid3 = HE5_GDattach(gdfid, "GEOGrid")
+         write(*,*) 'Grid ID returned by he5_gdattach(): ',GDid3
+         if (GDid3 .eq. -1) then
+            
+	    write(*,*) 'Error: Cannot attach to grid GEOGrid'
+            status = HE5_GDclose(gdfid)
+	    stop
+         endif
+
+
+!     Define Fields
+!     -------------	  
+         status = he5_gddeffld(gdid3, "GeoSpectra", "XDim,YDim",
+     1     " ", HE5T_NATIVE_FLOAT, 0)
+         write(*,*) 'Status returned by he5_gddeffld(): ',status
+
+         status = HE5_GDsetdimscale(GDid3, "GeoSpectra", "YDim", 
+     1                         ydim, HE5T_NATIVE_DOUBLE, GeoSpecf)
+         write(*,*) 'Status returned by HE5_GDsetdimscale: ',status
+         if (status .eq. -1) then
+            
+	    write(*,*) 'Error: Cannot set Dimension Scale for',
+     1                ' YDim dimemnsion in field GeoSpectra'
+            status = HE5_GDdetach(GDid3)
+            status = HE5_GDclose(gdfid)
+	    stop
+         endif
+         
+         count(1) = 15
+         status = HE5_GDwritedscaleattr(GDid3, "YDim", "Units", 
+     1                    HE5T_NATIVE_CHAR, count, "Decimal Degrees")
+         write(*,*) 'Status returned by HE5_GDwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+	    write(*,*) 'Error: Cannot set Dimension Scale strs for',
+     1                ' YDim dimemnsion in field GeoSpectra'
+            status = HE5_GDdetach(GDid3)
+            status = HE5_GDclose(gdfid)
+	    stop
+         endif
+         
+         
+         status = HE5_GDdetach(GDid3)
+         write(*,*) 'Status returned by he5_gddetach(): ',status
+         status = HE5_GDclose(gdfid)
+         write(*,*) 'Status returned by he5_gdclose(): ',status
+
+      endif
+      stop
+      end
diff --git a/samples/he5_gd_wrunlimfld.c b/samples/he5_gd_wrunlimfld.c
new file mode 100755
index 0000000..3b2f076
--- /dev/null
+++ b/samples/he5_gd_wrunlimfld.c
@@ -0,0 +1,118 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include   <HE5_HdfEosDef.h>
+
+
+/*
+ * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to
+ * the "UTMGrid", and (3) write data to the appendable "Vegetation" field. 
+ */
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  int             i, j;
+  int             rank = FAIL;
+
+  hid_t           gdfid = FAIL;
+  hid_t           GDid  = FAIL;
+
+  hid_t           *ntype;    
+  
+  hssize_t        start[3];
+
+  hsize_t         edge[3], dims[8] = {0,0,0,0,0,0,0,0};
+
+  float           veg[200][120];
+   
+  char            buf1[256], buf2[256];
+    
+
+
+  /* Fill veg array */
+  /* -------------- */
+  for (i = 0; i < 200; i++)
+	for (j = 0; j < 120; j++)
+	  veg[i][j] = (float)(10+i);
+    
+  /* Open the HDF grid file "Grid.h5" */
+  /* -------------------------------  */
+  gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR);
+  if (gdfid != FAIL)
+    {
+	  /* Attach the "UTMGrid" */
+      /* -------------------  */
+	  GDid = HE5_GDattach(gdfid, "UTMGrid");
+	  if (GDid != FAIL)
+		{
+          /* Write data to the appendable field */
+          /* ---------------------------------- */  
+		  start[0] = 0;     start[1] = 0;
+		  edge[0]  = 200;   edge[1]  = 120;
+		  status = HE5_GDwritefield(GDid, "Vegetation", start, NULL, edge, veg);
+          printf("Status returned by HE5_GDwritefield():  %d\n", status);
+
+          strcpy(buf1, "");
+          strcpy(buf2, "");
+          dims[0] = 0;
+		  dims[1] = 0;
+
+          ntype = (hid_t *)calloc(1, sizeof(hid_t));
+          status = HE5_GDfieldinfo(GDid, "Vegetation", &rank, dims, ntype, buf1, buf2);
+          printf("Status returned by HE5_GDfieldinfo():   %d\n", status);
+          if (status != FAIL)
+			{
+			  printf("\tThe dimension list:         %s \n", buf1);
+			  printf("\tThe maximum dimension list: %s \n", buf2);
+			  printf("The sizes of dataset dimensions before appending: \n");
+			  for (i = 0; i < rank; i++) 
+				printf("\t                            %lu \n", (unsigned long)dims[i]);
+			}
+          free(ntype);
+		}
+
+	  /* Detach from "UTMGrid" */
+      /* --------------------  */
+	  status = HE5_GDdetach(GDid);
+	  
+	  /* Attach the "UTMGrid" */
+      /* -------------------  */	
+	  GDid = HE5_GDattach(gdfid, "UTMGrid");
+	  if (GDid != FAIL)
+		{  
+          /* Write new data to the appendable field */
+          /* -------------------------------------- */   
+		  start[0] = 180;   start[1] = 100;
+		  edge[0]  = 100;   edge[1]  = 80;
+		  status = HE5_GDwritefield(GDid, "Vegetation", start, NULL, edge, veg);
+          printf("Status returned by HE5_GDwritefield():  %d\n", status);
+
+          strcpy(buf1, "");
+          strcpy(buf2, "");
+          dims[0] = 0;    dims[1] = 0;
+
+          ntype = (hid_t *)calloc(1, sizeof(hid_t));	  
+          status = HE5_GDfieldinfo(GDid, "Vegetation", &rank, dims, ntype, buf1, buf2);
+          printf("Status returned by HE5_GDfieldinfo():   %d\n", status);
+          if (status != FAIL)
+			{
+			  printf("\tThe dimension list:         %s \n", buf1);
+			  printf("\tThe maximum dimension list: %s \n", buf2);
+			  printf("The sizes of dataset dimensions after appending: \n");
+			  for (i = 0; i < rank; i++) 
+				printf("\t                            %lu \n", (unsigned long)dims[i]);
+			}	  
+          free(ntype);
+		}
+	  status = HE5_GDdetach(GDid);
+    }
+  status = HE5_GDclose(gdfid);
+  
+  return 0;
+}
diff --git a/samples/he5_pt_datainfo.c b/samples/he5_pt_datainfo.c
new file mode 100755
index 0000000..6296520
--- /dev/null
+++ b/samples/he5_pt_datainfo.c
@@ -0,0 +1,86 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |  
+ ----------------------------------------------------------------------------  
+ */
+
+
+#include <HE5_HdfEosDef.h>
+
+#define FILENAME   "Point.h5"
+#define OBJECT     "FixedBuoy Point"
+
+
+int main(void)
+{
+  herr_t       status     = FAIL;
+
+  int          fieldgroup = FAIL;
+
+  hid_t        fid = FAIL, PTid = FAIL, datatype = FAIL;
+
+  H5T_class_t  classid  = H5T_NO_CLASS;  
+   
+  H5T_order_t  order    = H5T_ORDER_ERROR;
+
+  size_t       size     = 0;
+
+  fid = HE5_PTopen(FILENAME, H5F_ACC_RDONLY);
+  printf("File ID returned by HE5_PTopen() :        %d \n", fid);
+    
+  PTid = HE5_PTattach(fid, OBJECT);
+  printf("Point ID returned by HE5_PTattach() :     %d \n", PTid);
+
+  fieldgroup = HE5_HDFE_DATAGROUP;
+  status = HE5_PTinqdatatype(PTid, "Observations", NULL, fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_PTinqdatatype() :  %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", (int)datatype);
+	  printf("\tclass ID:    %d \n", (int)classid);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  fieldgroup = HE5_HDFE_ATTRGROUP;
+  status = HE5_PTinqdatatype(PTid, NULL, "GlobalAttribute_int", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_PTinqdatatype() :  %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", (int)datatype);
+	  printf("\tclass ID:    %d \n", (int)classid);
+	  printf("\torder:       %d \n", (int)order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  fieldgroup = HE5_HDFE_GRPATTRGROUP;
+  status = HE5_PTinqdatatype(PTid, NULL, "GroupAttribute", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_PTinqdatatype() :  %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", (int)datatype);
+	  printf("\tclass ID:    %d \n", (int)classid);
+	  printf("\torder:       %d \n", (int)order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  fieldgroup = HE5_HDFE_LOCATTRGROUP;
+  status = HE5_PTinqdatatype(PTid, "Observations", "LocalAttribute", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_PTinqdatatype() :  %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", (int)datatype);
+	  printf("\tclass ID:    %d \n", (int)classid);
+	  printf("\torder:       %d \n", (int)order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  status = HE5_PTdetach(PTid);
+  printf("Status returned by HE5_PTdetach() :       %d \n", status);
+
+  status = HE5_PTclose(fid);
+  printf("Status returned by HE5_PTclose() :        %d \n", status);
+    
+  return(0);    
+}
+
+
diff --git a/samples/he5_pt_datainfoF_32.f b/samples/he5_pt_datainfoF_32.f
new file mode 100755
index 0000000..786fb7d
--- /dev/null
+++ b/samples/he5_pt_datainfoF_32.f
@@ -0,0 +1,101 @@
+      program       he5_pt_datainfoF_32
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+      integer       status
+      integer       ptfid 
+      integer       ptid       
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptinqdatatype
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+      integer       dtype
+      integer       classid
+      integer       order
+      integer       fieldgroup
+
+      integer*4     size
+
+      character*1   null_char_0
+      character*80  fieldname
+      character*80  attrname
+
+      null_char_0  = '0'
+
+c     Open the HDF point file, "point.he5"
+c     ------------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Read Simple Point 
+c     ----------------- 
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+      fieldgroup = HE5_HDFE_DATAGROUP
+      fieldname  = 'Observations'
+
+      status = he5_ptinqdatatype(ptid,fieldname,null_char_0,fieldgroup,
+     1dtype,classid,order,size)
+      print *,'Status returned from he5_ptinqdatatype():  ',status
+      print *,'datatype:     ',dtype
+      print *,'class ID:     ',classid
+      print *,'order:        ',order
+      print *,'size:         ',size
+
+
+      fieldgroup   = HE5_HDFE_ATTRGROUP
+      attrname     = 'GlobalAttribute_int'
+
+      status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup,
+     1dtype,classid,order,size)
+      print *,'Status returned from he5_ptinqdatatype():  ',status
+      print *,'datatype:     ',dtype
+      print *,'class ID:     ',classid
+      print *,'order:        ',order
+      print *,'size:         ',size
+
+
+      fieldgroup   = HE5_HDFE_GRPATTRGROUP
+      attrname     = 'GroupAttribute'
+
+      status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup,
+     1dtype,classid,order,size)
+      print *,'Status returned from he5_ptinqdatatype():  ',status
+      print *,'datatype:     ',dtype
+      print *,'class ID:     ',classid
+      print *,'order:        ',order
+      print *,'size:         ',size
+
+
+      fieldname    = 'Observations'
+      fieldgroup   = HE5_HDFE_LOCATTRGROUP
+      attrname     = 'LocalAttribute'
+
+      status = he5_ptinqdatatype(ptid,fieldname,attrname,fieldgroup,
+     1dtype,classid,order,size)
+      print *,'Status returned from he5_ptinqdatatype():  ',status
+      print *,'datatype:     ',dtype
+      print *,'class ID:     ',classid
+      print *,'order:        ',order
+      print *,'size:         ',size
+
+
+c     Close out the point interface
+c     -----------------------------
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+      stop
+      end
+
+
+ 
+
+
diff --git a/samples/he5_pt_datainfoF_64.f b/samples/he5_pt_datainfoF_64.f
new file mode 100755
index 0000000..8d170e0
--- /dev/null
+++ b/samples/he5_pt_datainfoF_64.f
@@ -0,0 +1,101 @@
+      program       he5_pt_datainfoF_64
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+      integer       status
+      integer       ptfid 
+      integer       ptid       
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptinqdatatype
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+      integer       dtype
+      integer       classid
+      integer       order
+      integer       fieldgroup
+
+      integer*8     size
+
+      character*1   null_char_0
+      character*80  fieldname
+      character*80  attrname
+
+      null_char_0  = '0'
+
+c     Open the HDF-EOS point file, "point.he5"
+c     ----------------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Read Simple Point 
+c     ----------------- 
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+      fieldgroup = HE5_HDFE_DATAGROUP
+      fieldname  = 'Observations'
+
+      status = he5_ptinqdatatype(ptid,fieldname,null_char_0,fieldgroup,
+     1dtype,classid,order,size)
+      print *,'Status returned from he5_ptinqdatatype():  ',status
+      print *,'dtype:        ',dtype
+      print *,'class ID:     ',classid
+      print *,'order:        ',order
+      print *,'size:         ',size
+
+
+      fieldgroup   = HE5_HDFE_ATTRGROUP
+      attrname     = 'GlobalAttribute_int'
+
+      status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup,
+     1dtype,classid,order,size)
+      print *,'Status returned from he5_ptinqdatatype():  ',status
+      print *,'dtype:        ',dtype
+      print *,'class ID:     ',classid
+      print *,'order:        ',order
+      print *,'size:         ',size
+
+
+      fieldgroup   = HE5_HDFE_GRPATTRGROUP
+      attrname     = 'GroupAttribute'
+
+      status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup,
+     1dtype,classid,order,size)
+      print *,'Status returned from he5_ptinqdatatype():  ',status
+      print *,'dtype:        ',dtype
+      print *,'class ID:     ',classid
+      print *,'order:        ',order
+      print *,'size:         ',size
+
+
+      fieldname    = 'Observations'
+      fieldgroup   = HE5_HDFE_LOCATTRGROUP
+      attrname     = 'LocalAttribute'
+
+      status = he5_ptinqdatatype(ptid,fieldname,attrname,fieldgroup,
+     1dtype,classid,order,size)
+      print *,'Status returned from he5_ptinqdatatype():  ',status
+      print *,'dtype:        ',dtype
+      print *,'class ID:     ',classid
+      print *,'order:        ',order
+      print *,'size:         ',size
+
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
diff --git a/samples/he5_pt_definelevels.c b/samples/he5_pt_definelevels.c
new file mode 100755
index 0000000..38a7f9a
--- /dev/null
+++ b/samples/he5_pt_definelevels.c
@@ -0,0 +1,395 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |  
+ ----------------------------------------------------------------------------  
+ */
+
+
+#include <HE5_HdfEosDef.h>
+
+/* File name: he5_pt_definelevels.c */
+/* -------------------------------- */
+
+/*
+ * In this example we will open the "Point.h5" HDF-EOS file 
+ *             and define the point levels.
+ */
+
+
+int main()
+{
+  herr_t            status = FAIL;
+
+  int               i;
+
+  hid_t             ptfid = FAIL, PTid = FAIL;
+
+  HE5_CmpDTSinfo    *dtsinfo;
+
+  typedef struct
+	{
+	  double          time;
+	  float           concentr[4];
+	  char            spec[8];
+
+	} InputData1;
+
+  typedef struct
+	{
+	  char        label[8];
+	  double      lon;
+	  double      lat;
+	  int         date;
+	  char        id[8];
+	} InputData2;
+
+
+  typedef struct
+	{
+	  double      time;
+	  float       rain;
+	  float       temp;
+	  char        id[8];
+	} InputData3;
+
+
+  typedef struct
+	{
+	  char        label[10];
+	  int         date;
+	  int         weight;
+	  char        id[8];
+	} InputData4;
+
+
+  typedef struct
+	{
+	  double      time;
+	  double      lon;
+	  double      lat;
+	  float       rain;
+	  float       temp;
+	  char        id[8];
+	} InputData5;
+
+
+  /*
+   * We first open the HDF-EOS point file, "Point.h5".  Because this file
+   * already exist and we wish to write to it, we use the H5F_ACC_RDWR access
+   * code in the open statement.  The PTopen routine returns the point file
+   * id, ptfid, which is used to identify the file in subsequent routines.
+   */
+
+  ptfid = HE5_PTopen("Point.h5", H5F_ACC_RDWR);
+  if (ptfid != FAIL)
+    {
+	  /* Simple Point */
+	  /* ------------ */
+	  PTid = HE5_PTattach(ptfid, "Simple Point");
+
+      dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo));
+
+	  /* Set up level data structure */
+	  /* --------------------------- */
+	  dtsinfo->nfields = 3;
+
+	  dtsinfo->rank[0] = 1;
+	  dtsinfo->rank[1] = 1;
+	  dtsinfo->rank[2] = 1;
+
+	  dtsinfo->offset[0] = HOFFSET(InputData1, time);
+	  dtsinfo->offset[1] = HOFFSET(InputData1, concentr);
+	  dtsinfo->offset[2] = HOFFSET(InputData1, spec);
+	  
+	  dtsinfo->dtype[0] = H5T_NATIVE_DOUBLE;
+	  dtsinfo->dtype[1] = H5T_NATIVE_FLOAT;
+	  dtsinfo->dtype[2] = H5T_NATIVE_CHAR;
+
+	  dtsinfo->array[0] = 0;
+	  dtsinfo->array[1] = 1;
+	  dtsinfo->array[2] = 1;
+
+	  for (i = 0; i < 3; i++)
+		dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char));
+
+	  strcpy(dtsinfo->fieldname[0],"Time");
+	  strcpy(dtsinfo->fieldname[1],"Concentration");
+	  strcpy(dtsinfo->fieldname[2],"Species");
+	  
+	  dtsinfo->dims[0][0] = 1;
+	  dtsinfo->dims[1][0] = 4;
+	  dtsinfo->dims[2][0] = 8;
+
+      dtsinfo->datasize = (size_t)sizeof(InputData1);
+	
+	  status = HE5_PTdeflevel(PTid, "Sensor", dtsinfo);
+	  printf("Status returned by HE5_PTdeflevel() :   %d \n", status);
+	  
+	  for (i = 0; i < 3; i++)
+		{
+		  free(dtsinfo->fieldname[i]);
+		  dtsinfo->fieldname[i] = NULL;
+		}
+
+	  free(dtsinfo);
+
+
+	  HE5_PTdetach(PTid);
+
+	  /* Fixed Buoy Point */
+	  /* ---------------- */
+	  PTid = HE5_PTattach(ptfid, "FixedBuoy Point");
+
+      dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo));
+
+	  /* Set up level data struvcture */
+	  /* ---------------------------- */
+	  dtsinfo->nfields = 5;
+
+	  dtsinfo->rank[0] = 1;
+	  dtsinfo->rank[1] = 1;
+	  dtsinfo->rank[2] = 1;
+	  dtsinfo->rank[3] = 1;
+	  dtsinfo->rank[4] = 1;
+
+	  dtsinfo->array[0] = 1;
+	  dtsinfo->array[1] = 0;
+	  dtsinfo->array[2] = 0;
+	  dtsinfo->array[3] = 0;
+	  dtsinfo->array[4] = 1;
+
+	  dtsinfo->offset[0] = HOFFSET(InputData2, label);
+	  dtsinfo->offset[1] = HOFFSET(InputData2, lon);
+	  dtsinfo->offset[2] = HOFFSET(InputData2, lat);
+	  dtsinfo->offset[3] = HOFFSET(InputData2, date);
+	  dtsinfo->offset[4] = HOFFSET(InputData2, id);
+	  
+	  dtsinfo->dtype[0] = H5T_NATIVE_CHAR;
+	  dtsinfo->dtype[1] = H5T_NATIVE_DOUBLE;
+	  dtsinfo->dtype[2] = H5T_NATIVE_DOUBLE;
+	  dtsinfo->dtype[3] = H5T_NATIVE_INT;
+	  dtsinfo->dtype[4] = H5T_NATIVE_CHAR;
+
+	  for (i = 0; i < 5; i++)
+		dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char));
+
+	  strcpy(dtsinfo->fieldname[0],"Label");
+	  strcpy(dtsinfo->fieldname[1],"Longitude");
+	  strcpy(dtsinfo->fieldname[2],"Latitude");
+	  strcpy(dtsinfo->fieldname[3],"DeployDate");
+	  strcpy(dtsinfo->fieldname[4],"ID");
+	  
+	  dtsinfo->dims[0][0] = 8;
+	  dtsinfo->dims[1][0] = 1;
+	  dtsinfo->dims[2][0] = 1;
+	  dtsinfo->dims[3][0] = 1;
+	  dtsinfo->dims[4][0] = 8;
+
+      dtsinfo->datasize = (size_t)sizeof(InputData2);
+
+	  status = HE5_PTdeflevel(PTid, "Desc-Loc", dtsinfo);
+	  printf("Status returned by HE5_PTdeflevel() :   %d \n", status);
+
+	  for (i = 0; i < 5; i++)
+		free(dtsinfo->fieldname[i]);
+
+	  free(dtsinfo);
+
+	  dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo));
+	  
+	  /* Set up level data structure */
+	  /* --------------------------- */
+	  dtsinfo->nfields = 4;
+
+	  dtsinfo->rank[0] = 1;
+	  dtsinfo->rank[1] = 1;
+	  dtsinfo->rank[2] = 1;
+	  dtsinfo->rank[3] = 1;
+
+	  dtsinfo->array[0] = 0;
+	  dtsinfo->array[1] = 0;
+	  dtsinfo->array[2] = 0;
+	  dtsinfo->array[3] = 1;
+
+	  dtsinfo->offset[0] = HOFFSET(InputData3, time);
+	  dtsinfo->offset[1] = HOFFSET(InputData3, rain);
+	  dtsinfo->offset[2] = HOFFSET(InputData3, temp);
+	  dtsinfo->offset[3] = HOFFSET(InputData3, id);
+	  
+	  dtsinfo->dtype[0] = H5T_NATIVE_DOUBLE;
+	  dtsinfo->dtype[1] = H5T_NATIVE_FLOAT;
+	  dtsinfo->dtype[2] = H5T_NATIVE_FLOAT;
+	  dtsinfo->dtype[3] = H5T_NATIVE_CHAR;
+
+	  for (i = 0; i < 4; i++)
+		dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char));
+
+	  strcpy(dtsinfo->fieldname[0],"Time");
+	  strcpy(dtsinfo->fieldname[1],"Rainfall");
+	  strcpy(dtsinfo->fieldname[2],"Temperature");
+	  strcpy(dtsinfo->fieldname[3],"ID");
+	  
+	  dtsinfo->dims[0][0] = 1;
+	  dtsinfo->dims[1][0] = 1;
+	  dtsinfo->dims[2][0] = 1;
+	  dtsinfo->dims[3][0] = 8;
+
+      dtsinfo->datasize = (size_t)sizeof(InputData3);
+
+	  status = HE5_PTdeflevel(PTid, "Observations", dtsinfo);
+	  printf("Status returned by HE5_PTdeflevel() :   %d \n", status);
+
+	  for (i = 0; i < 4; i++)
+		free(dtsinfo->fieldname[i]);
+
+	  free(dtsinfo);
+
+
+	  status = HE5_PTdeflinkage(PTid, "Desc-Loc", "Observations", "ID");
+	  printf("Status returned by HE5_PTdeflinkage() : %d \n", status);
+
+	  status = HE5_PTdetach(PTid);
+	  printf("Status returned by HE5_PTdetach() :     %d\n", status);
+	
+	  /* Floating Buoy Point */
+	  /* ------------------- */
+	  PTid = HE5_PTattach(ptfid, "FloatBuoy Point");
+
+
+	  dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo));
+
+	  /* Set up level data structure */
+	  /* --------------------------- */
+	  dtsinfo->nfields = 4;
+
+	  dtsinfo->rank[0] = 1;
+	  dtsinfo->rank[1] = 1;
+	  dtsinfo->rank[2] = 1;
+	  dtsinfo->rank[3] = 1;
+
+	  dtsinfo->array[0] = 1;
+	  dtsinfo->array[1] = 0;
+	  dtsinfo->array[2] = 0;
+	  dtsinfo->array[3] = 1;
+
+	  dtsinfo->offset[0] = HOFFSET(InputData4, label);
+	  dtsinfo->offset[1] = HOFFSET(InputData4, date);
+	  dtsinfo->offset[2] = HOFFSET(InputData4, weight);
+	  dtsinfo->offset[3] = HOFFSET(InputData4, id);
+	  
+	  dtsinfo->dtype[0] = H5T_NATIVE_CHAR;
+	  dtsinfo->dtype[1] = H5T_NATIVE_INT;
+	  dtsinfo->dtype[2] = H5T_NATIVE_INT;
+	  dtsinfo->dtype[3] = H5T_NATIVE_CHAR;
+
+	  for (i = 0; i < 4; i++)
+		dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char));
+
+	  strcpy(dtsinfo->fieldname[0],"Label");
+	  strcpy(dtsinfo->fieldname[1],"DeployDate");
+	  strcpy(dtsinfo->fieldname[2],"Weight");
+	  strcpy(dtsinfo->fieldname[3],"ID");
+	  
+	  dtsinfo->dims[0][0] = 8;
+	  dtsinfo->dims[1][0] = 1;
+	  dtsinfo->dims[2][0] = 1;
+	  dtsinfo->dims[3][0] = 8;
+
+      dtsinfo->datasize = (size_t)sizeof(InputData4);
+
+	  status = HE5_PTdeflevel(PTid, "Description",dtsinfo );
+	  printf("Status returned by HE5_PTdeflevel() :   %d \n", status);
+
+	  for (i = 0; i < 4; i++)
+		free(dtsinfo->fieldname[i]);
+
+	  free(dtsinfo);
+
+
+	  /* Define Data Level */
+
+	  dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo));
+	  
+	  /* Set up level data structure */
+	  /* --------------------------- */
+	  dtsinfo->nfields = 6;
+
+	  dtsinfo->rank[0] = 1;
+	  dtsinfo->rank[1] = 1;
+	  dtsinfo->rank[2] = 1;
+	  dtsinfo->rank[3] = 1;
+	  dtsinfo->rank[4] = 1;
+	  dtsinfo->rank[5] = 1;
+
+	  dtsinfo->array[0] = 0;
+	  dtsinfo->array[1] = 0;
+	  dtsinfo->array[2] = 0;
+	  dtsinfo->array[3] = 0;
+	  dtsinfo->array[4] = 0;
+	  dtsinfo->array[5] = 1;
+
+	  dtsinfo->offset[0] = HOFFSET(InputData5, time);
+	  dtsinfo->offset[1] = HOFFSET(InputData5, lon);
+	  dtsinfo->offset[2] = HOFFSET(InputData5, lat);
+	  dtsinfo->offset[3] = HOFFSET(InputData5, rain);
+	  dtsinfo->offset[4] = HOFFSET(InputData5, temp);
+	  dtsinfo->offset[5] = HOFFSET(InputData5, id);
+	  
+	  dtsinfo->dtype[0] = H5T_NATIVE_DOUBLE;
+	  dtsinfo->dtype[1] = H5T_NATIVE_DOUBLE;
+	  dtsinfo->dtype[2] = H5T_NATIVE_DOUBLE;
+	  dtsinfo->dtype[3] = H5T_NATIVE_FLOAT;
+	  dtsinfo->dtype[4] = H5T_NATIVE_FLOAT;
+	  dtsinfo->dtype[5] = H5T_NATIVE_CHAR;
+
+	  for (i = 0; i < 6; i++)
+		dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char));
+
+	  strcpy(dtsinfo->fieldname[0],"Time");
+	  strcpy(dtsinfo->fieldname[1],"Longitude");
+	  strcpy(dtsinfo->fieldname[2],"Latitude");
+	  strcpy(dtsinfo->fieldname[3],"Rainfall");
+	  strcpy(dtsinfo->fieldname[4],"Temperature");
+	  strcpy(dtsinfo->fieldname[5],"ID");
+	  
+	  dtsinfo->dims[0][0] = 1;
+	  dtsinfo->dims[1][0] = 1;
+	  dtsinfo->dims[2][0] = 1;
+	  dtsinfo->dims[3][0] = 1;
+	  dtsinfo->dims[4][0] = 1;
+	  dtsinfo->dims[5][0] = 8;
+
+      dtsinfo->datasize = (size_t)sizeof(InputData5);
+
+	  status = HE5_PTdeflevel(PTid, "Measurements", dtsinfo);
+	  printf("Status returned by HE5_PTdeflevel() :   %d \n", status);
+
+	  for (i = 0; i < 6; i++)
+		free(dtsinfo->fieldname[i]);	  
+
+	  free(dtsinfo);
+
+	  status = HE5_PTdeflinkage(PTid, "Description", "Measurements", "ID");
+	  printf("Status returned by HE5_PTdeflinkage() : %d \n", status);
+
+		  
+	  HE5_PTdetach(PTid);
+	  HE5_PTclose(ptfid);
+	}
+  else 
+    {
+	  printf("File ID returned by HE5_PTopen() : %d \n", ptfid);
+    }
+  
+  return 0;
+}
+  
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_pt_definelevelsF_32.f b/samples/he5_pt_definelevelsF_32.f
new file mode 100755
index 0000000..b5866bc
--- /dev/null
+++ b/samples/he5_pt_definelevelsF_32.f
@@ -0,0 +1,271 @@
+      program       he5_pt_definelevelsF_32
+
+      implicit      none
+
+      include      'hdfeos5.inc'
+
+      integer       status
+      integer       ptfid 
+      integer       ptid
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptdeflevel 
+      integer       he5_ptdeflinkage 
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+      integer       rank_1(3)
+      integer       rank_2(5)
+      integer       rank_3(4)
+      integer       rank_4(4)
+      integer       rank_5(6)
+      integer       dtype_1(3)
+      integer       dtype_2(5)
+      integer       dtype_3(4)
+      integer       dtype_4(4)
+      integer       dtype_5(6)
+      integer       array_1(3)
+      integer       array_2(5)
+      integer       array_3(4)
+      integer       array_4(4)
+      integer       array_5(6)
+
+      integer*4     dims_1(3,1)
+      integer*4     dims_2(5,1)
+      integer*4     dims_3(4,1)
+      integer*4     dims_4(4,1)
+      integer*4     dims_5(6,1)
+
+      character*240 fieldlist1
+      character*240 fieldlist2
+      character*240 fieldlist3
+      character*240 fieldlist4
+      character*240 fieldlist5
+      character*80  levelname
+      character*20  parent
+      character*20  child
+      character*20  linkfield
+
+c     Open the HDF point file, "point.he5"
+c     -----------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Read Simple Point 
+c     ----------------- 
+      ptid = HE5_PTattach(ptfid, "Simple Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+
+c     Populate input information structure 
+c     ------------------------------------ 
+      levelname = 'Sensor'
+
+      rank_1(1)  = 1
+      rank_1(2)  = 1
+      rank_1(3)  = 1
+
+      fieldlist1 = 'Time,Concentration,Species'
+
+      dtype_1(1)     =  HE5T_NATIVE_DOUBLE
+      dtype_1(2)     =  HE5T_NATIVE_FLOAT
+      dtype_1(3)     =  HE5T_NATIVE_CHAR
+
+      array_1(1)     =  0
+      array_1(2)     =  1
+      array_1(3)     =  1
+
+      dims_1(1,1)    =  1
+      dims_1(2,1)    =  4
+      dims_1(3,1)    =  8
+
+      status = he5_ptdeflevel(ptid, levelname, rank_1, fieldlist1,
+     1dims_1, dtype_1, array_1)
+      write(*,*) 'Status returned by he5_ptdeflevel():  ',status
+
+c     Close out the point interface
+c     -----------------------------
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+c     Read Fixed Buoy Point 
+c     --------------------- 
+      ptid = HE5_PTattach(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Populate input information structure 
+c     ------------------------------------ 
+      levelname = 'Desc-Loc'
+
+      rank_2(1)  = 1
+      rank_2(2)  = 1
+      rank_2(3)  = 1
+      rank_2(4)  = 1
+      rank_2(5)  = 1
+
+      fieldlist2 = 'Label,Longitude,Latitude,DeployDate,ID'
+
+      dtype_2(1)     =  HE5T_NATIVE_CHAR
+      dtype_2(2)     =  HE5T_NATIVE_DOUBLE
+      dtype_2(3)     =  HE5T_NATIVE_DOUBLE
+      dtype_2(4)     =  HE5T_NATIVE_INT
+      dtype_2(5)     =  HE5T_NATIVE_CHAR
+
+      array_2(1)  = 1
+      array_2(2)  = 0
+      array_2(3)  = 0
+      array_2(4)  = 0
+      array_2(5)  = 1
+
+      dims_2(1,1)      =  8
+      dims_2(2,1)      =  1
+      dims_2(3,1)      =  1
+      dims_2(4,1)      =  1
+      dims_2(5,1)      =  8
+
+      status = he5_ptdeflevel(ptid, levelname, rank_2, fieldlist2,
+     1dims_2, dtype_2, array_2)
+      write(*,*) 'Status returned by he5_ptdeflevel():  ',status
+
+
+c     Populate input information structure 
+c     ------------------------------------ 
+      levelname = 'Observations'
+
+      rank_3(1)  = 1
+      rank_3(2)  = 1
+      rank_3(3)  = 1
+      rank_3(4)  = 1
+
+      fieldlist3 = 'Time,Rainfall,Temperature,ID'
+
+      dtype_3(1)  =  HE5T_NATIVE_DOUBLE
+      dtype_3(2)  =  HE5T_NATIVE_FLOAT
+      dtype_3(3)  =  HE5T_NATIVE_FLOAT
+      dtype_3(4)  =  HE5T_NATIVE_CHAR
+
+      array_3(1)  = 0
+      array_3(2)  = 0
+      array_3(3)  = 0
+      array_3(4)  = 1
+
+      dims_3(1,1) =  1
+      dims_3(2,1) =  1
+      dims_3(3,1) =  1
+      dims_3(4,1) =  8
+
+      status = he5_ptdeflevel(ptid, levelname, rank_3, fieldlist3,
+     1dims_3, dtype_3, array_3)
+      write(*,*) 'Status ID returned by he5_ptdeflevel():  ',status
+
+      parent    = 'Desc-Loc'
+      child     = 'Observations'
+      linkfield = 'ID'
+
+      status = he5_ptdeflinkage(ptid, parent, child, linkfield)
+      write(*,*) 'Status ID returned by he5_ptdeflinkage():  ',status
+
+c     Close out the point interface
+c     -----------------------------
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+c     Read Floating Buoy Point 
+c     --------------------- 
+      ptid = HE5_PTattach(ptfid, "FloatBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Populate input information structure 
+c     ------------------------------------ 
+      levelname = 'Description'
+
+      rank_4(1)  = 1
+      rank_4(2)  = 1
+      rank_4(3)  = 1
+      rank_4(4)  = 1
+
+      fieldlist4 = 'Label,DeployDate,Weight,ID'
+
+      dtype_4(1)  =  HE5T_NATIVE_CHAR
+      dtype_4(2)  =  HE5T_NATIVE_INT
+      dtype_4(3)  =  HE5T_NATIVE_INT
+      dtype_4(4)  =  HE5T_NATIVE_CHAR
+
+      array_4(1)  = 1
+      array_4(2)  = 0
+      array_4(3)  = 0
+      array_4(4)  = 1
+
+      dims_4(1,1) =  8
+      dims_4(2,1) =  1
+      dims_4(3,1) =  1
+      dims_4(4,1) =  8
+
+      status = he5_ptdeflevel(ptid, levelname, rank_4, fieldlist4,
+     1dims_4, dtype_4, array_4)
+      write(*,*) 'Status returned by he5_ptdeflevel():  ',status
+
+c     Populate input information structure 
+c     ------------------------------------ 
+      levelname = 'Measurements'
+
+      rank_5(1)  = 1
+      rank_5(2)  = 1
+      rank_5(3)  = 1
+      rank_5(4)  = 1
+      rank_5(5)  = 1
+      rank_5(6)  = 1
+
+      fieldlist5 = 'Time,Longitude,Latitude,Rainfall,Temperature,ID'
+
+      dtype_5(1)     =  HE5T_NATIVE_DOUBLE
+      dtype_5(2)     =  HE5T_NATIVE_DOUBLE
+      dtype_5(3)     =  HE5T_NATIVE_DOUBLE
+      dtype_5(4)     =  HE5T_NATIVE_FLOAT
+      dtype_5(5)     =  HE5T_NATIVE_FLOAT
+      dtype_5(6)     =  HE5T_NATIVE_CHAR
+
+      array_5(1)  = 0
+      array_5(2)  = 0
+      array_5(3)  = 0
+      array_5(4)  = 0
+      array_5(5)  = 0
+      array_5(6)  = 1
+
+      dims_5(1,1)      =  1
+      dims_5(2,1)      =  1
+      dims_5(3,1)      =  1
+      dims_5(4,1)      =  1
+      dims_5(5,1)      =  1
+      dims_5(6,1)      =  8
+
+      status = he5_ptdeflevel(ptid, levelname, rank_5, fieldlist5,
+     1dims_5, dtype_5, array_5)
+      write(*,*) 'Status returned by he5_ptdeflevel():  ',status
+
+      parent    = 'Description'
+      child     = 'Measurements'
+      linkfield = 'ID'
+
+      status = he5_ptdeflinkage(ptid, parent, child, linkfield)
+      write(*,*) 'Status ID returned by he5_ptdeflinkage():  ',status
+
+c     Close out the point interface
+c     -----------------------------
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_pt_definelevelsF_64.f b/samples/he5_pt_definelevelsF_64.f
new file mode 100755
index 0000000..d711f7d
--- /dev/null
+++ b/samples/he5_pt_definelevelsF_64.f
@@ -0,0 +1,271 @@
+      program       he5_pt_definelevelsF_64
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+      integer       status
+      integer       ptfid 
+      integer       ptid
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptdeflevel 
+      integer       he5_ptdeflinkage 
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+      integer       rank_1(3)
+      integer       rank_2(5)
+      integer       rank_3(4)
+      integer       rank_4(4)
+      integer       rank_5(6)
+      integer       dtype_1(3)
+      integer       dtype_2(5)
+      integer       dtype_3(4)
+      integer       dtype_4(4)
+      integer       dtype_5(6)
+      integer       array_1(3)
+      integer       array_2(5)
+      integer       array_3(4)
+      integer       array_4(4)
+      integer       array_5(6)
+
+      integer*8     dims_1(3,1)
+      integer*8     dims_2(5,1)
+      integer*8     dims_3(4,1)
+      integer*8     dims_4(4,1)
+      integer*8     dims_5(6,1)
+
+      character*240 fieldlist1
+      character*240 fieldlist2
+      character*240 fieldlist3
+      character*240 fieldlist4
+      character*240 fieldlist5
+      character*80  levelname
+      character*20  parent
+      character*20  child
+      character*20  linkfield
+
+c     Open the HDF-EOS point file, "point.he5"
+c     ----------------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Read Simple Point 
+c     ----------------- 
+      ptid = HE5_PTattach(ptfid, "Simple Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Populate input information structure 
+c     ------------------------------------ 
+      levelname = 'Sensor'
+
+      rank_1(1)  = 1
+      rank_1(2)  = 1
+      rank_1(3)  = 1
+
+      fieldlist1 = 'Time,Concentration,Species'
+
+      dtype_1(1)     =  HE5T_NATIVE_DOUBLE
+      dtype_1(2)     =  HE5T_NATIVE_FLOAT
+      dtype_1(3)     =  HE5T_NATIVE_CHAR
+
+      array_1(1)     =  0
+      array_1(2)     =  1
+      array_1(3)     =  1
+
+      dims_1(1,1)      =  1
+      dims_1(2,1)      =  4
+      dims_1(3,1)      =  8
+
+      status = he5_ptdeflevel(ptid, levelname, rank_1, fieldlist1,
+     1dims_1, dtype_1, array_1)
+      write(*,*) 'Status returned by he5_ptdeflevel():  ',status
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+c     Read Fixed Buoy Point 
+c     --------------------- 
+      ptid = HE5_PTattach(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+
+c     Populate input information structure 
+c     ------------------------------------ 
+
+      levelname = 'Desc-Loc'
+
+      rank_2(1)  = 1
+      rank_2(2)  = 1
+      rank_2(3)  = 1
+      rank_2(4)  = 1
+      rank_2(5)  = 1
+
+      fieldlist2 = 'Label,Longitude,Latitude,DeployDate,ID'
+
+      dtype_2(1)     =  HE5T_NATIVE_CHAR
+      dtype_2(2)     =  HE5T_NATIVE_DOUBLE
+      dtype_2(3)     =  HE5T_NATIVE_DOUBLE
+      dtype_2(4)     =  HE5T_NATIVE_INT
+      dtype_2(5)     =  HE5T_NATIVE_CHAR
+
+      array_2(1)  = 1
+      array_2(2)  = 0
+      array_2(3)  = 0
+      array_2(4)  = 0
+      array_2(5)  = 1
+
+      dims_2(1,1)      =  8
+      dims_2(2,1)      =  1
+      dims_2(3,1)      =  1
+      dims_2(4,1)      =  1
+      dims_2(5,1)      =  8
+
+      status = he5_ptdeflevel(ptid, levelname, rank_2, fieldlist2,
+     1dims_2, dtype_2, array_2)
+      write(*,*) 'Status returned by he5_ptdeflevel():  ',status
+
+
+c     Populate input information structure 
+c     ------------------------------------ 
+
+      levelname = 'Observations'
+
+      rank_3(1)  = 1
+      rank_3(2)  = 1
+      rank_3(3)  = 1
+      rank_3(4)  = 1
+
+      fieldlist3 = 'Time,Rainfall,Temperature,ID'
+
+      dtype_3(1)     =  HE5T_NATIVE_DOUBLE
+      dtype_3(2)     =  HE5T_NATIVE_FLOAT
+      dtype_3(3)     =  HE5T_NATIVE_FLOAT
+      dtype_3(4)     =  HE5T_NATIVE_CHAR
+
+      array_3(1)  = 0
+      array_3(2)  = 0
+      array_3(3)  = 0
+      array_3(4)  = 1
+
+      dims_3(1,1)      =  1
+      dims_3(2,1)      =  1
+      dims_3(3,1)      =  1
+      dims_3(4,1)      =  8
+
+      status = he5_ptdeflevel(ptid, levelname, rank_3, fieldlist3,
+     1dims_3, dtype_3, array_3)
+      write(*,*) 'Status ID returned by he5_ptdeflevel():  ',status
+
+      parent    = 'Desc-Loc'
+      child     = 'Observations'
+      linkfield = 'ID'
+
+      status = he5_ptdeflinkage(ptid, parent, child, linkfield)
+      write(*,*) 'Status ID returned by he5_ptdeflinkage():  ',status
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+
+c     Read Floating Buoy Point 
+c     --------------------- 
+      ptid = HE5_PTattach(ptfid, "FloatBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+
+c     Populate input information structure 
+c     ------------------------------------ 
+
+      levelname = 'Description'
+
+      rank_4(1)  = 1
+      rank_4(2)  = 1
+      rank_4(3)  = 1
+      rank_4(4)  = 1
+
+      fieldlist4 = 'Label,DeployDate,Weight,ID'
+
+      dtype_4(1)     =  HE5T_NATIVE_CHAR
+      dtype_4(2)     =  HE5T_NATIVE_INT
+      dtype_4(3)     =  HE5T_NATIVE_INT
+      dtype_4(4)     =  HE5T_NATIVE_CHAR
+
+      array_4(1)  = 1
+      array_4(2)  = 0
+      array_4(3)  = 0
+      array_4(4)  = 1
+
+      dims_4(1,1)      =  8
+      dims_4(2,1)      =  1
+      dims_4(3,1)      =  1
+      dims_4(4,1)      =  8
+
+      status = he5_ptdeflevel(ptid, levelname, rank_4, fieldlist4,
+     1dims_4, dtype_4, array_4)
+      write(*,*) 'Status returned by he5_ptdeflevel():  ',status
+
+c     Populate input information structure 
+c     ------------------------------------ 
+
+      levelname = 'Measurements'
+
+      rank_5(1)  = 1
+      rank_5(2)  = 1
+      rank_5(3)  = 1
+      rank_5(4)  = 1
+      rank_5(5)  = 1
+      rank_5(6)  = 1
+
+      fieldlist5 = 'Time,Longitude,Latitude,Rainfall,Temperature,ID'
+
+      dtype_5(1)     =  HE5T_NATIVE_DOUBLE
+      dtype_5(2)     =  HE5T_NATIVE_DOUBLE
+      dtype_5(3)     =  HE5T_NATIVE_DOUBLE
+      dtype_5(4)     =  HE5T_NATIVE_FLOAT
+      dtype_5(5)     =  HE5T_NATIVE_FLOAT
+      dtype_5(6)     =  HE5T_NATIVE_CHAR
+
+      array_5(1)  = 0
+      array_5(2)  = 0
+      array_5(3)  = 0
+      array_5(4)  = 0
+      array_5(5)  = 0
+      array_5(6)  = 1
+
+      dims_5(1,1)      =  1
+      dims_5(2,1)      =  1
+      dims_5(3,1)      =  1
+      dims_5(4,1)      =  1
+      dims_5(5,1)      =  1
+      dims_5(6,1)      =  8
+
+      status = he5_ptdeflevel(ptid, levelname, rank_5, fieldlist5,
+     1dims_5, dtype_5, array_5)
+      write(*,*) 'Status returned by he5_ptdeflevel():  ',status
+
+      parent    = 'Description'
+      child     = 'Measurements'
+      linkfield = 'ID'
+
+      status = he5_ptdeflinkage(ptid, parent, child, linkfield)
+      write(*,*) 'Status ID returned by he5_ptdeflinkage():  ',status
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
+
diff --git a/samples/he5_pt_readattrs.c b/samples/he5_pt_readattrs.c
new file mode 100755
index 0000000..3d08bd1
--- /dev/null
+++ b/samples/he5_pt_readattrs.c
@@ -0,0 +1,116 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999  Emergent IT Inc.  and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+
+#include <HE5_HdfEosDef.h>
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  int             i, attr;
+  int             attr1[5], attr2[5];
+
+  hid_t           ptfid = FAIL, PTid = FAIL;    
+
+  hid_t           *nt = (hid_t *)NULL;
+
+  long            nattr, strbufsize;
+    
+  hsize_t         sz;
+ 
+  char            attrlist[256] ;
+
+
+  /* Open the HDF-EOS file, "Point.h5" */
+  /* --------------------------------- */
+  ptfid = HE5_PTopen("Point.h5", H5F_ACC_RDONLY);
+  printf("File ID returned by HE5_PTopen() :       %d \n", ptfid);
+
+  PTid = HE5_PTattach(ptfid, "FixedBuoy Point");
+  printf("Point ID returned by HE5_PTattach() :    %d \n", PTid);
+
+  nt = (hid_t *)calloc(1, sizeof(hid_t));
+
+  /* Global attributes */
+  /* ---------------- */
+  printf("Global Attribute: \n");
+  status = HE5_PTreadattr(PTid, "GlobalAttribute_int", &attr);
+  printf("Status returned by HE5_PTreadattr() :    %d \n", status);
+  printf("Attribute value:                         %d\n", attr);
+
+  nattr = HE5_PTinqattrs(PTid, NULL, &strbufsize);
+  printf("Number of attributes:                    %li\n", nattr);
+  printf("Size (in bytes) of attribute list:       %li\n", strbufsize);
+  nattr = HE5_PTinqattrs(PTid, attrlist, &strbufsize);
+  printf("Attribute list:                          %s\n", attrlist);
+
+  status = HE5_PTattrinfo(PTid, "GlobalAttr_Integer", nt, &sz);
+  printf("Data type of attribute:                  %d\n", (int)*nt);
+  printf("Number of attribute elements:            %d\n", (int)sz);
+
+
+  /* Group attributes */
+  /* ---------------- */
+  printf("\n");
+  printf("Group Attribute: \n");
+  status = HE5_PTreadgrpattr(PTid, "GroupAttribute", attr1);
+  printf("Status returned by HE5_PTreadgrpattr() : %d \n", status);
+  printf("Attribute values: \n");
+  for (i = 0; i < 5; i++)
+    {
+	  printf("\t\t %d \n", attr1[i]);
+    }    
+  nattr = HE5_PTinqgrpattrs(PTid, NULL, &strbufsize);
+  printf("Number of attributes:                    %li\n", nattr);
+  printf("Size (in bytes) of attribute list:       %li\n", strbufsize);
+  nattr = HE5_PTinqgrpattrs(PTid, attrlist, &strbufsize);
+  printf("Attribute list:                          %s\n", attrlist);
+
+  status = HE5_PTgrpattrinfo(PTid, "GroupAttribute", nt, &sz);
+  printf("Data type of attribute:                  %d\n",(int)*nt);
+  printf("Number of attribute elements:            %d\n", (int)sz);
+
+  /* Local attributes */
+  /* ---------------- */
+  printf("\n");
+  printf("Local Attribute: \n");
+  status = HE5_PTreadlocattr(PTid, "Observations", "LocalAttribute", attr2);
+  printf("Status returned by HE5_PTreadlocattr() : %d \n", status);
+  printf("Attribute values: \n");
+  for (i = 0; i < 5; i++)
+    {
+	  printf("\t\t %d \n", attr2[i]);
+    }    
+  nattr = HE5_PTinqlocattrs(PTid, "Observations", NULL, &strbufsize);
+  printf("Number of attributes:                    %li\n", nattr);
+  printf("Size (in bytes) of attribute list:       %li\n", strbufsize);
+  nattr = HE5_PTinqlocattrs(PTid, "Observations", attrlist, &strbufsize);
+  printf("Attribute list:                          %s\n", attrlist);
+
+  status = HE5_PTlocattrinfo(PTid, "Observations", "LocalAttribute", nt, &sz);
+  printf("Data type of attribute:                  %d\n", (int)*nt);
+  printf("Number of attribute elements:            %d\n", (int)sz);
+
+
+  free(nt);
+	
+  status = HE5_PTdetach(PTid);
+  printf("Status returned by HE5_PTdetach() :      %d \n", status);
+
+  status = HE5_PTclose(ptfid);
+  printf("Status returned by HE5_PTclose() :       %d \n", status);
+
+  return 0;
+}
+
+
+
+
+
+
+
diff --git a/samples/he5_pt_readattrsF_32.f b/samples/he5_pt_readattrsF_32.f
new file mode 100755
index 0000000..4e39933
--- /dev/null
+++ b/samples/he5_pt_readattrsF_32.f
@@ -0,0 +1,150 @@
+      program       he5_pt_readattrsF_32
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+      integer       status
+      integer       ptfid 
+      integer       ptid
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptinqattrs
+      integer       he5_ptinqgrpattrs
+      integer       he5_ptinqlocattrs
+      integer       he5_ptattrinfo
+      integer       he5_ptgrpattrinfo
+      integer       he5_ptlocattrinfo
+      integer       he5_ptreadattr
+      integer       he5_ptreadgrpattr
+      integer       he5_ptreadlocattr
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+      integer       attr
+      integer       attr1(5)
+      integer       attr2(5)
+      integer       ntype
+
+      integer*4     sz
+      integer*4     strbufsize
+      integer*4     nattr
+
+      real*4        flt      
+
+      character*1   null_char_0
+      character*80  attrname
+      character*80  levelname
+      character*240 attrlist
+
+      null_char_0  = '0'
+
+c     Open the HDF-EOS point file, "point.he5"
+c     ----------------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Read FixedBuoy Point 
+c     -------------------- 
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Global Attributes
+c     -----------------
+      attrname       = 'GlobalAttribute_int'
+             
+      print *,'Global Attribute:   '
+      status   = he5_ptreadattr(ptid,attrname,attr)
+      write(*,*) 'Status returned by he5_ptreadattr():  ',status
+      print *,'Attribute value:    ',attr
+
+     
+      nattr   = he5_ptinqattrs(ptid,null_char_0,strbufsize)
+      print *,'Number of attributes:  ',nattr
+      print *,'Size (in bytes) of attribute list:  ',strbufsize
+
+      nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)
+      print *,'Number of attributes:  ',nattr
+      print *,'Attribute list:  ',attrlist
+
+      attrname       = 'GlobalAttribute_int'
+
+      status   = he5_ptattrinfo(ptid,attrname,ntype,sz)
+      write(*,*) 'Status returned by he5_ptattrinfo():  ',status
+      print *,'Data type of attribute:        ',ntype
+      print *,'Number of attribute elements:  ',sz
+
+      print *,'   '
+      attrname       = 'GlobalAttribute_float'
+      print *,'attrname:    ',attrname
+
+      status   = he5_ptattrinfo(ptid,attrname,ntype,sz)
+      write(*,*) 'Status returned by he5_ptattrinfo():  ',status
+      print *,'Data type of attribute:        ',ntype
+      print *,'Number of attribute elements:  ',sz
+
+      status   = he5_ptreadattr(ptid,attrname,flt)
+      write(*,*) 'Status returned by he5_ptreadattr():  ',status
+      print *,'Attribute value:    ',flt
+
+      attrname       = 'GroupAttribute'
+
+c     Global Attributes
+c     -----------------
+      print *, 'Group Attribute:'
+      status = he5_ptreadgrpattr(ptid,attrname,attr1)
+      print *,'Status returned by he5_ptreadgrpattr():  ',status
+      print *,'Attribute values:  ',attr1
+
+
+      nattr = he5_ptinqgrpattrs(ptid,null_char_0,strbufsize)
+      print *,'Number of attributes:               ',nattr
+      print *,'Size (in bytes) of attribute list:  ',strbufsize
+      nattr = he5_ptinqgrpattrs(ptid,attrlist,strbufsize)
+      print *,'Attribute list:  ',attrlist
+
+      attrname       = 'GroupAttribute'
+
+      status   = he5_ptgrpattrinfo(ptid,attrname,ntype,sz)
+      write(*,*) 'Status returned by he5_ptgrpattrinfo():  ',status
+      print *,'Data type of attribute:        ',ntype
+      print *,'Number of attribute elements:  ',sz
+     
+c     Local Attributes
+c     ----------------
+      print *, 'Local Attribute:'
+
+      attrname       = 'LocalAttribute'
+      levelname      = 'Observations'
+
+      status = he5_ptreadlocattr(ptid,levelname,attrname,attr2)
+      print *,'Status returned by he5_ptreadlocattr():  ',status
+      print *,'Attribute values:  ',attr2
+
+      nattr = he5_ptinqlocattrs(ptid,levelname,null_char_0,strbufsize)
+      print *,'Status returned by he5_ptinqlocattrs():  ',status
+      print *,'Number of attributes:               ',nattr
+      print *,'Size (in bytes) of attribute list:  ',strbufsize
+
+      nattr = he5_ptinqlocattrs(ptid,levelname,attrlist,strbufsize)
+      print *,'Attribute list:  ',attrlist
+
+      status = he5_ptlocattrinfo(ptid,levelname,attrname,ntype,sz)
+      print *,'Data type of attribute:        ',ntype
+      print *,'Number of attribute elements:  ',sz
+
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
diff --git a/samples/he5_pt_readattrsF_64.f b/samples/he5_pt_readattrsF_64.f
new file mode 100755
index 0000000..1912c67
--- /dev/null
+++ b/samples/he5_pt_readattrsF_64.f
@@ -0,0 +1,152 @@
+      program       he5_pt_readattrsF_64
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+      integer       status
+      integer       ptfid 
+      integer       ptid
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptinqattrs
+      integer       he5_ptinqgrpattrs
+      integer       he5_ptinqlocattrs
+      integer       he5_ptattrinfo
+      integer       he5_ptgrpattrinfo
+      integer       he5_ptlocattrinfo
+      integer       he5_ptreadattr
+      integer       he5_ptreadgrpattr
+      integer       he5_ptreadlocattr
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+      integer       attr
+      integer       attr1(5)
+      integer       attr2(5)
+      integer       ntype
+
+      integer*8     sz
+      integer*8     strbufsize
+      integer*8     nattr
+
+      real*4        flt      
+
+      character*1   null_char_0
+      character*80  attrname
+      character*80  levelname
+      character*240 attrlist
+
+      null_char_0  = '0'
+
+c     Open the HDF-EOS point file, "point.he5"
+c     ----------------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Read FixedBuoy Point 
+c     -------------------- 
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Global Attributes
+c     -----------------
+      attrname       = 'GlobalAttribute_int'
+             
+      print *,'Global Attribute:   '
+      status   = he5_ptreadattr(ptid,attrname,attr)
+      write(*,*) 'Status returned by he5_ptreadattr():  ',status
+      print *,'Attribute value:    ',attr
+
+     
+      nattr   = he5_ptinqattrs(ptid,null_char_0,strbufsize)
+      print *,'Number of attributes:  ',nattr
+      print *,'Size (in bytes) of attribute list:  ',strbufsize
+
+      nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)
+      print *,'Number of attributes:  ',nattr
+      print *,'Attribute list:  ',attrlist
+
+      attrname       = 'GlobalAttribute_int'
+
+      status   = he5_ptattrinfo(ptid,attrname,ntype,sz)
+      write(*,*) 'Status returned by he5_ptattrinfo():  ',status
+      print *,'Data type of attribute:        ',ntype
+      print *,'Number of attribute elements:  ',sz
+
+      print *,'   '
+      attrname       = 'GlobalAttribute_float'
+      print *,'attrname:    ',attrname
+
+      status   = he5_ptattrinfo(ptid,attrname,ntype,sz)
+      write(*,*) 'Status returned by he5_ptattrinfo():  ',status
+      print *,'Data type of attribute:        ',ntype
+      print *,'Number of attribute elements:  ',sz
+
+      status   = he5_ptreadattr(ptid,attrname,flt)
+      write(*,*) 'Status returned by he5_ptreadattr():  ',status
+      print *,'Attribute value:    ',flt
+
+      attrname       = 'GroupAttribute'
+
+c     Global Attributes
+c     -----------------
+      print *, 'Group Attribute:'
+      status = he5_ptreadgrpattr(ptid,attrname,attr1)
+      print *,'Status returned by he5_ptreadgrpattr():  ',status
+      print *,'Attribute values:  ',attr1
+
+
+      nattr = he5_ptinqgrpattrs(ptid,null_char_0,strbufsize)
+      print *,'Number of attributes:               ',nattr
+      print *,'Size (in bytes) of attribute list:  ',strbufsize
+      nattr = he5_ptinqgrpattrs(ptid,attrlist,strbufsize)
+      print *,'Attribute list:  ',attrlist
+
+      attrname       = 'GroupAttribute'
+
+      status   = he5_ptgrpattrinfo(ptid,attrname,ntype,sz)
+      write(*,*) 'Status returned by he5_ptgrpattrinfo():  ',status
+      print *,'Data type of attribute:        ',ntype
+      print *,'Number of attribute elements:  ',sz
+     
+c     Local Attributes
+c     ----------------
+      print *, 'Local Attribute:'
+
+      attrname       = 'LocalAttribute'
+      levelname      = 'Observations'
+
+      status = he5_ptreadlocattr(ptid,levelname,attrname,attr2)
+      print *,'Status returned by he5_ptreadlocattr():  ',status
+      print *,'Attribute values:  ',attr2
+
+      nattr = he5_ptinqlocattrs(ptid,levelname,null_char_0,strbufsize)
+      print *,'Status returned by he5_ptinqlocattrs():  ',status
+      print *,'Number of attributes:               ',nattr
+      print *,'Size (in bytes) of attribute list:  ',strbufsize
+
+      nattr = he5_ptinqlocattrs(ptid,levelname,attrlist,strbufsize)
+      print *,'Attribute list:  ',attrlist
+
+      status = he5_ptlocattrinfo(ptid,levelname,attrname,ntype,sz)
+      print *,'Data type of attribute:        ',ntype
+      print *,'Number of attribute elements:  ',sz
+
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
+
+
diff --git a/samples/he5_pt_readdata.c b/samples/he5_pt_readdata.c
new file mode 100755
index 0000000..9bd269a
--- /dev/null
+++ b/samples/he5_pt_readdata.c
@@ -0,0 +1,197 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include <HE5_HdfEosDef.h>
+
+int main()
+{
+  herr_t          status = FAIL;/* return status variable         */
+
+  hid_t           ptfid = FAIL; /* HDFEOS Point file ID           */
+  hid_t           PTid  = FAIL; /* Point structure ID             */
+
+  int             i, j;        /* Loop indices                    */
+  int             nflds = FAIL;/* Number of level fields          */
+  int             IntAttr;     /* Integer attribute value         */
+
+  long            nattr;       /* Number of attributes            */
+  long            strbufsize;  /* Size of attribute list buffer   */
+
+  hsize_t         nrecs = 0;   /* Number of records in a level    */
+
+  size_t          datasize = 0;/* Size (in bytes) of data to read */
+
+  HE5_CmpDTSinfo  level;      /* Level information data structure */
+  HE5_CmpDTSinfo  inInfo;     /* Input information data structure */
+  HE5_CmpDTSinfo  inInfo2;    /* Input information data structure */
+
+
+  /* User-defined structure to read level data to */
+  /* -------------------------------------------- */
+  typedef struct {
+          double   time;
+          float    con[4];
+          char     spec[8];
+        } Sensor;
+
+  Sensor   s[50];
+  
+  double   s1[50];
+
+
+  /* Open the HDF-EOS file, "Point.h5" */
+  /* --------------------------------- */
+  ptfid = HE5_PTopen("Point.h5", H5F_ACC_RDONLY);
+  printf("File ID returned by HE5_PTopen() :           %d \n", ptfid);
+
+  /* Read Simple Point */
+  /* ----------------- */
+  PTid = HE5_PTattach(ptfid, "Simple Point");
+  printf("Point ID returned by HE5_PTattach() :        %d \n", PTid);
+
+  /* Get level information */
+  /* --------------------- */
+  status = HE5_PTlevelinfo(PTid, 0, &level);
+  printf("Status returned by HE5_PTlevelinfo() :       %d \n", status);
+  
+  nflds = level.nfields;
+  printf("Number of fields in level:   %d \n", nflds);
+  for (i = 0; i < nflds; i++)
+	{
+	  printf("Field name:                  %s \n", level.fieldname[i]);
+	  printf("Field rank:                  %d \n", level.rank[i]);
+	  printf("Field type ID:               %d \n", level.dtype[i]);
+	  for (j = 0; j < level.rank[i]; j++)
+		printf("Field dims:                  %d \n", (int)level.dims[i][j]);
+	  printf("Field class:                 %d \n", level.dclass[i]);
+	}
+
+  /* Get the number of records in level */
+  /* ---------------------------------- */
+  nrecs = HE5_PTnrecs(PTid, 0);
+  printf("Number of records in level:  %lu \n", (unsigned long)nrecs);
+
+  /* Set the data size */
+  /* ----------------- */
+  datasize = (size_t)sizeof(Sensor);
+
+  /* Populate input information structure */
+  /* ------------------------------------ */
+  inInfo.nfields    = nflds;
+  inInfo.datasize   = (size_t)sizeof(Sensor);
+
+  inInfo.rank[0]    = 1;
+  inInfo.rank[1]    = 1;
+  inInfo.rank[2]    = 1;
+
+  inInfo.offset[0]  = HOFFSET(Sensor, time);
+  inInfo.offset[1]  = HOFFSET(Sensor, con);
+  inInfo.offset[2]  = HOFFSET(Sensor, spec);
+
+  inInfo.dtype[0]   = H5T_NATIVE_DOUBLE;
+  inInfo.dtype[1]   = H5T_NATIVE_FLOAT;
+  inInfo.dtype[2]   = H5T_NATIVE_CHAR;
+
+  inInfo.dclass[0]  = H5T_NO_CLASS;
+  inInfo.dclass[1]  = H5T_NO_CLASS;
+  inInfo.dclass[2]  = H5T_NO_CLASS;
+
+  inInfo.dims[0][0] = 1;
+  inInfo.dims[1][0] = 4;
+  inInfo.dims[2][0] = 8;
+
+  inInfo.array[0] = 0;
+  inInfo.array[1] = 1;
+  inInfo.array[2] = 1;
+
+  for( i = 0; i < nflds; i++)
+  {
+	inInfo.fieldname[i] = (char *)calloc(64, sizeof(char));
+	strcpy(inInfo.fieldname[i], level.fieldname[i]);
+  }
+
+  /* Read the level data */
+  /* ------------------- */
+  status = HE5_PTreadlevel(PTid, 0, &inInfo, &datasize, s);
+  printf("Status returned by HE5_PTreadlevel() :       %d \n", status);
+  for (i = 0; i < nrecs; i++)
+	printf("%lf  %f  %f  %f  %f  %s\n", s[i].time, s[i].con[0], s[i].con[1], s[i].con[2], s[i].con[3], s[i].spec);
+
+
+  /* Release memory */
+  /* -------------- */
+  for (i = 0; i < nflds; i++)
+	if (inInfo.fieldname[i] != NULL) free(inInfo.fieldname[i]);
+
+  /* Set the data size */
+  /* ----------------- */
+  datasize = (size_t)sizeof(double);
+
+  /* Populate input information structure */
+  /* ------------------------------------ */
+  inInfo2.nfields    = 1;
+  inInfo2.datasize   = (size_t)sizeof(double);
+
+  inInfo2.rank[0]    = 1;
+
+  inInfo2.offset[0]  = 0;
+
+  inInfo2.dtype[0]   = H5T_NATIVE_DOUBLE;
+
+  inInfo2.dclass[0]  = H5T_FLOAT;
+
+  inInfo2.dims[0][0] = 1;
+
+  inInfo2.array[0]   = 0;
+
+  inInfo2.fieldname[0] = (char *)calloc(64, sizeof(char));
+  strcpy(inInfo2.fieldname[0], level.fieldname[0]);
+
+  /* Read the level data */
+  /* ------------------- */
+  status = HE5_PTreadlevel(PTid, 0, &inInfo2, &datasize, s1);
+  printf("Status returned by HE5_PTreadlevel() :       %d \n", status);
+  for (i = 0; i < nrecs; i++)
+	printf("%lf \n", s1[i]);
+  
+  /* Release memory */
+  /* -------------- */
+  if (inInfo2.fieldname[0] != NULL) 
+	free(inInfo2.fieldname[0]);
+  
+  for (i = 0; i < nflds; i++)
+	if(level.fieldname[i] != NULL) free(level.fieldname[i]);
+
+  status = HE5_PTdetach(PTid);
+  printf("Status returned by HE5_PTdetach() :          %d \n", status);
+    
+  PTid = HE5_PTattach(ptfid, "FixedBuoy Point");
+  printf("Point ID returned by HE5_PTattach() :        %d \n", PTid);
+
+  /* Read Fixed Buoy Point Attributes */
+  /* -------------------------------- */
+  nattr  = HE5_PTinqattrs(PTid, NULL, &strbufsize);
+  status = HE5_PTreadattr(PTid, "GlobalAttr_Integer", &IntAttr);
+  printf("Status returned by HE5_PTreadattr() :        %d \n", status);
+  printf(" \n");
+  printf("Integer attribute value:                     %d\n", IntAttr);
+	
+  status = HE5_PTdetach(PTid);
+  printf("Status returned by HE5_PTdetach() :          %d \n", status);
+
+  status = HE5_PTclose(ptfid);
+  printf("Status returned by HE5_PTclose() :           %d \n", status);
+
+  return 0;
+}
+
+
+
+
+
+
+
diff --git a/samples/he5_pt_readdataF_32.f b/samples/he5_pt_readdataF_32.f
new file mode 100755
index 0000000..cb4e5fa
--- /dev/null
+++ b/samples/he5_pt_readdataF_32.f
@@ -0,0 +1,174 @@
+      program       he5_pt_readdataF_32
+
+      implicit      none
+
+      include      'hdfeos5.inc'
+
+      integer       status
+      integer       ptfid 
+      integer       ptid
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptreadlevel
+      integer       he5_ptlevelinfo 
+      integer       he5_ptnrecs
+      integer       he5_ptnlevels
+      integer       he5_ptnfields
+      integer       he5_ptc2fort
+      integer       he5_ptinqattrs
+      integer       he5_ptreadattr
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+      integer       i
+      integer       nflds
+      integer       level
+      integer       arr_rank
+      integer       datatype
+      integer       dtype(3)
+      integer       attr
+      integer       nrecs
+      integer       nlevels
+
+      integer*4     dimens(2)
+      integer*4     datasize
+      integer*4     rank_tt(3)
+      integer*4     offset_tt(3)
+      integer*4     dtype_tt(3)
+      integer*4     dim_sizes_tt(3)
+      integer*4     nattr
+      integer*4     strbufsize
+
+      character*80  levelname
+      character*80  fieldname(3)
+      character*80  attrname
+      character*240 fieldlist
+      character*240 attrlist
+      character*8   spec(15)
+
+      real*4        con(4,15)
+      real*4        outcon(15,4)
+      real*8        time(15)
+
+
+c     Open the HDF-EOS point file, "point.he5"
+c     ----------------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Read Simple Point 
+c     ----------------- 
+      ptid = he5_ptattach(ptfid, "Simple Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Get level information 
+c     --------------------- 
+      level = 0
+
+      status = he5_ptlevelinfo(ptid, level, levelname, rank_tt,
+     1fieldlist, dim_sizes_tt, datasize, offset_tt, dtype_tt)
+      write(*,*) 'Status returned by he5_ptlevelinfo(): ',status
+
+c     Get the number of records in level
+c     ---------------------------------- 
+      level = 0
+      nrecs = he5_ptnrecs(ptid, level)
+      print *,'Number of records in level: ', nrecs
+
+      nlevels = he5_ptnlevels(ptid)
+      print *,'Number of levels in Point data set: ', nlevels
+
+      nflds = he5_ptnfields(ptid, level, fieldlist, strbufsize)
+      print *,'Number of fields in level: ', nflds
+
+c     Populate input information structure 
+c     ------------------------------------ 
+      dtype(1)     =  HE5T_NATIVE_DOUBLE
+      dtype(2)     =  HE5T_NATIVE_FLOAT
+      dtype(3)     =  HE5T_NATIVE_CHAR
+
+c     Read the level data and print out
+c     --------------------------------- 
+      fieldname(1)  = 'Time'
+
+      status = he5_ptreadlevel(ptid, 0, fieldname(1), 
+     1dtype(1), time)
+      write(*,*) 'Status returned by he5_ptreadlevel():  ',status
+
+      write(*,*) 'time array:    '
+      do i = 1,nrecs
+        print *,time(i)
+      end do
+
+      fieldname(2)  = 'Concentration'
+
+      status = he5_ptreadlevel(ptid, 0, fieldname(2),  
+     1dtype(2), con)  
+      write(*,*) 'Status returned by he5_ptreadlevel():  ',status
+
+c     Convert 'C' array to Fortran order
+c     ---------------------------------- 
+      dimens(1) = 15
+      dimens(2) = 4
+      arr_rank  = 2
+      datatype  = HE5T_NATIVE_FLOAT
+
+      status  = he5_ptc2fort(dimens, arr_rank, datatype, con, 
+     1outcon)
+      write(*,*) 'Status returned by he5_ptc2fort():  ',status
+
+      write(*,*) 'outcon array:    '
+      do i = 1,nrecs
+        print *,outcon(i,1),outcon(i,2),outcon(i,3),outcon(i,4) 
+      end do
+
+      fieldname(3)  = 'Species'
+
+      status = he5_ptreadlevel(ptid, 0, fieldname(3), 
+     1dtype(3), spec)  
+      write(*,*) 'Status returned by he5_ptreadlevel():  ',status
+
+      write(*,*) 'spec array:    '
+      do i = 1,nrecs
+        print *,spec(i)
+      end do
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+c     Read FixedBuoy Point 
+c     -------------------- 
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Global Attributes
+c     -----------------
+      attrname       = 'GlobalAttribute_int'
+
+      print *,'   '
+      print *,'Global Attribute:   '
+      nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)
+      print *,'Number of attributes:  ',nattr
+      print *,'Attribute list:  ',attrlist
+      print *,'Size (in bytes) of attribute list:  ',strbufsize
+
+      status   = he5_ptreadattr(ptid,attrname,attr)
+      write(*,*) 'Status returned by he5_ptreadattr():  ',status
+      print *,'Attribute value:    ',attr
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+
+      stop
+      end
+
+
+
+
+
+
diff --git a/samples/he5_pt_readdataF_64.f b/samples/he5_pt_readdataF_64.f
new file mode 100755
index 0000000..b3084d1
--- /dev/null
+++ b/samples/he5_pt_readdataF_64.f
@@ -0,0 +1,175 @@
+      program       he5_pt_readdataF_64
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+      integer       status
+      integer       ptfid 
+      integer       ptid
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptreadlevel
+      integer       he5_ptlevelinfo 
+      integer       he5_ptnrecs
+      integer       he5_ptnlevels
+      integer       he5_ptnfields
+      integer       he5_ptc2fort
+      integer       he5_ptinqattrs
+      integer       he5_ptreadattr
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+      integer       i
+      integer       nflds
+      integer       level
+      integer       arr_rank
+      integer       datatype
+      integer       dtype(3)
+      integer       attr
+      integer       rank_tt(3)
+      integer       dtype_tt(3)
+
+      integer       nrecs
+      integer       nlevels
+
+      integer*8     dimens(2)
+      integer*8     datasize
+      integer*8     offset_tt(3)
+      integer*8     dim_sizes_tt(3)
+      integer*8     nattr
+      integer*8     strbufsize
+
+      character*80  levelname
+      character*80  fieldname(3)
+      character*80  attrname
+      character*240 fieldlist
+      character*240 attrlist
+      character*8   spec(15)
+
+      real*4        con(4,15)
+      real*4        outcon(15,4)
+      real*8        time(15)
+
+
+c     Open the HDF-EOS point file, "point.he5"
+c     ----------------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Read Simple Point 
+c     ----------------- 
+      ptid = he5_ptattach(ptfid, "Simple Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Get level information 
+c     --------------------- 
+      level = 0
+
+      status = he5_ptlevelinfo(ptid, level, levelname, rank_tt,
+     1fieldlist, dim_sizes_tt, datasize, offset_tt, dtype_tt)
+      write(*,*) 'Status returned by he5_ptlevelinfo(): ',status
+
+c     Get the number of records in level
+c     ---------------------------------- 
+      level = 0
+      nrecs = he5_ptnrecs(ptid, level)
+      print *,'Number of records in level: ', nrecs
+
+      nlevels = he5_ptnlevels(ptid)
+      print *,'Number of levels in Point data set: ', nlevels
+
+      nflds = he5_ptnfields(ptid, level, fieldlist, strbufsize)
+      print *,'Number of fields in level: ', nflds
+
+c     Populate input information structure 
+c     ------------------------------------ 
+      dtype(1)     =  HE5T_NATIVE_DOUBLE
+      dtype(2)     =  HE5T_NATIVE_FLOAT
+      dtype(3)     =  HE5T_NATIVE_CHAR
+
+c     Read the level data and print out
+c     --------------------------------- 
+      fieldname(1)  = 'Time'
+
+      status = he5_ptreadlevel(ptid, 0, fieldname(1), 
+     1dtype(1), time)
+      write(*,*) 'Status returned by he5_ptreadlevel():  ',status
+
+      write(*,*) 'time array:    '
+      do i = 1,nrecs
+        print *,time(i)
+      end do
+
+      fieldname(2)  = 'Concentration'
+
+      status = he5_ptreadlevel(ptid, 0, fieldname(2),  
+     1dtype(2), con)  
+      write(*,*) 'Status returned by he5_ptreadlevel():  ',status
+
+c     Convert 'C' array to Fortran order
+c     ---------------------------------- 
+      dimens(1) = 15
+      dimens(2) = 4
+      arr_rank  = 2
+      datatype  = HE5T_NATIVE_FLOAT
+
+      status  = he5_ptc2fort(dimens, arr_rank, datatype, con, 
+     1outcon)
+      write(*,*) 'Status returned by he5_ptc2fort():  ',status
+
+      write(*,*) 'outcon array:    '
+      do i = 1,nrecs
+        print *,outcon(i,1),outcon(i,2),outcon(i,3),outcon(i,4) 
+      end do
+
+      fieldname(3)  = 'Species'
+
+      status = he5_ptreadlevel(ptid, 0, fieldname(3), 
+     1dtype(3), spec)  
+      write(*,*) 'Status returned by he5_ptreadlevel():  ',status
+
+      write(*,*) 'spec array:    '
+      do i = 1,nrecs
+        print *,spec(i)
+      end do
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+c     Read FixedBuoy Point 
+c     -------------------- 
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Global Attributes
+c     -----------------
+      attrname       = 'GlobalAttribute_int'
+
+      print *,'   '
+      print *,'Global Attribute:   '
+      nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)
+      print *,'Number of attributes:  ',nattr
+      print *,'Attribute list:  ',attrlist
+      print *,'Size (in bytes) of attribute list:  ',strbufsize
+
+      status   = he5_ptreadattr(ptid,attrname,attr)
+      write(*,*) 'Status returned by he5_ptreadattr():  ',status
+      print *,'Attribute value:    ',attr
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+
+      stop
+      end
+
+
+
+
+
+
diff --git a/samples/he5_pt_setup.c b/samples/he5_pt_setup.c
new file mode 100755
index 0000000..14eace7
--- /dev/null
+++ b/samples/he5_pt_setup.c
@@ -0,0 +1,57 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+/* File name: he5_pt_setup.c  */
+/* -------------------------- */
+
+
+#include <HE5_HdfEosDef.h>
+
+
+int main()
+{
+  herr_t  status = FAIL;
+
+  hid_t   ptfid  = FAIL;
+  hid_t   PTid1  = FAIL;
+  hid_t   PTid2  = FAIL;
+  hid_t   PTid3  = FAIL;
+
+  /*
+   * We first open the HDF-EOS point file, "Point.h5". Because this file
+   * does not already exist, we use the H5F_ACC_TRUNC access code in the
+   * open statement.  The PTopen routine returns the point file id, ptfid,
+   * which is used to identify the file in subsequent routines in the
+   * library.
+   */
+
+  ptfid = HE5_PTopen("Point.h5", H5F_ACC_TRUNC);
+
+  PTid1 = HE5_PTcreate(ptfid, "Simple Point");
+  PTid2 = HE5_PTcreate(ptfid, "FixedBuoy Point");
+  PTid3 = HE5_PTcreate(ptfid, "FloatBuoy Point");
+
+  /*
+   * We now close the point interface with the HE5_PTdetach routine.  This step
+   * is necessary to properly store the point information within the file.
+   */
+
+  status = HE5_PTdetach(PTid1);
+  status = HE5_PTdetach(PTid2);
+  status = HE5_PTdetach(PTid3);
+
+  /*
+   * Finally, we close the swath file using the PTclose routine.  This will
+   * release the point file handles established by PTopen.
+   */
+
+  status = HE5_PTclose(ptfid);
+  
+  return 0;
+}
+
+
diff --git a/samples/he5_pt_setupF_32.f b/samples/he5_pt_setupF_32.f
new file mode 100755
index 0000000..5b60dd1
--- /dev/null
+++ b/samples/he5_pt_setupF_32.f
@@ -0,0 +1,64 @@
+      program     he5_pt_setupF_32
+      
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status 
+      integer     ptfid 
+      integer     ptid1, ptid2, ptid3
+
+      integer     he5_ptopen
+      integer     he5_ptcreate
+      integer     he5_ptdetach
+      integer     he5_ptclose
+
+c --------------------------------------------------------------------------- c
+c     We first open the HDF-EOS point file, "point.he5". Because this file    c
+c     does not already exist, we use the "TRUNC" file  access code in the     c
+c     open statement.  The PTopen routine returns the point file id, ptfid,   c
+c     which is used to identify the file in subsequent routines in the        c
+c     library.                                                                c
+c --------------------------------------------------------------------------- c
+
+
+c     Open the HDF point file, "point.he5"
+c     -----------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_TRUNC)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+     
+
+      ptid1 = he5_ptcreate(ptfid, "Simple Point")
+      write(*,*) 'Point ID returned by he5_ptcreate():   ',ptid1
+      ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptcreate():   ',ptid2
+      ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptcreate():   ',ptid3
+
+
+c --------------------------------------------------------------------------- c
+c     We now close the point interface with the he5_ptdetach routine.         c
+c     This step is necessary to properly store the point information within   c
+c     the file.                                                               c
+c --------------------------------------------------------------------------- c
+
+      status = he5_ptdetach(ptid1)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+      status = he5_ptdetach(ptid2)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+      status = he5_ptdetach(ptid3)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
+
+
diff --git a/samples/he5_pt_setupF_64.f b/samples/he5_pt_setupF_64.f
new file mode 100755
index 0000000..88f5d28
--- /dev/null
+++ b/samples/he5_pt_setupF_64.f
@@ -0,0 +1,63 @@
+      program     he5_pt_setupF_64
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status 
+      integer     ptfid 
+      integer     ptid1
+      integer     ptid2
+      integer     ptid3
+
+      integer     he5_ptopen
+      integer     he5_ptcreate
+      integer     he5_ptdetach
+      integer     he5_ptclose
+
+c --------------------------------------------------------------------------- c
+c     We first open the HDF-EOS point file, "point.he5". Because this file    c
+c     does not already exist, we use the "TRUNC" file access code in the      c
+c     open statement.  The PTopen routine returns the point file id, ptfid,   c
+c     which is used to identify the file in subsequent routines in the        c
+c     library.                                                                c
+c --------------------------------------------------------------------------- c
+
+c     Open the HDF-EOS point file, "point.he5"
+c     ----------------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_TRUNC)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+     
+      ptid1 = he5_ptcreate(ptfid, "Simple Point")
+      write(*,*) 'Point ID returned by he5_ptcreate():   ',ptid1
+      ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptcreate():   ',ptid2
+      ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptcreate():   ',ptid3
+
+c --------------------------------------------------------------------------- c
+c     We now close the point interface with the he5_ptdetach routine.         c
+c     This step is necessary to properly store the point information within   c
+c     the file.                                                               c
+c --------------------------------------------------------------------------- c
+
+      status = he5_ptdetach(ptid1)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+      status = he5_ptdetach(ptid2)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+      status = he5_ptdetach(ptid3)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
+
+
diff --git a/samples/he5_pt_updatelevels.c b/samples/he5_pt_updatelevels.c
new file mode 100755
index 0000000..2d12518
--- /dev/null
+++ b/samples/he5_pt_updatelevels.c
@@ -0,0 +1,73 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include <HE5_HdfEosDef.h>
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  hid_t           ptfid = FAIL;
+  hid_t           PTid1 = FAIL;
+
+  hssize_t        recs[32];
+    
+  hsize_t         nrec;
+
+  typedef struct 
+	{
+	  double    Time;
+	  float     Conc[4];
+	  char      Spc[8];
+	} CmpData_1;
+
+  CmpData_1  buf_1;
+
+  buf_1.Time    = 13131313.0;
+
+  buf_1.Conc[0] = 1.11;
+  buf_1.Conc[1] = 2.22;
+  buf_1.Conc[2] = 3.33;
+  buf_1.Conc[3] = 4.44;
+
+  strcpy(buf_1.Spc,"AM");
+
+  /* -------------------------------------------------------------- */
+  /* NOTE: To update all records, set "nrec" => 0 or "recs" => NULL */
+  /*       the data buffer should be properly populated             */
+  /* -------------------------------------------------------------- */
+
+  /* Open the HDF-EOS file, "Point.h5" */
+  /* --------------------------------- */
+  ptfid = HE5_PTopen("Point.h5", H5F_ACC_RDWR);
+  if (ptfid != FAIL)
+    {
+	  PTid1 = HE5_PTattach(ptfid, "Simple Point");
+	  if (PTid1 != FAIL)
+		{
+		  nrec    = 1;
+		  recs[0] = 0;
+		  status = HE5_PTupdatelevel(PTid1, 0, "Concentration", nrec, recs, &buf_1);
+		  printf("Status returned by HE5_PTupdatelevel() :  %d \n", status);
+		  
+		}
+
+	  status = HE5_PTdetach(PTid1);
+	  printf("Status returned by HE5_PTdetach() :       %d \n", status);
+    }
+
+  status = HE5_PTclose(ptfid);
+    
+  return 0;
+}
+
+
+
+
+
+
+
diff --git a/samples/he5_pt_updatelevelsF_32.f b/samples/he5_pt_updatelevelsF_32.f
new file mode 100755
index 0000000..7c4215b
--- /dev/null
+++ b/samples/he5_pt_updatelevelsF_32.f
@@ -0,0 +1,100 @@
+      program       he5_pt_updatelevelsF_32
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+      integer       status
+      integer       ptfid 
+      integer       ptid
+      integer       level
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptupdatelevel 
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+      integer       dtype(3)
+
+      integer*4     recs(32)
+      integer*4     nrec
+
+      real*4        conc_tt(4)
+
+      real*8        time_tt
+
+      character*8   spc_tt
+      character*80  fieldname
+
+
+c     Open the HDF point file, "point.he5"
+c     ------------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Read Simple Point 
+c     ----------------- 
+      ptid = HE5_PTattach(ptfid, "Simple Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+      dtype(1)     =  HE5T_NATIVE_DOUBLE
+      dtype(2)     =  HE5T_NATIVE_FLOAT
+      dtype(3)     =  HE5T_NATIVE_CHAR
+
+      nrec      = 1
+      recs(1)   = 0
+
+      level     = 0
+
+      fieldname = 'Concentration'
+
+      conc_tt(1)   = 1.11
+      conc_tt(2)   = 2.22
+      conc_tt(3)   = 3.33
+      conc_tt(4)   = 4.44
+
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, dtype(2), conc_tt)
+      write(*,*) 'Status returned by he5_ptupdatelevel():  ',status
+
+      fieldname = 'Time'
+
+      time_tt   = 13131313.0
+
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, dtype(1), time_tt)
+      write(*,*) 'Status returned by he5_ptupdatelevel():  ',status
+
+      fieldname = 'Species'
+
+      spc_tt    = 'AM'
+
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, dtype(3), spc_tt)
+      write(*,*) 'Status returned by he5_ptupdatelevel():  ',status
+
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+
+      stop
+      end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_pt_updatelevelsF_32_a.f b/samples/he5_pt_updatelevelsF_32_a.f
new file mode 100755
index 0000000..2cba2b9
--- /dev/null
+++ b/samples/he5_pt_updatelevelsF_32_a.f
@@ -0,0 +1,180 @@
+
+
+
+
+      program       he5_pt_updatelevelsF_32
+
+      integer       status
+      integer       ptfid 
+      integer       ptid
+      integer       level
+      integer       rank, datatype
+
+      integer*4     recs(32)
+      integer*4     nrec
+
+      integer*4     dimens(2)
+      integer*4     num_elements
+
+      real*4        concentration_tt(4)
+      real*4        conc(15,4)
+      real*4        conc_tt(4)
+      real*4        outconc(4,15)
+      real*8        time(15)
+      real*8        time_tt
+
+      character*8   spc(15)
+      character*8   spc_tt
+
+      character*80  fieldname
+
+      integer       datasize_time
+      integer       datasize_conc
+      integer       datasize_spc
+      integer       dtype(3)
+
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptupdatelevel 
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+
+
+c     Open the HDF-EOS point file, "point.he5"
+c     ----------------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Read Simple Point 
+c     ----------------- 
+      ptid = HE5_PTattach(ptfid, "Simple Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+
+      open(unit=1, file='simple_a.txt', status='OLD')
+
+      n = 0
+      do 10 i=1,1000
+         read(1, *, end=100) time_tt, concentration_tt(1), 
+     1                                concentration_tt(2), 
+     2                                concentration_tt(3),
+     3                                concentration_tt(4), 
+     4                                spc_tt
+         time(i)     = time_tt
+         conc(i,1)   = concentration_tt(1)
+         conc(i,2)   = concentration_tt(2)
+         conc(i,3)   = concentration_tt(3)
+         conc(i,4)   = concentration_tt(4)
+         spc(i)      = spc_tt
+
+         n = n + 1
+   10 continue
+
+  100 close(unit=1)
+
+
+      print *,'n = ',n
+      do i = 1,n
+        print *,time(i)
+        print *,conc(i,1),conc(i,2),conc(i,3),conc(i,4)
+        print *,spc(i)
+      end do
+
+c.....specify the storage size of each atomic field
+      datasize_time  = 8
+      datasize_conc  = 4*4
+      datasize_spc   = 8*1
+
+      dtype(1)     =  HE5T_NATIVE_DOUBLE
+      dtype(2)     =  HE5T_NATIVE_FLOAT
+      dtype(3)     =  HE5T_NATIVE_CHAR
+
+
+cc... One way that works
+      nrec      = 0
+      recs(1)   = 0
+
+cc... Another way that works 
+cc      nrec      = n
+cc      do i = 1,n
+cc         recs(i)   = i-1
+cc      end do
+
+      level     = 0
+
+      fieldname = 'Concentration'
+
+cc      conc_tt(1)   = 1.11
+cc      conc_tt(2)   = 2.22
+cc      conc_tt(3)   = 3.33
+cc      conc_tt(4)   = 4.44
+
+
+c.....Convert array to 'C' order
+      dimens(1) = 15
+      dimens(2) = 4
+      rank      = 2
+      datatype  = HE5T_NATIVE_FLOAT
+
+      num_elements   = he5_ptfort2c(dimens, rank, datatype, conc, 
+     1outconc)
+      write(*,*) 'num_elements returned by he5_ptfort2c():  ',num_elements
+
+c      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+c     1recs, datasize_conc, dtype(2), conc)
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, datasize_conc, dtype(2), outconc)
+      write(*,*) 'Status returned by he5_ptupdatelevel():  ',status
+
+cc      print *,nrec
+cc      print *,recs
+
+      fieldname = 'Time'
+
+cc      time_tt   = 13131313.0
+
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, datasize_time, dtype(1), time)
+      write(*,*) 'Status returned by he5_ptupdatelevel():  ',status
+
+cc      print *,nrec
+cc      print *,recs
+
+      fieldname = 'Species'
+
+cc      spc_tt    = 'AM'
+
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, datasize_spc, dtype(3), spc)
+      write(*,*) 'Status returned by he5_ptupdatelevel():  ',status
+
+cc      print *,nrec
+cc      print *,recs
+
+
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+
+      stop
+      end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_pt_updatelevelsF_64.f b/samples/he5_pt_updatelevelsF_64.f
new file mode 100755
index 0000000..ec40b90
--- /dev/null
+++ b/samples/he5_pt_updatelevelsF_64.f
@@ -0,0 +1,99 @@
+      program       he5_pt_updatelevelsF_64
+
+      implicit      none
+ 
+      include       'hdfeos5.inc'
+ 
+      integer       status
+      integer       ptfid 
+      integer       ptid
+      integer       level
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptupdatelevel 
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+      integer       dtype(3)
+
+      integer*8     recs(32)
+      integer*8     nrec
+
+      real*4        conc_tt(4)
+
+      real*8        time_tt
+
+      character*8   spc_tt
+      character*80  fieldname
+
+c     Open the HDF-EOS point file, "point.he5"
+c     ----------------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Read Simple Point 
+c     ----------------- 
+      ptid = HE5_PTattach(ptfid, "Simple Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+      dtype(1)     =  HE5T_NATIVE_DOUBLE
+      dtype(2)     =  HE5T_NATIVE_FLOAT
+      dtype(3)     =  HE5T_NATIVE_CHAR
+
+      nrec         = 1
+      recs(1)      = 0
+
+      level        = 0
+
+      fieldname    = 'Concentration'
+
+      conc_tt(1)   = 1.11
+      conc_tt(2)   = 2.22
+      conc_tt(3)   = 3.33
+      conc_tt(4)   = 4.44
+
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, dtype(2), conc_tt)
+      write(*,*) 'Status returned by he5_ptupdatelevel():  ',status
+
+      fieldname = 'Time'
+
+      time_tt   = 13131313.0
+
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, dtype(1), time_tt)
+      write(*,*) 'Status returned by he5_ptupdatelevel():  ',status
+
+      fieldname = 'Species'
+
+      spc_tt    = 'AM'
+
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, dtype(3), spc_tt)
+      write(*,*) 'Status returned by he5_ptupdatelevel():  ',status
+
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+
+      stop
+      end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_pt_writeattrs.c b/samples/he5_pt_writeattrs.c
new file mode 100755
index 0000000..7cf5620
--- /dev/null
+++ b/samples/he5_pt_writeattrs.c
@@ -0,0 +1,73 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include <HE5_HdfEosDef.h>
+
+
+int main()
+{
+  herr_t      status = FAIL;
+
+  int         attr       = 9999;                  /* Global attribute */     
+  int         attr1[ 5 ] = { 1, 2, 3, 4, 5};      /* Group attribute  */   
+  int         attr2[ 5 ] = { 10, 20, 30, 40, 50}; /* Local attribute  */
+
+  hid_t       ptfid = FAIL, PTid = FAIL;
+
+  hsize_t     count[8];
+ 
+  float       flt = -7.5;                         /* Global attribute */
+    
+
+
+  /* Open the HDF-EOS file, "Point.h5" */
+  /* --------------------------------- */
+  ptfid = HE5_PTopen("Point.h5", H5F_ACC_RDWR);
+  printf("File ID returned by HE5_PTopen() :         %d \n", ptfid);
+
+  /* Write attribute to "Fixed Buoy Point" */
+  /* ------------------------------------- */
+  PTid = HE5_PTattach(ptfid, "FixedBuoy Point");
+  printf("Point ID returned by HE5_PTattach() :      %d \n", PTid);
+
+  count[0] = 1;
+  status = HE5_PTwriteattr(PTid, "GlobalAttribute_int", H5T_NATIVE_INT, count, &attr);
+  printf("Status returned by HE5_PTwriteattr() :     %d \n", status);
+
+  count[0] = 5;
+  status = HE5_PTwritegrpattr(PTid, "GroupAttribute", H5T_NATIVE_INT, count, attr1);
+  printf("Status returned by HE5_PTwritegrpattr() :  %d \n", status);
+
+  status = HE5_PTwritelocattr(PTid, "Observations", "LocalAttribute", H5T_NATIVE_INT, count, attr2);
+  printf("Status returned by HE5_PTwritelocattr() :  %d \n", status);
+
+  status = HE5_PTdetach(PTid);
+  printf("Status returned by HE5_PTdetach() :        %d \n", status);
+    
+  /* Write attributes to "Floating Buoy Point" */
+  /* ----------------------------------------- */
+  PTid = HE5_PTattach(ptfid, "FloatBuoy Point");
+  printf("Point ID returned by HE5_PTattach() :      %d \n", PTid);
+
+  count[0] = 1;    
+  status = HE5_PTwriteattr(PTid, "GlobalAttribute_float", H5T_NATIVE_FLOAT, count, &flt);
+  printf("Status returned by HE5_PTwriteattr() :     %d \n", status);    
+
+  status = HE5_PTdetach(PTid);
+  printf("Status returned by HE5_PTdetach() :        %d \n", status);
+
+  status = HE5_PTclose(ptfid);
+  printf("Status returned by HE5_PTclose() :         %d \n", status);
+
+  return 0;
+}
+
+
+
+
+
+
diff --git a/samples/he5_pt_writeattrsF_32.f b/samples/he5_pt_writeattrsF_32.f
new file mode 100755
index 0000000..6ce6513
--- /dev/null
+++ b/samples/he5_pt_writeattrsF_32.f
@@ -0,0 +1,109 @@
+      program       he5_pt_writeattrsF_32
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+      integer       status
+      integer       ptfid 
+      integer       ptid
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptwriteattr
+      integer       he5_ptwritegrpattr
+      integer       he5_ptwritelocattr
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+      integer       attr,attr1(5)
+      integer       attr2(5)
+      integer       ntype
+
+      integer*4     fortcount(8)
+
+      real*4        flt      
+
+      character*80  attrname,levelname
+
+
+c     Open the HDF point file, "point.he5"
+c     -----------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Read Simple Point 
+c     ----------------- 
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Write attributes to "Fixed Buoy Point"
+c     --------------------------------------
+      attrname       = 'GlobalAttribute_int'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 1
+      attr           = 9999
+             
+      status   = he5_ptwriteattr(ptid,attrname,ntype,fortcount,
+     1attr)
+      write(*,*) 'Status returned by he5_ptwriteattr():  ',status
+
+      attrname       = 'GroupAttribute'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 5
+      attr1(1)       = 1
+      attr1(2)       = 2
+      attr1(3)       = 3
+      attr1(4)       = 4
+      attr1(5)       = 5
+
+      status   = he5_ptwritegrpattr(ptid,attrname,ntype,fortcount,
+     1attr1)
+      write(*,*) 'Status returned by he5_ptwritegrpattr():  ',status
+
+      levelname      = 'Observations'
+      attrname       = 'LocalAttribute'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 5
+      attr2(1)       = 10
+      attr2(2)       = 20
+      attr2(3)       = 30
+      attr2(4)       = 40
+      attr2(5)       = 50
+
+      status   = he5_ptwritelocattr(ptid,levelname,attrname,
+     1ntype,fortcount,attr2)
+      write(*,*) 'Status returned by he5_ptwritelocattr():  ',status
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+
+c     Write attributes to "Fixed Buoy Point"
+c     --------------------------------------
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+      attrname       = 'GlobalAttribute_float'
+      ntype          = HE5T_NATIVE_FLOAT
+      fortcount(1)   = 1
+      flt            = -7.5
+
+      status   = he5_ptwriteattr(ptid,attrname,
+     1ntype,fortcount,flt)
+      write(*,*) 'Status returned by he5_ptwriteattr():  ',status
+
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+      stop
+      end
+
+
+
+
+
diff --git a/samples/he5_pt_writeattrsF_64.f b/samples/he5_pt_writeattrsF_64.f
new file mode 100755
index 0000000..26a2847
--- /dev/null
+++ b/samples/he5_pt_writeattrsF_64.f
@@ -0,0 +1,109 @@
+      program       he5_pt_writeattrsF_64
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+      integer       status
+      integer       ptfid 
+      integer       ptid
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptwriteattr
+      integer       he5_ptwritegrpattr
+      integer       he5_ptwritelocattr
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+      integer       attr,attr1(5)
+      integer       attr2(5)
+      integer       ntype
+
+      integer*8     fortcount(8)
+
+      real*4        flt      
+
+      character*80  attrname
+      character*80  levelname
+
+c     Open the HDF-EOS point file, "point.he5"
+c     ----------------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Read Simple Point 
+c     ----------------- 
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Write attributes to "Fixed Buoy Point"
+c     --------------------------------------
+      attrname       = 'GlobalAttribute_int'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 1
+      attr           = 9999
+             
+      status   = he5_ptwriteattr(ptid,attrname,ntype,fortcount,
+     1attr)
+      write(*,*) 'Status returned by he5_ptwriteattr():  ',status
+
+      attrname       = 'GroupAttribute'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 5
+      attr1(1)       = 1
+      attr1(2)       = 2
+      attr1(3)       = 3
+      attr1(4)       = 4
+      attr1(5)       = 5
+
+      status   = he5_ptwritegrpattr(ptid,attrname,ntype,fortcount,
+     1attr1)
+      write(*,*) 'Status returned by he5_ptwritegrpattr():  ',status
+
+      levelname      = 'Observations'
+      attrname       = 'LocalAttribute'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 5
+      attr2(1)       = 10
+      attr2(2)       = 20
+      attr2(3)       = 30
+      attr2(4)       = 40
+      attr2(5)       = 50
+
+      status   = he5_ptwritelocattr(ptid,levelname,attrname,
+     1ntype,fortcount,attr2)
+      write(*,*) 'Status returned by he5_ptwritelocattr():  ',status
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+
+c     Write attributes to "Fixed Buoy Point"
+c     --------------------------------------
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+      attrname       = 'GlobalAttribute_float'
+      ntype          = HE5T_NATIVE_FLOAT
+      fortcount(1)   = 1
+      flt            = -7.5
+
+      status   = he5_ptwriteattr(ptid,attrname,
+     1ntype,fortcount,flt)
+      write(*,*) 'Status returned by he5_ptwriteattr():  ',status
+
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+      stop
+      end
+
+
+
+
+
diff --git a/samples/he5_pt_writedata.c b/samples/he5_pt_writedata.c
new file mode 100755
index 0000000..1bd687a
--- /dev/null
+++ b/samples/he5_pt_writedata.c
@@ -0,0 +1,314 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+#include <HE5_HdfEosDef.h>
+
+  typedef struct 
+	{
+	  double    Time;
+	  float     Conc[4];
+	  char      Spc[8];
+	} CmpData_1;
+
+
+  typedef struct 
+	{
+	  char      Label[8];
+	  double    Lon;
+	  double    Lat;
+	  int       Date;
+	  char      Id[8];
+	} CmpData_2;
+
+  typedef struct
+	{
+          double      Time;
+          float       Rain;
+          float       Temp;
+          char        Id[8];
+	} CmpData_3;
+
+  typedef struct
+        {
+          char        Label[10];
+          int         Date;
+          int         Weight;
+          char        Id[8];
+        } CmpData_4;
+
+  typedef struct
+	{
+	  double      Time;
+	  double      Lon;
+	  double      Lat;
+	  float       Rain;
+	  float       Temp;
+	  char        Id[8];
+	} CmpData_5;
+
+
+#define NAMEBUF_SIZE 100
+
+int main()
+{
+  FILE            *fp;
+
+  herr_t          status = FAIL;
+
+  int             n, date, wgt, IntAttr = 9999;
+
+  hid_t           ptfid = FAIL, PTid = FAIL;
+
+  hsize_t         count[1];
+  
+  size_t          datasize = 0;
+  
+  float           conc[4], rain, temp, flt = -7.5;
+
+  double          time, lon, lat;
+
+  char            spc[8], desc[16], id[ 2 ];    
+
+  char            namebuf[NAMEBUF_SIZE];
+
+  char            *srcdir;
+
+
+  CmpData_1 datbuf_1[20];
+  CmpData_2 datbuf_2[5];
+  CmpData_3 datbuf_3[25];
+  CmpData_4 datbuf_4[5];
+  CmpData_5 datbuf_5[30];
+
+  /* Open the HDF-EOS file, "Point.h5" */
+  /* --------------------------------- */
+  ptfid = HE5_PTopen("Point.h5", H5F_ACC_RDWR);
+
+  /* Write to Simple Point */
+  /* --------------------- */
+  PTid = HE5_PTattach(ptfid, "Simple Point");
+
+  /* Open input data file */
+  /* -------------------- */
+
+  /* Set up path if the input file is in another directory */
+  srcdir = getenv("srcdir");
+  if(srcdir != NULL && (strlen(srcdir) + strlen("simple.txt") + 2) <= NAMEBUF_SIZE)
+  {  
+    strcpy(namebuf, srcdir);
+    strcat(namebuf, "/simple.txt");
+  }
+  else
+  {
+    strcpy(namebuf, "simple.txt");
+  }
+
+  fp = fopen(namebuf, "rb");
+  n = 0;
+  while(fscanf(fp, "%lf %f %f %f %f %s", &time, &conc[0], &conc[1], &conc[2], &conc[3], spc) != -1)
+    {
+ 	  datbuf_1[n].Time    = time;
+	  datbuf_1[n].Conc[0] = conc[0];
+	  datbuf_1[n].Conc[1] = conc[1];
+	  datbuf_1[n].Conc[2] = conc[2];
+	  datbuf_1[n].Conc[3] = conc[3];
+	  memmove(datbuf_1[n].Spc, spc, sizeof(char)*strlen(spc));
+	  datbuf_1[n].Spc[strlen(spc)] = 0;
+	  n++;
+    }
+
+  fclose(fp);
+    
+  datasize = (size_t)sizeof(CmpData_1);
+  count[0] = n;
+
+  status = HE5_PTwritelevel(PTid, 0, count, &datasize, datbuf_1);
+  printf("Status returned by HE5_PTwritelevel() :   %d \n", status);
+    
+  status = HE5_PTdetach(PTid);
+  printf("Status returned by HE5_PTdetach() :       %d \n", status);
+    
+  /* Write to Fixed Buoy Point */
+  /* ------------------------- */
+  PTid = HE5_PTattach(ptfid, "FixedBuoy Point");
+
+
+  /* Write First (0th) Level */
+  /* ----------------------- */
+
+  /* Set up path if the input file is in another directory */
+  srcdir = getenv("srcdir");
+  if(srcdir != NULL && (strlen(srcdir) + strlen("simple.txt") + 2) <= NAMEBUF_SIZE)
+  {  
+    strcpy(namebuf, srcdir);
+    strcat(namebuf, "/fixedBuoy0.txt");
+  }
+  else
+  {
+    strcpy(namebuf, "fixedBuoy0.txt");
+  }
+
+  fp = fopen(namebuf, "r");
+
+  n = 0;
+  while(fscanf(fp, "%s %lf %lf %d  %s", desc, &lon, &lat, &date, id) != -1)
+    {
+	  strcpy(datbuf_2[n].Label, desc);
+ 	  datbuf_2[n].Lon     = lon;
+ 	  datbuf_2[n].Lat     = lat;
+ 	  datbuf_2[n].Date    = date;
+ 	  memmove(datbuf_2[n].Id, id, sizeof(char)*strlen(id));
+	  datbuf_2[n].Id[strlen(id)] = 0;
+	  n++;
+    }
+
+  fclose(fp);
+    
+  datasize = (size_t)sizeof(CmpData_2);
+  count[0] = n;
+
+  status = HE5_PTwritelevel(PTid, 0, count, &datasize, datbuf_2);
+  printf("Status returned by HE5_PTwritelevel() :   %d \n", status);
+
+
+  /* Write Second (1th) Level */
+  /* ------------------------ */
+
+  /* Set up path if the input file is in another directory */
+  srcdir = getenv("srcdir");
+  if(srcdir != NULL && (strlen(srcdir) + strlen("simple.txt") + 2) <= NAMEBUF_SIZE)
+  {  
+    strcpy(namebuf, srcdir);
+    strcat(namebuf, "/fixedBuoy1.txt");
+  }
+  else
+  {
+    strcpy(namebuf, "fixedBuoy1.txt");
+  }
+
+  fp = fopen(namebuf, "r");
+
+  n = 0;
+  while(fscanf(fp, "%lf %f %f %s", &time, &rain, &temp, id) != -1)
+    {
+	  datbuf_3[n].Time = time;
+	  datbuf_3[n].Rain = rain;
+	  datbuf_3[n].Temp = temp;
+	  memmove(datbuf_3[n].Id, id, sizeof(char)*strlen(id));
+	  datbuf_3[n].Id[strlen(id)] = 0;
+	  n++;
+    }
+
+  fclose(fp);
+    
+  datasize = (size_t)sizeof(CmpData_3);
+  count[0] = n;
+
+  status = HE5_PTwritelevel(PTid, 1, count, &datasize, datbuf_3);
+  printf("Status returned by HE5_PTwritelevel() :   %d \n", status);
+
+  count[0] = 1;
+  status = HE5_PTwriteattr(PTid, "GlobalAttr_Integer", H5T_NATIVE_INT, count, &IntAttr);
+  printf("Status returned by HE5_PTwriteattr() :    %d \n", status);
+
+  status = HE5_PTdetach(PTid);
+  printf("Status returned by HE5_PTdetach() :       %d \n", status);
+
+
+  /* Write to Floating Buoy Point */
+  /* ---------------------------- */
+  PTid = HE5_PTattach(ptfid, "FloatBuoy Point");
+
+
+  /* Write First (0th) Level */
+  /* ----------------------- */
+
+  /* Set up path if the input file is in another directory */
+  srcdir = getenv("srcdir");
+  if(srcdir != NULL && (strlen(srcdir) + strlen("simple.txt") + 2) <= NAMEBUF_SIZE)
+  {  
+    strcpy(namebuf, srcdir);
+    strcat(namebuf, "/floatBuoy0.txt");
+  }
+  else
+  {
+    strcpy(namebuf, "floatBuoy0.txt");
+  }
+
+  fp = fopen(namebuf, "r");
+
+  n = 0;
+  while(fscanf(fp, "%s %d %d %s", desc, &date, &wgt, id) != -1)
+    {
+	  strcpy(datbuf_4[n].Label, desc);
+	  datbuf_4[n].Date   = date;
+	  datbuf_4[n].Weight = wgt;
+	  memmove(datbuf_4[n].Id, id, sizeof(char)*strlen(id));
+      datbuf_4[n].Id[strlen(id)] = 0;
+	  n++;
+    }
+  fclose(fp);
+    
+  datasize = (size_t)sizeof(CmpData_4);
+  count[0] = n;
+
+  status = HE5_PTwritelevel(PTid, 0, count, &datasize, datbuf_4);
+  printf("Status returned by HE5_PTwritelevel() :   %d \n", status);
+
+  /* Write Second (1th) Level */
+  /* ------------------------ */
+
+  /* Set up path if the input file is in another directory */
+  srcdir = getenv("srcdir");
+  if(srcdir != NULL && (strlen(srcdir) + strlen("simple.txt") + 2) <= NAMEBUF_SIZE)
+  {  
+    strcpy(namebuf, srcdir);
+    strcat(namebuf, "/floatBuoy1.txt");
+  }
+  else
+  {
+    strcpy(namebuf, "floatBuoy1.txt");
+  }
+
+  fp = fopen(namebuf, "r");
+
+  n = 0;
+  while(fscanf(fp, "%lf %lf %lf %f %f %s", &time, &lon, &lat, &rain, &temp, id) != -1)
+    {
+	  datbuf_5[n].Time = time;
+	  datbuf_5[n].Lon  = lon;
+	  datbuf_5[n].Lat  = lat;
+	  datbuf_5[n].Rain = rain;
+	  datbuf_5[n].Temp = temp;
+	  memmove(datbuf_5[n].Id, id,sizeof(char)*strlen(id));
+      datbuf_5[n].Id[strlen(id)] = 0;
+	  n++;
+    }
+  fclose(fp);
+
+  datasize = (size_t)sizeof(CmpData_5);
+  count[0] = n; 
+  status = HE5_PTwritelevel(PTid, 1, count, &datasize, datbuf_5);
+  printf("Status returned by HE5_PTwritelevel() :   %d \n", status);
+ 
+  count[0] = 1;
+  status = HE5_PTwriteattr(PTid, "GlobalAttr", H5T_NATIVE_FLOAT, count, &flt);
+  printf("Status returned by HE5_PTwriteattr() :    %d \n", status);
+    
+  status = HE5_PTdetach(PTid);
+  printf("Status returned by HE5_PTdetach() :       %d \n", status);
+
+  status = HE5_PTclose(ptfid);
+  printf("Status returned by HE5_PTclose() :        %d \n", status);
+
+  return 0;
+}
+
+
+
+
+
+
diff --git a/samples/he5_pt_writedataF_32.f b/samples/he5_pt_writedataF_32.f
new file mode 100755
index 0000000..ce2e5f4
--- /dev/null
+++ b/samples/he5_pt_writedataF_32.f
@@ -0,0 +1,441 @@
+      program       he5_pt_writedataF_32
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+      integer       status
+      integer       ptfid 
+      integer       ptid
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptwritelevel 
+      integer       he5_ptfort2c
+      integer       he5_ptwrbckptr
+      integer       he5_ptwrfwdptr
+      integer       he5_ptwriteattr 
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+      integer       i
+      integer       rank, datatype
+      integer       attr
+
+      integer*4     n
+      integer*4     count(1)
+      integer*4     dimens(2)
+      integer*4     fortcount(8),ntype
+
+      real*4        flt      
+
+      character*80  fieldname,attrname
+
+c.....used by Simple Point
+      real*8        time_tt
+      real*8        time(15)
+      real*4        concentration_tt(4)
+      real*4        conc(15,4)
+      real*4        outconc(4,15)
+      character*8   spc_tt
+      character*8   spc(15)
+
+c.....used by FixedBuoy Point - Level 0
+      character*8   desc_tt
+      character*8   desc(3)
+      real*8        lon_tt
+      real*8        lon(3)
+      real*8        lat_tt
+      real*8        lat(3)
+      integer*4     date_tt
+      integer*4     date(3)
+      character*8   id_tt
+      character*8   id(3)
+
+c.....used by FixedBuoy Point - Level 1
+      real*8        time3_tt
+      real*8        time3(20)
+      real*4        rain_tt
+      real*4        rain(20)
+      real*4        temp_tt
+      real*4        temp(20)
+      character*8   id3_tt
+      character*8   id3(20)
+
+c.....used by FloatBuoy Point - Level 0
+      character*8   desc4_tt
+      character*8   desc4(3)
+      integer*4     date4_tt
+      integer*4     date4(3)
+      integer*4     wgt_tt
+      integer*4     wgt(3)
+      character*8   id4_tt
+      character*8   id4(3)
+
+c.....used by FloatBuoy Point - Level 1
+      real*8        time5_tt
+      real*8        time5(25)
+      real*8        lon5_tt
+      real*8        lon5(25)
+      real*8        lat5_tt
+      real*8        lat5(25)
+      real*4        rain5_tt
+      real*4        rain5(25)
+      real*4        temp5_tt
+      real*4        temp5(25)
+      character*8   id5_tt
+      character*8   id5(25)
+
+
+c     Open the HDF point file, "point.he5"
+c     -----------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Do Simple Point 
+c     --------------- 
+      ptid = HE5_PTattach(ptfid, "Simple Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+
+c     Read Simple Point 
+c     ----------------- 
+      open(unit=1, file='simple.txt', status='OLD')
+
+      n = 0
+      do 10 i=1,1000
+         read(1, 110, end=100) time_tt, concentration_tt(1), 
+     1                                  concentration_tt(2), 
+     2                                  concentration_tt(3),
+     3                                  concentration_tt(4), 
+     4                                  spc_tt
+         time(i)     = time_tt
+         conc(i,1)   = concentration_tt(1)
+         conc(i,2)   = concentration_tt(2)
+         conc(i,3)   = concentration_tt(3)
+         conc(i,4)   = concentration_tt(4)
+         spc(i)      = spc_tt
+
+         n = n + 1
+   10 continue
+
+  100 close(unit=1)
+  110 format(F13.1,F6.2,F6.2,F6.2,F6.2,2X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Time'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, time)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+   
+c.....Convert array to 'C' order
+      dimens(1) = 15
+      dimens(2) = 4
+      rank      = 2
+      datatype  = HE5T_NATIVE_FLOAT
+
+      status    = he5_ptfort2c(dimens, rank, datatype, conc, 
+     1outconc)
+      write(*,*) 'Status returned by he5_ptfort2c():  ',status
+
+      fieldname      = 'Concentration'
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, outconc)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+
+      fieldname      = 'Species'
+      datatype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, spc)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+c     Do FixedBuoy Point 
+c     ------------------ 
+      ptid = HE5_PTattach(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Read FixedBuoy Point 
+c     -------------------- 
+      open(unit=1, file='fixedBuoy0.txt', status='OLD')
+
+      n = 0
+      do 20 i=1,1000
+         read(1, 210, end=200) desc_tt, lon_tt, lat_tt, date_tt, 
+     1id_tt
+         desc(i)     = desc_tt
+         lon(i)      = lon_tt
+         lat(i)      = lat_tt
+         date(i)     = date_tt
+         id(i)       = id_tt
+
+         n = n + 1
+   20 continue
+
+  200 close(unit=1)
+  210 format(A8,F13.7,F13.7,I7,1X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Label'
+      datatype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, desc)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Longitude'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, lon)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Latitude'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, lat)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'DeployDate'
+      datatype       = HE5T_NATIVE_INT
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, date)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'ID'
+      datatype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, id)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+c     Read FixedBuoy Point - Level 1
+c     ------------------------------ 
+      open(unit=1, file='fixedBuoy1.txt', status='OLD')
+
+      n = 0
+      do 30 i=1,1000
+         read(1, 310, end=300) time3_tt, rain_tt, temp_tt, id3_tt 
+         time3(i)     = time3_tt
+         rain(i)      = rain_tt
+         temp(i)      = temp_tt
+         id3(i)       = id3_tt
+
+         n = n + 1
+   30 continue
+
+  300 close(unit=1)
+  310 format(F13.2,F8.1,F8.2,3X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Time'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, time3)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Rainfall'
+      datatype       = HE5T_NATIVE_FLOAT
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, rain)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Temperature'
+      datatype       = HE5T_NATIVE_FLOAT
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, temp)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'ID'
+      datatype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, id3)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+c.....Write forward and backward pointers
+      status = he5_ptwrbckptr(ptid,1)
+      write(*,*) 'Status returned by he5_ptwrbckptr():  ',status
+
+      status = he5_ptwrfwdptr(ptid,1)
+      write(*,*) 'Status returned by he5_ptwrfwdptr():  ',status
+
+c     Write attributes to "Fixed Buoy Point"
+c     --------------------------------------
+      attrname       = 'GlobalAttribute_int'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 1
+      attr           = 9999 
+
+      status   = he5_ptwriteattr(ptid,attrname,ntype,fortcount,
+     1attr)
+      write(*,*) 'Status returned by he5_ptwriteattr():  ',status
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+
+c     Do FloatBuoy Point 
+c     ------------------ 
+      ptid = HE5_PTattach(ptfid, "FloatBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Read FloatBuoy Point - Level 0
+c     ------------------------------ 
+      open(unit=1, file='floatBuoy0.txt', status='OLD')
+
+      n = 0
+      do 40 i=1,1000
+         read(1, 410, end=400) desc4_tt, date4_tt, wgt_tt, id4_tt 
+         desc4(i)     = desc4_tt
+         date4(i)     = date4_tt
+         wgt(i)       = wgt_tt
+         id4(i)       = id4_tt
+
+         n = n + 1
+   40 continue
+
+  400 close(unit=1)
+  410 format(A8,I8,I7,2X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Label'
+      datatype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, desc4)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'DeployDate'
+      datatype       = HE5T_NATIVE_INT
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, date4)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Weight'
+      datatype       = HE5T_NATIVE_INT
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, wgt)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'ID'
+      datatype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, id4)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+c     Read FixedBuoy Point - Level 1
+c     ------------------------------ 
+      open(unit=1, file='floatBuoy1.txt', status='OLD')
+
+      n = 0
+      do 50 i=1,1000
+         read(1, 510, end=500) time5_tt, lon5_tt, lat5_tt,  
+     1rain5_tt,temp5_tt,id5_tt
+         time5(i)     = time5_tt
+         lon5(i)      = lon5_tt
+         lat5(i)      = lat5_tt
+         rain5(i)     = rain5_tt
+         temp5(i)     = temp5_tt
+         id5(i)       = id5_tt
+
+         n = n + 1
+   50 continue
+
+  500 close(unit=1)
+  510 format(F13.1,F13.6,F13.6,F8.1,F8.2,3X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Time'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, time5)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Longitude'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, lon5)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Latitude'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, lat5)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Rainfall'
+      datatype       = HE5T_NATIVE_FLOAT
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, rain5)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Temperature'
+      datatype       = HE5T_NATIVE_FLOAT
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, temp5)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'ID'
+      datatype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, id5)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+c.....Write forward and backward pointers
+      status = he5_ptwrbckptr(ptid,1)
+      write(*,*) 'Status returned by he5_ptwrbckptr():  ',status
+
+      status = he5_ptwrfwdptr(ptid,1)
+      write(*,*) 'Status returned by he5_ptwrfwdptr():  ',status
+
+c     Write attributes to "Float Buoy Point"
+c     --------------------------------------
+      attrname       = 'GlobalAttribute_float'
+      ntype          = HE5T_NATIVE_FLOAT
+      fortcount(1)   = 1
+      flt            = -7.5
+
+      status   = he5_ptwriteattr(ptid,attrname,
+     1ntype,fortcount,flt)
+      write(*,*) 'Status returned by he5_ptwriteattr():  ',status
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+
+      stop
+      end
+
+
+
diff --git a/samples/he5_pt_writedataF_64.f b/samples/he5_pt_writedataF_64.f
new file mode 100755
index 0000000..d8d1de6
--- /dev/null
+++ b/samples/he5_pt_writedataF_64.f
@@ -0,0 +1,450 @@
+      program       he5_pt_writedataF_64
+
+      implicit      none
+ 
+      include       'hdfeos5.inc'
+ 
+      integer       status
+      integer       ptfid 
+      integer       ptid
+      integer       he5_ptopen
+      integer       he5_ptattach
+      integer       he5_ptwritelevel 
+      integer       he5_ptfort2c
+      integer       he5_ptwrbckptr
+      integer       he5_ptwrfwdptr
+      integer       he5_ptwriteattr 
+      integer       he5_ptdetach 
+      integer       he5_ptclose
+      integer       i
+      integer       rank
+      integer       dtype
+      integer       attr
+      integer       ntype
+
+      integer*8     n
+      integer*8     count(1)
+      integer*8     dimens(2)
+      integer*8     fortcount(8)
+
+      real*4        flt      
+
+      character*80  fieldname
+      character*80  attrname
+
+c.....used by Simple Point
+      real*8        time_tt
+      real*8        time(15)
+      real*4        concentration_tt(4)
+      real*4        conc(15,4)
+      real*4        outconc(4,15)
+      character*8   spc_tt
+      character*8   spc(15)
+
+c.....used by FixedBuoy Point - Level 0
+      character*8   desc_tt
+      character*8   desc(3)
+      real*8        lon_tt
+      real*8        lon(3)
+      real*8        lat_tt
+      real*8        lat(3)
+      integer*4     date_tt
+      integer*4     date(3)
+      character*8   id_tt
+      character*8   id(3)
+
+c.....used by FixedBuoy Point - Level 1
+      real*8        time3_tt
+      real*8        time3(20)
+      real*4        rain_tt
+      real*4        rain(20)
+      real*4        temp_tt
+      real*4        temp(20)
+      character*8   id3_tt
+      character*8   id3(20)
+
+c.....used by FloatBuoy Point - Level 0
+      character*8   desc4_tt
+      character*8   desc4(3)
+      integer*4     date4_tt
+      integer*4     date4(3)
+      integer*4     wgt_tt
+      integer*4     wgt(3)
+      character*8   id4_tt
+      character*8   id4(3)
+
+c.....used by FloatBuoy Point - Level 1
+      real*8        time5_tt
+      real*8        time5(25)
+      real*8        lon5_tt
+      real*8        lon5(25)
+      real*8        lat5_tt
+      real*8        lat5(25)
+      real*4        rain5_tt
+      real*4        rain5(25)
+      real*4        temp5_tt
+      real*4        temp5(25)
+      character*8   id5_tt
+      character*8   id5(25)
+
+
+c     Open the HDF-EOS point file, "point.he5"
+c     ----------------------------------------
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_ptopen():  ',ptfid
+
+c     Do Simple Point 
+c     --------------- 
+      ptid = HE5_PTattach(ptfid, "Simple Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Read Simple Point 
+c     ----------------- 
+      open(unit=1, file='simple.txt', status='OLD')
+
+      n = 0
+      do 10 i=1,1000
+         read(1, 110, end=100) time_tt, concentration_tt(1), 
+     1                                  concentration_tt(2), 
+     2                                  concentration_tt(3),
+     3                                  concentration_tt(4), 
+     4                                  spc_tt
+         time(i)     = time_tt
+         conc(i,1)   = concentration_tt(1)
+         conc(i,2)   = concentration_tt(2)
+         conc(i,3)   = concentration_tt(3)
+         conc(i,4)   = concentration_tt(4)
+         spc(i)      = spc_tt
+
+         n = n + 1
+   10 continue
+
+  100 close(unit=1)
+  110 format(F13.1,F6.2,F6.2,F6.2,F6.2,2X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Time'
+      dtype       = HE5T_NATIVE_DOUBLE
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1dtype, time)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+   
+c.....Convert array to 'C' order
+      dimens(1) = 15
+      dimens(2) = 4
+      rank      = 2
+      dtype  = HE5T_NATIVE_FLOAT
+
+      status    = he5_ptfort2c(dimens, rank, dtype, conc, 
+     1outconc)
+      write(*,*) 'Status returned by he5_ptfort2c():  ',status
+
+
+      fieldname      = 'Concentration'
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1dtype, outconc)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+
+      fieldname      = 'Species'
+      dtype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1dtype, spc)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+c     Do FixedBuoy Point 
+c     ------------------ 
+      ptid = HE5_PTattach(ptfid, "FixedBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Read FixedBuoy Point 
+c     -------------------- 
+      open(unit=1, file='fixedBuoy0.txt', status='OLD')
+
+      n = 0
+      do 20 i=1,1000
+         read(1, 210, end=200) desc_tt, lon_tt, lat_tt, date_tt, 
+     1id_tt
+         desc(i)     = desc_tt
+         lon(i)      = lon_tt
+         lat(i)      = lat_tt
+         date(i)     = date_tt
+         id(i)       = id_tt
+
+         n = n + 1
+   20 continue
+
+  200 close(unit=1)
+  210 format(A8,F13.7,F13.7,I7,1X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Label'
+      dtype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1dtype, desc)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Longitude'
+      dtype       = HE5T_NATIVE_DOUBLE
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1dtype, lon)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Latitude'
+      dtype       = HE5T_NATIVE_DOUBLE
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1dtype, lat)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'DeployDate'
+      dtype       = HE5T_NATIVE_INT
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1dtype, date)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'ID'
+      dtype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1dtype, id)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+
+c     Read FixedBuoy Point - Level 1
+c     ------------------------------ 
+      open(unit=1, file='fixedBuoy1.txt', status='OLD')
+
+      n = 0
+      do 30 i=1,1000
+         read(1, 310, end=300) time3_tt, rain_tt, temp_tt, id3_tt 
+         time3(i)     = time3_tt
+         rain(i)      = rain_tt
+         temp(i)      = temp_tt
+         id3(i)       = id3_tt
+
+         n = n + 1
+   30 continue
+
+  300 close(unit=1)
+  310 format(F13.2,F8.1,F8.2,3X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Time'
+      dtype       = HE5T_NATIVE_DOUBLE
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1dtype, time3)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Rainfall'
+      dtype       = HE5T_NATIVE_FLOAT
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1dtype, rain)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Temperature'
+      dtype       = HE5T_NATIVE_FLOAT
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1dtype, temp)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+
+      fieldname      = 'ID'
+      dtype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1dtype, id3)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+c.....Write forward and backward pointers
+      status = he5_ptwrbckptr(ptid,1)
+      write(*,*) 'Status returned by he5_ptwrbckptr():  ',status
+
+      status = he5_ptwrfwdptr(ptid,1)
+      write(*,*) 'Status returned by he5_ptwrfwdptr():  ',status
+
+c     Write attributes to "Fixed Buoy Point"
+c     --------------------------------------
+      attrname       = 'GlobalAttribute_int'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 1
+      attr           = 9999 
+
+      status   = he5_ptwriteattr(ptid,attrname,ntype,fortcount,
+     1attr)
+      write(*,*) 'Status returned by he5_ptwriteattr():  ',status
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+
+c     Do FloatBuoy Point 
+c     ------------------ 
+      ptid = HE5_PTattach(ptfid, "FloatBuoy Point")
+      write(*,*) 'Point ID returned by he5_ptattach():  ',ptid
+
+c     Read FloatBuoy Point - Level 0
+c     ------------------------------ 
+      open(unit=1, file='floatBuoy0.txt', status='OLD')
+
+      n = 0
+      do 40 i=1,1000
+         read(1, 410, end=400) desc4_tt, date4_tt, wgt_tt, id4_tt 
+         desc4(i)     = desc4_tt
+         date4(i)     = date4_tt
+         wgt(i)       = wgt_tt
+         id4(i)       = id4_tt
+
+         n = n + 1
+   40 continue
+
+  400 close(unit=1)
+  410 format(A8,I8,I7,2X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Label'
+      dtype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1dtype, desc4)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'DeployDate'
+      dtype       = HE5T_NATIVE_INT
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1dtype, date4)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Weight'
+      dtype       = HE5T_NATIVE_INT
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1dtype, wgt)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'ID'
+      dtype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1dtype, id4)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+c     Read FixedBuoy Point - Level 1
+c     ------------------------------ 
+      open(unit=1, file='floatBuoy1.txt', status='OLD')
+
+      n = 0
+      do 50 i=1,1000
+         read(1, 510, end=500) time5_tt, lon5_tt, lat5_tt,  
+     1rain5_tt,temp5_tt,id5_tt
+         time5(i)     = time5_tt
+         lon5(i)      = lon5_tt
+         lat5(i)      = lat5_tt
+         rain5(i)     = rain5_tt
+         temp5(i)     = temp5_tt
+         id5(i)       = id5_tt
+
+         n = n + 1
+   50 continue
+
+  500 close(unit=1)
+  510 format(F13.1,F13.6,F13.6,F8.1,F8.2,3X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Time'
+      dtype       = HE5T_NATIVE_DOUBLE
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1dtype, time5)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Longitude'
+      dtype       = HE5T_NATIVE_DOUBLE
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1dtype, lon5)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Latitude'
+      dtype       = HE5T_NATIVE_DOUBLE
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1dtype, lat5)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Rainfall'
+      dtype       = HE5T_NATIVE_FLOAT
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1dtype, rain5)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'Temperature'
+      dtype       = HE5T_NATIVE_FLOAT
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1dtype, temp5)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+      fieldname      = 'ID'
+      dtype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1dtype, id5)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+c.....Write forward and backward pointers
+      status = he5_ptwrbckptr(ptid,1)
+      write(*,*) 'Status returned by he5_ptwrbckptr():  ',status
+
+      status = he5_ptwrfwdptr(ptid,1)
+      write(*,*) 'Status returned by he5_ptwrfwdptr():  ',status
+
+c     Write attributes to "Float Buoy Point"
+c     --------------------------------------
+      attrname       = 'GlobalAttribute_float'
+      ntype          = HE5T_NATIVE_FLOAT
+      fortcount(1)   = 1
+      flt            = -7.5
+
+      status   = he5_ptwriteattr(ptid,attrname,
+     1ntype,fortcount,flt)
+      write(*,*) 'Status returned by he5_ptwriteattr():  ',status
+
+c.....Close out the point interface
+      status = he5_ptdetach(ptid)
+      write(*,*) 'Status returned by he5_ptdetach():  ',status
+
+      status = he5_ptclose(ptfid)
+      write(*,*) 'Status returned by he5_ptclose():  ',status
+
+
+      stop
+      end
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_datainfo.c b/samples/he5_sw_datainfo.c
new file mode 100755
index 0000000..a6cc5aa
--- /dev/null
+++ b/samples/he5_sw_datainfo.c
@@ -0,0 +1,170 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |  
+ ----------------------------------------------------------------------------  
+ */
+
+
+#include   <HE5_HdfEosDef.h>
+
+
+#define FILENAME   "Swath.h5"
+#define OBJECT     "Swath1"
+
+
+int main(void)
+{
+  herr_t       status     = FAIL;
+
+  int          fieldgroup = FAIL;
+
+  hid_t        fid      = FAIL;
+  hid_t        SWid     = FAIL;
+  hid_t        datatype = FAIL;
+
+  H5T_class_t  classid = H5T_NO_CLASS;     
+  H5T_order_t  order   = H5T_ORDER_ERROR;
+
+  size_t       size    = 0;
+
+
+  /* Open the HDF-EOS swath file */
+  /* --------------------------- */
+  fid = HE5_SWopen(FILENAME, H5F_ACC_RDONLY);
+  printf("File ID returned by HE5_SWopen() :         %d \n", fid);
+    
+  /* Attach to the "Swath1" swath */
+  /* ---------------------------- */
+  SWid = HE5_SWattach(fid, OBJECT);
+  printf("Swath ID returned by HE5_SWattach() :      %d \n", SWid);
+
+  /* Inquire data type information for the "Spectra" field */
+  /* ----------------------------------------------------- */
+  fieldgroup = HE5_HDFE_DATAGROUP;
+  status = HE5_SWinqdatatype(SWid, "Spectra", NULL, fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_SWinqdatatype() :   %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", datatype);
+	  printf("\tclass ID:    %d \n", classid);
+	  printf("\torder:       %d \n", order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  /* Inquire data type information for the profile */
+  /* --------------------------------------------- */
+  fieldgroup = HE5_HDFE_PROFGROUP;
+  status = HE5_SWinqdatatype(SWid, "Profile-2000", NULL, fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_SWinqdatatype() :   %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", datatype);
+	  printf("\tclass ID:    %d \n", classid);
+	  printf("\torder:       %d \n", order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  /* Inquire data type information for the attributes */
+  /* ------------------------------------------------ */
+  status = HE5_EHinqglbdatatype(fid, "GlobalAttribute_1", &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_EHinqglbdatatype() :  %d \n", status);
+  if (status != FAIL)
+        {
+          printf("\tdatatype:    %d \n", datatype);
+          printf("\tclass ID:    %d \n", classid);
+          printf("\torder:       %d \n", order);
+          printf("\tsize:        %d \n", (int)size);
+        }
+
+  status = HE5_EHinqglbdatatype(fid, "GLOBAL_DOUBLE_ATTR_1", &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_EHinqglbdatatype()->GLOBAL_DOUBLE_ATTR_1  :  %d \n", status);
+  if (status != FAIL)
+        {
+          printf("\tdatatype:    %d \n", datatype);
+          printf("\tclass ID:    %d \n", classid);
+          printf("\torder:       %d \n", order);
+          printf("\tsize:        %d \n", (int)size);
+        }
+
+          
+  fieldgroup = HE5_HDFE_ATTRGROUP;
+  status = HE5_SWinqdatatype(SWid, NULL, "GlobalAttribute", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_SWinqdatatype() :   %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", datatype);
+	  printf("\tclass ID:    %d \n", classid);
+	  printf("\torder:       %d \n", order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  status = HE5_SWinqdatatype(SWid, NULL, "GLOBAL_CHAR_ATTR_11", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_SWinqdatatype()->GLOBAL_CHAR_ATTR_11 :   %d \n", status);
+  if (status != FAIL)
+        {
+          printf("\tdatatype:    %d \n", datatype);
+          printf("\tclass ID:    %d \n", classid);
+          printf("\torder:       %d \n", order);
+          printf("\tsize:        %d \n", (int)size);
+        }
+
+  status = HE5_SWinqdatatype(SWid, NULL, "GLOBAL_CHAR_ATTR", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_SWinqdatatype()->GLOBAL_CHAR_ATTR :   %d \n", status);
+  if (status != FAIL)
+        {
+          printf("\tdatatype:    %d \n", datatype);
+          printf("\tclass ID:    %d \n", classid);
+          printf("\torder:       %d \n", order);
+          printf("\tsize:        %d \n", (int)size);
+        }
+
+  fieldgroup = HE5_HDFE_GRPATTRGROUP;
+  status = HE5_SWinqdatatype(SWid, NULL, "GroupAttribute", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_SWinqdatatype() :   %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", datatype);
+	  printf("\tclass ID:    %d \n", classid);
+	  printf("\torder:       %d \n", order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  fieldgroup = HE5_HDFE_LOCATTRGROUP;
+  status = HE5_SWinqdatatype(SWid, "Density", "LocalAttribute_1", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_SWinqdatatype() :   %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", datatype);
+	  printf("\tclass ID:    %d \n", classid);
+	  printf("\torder:       %d \n", order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  fieldgroup = HE5_HDFE_LOCATTRGROUP;
+  status = HE5_SWinqdatatype(SWid, "Longitude", "LocalAttribute_2", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_SWinqdatatype() :   %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", datatype);
+	  printf("\tclass ID:    %d \n", classid);
+	  printf("\torder:       %d \n", order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  /* Detach from the swath */
+  /* --------------------- */
+  status = HE5_SWdetach(SWid);
+  printf("Status returned by HE5_SWdetach() :        %d \n", status);
+
+  /* Close the file */
+  /* -------------- */
+  status = HE5_SWclose(fid);
+  printf("Status returned by HE5_SWclose() :         %d \n", status);
+    
+  return(0);
+    
+}
+
+
+
+
diff --git a/samples/he5_sw_defexternalfld.c b/samples/he5_sw_defexternalfld.c
new file mode 100755
index 0000000..01f3ce5
--- /dev/null
+++ b/samples/he5_sw_defexternalfld.c
@@ -0,0 +1,73 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+#include    <HE5_HdfEosDef.h>
+
+
+/* ----------------------------------------------------------- */
+/*   In this program we (1) open the "Swath.h5" HDF-EOS file,  */
+/*   (2) attach to the "Swath1" swath, and (3) define the      */
+/*   external data field "ExtData".                            */
+/* ----------------------------------------------------------- */
+
+int main()
+{
+  
+  herr_t      status = FAIL;
+  
+  hid_t       swfid = FAIL;
+  hid_t       SWid  = FAIL;
+
+  off_t       offset[3];
+
+  hsize_t     size[3];
+  
+
+  /* Open the file, "Swath.h5", using the H5F_ACC_RDWR access code */
+  /* ------------------------------------------------------------- */
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR);
+  if (swfid != FAIL)
+    {
+	  /* Attach to the "Swath1" swath */
+	  /* ---------------------------- */
+	  SWid = HE5_SWattach(swfid, "Swath1"); 
+	  if (SWid != FAIL)
+		{
+		  /* Set the data sizes and offsets in external files */
+		  /* ------------------------------------------------ */
+		  size[0] = 10 * sizeof(int);       offset[0] = 0;
+		  size[1] = 20 * sizeof(int);       offset[1] = 40;
+		  size[2] = 30 * sizeof(int);       offset[2] = 80;
+
+		  /* Set external data files first */
+		  /* ----------------------------- */
+		  status = HE5_SWsetextdata(SWid, "external_1.data,external_2.data,external_3.data", offset, size);
+		  printf("Status returned by HE5_SWsetextdata(...) :                        %d\n",status);
+
+		  /* Define field containing external data */
+		  /* ------------------------------------- */
+		  status = HE5_SWdefdatafield(SWid, "ExtData", "ExtDim", NULL, H5T_NATIVE_INT, 0);
+		  printf("Status returned by HE5_SWdefdatafield(...\"ExtData\",...) :         %d\n",status);		  
+		}
+    }
+
+  /* Detach from the swath */
+  /* --------------------- */
+  status = HE5_SWdetach(SWid);
+  printf("Status returned by HE5_SWdetach(...) :                            %d\n",status);
+
+  /* Close the file */
+  /* -------------- */
+  status = HE5_SWclose(swfid);
+  printf("Status returned by HE5_SWclose(...) :                             %d\n",status);
+  
+  return 0;
+}
+
+
+
+
+
diff --git a/samples/he5_sw_defexternalfldF_32.f b/samples/he5_sw_defexternalfldF_32.f
new file mode 100755
index 0000000..ec1ce65
--- /dev/null
+++ b/samples/he5_sw_defexternalfldF_32.f
@@ -0,0 +1,73 @@
+c
+c	  In this program we (1) open the "swath.he5" HDF-EOS file, 
+c     (2) attach to the "Swath1" swath, and (3) define the 
+c     external data field "ExtData".
+c
+      program     he5_sw_defexternalfldF_32
+
+      implicit    none
+ 
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     he5_swopen
+      integer     he5_swattach
+      integer     he5_swdefdfld
+      integer     he5_swdetach
+      integer     he5_swclose
+      integer     he5_swsetxdat
+      integer     swfid, swid
+
+      integer*4   offset(3), size(3)
+
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+
+c     Open the HDF-EOS file, "swath.he5" using "READ/WRITE" access code
+c     ----------------------------------------------------------------
+      swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid
+      if (swfid .NE. FAIL) then
+
+      swid = he5_swattach(swfid, "Swath1")
+      write(*,*) 'Swath ID returned by he5_swattach():  ',swid
+      if (swid .NE. FAIL) then
+
+      offset(1) = 0 
+      size(1)   = 40
+
+      offset(2) = 40
+      size(2)   = 80
+
+      offset(3) = 80
+      size(3)   = 120
+
+      status = he5_swsetxdat(swid, "extf1.dat,extf2.dat,extf3.dat",
+     1offset, size)
+      write(*,*) 'Status returned by he5_swsetxdat():  ',status
+      
+      status = he5_swdefdfld(swid, "ExtData", "ExtDim",
+     1" ", HE5T_NATIVE_INT, 0)
+      write(*,*) 'Status returned by he5_swdefdfld():  ',status
+
+      endif
+      endif
+
+c     Detach from the swath
+c     ---------------------      
+      status = he5_swdetach(swid)
+      write(*,*) 'Status returned by he5_swdetach():  ',status
+
+c     Close the file
+c     --------------      
+      status = he5_swclose(swfid)
+      write(*,*) 'Status returned by he5_swclose():  ',status
+
+      stop
+      end
+
+
+
+
+
diff --git a/samples/he5_sw_defexternalfldF_64.f b/samples/he5_sw_defexternalfldF_64.f
new file mode 100755
index 0000000..5883d56
--- /dev/null
+++ b/samples/he5_sw_defexternalfldF_64.f
@@ -0,0 +1,78 @@
+c
+c	In this program we (1) open the "swath.he5" HDF-EOS file, (2)
+c	attach to the "Swath1" swath, and (3) define the external 
+c   data field "ExtData".
+c
+
+      program     he5_sw_defexternalfldF_64
+
+      implicit    none
+ 
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     he5_swopen
+      integer     he5_swattach
+      integer     he5_swdefdfld
+      integer     he5_swdetach
+      integer     he5_swclose
+      integer     he5_swsetxdat
+      integer     swfid, swid
+
+      integer*8   offset(3), size(3)
+
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+
+c     Open the HDF-EOS file, "swath.he5" using "READ/WRITE" access code
+c     -----------------------------------------------------------------
+      swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid
+      if (swfid .NE. FAIL) then
+
+      swid = he5_swattach(swfid, "Swath1")
+      write(*,*) 'Swath ID returned by he5_swattach():  ',swid
+      if (swid .NE. FAIL) then
+
+      offset(1) = 0 
+      size(1)   = 40
+
+      offset(2) = 40
+      size(2)   = 80
+
+      offset(3) = 80
+      size(3)   = 120
+
+      status = he5_swsetxdat(swid, "extf1.dat,extf2.dat,extf3.dat",
+     1offset, size)
+      write(*,*) 'Status returned by he5_swsetxdat():  ',status
+      
+      status = he5_swdefdfld(swid, "ExtData", "ExtDim",
+     1" ", HE5T_NATIVE_INT, 0)
+      write(*,*) 'Status returned by he5_swdefdfld():  ',status
+
+      endif
+      endif
+
+c     Detach from the swath
+c     ---------------------      
+      status = he5_swdetach(swid)
+      write(*,*) 'Status returned by he5_swdetach():  ',status
+
+c     Close the file
+c     --------------      
+      status = he5_swclose(swfid)
+      write(*,*) 'Status returned by he5_swclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_definefields.c b/samples/he5_sw_definefields.c
new file mode 100755
index 0000000..b2dad23
--- /dev/null
+++ b/samples/he5_sw_definefields.c
@@ -0,0 +1,214 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+#include     <HE5_config.h>
+#include     <HE5_HdfEosDef.h>
+
+#define  RANK   3
+#define  rank   1
+
+/*   In this program we (1) open the "Swath.h5" HDF-EOS file,  */
+/* (2) attach to the "Swath1" swath, and (3) define the fields */
+/* ----------------------------------------------------------- */
+
+int main()
+{
+  
+  herr_t      status = FAIL;
+
+  int         comp_level[ 5 ] = {0,0,0,0,0};
+  int         comp_code;
+  int         i, j;  
+  
+  hid_t       swfid = FAIL;
+  hid_t       SWid  = FAIL;
+
+  hsize_t     chunk_dims[ 3 ];
+  char        fillvalue[100] = "charname";
+
+  double      fillvalue1 = -1.11111;
+  int         fillvalue2 = 6;
+
+  /* Open the file, "Swath.h5", using the H5F_ACC_RDWR access code */
+  /* ------------------------------------------------------------- */
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR);
+  if (swfid != FAIL)
+    {
+	  SWid = HE5_SWattach(swfid, "Swath1"); 
+	  if (SWid != FAIL)
+		{
+		  /*
+		   * We define seven fields.  The first three, "Time", "Longitude"
+		   * and "Latitude" are geolocation fields and thus we use the
+		   * geolocation dimensions "GeoTrack" and "GeoXtrack" in the field
+		   * definitions.
+		   * 
+		   * The next four fields are data fields.  Note that either
+		   * geolocation or data dimensions can be used.
+		   */
+
+                  status = HE5_SWsetfillvalue(SWid,"Time",H5T_NATIVE_DOUBLE, &fillvalue1);
+                  printf("Status returned by HE5_SWsetfillvalue(...\"Time\",...) :         %d\n",status);
+
+		  status = HE5_SWdefgeofield(SWid, "Time", "GeoTrack", NULL, H5T_NATIVE_DOUBLE, 0);
+		  printf("Status returned by HE5_SWdefgeofield(...\"Time\",...) :         %d\n",status);
+	    
+		  status = HE5_SWdefgeofield(SWid, "Longitude", "GeoTrack,GeoXtrack", NULL, H5T_NATIVE_FLOAT, 0);
+		  printf("Status returned by HE5_SWdefgeofield(...\"Longitude\",...) :    %d\n",status);
+
+		  status = HE5_SWdefgeofield(SWid, "Latitude", "GeoTrack,GeoXtrack", NULL, H5T_NATIVE_FLOAT, 0);
+		  printf("Status returned by HE5_SWdefgeofield(...\"Latitude\",...) :     %d\n",status);
+
+                  status = HE5_SWsetfillvalue(SWid, "Test_string", HE5T_CHARSTRING, fillvalue);
+                  printf("Status returned by HE5_SWsetfillvalue(...\"Test_string\",...) :     %d\n",status);
+
+                  status = HE5_SWdefdatafield(SWid, "Test_string", "GeoXtrack", NULL, HE5T_CHARSTRING, 0);
+                  printf("Status returned by HE5_SWdefdatafield(...\"Test_string\",...) :     %d\n",status);
+
+                  status = HE5_SWsetfillvalue(SWid,"Density",H5T_NATIVE_INT8, &fillvalue2);
+                  printf("Status returned by HE5_SWsetfillvalue(...\"Density\",...) :         %d\n",status);
+
+                  status = HE5_SWdefdatafield(SWid, "Density", "GeoTrack", NULL, H5T_NATIVE_INT8, 0);
+                  printf("Status returned by HE5_SWdefdatafield(...\"Density\",...) :     %d\n",status);
+
+		  status = HE5_SWdefdatafield(SWid, "Temperature", "GeoTrack,GeoXtrack",NULL, H5T_NATIVE_FLOAT, 0);
+		  printf("Status returned by HE5_SWdefdatafield(...\"Temperature\",...) : %d\n",status);
+
+                  comp_level[0] =0;
+
+                  chunk_dims[0] = 40;
+
+                  status = HE5_SWdefchunk(SWid, rank, chunk_dims);
+                  printf("\tStatus returned by HE5_SWdefchunk() :                 %d\n",status);
+
+                  status = HE5_SWdefcomp(SWid,HE5_HDFE_COMP_NONE,comp_level);
+                  status = HE5_SWdefdatafield(SWid, "Pressure", "Res2tr", NULL, H5T_NATIVE_FLOAT, 0);
+                  printf("Status returned by HE5_SWdefdatafield(...\"Pressure\",...):    %d\n",status);
+
+		  /* Define Appendable Field */
+		  /* ----------------------- */
+
+		  /*           First, define chunking          */
+		  /* (the appendable dataset must be chunked)  */
+		  /* ----------------------------------------  */
+		  chunk_dims[0] = 15;
+		  chunk_dims[1] = 40;
+		  chunk_dims[2] = 20;
+
+		  status = HE5_SWdefchunk(SWid, RANK, chunk_dims);
+		  printf("\tStatus returned by HE5_SWdefchunk() :                 %d\n",status);
+
+		  /* Second, define compression scheme */
+		  /* --------------------------------- */ 
+		  
+		  /* set the value of compression code: */
+		  /*  HDFE_COMP_NONE                  0 */
+		  /*  HDFE_COMP_RLE                   1 */   
+		  /*  HDFE_COMP_NBIT                  2 */   
+		  /*  HDFE_COMP_SKPHUFF               3 */   
+		  /*  HDFE_COMP_DEFLATE               4 */           
+                  /*  HDFE_COMP_SZIP_CHIP             5 */
+                  /*  HDFE_COMP_SZIP_K13              6 */
+                  /*  HDFE_COMP_SZIP_EC               7 */
+                  /*  HDFE_COMP_SZIP_NN               8 */
+                  /*  HDFE_COMP_SZIP_K13orEC          9 */
+                  /*  HDFE_COMP_SZIP_K13orNN          10 */
+                  /*  HDFE_COMP_SHUF_DEFLATE          11 */
+                  /*  HDFE_COMP_SHUF_SZIP_CHIP        12 */
+                  /*  HDFE_COMP_SHUF_SZIP_K13         13 */
+                  /*  HDFE_COMP_SHUF_SZIP_EC          14 */
+                  /*  HDFE_COMP_SHUF_SZIP_NN          15 */
+                  /*  HDFE_COMP_SHUF_SZIP_K13orEC     16 */
+                  /*  HDFE_COMP_SHUF_SZIP_K13orNN     17 */
+
+		  comp_code = 16;
+                  /*comp_code = 0;*/
+
+		  /* Set compression level: value 0,1,2,3,4,5,6,7,8,9,10,16, or 32 */
+		  /* ------------------------------------------------------------- */
+		  comp_level[0] = 8;
+                  /*comp_level[0] = 0;*/
+		  
+#ifdef HAVE_FILTER_SZIP_ENCODER
+		  status = HE5_SWdefcomp(SWid,comp_code, comp_level);
+		  printf("\tStatus returned by HE5_SWdefcomp() :                  %d\n",status);
+#else
+		  printf("SZIP encoder is not available. The data compression test is skipped.\n");
+#endif
+                  status = HE5_SWdefdatafield(SWid, "Spectra", "Bands,Res2tr,Res2xtr", NULL, H5T_NATIVE_FLOAT, 0);
+                  printf("Status returned by HE5_SWdefdatafield(...\"Spectra\",...) :     %d\n",status);
+	    
+
+                  /* Define Appendable Field */
+                  /* ----------------------- */
+ 
+                  /*           First, define chunking          */
+                  /* (the appendable dataset must be chunked)  */
+                  /* ----------------------------------------  */
+                  chunk_dims[0] = 20;
+ 
+                  status = HE5_SWdefchunk(SWid, rank, chunk_dims);
+                  printf("\tStatus returned by HE5_SWdefchunk() :                 %d\n",status);
+ 
+                  /* Second, define compression scheme */
+                  /* --------------------------------- */
+ 
+                  /* set the value of compression code: */
+                  /*  HDFE_COMP_NONE                  0 */
+                  /*  HDFE_COMP_RLE                   1 */
+                  /*  HDFE_COMP_NBIT                  2 */
+                  /*  HDFE_COMP_SKPHUFF               3 */
+                  /*  HDFE_COMP_DEFLATE               4 */
+                  /*  HDFE_COMP_SZIP_CHIP             5 */
+                  /*  HDFE_COMP_SZIP_K13              6 */
+                  /*  HDFE_COMP_SZIP_EC               7 */
+                  /*  HDFE_COMP_SZIP_NN               8 */
+                  /*  HDFE_COMP_SZIP_K13orEC          9 */
+                  /*  HDFE_COMP_SZIP_K13orNN          10 */
+                  /*  HDFE_COMP_SHUF_DEFLATE          11 */
+                  /*  HDFE_COMP_SHUF_SZIP_CHIP        12 */
+                  /*  HDFE_COMP_SHUF_SZIP_K13         13 */
+                  /*  HDFE_COMP_SHUF_SZIP_EC          14 */
+                  /*  HDFE_COMP_SHUF_SZIP_NN          15 */
+                  /*  HDFE_COMP_SHUF_SZIP_K13orEC     16 */
+                  /*  HDFE_COMP_SHUF_SZIP_K13orNN     17 */
+                  comp_code = 10;
+                  /*comp_code = 0;*/
+ 
+                  /* Set compression level: value 0,1,2,3,4,5,6,7,8,9,10,16, or 32 */
+                  /* ------------------------------------------------------------- */
+                  comp_level[0] = 8;
+                  /*comp_level[0] = 0;*/
+ 
+#ifdef HAVE_FILTER_SZIP_ENCODER
+		  status = HE5_SWdefcomp(SWid,comp_code, comp_level);
+		  printf("\tStatus returned by HE5_SWdefcomp() :                  %d\n",status);
+#else
+		  printf("SZIP encoder is not available. The data compression test is skipped.\n");
+#endif
+
+		  status = HE5_SWdefdatafield(SWid, "Count", "GeoTrack", "Unlim", H5T_NATIVE_INT, 0);
+		  printf("Status returned by HE5_SWdefdatafield(...\"Count\",...) :       %d\n",status);
+
+
+                  /* Define Profile field */
+                  /* -------------------- */
+                  status = HE5_PRdefine(SWid, "Profile-2000", "ProfDim", NULL, H5T_NATIVE_UINT);
+                  printf("Status returned by HE5_PRdefine(...\"Profile-2000\",...) :      %d\n",status);
+
+		}
+    }
+  
+  status = HE5_SWdetach(SWid);
+  status = HE5_SWclose(swfid);
+  
+  return 0;
+}
+
+
+
+
+
diff --git a/samples/he5_sw_definefieldsF_32.f b/samples/he5_sw_definefieldsF_32.f
new file mode 100755
index 0000000..cc7a996
--- /dev/null
+++ b/samples/he5_sw_definefieldsF_32.f
@@ -0,0 +1,134 @@
+c	  In this program we (1) open the "swath.he5" HDF-EOS file, (2)
+c	  attach to the "Swath1" swath, and (3) define the swath fields
+c     =============================================================
+
+      program     he5_sw_definefieldsF_32
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     he5_swopen
+      integer     he5_swattach
+      integer     he5_swsetfill
+      integer     he5_swdefgfld
+      integer     he5_swdefdfld
+      integer     he5_prdefine
+      integer     he5_swdefchunk
+      integer     he5_swdefcomp
+      integer     he5_swdetach
+      integer     he5_swclose
+      integer     swfid, swid
+
+      integer     chunkrank
+      integer*4   chunkdims(3) 
+      integer     compparm(1)
+
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+c     Open the HDF-EOS file, "swath.he5" using "READ/WRITE" access code
+c     -----------------------------------------------------------------
+      swfid = he5_swopen("swath.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid 
+      if (swfid .NE. FAIL) then
+
+         swid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID  returned by he5_swattach():  ',swid 
+         if (swid .NE. FAIL) then
+            
+c     Define Geolocation and Data fields
+c     ----------------------------------
+c     ---------------------------------------------------------------
+c     We define six fields.  The first three, "Time", "Longitude"
+c	  and "Latitude" are geolocation fields and thus we use the
+c	  geolocation dimensions "GeoTrack" and "GeoXtrack" in the field
+c	  definitions.  We also must specify the data type using the
+c	  standard HDF data type codes.  In this example the geolocation
+c	  are 4-byte (32 bit) floating point numbers.
+c     
+c	  The next three fields are data fields.  Note that either
+c	  geolocation or data dimensions can be used. 
+c     ---------------------------------------------------------------
+            
+            status = he5_swdefgfld(swid, "Time", "GeoTrack", 
+     1           " ",HE5T_NATIVE_DOUBLE, 0)
+            write(*,*) 'Status returned by he5_swdefgfld():  ',status 
+
+            status = he5_swdefgfld(swid, "Longitude", 
+     1           "GeoXtrack,GeoTrack",
+     2           " ", HE5T_NATIVE_FLOAT, 0)
+            write(*,*) 'Status returned by he5_swdefgfld():  ',status 
+
+            status = he5_swdefgfld(swid, "Latitude",
+     1           "GeoXtrack,GeoTrack",
+     2           " ", HE5T_NATIVE_FLOAT, 0)
+            write(*,*) 'Status returned by he5_swdefgfld():  ',status 
+
+            status = he5_swdefdfld(swid, "Density",
+     1           "GeoTrack"," ", HE5T_NATIVE_FLOAT, 0)
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status
+
+            status = he5_swdefdfld(swid, "Temperature",
+     1           "GeoXtrack,GeoTrack",
+     2           " ", HE5T_NATIVE_FLOAT, 0)	      
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status 
+	      
+            status = he5_swdefdfld(swid, "Pressure", 
+     1           "Res2xtr,Res2tr",
+     2           " ", HE5T_NATIVE_FLOAT, 0)
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status 
+	      
+		chunkrank = 3
+                chunkdims(1) = 20
+                chunkdims(2) = 40
+                chunkdims(3) = 15
+                compparm(1) = 6
+
+            status = he5_swdefchunk(swid,chunkrank,chunkdims)
+            write(*,*) 'Status returned by he5_swdefchunk(): ',status
+
+            status = he5_swdefcomp(swid,
+     1               HE5_HDFE_COMP_DEFLATE,compparm)
+            write(*,*) 'Status returned by he5_swdefcomp():  ',
+     1                  status
+
+            status = he5_swdefdfld(swid, "Spectra", 
+     1           "Res2xtr,Res2tr,Bands",
+     2           " ", HE5T_NATIVE_DOUBLE, 0)	      
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status 
+
+
+c     Define Profile Field
+c     -----------------------  
+            status = he5_prdefine(swid, "Profile-2000", 
+     1           "ProfDim", " ", HE5T_NATIVE_INT)
+            write(*,*) 'Status returned by he5_prdefine():  ',status
+
+
+c     Define Appendable Field
+c     -----------------------  
+c     status = he5_swdefdfld(swid, "Count", "GeoTrack",
+c     1"Unlim", HE5T_NATIVE_INT, 0)	      
+            
+         endif
+      endif
+      
+c     Detach from the swath
+c     ---------------------      
+      status = he5_swdetach(swid)
+      write(*,*) 'Status returned by he5_swdetach():  ',status 
+      
+c     Close the file
+c     --------------      
+      status = he5_swclose(swfid)
+      write(*,*) 'Status returned by he5_swclose():  ',status 
+
+      stop
+      end
+
+
+
+
+
diff --git a/samples/he5_sw_definefieldsF_64.f b/samples/he5_sw_definefieldsF_64.f
new file mode 100755
index 0000000..6ec141a
--- /dev/null
+++ b/samples/he5_sw_definefieldsF_64.f
@@ -0,0 +1,135 @@
+c	In this program we (1) open the "swath.he5" HDF-EOS file, (2)
+c	attach to the "Swath1" swath, and (3) define the swath fields
+c   =============================================================
+
+      program     he5_sw_definefieldsF_64
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     he5_swopen
+      integer     he5_swattach
+      integer     he5_swsetfill
+      integer     he5_swdefgfld
+      integer     he5_prdefine
+      integer     he5_swdefdfld
+      integer     he5_swdefchunk
+      integer     he5_swdefcomp
+      integer     he5_swdetach
+      integer     he5_swclose
+      integer     swfid, swid
+
+      integer     chunkrank
+      integer*8   chunkdims(3)
+      integer     compparm(1)
+
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+c     Open the HDF-EOS file, "swath.he5" using "READ/WRITE" access code
+c     -----------------------------------------------------------------
+      swfid = he5_swopen("swath.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid 
+      if (swfid .NE. FAIL) then
+         
+         swid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID  returned by he5_swattach():  ',swid 
+         if (swid .NE. FAIL) then
+            
+c     Define Geolocation and Data fields
+c     ----------------------------------
+c     ---------------------------------------------------------------
+c     We define six fields.  The first three, "Time", "Longitude"
+c	  and "Latitude" are geolocation fields and thus we use the
+c	  geolocation dimensions "GeoTrack" and "GeoXtrack" in the field
+c	  definitions.  We also must specify the data type using the
+c	  standard HDF data type codes.  In this example the geolocation
+c	  are 4-byte (32 bit) floating point numbers.
+c	     
+c	  The next three fields are data fields.  Note that either
+c	  geolocation or data dimensions can be used. 
+c     ---------------------------------------------------------------
+
+            status = he5_swdefgfld(swid, "Time", "GeoTrack", " ",
+     1           HE5T_NATIVE_DOUBLE, 0)
+            write(*,*) 'Status returned by he5_swdefgfld():  ',status 
+            
+            status = he5_swdefgfld(swid, "Longitude", 
+     1           "GeoXtrack,GeoTrack"," ",HE5T_NATIVE_FLOAT,0)
+            write(*,*) 'Status returned by he5_swdefgfld():  ',status 
+
+            status = he5_swdefgfld(swid,"Latitude",
+     1           "GeoXtrack,GeoTrack"," ",HE5T_NATIVE_FLOAT,0)
+            write(*,*) 'Status returned by he5_swdefgfld():  ',status 
+
+            status = he5_swsetfill(swid,"test_string",HE5T_NATIVE_CHAR,
+     1           'missing')
+            write(*,*) 'Status returned by he5_swsetfill():  ',status
+
+            status = he5_swdefdfld(swid,"test_string","GeoXtrack",
+     1           " ",HE5T_NATIVE_CHAR,0)
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status
+
+            status = he5_swdefdfld(swid,"Density","GeoTrack",
+     1           " ",HE5T_NATIVE_FLOAT,0)
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status
+
+            status = he5_swdefdfld(swid,"Temperature", 
+     1           "GeoXtrack,GeoTrack"," ",HE5T_NATIVE_FLOAT,0)
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status 	      
+	      
+            status = he5_swdefdfld(swid,"Pressure","Res2xtr,Res2tr",
+     1           " ", HE5T_NATIVE_FLOAT, 0)
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status 
+	      
+                chunkrank = 3
+                chunkdims(1) = 20
+                chunkdims(2) = 40
+                chunkdims(3) = 15
+                compparm(1) = 6
+ 
+            status = he5_swdefchunk(swid,chunkrank,chunkdims)
+            write(*,*) 'Status returned by he5_swdefchunk(): ',status
+ 
+            status = he5_swdefcomp(swid,HE5_HDFE_COMP_DEFLATE,compparm)
+            write(*,*) 'Status returned by he5_swdefcomp():  ',status
+
+            status = he5_swdefdfld(swid, "Spectra", 
+     1           "Res2xtr,Res2tr,Bands"," ",
+     2           HE5T_NATIVE_DOUBLE,0)	      
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status 
+            
+
+c     Define Profile Field
+c     -----------------------  
+      status = he5_prdefine(swid, "Profile-2000", 
+     1           "ProfDim", " ", HE5T_NATIVE_INT)
+            write(*,*) 'Status returned by he5_prdefine():  ',status
+
+
+c     Define Appendable Field
+c     -----------------------  
+c      status = he5_swdefdfld(swid, "Count", "GeoTrack",
+c     1		"Unlim", HE5T_NATIVE_INT, 0)	      
+            
+         endif
+      endif
+      
+c     Detach from the swath
+c     ---------------------      
+      status = he5_swdetach(swid)
+      write(*,*) 'Status returned by he5_swdetach():  ',status 
+      
+c     Close the file
+c     --------------      
+      status = he5_swclose(swfid)
+      write(*,*) 'Status returned by he5_swclose():  ',status 
+      
+      stop
+      end
+
+
+
+
diff --git a/samples/he5_sw_definefields_and_all_dimscales.c b/samples/he5_sw_definefields_and_all_dimscales.c
new file mode 100644
index 0000000..b3ba021
--- /dev/null
+++ b/samples/he5_sw_definefields_and_all_dimscales.c
@@ -0,0 +1,316 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+#include     <HE5_config.h>
+#include     <HE5_HdfEosDef.h>
+
+#define  RANK   3
+#define  rank   1
+
+/*   In this program we (1) open the "Swath.h5" HDF-EOS file,  */
+/* (2) attach to the "Swath1" swath, and (3) define the fields */
+/* ----------------------------------------------------------- */
+
+int main()
+{
+  
+  herr_t      status = FAIL;
+
+  int         comp_level[ 5 ] = {0,0,0,0,0};
+  int         comp_code;
+  int         i, j;  
+  
+  hid_t       swfid = FAIL;
+  hid_t       SWid  = FAIL;
+
+  hsize_t     chunk_dims[ 3 ];
+  char        fillvalue[100] = "charname";
+
+  double      fillvalue1 = -1.11111;
+  int         fillvalue2 = 6;
+
+
+  int             data[15]={1,2,3,6,9,12,15,18,23,26,29,32, 33,34,35};
+  char            label[16];
+  char            unit[16];
+  char            format[16];
+  int             nbands;
+  hsize_t         count[3];
+  hsize_t         databufsize;
+  int             countRank;
+
+  /* Open the file, "Swath.h5", using the H5F_ACC_RDWR access code */
+  /* ------------------------------------------------------------- */
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR);
+  if (swfid != FAIL)
+    {
+      SWid = HE5_SWattach(swfid, "Swath1"); 
+      if (SWid != FAIL)
+	{
+	  /*
+	   * We define seven fields.  The first three, "Time", "Longitude"
+	   * and "Latitude" are geolocation fields and thus we use the
+	   * geolocation dimensions "GeoTrack" and "GeoXtrack" in the field
+	   * definitions.
+	   * 
+	   * The next four fields are data fields.  Note that either
+	   * geolocation or data dimensions can be used.
+	   */
+	  
+	  status = HE5_SWsetfillvalue(SWid,"Time",H5T_NATIVE_DOUBLE, &fillvalue1);
+	  printf("Status returned by HE5_SWsetfillvalue(...\"Time\",...) :         %d\n",status);
+	  
+	  status = HE5_SWdefgeofield(SWid, "Time", "GeoTrack", NULL, H5T_NATIVE_DOUBLE, 0);
+	  printf("Status returned by HE5_SWdefgeofield(...\"Time\",...) :         %d\n",status);
+	  
+	  status = HE5_SWdefgeofield(SWid, "Longitude", "GeoTrack,GeoXtrack", NULL, H5T_NATIVE_FLOAT, 0);
+	  printf("Status returned by HE5_SWdefgeofield(...\"Longitude\",...) :    %d\n",status);
+	  
+	  status = HE5_SWdefgeofield(SWid, "Latitude", "GeoTrack,GeoXtrack", NULL, H5T_NATIVE_FLOAT, 0);
+	  printf("Status returned by HE5_SWdefgeofield(...\"Latitude\",...) :     %d\n",status);
+	  
+	  status = HE5_SWsetfillvalue(SWid, "Test_string", HE5T_CHARSTRING, fillvalue);
+	  printf("Status returned by HE5_SWsetfillvalue(...\"Test_string\",...) :     %d\n",status);
+	  
+	  status = HE5_SWdefdatafield(SWid, "Test_string", "GeoXtrack", NULL, HE5T_CHARSTRING, 0);
+	  printf("Status returned by HE5_SWdefdatafield(...\"Test_string\",...) :     %d\n",status);
+	  
+	  status = HE5_SWsetfillvalue(SWid,"Density",H5T_NATIVE_INT8, &fillvalue2);
+	  printf("Status returned by HE5_SWsetfillvalue(...\"Density\",...) :         %d\n",status);
+	  
+	  status = HE5_SWdefdatafield(SWid, "Density", "GeoTrack", NULL, H5T_NATIVE_INT8, 0);
+	  printf("Status returned by HE5_SWdefdatafield(...\"Density\",...) :     %d\n",status);
+	  
+	  status = HE5_SWdefdatafield(SWid, "Temperature", "GeoTrack,GeoXtrack",NULL, H5T_NATIVE_FLOAT, 0);
+	  printf("Status returned by HE5_SWdefdatafield(...\"Temperature\",...) : %d\n",status);
+	  
+	  comp_level[0] =0;
+	  
+	  chunk_dims[0] = 40;
+	  
+	  status = HE5_SWdefchunk(SWid, rank, chunk_dims);
+	  printf("\tStatus returned by HE5_SWdefchunk() :                 %d\n",status);
+	  
+	  status = HE5_SWdefcomp(SWid,HE5_HDFE_COMP_NONE,comp_level);
+	  status = HE5_SWdefdatafield(SWid, "Pressure", "Res2tr", NULL, H5T_NATIVE_FLOAT, 0);
+	  printf("Status returned by HE5_SWdefdatafield(...\"Pressure\",...):    %d\n",status);
+	  
+	  /* Define Appendable Field */
+	  /* ----------------------- */
+	  
+	  /*           First, define chunking          */
+	  /* (the appendable dataset must be chunked)  */
+	  /* ----------------------------------------  */
+	  chunk_dims[0] = 15;
+	  chunk_dims[1] = 40;
+	  chunk_dims[2] = 20;
+	  
+	  status = HE5_SWdefchunk(SWid, RANK, chunk_dims);
+	  printf("\tStatus returned by HE5_SWdefchunk() :                 %d\n",status);
+	  
+	  /* Second, define compression scheme */
+	  /* --------------------------------- */ 
+	  
+	  /* set the value of compression code: */
+	  /*  HDFE_COMP_NONE                  0 */
+	  /*  HDFE_COMP_RLE                   1 */   
+	  /*  HDFE_COMP_NBIT                  2 */   
+	  /*  HDFE_COMP_SKPHUFF               3 */   
+	  /*  HDFE_COMP_DEFLATE               4 */           
+	  /*  HDFE_COMP_SZIP_CHIP             5 */
+	  /*  HDFE_COMP_SZIP_K13              6 */
+	  /*  HDFE_COMP_SZIP_EC               7 */
+	  /*  HDFE_COMP_SZIP_NN               8 */
+	  /*  HDFE_COMP_SZIP_K13orEC          9 */
+	  /*  HDFE_COMP_SZIP_K13orNN          10 */
+	  /*  HDFE_COMP_SHUF_DEFLATE          11 */
+	  /*  HDFE_COMP_SHUF_SZIP_CHIP        12 */
+	  /*  HDFE_COMP_SHUF_SZIP_K13         13 */
+	  /*  HDFE_COMP_SHUF_SZIP_EC          14 */
+	  /*  HDFE_COMP_SHUF_SZIP_NN          15 */
+	  /*  HDFE_COMP_SHUF_SZIP_K13orEC     16 */
+	  /*  HDFE_COMP_SHUF_SZIP_K13orNN     17 */
+	  
+	  comp_code = 16;
+	  /*comp_code = 0;*/
+	  
+	  /* Set compression level: value 0,1,2,3,4,5,6,7,8,9,10,16, or 32 */
+	  /* ------------------------------------------------------------- */
+	  comp_level[0] = 8;
+	  /*comp_level[0] = 0;*/
+	  
+#ifdef HAVE_FILTER_SZIP_ENCODER
+	  status = HE5_SWdefcomp(SWid,comp_code, comp_level);
+	  printf("\tStatus returned by HE5_SWdefcomp() :                  %d\n",status);
+#else
+	  printf("SZIP encoder is not available. The data compression test is skipped.\n");
+#endif
+	  status = HE5_SWdefdatafield(SWid, "Spectra", "Bands,Res2tr,Res2xtr", NULL, H5T_NATIVE_FLOAT, 0);
+	  printf("Status returned by HE5_SWdefdatafield(...\"Spectra\",...) :     %d\n",status);
+	  
+	  /* Define Appendable Field */
+	  /* ----------------------- */
+	  
+	  /*           First, define chunking          */
+	  /* (the appendable dataset must be chunked)  */
+	  /* ----------------------------------------  */
+	  chunk_dims[0] = 20;
+	  
+	  status = HE5_SWdefchunk(SWid, rank, chunk_dims);
+	  printf("\tStatus returned by HE5_SWdefchunk() :                 %d\n",status);
+	  
+	  /* Second, define compression scheme */
+	  /* --------------------------------- */
+	  
+	  /* set the value of compression code: */
+	  /*  HDFE_COMP_NONE                  0 */
+	  /*  HDFE_COMP_RLE                   1 */
+	  /*  HDFE_COMP_NBIT                  2 */
+	  /*  HDFE_COMP_SKPHUFF               3 */
+	  /*  HDFE_COMP_DEFLATE               4 */
+	  /*  HDFE_COMP_SZIP_CHIP             5 */
+	  /*  HDFE_COMP_SZIP_K13              6 */
+	  /*  HDFE_COMP_SZIP_EC               7 */
+	  /*  HDFE_COMP_SZIP_NN               8 */
+	  /*  HDFE_COMP_SZIP_K13orEC          9 */
+	  /*  HDFE_COMP_SZIP_K13orNN          10 */
+	  /*  HDFE_COMP_SHUF_DEFLATE          11 */
+	  /*  HDFE_COMP_SHUF_SZIP_CHIP        12 */
+	  /*  HDFE_COMP_SHUF_SZIP_K13         13 */
+	  /*  HDFE_COMP_SHUF_SZIP_EC          14 */
+	  /*  HDFE_COMP_SHUF_SZIP_NN          15 */
+	  /*  HDFE_COMP_SHUF_SZIP_K13orEC     16 */
+	  /*  HDFE_COMP_SHUF_SZIP_K13orNN     17 */
+	  comp_code = 10;
+	  /*comp_code = 0;*/
+	  
+	  /* Set compression level: value 0,1,2,3,4,5,6,7,8,9,10,16, or 32 */
+	  /* ------------------------------------------------------------- */
+	  comp_level[0] = 8;
+	  /*comp_level[0] = 0;*/
+	  
+#ifdef HAVE_FILTER_SZIP_ENCODER
+	  status = HE5_SWdefcomp(SWid,comp_code, comp_level);
+	  printf("\tStatus returned by HE5_SWdefcomp() :                  %d\n",status);
+#else
+	  printf("SZIP encoder is not available. The data compression test is skipped.\n");
+#endif
+	  status = HE5_SWdefdatafield(SWid, "Count", "GeoTrack", "Unlim", H5T_NATIVE_INT, 0);
+	  printf("Status returned by HE5_SWdefdatafield(...\"Count\",...) :       %d\n",status);
+	  
+	  
+	  /* Define Profile field */
+	  /* -------------------- */
+	  
+	  status = HE5_PRdefine(SWid, "Profile-2000", "ProfDim", NULL, H5T_NATIVE_UINT);
+	  printf("Status returned by HE5_PRdefine(...\"Profile-2000\",...) :      %d\n",status);
+	}
+      
+      /* detach swath after field creation and attach again before setting dimension scale */
+      status = HE5_SWdetach(SWid);
+      SWid = HE5_SWattach(swfid, "Swath1");
+
+      if (SWid != FAIL)
+	{
+	  
+	  /*define one call dimscale setup for "Bnds" in all fields in Swath1 */
+	  nbands = 15;
+	  status = HE5_SWdefdimscale(SWid, "Bands", nbands, H5T_NATIVE_INT, (void *)data);
+	  if (status == -1)
+	    {
+	      printf("\t\tError: Cannot define Dimension Scale for Bands dimemnsion \n");
+	      HE5_SWdetach(SWid);
+	      HE5_SWclose(swfid);
+	      return -1;
+	    }
+	  else
+	    {
+	      printf("Status returned by HE5_SWdefdimscale(): Bands:%d\n",status);
+	    }
+
+	  strcpy(label, "Bands Dim");
+	  strcpy(unit, "None");
+	  strcpy(format, "I2");
+	  
+	  count[0]= 12;
+	  status = HE5_SWwritedscaleattr(SWid, "Bands", "label", H5T_NATIVE_CHAR, count, label);
+	  if (status == -1)
+	    {
+	      printf("\t\tError: Cannot define Dimension Scale label strs for Bands dimemnsion \n");
+	      HE5_SWdetach(SWid);
+	      HE5_SWclose(swfid);
+	      return -1;
+	    }
+	  else
+	    {
+	      printf("Status returned by HE5_SWwritedscaleattr(): label:%d\n",status);
+	    }
+
+	  count[0]= 6;
+	  status = HE5_SWwritedscaleattr(SWid, "Bands", "unit", H5T_NATIVE_CHAR, count, unit);
+	  if (status == -1)
+	    {
+	      printf("\t\tError: Cannot define Dimension Scale unit strs for Bands dimemnsion \n");
+	      HE5_SWdetach(SWid);
+	      HE5_SWclose(swfid);
+	      return -1;
+	    }
+	  else
+	    {
+	      printf("Status returned by HE5_SWwritedscaleattr(): unit:%d\n",status);
+	    }
+
+	  count[0]= 4;
+	  status = HE5_SWwritedscaleattr(SWid, "Bands", "format", H5T_NATIVE_CHAR, count, format);
+	  if (status == -1)
+	    {
+	      printf("\t\tError: Cannot define Dimension Scale format strs for Bands dimemnsion \n");
+	      HE5_SWdetach(SWid);
+	      HE5_SWclose(swfid);
+	      return -1;
+	    }
+	  else
+	    {
+	      printf("Status returned by HE5_SWwritedscaleattr(): format:%d\n",status);
+	    }
+
+	  int datbuf_i1[1] = {-999};
+	  count[0]= 1;
+	  status = HE5_SWwritedscaleattr(SWid, "Bands", "MissingValue", H5T_NATIVE_INT, count, datbuf_i1);
+	  if (status == -1)
+	    {
+	      printf("\t\tError: Cannot define Dimension Scale MissingValue for Bands dimemnsion \n");
+	      HE5_SWdetach(SWid);
+	      HE5_SWclose(swfid);
+	      return -1;
+	    }
+	  else
+	    {
+	      printf("Status returned by HE5_SWwritedscaleattr(): MissingValue:%d\n",status);
+	    }
+
+	  int datbuf_i2[3] = {-999,0,999};
+	  count[0]= 3;
+	  status = HE5_SWwritedscaleattr(SWid, "Bands", "IntValues", H5T_NATIVE_INT, count, datbuf_i2);
+	  if (status == -1)
+	    {
+	      printf("\t\tError: Cannot define Dimension Scale IntValues for Bands dimemnsion \n");
+	      HE5_SWdetach(SWid);
+	      HE5_SWclose(swfid);
+	      return -1;
+	    }
+	  else
+	    {
+	      printf("Status returned by HE5_SWwritedscaleattr(): IntValues:%d\n",status);
+	    }
+	}
+    }
+  status = HE5_SWdetach(SWid);
+  status = HE5_SWclose(swfid);
+  
+  return 0;
+}
+
diff --git a/samples/he5_sw_definefields_szipF_32.f b/samples/he5_sw_definefields_szipF_32.f
new file mode 100644
index 0000000..1ff118c
--- /dev/null
+++ b/samples/he5_sw_definefields_szipF_32.f
@@ -0,0 +1,142 @@
+c	  In this program we (1) open the "swath.he5" HDF-EOS file, (2)
+c	  attach to the "Swath1" swath, and (3) define the swath fields
+c     =============================================================
+
+      program     he5_sw_definefieldsF_32
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     he5_swopen
+      integer     he5_swattach
+      integer     he5_swsetfill
+      integer     he5_swdefgfld
+      integer     he5_swdefdfld
+      integer     he5_prdefine
+      integer     he5_swdefchunk
+      integer     he5_swdefcomp
+      integer     he5_swdetach
+      integer     he5_swclose
+      integer     he5_szip_can_encode
+      integer     swfid, swid
+
+      integer     chunkrank
+      integer     canenc
+      integer*4   chunkdims(3) 
+      integer     compparm(1)
+
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+c     Open the HDF-EOS file, "swath.he5" using "READ/WRITE" access code
+c     -----------------------------------------------------------------
+      swfid = he5_swopen("swath.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid 
+      if (swfid .NE. FAIL) then
+
+         swid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID  returned by he5_swattach():  ',swid 
+         if (swid .NE. FAIL) then
+            
+c     Define Geolocation and Data fields
+c     ----------------------------------
+c     ---------------------------------------------------------------
+c     We define six fields.  The first three, "Time", "Longitude"
+c	  and "Latitude" are geolocation fields and thus we use the
+c	  geolocation dimensions "GeoTrack" and "GeoXtrack" in the field
+c	  definitions.  We also must specify the data type using the
+c	  standard HDF data type codes.  In this example the geolocation
+c	  are 4-byte (32 bit) floating point numbers.
+c     
+c	  The next three fields are data fields.  Note that either
+c	  geolocation or data dimensions can be used. 
+c     ---------------------------------------------------------------
+            
+            status = he5_swdefgfld(swid, "Time", "GeoTrack", 
+     1           " ",HE5T_NATIVE_DOUBLE, 0)
+            write(*,*) 'Status returned by he5_swdefgfld():  ',status 
+
+            status = he5_swdefgfld(swid, "Longitude", 
+     1           "GeoXtrack,GeoTrack",
+     2           " ", HE5T_NATIVE_FLOAT, 0)
+            write(*,*) 'Status returned by he5_swdefgfld():  ',status 
+
+            status = he5_swdefgfld(swid, "Latitude",
+     1           "GeoXtrack,GeoTrack",
+     2           " ", HE5T_NATIVE_FLOAT, 0)
+            write(*,*) 'Status returned by he5_swdefgfld():  ',status 
+
+            status = he5_swdefdfld(swid, "Density",
+     1           "GeoTrack"," ", HE5T_NATIVE_FLOAT, 0)
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status
+
+            status = he5_swdefdfld(swid, "Temperature",
+     1           "GeoXtrack,GeoTrack",
+     2           " ", HE5T_NATIVE_FLOAT, 0)	      
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status 
+	      
+            status = he5_swdefdfld(swid, "Pressure", 
+     1           "Res2xtr,Res2tr",
+     2           " ", HE5T_NATIVE_FLOAT, 0)
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status 
+	      
+		chunkrank = 3
+                chunkdims(1) = 20
+                chunkdims(2) = 40
+                chunkdims(3) = 15
+                compparm(1) = 6
+
+            status = he5_swdefchunk(swid,chunkrank,chunkdims)
+            write(*,*) 'Status returned by he5_swdefchunk(): ',status
+
+            canenc = he5_szip_can_encode()
+            if (canenc .ne. 0) then
+                status = he5_swdefcomp(swid,
+     1                   HE5_HDFE_COMP_SHUF_SZIP_K13orEC,compparm)
+                write(*,*) 'Status returned by he5_swdefcomp():  ',
+     1                      status
+            else
+                write(*,*) 'SZIP encoder is not available.'
+                write(*,*) 'The data compression test is skipped.'
+            endif
+
+            status = he5_swdefdfld(swid, "Spectra", 
+     1           "Res2xtr,Res2tr,Bands",
+     2           " ", HE5T_NATIVE_DOUBLE, 0)	      
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status 
+
+
+c     Define Profile Field
+c     -----------------------  
+            status = he5_prdefine(swid, "Profile-2000", 
+     1           "ProfDim", " ", HE5T_NATIVE_INT)
+            write(*,*) 'Status returned by he5_prdefine():  ',status
+
+
+c     Define Appendable Field
+c     -----------------------  
+c     status = he5_swdefdfld(swid, "Count", "GeoTrack",
+c     1"Unlim", HE5T_NATIVE_INT, 0)	      
+            
+         endif
+      endif
+      
+c     Detach from the swath
+c     ---------------------      
+      status = he5_swdetach(swid)
+      write(*,*) 'Status returned by he5_swdetach():  ',status 
+      
+c     Close the file
+c     --------------      
+      status = he5_swclose(swfid)
+      write(*,*) 'Status returned by he5_swclose():  ',status 
+
+      stop
+      end
+
+
+
+
+
diff --git a/samples/he5_sw_definefields_szipF_64.f b/samples/he5_sw_definefields_szipF_64.f
new file mode 100644
index 0000000..dde6408
--- /dev/null
+++ b/samples/he5_sw_definefields_szipF_64.f
@@ -0,0 +1,145 @@
+c	In this program we (1) open the "swath.he5" HDF-EOS file, (2)
+c	attach to the "Swath1" swath, and (3) define the swath fields
+c   =============================================================
+
+      program     he5_sw_definefieldsF_64
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     he5_swopen
+      integer     he5_swattach
+      integer     he5_swsetfill
+      integer     he5_swdefgfld
+      integer     he5_prdefine
+      integer     he5_swdefdfld
+      integer     he5_swdefchunk
+      integer     he5_swdefcomp
+      integer     he5_swdetach
+      integer     he5_swclose
+      integer     he5_szip_can_encode
+      integer     swfid, swid
+
+      integer     chunkrank
+      integer     canenc
+      integer*8   chunkdims(3)
+      integer     compparm(1)
+
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+c     Open the HDF-EOS file, "swath.he5" using "READ/WRITE" access code
+c     -----------------------------------------------------------------
+      swfid = he5_swopen("swath.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid 
+      if (swfid .NE. FAIL) then
+         
+         swid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID  returned by he5_swattach():  ',swid 
+         if (swid .NE. FAIL) then
+            
+c     Define Geolocation and Data fields
+c     ----------------------------------
+c     ---------------------------------------------------------------
+c     We define six fields.  The first three, "Time", "Longitude"
+c	  and "Latitude" are geolocation fields and thus we use the
+c	  geolocation dimensions "GeoTrack" and "GeoXtrack" in the field
+c	  definitions.  We also must specify the data type using the
+c	  standard HDF data type codes.  In this example the geolocation
+c	  are 4-byte (32 bit) floating point numbers.
+c	     
+c	  The next three fields are data fields.  Note that either
+c	  geolocation or data dimensions can be used. 
+c     ---------------------------------------------------------------
+
+            status = he5_swdefgfld(swid, "Time", "GeoTrack", " ",
+     1           HE5T_NATIVE_DOUBLE, 0)
+            write(*,*) 'Status returned by he5_swdefgfld():  ',status 
+            
+            status = he5_swdefgfld(swid, "Longitude", 
+     1           "GeoXtrack,GeoTrack"," ",HE5T_NATIVE_FLOAT,0)
+            write(*,*) 'Status returned by he5_swdefgfld():  ',status 
+
+            status = he5_swdefgfld(swid,"Latitude",
+     1           "GeoXtrack,GeoTrack"," ",HE5T_NATIVE_FLOAT,0)
+            write(*,*) 'Status returned by he5_swdefgfld():  ',status 
+
+            status = he5_swsetfill(swid,"test_string",HE5T_NATIVE_CHAR,
+     1           'missing')
+            write(*,*) 'Status returned by he5_swsetfill():  ',status
+
+            status = he5_swdefdfld(swid,"test_string","GeoXtrack",
+     1           " ",HE5T_NATIVE_CHAR,0)
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status
+
+            status = he5_swdefdfld(swid,"Density","GeoTrack",
+     1           " ",HE5T_NATIVE_FLOAT,0)
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status
+
+            status = he5_swdefdfld(swid,"Temperature", 
+     1           "GeoXtrack,GeoTrack"," ",HE5T_NATIVE_FLOAT,0)
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status 	      
+	      
+            status = he5_swdefdfld(swid,"Pressure","Res2xtr,Res2tr",
+     1           " ", HE5T_NATIVE_FLOAT, 0)
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status 
+	      
+                chunkrank = 3
+                chunkdims(1) = 20
+                chunkdims(2) = 40
+                chunkdims(3) = 15
+                compparm(1) = 6
+ 
+            status = he5_swdefchunk(swid,chunkrank,chunkdims)
+            write(*,*) 'Status returned by he5_swdefchunk(): ',status
+ 
+            canenc = he5_szip_can_encode()
+            if (canenc .ne. 0) then
+                status = he5_swdefcomp(swid,
+     1                   HE5_HDFE_COMP_SHUF_SZIP_K13orEC,compparm)
+                write(*,*) 'Status returned by he5_swdefcomp():  ',
+     1                      status
+            else
+                write(*,*) 'SZIP encoder is not available.'
+                write(*,*) 'The data compression test is skipped.'
+            endif
+
+            status = he5_swdefdfld(swid, "Spectra", 
+     1           "Res2xtr,Res2tr,Bands"," ",
+     2           HE5T_NATIVE_DOUBLE,0)	      
+            write(*,*) 'Status returned by he5_swdefdfld():  ',status 
+            
+
+c     Define Profile Field
+c     -----------------------  
+      status = he5_prdefine(swid, "Profile-2000", 
+     1           "ProfDim", " ", HE5T_NATIVE_INT)
+            write(*,*) 'Status returned by he5_prdefine():  ',status
+
+
+c     Define Appendable Field
+c     -----------------------  
+c      status = he5_swdefdfld(swid, "Count", "GeoTrack",
+c     1		"Unlim", HE5T_NATIVE_INT, 0)	      
+            
+         endif
+      endif
+      
+c     Detach from the swath
+c     ---------------------      
+      status = he5_swdetach(swid)
+      write(*,*) 'Status returned by he5_swdetach():  ',status 
+      
+c     Close the file
+c     --------------      
+      status = he5_swclose(swfid)
+      write(*,*) 'Status returned by he5_swclose():  ',status 
+      
+      stop
+      end
+
+
+
+
diff --git a/samples/he5_sw_defunlimfld.c b/samples/he5_sw_defunlimfld.c
new file mode 100755
index 0000000..fd9def0
--- /dev/null
+++ b/samples/he5_sw_defunlimfld.c
@@ -0,0 +1,111 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include     <HE5_HdfEosDef.h>
+
+
+/*  In this program we  (1) open the "Swath.h5" HDF-EOS file,   */
+/*  (2) attach to the "Swath1" swath, and (3) define the swath  */
+/*  fields, including appendable field "Spectra".               */
+/* ------------------------------------------------------------ */
+
+
+#define RANK 3
+
+int main()
+{
+
+  herr_t      status = FAIL;
+
+  hid_t       swfid  = FAIL;
+  hid_t       SWid   = FAIL;
+
+  int         comp_level[ 5 ] = { 0, 0, 0, 0, 0 };
+  int         comp_code;
+
+  hsize_t     chunk_dims[ 3 ];
+
+
+  /* Open the file, "Swath.h5", using the H5F_ACC_RDWR access code */
+  /* ------------------------------------------------------------- */
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR);
+  if (swfid != FAIL)
+    {
+	  SWid = HE5_SWattach(swfid, "Swath1");
+	  if (SWid != FAIL)
+		{	  
+		  /*
+		   * We define seven fields.  The first three, "Time", "Longitude"
+		   * and "Latitude" are geolocation fields and thus we use the
+		   * geolocation dimensions "GeoTrack" and "GeoXtrack" in the field
+		   * definitions.
+		   * 
+		   * The next four fields are data fields.  Note that either
+		   * geolocation or data dimensions can be used.
+		   */
+		  status = HE5_SWdefgeofield(SWid, "Time", "GeoTrack", NULL, H5T_NATIVE_DOUBLE, 0);
+		  printf("Status returned by HE5_SWdefgeofield(...\"Time\",...) :         %d\n",status);
+	    
+		  status = HE5_SWdefgeofield(SWid, "Longitude", "GeoTrack,GeoXtrack", NULL, H5T_NATIVE_FLOAT, 0);
+		  printf("Status returned by HE5_SWdefgeofield(...\"Longitude\",...) :    %d\n",status);
+
+		  status = HE5_SWdefgeofield(SWid, "Latitude", "GeoTrack,GeoXtrack", NULL, H5T_NATIVE_FLOAT, 0);
+		  printf("Status returned by HE5_SWdefgeofield(...\"Latitude\",...) :     %d\n",status);
+
+		  status = HE5_SWdefdatafield(SWid, "Density", "GeoTrack", NULL, H5T_NATIVE_FLOAT, 0);
+		  printf("Status returned by HE5_SWdefdatafield(...\"Density\",...) :     %d\n",status);
+
+		  status = HE5_SWdefdatafield(SWid, "Temperature", "GeoTrack,GeoXtrack",NULL, H5T_NATIVE_FLOAT, 0);
+		  printf("Status returned by HE5_SWdefdatafield(...\"Temperature\",...) : %d\n",status);
+
+		  status = HE5_SWdefdatafield(SWid, "Pressure", "Res2tr,Res2xtr", NULL, H5T_NATIVE_DOUBLE, 0);
+		  printf("Status returned by HE5_SWdefdatafield(...\"Pressure\",...) :    %d\n",status);
+
+		  /* Define Appendable Field  */
+		  /* ------------------------ */
+
+		  /* ----------------------------------------  */
+		  /*           First, define chunking          */
+		  /* (the appendable dataset must be chunked)  */
+		  /* ----------------------------------------  */
+		  chunk_dims[0] = 15;
+		  chunk_dims[1] = 40;
+		  chunk_dims[2] = 20;
+	    
+             
+		  status = HE5_SWdefchunk(SWid, RANK, chunk_dims);
+		  printf("\tStatus returned by HE5_SWdefchunk() :                 %d\n",status);
+
+		  comp_code     = 4;
+                  /*comp_code     = 0;*/
+		  comp_level[0] = 6;
+                  /*comp_level[0] = 0;*/
+
+		  status = HE5_SWdefcomp(SWid,comp_code, comp_level);
+		  printf("\tStatus returned by HE5_SWdefcomp() :                  %d\n",status);
+
+		  status = HE5_SWdefdatafield(SWid, "Spectra", "Bands,Res2tr,Res2xtr", "Unlim,Unlim,Unlim", H5T_NATIVE_FLOAT, 0);
+		  printf("Status returned by HE5_SWdefdatafield(...\"Spectra\",...) :     %d\n",status);
+
+                                    /* Define Profile field */
+                  /* -------------------- */
+                  status = HE5_PRdefine(SWid, "Profile-2000", "ProfDim", NULL, H5T_NATIVE_UINT);
+                  printf("Status returned by HE5_PRdefine(...\"Profile-2000\",...) :      %d\n",status);
+
+		}
+    }
+
+  status = HE5_SWdetach(SWid);
+  status = HE5_SWclose(swfid);
+  
+  return 0;
+}
+
+
+
+
+
diff --git a/samples/he5_sw_info.c b/samples/he5_sw_info.c
new file mode 100755
index 0000000..5073c2d
--- /dev/null
+++ b/samples/he5_sw_info.c
@@ -0,0 +1,279 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+
+#include      <HE5_HdfEosDef.h>
+
+/*  In this program we retrieve information about (1) dimensions, (2)  */
+/*   dimension mappings (geolocation relations), (3) swath fields,     */
+/*     and (4) the global/group/local attributes                       */
+/* ------------------------------------------------------------------- */
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  int             i, rk, *rank, rk1, chunk_rank;
+
+  hid_t           swfid = FAIL, SWid = FAIL;
+
+  hid_t           ntype[10];
+  hid_t           dtype = FAIL;
+  hid_t           dtype_char = FAIL;
+  hid_t           dtype1 = FAIL;
+
+  long            ndims, strbufsize, nmaps, nflds, nattr;
+  long            *off, *inc, *indx, offset, incr;
+
+  hsize_t         *sizes, dimsize;
+  hsize_t         dim[8], *dims, dim1[8], chunk_dim[8];
+  hsize_t         n, nelem = 0;
+    
+  char            version[80] = {0};
+  char            *dimname, *dimmap, *fieldlist; 
+  char            dimlist[80], attrlist[80], dimlist1[80];
+
+   int         level[ 5 ]      = { 0, 0, 0, 0, 0 };
+   int         code            = 0;
+
+  /* Open the Swath HDF-EOS File "Swath.h5" for reading only */
+  /* ------------------------------------------------------- */
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDONLY);
+  if (swfid != FAIL)
+    {
+	  HE5_EHgetversion(swfid, version);
+	  printf("HDF-EOS library version: \"%s\" \n", version);
+	
+	  /* Attach the swath "Swath1" */
+	  /* ------------------------  */
+	  SWid = HE5_SWattach(swfid, "Swath1");
+	  if (SWid != FAIL)
+		{
+		  /* Inquire Dimensions */
+		  /* ------------------ */
+		  ndims = HE5_SWnentries(SWid, HE5_HDFE_NENTDIM, &strbufsize);
+		  dims = (hsize_t *) calloc(ndims, sizeof(hsize_t));
+		  dimname = (char *) calloc(strbufsize + 1, 1);
+	    
+		  ndims = HE5_SWinqdims(SWid, dimname, dims);
+
+		  printf("Dimension list: %s\n", dimname);
+		  for (i = 0; i < ndims; i++)
+			printf("dim size: %li\n", (long)dims[i]);
+	    
+		  free(dims);
+		  free(dimname);
+
+		  /* Inquire Dimension Mappings */
+		  /* -------------------------- */
+		  nmaps = HE5_SWnentries(SWid, HE5_HDFE_NENTMAP, &strbufsize);
+	    
+		  off = (long *)calloc(nmaps, sizeof(long));
+		  inc = (long *)calloc(nmaps, sizeof(long));
+		  dimmap = (char *)calloc(strbufsize + 1, 1);
+	    
+		  nmaps = HE5_SWinqmaps(SWid, dimmap, off, inc);
+		  printf("Dimension map: %s\n", dimmap);
+		  for (i = 0; i < nmaps; i++)
+			printf("offset increment: %li %li\n",
+				   off[i], inc[i]);
+		  free(off);
+		  free(inc);
+		  free(dimmap);
+
+
+		  /* Inquire Indexed Dimension Mappings */
+		  /* ---------------------------------- */
+		  nmaps = HE5_SWnentries(SWid, HE5_HDFE_NENTIMAP, &strbufsize);
+		  sizes = (hsize_t *) calloc(nmaps, sizeof(hsize_t));
+		  dimmap = (char *) calloc(strbufsize + 1, 1);
+		  nmaps = HE5_SWinqidxmaps(SWid, dimmap, sizes);
+
+		  printf("Index Dimension map: %s\n", dimmap);
+		  for (i = 0; i < nmaps; i++)
+			printf("sizes: %lu\n", (unsigned long)sizes[i]);
+
+		  free(sizes);
+		  free(dimmap);
+
+
+		  /* Inquire Geolocation Fields */
+		  /* -------------------------- */
+		  nflds = HE5_SWnentries(SWid, HE5_HDFE_NENTGFLD, &strbufsize);
+		  rank = (int *)calloc(nflds, sizeof(int));
+		  fieldlist = (char *) calloc(strbufsize + 1, 1);
+		  nflds = HE5_SWinqgeofields(SWid, fieldlist, rank, ntype);
+
+		  printf("geo fields: %s\n", fieldlist);
+		  for (i = 0; i < nflds; i++)
+			printf("Rank:  %d   Data type:  %d\n", rank[i], ntype[i]);
+
+		  free(rank);
+		  free(fieldlist);
+
+		  /* Inquire Data Fields */
+		  /* ------------------- */
+		  nflds = HE5_SWnentries(SWid, HE5_HDFE_NENTDFLD, &strbufsize);
+		  rank = (int *) calloc(nflds, sizeof(int));
+		  fieldlist = (char *) calloc(strbufsize + 1, 1);
+		  nflds = HE5_SWinqdatafields(SWid, fieldlist, rank, ntype);
+
+		  printf("data fields: %s\n", fieldlist);
+		  for (i = 0; i < nflds; i++)
+			printf("Rank:  %d   Data type:  %d\n", rank[i], ntype[i]);
+
+		  free(rank);
+		  free(fieldlist);
+
+
+		  /* Get info on "GeoTrack" dim */
+		  /* -------------------------- */
+		  dimsize = HE5_SWdiminfo(SWid, "GeoTrack");
+		  printf("Size of GeoTrack: %lu\n", (unsigned long)dimsize);
+
+                  dimsize = HE5_SWdiminfo(SWid, "Unlim");
+                  printf("Size of Unlim: %li\n", (long)dimsize);
+
+		  /* Get info on "GeoTrack/Res2tr" mapping */
+		  /* ------------------------------------- */
+		  status = HE5_SWmapinfo(SWid, "GeoTrack", "Res2tr", &offset, &incr);
+		  printf("Mapping Offset: %li\n", offset);
+		  printf("Mapping Increment: %li\n", incr);
+
+
+		  /* Get info on "IndxTrack/Res2tr" indexed mapping */
+		  /* ---------------------------------------------- */
+		  dimsize = HE5_SWdiminfo(SWid, "IndxTrack");
+		  indx = (long *) calloc(dimsize, sizeof(long));
+		  n = HE5_SWidxmapinfo(SWid, "IndxTrack", "Res2tr", indx);
+		  for (i = 0; i < n; i++)
+			printf("Index Mapping Entry %d: %li\n", i+1, indx[i]);
+		  free(indx);
+
+		  /* Get info on "Longitude" Field */
+		  /* ----------------------------- */
+		  status = HE5_SWfieldinfo(SWid, "Longitude", &rk, dim, &dtype, dimlist, NULL);
+		  printf("Longitude Rank: %d\n", rk);
+		  printf("Longitude NumberType: %d\n", dtype);
+		  printf("Longitude Dimension List: %s\n", dimlist);	    
+		  for (i = 0; i < rk; i++)
+			printf("Dimension %d: %lu\n",i+1,(unsigned long)dim[i]);
+
+                  status = HE5_SWfieldinfo(SWid, "Test_string", &rk1, dim1, &dtype_char, dimlist1, NULL);
+                  printf("Test_string Rank: %d\n", rk1);
+                  printf("Test_string NumberType: %d\n", dtype_char);
+                  printf("Test_string Dimension List: %s\n", dimlist1);
+                  for (i = 0; i < rk1; i++)
+                        printf("Dimension %d: %lu\n",i+1,(unsigned long)dim1[i]);
+
+          dtype1 = FAIL;
+		  /* Get info about Global Attributes */
+		  /* -------------------------------- */
+		  printf("Global Attribute:\n");
+		  status = HE5_SWattrinfo(SWid,"GlobalAttribute",&dtype1, &nelem);
+		  printf("\t\t Data type:          %d\n", dtype1);
+		  printf("\t\t Number of elements: %lu \n", (unsigned long)nelem);    
+ 
+                  nelem = 0;
+                  status = HE5_SWattrinfo(SWid,"GLOBAL_CHAR_ATTR",&dtype1, &nelem);
+                  printf("\t\t Data type:          %d\n", dtype1);
+                  printf("\t\t The size of string: %lu \n", (unsigned long)nelem);
+
+                  nelem = 0;
+                  status = HE5_SWattrinfo(SWid,"GLOBAL_DOUBLE_ATTR",&dtype1, &nelem);
+                  printf("\t\t Data type:          %d\n", dtype1);
+                  printf("\t\t Number of elements: %lu \n", (unsigned long)nelem);
+
+		  nelem = 0;
+          dtype1 = FAIL;
+		  /* Get info about Group Attributes */
+		  /* ------------------------------- */
+		  printf("Group Attribute:\n");
+		  status = HE5_SWgrpattrinfo(SWid,"GroupAttribute",&dtype1,&nelem);
+		  printf("\t\t Data type:          %d\n", dtype1);
+		  printf("\t\t Number of elements: %lu \n", (unsigned long)nelem);    
+
+		  nelem = 777;
+          dtype1 = FAIL;
+		  /* Get info about Local Attributes */
+		  /* ------------------------------- */
+		  printf("Local Attribute:\n");
+		  status = HE5_SWlocattrinfo(SWid,"Density", "LocalAttribute_1",&dtype1,&nelem);
+		  printf("\t\t Data type:          %d\n", dtype1);
+		  printf("\t\t Number of elements: %lu \n", (unsigned long)nelem);    
+
+		  printf("Local Attribute:\n");
+		  status = HE5_SWlocattrinfo(SWid,"Longitude", "LocalAttribute_2",&dtype1,&nelem);
+		  printf("\t\t Data type:          %d\n", dtype1);
+		  printf("\t\t Number of elements: %lu \n", (unsigned long)nelem);    
+
+                  nelem = 0;
+                  status = HE5_SWlocattrinfo(SWid,"Time", "LOCAL_CHAR_ATTR",&dtype1,&nelem);
+                  printf("\t\t Data type:          %d\n", dtype1);
+                  printf("\t\t The size of string: %lu \n", (unsigned long)nelem);
+
+		  /* Inquire Global Attributes */
+		  /* ------------------------- */
+		  printf("Global Attributes:\n");
+		  nattr = HE5_SWinqattrs(SWid, NULL, &strbufsize);
+		  printf("\t\t Number of attributes:             %li \n", nattr);
+		  printf("\t\t String length of attribute list:  %li \n", strbufsize);
+		  n = HE5_SWinqattrs(SWid, attrlist, &strbufsize);
+		  printf("\t\t Attribute list:                   %s \n", attrlist);
+           
+		  /* Inquire Group Attributes */
+		  /* ------------------------ */
+		  strbufsize = 0;
+		  printf("\n");
+		  printf("Group Attributes:\n");
+		  nattr = HE5_SWinqgrpattrs(SWid, NULL, &strbufsize);
+		  printf("\t\t Number of attributes:             %li \n", nattr);
+		  printf("\t\t String length of attribute list:  %li \n", strbufsize);
+		  strcpy(attrlist,"");
+		  nattr = HE5_SWinqgrpattrs(SWid, attrlist, &strbufsize);
+		  printf("\t\t Attribute list:                   %s \n", attrlist);
+
+		  /* Inquire Local Attributes */
+		  /* ------------------------ */
+		  strbufsize = 0;
+		  printf("\n");
+		  printf("Local Attributes:\n");
+		  nattr = HE5_SWinqlocattrs(SWid, "Density", NULL, &strbufsize);
+		  printf("\t\t Number of attributes:             %li \n", nattr);
+		  printf("\t\t String length of attribute list:  %li \n", strbufsize);
+		  strcpy(attrlist,"");
+		  nattr = HE5_SWinqlocattrs(SWid, "Density", attrlist, &strbufsize);
+		  printf("\t\t Attribute list:                   %s \n", attrlist);
+
+		  nattr = HE5_SWinqlocattrs(SWid, "Longitude", NULL, &strbufsize);
+		  printf("\t\t Number of attributes:             %li \n", nattr);
+		  printf("\t\t String length of attribute list:  %li \n", strbufsize);
+		  strcpy(attrlist,"");
+		  nattr = HE5_SWinqlocattrs(SWid, "Longitude", attrlist, &strbufsize);
+		  printf("\t\t Attribute list:                   %s \n", attrlist);
+
+                  status = HE5_SWcompinfo(SWid,"Spectra",&code,level);
+                  printf("\n");
+                  printf("\t\t Compression scheme       Compression level\n");
+                  printf("\t\t    %d,                      %d\n", code, level[0]);
+ 
+                  status = HE5_SWchunkinfo(SWid,"Spectra",&chunk_rank,chunk_dim);
+                  printf("\n");
+                  printf("\t\t Spectra chunk rank: %d\n", chunk_rank);
+                  for (i = 0; i < chunk_rank; i++)
+                        printf("\t\t Spectra chunk dimension %d: %lu\n",i+1, (unsigned long)chunk_dim[i]);
+
+
+		}
+    }
+
+  status = HE5_SWdetach(SWid);
+  status = HE5_SWclose(swfid);
+
+  return 0;
+}
+
diff --git a/samples/he5_sw_infoF_32.f b/samples/he5_sw_infoF_32.f
new file mode 100755
index 0000000..e43d98b
--- /dev/null
+++ b/samples/he5_sw_infoF_32.f
@@ -0,0 +1,207 @@
+c	  In this program we retrieve (1) information about the
+c	  dimensions, (2) the dimension mappings 
+c     (geolocation relations), 	and (3) the swath fields 
+
+      program         he5_sw_infoF_32
+
+      implicit        none
+
+      include         'hdfeos5.inc'
+
+	  integer         i
+          integer         status
+	  integer         swfid, swid
+	  integer         he5_swopen
+	  integer         he5_swattach
+	  integer         he5_swfldinfo
+          integer         he5_swattrinfo
+	  integer         he5_swmapinfo
+          integer         he5_swinqgfldalias
+          integer         he5_swinqdfldalias
+          integer         he5_swchunkinfo
+	  integer         he5_swdetach	  
+	  integer         he5_swclose
+	  integer         rank(32)
+	  integer         ntype(32)
+	  integer         rk
+	  integer         nt
+
+	  integer*4       he5_swinqdims
+	  integer*4       he5_swinqmaps
+          integer*4       he5_swinqgflds
+          integer*4       he5_swinqdflds
+	  integer*4       he5_swdiminfo
+	  integer*4       he5_swimapinfo
+	  integer*4       he5_swinqimaps
+          integer*4       n
+	  integer*4       offset
+	  integer*4       incr
+	  integer*4       ndims
+	  integer*4       nmaps
+	  integer*4       nflds
+	  integer*4       dims(32)
+	  integer*4       off(32)
+	  integer*4       inc(32)
+	  integer*4       sizes(8)
+	  integer*4       indx(32)
+	  integer*4       dimsize
+          integer*4       count
+
+	  character*72    dimname
+	  character*72    dimmap
+          character*72    dimlist
+          character*72    maxdimlst
+          character*72    fieldlist
+
+          integer*4       nfldalias
+          integer*4       strbufsize
+ 
+          character*72    fldaliases
+
+          integer         chunkrank
+          integer*4       chunkdims(32)
+
+
+	  integer         FAIL
+	  parameter       (FAIL=-1)
+
+      
+c     Open the "swath.he5" file for "read only" access
+c     ------------------------------------------------
+	  swfid = he5_swopen("swath.he5", HE5F_ACC_RDONLY)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid
+
+	  if (swfid .NE. FAIL) then
+	   
+c     Attach the swath
+c     ----------------
+		 swid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID returned by he5_swattach():  ',swid
+
+		 if (swid .NE. FAIL) then
+		
+c     Inquire Dimensions
+c     ------------------			
+			ndims = he5_swinqdims(swid, dimname, dims)
+			write(*,*) 'Dimension list: ', dimname
+			do i = 1,ndims
+			   write(*,*) 'dim size: ', dims(i)
+			enddo
+			write(*,*)	      
+						
+c     Inquire Dimension Mappings
+c     --------------------------
+			nmaps = he5_swinqmaps(swid, dimmap, off, inc)
+			write(*,*) 'Dimension map: ', dimmap
+			do i = 1,nmaps
+			   write(*,*) 'offset increment: ', off(i), inc(i)
+			enddo
+			write(*,*)
+
+c     Inquire Indexed Dimension Mappings
+c     ----------------------------------
+			nmaps = he5_swinqimaps(swid, dimmap, sizes)
+			write(*,*) 'Index Dimension map: ', dimmap
+			do i=1,nmaps
+			   write(*,*) 'sizes: ', sizes(i)
+			enddo
+			write(*,*)	      
+			
+c     Inquire Geolocation Fields
+c     --------------------------
+			nflds = he5_swinqgflds(swid, fieldlist, rank, ntype)
+			write(*,*) 'Geolocation fieldlist: ', fieldlist
+			do i=1,nflds
+			   write(*,*) 'field rank & datatype: ',rank(i),ntype(i)
+			enddo
+			write(*,*) 
+
+        nfldalias = he5_swinqgfldalias(swid,fldaliases,strbufsize)
+        write(*,*) 'Fields & aliases list: ',fldaliases
+        write(*,*) 'Length of list is ',strbufsize
+	      
+c     Inquire Data Fields	      
+c     -------------------			
+			nflds = he5_swinqdflds(swid, fieldlist, rank, ntype)
+			write(*,*) 'Data Fieldlist: ', fieldlist
+			do i=1,nflds
+			   write(*,*) 'field rank & datatype: ',rank(i),ntype(i)
+			enddo
+			write(*,*) 
+
+        nfldalias = he5_swinqdfldalias(swid,fldaliases,strbufsize)
+        write(*,*) 'Fields & aliases list: ',fldaliases
+        write(*,*) 'Length of list is ',strbufsize
+
+			
+c     Get info on "GeoTrack" dim
+c     --------------------------			
+	      dimsize = he5_swdiminfo(swid, "GeoTrack")
+	      write(*,*) 'Size of GeoTrack: ', dimsize
+	      write(*,*)
+	      
+
+c     Get info on "GeoTrack/Res2tr" mapping
+c     -------------------------------------		  
+	      status = he5_swmapinfo(swid,"GeoTrack","Res2tr",
+     1         offset,incr)	      
+	      write(*,*) 'Mapping Offset: ', offset
+	      write(*,*) 'Mapping Increment: ', incr
+	      write(*,*)
+
+
+c     Get info on "IndxTrack/Res2tr" indexed mapping
+c     ----------------------------------------------		  
+	      n = he5_swimapinfo(swid, "IndxTrack", "Res2tr", indx)
+	      do i=1,n
+			 write(*,*) 'Index Mapping Entry ', i, indx(i)
+	      enddo
+	      write(*,*)
+	      
+c     Get info on "Longitude" Field
+c     -----------------------------		  
+	      status = he5_swfldinfo(swid,"Longitude",rk,dims,nt,
+     1         dimlist,maxdimlst)
+	      write(*,*) 'Longitude Rank: ', rk
+	      write(*,*) 'Longitude NumberType: ', nt
+	      write(*,*) 'Longitude Dimlist: ', dimlist
+	      write(*,*) 'Longitude Max Dimlist: ', maxdimlst
+	      do i=1,rk
+			 write(*,*) 'Dimension ',i,dims(i)
+	      enddo
+
+        	status = he5_swattrinfo(swid,"GLOBAL_CHAR_ATTR",nt,count)
+              write(*,*) 'GLOBAL_CHAR_ATTR NumberType: ', nt
+              write(*,*) 'GLOBAL_CHAR_ATTR size: ', count
+
+              status = he5_swchunkinfo(swid,"Spectra",chunkrank,
+     1         chunkdims)
+              write(*,*) 'Spectra Chunking Rank: ', chunkrank
+              do i=1,chunkrank
+                         write(*,*) 'Chunking Dimension ',i,chunkdims(i)
+              enddo
+
+
+	   endif
+	  endif
+	  
+c     Detach from swath
+c     -----------------
+	  status = he5_swdetach(swid)
+      write(*,*) 'Status returned by he5_swdetach():  ',status
+
+c     Close the file
+c     --------------
+	  status = he5_swclose(swfid)
+      write(*,*) 'Status returned by he5_swclose():  ',status
+
+	  stop
+	  end
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_infoF_64.f b/samples/he5_sw_infoF_64.f
new file mode 100755
index 0000000..124044f
--- /dev/null
+++ b/samples/he5_sw_infoF_64.f
@@ -0,0 +1,211 @@
+c	In this program we retrieve (1) information about the
+c	dimensions, (2) the dimension mappings (geolocation relations), 
+c	and (3) the swath fields 
+
+      program         he5_sw_infoF_64
+
+      implicit        none
+
+      include         'hdfeos5.inc'
+
+	  integer         i
+          integer         status
+	  integer         swfid, swid
+	  integer         he5_swopen
+	  integer         he5_swattach
+	  integer         he5_swfldinfo
+          integer         he5_swattrinfo
+	  integer         he5_swmapinfo
+          integer         he5_swchunkinfo
+	  integer         he5_swdetach	  
+	  integer         he5_swclose
+	  integer         rank(32)
+	  integer         ntype(32)
+	  integer         rk
+          integer         nt
+
+	  integer*8       he5_swinqdims
+	  integer*8       he5_swinqmaps
+          integer*8       he5_swinqgflds
+          integer*8       he5_swinqdflds
+	  integer*8       he5_swdiminfo
+	  integer*8       he5_swimapinfo
+	  integer*8       he5_swinqimaps
+          integer*8       he5_swinqgfldalias
+	  integer*8       offset
+	  integer*8       incr
+	  integer*8       ndims
+	  integer*8       nmaps
+	  integer*8       nflds
+	  integer*8       dims(32)
+	  integer*8       off(32)
+	  integer*8       inc(32)
+	  integer*8       sizes(8)
+	  integer*8       indx(32)
+	  integer*8       dimsize
+          integer*8       n
+          integer*8       count
+
+	  character*72    dimname
+	  character*72    dimmap
+          character*72    dimlist
+          character*72    maxdimlst
+          character*72    fieldlist
+
+          integer*8       nfldalias
+          integer*8       strbufsize
+ 
+          character*72    fldaliases
+
+          integer         chunkrank
+          integer*8       chunkdims(32)
+
+	  
+	  integer         FAIL
+	  parameter       (FAIL=-1)
+
+c     Open the "swath.he5" file for "read only" access
+c     ------------------------------------------------
+	  swfid = he5_swopen("swath.he5",HE5F_ACC_RDONLY)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid
+
+	  if (swfid .NE. FAIL) then
+	   
+c     Attach the swath
+c     ----------------
+		 swid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID returned by he5_swattach():  ',swid
+
+		 if (swid .NE. FAIL) then
+		
+c     Inquire Dimensions
+c     ------------------			
+			ndims = he5_swinqdims(swid, dimname, dims)
+			write(*,*) 'Dimension list: ', dimname
+			do i = 1,ndims
+			   write(*,*) 'dim size: ', dims(i)
+			enddo
+			write(*,*)	      
+            
+c     Inquire Dimension Mappings
+c     --------------------------
+			nmaps = he5_swinqmaps(swid, dimmap, off, inc)
+			write(*,*) 'Dimension map: ', dimmap
+			do i = 1,nmaps
+			   write(*,*) 'offset increment: ', off(i), inc(i)
+			enddo
+			write(*,*)
+
+c     Inquire Indexed Dimension Mappings
+c     ----------------------------------
+			nmaps = he5_swinqimaps(swid, dimmap, sizes)
+			write(*,*) 'Index Dimension map: ', dimmap
+			do i=1,nmaps
+			   write(*,*) 'sizes: ', sizes(i)
+			enddo
+			write(*,*)	      
+			
+c     Inquire Geolocation Fields
+c     --------------------------
+			nflds = he5_swinqgflds(swid, fieldlist, rank, ntype)
+			write(*,*) 'Geolocation fieldlist: ', fieldlist
+			do i=1,nflds
+			   write(*,*) 'field rank & datatype: ',rank(i),ntype(i)
+			enddo
+			write(*,*) 
+	      
+c     Inquire Data Fields	      
+c     -------------------			
+			nflds = he5_swinqdflds(swid, fieldlist, rank, ntype)
+			write(*,*) 'Data Fieldlist: ', fieldlist
+			do i=1,nflds
+			   write(*,*) 'field rank & datatype: ',rank(i),ntype(i)
+			enddo
+			write(*,*) 
+
+        nfldalias = he5_swinqgfldalias(swid,fldaliases,strbufsize)
+        write(*,*) 'Fields & aliases list: ',fldaliases
+        write(*,*) 'Length of list is ',strbufsize
+
+			
+c     Get info on "GeoTrack" dim
+c     --------------------------			
+	      dimsize = he5_swdiminfo(swid, "GeoTrack")
+	      write(*,*) 'Size of GeoTrack: ', dimsize
+	      write(*,*)
+	      
+
+c     Get info on "GeoTrack/Res2tr" mapping
+c     -------------------------------------		  
+	      status = he5_swmapinfo(swid,"GeoTrack","Res2tr",
+     1         offset,incr)	      
+	      write(*,*) 'Mapping Offset: ', offset
+	      write(*,*) 'Mapping Increment: ', incr
+	      write(*,*)
+
+
+c     Get info on "IndxTrack/Res2tr" indexed mapping
+c     ----------------------------------------------		  
+	      n = he5_swimapinfo(swid, "IndxTrack", "Res2tr", indx)
+	      do i=1,n
+			 write(*,*) 'Index Mapping Entry ', i, indx(i)
+	      enddo
+	      write(*,*)
+	      
+c	  Get info on "Longitude" Field
+c         -----------------------------		  
+	      status = he5_swfldinfo(swid,"Longitude",rk,dims,nt,
+     1         dimlist,maxdimlst)
+	      write(*,*) 'Longitude Rank: ', rk
+	      write(*,*) 'Longitude NumberType: ', nt
+	      write(*,*) 'Longitude Dimlist: ', dimlist
+	      write(*,*) 'Longitude Max Dimlist: ', maxdimlst
+	      do i=1,rk
+			 write(*,*) 'Dimension ',i,dims(i)
+	      enddo
+
+              status = he5_swfldinfo(swid,"test_string",rk,dims,nt,
+     1         dimlist,maxdimlst)
+              write(*,*) 'test_string: Rank: ', rk
+              write(*,*) 'test_string: NumberType: ', nt
+              write(*,*) 'test_string: Dimlist: ', dimlist
+              write(*,*) 'test_string: Max Dimlist: ', maxdimlst
+              do i=1,rk
+                         write(*,*) 'Dimension ',i,dims(i)
+              enddo
+
+			status = he5_swattrinfo(swid,"GLOBAL_CHAR_ATTR",nt,count)
+		write(*,*) 'GLOBAL_CHAR_ATTR NumberType: ', nt
+		write(*,*) 'GLOBAL_CHAR_ATTR size: ', count
+
+              status = he5_swchunkinfo(swid,"Spectra",chunkrank,
+     1         chunkdims)
+              write(*,*) 'Spectra Chunking Rank: ', chunkrank
+              do i=1,chunkrank
+                         write(*,*) 'Chunking Dimension ',i,chunkdims(i)
+              enddo
+
+		  
+	   endif
+	  endif
+	  
+c     Detach from swath
+c     -----------------
+	  status = he5_swdetach(swid)
+      write(*,*) 'Status returned by he5_swdetach():  ',status
+
+c     Close the file
+c     --------------
+	  status = he5_swclose(swfid)
+      write(*,*) 'Status returned by he5_swclose():  ',status
+
+	  stop
+	  end
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_rdexternaldata.c b/samples/he5_sw_rdexternaldata.c
new file mode 100755
index 0000000..b8cb12c
--- /dev/null
+++ b/samples/he5_sw_rdexternaldata.c
@@ -0,0 +1,140 @@
+/*
+ ---------------------------------------------------------------------------- 
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+
+#include    <HE5_HdfEosDef.h>
+
+#define  DIMIN    100
+#define  DIMOUT   60
+
+int main()
+{
+  FILE            *in_1, *in_2, *in_3;
+
+  herr_t          status = FAIL;
+
+  int             i;
+  int             data_in_1[DIMIN];
+  int             data_in_2[DIMIN];
+  int             data_in_3[DIMIN];
+  int             data_out[DIMOUT];
+  int             nfiles = FAIL;
+
+  hid_t           swfid  = FAIL;
+  hid_t           SWid   = FAIL;
+
+  size_t          namelength = 48;
+ 
+  off_t           offset[3];
+
+  char            filelist[256];
+
+  hssize_t        start[2];
+
+  hsize_t         count[2];
+  hsize_t         size[3];
+
+
+
+  /* Create the external data sets */
+  /* ----------------------------- */
+  for (i = 0; i < DIMIN; i++)
+	{
+	  data_in_1[i] = 1000 + i + 1;
+	  data_in_2[i] = 2000 + i + 1;
+	  data_in_3[i] = 3000 + i + 1;
+	}
+
+  /* Open the external data files */
+  /* ---------------------------- */
+  in_1 = fopen("external_1.data", "w");
+  in_2 = fopen("external_2.data", "w");
+  in_3 = fopen("external_3.data", "w");
+
+
+  /* Write data buffers to the external data files */
+  /* --------------------------------------------- */
+  fwrite(data_in_1, sizeof(int), DIMIN, in_1);
+  fwrite(data_in_2, sizeof(int), DIMIN, in_2);
+  fwrite(data_in_3, sizeof(int), DIMIN, in_3);
+
+  /* Close the external data files */
+  /* ----------------------------- */
+  fclose(in_1);
+  fclose(in_2);
+  fclose(in_3);
+  
+
+
+  /* Open the HDF-EOS swath file, "Swath.h5" */
+  /* --------------------------------------- */
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR);
+  if (swfid != FAIL)
+	{
+	  /* Attach the "Swath1" swath */
+	  /* ------------------------- */
+	  SWid = HE5_SWattach(swfid, "Swath1");
+	  if (SWid != FAIL)
+		{
+		  /* Read the external data field */
+		  /* ---------------------------- */
+		  start[0] = 0;
+		  count[0] = DIMOUT;
+		  status = HE5_SWreadfield(SWid, "ExtData", start, NULL, count, data_out);
+		  printf("Status returned by HE5_SWreadfield() :    %d \n", status);
+	    
+		  /* Display external data set */
+		  /* ------------------------- */
+		  printf(" \n");
+		  for (i = 0; i < DIMOUT; i++)
+			printf("%d ", data_out[i]);
+		  
+		  /* Get the number of external files */
+		  /* -------------------------------- */
+		  nfiles = HE5_SWgetextdata(SWid, "ExtData", namelength, filelist, offset, size);
+		  printf(" \n");
+		  printf(" \n");
+		  printf("Number of external files returned by HE5_SWgetextdata() :     %d \n", nfiles);
+		  if (nfiles > 0)
+			{
+			  printf(" \n");
+			  printf("External files: \"%s\"  \n", filelist);
+			  printf(" \n");
+			  printf("offsets:  ");
+			  for (i = 0; i < nfiles; i++)
+				printf("%d ", (int)offset[i]);
+
+			  printf(" \n");
+			  printf("sizes:    ");
+			  for (i = 0; i < nfiles; i++)
+				printf("%lu ", (unsigned long)size[i]);
+			  printf(" \n");
+			  printf(" \n");
+			}
+		}
+	}
+  
+  /* Detach from the swath */
+  /* --------------------- */
+  status = HE5_SWdetach(SWid);
+  printf("Status returned by HE5_SWdetach() :       %d \n", status);
+  
+  /* Close the file */
+  /* -------------- */
+  status = HE5_SWclose(swfid);
+  printf("Status returned by HE5_SWclose() :        %d \n", status);
+
+  return 0;
+}
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_rdexternaldataF_32.f b/samples/he5_sw_rdexternaldataF_32.f
new file mode 100755
index 0000000..f0d57d2
--- /dev/null
+++ b/samples/he5_sw_rdexternaldataF_32.f
@@ -0,0 +1,148 @@
+c
+c ----------------------------------------------------------------------------
+c |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+c ----------------------------------------------------------------------------
+c
+
+      program            he5_sw_rdexternaldataF_32
+
+      implicit           none
+
+      include            'hdfeos5.inc'
+
+      integer            i
+      integer            status
+      integer            he5_swopen
+      integer            he5_swattach
+      integer            he5_swrdfld
+      integer            he5_swgetxdat
+      integer            he5_ehrdwrfile
+      integer            he5_swdetach
+      integer            he5_swclose
+      integer            swfid, swid
+      integer            nfiles
+      integer            datain1(100)
+      integer            datain2(100)
+      integer            datain3(100)
+      integer            dataout(60)
+
+      integer*4          start(2)
+      integer*4          stride(2)
+      integer*4          count(2)
+      integer*4          offset(3)
+      integer*4          size(3)
+      integer*4          nmlgth
+      integer*4          num_elements
+
+      character          filelist*256
+
+      integer            FAIL
+      parameter          (FAIL=-1)
+
+c.....Use this for writing (only) to an existing file
+      integer            WRITE_EXISTING_ONLY
+      parameter          (WRITE_EXISTING_ONLY=0)
+
+c.....Use this for reading (only) from an existing file
+      integer            READ_ONLY
+      parameter          (READ_ONLY=1)
+
+c.....Use this for creating and writing to a file
+      integer            WRITE_NEW
+      parameter          (WRITE_NEW=2)
+
+
+
+c     Create the external data sets
+c     -----------------------------
+      do 10 i=1,100
+
+         datain1(i) = 1000+i
+         datain2(i) = 2000+i
+         datain3(i) = 3000+i        
+         
+ 10   continue
+
+      num_elements = 100
+      
+      status = he5_ehrdwrfile("extf1.dat",WRITE_NEW,
+     1HE5T_NATIVE_INT,num_elements,datain1)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf2.dat",WRITE_NEW,
+     1HE5T_NATIVE_INT,num_elements,datain2)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf3.dat",WRITE_NEW,
+     1HE5T_NATIVE_INT,num_elements,datain3)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+c     Open HDF-EOS swath file, "swath.he5"
+c     -----------------------------------
+	  swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned from he5_swopen():  ',swfid
+
+	  if (swfid .NE. FAIL) then
+		 swid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID returned from he5_swattach():  ',swid
+
+		 if (swid .NE. FAIL) then
+			
+c     Read the external data field 
+c     ----------------------------
+      start(1)  = 0
+      stride(1) = 1
+      count(1)  = 60
+
+      status = he5_swrdfld(swid,"ExtData",
+     1     start,stride,count,dataout)
+      write(*,*) 'Status returned from he5_swrdfld():  ',status
+
+
+c     Display the data
+c     ----------------
+      do i=1,60
+         write(*,*)'External data',dataout(i)
+      enddo
+
+      nmlgth = 48
+
+c     Get the number of external files
+c     --------------------------------     
+      nfiles = he5_swgetxdat(swid,"ExtData",nmlgth,
+     1     filelist,offset,size)
+
+      write(*,*) 'Number of external files',nfiles
+      write(*,*) 'External files:',filelist
+      do i=1,nfiles
+         write(*,*) 'offsets:',offset(i)
+         write(*,*) 'sizes:',size(i)
+      enddo
+
+		 endif
+	  endif
+	
+c     Detach from swath
+c     -----------------
+	  status = he5_swdetach(swid)
+      write(*,*) 'Status returned from he5_swdetach():  ',status
+
+c     Close the file
+c     --------------
+	  status = he5_swclose(swfid)
+      write(*,*) 'Status returned from he5_swclose():  ',status
+      
+	  stop
+	  end
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_rdexternaldataF_64.f b/samples/he5_sw_rdexternaldataF_64.f
new file mode 100755
index 0000000..4fbafaf
--- /dev/null
+++ b/samples/he5_sw_rdexternaldataF_64.f
@@ -0,0 +1,142 @@
+c
+c ----------------------------------------------------------------------------
+c |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+c ----------------------------------------------------------------------------
+c
+
+      program            he5_sw_rdexternaldataF_64
+
+      implicit           none
+ 
+      include            'hdfeos5.inc'
+
+      integer            i
+      integer            status
+      integer            he5_swopen
+      integer            he5_swattach
+      integer            he5_swrdfld
+      integer            he5_swgetxdat
+      integer            he5_ehrdwrfile
+      integer            he5_swdetach
+      integer            he5_swclose
+      integer            swfid, swid
+      integer            nfiles
+      integer            datain1(100)
+      integer            datain2(100)
+      integer            datain3(100)
+      integer            dataout(60)
+
+      integer*8          start(2)
+      integer*8          stride(2)
+      integer*8          count(2)
+      integer*8          offset(3)
+      integer*8          size(3)
+      integer*8          nmlgth
+      integer*8          num_elements
+
+      character          filelist*256
+
+      integer            FAIL
+      parameter          (FAIL=-1)
+
+c.....Use this for writing (only) to an existing file
+      integer            WRITE_EXISTING_ONLY
+      parameter          (WRITE_EXISTING_ONLY=0)
+
+c.....Use this for reading (only) from an existing file
+      integer            READ_ONLY
+      parameter          (READ_ONLY=1)
+
+c.....Use this for creating and writing to a file
+      integer            WRITE_NEW
+      parameter          (WRITE_NEW=2)
+
+c     Create the external data sets
+c     -----------------------------
+      do 10 i=1,100
+
+         datain1(i) = 1000+i
+         datain2(i) = 2000+i
+         datain3(i) = 3000+i        
+         
+ 10   continue
+
+      num_elements = 100
+      
+      status = he5_ehrdwrfile("extf1.dat",WRITE_NEW,
+     1HE5T_NATIVE_INT,num_elements,datain1)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf2.dat",WRITE_NEW,
+     1HE5T_NATIVE_INT,num_elements,datain2)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf3.dat",WRITE_NEW,
+     1HE5T_NATIVE_INT,num_elements,datain3)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+c     Open HDF-EOS swath file, "swath.he5"
+c     ------------------------------------
+	  swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned from he5_swopen():  ',swfid
+
+	  if (swfid .NE. FAIL) then
+		 swid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID returned from he5_swattach():  ',swid
+
+		 if (swid .NE. FAIL) then
+			
+c     Read the external data field 
+c     ----------------------------
+      start(1)  = 0
+      stride(1) = 1
+      count(1)  = 60
+
+      status = he5_swrdfld(swid,"ExtData",
+     1     start,stride,count,dataout)
+      write(*,*) 'Status returned from he5_swrdfld():  ',status
+
+c     Display the data
+c     ----------------
+      do i=1,60
+         write(*,*)'External data',dataout(i)
+      enddo
+
+      nmlgth = 48
+
+c     Get the number of external files
+c     --------------------------------     
+      nfiles = he5_swgetxdat(swid,"ExtData",nmlgth,
+     1     filelist,offset,size)
+
+      write(*,*) 'Number of external files',nfiles
+      write(*,*) 'External files:',filelist
+      do i=1,nfiles
+         write(*,*) 'offsets:',offset(i)
+         write(*,*) 'sizes:',size(i)
+      enddo
+
+		 endif
+	  endif
+	
+c     Detach from swath
+c     -----------------
+	  status = he5_swdetach(swid)
+      write(*,*) 'Status returned from he5_swdetach():  ',status
+
+c     Close the file
+c     --------------
+	  status = he5_swclose(swfid)
+      write(*,*) 'Status returned from he5_swclose():  ',status
+            
+	  stop
+	  end
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_readdata.c b/samples/he5_sw_readdata.c
new file mode 100755
index 0000000..38bae3a
--- /dev/null
+++ b/samples/he5_sw_readdata.c
@@ -0,0 +1,177 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+
+
+#include    <HE5_HdfEosDef.h>
+
+
+/* In this program we (1) open the "Swath.h5" HDF-EOS file, (2) attach to  */
+/* the "Swath1" swath, and (3) read data from the "Longitude" field. Also, */ 
+/*   we read the global/group/local attributes                             */
+/* ----------------------------------------------------------------------- */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  int             i, j, k;
+  int             attr1[4];		/* data buffer for global attribute     */
+  int             attr2[4];		/* ....  for group attribute            */
+  int             attr3[4];		/* ....  for local attribute            */
+
+  hid_t           swfid = FAIL;
+  hid_t           SWid  = FAIL;
+
+  char            attr4[20] = {0};    /* ...  for global 'char' attribute     */
+
+  long            attr5[4];     /* ...  for global 'long' attribute     */
+
+  double          attr6[4];     /* ... for global 'double' attribute    */
+
+  float           attr7[4];     /* ... for local 'float'   attribute    */
+
+  char            attr8[20] = {0};   /* ... for local 'char' attribute    */
+
+  hssize_t        start[2];
+  hsize_t         count[2];
+
+  float           lng[20][10];
+
+  hvl_t           buffer_out[4];/* Buffer to read out data from profile */
+  char            *charname[10] = {0};
+
+
+  /* Open the HDF-EOS swath file, "Swath.h5" */
+  /* --------------------------------------- */
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDONLY);
+  if (swfid != FAIL)
+	{
+	  /* Attach the "Swath1" swath */
+	  /* ------------------------- */
+	  SWid = HE5_SWattach(swfid, "Swath1");
+	  if (SWid != FAIL)
+		{
+		  /* Read the entire longitude field */
+		  /* ------------------------------- */
+		  start[0] = 0;    start[1] = 0;
+		  count[0] = 20;   count[1] = 10;
+		  status = HE5_SWreadfield(SWid, "Longitude", start, NULL, count, lng);
+		  printf("Status returned by HE5_SWreadfield() :    %d \n", status);
+	    
+		  /* Display longitude data */
+		  /* ---------------------- */
+		  for (i = 0; i < 20; i++)
+			for (j = 0; j < 10; j++)
+			  printf("i j Longitude: %d %d %f\n", i, j, lng[i][j]);
+
+                  start[0] = 0;    
+                  count[0] = 10;   
+                  for (i = 0; i < 10; i++)
+                      charname[i] = (char *)malloc(95*sizeof(char));
+                  status = HE5_SWreadfield(SWid, "Test_string", start, NULL, count, charname);
+                  printf("Status returned by HE5_SWreadfield() :    %d \n", status);
+ 
+                  /* Display Test_string data */
+                  /* ---------------------- */
+                  for (i = 0; i < 10; i++)
+                          printf("i = %d	string =  %s\n", i, charname[i]);
+
+                  for (i = 0; i < 10; i++)
+                       free(charname[i]);
+
+		  /* Read data from the Profile */
+		  /* -------------------------- */
+		  start[0] = 0;    count[0] = 4;
+		  status = HE5_PRread(SWid, "Profile-2000", start, NULL, count, buffer_out);
+		  printf("Status returned by HE5_PRread() :         %d \n", status);
+		  
+		  /* Display the profile data */
+		  /* ------------------------ */
+		  for (i = 0; i < 4; i++)
+			{                      
+			  printf("\tThe %d-th element length is %d \n", i, (unsigned)buffer_out[i].len);
+			  for (j = 0; j < buffer_out[i].len; j++)
+				printf("\t\t %d \n", ((unsigned int *)buffer_out[i].p)[j]);
+			}
+		  
+		  /* Release IDs and memory */
+		  /* ---------------------- */
+		  status = HE5_PRreclaimspace(SWid, "Profile-2000", buffer_out);
+		  printf("Status returned by HE5_PRreclaimspace() : %d \n", status);
+		  
+		  /* Read Global 'int' Attribute */
+		  /* --------------------------- */
+		  status = HE5_SWreadattr(SWid, "GlobalAttribute", attr1);
+		  printf("Status returned by HE5_SWreadattr() :     %d \n", status);
+		  printf("Global attribute values:\n");
+		  for (i = 0; i < 4; i++)
+			printf("\t\t %d \n",attr1[i]);
+			
+		  /* Read Group Attribute */
+		  /* -------------------- */
+		  status = HE5_SWreadgrpattr(SWid, "GroupAttribute", attr2);
+		  printf("Status returned by HE5_SWreadgrpattr() :  %d \n", status);
+		  printf("Group attribute values:\n");
+		  for (i = 0; i < 4; i++)
+			printf("\t\t %d \n",attr2[i]);
+		  
+		  /* Read Local Attribute */
+		  /* -------------------- */
+		  status = HE5_SWreadlocattr(SWid, "Density", "LocalAttribute_1", attr3);
+		  printf("Status returned by HE5_SWreadlocattr() :  %d \n", status);
+		  printf("Local attribute values:\n");
+		  for (i = 0; i < 4; i++)
+			printf("\t\t %d \n",attr3[i]);
+
+		  /* Read Local Attribute */
+		  /* -------------------- */
+		  status = HE5_SWreadlocattr(SWid, "Longitude", "LocalAttribute_2", attr7);
+		  printf("Status returned by HE5_SWreadlocattr() :  %d \n", status);
+		  printf("Local attribute values:\n");
+		  for (i = 0; i < 4; i++)
+			printf("\t\t %f \n",attr7[i]);
+
+                  status = HE5_SWreadlocattr(SWid, "Time", "LOCAL_CHAR_ATTR", attr8);
+                  printf("Status returned by HE5_SWreadlocattr() :  %d \n", status);
+                  printf("Local attribute values:\n");
+                  printf("\t\t %s \n",attr8);
+
+		  /* Read Global 'char' Attribute */
+		  /* ---------------------------- */
+		  status = HE5_SWreadattr(SWid, "GLOBAL_CHAR_ATTR", attr4);
+		  printf("Status returned by HE5_SWreadattr() :     %d \n", status);
+		  printf("Global attribute values:\n");
+		  printf("\t\t %s \n",attr4);
+
+		  /* Read Global 'long' Attribute */
+		  /* ---------------------------- */
+		  status = HE5_SWreadattr(SWid, "GLOBAL_LONG_ATTR", attr5);
+		  printf("Status returned by HE5_SWreadattr() :     %d \n", status);
+		  printf("Global attribute values:\n");
+		  for (i = 0; i < 4; i++)
+			printf("\t\t %li \n",attr5[i]);
+
+		  /* Read Global 'double' Attribute */
+		  /* ------------------------------ */
+		  status = HE5_SWreadattr(SWid, "GLOBAL_DOUBLE_ATTR", attr6);
+		  printf("Status returned by HE5_SWreadattr() :     %d \n", status);
+		  printf("Global attribute values:\n");
+		  for (i = 0; i < 4; i++)
+			printf("\t\t %f \n",attr6[i]);
+		  
+		}
+	}
+  
+  status = HE5_SWdetach(SWid);
+  status = HE5_SWclose(swfid);
+  
+  return 0;
+}
+
+
diff --git a/samples/he5_sw_readdataF_32.f b/samples/he5_sw_readdataF_32.f
new file mode 100755
index 0000000..1a70059
--- /dev/null
+++ b/samples/he5_sw_readdataF_32.f
@@ -0,0 +1,183 @@
+c     In this program we (1) open the "swath.he5" file, (2) attach to
+c     the "Swath1" swath, and (3) read data from the "Longitude" field
+c     ================================================================
+
+      program            he5_sw_readdataF_32
+
+      implicit           none
+
+      include            'hdfeos5.inc'
+
+      integer            status
+      integer            he5_swopen
+      integer            he5_swattach
+      integer            he5_swrdfld
+      integer            he5_swrdattr
+      integer            he5_prread
+      integer            he5_swdetach
+      integer            he5_swclose
+      integer            swfid, swid
+      integer            buffer_out(250)
+      integer            i,j,j1
+      integer            element1(25)
+      integer            element2(50)
+      integer            element3(75)
+      integer            element4(100)
+
+      real*4             lng(10,20)
+      real*4             temp(10,20)
+
+      integer*4          attr(4)
+
+      integer*4          start(2)
+      integer*4          stride(2)
+      integer*4          count(2)
+      integer*4          len(4)
+      
+      integer            FAIL
+      parameter          (FAIL=-1)
+      
+c     Open HDF-EOS swath file, "swath.he5"
+c     -----------------------------------
+	  swfid = he5_swopen("swath.he5",HE5F_ACC_RDONLY)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid
+
+	  if (swfid .NE. FAIL) then
+		 swid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID returned by he5_swattach():  ',swid
+
+		 if (swid .NE. FAIL) then
+			
+	      
+c     Read the entire Longitude field
+c     -------------------------------
+			start(1)  = 0
+			start(2)  = 0
+			stride(1) = 1
+			stride(2) = 1
+			count(1)  = 10
+			count(2)  = 20
+            
+			status = he5_swrdfld(swid,"Longitude",
+     1           start,stride,count,lng)
+            
+			do i=1,20
+			   do j=1,10
+				  write(*,*)'i j Longitude ',i,j,lng(j,i)
+			   enddo
+			enddo
+
+                        start(1)  = 0
+                        start(2)  = 0
+                        stride(1) = 1
+                        stride(2) = 1
+                        count(1)  = 10
+                        count(2)  = 20
+ 
+                        status = he5_swrdfld(swid,"L2gpValue",
+     1           start,stride,count,temp)
+ 
+                        do i=1,20
+                           do j=1,10
+                               write(*,*)'i j L2gpValue ',i,j,temp(j,i)
+                           enddo
+                        enddo
+
+
+c     Read data from the Profile
+c     --------------------------
+			start(1)  = 0
+			stride(1) = 1
+			count(1)  = 4
+ 
+      status = he5_prread(swid,"Profile-2000",start,stride,count,
+     1len,buffer_out)
+      write(*,*) '   '
+      write(*,*) 'Status returned from he5_prread:  ',status
+
+c     Display the Profile data
+c     ------------------------
+      do i=1,4
+         write(*,*) 'len(',i,'):  ',len(i)
+      enddo
+
+      write(*,*) '   '
+      write(*,*) 'buffer_out:  '
+      write(*,*)  buffer_out
+      write(*,*) '   '
+
+      j = 0
+      do i=1,25
+        element1(i) = buffer_out(i)      
+        j = j + 1
+      enddo  
+      write(*,*) '1st element: '
+      write(*,*) element1
+      write(*,*) '   '
+
+      j1 = j
+      do i=1,50
+        element2(i) = buffer_out(j1 + i)      
+        j = j + 1
+      enddo  
+      write(*,*) '2nd element: '
+      write(*,*) element2
+      write(*,*) '   '
+
+      j1 = j
+      do i=1,75
+        element3(i) = buffer_out(j1 + i)      
+        j = j + 1
+      enddo  
+      write(*,*) '3rd element: '
+      write(*,*) element3
+      write(*,*) '   '
+
+      j1 = j
+      do i=1,100
+        element4(i) = buffer_out(j1 + i)      
+        j = j + 1
+      enddo  
+      write(*,*) '4th element: '
+      write(*,*) element4
+      write(*,*) '   '
+         
+c     Read Attribute
+c     --------------	      
+			status = he5_swrdattr(swid, "TestAttr", attr)
+			do i=1,4
+			   write(*,*) 'Attribute Element', i, ':', attr(i)
+			enddo	      
+			
+		 endif
+	  endif
+      
+c     Detach from swath
+c     -----------------
+	  status = he5_swdetach(swid)
+      write(*,*) 'Status returned from he5_swdetach:  ',status
+
+c     Close the file
+c     --------------
+	  status = he5_swclose(swfid)
+      write(*,*) 'Status returned from he5_swclose:  ',status
+
+	  stop
+	  end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_readdataF_64.f b/samples/he5_sw_readdataF_64.f
new file mode 100755
index 0000000..52baa03
--- /dev/null
+++ b/samples/he5_sw_readdataF_64.f
@@ -0,0 +1,169 @@
+c     In this program we (1) open the "swath.he5" file, (2) attach to
+c     the "Swath1" swath, and (3) read data from the "Longitude" field
+c     ================================================================
+
+      program            he5_sw_readdataF_64
+
+      implicit           none
+
+      include            'hdfeos5.inc'
+
+      integer            status
+      integer            he5_swopen
+      integer            he5_swattach
+      integer            he5_swrdfld
+      integer            he5_swrdattr
+      integer            he5_prread
+      integer            he5_swdetach
+      integer            he5_swclose
+      integer            swfid, swid
+      integer            buffer_out(250)
+      integer            i,j,j1
+      integer            element1(25)
+      integer            element2(50)
+      integer            element3(75)
+      integer            element4(100)
+
+      real*4             lng(10,20)
+
+      integer*4          attr(4)
+
+      integer*8          start(2)
+      integer*8          stride(2)
+      integer*8          count(2)
+      integer*8          len(4)
+      character*4        charfield(10)
+
+      integer            FAIL
+      parameter          (FAIL=-1)
+
+    
+c     Open HDF-EOS swath file, "swath.he5"
+c     ------------------------------------
+	  swfid = he5_swopen("swath.he5",HE5F_ACC_RDONLY)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid
+
+	  if (swfid .NE. FAIL) then
+		 swid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID returned by he5_swattach():  ',swid
+
+		 if (swid .NE. FAIL) then
+			
+	      
+c     Read the entire Longitude field
+c     -------------------------------
+			start(1)  = 0
+			start(2)  = 0
+			stride(1) = 1
+			stride(2) = 1
+			count(1)  = 10
+			count(2)  = 20
+            
+			status = he5_swrdfld(swid,"Longitude",
+     1           start,stride,count,lng)
+
+			do i=1,20
+			   do j=1,10
+				  write(*,*)'i j Longitude ',i,j,lng(j,i)
+			   enddo
+			enddo
+
+                        start(1)  = 0
+                        stride(1) = 1
+                        count(1)  = 10
+                        status = he5_swrdfld(swid,"test_string",
+     1           start,stride,count,charfield)
+
+                        do i=1,10
+                                  write(*,*)'i = ',i,charfield(i)
+                        enddo
+
+c     Read data from the Profile
+c     --------------------------
+			start(1)  = 0
+			stride(1) = 1
+			count(1)  = 4
+ 
+      status = he5_prread(swid,"Profile-2000",start,stride,count,
+     1len,buffer_out)
+      write(*,*) '   '
+      write(*,*) 'Status returned from he5_prread:  ',status
+
+c     Display the Profile data
+c     ------------------------
+      do i=1,4
+         write(*,*) 'len(',i,'):  ',len(i)
+      enddo
+
+      write(*,*) '   '
+      write(*,*) 'buffer_out:  '
+      write(*,*)  buffer_out
+      write(*,*) '   '
+
+      j = 0
+      do i=1,25
+        element1(i) = buffer_out(i)      
+        j = j + 1
+      enddo  
+      write(*,*) '1st element: '
+      write(*,*) element1
+      write(*,*) '   '
+
+      j1 = j
+      do i=1,50
+        element2(i) = buffer_out(j1 + i)      
+        j = j + 1
+      enddo  
+      write(*,*) '2nd element: '
+      write(*,*) element2
+      write(*,*) '   '
+
+      j1 = j
+      do i=1,75
+        element3(i) = buffer_out(j1 + i)      
+        j = j + 1
+      enddo  
+      write(*,*) '3rd element: '
+      write(*,*) element3
+      write(*,*) '   '
+
+      j1 = j
+      do i=1,100
+        element4(i) = buffer_out(j1 + i)      
+        j = j + 1
+      enddo  
+      write(*,*) '4th element: '
+      write(*,*) element4
+      write(*,*) '   '
+            
+c     Read Attribute
+c     --------------	      
+			status = he5_swrdattr(swid, "TestAttr", attr)
+			do i=1,4
+			   write(*,*) 'Attribute Element', i, ':', attr(i)
+			enddo	      
+			
+		 endif
+	  endif
+      
+c     Detach from swath
+c     -----------------
+	  status = he5_swdetach(swid)
+      write(*,*) 'Status returned from he5_swdetach:  ',status
+      
+c     Close the file
+c     --------------
+	  status = he5_swclose(swfid)
+      write(*,*) 'Status returned from he5_swclose:  ',status
+      
+	  stop
+	  end
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_readdimscale.c b/samples/he5_sw_readdimscale.c
new file mode 100644
index 0000000..a3ae11d
--- /dev/null
+++ b/samples/he5_sw_readdimscale.c
@@ -0,0 +1,187 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Raytheon Systems Company                         |
+ ----------------------------------------------------------------------------
+ */
+
+#include     <HE5_HdfEosDef.h>
+
+/*
+ * In this example we will open an HDF-EOS file and attach to a
+ * swath structures within the file to read a dimension scales
+ * and its attributes
+ */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+  hid_t           swfid = FAIL;
+  hid_t           SWid1 = FAIL;
+  int             i,j;
+  int             bufsize;
+  int            *databuff;
+  long            nattr;
+  long            strbufsize;
+  char           *attrlist;
+  size_t          fldnmlen[HE5_HDFE_NAMBUFSIZE];
+  char           *fldnm[HE5_HDFE_NAMBUFSIZE];
+  char           *attrname = (char *)NULL;
+  hid_t          *ntype;
+  hsize_t         count = 0;
+  void           *attr;
+  int            *attr_int;
+  float          *attr_flt;
+  char           *attr_char;
+  hsize_t         dimsize;
+  hid_t           numtype;
+
+  /*
+   * Open the HDF swath file, "Swath.h5".
+   */
+
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR);
+ 
+  /*
+   * If the swath file cannot be found, HE5_SWopen will return -1 for the file
+   * handle (swfid).  We there check that this is not the case before
+   * proceeding with the other routines.
+   * 
+   * The HE5_SWattach routine returns the handle to the existing swath "Swath1",
+   * SWid.  If the swath is not found, HE5_SWattach returns -1 for the handle.
+   */ 
+
+  if (swfid != FAIL)
+    {	  
+      SWid1 = HE5_SWattach(swfid, "Swath1");
+
+      /* the field Spectra has Bands,Res2tr,Res2xtr dimensions. 
+	 Bands dim is set to 15
+      */
+
+      if (SWid1 == FAIL)
+	{
+	  printf("\t\tError: Cannot attach to swath \"Swath1\"\n");
+	  HE5_SWclose(swfid);
+	  return -1;
+	}
+
+      bufsize = HE5_SWgetdimscale(SWid1, "Spectra", "Bands", &dimsize, &numtype, NULL);
+      if (bufsize == -1)
+	{
+	  printf("\t\tError: Cannot get Dimension Scale size for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_SWdetach(SWid1);
+	  HE5_SWclose(swfid);
+	  return -1;
+	}
+      else
+	{
+	  printf ("bufsize = %d \n",(int)bufsize);
+	  printf ("dimsize = %d \n",(int)dimsize);
+	  printf ("numtype = %d\n", (int)numtype);
+	}
+      databuff = (int *) malloc(bufsize);
+      bufsize = HE5_SWgetdimscale(SWid1, "Spectra", "Bands", &dimsize, &numtype, (void *)databuff);
+
+      if (bufsize == -1)
+	{
+	  printf("\t\tError: Cannot get Dimension Scale for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_SWdetach(SWid1);
+	  HE5_SWclose(swfid);
+	  free(databuff);
+	  return -1;
+	}
+      else
+	{
+	  printf ("First 10 values are:\n");
+	  for( i = 0; i < 10; i++)
+	    {
+	      printf ("DimscaleValue[%d] = %d\n",i,databuff[i]);
+	    }
+	}
+
+      nattr = HE5_SWinqdscaleattrs(SWid1, "Bands", NULL, &strbufsize);
+      if ( nattr < 0 )
+	{
+	  printf("\t\tError: Cannot get Dimension Scale attribute list for \"Bands\"\n");
+	  HE5_SWdetach(SWid1);
+	  HE5_SWclose(swfid);
+	  free(attrlist);
+	  return -1;
+	}
+
+      attrlist = (char *) calloc(strbufsize + 2, sizeof(char));
+      nattr = HE5_SWinqdscaleattrs(SWid1, "Bands", attrlist, &strbufsize);
+      if ( nattr < 0 )
+	{
+	  printf("\t\tError: Cannot get Dimension Scale attribute list for \"Bands\"\n");
+	  HE5_SWdetach(SWid1);
+	  HE5_SWclose(swfid);
+	  free(attrlist);
+	  return -1;
+	}
+	  printf(" \n");
+	  printf("Dimension scale for \"Bands\" Attribute: \n");
+      nattr = HE5_EHparsestr(attrlist, ',', fldnm, fldnmlen);
+      if(nattr != FAIL)
+	{
+	  for( i = 0; i < nattr; i++)
+	    {
+	      attrname = (char *)calloc(fldnmlen[i] + 1, sizeof(char));
+	      memmove(attrname,fldnm[i],fldnmlen[i]);
+	      ntype = (hid_t *)calloc(1, sizeof(hid_t));
+	      if(strcmp(attrname, "REFERENCE_LIST") ==0 ) continue;
+	      status = HE5_SWdscaleattrinfo(SWid1,"Bands", attrname, ntype, &count);
+	      if( (int)*ntype == 0) {
+		attr_int = (int *)malloc(count*sizeof(int));
+		attr = (void *) attr_int;
+	      }
+
+	      if( (int)*ntype == 10) {
+		attr_flt = (float *)malloc(count*sizeof(float));
+		attr = (void *) attr_flt;
+	      }
+
+	      if( (int)*ntype == 57) {
+		attr_char = (char *)malloc((count+1)*sizeof(char));
+		attr = (void *) attr_char;
+	      }
+	      status = HE5_SWreaddscaleattr(SWid1,"Bands", attrname, attr);
+	      printf("\n");
+	      printf("Status returned by HE5_SWreaddscaleattr() :  %d \n", status );
+	      printf("\tAttribute Name:               %s  \n",attrname);
+	      printf("\tNumber of attribute elements: %lu \n", (unsigned long)count);
+	      printf("\tData type of attribute:       %d \n", (int)*ntype);
+
+	      if( (int)*ntype == 0) {
+		attr_int = (int *)attr;
+		for (j = 0; j < count; j++)
+		  {
+		    printf("\tAttrvalue[%d]:                 %d \n", j,attr_int[j]);
+		  }
+	      }
+
+	      if( (int)*ntype == 10) {
+		attr_flt = (float *)attr;
+		for (j = 0; j < count; j++)
+		  {
+		    printf("\tAttrvalue[%d]:                 %f \n", j,attr_flt[j]);
+		  }
+	      }
+
+	      if( (int)*ntype == 57) {
+		attr_char = (char *)attr;
+		attr_char[count]='\0';
+		printf("\tAttrvalue:                    %s \n", attr_char);
+		free(attr_char);
+	      }
+	    }
+	}
+
+      HE5_SWdetach(SWid1);
+
+      HE5_SWclose(swfid);
+      
+      return 0;
+    }
+}
diff --git a/samples/he5_sw_readdimscaleF_32.f b/samples/he5_sw_readdimscaleF_32.f
new file mode 100644
index 0000000..558d135
--- /dev/null
+++ b/samples/he5_sw_readdimscaleF_32.f
@@ -0,0 +1,180 @@
+      program     he5_sw_readdimscaleF_32
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     i, j, jj
+      integer     he5_swopen
+      integer     he5_swattach
+      integer     he5_swwrfld
+      integer     he5_swwrattr
+      integer     he5_swwrgattr
+      integer     he5_ehwrglatt
+      integer     he5_swwrlattr 
+      integer     he5_swdetach
+      integer     he5_swclose
+      integer     HE5_SWdscaleattrinfo, HE5_SWreaddscaleattr
+      integer     HE5_SWgetdimscale, HE5_SWinqdscaleattrs
+      integer     ntype
+      integer     swfid,swid1
+      real*4      datbuf_f(1) 
+      integer*4   datbuf_i(3)
+      integer*4   nbands
+      integer     bands(3)
+      integer*4   datbuf_i2(2) 
+      integer     count(2)
+      integer         attr_int(25)
+      real*4          attr_flt(25)
+      real*8          attr_dbl(25)
+      character       attr_char(25)
+      integer         dimsize
+      integer         bufsize, nattr 
+      integer         data(30)
+      integer         FAIL
+      parameter       (FAIL=-1)
+      character*100   attrlist
+      character*100   strbufsize
+      character*15    attrname(10)
+      integer         numtype
+
+!  /*
+!   * Open the HDF swath file, "swath.he5".
+!   */
+
+      swfid = HE5_SWopen("swath.he5", HE5F_ACC_RDWR)
+ 
+!  /*
+!   * If the swath file cannot be found, HE5_SWopen will return -1 for the file
+!   * handle (swfid).  We there check that this is not the case before
+!   * proceeding with the other routines.
+!   * 
+!   * The HE5_SWattach routine returns the handle to the existing swath "Swath1",
+!   * SWid.  If the swath is not found, HE5_SWattach returns -1 for the handle.
+!   */ 
+
+      if (swfid .ne. FAIL) then
+     
+         SWid1 = HE5_SWattach(swfid, "Swath1")
+
+!      /* the field Pollution has Time,YDim,XDim dimensions. 
+!	 xdim = 120
+!	 ydim = 200
+!	 Time dim is set to 10
+!      */
+
+         if (SWid1 .eq. FAIL) then
+            
+            write(*,*) 'Error: Cannot attach to swath  Swath1'
+            status = HE5_SWclose(swfid)
+            stop
+         endif
+
+         bufsize = HE5_SWgetdimscale(SWid1, "Spectra", "Bands", 
+     1        dimsize, numtype, data)
+         if (bufsize .eq. -1) then
+	
+            write(*,*) 'Error:Cannot get Dimension Scale size of Bands',
+     1           ' dimemnsion in field Spectra'
+            status = HE5_SWdetach(SWid1)
+            status = HE5_SWclose(swfid)
+            stop
+            
+         else
+            
+            write(*,*) 'bufsize = ',bufsize
+            write(*,*) 'dimsize = ',dimsize
+            write(*,*) 'numtype = ',numtype
+            
+            write(*,*) 'Values are:'
+            do i = 1,dimsize
+               write(*,*) 'DimscaleValue[',i,'] = ',data(i)
+            enddo
+         endif
+         
+         nattr = HE5_SWinqdscaleattrs(SWid1, "Bands", attrlist, 
+     1        strbufsize)
+         if ( nattr .lt. 0 ) then
+            
+            write(*,*) 'Error: Cannot get Dimension Scale attribute',
+     1           ' list for Bands'
+            status = HE5_SWdetach(SWid1)
+            status = HE5_SWclose(swfid)
+            stop
+         endif
+         write(*,*) ' '
+         write(*,*) 'Dimension scale for Bands Attribute:'
+
+         attrname(1) = 'label'
+         attrname(2) = 'unit'
+         attrname(3) = 'format'
+         attrname(4) = 'MissingValue'
+         attrname(5) = 'IntValues'
+         do j = 1,5
+            attr_char = ''
+            count(1)= 0
+            count(2)= 0
+
+            status = HE5_SWdscaleattrinfo(SWid1,"Bands", attrname(j), 
+     1        ntype, count)
+                              
+            if( ntype .eq. 0) then
+               status = HE5_SWreaddscaleattr(SWid1,"Bands", attrname(j), 
+     1              attr_int)
+            endif
+
+            if( ntype .eq. 10) then
+               status = HE5_SWreaddscaleattr(SWid1,"Bands", attrname(j), 
+     1              attr_flt)
+            endif
+            
+            if( ntype .eq. 11) then
+               status = HE5_SWreaddscaleattr(SWid1,"Bands", attrname(j), 
+     1              attr_dbl)
+            endif
+            
+            if( ntype .eq. 57) then
+               status = HE5_SWreaddscaleattr(SWid1,"Bands", attrname(j), 
+     1              attr_char)
+            endif
+
+            write(*,*) ' '
+            write(*,*) 'Status returned by HE5_SWreaddscaleattr() :', 
+     1           status
+            write(*,*) 'Attribute Name: ',attrname(j)
+            write(*,*) 'Number of attribute elements: ', count(1),
+     1     '   ',count(2)
+            write(*,*) 'Data type of attribute: ', ntype
+            
+            if( ntype .eq. 0) then
+               do jj = 1,count(1)
+                  write(*,*) 'Attrvalue[',jj,']: ', attr_int(jj)
+               enddo
+            endif
+            
+            if( ntype .eq. 10) then
+               do jj = 1,count(1)
+                  write(*,*) 'Attrvalue[',jj,']: ',attr_flt(jj)
+               enddo
+            endif
+
+            if( ntype .eq. 11) then
+               do jj = 1,count(1)
+                  write(*,*) 'Attrvalue[',jj,']: ',attr_dbl(jj)
+               enddo
+            endif
+
+            if( ntype .eq. 57) then
+               write(*,*) 'Attrvalue: ', attr_char
+            endif
+         enddo
+      endif
+
+      status = HE5_SWdetach(SWid1)
+      
+      status = HE5_SWclose(swfid)
+      
+      stop
+      end
+
diff --git a/samples/he5_sw_setup.c b/samples/he5_sw_setup.c
new file mode 100755
index 0000000..bf3547e
--- /dev/null
+++ b/samples/he5_sw_setup.c
@@ -0,0 +1,120 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include    <HE5_HdfEosDef.h>
+
+
+/*   In this program we (1) open an HDF-EOS file, (2) create the swath    */
+/*  interface within the file, and (3) define the swath field dimensions  */
+/*  --------------------------------------------------------------------  */
+
+int main()
+{
+  herr_t         status = FAIL; 
+
+  int            i, j;
+
+  hid_t          swfid = FAIL;
+  hid_t          SWid  = FAIL;
+
+  long           indx[12] = {0,1,3,6,7,8,11,12,14,24,32,39};
+
+  
+  /* Open a new HDF-EOS swath file, "Swath.h5" */
+  /* ----------------------------------------- */
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_TRUNC);
+  printf("File ID returned by HE5_SWopen():       %d \n", swfid);
+
+  /* Create the swath, "Swath1", within the file */
+  /* ------------------------------------------- */
+  SWid = HE5_SWcreate(swfid, "Swath1");
+  printf("Swath ID returned by HE5_SWcreate():    %d \n", SWid);
+
+  /* Define dimensions and specify their sizes */
+  /* ----------------------------------------- */
+  status = HE5_SWdefdim(SWid, "GeoTrack", 20);
+  printf("Status returned by HE5_SWdefdim():      %d \n", status);
+
+  status = HE5_SWdefdim(SWid, "GeoXtrack", 10);
+  printf("Status returned by HE5_SWdefdim():      %d \n", status);
+
+  status = HE5_SWdefdim(SWid, "Res2tr", 40);
+  printf("Status returned by HE5_SWdefdim():      %d \n", status);
+
+  status = HE5_SWdefdim(SWid, "Res2xtr", 20);
+  printf("Status returned by HE5_SWdefdim():      %d \n", status);
+
+  status = HE5_SWdefdim(SWid, "Bands", 15);
+  printf("Status returned by HE5_SWdefdim():      %d \n", status);
+
+  status = HE5_SWdefdim(SWid, "IndxTrack", 12);
+  printf("Status returned by HE5_SWdefdim():      %d \n", status);
+
+  status = HE5_SWdefdim(SWid, "ProfDim", 4);
+  printf("Status returned by HE5_SWdefdim():      %d \n", status);
+
+  /* Define "External" Dimension */
+  /* --------------------------- */
+  status = HE5_SWdefdim(SWid, "ExtDim", 60);
+  printf("Status returned by HE5_SWdefdim():      %d \n", status);
+     
+  /* Define Unlimited Dimension */
+  /* -------------------------- */
+  status = HE5_SWdefdim(SWid, "Unlim", H5S_UNLIMITED);
+  printf("Status returned by HE5_SWdefdim():      %d \n", status);
+
+  /*
+   * Once the dimensions are defined, the relationship (mapping) between the
+   * geolocation dimensions, such as track and cross track, and the data
+   * dimensions, must be established.  This is done through the HE5_SWdefdimmap
+   * routine.  It takes as input the swath id, the names of the dimensions
+   * designating the geolocation and data dimensions, respectively, and the
+   * offset and increment defining the relation.
+   * 
+   * In the first example we relate the "GeoTrack" and "Res2tr" dimensions
+   * with an offset of 0 and an increment of 2.  Thus the ith element of
+   * "Geotrack" corresponds to the 2 * ith element of "Res2tr".
+   * 
+   * In the second example, the ith element of "GeoXtrack" corresponds to the
+   * 2 * ith + 1 element of "Res2xtr".
+   *
+   * Note that there is no relationship between the geolocation dimensions
+   * and the "Bands" dimension.
+   */
+
+  /* Define Dimension Mapping */
+  /* ------------------------ */
+  status = HE5_SWdefdimmap(SWid, "GeoTrack", "Res2tr", 0, 2);
+  printf("Status returned by HE5_SWdefdimmap():   %d \n", status);
+
+  status = HE5_SWdefdimmap(SWid, "GeoXtrack", "Res2xtr", 1, 2);
+  printf("Status returned by HE5_SWdefdimmap():   %d \n", status);
+
+  /* Define Indexed Mapping */
+  /* ---------------------- */
+  status = HE5_SWdefidxmap(SWid, "IndxTrack", "Res2tr", indx);
+  printf("Status returned by HE5_SWdefidxmap():   %d \n", status);
+
+  /* Close the swath interface */
+  /* ------------------------- */
+  status = HE5_SWdetach(SWid);
+  printf("Status returned by HE5_SWdetach():      %d \n", status);
+
+  /* Close the swath file */
+  /* -------------------- */
+  status = HE5_SWclose(swfid);
+  printf("Status returned by HE5_SWclose():       %d \n", status);
+
+
+  return 0;
+
+}
+
+
+
+
+
diff --git a/samples/he5_sw_setupF_32.f b/samples/he5_sw_setupF_32.f
new file mode 100755
index 0000000..bb36d68
--- /dev/null
+++ b/samples/he5_sw_setupF_32.f
@@ -0,0 +1,177 @@
+c     In this program we (1) open an HDF-EOS file, (2) create the 
+c     swath interface, and (3) define the swath field dimensions
+c     ===========================================================
+      
+      program    he5_sw_setupF_32
+
+      implicit   none
+
+      include    'hdfeos5.inc'
+
+      integer    status
+      integer    he5_swopen
+      integer    he5_swcreate
+      integer    he5_swdefdim
+      integer    he5_swdefmap
+      integer    he5_swdefimap
+      integer    he5_swdetach
+      integer    he5_swclose
+      integer    swfid, swid
+
+      integer*4  dtrack, extdata
+      integer*4  offset, incr
+      integer*4  indx(12) 
+
+      data indx  /0,1,3,6,7,8,11,12,14,24,32,39/
+
+c     Open the HDF-EOS file, "swath.he5" using "TRUNC" file access code 
+c     -----------------------------------------------------------------
+      swfid = he5_swopen('swath.he5',HE5F_ACC_TRUNC)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid
+
+c     Create the swath, "Swath1", within the file 
+c     -------------------------------------------
+      swid = he5_swcreate(swfid, "Swath1")
+      write(*,*) 'Swath ID returned by he5_swcreate():  ',swid
+    
+c     Define Geolocation and Data dimensions
+c     --------------------------------------
+c     ----------------------------------------------------------------------
+c     Typically, many fields within a swath share the same dimension. The
+c     swath interface therefore provides a way of defining dimensions that
+c     will then be used to define swath fields.  A dimension is defined with
+c     a name and a size and is connected to the particular swath through the
+c     swath id.  In this example, we define the geo- location track and
+c     cross track dimensions with size 20 and 10 respectively and two
+c     dimensions corresponding to these but with twice the resolution.
+c     Also, we define "Bands" and "unlimited" dimensions.
+c     ----------------------------------------------------------------------
+      dtrack = 20
+      status = he5_swdefdim(swid, "GeoTrack", dtrack)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+      dtrack = 10
+      status = he5_swdefdim(swid, "GeoXtrack", dtrack)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+      dtrack = 40
+      status = he5_swdefdim(swid, "Res2tr", dtrack)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+      dtrack = 20
+      status = he5_swdefdim(swid, "Res2xtr", dtrack)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+      dtrack = 15
+      status = he5_swdefdim(swid, "Bands", dtrack)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+      dtrack = 12
+      status = he5_swdefdim(swid, "IndxTrack", dtrack)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+      dtrack = 4
+      status = he5_swdefdim(swid, "ProfDim", dtrack)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+c     Define "External" dimension
+c     ---------------------------
+      extdata = 60
+      status = he5_swdefdim(swid, "ExtDim", extdata)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+c     Define Unlimited (appendable) dimension
+c     ---------------------------------------
+      status = he5_swdefdim(swid, "Unlim", HE5S_UNLIMITED_F)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+c     ----------------------------------------------------------------------
+c     Once the dimensions are defined, the relationship (mapping)between the
+c     geolocation dimensions, such as track and cross track, and the data
+c     dimensions, must be established.  This is done through the SWdefdimmap
+c     routine.  It takes as input the swath id, the names of the dimensions
+c     designating the geolocation and data dimensions, respectively, and the
+c     offset and increment defining the relation.
+c     
+c     In the first example we relate the "GeoTrack" and "Res2tr" dimensions
+c     with an offset of 0 and an increment of 2.  Thus the ith element of
+c     "Geotrack" corresponds to the 2 * ith element of "Res2tr".
+c   
+c     In the second example, the ith element of "GeoXtrack" corresponds to 
+c     the 2 * ith + 1 element of "Res2xtr".
+c     -----------------------------------------------------------------------  
+      
+c     Define dimension mappings
+c     -------------------------
+      offset = 0
+      incr   = 2
+      status = he5_swdefmap(swid, "GeoTrack", 
+     1     "Res2tr", offset, incr)
+      write(*,*) 'Status returned by he5_swdefmap():  ',status
+
+      offset = 1
+      status = he5_swdefmap(swid, "GeoXtrack", 
+     1     "Res2xtr", offset, incr)
+      write(*,*) 'Status returned by he5_swdefmap():  ',status
+
+c     Define indexed dimension mapping
+c     --------------------------------
+      status = he5_swdefimap(swid, "IndxTrack", 
+     1     "Res2tr", indx)
+      write(*,*) 'Status returned by he5_swdefimap():  ',status
+
+c     Detach from the swath
+c     ---------------------
+      status = he5_swdetach(swid)
+      write(*,*) 'Status returned by he5_swdetach():  ',status
+
+c     Close the swath file
+c     --------------------
+      status = he5_swclose(swfid)
+      write(*,*) 'Status returned by he5_swclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_setupF_64.f b/samples/he5_sw_setupF_64.f
new file mode 100755
index 0000000..8ba87b4
--- /dev/null
+++ b/samples/he5_sw_setupF_64.f
@@ -0,0 +1,144 @@
+c     In this program we (1) open an HDF-EOS file, (2) create the 
+c     swath interface, and (3) define the swath field dimensions
+c     ===========================================================
+
+      program            he5_sw_setupF_64
+
+      implicit           none
+
+      include            'hdfeos5.inc'
+      include            'hdfeos5_64.inc'
+
+      integer            status
+      integer            he5_swopen
+      integer            he5_swcreate
+      integer            he5_swdefdim
+      integer            he5_swdefmap
+      integer            he5_swdefimap
+      integer            he5_swdetach
+      integer            he5_swclose
+      integer            swfid, swid
+
+      integer*8          dtrack, extdata
+      integer*8          offset, incr
+      integer*8          indx(12)
+
+      data indx  /0,1,3,6,7,8,11,12,14,24,32,39/
+
+c     Open the HDF-EOS file, "swath.he5" using "TRUNC" file access code 
+c     -----------------------------------------------------------------
+      swfid = he5_swopen("swath.he5",HE5F_ACC_TRUNC)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid
+
+c     Create the swath, "Swath1", within the file 
+c     -------------------------------------------
+      swid = he5_swcreate(swfid, "Swath1")
+      write(*,*) 'Swath ID returned by he5_swcreate():  ',swid
+    
+c     Define Geolocation and Data dimensions
+c     --------------------------------------
+c     ----------------------------------------------------------------------
+c     Typically, many fields within a swath share the same dimension. The
+c     swath interface therefore provides a way of defining dimensions that
+c     will then be used to define swath fields.  A dimension is defined with
+c     a name and a size and is connected to the particular swath through the
+c     swath id.  In this example, we define the geo- location track and
+c     cross track dimensions with size 20 and 10 respectively and two
+c     dimensions corresponding to these but with twice the resolution.
+c     Also, we define "Bands" and "unlimited" dimensions.
+c     ----------------------------------------------------------------------
+      dtrack = 73
+      status = he5_swdefdim(swid, "GeoTrack", dtrack)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+      dtrack = 10
+      status = he5_swdefdim(swid, "GeoXtrack", dtrack)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+      dtrack = 40
+      status = he5_swdefdim(swid, "Res2tr", dtrack)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+      dtrack = 20
+      status = he5_swdefdim(swid, "Res2xtr", dtrack)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+      dtrack = 15
+      status = he5_swdefdim(swid, "Bands", dtrack)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+      dtrack = 12
+      status = he5_swdefdim(swid, "IndxTrack", dtrack)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+      dtrack = 4
+      status = he5_swdefdim(swid, "ProfDim", dtrack)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+      
+c     Define "External" dimension
+c     ---------------------------
+      extdata = 60
+      status = he5_swdefdim(swid, "ExtDim", extdata)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+     
+c     Define Unlimited (appendable) dimension
+c     ---------------------------------------
+      status = he5_swdefdim(swid, "Unlim", HE5S_UNLIMITED_F_64)
+      write(*,*) 'Status returned by he5_swdefdim():  ',status
+
+c     ----------------------------------------------------------------------
+c     Once the dimensions are defined, the relationship (mapping)between the
+c     geolocation dimensions, such as track and cross track, and the data
+c     dimensions, must be established.  This is done through the SWdefdimmap
+c     routine.  It takes as input the swath id, the names of the dimensions
+c     designating the geolocation and data dimensions, respectively, and the
+c     offset and increment defining the relation.
+c     
+c     In the first example we relate the "GeoTrack" and "Res2tr" dimensions
+c     with an offset of 0 and an increment of 2.  Thus the ith element of
+c     "Geotrack" corresponds to the 2 * ith element of "Res2tr".
+c   
+c     In the second example, the ith element of "GeoXtrack" corresponds to 
+c     the 2 * ith + 1 element of "Res2xtr".
+c     -----------------------------------------------------------------------  
+      
+c     Define dimension mappings
+c     -------------------------
+      offset = 0
+      incr   = 2
+      status = he5_swdefmap(swid, "GeoTrack", "Res2tr",
+     1offset, incr)
+      write(*,*) 'Status returned by he5_swdefmap():  ',status
+
+      offset = 1
+      status = he5_swdefmap(swid, "GeoXtrack", "Res2xtr", 
+     1offset, incr)
+      write(*,*) 'Status returned by he5_swdefmap():  ',status
+
+
+c     Define indexed dimension mapping
+c     --------------------------------
+      status = he5_swdefimap(swid, "IndxTrack", "Res2tr", 
+     1indx)
+      write(*,*) 'Status returned by he5_swdefimap():  ',status
+
+c     Detach from the swath
+c     ---------------------
+      status = he5_swdetach(swid)
+      write(*,*) 'Status returned by he5_swdetach():  ',status
+
+c     Close the swath file
+c     --------------------
+      status = he5_swclose(swfid)
+      write(*,*) 'Status returned by he5_swclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_subset.c b/samples/he5_sw_subset.c
new file mode 100755
index 0000000..54b7de4
--- /dev/null
+++ b/samples/he5_sw_subset.c
@@ -0,0 +1,109 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+
+#include    <HE5_HdfEosDef.h>
+
+
+/* In this program we (1) open the "Swath.h5" HDF-EOS file, (2) attach to  */
+/*  the "Swath1", and (3) read data from the "Spectra" and "Time" fields   */
+/* ----------------------------------------------------------------------- */
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  int             i, j,  rank = 0;    
+
+  hid_t           swfid = FAIL, SWid = FAIL;
+  hid_t           regionID = FAIL, periodID = FAIL;
+
+  hid_t           *ntype;
+
+  size_t          size = 0;
+
+  hsize_t         dims[8];
+
+  double          cornerlon[2], cornerlat[2];
+  double          *datbuf, start_time, stop_time;
+
+    
+  /* Open the HDF-EOS swath file, "Swath.h5" */
+  /* --------------------------------------- */
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR);
+  if (swfid != FAIL)
+    {
+	  /* Attach to the "Swath1" swath */
+	  /* ---------------------------- */
+	  SWid = HE5_SWattach(swfid, "Swath1");
+	  if (SWid != FAIL)
+		{
+		  cornerlon[0] = 3. ;
+		  cornerlat[0] = 5. ;
+		  cornerlon[1] = 7. ;
+		  cornerlat[1] = 12.;
+
+		  regionID = HE5_SWdefboxregion(SWid, cornerlon, cornerlat, HE5_HDFE_MIDPOINT);
+		  printf("\n");
+		  printf("Region ID returned by HE5_SWdefboxregion()  :          %d \n", regionID);
+	    
+		  ntype = (hid_t *)calloc(1, sizeof(hid_t) );
+
+		  status = HE5_SWregioninfo(SWid, regionID, "Longitude", ntype, &rank, dims, &size);
+		  printf("Status returned by HE5_SWregioninfo(\"Longitude\")  :  %d \n", status);
+
+		  status = HE5_SWregioninfo(SWid, regionID, "Spectra", ntype, &rank, dims, &size);
+		  printf("Status returned by HE5_SWregioninfo(\"Spectra\")  :    %d \n", status);           
+ 	    
+		  datbuf = (double *) malloc(size);
+
+		  status = HE5_SWextractregion(SWid, regionID, "Spectra", HE5_HDFE_INTERNAL, datbuf);
+		  printf("Status returned by HE5_SWextractregion()  :            %d \n", status);
+		  printf("\n");
+		  printf("====================  DATA  ===================== \n");
+		  printf("\n");
+		  for (i = 0; i < size / sizeof(double); i++)
+			printf("\t %lf \n", datbuf[i]);
+	    	    
+		  free(datbuf);
+
+		  /* Time Subsetting */
+		  /* --------------- */
+		  start_time = 35232487.2;
+		  stop_time  = 36609898.1;
+
+		  periodID = HE5_SWdeftimeperiod(SWid, start_time, stop_time, HE5_HDFE_MIDPOINT);
+		  printf("\n");
+		  printf("Period ID returned by HE5_SWdeftimeperiod() :          %d \n",  periodID);
+	    
+		  status = HE5_SWperiodinfo(SWid, periodID, "Time", ntype, &rank, dims, &size);
+		  printf("Status returned by HE5_SWperiodinfo() :                %d \n",  status);
+
+		  datbuf = (double *) malloc(size);
+
+		  status = HE5_SWextractperiod(SWid, periodID, "Time", HE5_HDFE_INTERNAL, datbuf);
+		  printf("Status returned by HE5_SWextractperiod()  :            %d \n", status);
+
+		  printf("\n");
+		  printf("====================  DATA  ===================== \n");
+		  printf("\n");
+		  for (i = 0; i < size / sizeof(double); i++)
+			printf("\t\t %lf \n", datbuf[i]);
+
+		  free(datbuf);
+		  free(ntype);	    
+		}
+    }
+
+  status = HE5_SWdetach(SWid);
+  status = HE5_SWclose(swfid);
+
+  return 0;
+}
+
+
+
diff --git a/samples/he5_sw_subsetF_32.f b/samples/he5_sw_subsetF_32.f
new file mode 100755
index 0000000..65a48b4
--- /dev/null
+++ b/samples/he5_sw_subsetF_32.f
@@ -0,0 +1,134 @@
+c     In this program we (1) open the "swath.he5" HDF-EOS file, 
+c     (2) attach to the "Swath1" swath, and (3) subset data from 
+c     the "Spectra" field
+c     ==========================================================
+
+      program     he5_sw_subsetF_32
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+	  integer     status
+	  integer     i
+	  integer     he5_swopen
+      integer     he5_swattach
+	  integer     he5_swextper
+	  integer     he5_swperinfo
+      integer     he5_swreginfo
+	  integer     he5_swdefboxreg
+      integer     he5_swdeftmeper
+      integer     he5_swextreg
+      integer     he5_swdetach
+      integer     he5_swclose
+	  integer     swfid
+      integer     swid
+	  integer     rank
+	  integer     ntype
+	  integer     regionid
+	  integer     periodid
+
+	  integer*4   dims(8)
+	  integer*4   size
+
+	  real*8      cornerlon(2)
+	  real*8      cornerlat(2)
+	  real*8      datbuf(40,20,15)
+	  real*8      tmebuf(20)
+	  real*8      t1
+	  real*8      t2
+
+	  integer     FAIL
+      parameter   (FAIL=-1)
+      
+c     Open HDF-EOS swath file, "swath.he5"
+c     ------------------------------------
+	  swfid = he5_swopen("swath.he5",HE5F_ACC_RDONLY)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid
+
+      if (swfid .NE. FAIL) then
+		 swid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID returned by he5_swattach():  ',swid
+
+		 if (swid .NE. FAIL) then
+			cornerlon(1) = 3.
+			cornerlat(1) = 5.
+			cornerlon(2) = 7.
+			cornerlat(2) = 12.
+            
+c     Define box region 
+c     -----------------
+			regionid = he5_swdefboxreg(swid,cornerlon,
+     1           cornerlat,HE5_HDFE_MIDPOINT)
+            write(*,*) 'Region ID returned by he5_swdefboxreg():  ',
+     1           regionid
+
+			write(*,*) regionid,swid
+            
+			status = he5_swreginfo(swid,regionid,"Spectra",ntype,
+     1           rank,dims,size)
+            write(*,*) 'Status returned by he5_swreginfo():  ',
+     1           status
+			write(*,*) dims(1), dims(2), dims(3), rank, ntype, size
+            
+c     Extract region data
+c     -------------------
+			status = he5_swextreg(swid,regionid,"Spectra",
+     1           HE5_HDFE_INTERNAL,datbuf)
+            write(*,*) 'Status returned by he5_swextreg():  ',
+     1           status
+            
+c     Time Subsetting
+c     ---------------
+			t1  = 35232487.2d0
+			t2  = 36609898.1d0
+			periodid = he5_swdeftmeper(swid,t1,t2,HE5_HDFE_MIDPOINT)
+            write(*,*) 'Period ID returned by he5_swdeftmeper():  ',
+     1           periodid                       
+			write(*,*) 'Time Subset: ', periodid,swid
+			status = he5_swperinfo(swid,periodid,"Time",ntype,rank,
+     1           dims,size)
+            write(*,*) 'Status returned by he5_swperinfo():  ',
+     1           status            
+			write(*,*) 'Time Subset: ', rank, dims(1), size
+            
+c     Extract Time data
+c     -----------------
+			status = he5_swextper(swid,periodid,"Time",
+     1           HE5_HDFE_INTERNAL,tmebuf)
+            write(*,*) 'Status returned by he5_swextper():  ',
+     1           status            
+			do 10 i=1,size/8
+			   write(*,*) i, tmebuf(i)
+ 10         continue
+            
+		 endif
+         
+c     Detach from swath
+c     -----------------		 
+		 status = he5_swdetach(swid)
+         write(*,*) 'Status returned by he5_swdetach():  ',status         
+
+c     Close the file
+c     --------------
+		 status = he5_swclose(swfid)
+         write(*,*) 'Status returned by he5_swclose():  ',status    
+     
+      endif
+      
+      stop
+      end
+	
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_subsetF_64.f b/samples/he5_sw_subsetF_64.f
new file mode 100755
index 0000000..8ff8f3d
--- /dev/null
+++ b/samples/he5_sw_subsetF_64.f
@@ -0,0 +1,127 @@
+c     In this program we (1) open the "swath.he5" HDF-EOS file
+c     (2) attach to the "Swath1" swath, and (3) subset data from 
+c     the "Spectra" field
+c     ==========================================================
+
+      program     he5_sw_subsetF_64
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+	  integer     status
+	  integer     i
+	  integer     he5_swopen
+      integer     he5_swattach
+	  integer     he5_swextper
+	  integer     he5_swperinfo
+      integer     he5_swreginfo
+	  integer     he5_swdefboxreg
+      integer     he5_swdeftmeper
+      integer     he5_swextreg
+      integer     he5_swdetach
+      integer     he5_swclose
+	  integer     swfid
+      integer     swid
+	  integer     rank
+	  integer     ntype
+	  integer     regionid
+	  integer     periodid
+
+	  integer*8   dims(8)
+	  integer*8   size
+
+	  real*8      cornerlon(2)
+	  real*8      cornerlat(2)
+	  real*8      datbuf(40,20,15)
+	  real*8      tmebuf(20)
+	  real*8      t1
+	  real*8      t2
+
+	  integer     FAIL
+      parameter   (FAIL=-1)
+
+c     Open HDF-EOS swath file, "swath.he5"
+c     ------------------------------------
+	  swfid = he5_swopen("swath.he5",HE5F_ACC_RDONLY)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid
+
+      if (swfid .NE. FAIL) then
+		 swid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID returned by he5_swattach():  ',swid
+
+		 if (swid .NE. FAIL) then
+			cornerlon(1) = 3.
+			cornerlat(1) = 5.
+			cornerlon(2) = 7.
+			cornerlat(2) = 12.
+            
+c     Define box region 
+c     -----------------
+			regionid = he5_swdefboxreg(swid,cornerlon,
+     1           cornerlat,HE5_HDFE_MIDPOINT)
+            write(*,*) 'Region ID returned by he5_swdefboxreg():  ',
+     1           regionid
+
+			write(*,*) regionid,swid
+            
+			status = he5_swreginfo(swid,regionid,"Spectra",ntype,
+     1           rank,dims,size)
+            write(*,*) 'Status returned by he5_swreginfo():  ',
+     1           status
+			write(*,*) dims(1), dims(2), dims(3), rank, ntype, size
+	      
+c     Extract region data
+c     -------------------
+			status = he5_swextreg(swid,regionid,"Spectra",
+     1           HE5_HDFE_INTERNAL,datbuf)
+            write(*,*) 'Status returned by he5_swextreg():  ',
+     1           status
+            
+c     Time Subsetting
+c     ---------------
+			t1  = 352324870.2d0
+			t2  = 366098980.1d0
+			periodid = he5_swdeftmeper(swid,t1,t2,HE5_HDFE_MIDPOINT)
+            write(*,*) 'Period ID returned by he5_swdeftmeper():  ',
+     1           periodid
+
+			write(*,*) 'Time Subset: ', periodid,swid
+            
+			status = he5_swperinfo(swid,periodid,"Time",ntype,rank,
+     1           dims,size)
+	        write(*,*) 'Status returned by he5_swperinfo():  ',
+     1           status 
+            write(*,*) 'Time Subset: ', rank, dims(1), size
+            
+c     Extract Time data
+c     -----------------
+			status = he5_swextper(swid,periodid,"Time",
+     1           HE5_HDFE_INTERNAL,tmebuf)
+             write(*,*) 'Status returned by he5_swextper():  ',
+     1           status            
+
+			do 10 i=1,size/8
+			   write(*,*) i, tmebuf(i)
+ 10         continue
+            
+		 endif
+
+c     Detach from swath
+c     -----------------		 
+		 status = he5_swdetach(swid)
+         write(*,*) 'Status returned by he5_swdetach():  ',status         
+
+c     Close the file
+c     --------------
+		 status = he5_swclose(swfid)
+         write(*,*) 'Status returned by he5_swclose():  ',status             
+
+      endif
+      
+      stop
+      end
+	
+
+
+
diff --git a/samples/he5_sw_wrextendrd.c b/samples/he5_sw_wrextendrd.c
new file mode 100755
index 0000000..b5ca32f
--- /dev/null
+++ b/samples/he5_sw_wrextendrd.c
@@ -0,0 +1,121 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include <HE5_HdfEosDef.h>
+
+/* This program demonstrates the use of the unlimited dimension   */
+/*               in creating an appendable field                  */
+/* -------------------------------------------------------------- */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  int             i, rank = FAIL;
+  int             inarray[20] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
+  int             outarray[40];
+
+  hid_t           swfid = FAIL;
+  hid_t           SWid  = FAIL;
+
+  hid_t     *ntype;
+
+  hssize_t        start[1];
+
+  hsize_t         count[1], dims[1];
+
+  char            dimlist[100];
+  char            maxdimlist[100];
+ 
+
+  /* Open the swath file */
+  /* ------------------- */
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR);
+  if (swfid != FAIL)
+	{
+	  /* Attach to the swath "Swath1" */
+	  /* ---------------------------- */
+	  SWid  = HE5_SWattach(swfid, "Swath1");
+	  if (SWid != NULL)
+		{
+		  /* Inquire information about "Count" field */
+		  /* --------------------------------------- */
+		  ntype = (hid_t *)calloc(1,sizeof(hid_t));
+		  
+		  status = HE5_SWfieldinfo(SWid, "Count", &rank, dims, ntype, dimlist, maxdimlist);
+		  if (status != FAIL)
+			{
+			  printf("No. of elements in \"Count\":  %lu\n", (unsigned long)dims[0]);
+			  printf("\"DimList\" :                  %s \n", dimlist);
+			  printf("\"MaxdimList\" :               %s \n", maxdimlist);
+			}
+		  
+		  /* Write 20 records to the "Count" field */
+		  /* ------------------------------------- */
+		  start[0] = 0;
+		  count[0] = 20;
+		  status = HE5_SWwritefield(SWid, "Count", start, NULL, count, inarray);
+		  printf("Status returned by HE5_SWwritefield:  %d \n", status);
+		  
+
+		  /* Inquire information about "Count" field again */
+		  /* --------------------------------------------- */  
+		  dims[0] = 0;
+		  status = HE5_SWfieldinfo(SWid, "Count", &rank, dims, ntype, dimlist, maxdimlist);
+		  if (status != FAIL)
+			{
+			  printf("No. of records written:        %lu \n",(unsigned long)dims[0]);
+			  printf("\"DimList\" :                  %s \n", dimlist);
+			  printf("\"MaxdimList\" :               %s \n", maxdimlist);
+			}
+		  
+		  /* Append 10 records to the "Count" field */
+		  /* -------------------------------------- */
+		  start[0] = 22;
+		  count[0] = 10;
+		  status = HE5_SWwritefield(SWid, "Count", start, NULL, count, inarray);
+		  printf("Status returned by HE5_SWwritefield:  %d \n", status);
+		  
+		  /* Inquire information about "Count" field one more time */
+		  /* ----------------------------------------------------- */  
+		  dims[0] = 0;
+		  status = HE5_SWfieldinfo(SWid, "Count", &rank, dims, ntype, dimlist, maxdimlist);
+		  if (status != FAIL)
+			{
+			  printf("No. of records written:        %lu\n",(unsigned long)dims[0]);
+			  printf("\"DimList\" :                  %s \n", dimlist);
+			  printf("\"MaxdimList\" :               %s \n", maxdimlist);
+			  free(ntype);   
+			}
+
+		  /* Display the "Count" field data */
+		  /* ------------------------------ */
+		  start[0] = 0;
+		  status = HE5_SWreadfield(SWid, "Count", start, NULL, dims, outarray);
+		  if (status != FAIL )
+			{
+			  for (i = 0; i < (unsigned long)dims[0]; i++) 
+				printf("\t\t element #%d:  value: %d \n", i+1, outarray[i]);
+			}
+		  
+		}
+	}
+  
+  status = HE5_SWdetach(SWid);
+  status = HE5_SWclose(swfid);
+  
+  return 0;
+}
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_wrexternaldata.c b/samples/he5_sw_wrexternaldata.c
new file mode 100755
index 0000000..3f0b887
--- /dev/null
+++ b/samples/he5_sw_wrexternaldata.c
@@ -0,0 +1,119 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |   ----------------------------------------------------------------------------
+ */
+
+
+#include    <HE5_HdfEosDef.h>
+
+#define  DIM      100
+#define  DIMTOT   60
+
+int main()
+{
+  FILE            *in_1, *in_2, *in_3;
+
+  herr_t          status = FAIL;
+
+  int             i;
+  int             data_out_1[DIM];
+  int             data_out_2[DIM];
+  int             data_out_3[DIM];
+  int             data[DIMTOT];
+
+  hid_t           swfid = FAIL;
+  hid_t           SWid  = FAIL;
+
+  hssize_t        start[2];
+  hsize_t         count[2];
+
+
+  
+  /* Create new data buffer */
+  /* ---------------------- */
+  for (i = 0; i < DIMTOT; i++)
+	data[ i ] = 9999;
+
+  /* Open the HDF-EOS swath file, "Swath.h5" */
+  /* --------------------------------------- */
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR);
+  if (swfid != FAIL)
+	{
+	  /* Attach the "Swath1" swath */
+	  /* ------------------------- */
+	  SWid = HE5_SWattach(swfid, "Swath1");
+	  if (SWid != FAIL)
+		{
+		  /* Write new data to the external files */
+		  /* ------------------------------------ */
+		  start[0] = 0;
+		  count[0] = DIMTOT;
+		  status = HE5_SWwritefield(SWid, "ExtData", start, NULL, count, data);
+		  printf("Status returned by HE5_SWwritefield() :    %d \n", status);
+	    
+
+		  /* Open the external data files */
+		  /* ---------------------------- */
+		  in_1 = fopen("external_1.data", "r");
+		  in_2 = fopen("external_2.data", "r");
+		  in_3 = fopen("external_3.data", "r");
+
+		  /* Read data from external data files */
+		  /* ---------------------------------- */
+		  fread(data_out_1, sizeof(int), DIM, in_1);
+		  fread(data_out_2, sizeof(int), DIM, in_2);
+		  fread(data_out_3, sizeof(int), DIM, in_3);
+		  
+		  /* Close the external data files */
+		  /* ----------------------------- */
+		  fclose(in_1);
+		  fclose(in_2);
+		  fclose(in_3);
+  
+		  /* Check the contents of external files */
+		  /* ------------------------------------ */
+		  printf(" \n");
+		  printf("Reading data from 1st file: \n");
+		  printf(" \n");
+		  for (i = 0; i < DIM; i++)
+			printf("%d ", data_out_1[i]);
+
+		  printf(" \n");
+		  printf(" \n");
+		  printf("Reading data from 2d file: \n");
+		  printf(" \n");
+		  for (i = 0; i < DIM; i++)
+			printf("%d ", data_out_2[i]);
+		  
+		  printf(" \n");
+		  printf(" \n");
+		  printf("Reading data from 3d file: \n");
+		  printf(" \n"); 
+		  for (i = 0; i < DIM; i++)
+			printf("%d ", data_out_3[i]);
+		  printf(" \n");
+		  printf(" \n");
+
+		}
+	}
+
+  /* Detach from the swath */
+  /* --------------------- */
+  status = HE5_SWdetach(SWid);
+  printf("Status returned by HE5_SWdetach() :        %d \n", status);
+
+  /* Close the file */
+  /* -------------- */
+  status = HE5_SWclose(swfid);
+  printf("Status returned by HE5_SWclose() :         %d \n", status); 
+  
+  return 0;
+}
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_wrexternaldataF_32.f b/samples/he5_sw_wrexternaldataF_32.f
new file mode 100755
index 0000000..6042e9c
--- /dev/null
+++ b/samples/he5_sw_wrexternaldataF_32.f
@@ -0,0 +1,125 @@
+c
+c ----------------------------------------------------------------------------
+c |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+c ----------------------------------------------------------------------------
+c
+
+      program            he5_sw_wrexternaldataF_32
+
+      implicit           none
+ 
+      include            'hdfeos5.inc'
+
+      integer            i
+      integer            status
+      integer            he5_swopen
+      integer            he5_swattach
+      integer            he5_swwrfld
+      integer            he5_ehrdwrfile
+      integer            he5_swdetach
+      integer            he5_swclose
+      integer            swfid, swid
+
+      integer            data_out_1(100)
+      integer            data_out_2(100)
+      integer            data_out_3(100)
+      integer            data(60)
+
+      integer*4          start(2)
+      integer*4          stride(2)
+      integer*4          count(2)
+      integer*4          num_elements
+
+      integer            FAIL
+      parameter          (FAIL=-1)
+
+c.....Use this for writing (only) to an existing file
+      integer            WRITE_EXISTING_ONLY
+      parameter          (WRITE_EXISTING_ONLY=0)
+
+c.....Use this for reading (only) from an existing file
+      integer            READ_ONLY
+      parameter          (READ_ONLY=1)
+
+c.....Use this for creating and writing to a file
+      integer            WRITE_NEW
+      parameter          (WRITE_NEW=2)
+
+
+c     Create the new data buffer
+c     --------------------------
+      do 10 i=1,60
+         data(i) = 9999
+ 10   continue
+      
+c     Open HDF-EOS swath file, "swath.he5"
+c     ------------------------------------
+	  swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned from he5_swopen():  ',swfid
+
+	  if (swfid .NE. FAIL) then
+		 swid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID returned from he5_swattach():  ',swid
+
+		 if (swid .NE. FAIL) then
+			
+c     Write new data to the external files 
+c     ------------------------------------
+      start(1)  = 0
+      stride(1) = 1
+      count(1)  = 60
+
+      status = he5_swwrfld(swid,"ExtData",
+     1     start,stride,count,data)
+      write(*,*) 'Status returned from he5_swrdfld():  ',status
+
+      num_elements = 100
+
+      status = he5_ehrdwrfile("extf1.dat",READ_ONLY,
+     1HE5T_NATIVE_INT,num_elements,data_out_1)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf2.dat",READ_ONLY,
+     1HE5T_NATIVE_INT,num_elements,data_out_2)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf3.dat",READ_ONLY,
+     1HE5T_NATIVE_INT,num_elements,data_out_3)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      write(*,*)'External file extf1.dat:'
+      write(*,*) data_out_1
+      write(*,*) '  '
+
+      write(*,*)'External file extf2.dat:'
+      write(*,*) data_out_2
+      write(*,*) '  '
+
+      write(*,*)'External file extf3.dat:'
+      write(*,*) data_out_3
+      write(*,*) '  '
+
+		 endif
+	  endif
+	
+c     Detach from swath
+c     -----------------
+	  status = he5_swdetach(swid)
+      write(*,*) 'Status returned from he5_swdetach():  ',status
+
+c     Close the file
+c     --------------
+	  status = he5_swclose(swfid)
+      write(*,*) 'Status returned from he5_swclose():  ',status
+      
+	  stop
+	  end
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_wrexternaldataF_64.f b/samples/he5_sw_wrexternaldataF_64.f
new file mode 100755
index 0000000..c75ab42
--- /dev/null
+++ b/samples/he5_sw_wrexternaldataF_64.f
@@ -0,0 +1,125 @@
+c
+c ----------------------------------------------------------------------------
+c |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+c ----------------------------------------------------------------------------
+c
+      program            he5_sw_wrexternaldataF_64
+
+      implicit           none
+ 
+      include            'hdfeos5.inc'
+
+      integer            i
+      integer            status
+      integer            he5_swopen
+      integer            he5_swattach
+      integer            he5_swwrfld
+      integer            he5_ehrdwrfile
+      integer            he5_swdetach
+      integer            he5_swclose
+      integer            swfid, swid
+
+      integer            data_out_1(100)
+      integer            data_out_2(100)
+      integer            data_out_3(100)
+      integer            data(60)
+
+      integer*8          start(2)
+      integer*8          stride(2)
+      integer*8          count(2)
+      integer*8          num_elements
+
+      integer            FAIL
+      parameter          (FAIL=-1)
+
+c.....Use this for writing (only) to an existing file
+      integer            WRITE_EXISTING_ONLY
+      parameter          (WRITE_EXISTING_ONLY=0)
+
+c.....Use this for reading (only) from an existing file
+      integer            READ_ONLY
+      parameter          (READ_ONLY=1)
+
+c.....Use this for creating and writing to a file
+      integer            WRITE_NEW
+      parameter          (WRITE_NEW=2)
+
+
+c     Create the new data buffer
+c     --------------------------
+      do 10 i=1,60
+         data(i) = 9999
+ 10   continue
+      
+c     Open HDF-EOS swath file, "swath.he5"
+c     ------------------------------------
+	  swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned from he5_swopen():  ',swfid
+
+	  if (swfid .NE. FAIL) then
+		 swid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID returned from he5_swattach():  ',swid
+
+		 if (swid .NE. FAIL) then
+			
+c     Write new data to the external files 
+c     ------------------------------------
+      start(1)  = 0
+      stride(1) = 1
+      count(1)  = 60
+
+      status = he5_swwrfld(swid,"ExtData",
+     1     start,stride,count,data)
+      write(*,*) 'Status returned  from he5_swrdfld():  ',status
+
+      num_elements = 100
+
+      status = he5_ehrdwrfile("extf1.dat",READ_ONLY,
+     1HE5T_NATIVE_INT,num_elements,data_out_1)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf2.dat",READ_ONLY,
+     1HE5T_NATIVE_INT,num_elements,data_out_2)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf3.dat",READ_ONLY,
+     1HE5T_NATIVE_INT,num_elements,data_out_3)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+
+      write(*,*)'External file extf1.dat:'
+      write(*,*) data_out_1
+      write(*,*) '  '
+
+      write(*,*)'External file extf2.dat:'
+      write(*,*) data_out_2
+      write(*,*) '  '
+
+      write(*,*)'External file extf3.dat:'
+      write(*,*) data_out_3
+      write(*,*) '  '
+
+		 endif
+	  endif
+	
+c     Detach from swath
+c     -----------------
+	  status = he5_swdetach(swid)
+      write(*,*) 'Status returned from he5_swdetach():  ',status
+
+c     Close the file
+c     --------------
+	  status = he5_swclose(swfid)
+      write(*,*) 'Status returned from he5_swclose():  ',status     
+
+	  stop
+	  end
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_writedata.c b/samples/he5_sw_writedata.c
new file mode 100755
index 0000000..ea2a621
--- /dev/null
+++ b/samples/he5_sw_writedata.c
@@ -0,0 +1,244 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include  <HE5_HdfEosDef.h>
+
+
+/*  In this program we (1) open the "Swath.h5" file, (2) attach to the       */
+/*  "Swath1" swath, and (3) write data to the "Longitude", "Latitude", and   */
+/*  "Spectra" fields. Also, set up the global, group, and local attributes   */
+/*  -----------------------------------------------------------------------  */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  int             i, j, k;
+  int             track, xtrack;
+  int             attr1[4] = {1, 2, 3, 4};         /* global attribute */
+  int             attr2[4] = {10, 20, 30, 40};     /* group attribute  */
+  int             attr3[4] = {100, 200, 300, 400}; /* local attribute  */
+
+  hid_t           swfid = FAIL;
+  hid_t           SWid  = FAIL;
+
+  char            attr4[20]; /* Global 'char' attribute */
+  char            attr8[20]; /* Global 'char' attribute */
+  char            attr9[20]; /* Global 'char' attribute */
+
+  long            attr5[4] = {1111111L,2222222L,3333333L,4444444L};/* Global 'long' attribute   */ 
+
+  double          attr6[4] = {1.111111,2.222222,3.333333,4.444444};/* Global 'double' attribute */
+
+  float           attr7[4] = {1.111111,2.222222,3.333333,4.444444};/* Local 'float'   attribute */  
+
+  hssize_t        start[3];
+    
+  hsize_t         count[3];
+
+  size_t          datasize;
+
+  float           lng[20][10], latcnt;  
+  float           lat[20][10], loncnt;
+
+  double          plane[15][40][20], tme[20];
+
+  hvl_t           buffer[4];/* Data buffer for the profile */
+
+  const char *charname[10] = {
+        "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 
+        "BBBBBBBBBBBBBBBB", 
+        "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", 
+        "DDDDDDDDDDDDDDDDDDDD", 
+        "EEEEEEEE", 
+        "FFFFFFFFFFFFF", 
+        "GGGGGGGGGGGGG", 
+        "HHHHHHHHHH",
+        "IIIIIII", 
+        "JJJJJJJJJJJJJ"
+      };
+
+
+  /* Populate lon/lat data arrays */
+  /* ---------------------------- */
+  latcnt = 1.;
+  loncnt = 1.;
+  track  = 0 ;
+  xtrack = 0 ;
+  while(track < 20) {
+	while(xtrack < 10) {
+	  lat[track][xtrack] = latcnt;
+	  lng[track][xtrack] = loncnt;
+	  loncnt = loncnt + 1.;
+	  xtrack++;
+	}
+	latcnt = latcnt + 1.;
+	loncnt = 1.;
+	track++;
+	xtrack = 0;
+  }
+    
+	
+  /* Popolate spectra data array. Value = 100*(track index)+(band index) */
+  /* ------------------------------------------------------------------- */
+  for (i = 0; i < 15; i++)
+	{
+	  for (j = 0; j < 40; j++)
+		for (k = 0; k < 20; k++)
+		  plane[i][j][k] = (double)(j*100 + i);
+    }
+	
+	
+  /* Allocate memory for and populate data buffer */
+  /* -------------------------------------------- */
+  datasize = 0;
+  for (i = 0; i < 4; i++)
+	{
+	  buffer[i].p = (hvl_t *)calloc( 25 *(i+1),  sizeof(unsigned int));
+	  buffer[i].len  =  25 * (i+1);
+	  /* calculate the data buffer size (bytes) */
+	  datasize += buffer[i].len * sizeof(unsigned int);
+	  for ( j = 0; j < 25 * (i+1); j++)
+		((unsigned int *)buffer[i].p)[j] = (i+1)*1000 + j;
+	}
+  
+	
+  /* Open the HDF swath file, "Swath.h5" */
+  /* ----------------------------------- */
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR);
+  if (swfid != FAIL)
+	{
+	  /* Attach the "Swath1" swath */
+	  /* ------------------------- */
+	  SWid = HE5_SWattach(swfid, "Swath1");
+	  if (SWid != FAIL)
+		{
+		  start[0] = 0;
+		  start[1] = 0;
+		  count[0] = 20;
+		  count[1] = 10;
+			
+		  /*  Write longitute field */
+		  /* ---------------------- */
+		  status = HE5_SWwritefield(SWid, "Longitude", start, NULL, count, lng);
+		  printf("status returned by HE5_SWwritefield(\"Longitude\"):         %d\n", status);
+	    
+		  /*  Write latitude field */
+		  /* --------------------- */
+		  status = HE5_SWwritefield(SWid, "Latitude", start, NULL, count, lat);
+		  printf("status returned by HE5_SWwritefield(\"Latitude\"):          %d\n", status);
+			
+		  /* Write Time Field */
+		  /* ---------------- */
+		  for (i = 0; i < 20; i++) 
+			tme[i] = 34574087.3 + 84893.2*i;
+		  
+		  start[0] = 0;
+		  count[0] = 20;
+		  status = HE5_SWwritefield(SWid, "Time", start, NULL, count, tme);
+		  printf("status returned by HE5_SWwritefield(\"Time\"):              %d\n", status);
+
+            start[0] = 0;
+            count[0] = 10;
+                  status = HE5_SWwritefield(SWid, "Test_string", start, NULL, count, charname);
+                  printf("status returned by HE5_SWwritefield(\"Test_string\"):              %d\n", status);
+			
+		  /* Write Spectra Field */
+		  /* ------------------- */
+		  start[0] = 0;      count[0] = 15;
+		  start[1] = 0;      count[1] = 40;
+		  start[2] = 0;      count[2] = 20;
+			
+		  status = HE5_SWwritefield(SWid, "Spectra", start, NULL, count, plane);
+		  printf("status returned by HE5_SWwritefield(\"Spectra\"):           %d\n", status);
+
+		  /* Write data to the profile */
+		  /* ------------------------- */
+		  start[0] = 0;      count[0] = 4;
+		  status = HE5_PRwrite(SWid, "Profile-2000", start, NULL, count, datasize, buffer);
+		  printf("Status returned by HE5_PRwrite(\"Profile-2000\"):           %d \n", status);
+            
+		  /* Write Global 'int' Attribute */
+		  /* ---------------------------- */
+		  count[0] = 4;
+		  status = HE5_SWwriteattr(SWid, "GlobalAttribute", H5T_NATIVE_INT, count, attr1);
+		  printf("status returned by HE5_SWwriteattr(\"GlobalAttribute\"):    %d\n", status);
+
+                  status = HE5_EHwriteglbattr(swfid, "GlobalAttribute_1", H5T_NATIVE_FLOAT, count, attr7);
+                  printf("status returned by HE5_EHwriteglbattr(\"GlobalAttribute_1\"):    %d\n", status);
+
+          strcpy(attr8,"AAAAAA");
+          count[0] = 6;
+                  status = HE5_EHwriteglbattr(swfid, "GlobalAttribute_2222", H5T_NATIVE_CHAR, count, attr8);
+                  printf("status returned by HE5_EHwriteglbattr(\"GlobalAttribute_2222\"):    %d\n", status);
+
+		  /* Write Global 'char' Attribute */
+		  /* ----------------------------- */
+          strcpy(attr4,"ABCDEFGH");
+		  count[0] = 8;
+		  status = HE5_SWwriteattr(SWid, "GLOBAL_CHAR_ATTR", H5T_NATIVE_CHAR, count, attr4);
+		  printf("status returned by HE5_SWwriteattr(\"GLOBAL_CHAR_ATTR\"):   %d\n", status);
+			
+          strcpy(attr9,"abc");
+                  count[0] = 3;
+                  status = HE5_SWwriteattr(SWid, "GLOBAL_CHAR_ATTR_11", H5T_NATIVE_CHAR, count, attr9);
+                  printf("status returned by HE5_SWwriteattr(\"GLOBAL_CHAR_ATTR_11\"):   %d\n", status);
+
+		  /* Write Global 'long' Attribute */
+		  /* ----------------------------- */
+		  count[0] = 4;
+		  status = HE5_SWwriteattr(SWid, "GLOBAL_LONG_ATTR", H5T_NATIVE_LONG, count, attr5);
+		  printf("status returned by HE5_SWwriteattr(\"GLOBAL_LONG_ATTR\"):   %d\n", status);
+
+		  /* Write Global 'double' Attribute */
+		  /* ------------------------------- */
+		  count[0] = 4;
+		  status = HE5_SWwriteattr(SWid, "GLOBAL_DOUBLE_ATTR", H5T_NATIVE_DOUBLE, count, attr6);
+		  printf("status returned by HE5_SWwriteattr(\"GLOBAL_DOUBLE_ATTR\"): %d\n", status);
+
+                  status = HE5_EHwriteglbattr(swfid, "GLOBAL_DOUBLE_ATTR_1", H5T_NATIVE_DOUBLE, count, attr6);
+                  printf("status returned by HE5_EHwriteglbattr(\"GLOBAL_DOUBLE_ATTR_1\"): %d\n", status);
+
+		  /* Write Group Attribute */
+		  /* --------------------- */
+		  status = HE5_SWwritegrpattr(SWid, "GroupAttribute", H5T_NATIVE_INT, count, attr2);
+		  printf("status returned by HE5_SWwritegrpattr(\"GroupAttribute\"):  %d\n", status);
+
+		  /* Write Local Attribute */
+		  /* --------------------- */
+          strcpy(attr4,"ababababababababab");
+                  count[0] = 18;
+                  status = HE5_SWwritelocattr(SWid, "Time", "LOCAL_CHAR_ATTR", H5T_NATIVE_CHAR, count, attr4);
+                  printf("status returned by HE5_SWwritelocattr(\"LOCAL_CHAR_ATTR\"):   %d\n", status);
+ 
+                  count[0] = 4;
+
+		  status = HE5_SWwritelocattr(SWid, "Density", "LocalAttribute_1", H5T_NATIVE_INT, count, attr3);
+		  printf("status returned by HE5_SWwritelocattr(\"LocalAttribute_1\"):%d\n", status);
+
+		  /* Write Local Attribute */
+		  /* --------------------- */
+		  status = HE5_SWwritelocattr(SWid, "Longitude", "LocalAttribute_2", H5T_NATIVE_FLOAT, count, attr7);
+		  printf("status returned by HE5_SWwritelocattr(\"LocalAttribute_2\"):%d\n", status);
+		}
+	}
+	
+  status = HE5_SWdetach(SWid);
+  status = HE5_SWclose(swfid);
+
+  return 0;
+}
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_writedataF_32.f b/samples/he5_sw_writedataF_32.f
new file mode 100755
index 0000000..7abab9b
--- /dev/null
+++ b/samples/he5_sw_writedataF_32.f
@@ -0,0 +1,251 @@
+c     In this program we (1) open the "swath.he5" file, (2) attach to
+c     the "Swath1" swath, and (3) write data to the "Longitude", 
+c     "Longitude" and "Spectra" fields
+
+      program        he5_sw_writedataF_32
+      
+      implicit       none
+
+      include        'hdfeos5.inc'
+
+      integer        status
+      integer        he5_swopen 
+      integer        he5_swattach 
+      integer        he5_swwrfld
+      integer        he5_swwrattr
+      integer        he5_swwrlattr
+      integer        he5_swwrgattr
+      integer        he5_ehwrglatt
+      integer        he5_swsetalias
+      integer        he5_swdetach
+      integer        he5_swclose
+      integer        he5_prwrite
+      integer        swfid, swid 
+      integer        buffer(250)
+      integer        counter
+      integer        i, j, k 
+      integer        itrack
+
+      integer*4      attr(4)
+      integer*4      attr0(4)
+      integer*4      track
+      integer*4      start(3)
+      integer*4      stride(3)
+      integer*4      count(3)
+      integer*4      len(4)
+      integer*4      datasize
+      real           attr1(4)
+      character*10    attr4
+      character*100   attr5
+
+      real           lng(10)
+      real           lat(10)
+ 
+      real*8         plane(800)
+      real*8         tme(20)
+
+      integer        FAIL
+      parameter      (FAIL=-1)	
+
+
+c     Set longitude values along the cross track
+c     ------------------------------------------
+      do i=1,10
+		 lng(i) = i-1.0
+      enddo
+	 
+c     Open HDF-EOS file, "swath.he5"
+c     ------------------------------
+      swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid
+
+      if (swfid .NE. FAIL) then
+		 swid = he5_swattach(swfid, "Swath1")      
+         write(*,*) 'Swath ID returned by he5_swattach():  ',swid
+
+		 if (swid .NE. FAIL) then
+            
+c     Write data starting at the beginning of each cross track
+c     --------------------------------------------------------
+			start(1)  = 0
+			stride(1) = 1
+			stride(2) = 1
+			count(1)  = 10
+			count(2)  = 1
+
+c     Loop through all the tracks, incrementing the track starting
+c     position by one each time
+c     ------------------------------------------------------------
+			do track = 1,20
+			   start(2) = track - 1
+			   status = he5_swwrfld(swid,"Longitude",start,
+     1              stride,count,lng)
+
+			   do itrack = 1,10
+				  lat(itrack) = track
+			   enddo
+			   status = he5_swwrfld(swid,"Latitude",start,
+     1              stride,count,lat) 
+			enddo
+            
+			do i = 1,20
+			   tme(i) = 34574087.3 + 84893.2*(i-1)
+			enddo
+            
+			start(1)  = 0
+			stride(1) = 1
+			count(1)  = 20
+	     
+			status = he5_swwrfld(swid, "Time", start, stride,
+     1           count, tme)
+
+                        start(1)  = 0
+                        stride(1) = 1
+                        stride(2) = 1
+                        count(1)  = 10
+                        count(2)  = 1
+
+                        do track = 1,20
+                           start(2) = track - 1
+			status = he5_swwrfld(swid,"Temperature",start,
+     1              stride,count,lng)
+                        enddo
+
+			status = he5_swsetalias(swid,"Temperature","L2gpValue")
+			status = he5_swsetalias(swid,"Latitude","Lat,L")
+            
+c     Write Spectra one plane at a time 
+c     Value is 100 * track index + band index (0-based)
+c     -------------------------------------------------
+			start(1)  = 0
+			start(2)  = 0
+			count(1)  = 20
+			count(2)  = 40
+			count(3)  = 1
+			stride(3) = 1
+	    
+			do i=1,15
+			   start(3) = i - 1
+			   do j=1,40
+				  do k=1,20
+					 plane((j-1)*20+k) = (j-1)*100 + i-1
+				  enddo
+			   enddo
+			   status = he5_swwrfld(swid,"Spectra",start,
+     1              stride,count,plane)
+			enddo
+
+c     Populate data buffer and write data to the Profile Field
+c     --------------------------------------------------------
+      datasize = 0
+      counter  = 0
+      do i=1,4
+
+         len(i)    = i*25
+         datasize  = datasize + len(i)
+         do j=1,(25*i)
+            counter = counter + 1
+            buffer(counter) = (i)*1000 + j - 1
+         enddo
+      enddo
+
+      start(1)  = 0
+      count(1)  = 4
+      stride(1) = 1
+
+      status = he5_prwrite(swid,"Profile-2000",start,stride,count,
+     1datasize,len,buffer)
+      write(*,*) 'Status returned by he5_prwrite():  ',status
+		            
+c     Write User defined Attribute
+c     ----------------------------
+			attr(1) = 3
+			attr(2) = 5
+			attr(3) = 7
+			attr(4) = 11
+            count(1) = 4
+			status = he5_swwrattr(swid,"TestAttr",HE5T_NATIVE_INT,
+     1           count,attr)
+	write(*,*) 'Status returned by he5_swwrattr():  ',status
+
+            
+c     Write Global Attribute
+c     ----------------------
+			attr4 = "ABCDEFGH"
+			count(1) = 8
+			status = he5_swwrattr(swid,"GLOBAL_CHAR_ATTR",HE5T_NATIVE_CHAR,
+	1	count,attr4)
+	write(*,*) 'Status returned by he5_swwrattr():  ',status
+
+			attr4 = "111"
+			count(1) = 3
+			status = he5_swwrgattr(swid,"GLOBAL_CHAR_ATTR_1",HE5T_NATIVE_CHAR,
+	1	count,attr4)
+	write(*,*) 'Status returned by he5_swwrgattr():  ',status
+
+			attr4 = "222222"
+			count(1) = 6
+			status = he5_ehwrglatt(swfid,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR,
+	1	count,attr4)
+	write(*,*) 'Status returned by he5_ehwrglatt():  ',status
+
+c     Write Local Attribute
+c     ---------------------
+                     attr0(1) = 100
+                     attr0(2) = 200
+                     attr0(3) = 300
+                     attr0(4) = 400
+               count(1) = 4
+			status = he5_swwrlattr(swid,"Density","LocalAttribute_1",
+     1		 HE5T_NATIVE_INT,count,attr0)
+	write(*,*) 'Status returned by he5_swwrlattr():  ',status
+                     
+			attr5 = "abababababababababab"
+			count(1) = 20
+			status = he5_swwrlattr(swid,"Density","LocalAttribute_0",
+	1           HE5T_NATIVE_CHAR,count,attr5)
+	write(*,*) 'Status returned by he5_swwrlattr():  ',status
+
+                 attr1(1) = 1.111111
+                 attr1(2) = 2.222222
+                 attr1(3) = 3.333333
+                 attr1(4) = 4.444444
+           count(1) = 4
+			status = he5_swwrlattr(swid,"Longitude","LocalAttribute_2",
+     1		HE5T_NATIVE_REAL,count,attr1)
+	write(*,*) 'Status returned by he5_swwrlattr():  ',status
+
+                 
+		 endif
+	  endif
+
+c     Detach from the swath
+c     ---------------------
+      status = he5_swdetach(swid)
+      write(*,*) 'Status returned by he5_swdetach():  ',status
+ 
+c     Close the file
+c     --------------
+      status = he5_swclose(swfid)
+      write(*,*) 'Status returned by he5_swclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_writedataF_64.f b/samples/he5_sw_writedataF_64.f
new file mode 100755
index 0000000..79e34bd
--- /dev/null
+++ b/samples/he5_sw_writedataF_64.f
@@ -0,0 +1,209 @@
+c  In this program we (1) open the "swath.he5" file, (2) attach to
+c  the "Swath1" swath, and (3) write data to the "Longitude", 
+c  "Longitude" and "Spectra" fields
+
+      program        he5_sw_writedataF_64
+
+      implicit       none
+
+      include        'hdfeos5.inc'
+
+      integer        status
+      integer        he5_swopen 
+      integer        he5_swattach 
+      integer        he5_swwrfld
+      integer        he5_swwrattr
+      integer        he5_swwrlattr
+      integer        he5_swwrgattr
+      integer        he5_ehwrglatt
+      integer        he5_swdetach
+      integer        he5_swclose
+      integer        he5_prwrite
+      integer        swfid, SWid 
+      integer        buffer(250)
+      integer        counter
+      integer        i, j , k
+      integer        itrack
+
+      integer*4      attr(4)
+      integer*8      track
+      integer*8      start(3)
+      integer*8      stride(3)
+      integer*8      count(3)
+      integer*8      len(4)
+      integer*8      datasize
+      character*10    attr4
+      character*100   attr5
+
+      character*4    charfield(10)
+
+      real           lng(10)
+      real           lat(10)
+ 
+      real*8         plane(800)
+      real*8         tme(73)
+
+      integer        FAIL
+      parameter      (FAIL=-1)
+      
+c     Set longitude values along the cross track
+c     ------------------------------------------
+      do i=1,10
+		 lng(i) = i-1.0
+      enddo
+
+      data charfield/'aaaa','b  b','cc  ','dddd','ee e','ffff',
+     1              'gggg','hh  ','i   ','jjjj'/
+	 
+c     Open HDF-EOS file, "swath.he5"
+c     ------------------------------
+      swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_swopen():  ',swfid
+
+      if (swfid .NE. FAIL) then
+		 SWid = he5_swattach(swfid, "Swath1")
+         write(*,*) 'Swath ID returned by he5_swattach():  ',swid
+
+		 if (swid .NE. FAIL) then
+
+c     Write data starting at the beginning of each cross track
+c     --------------------------------------------------------
+			start(1)  = 0
+			stride(1) = 1
+			stride(2) = 1
+			count(1)  = 10
+			count(2)  = 1
+
+c     Loop through all the tracks, incrementing the track starting
+c     position by one each time
+c     ------------------------------------------------------------
+			do track = 1,20
+			   start(2) = track - 1
+			   status = he5_swwrfld(swid,"Longitude",start,
+     1              stride,count,lng)
+			   do itrack = 1,10
+				  lat(itrack) = track
+			   enddo
+			   status = he5_swwrfld(swid,"Latitude",start,
+     1              stride,count,lat) 
+			enddo
+
+			do i = 1,73
+			   tme(i) = 345740878.3 + 848936.2*(i-1)
+			enddo
+            
+			start(1)  = 0
+			stride(1) = 1
+			count(1)  = 73
+	     
+			status = he5_swwrfld(swid, "Time", start, stride,
+     1           count, tme)
+
+			start(1) = 0
+                        stride(1) = 1
+                        count(1)  = 10
+                        status = he5_swwrfld(swid, "test_string", start, 
+     1           stride, count, charfield)
+
+c     Write Spectra one plane at a time 
+c     Value is 100 * track index + band index (0-based)
+c     -------------------------------------------------
+			start(1)  = 0
+			start(2)  = 0
+			count(1)  = 20
+			count(2)  = 40
+			count(3)  = 1
+			stride(3) = 1
+	    
+			do i=1,15
+			   start(3) = i - 1
+			   do j=1,40
+				  do k=1,20
+					 plane((j-1)*20+k) = (j-1)*100 + i-1
+				  enddo
+			   enddo
+			   status = he5_swwrfld(swid,"Spectra",start,
+     1              stride,count,plane)
+			enddo
+
+c     Populate data buffer and write data to the Profile Field
+c     --------------------------------------------------------
+      datasize = 0
+      counter  = 0
+      do i=1,4
+
+         len(i)    = i*25
+         datasize  = datasize + len(i)
+         do j=1,(25*i)
+            counter = counter + 1
+            buffer(counter) = (i)*1000 + j - 1
+         enddo
+      enddo
+
+      start(1)  = 0
+      count(1)  = 4
+      stride(1) = 1
+
+      status = he5_prwrite(swid,"Profile-2000",start,stride,count,
+     1datasize,len,buffer)
+      write(*,*) 'Status returned by he5_prwrite():  ',status
+			
+c     Write User defined Attribute
+c     ----------------------------
+			attr(1)  = 3
+			attr(2)  = 5
+			attr(3)  = 7
+			attr(4)  = 11
+            count(1) = 4
+			status = he5_swwrattr(swid,"TestAttr",HE5T_NATIVE_INT,
+     1           count,attr)
+
+c     Write Global Attribute
+c     ----------------------
+			attr4 = "ABCDEFGH"
+			count(1) = 8
+			status = he5_swwrattr(swid,"GLOBAL_CHAR_ATTR",HE5T_NATIVE_CHAR,
+	1	count,attr4)
+
+			attr4 = "111"
+			count(1) = 3		
+			status = he5_swwrgattr(swid,"GLOBAL_CHAR_ATTR_1",HE5T_NATIVE_CHAR,
+	1	count,attr4)
+
+			attr4 = "222222"
+			count(1) = 6
+			status = he5_ehwrglatt(swfid,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR,
+	1	count,attr4)
+
+c     Write Local Attribute
+c     ---------------------
+			attr5 = "abababababababababab"
+			count(1) = 20
+			status = he5_swwrlattr(swid,"Density","LocalAttribute_0",
+	1	HE5T_NATIVE_CHAR,count,attr5)
+
+	      
+		 endif
+	  endif
+	  
+c     Detach from the swath
+c     ---------------------
+      status = he5_swdetach(swid)
+      write(*,*) 'Status returned by he5_swdetach():  ',status
+
+c     Close the file
+c     --------------
+      status = he5_swclose(swfid)
+      write(*,*) 'Status returned by he5_swclose():  ',status
+	  
+      stop
+      end
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_sw_writedimscale.c b/samples/he5_sw_writedimscale.c
new file mode 100644
index 0000000..f3ffcdf
--- /dev/null
+++ b/samples/he5_sw_writedimscale.c
@@ -0,0 +1,137 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Raytheon Systems Company                         |
+ ----------------------------------------------------------------------------
+ */
+
+#include     <HE5_HdfEosDef.h>
+
+/*
+ * In this example we will open an HDF-EOS file and attach to
+ * a swath structures within the file to write a dimension scales
+ */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  hid_t           swfid = FAIL;
+  hid_t           SWid1 = FAIL;
+
+  int             data[15]={1,2,3,6,9,12,15,18,23,26,29,32, 33,34,35};
+  char            label[16];
+  char            unit[16];
+  char            format[16];
+  int             nbands;
+  hsize_t         count[3];
+
+  /*
+   * We first open the HDF-EOS swath file, "Swath.h5".  Because this file
+   * already exist and we wish to write to it, we use the H5F_ACC_RDWR access
+   * code in the open statement.  The HE5_SWopen routine returns the swath file
+   * id, swfid, which is used to identify the file in subsequent routines.
+   */ 
+
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR);
+ 
+  /*
+   * If the swath file cannot be found, HE5_SWopen will return -1 for the file
+   * handle (swfid).  We there check that this is not the case before
+   * proceeding with the other routines.
+   * 
+   * The HE5_SWattach routine returns the handle to the existing swath "Swath1",
+   * SWid1.  If the swath is not found, HE5_SWattach returns -1 for the handle.
+   */ 
+
+  if (swfid != FAIL)
+    {	  
+      SWid1 = HE5_SWattach(swfid, "Swath1");
+
+      /* the field Spectra has Bands,Res2tr,Res2xtr dimensions. 
+	 xdim = 120;
+	 ydim = 200;
+	 Time dim is set to 10
+      */
+
+      if (SWid1 == -1)
+	{
+	  printf("\t\tError: Cannot attach to swath \"Swath1\"\n");
+	  HE5_SWclose(swfid);
+	  return -1;
+	}
+      
+      nbands = 15;
+      
+      status = HE5_SWsetdimscale(SWid1, "Spectra", "Bands", nbands, H5T_NATIVE_INT, (void *)data);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_SWdetach(SWid1);
+	  HE5_SWclose(swfid);
+	  return -1;
+	}
+      
+      strcpy(label, "Bands Dim");
+      strcpy(unit, "None");
+      strcpy(format, "I2");
+      
+      count[0]= 12;
+      status = HE5_SWwritedscaleattr(SWid1, "Bands", "label", H5T_NATIVE_CHAR, count, label);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_SWdetach(SWid1);
+	  HE5_SWclose(swfid);
+	  return -1;
+	}
+
+      count[0]= 6;
+      status = HE5_SWwritedscaleattr(SWid1, "Bands", "unit", H5T_NATIVE_CHAR, count, unit);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_SWdetach(SWid1);
+	  HE5_SWclose(swfid);
+	  return -1;
+	}
+      
+      count[0]= 4;
+      status = HE5_SWwritedscaleattr(SWid1, "Bands", "format", H5T_NATIVE_CHAR, count, format);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_SWdetach(SWid1);
+	  HE5_SWclose(swfid);
+	  return -1;
+	}
+         
+      int datbuf_i1[1] = {-999};
+      count[0]= 1;
+      status = HE5_SWwritedscaleattr(SWid1, "Bands", "MissingValue", H5T_NATIVE_INT, count, datbuf_i1);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_SWdetach(SWid1);
+	  HE5_SWclose(swfid);
+	  return -1;
+	}
+      
+      int datbuf_i2[3] = {-999,0,999};
+      count[0]= 3;
+      status = HE5_SWwritedscaleattr(SWid1, "Bands", "IntValues", H5T_NATIVE_INT, count, datbuf_i2);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_SWdetach(SWid1);
+	  HE5_SWclose(swfid);
+	  return -1;
+	}
+      
+      HE5_SWdetach(SWid1);
+      
+      HE5_SWclose(swfid);
+      
+      return 0;
+    }
+}
diff --git a/samples/he5_sw_writedimscaleF_32.f b/samples/he5_sw_writedimscaleF_32.f
new file mode 100644
index 0000000..73dca6f
--- /dev/null
+++ b/samples/he5_sw_writedimscaleF_32.f
@@ -0,0 +1,168 @@
+      program     he5_sw_writedimscaleF_32
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     i, j
+      integer     he5_swopen
+      integer     he5_swattach
+      integer     he5_swwrfld
+      integer     he5_swwrattr
+      integer     he5_swwrgattr
+      integer     he5_ehwrglatt
+      integer     he5_swwrlattr 
+      integer     he5_swdetach
+      integer     he5_swclose
+      integer     HE5_SWsetdimscale
+      integer     HE5_SWwritedscaleattr
+
+      integer     swfid,swid1
+      integer*4   datbuf_i1(1) 
+      integer*4   datbuf_i(15)
+      integer     count(2)
+      integer*4   nbands
+      integer     bands(3)
+      integer*4   datbuf_i2(2)
+      integer     xdim, ydim, ntime
+      integer     data(15)
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+
+
+!  /*
+!   * We first open the HDF-EOS swath file, "swath.he5".  Because this file
+!   * already exist and we wish to write to it, we use the H5F_ACC_RDWR access
+!   * code in the open statement.  The HE5_SWopen routine returns the swath file
+!   * id, swfid, which is used to identify the file in subsequent routines.
+!   */ 
+      nbands = 15
+      do j=1,nbands
+         data(j)=(j+1)*2
+      enddo
+
+      swfid = HE5_SWopen("swath.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_swopen(): ',swfid
+!  /*
+!   * If the swath file cannot be found, HE5_SWopen will return -1 for the file
+!   * handle (swfid).  We there check that this is not the case before
+!   * proceeding with the other routines.
+!   * 
+!   * The HE5_SWattach routine returns the handle to the existing swath "Swath1",
+!   * SWid.  If the swath is not found, HE5_SWattach returns -1 for the handle.
+!   */ 
+
+      if (swfid .ne. FAIL) then
+ 
+         SWid1 = HE5_SWattach(swfid, "Swath1")
+         write(*,*) 'Swath ID returned by he5_swattach(): ',swid1
+
+!      /* the field Spectra has Bands,Res2tr,Res2xtr dimensions. 
+!	 xdim = 120;
+!	 ydim = 200;
+!	 Time dim is set to 10
+!      */
+
+         if (SWid1 .eq. -1) then
+            
+            write(*,*) 'Error: Cannot attach to swath Swath1. Stpped.'
+            status = HE5_SWclose(swfid)
+            stop
+            
+         endif
+                  
+         status = HE5_SWsetdimscale(SWid1, "Spectra", "Bands", nbands,
+     1                               HE5T_NATIVE_INT, data)
+         write(*,*) 'Status returned by HE5_SWsetdimscale: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error: Cannot set Dimension Scale for Bands',
+     1                 ' dimemnsion in field Vegetation'
+            status = HE5_SWdetach(SWid1)
+            status = HE5_SWclose(swfid)
+            stop
+         endif
+
+         count(1)= 12
+         status = HE5_SWwritedscaleattr(SWid1, "Bands", "label", 
+     1                         HE5T_NATIVE_CHAR, count, "Bands Dim")
+         write(*,*) 'Status returned by HE5_SWwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale str for Bands',
+     1                ' dimemnsion in field Spectra'
+            status = HE5_SWdetach(SWid1)
+            status = HE5_SWclose(swfid)
+            stop
+         endif
+         
+         count(1)= 6
+         status = HE5_SWwritedscaleattr(SWid1, "Bands", "unit", 
+     1                              HE5T_NATIVE_CHAR, count, "None")
+         write(*,*) 'Status returned by HE5_SWwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale str for Bands',
+     1                 ' dimemnsion in field Spectra'
+            status = HE5_SWdetach(SWid1)
+            status = HE5_SWclose(swfid)
+            stop
+         endif
+         
+         count(1)= 4
+         status = HE5_SWwritedscaleattr(SWid1, "Bands", "format", 
+     1                                 HE5T_NATIVE_CHAR, count, "I2")
+         write(*,*) 'Status returned by HE5_SWwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale str for Bands',
+     1                 ' dimemnsion in field Spectra'
+            status = HE5_SWdetach(SWid1)
+            status =  HE5_SWclose(swfid)
+            stop
+         endif
+
+         datbuf_i1(1) = -999
+         count(1)= 1
+         status = HE5_SWwritedscaleattr(SWid1, "Bands", "MissingValue",
+     1                             HE5T_NATIVE_INT, count, datbuf_i1)
+         write(*,*) 'Status returned by HE5_SWwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale str for Bands',
+     1                 ' dimemnsion in field Spectra'
+            status = HE5_SWdetach(SWid1)
+            status = HE5_SWclose(swfid)
+            stop
+         endif
+         
+         datbuf_i(1) =  -999
+         datbuf_i(2) =  0
+         datbuf_i(3) =  999
+
+
+         count(1)= 3
+         status = HE5_SWwritedscaleattr(SWid1, "Bands", "IntValues", 
+     1                               HE5T_NATIVE_INT, count, datbuf_i)
+         write(*,*) 'Status returned by HE5_SWwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale str for Bands',
+     1         ' dimemnsion in field Spectra'
+            status = HE5_SWdetach(SWid1)
+            status = HE5_SWclose(swfid)
+            stop
+         endif
+         
+         status = HE5_SWdetach(SWid1)
+         write(*,*) 'Status returned by he5_swdetach(): ',status
+
+         status = HE5_SWclose(swfid)
+         write(*,*) 'Status returned by he5_swclose(): ',status
+
+      endif
+      stop
+      end
+
diff --git a/samples/he5_sw_wrunlimfld.c b/samples/he5_sw_wrunlimfld.c
new file mode 100755
index 0000000..e813e4f
--- /dev/null
+++ b/samples/he5_sw_wrunlimfld.c
@@ -0,0 +1,205 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include <HE5_HdfEosDef.h>
+
+/* In this program we (1) open the "Swath.h5" HDF-EOS file, (2) attach to  */
+/* the "Swath1" swath, and (3) write data to the "Longitude", "Latitude",  */
+/*      and (appendable) "Spectra" fields                                  */
+/* ----------------------------------------------------------------------- */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  int             i, j, k;
+  int             track, xtrack;
+  int             rank = FAIL;
+
+  hid_t           swfid = FAIL;
+  hid_t           SWid  = FAIL;
+
+  hid_t     *ntype;
+
+  hssize_t        start[3] = {0, 0, 0};
+    
+  hsize_t         count[3];
+  hsize_t         dims[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+
+  long            attr[4] = {3, 5, 7, 11};
+
+  float           lng[20][10], latcnt;  
+  float           lat[20][10], loncnt;
+
+  double          plane[15][40][20];
+  double          tme[20];
+
+  char            dimlist[80];
+  char            maxdimlist[80];   
+
+  hvl_t           buffer[4];
+
+  size_t          datasize;
+
+
+  /* Populate lon/lat data arrays */
+  /* ---------------------------- */
+  latcnt = 1.;
+  loncnt = 1.;
+  track  = 0;
+  xtrack = 0;
+ 
+  while(track < 20) {
+	while(xtrack < 10) {
+	  lat[track][xtrack] = latcnt;
+	  lng[track][xtrack] = loncnt;
+	  loncnt = loncnt + 1.;
+	  xtrack++;
+	}
+	latcnt = latcnt + 1.;
+	loncnt = 1.;
+	track++;
+	xtrack = 0;
+  }
+    
+
+  /* Popolate spectra data arrays */
+  /* ---------------------------- */
+  for (i = 0; i < 15; i++){
+	for (j = 0; j < 40; j++)
+	  for (k = 0; k < 20; k++)
+		plane[i][j][k] = (double)(j*100 + i);
+  }
+
+
+  /* Allocate memory for and populate data buffer */
+  /* -------------------------------------------- */
+  datasize = 0;
+  for (i = 0; i < 4; i++)
+	{
+	  buffer[i].p = (hvl_t *)calloc( 25 *(i+1), sizeof(unsigned int));
+	  buffer[i].len  =  25 * (i+1);
+	  /* calculate the data buffer size (bytes) */
+	  datasize += buffer[i].len * sizeof(unsigned int);
+	  for ( j = 0; j < 25 * (i+1); j++)
+		((unsigned int *)buffer[i].p)[j] = (i+1)*1000 + j;
+	}
+
+
+  /* Open the HDF swath file, "Swath.h5" */
+  /* ----------------------------------- */
+  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR);
+  if (swfid != FAIL)
+    {
+	  /* Attach the "Swath1" swath */
+	  /* ------------------------- */
+	  SWid = HE5_SWattach(swfid, "Swath1");
+	  if (SWid != FAIL)
+		{
+		  count[0] = 20;
+		  count[1] = 10;
+
+		  /* Write "Longitute" field */
+		  /* ----------------------- */
+		  status = HE5_SWwritefield(SWid, "Longitude", start, NULL, count, lng);
+		  printf("status returned by HE5_SWwritefield(\"Longitude\"):         %d\n", status);
+	    
+		  /* Write "Latitude" field */
+		  /* ---------------------- */
+		  status = HE5_SWwritefield(SWid, "Latitude", start, NULL, count, lat);
+		  printf("status returned by HE5_SWwritefield(\"Latitude\"):          %d\n", status);
+
+		  /*  Write "Time" field */
+		  /* ------------------- */
+		  for (i = 0; i < 20; i++) 
+			tme[i] = 34574087.3 + 84893.2*i;
+
+		  count[0] = 20;
+		  status = HE5_SWwritefield(SWid, "Time", start, NULL, count, tme);
+		  printf("status returned by HE5_SWwritefield(\"Time\"):              %d\n", status);
+
+		  /*  Write "Spectra" field  1st time */
+		  /* -------------------------------- */
+
+		  count[0] = 15;  
+		  count[1] = 40;  
+		  count[2] = 20;
+
+		  status = HE5_SWwritefield(SWid, "Spectra", start, NULL, count, plane);
+		  printf("status returned by HE5_SWwritefield(\"Spectra\"):           %d\n", status);
+
+		  /* Retrieve information about "Spectra" field */
+		  /* ------------------------------------------ */
+
+		  ntype = (hid_t *)calloc(3,sizeof(hid_t));
+
+		  status = HE5_SWfieldinfo(SWid, "Spectra", &rank, dims, ntype, dimlist, maxdimlist);
+		  printf("Number of elements after first write: \n");
+		  for ( i = 0; i < rank; i++)
+			printf("\t\t %lu\n",(unsigned long)dims[i]);
+
+		  printf("DimList string:        %s \n", dimlist);
+		  printf("MaxdimList string:     %s \n", maxdimlist);
+
+		  /*  Write Spectra Field  2d time */
+		  /* ----------------------------- */
+
+		  start[0] = 10;  
+		  start[1] = 50;  
+		  start[2] = 30;
+
+		  count[0] = 15;  
+		  count[1] = 40;  
+		  count[2] = 20;
+
+		  status = HE5_SWwritefield(SWid, "Spectra", start, NULL, count, plane);
+		  printf("status returned by HE5_SWwritefield(\"Spectra\"):           %d\n", status);
+
+		  /* Retrieve information about "Spectra" field */
+		  /* ------------------------------------------ */
+
+		  dims[0] = 0;  
+		  dims[1] = 0; 
+		  dims[2] = 0;
+		  status = HE5_SWfieldinfo(SWid, "Spectra", &rank, dims, ntype, dimlist, maxdimlist);
+		  printf("Number of elements after second write: \n");
+		  for ( i = 0; i < rank; i++)
+			{
+			  printf("\t\t %lu\n",(unsigned long)dims[i]);
+			}
+		  printf("DimList string:        %s \n", dimlist);
+		  printf("MaxdimList string:     %s \n", maxdimlist);            
+
+		  free(ntype);
+
+		  /* Write data to the profile */
+		  /* ------------------------- */
+		  start[0] = 0;  count[0] = 4;
+		  status = HE5_PRwrite(SWid, "Profile-2000", start, NULL, count, datasize, buffer);
+		  printf("Status returned by HE5_PRwrite(\"Profile-2000\"):           %d \n", status);
+   
+		  /* Write User-defined Attribute */
+		  /* ---------------------------- */
+		  count[0] = 4;
+		  status = HE5_SWwriteattr(SWid, "TestAttr", H5T_NATIVE_INT, count, attr);
+		  printf("status returned by HE5_SWwriteattr(\"TestAttr\"):           %d\n", status);
+	    
+		}
+    }
+
+  status = HE5_SWdetach(SWid);
+  status = HE5_SWclose(swfid);
+
+  return 0;
+}
+
+
+
+
+
+
diff --git a/samples/he5_za_datainfo.c b/samples/he5_za_datainfo.c
new file mode 100755
index 0000000..8debbd5
--- /dev/null
+++ b/samples/he5_za_datainfo.c
@@ -0,0 +1,106 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |  
+ ----------------------------------------------------------------------------  
+ */
+
+
+#include   <HE5_HdfEosDef.h>
+
+
+#define FILENAME   "ZA.he5"
+#define OBJECT     "ZA1"
+
+
+int main(void)
+{
+  herr_t       status     = FAIL;
+
+  int          fieldgroup = FAIL;
+
+  hid_t        fid      = FAIL;
+  hid_t        ZAid     = FAIL;
+  hid_t        datatype = FAIL;
+
+  H5T_class_t  classid = H5T_NO_CLASS;     
+  H5T_order_t  order   = H5T_ORDER_ERROR;
+
+  size_t       size    = 0;
+
+
+  /* Open the HDF-EOS ZA file */
+  /* ------------------------ */
+  fid = HE5_ZAopen(FILENAME, H5F_ACC_RDONLY);
+  printf("File ID returned by HE5_ZAopen() :         %d \n", fid);
+    
+  /* Attach to the "ZA1" za */
+  /* ---------------------- */
+  ZAid = HE5_ZAattach(fid, OBJECT);
+  printf("ZA ID returned by HE5_ZAattach() :      %d \n", ZAid);
+
+  /* Inquire data type information for the "Spectra" field */
+  /* ----------------------------------------------------- */
+  fieldgroup = HE5_HDFE_DATAGROUP;
+  status = HE5_ZAinqdatatype(ZAid, "Spectra", NULL, fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_ZAinqdatatype() :   %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", datatype);
+	  printf("\tclass ID:    %d \n", classid);
+	  printf("\torder:       %d \n", order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  /* Inquire data type information for the attributes */
+  /* ------------------------------------------------ */
+  fieldgroup = HE5_HDFE_ATTRGROUP;
+  status = HE5_ZAinqdatatype(ZAid, NULL, "GlobalAttribute", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_ZAinqdatatype() :   %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", datatype);
+	  printf("\tclass ID:    %d \n", classid);
+	  printf("\torder:       %d \n", order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  fieldgroup = HE5_HDFE_GRPATTRGROUP;
+  status = HE5_ZAinqdatatype(ZAid, NULL, "GroupAttribute", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_ZAinqdatatype() :   %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", datatype);
+	  printf("\tclass ID:    %d \n", classid);
+	  printf("\torder:       %d \n", order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+  fieldgroup = HE5_HDFE_LOCATTRGROUP;
+  status = HE5_ZAinqdatatype(ZAid, "Density", "LocalAttribute", fieldgroup, &datatype, &classid, &order, &size);
+  printf("Status returned by HE5_ZAinqdatatype() :   %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("\tdatatype:    %d \n", datatype);
+	  printf("\tclass ID:    %d \n", classid);
+	  printf("\torder:       %d \n", order);
+	  printf("\tsize:        %d \n", (int)size);        
+	}
+
+
+  /* Detach from the za */
+  /* ------------------ */
+  status = HE5_ZAdetach(ZAid);
+  printf("Status returned by HE5_ZAdetach() :        %d \n", status);
+
+  /* Close the file */
+  /* -------------- */
+  status = HE5_ZAclose(fid);
+  printf("Status returned by HE5_ZAclose() :         %d \n", status);
+    
+  return(0);
+    
+}
+
+
+
+
diff --git a/samples/he5_za_defexternalfld.c b/samples/he5_za_defexternalfld.c
new file mode 100755
index 0000000..ba7eb2b
--- /dev/null
+++ b/samples/he5_za_defexternalfld.c
@@ -0,0 +1,73 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+#include    <HE5_HdfEosDef.h>
+
+
+/* --------------------------------------------------------- */
+/*   In this program we (1) open the "ZA.he5" HDF-EOS file,   */
+/*   (2) attach to the "ZA1" za, and (3) define the external */
+/*   data field "ExtData".                                   */
+/* --------------------------------------------------------- */
+
+int main()
+{
+  
+  herr_t      status = FAIL;
+  
+  hid_t       zafid = FAIL;
+  hid_t       ZAid  = FAIL;
+
+  off_t       offset[3];
+
+  hsize_t     size[3];
+  
+
+  /* Open the file, "ZA.he5", using the H5F_ACC_RDWR access code */
+  /* ---------------------------------------------------------- */
+  zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDWR);
+  if (zafid != FAIL)
+    {
+	  /* Attach to the "ZA1" za */
+	  /* ---------------------- */
+	  ZAid = HE5_ZAattach(zafid, "ZA1"); 
+	  if (ZAid != FAIL)
+		{
+		  /* Set the data sizes and offsets in external files */
+		  /* ------------------------------------------------ */
+		  size[0] = 10 * sizeof(int);       offset[0] = 0;
+		  size[1] = 20 * sizeof(int);       offset[1] = 40;
+		  size[2] = 30 * sizeof(int);       offset[2] = 80;
+
+		  /* Set external data files first */
+		  /* ----------------------------- */
+		  status = HE5_ZAsetextdata(ZAid, "external_1.data,external_2.data,external_3.data", offset, size);
+		  printf("Status returned by HE5_ZAsetextdata(...) :                        %d\n",status);
+
+		  /* Define field containing external data */
+		  /* ------------------------------------- */
+		  status = HE5_ZAdefine(ZAid, "ExtData", "ExtDim", NULL, H5T_NATIVE_INT);
+		  printf("Status returned by HE5_ZAdefine(...\"ExtData\",...) :         %d\n",status);		  
+		}
+    }
+
+  /* Detach from the za */
+  /* ------------------ */
+  status = HE5_ZAdetach(ZAid);
+  printf("Status returned by HE5_ZAdetach(...) :                            %d\n",status);
+
+  /* Close the file */
+  /* -------------- */
+  status = HE5_ZAclose(zafid);
+  printf("Status returned by HE5_ZAclose(...) :                             %d\n",status);
+  
+  return 0;
+}
+
+
+
+
+
diff --git a/samples/he5_za_defexternalfldF_32.f b/samples/he5_za_defexternalfldF_32.f
new file mode 100755
index 0000000..1725070
--- /dev/null
+++ b/samples/he5_za_defexternalfldF_32.f
@@ -0,0 +1,73 @@
+!
+!     In this program we (1) open the "za.he5" HDF-EOS file, 
+!     (2) attach to the "ZA1" za, and (3) define the 
+!     external data field "ExtData".
+!
+      program     he5_za_defexternalfldF_32
+
+      implicit    none
+ 
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     he5_zaopen
+      integer     he5_zaattach
+      integer     he5_zadefine
+      integer     he5_zadetach
+      integer     he5_zaclose
+      integer     he5_zasetxdat
+      integer     zafid, zaid
+
+      integer*4   offset(3), size(3)
+
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+
+!     Open the HDF-EOS file, "za.he5" using "READ/WRITE" access code
+!     --------------------------------------------------------------
+      zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_zaopen():  ',zafid
+      if (zafid .NE. FAIL) then
+
+      zaid = he5_zaattach(zafid, "ZA1")
+      write(*,*) 'ZA ID returned by he5_zaattach():  ',zaid
+      if (zaid .NE. FAIL) then
+
+      offset(1) = 0 
+      size(1)   = 40
+
+      offset(2) = 40
+      size(2)   = 80
+
+      offset(3) = 80
+      size(3)   = 120
+
+      status = he5_zasetxdat(zaid, "extf1.dat,extf2.dat,extf3.dat",
+     1offset, size)
+      write(*,*) 'Status returned by he5_zasetxdat():  ',status
+      
+      status = he5_zadefine(zaid, "ExtData", "ExtDim",
+     1" ", HE5T_NATIVE_INT)
+      write(*,*) 'Status returned by he5_zadefine():  ',status
+
+      endif
+      endif
+
+!     Detach from the za
+!     ------------------      
+      status = he5_zadetach(zaid)
+      write(*,*) 'Status returned by he5_zadetach():  ',status
+
+!     Close the file
+!     --------------      
+      status = he5_zaclose(zafid)
+      write(*,*) 'Status returned by he5_zaclose():  ',status
+
+      stop
+      end
+
+
+
+
+
diff --git a/samples/he5_za_defexternalfldF_64.f b/samples/he5_za_defexternalfldF_64.f
new file mode 100755
index 0000000..c42586d
--- /dev/null
+++ b/samples/he5_za_defexternalfldF_64.f
@@ -0,0 +1,78 @@
+!
+!   In this program we (1) open the "za.he5" HDF-EOS file, (2)
+!   attach to the "ZA1" za, and (3) define the external data 
+!   field "ExtData".
+!
+
+      program     he5_za_defexternalfldF_64
+
+      implicit    none
+ 
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     he5_zaopen
+      integer     he5_zaattach
+      integer     he5_zadefine
+      integer     he5_zadetach
+      integer     he5_zaclose
+      integer     he5_zasetxdat
+      integer     zafid, zaid
+
+      integer*8   offset(3), size(3)
+
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+
+!     Open the HDF-EOS file, "za.he5" using "READ/WRITE" access code
+!     --------------------------------------------------------------
+      zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_zaopen():  ',zafid
+      if (zafid .NE. FAIL) then
+
+      zaid = he5_zaattach(zafid, "ZA1")
+      write(*,*) 'ZA ID returned by he5_zaattach():  ',zaid
+      if (zaid .NE. FAIL) then
+
+      offset(1) = 0 
+      size(1)   = 40
+
+      offset(2) = 40
+      size(2)   = 80
+
+      offset(3) = 80
+      size(3)   = 120
+
+      status = he5_zasetxdat(zaid, "extf1.dat,extf2.dat,extf3.dat",
+     1offset, size)
+      write(*,*) 'Status returned by he5_zasetxdat():  ',status
+      
+      status = he5_zadefine(zaid, "ExtData", "ExtDim",
+     1" ", HE5T_NATIVE_INT)
+      write(*,*) 'Status returned by he5_zadefine():  ',status
+
+      endif
+      endif
+
+!     Detach from the za
+!     ------------------      
+      status = he5_zadetach(zaid)
+      write(*,*) 'Status returned by he5_zadetach():  ',status
+
+!     Close the file
+!     --------------      
+      status = he5_zaclose(zafid)
+      write(*,*) 'Status returned by he5_zaclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_definefields.c b/samples/he5_za_definefields.c
new file mode 100755
index 0000000..461a4eb
--- /dev/null
+++ b/samples/he5_za_definefields.c
@@ -0,0 +1,172 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+#include     <HE5_config.h>
+#include     <HE5_HdfEosDef.h>
+
+#define  RANK   3
+#define  rank   1
+
+/* In this program we (1) open the "ZA.he5" HDF-EOS file, */
+/* (2) attach to the "ZA1" za, and (3) define the fields */
+/* ----------------------------------------------------- */
+
+int main()
+{
+  
+  herr_t      status = FAIL;
+
+  int         comp_level[ 5 ] = {0,0,0,0,0};
+  int         comp_code;
+  
+  hid_t       zafid = FAIL;
+  hid_t       ZAid  = FAIL;
+
+  hsize_t     chunk_dims[ 3 ];
+  char        fillvalue[100] = "charname";
+
+
+  /* Open the file, "ZA.he5", using the H5F_ACC_RDWR access code */
+  /* ---------------------------------------------------------- */
+  zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDWR);
+  if (zafid != FAIL)
+    {
+	  ZAid = HE5_ZAattach(zafid, "ZA1"); 
+	  if (ZAid != FAIL)
+		{
+		  status = HE5_ZAdefine(ZAid, "Density", "MyTrack1", NULL, H5T_NATIVE_FLOAT);
+		  printf("Status returned by HE5_ZAdefine(...\"Density\",...) :     %d\n",status);
+		  
+		  status = HE5_ZAdefine(ZAid, "Temperature", "MyTrack1,MyTrack2",NULL, H5T_NATIVE_FLOAT);
+		  printf("Status returned by HE5_ZAdefine(...\"Temperature\",...) : %d\n",status);
+
+		  status = HE5_ZAdefine(ZAid, "Presure", "Res2tr,Res2xtr", NULL, H5T_NATIVE_DOUBLE);
+		  printf("Status returned by HE5_ZAdefine(...\"Presure\",...) :    %d\n",status);
+
+                  status = HE5_ZAsetfillvalue(ZAid, "Test_string", HE5T_CHARSTRING, fillvalue);
+                  printf("Status returned by HE5_ZAsetfillvalue(...\"Test_string\",...) :     %d\n",status);
+ 
+                  status = HE5_ZAdefine(ZAid, "Test_string", "MyTrack2", NULL, HE5T_CHARSTRING);
+                  printf("Status returned by HE5_ZAdefine(...\"Test_string\",...) :     %d\n",status);
+
+
+		  /* Define Appendable Field */
+		  /* ----------------------- */
+
+		  /*           First, define chunking          */
+		  /* (the appendable dataset must be chunked)  */
+		  /* ----------------------------------------  */
+		  chunk_dims[0] = 15;
+		  chunk_dims[1] = 40;
+		  chunk_dims[2] = 20;
+
+		  status = HE5_ZAdefchunk(ZAid, RANK, chunk_dims);
+		  printf("\tStatus returned by HE5_ZAdefchunk() :                 %d\n",status);
+
+		  /* Second, define compression scheme */
+		  /* --------------------------------- */ 
+		  
+		  /* set the value of compression code: */
+		  /*  HDFE_COMP_NONE                  0 */
+		  /*  HDFE_COMP_RLE                   1 */   
+		  /*  HDFE_COMP_NBIT                  2 */   
+		  /*  HDFE_COMP_SKPHUFF               3 */   
+		  /*  HDFE_COMP_DEFLATE               4 */           
+                  /*  HDFE_COMP_SZIP_CHIP             5 */
+                  /*  HDFE_COMP_SZIP_K13              6 */
+                  /*  HDFE_COMP_SZIP_EC               7 */
+                  /*  HDFE_COMP_SZIP_NN               8 */
+                  /*  HDFE_COMP_SZIP_K13orEC          9 */
+                  /*  HDFE_COMP_SZIP_K13orNN          10 */
+                  /*  HDFE_COMP_SHUF_DEFLATE          11 */
+                  /*  HDFE_COMP_SHUF_SZIP_CHIP        12 */
+                  /*  HDFE_COMP_SHUF_SZIP_K13         13 */
+                  /*  HDFE_COMP_SHUF_SZIP_EC          14 */
+                  /*  HDFE_COMP_SHUF_SZIP_NN          15 */
+                  /*  HDFE_COMP_SHUF_SZIP_K13orEC     16 */
+                  /*  HDFE_COMP_SHUF_SZIP_K13orNN     17 */
+		  comp_code = 9;
+                  /*comp_code = 0;*/
+
+		  /* Set compression level: value 0,1,2,3,4,5,6,7,8,9,10,16, or 32 */
+		  /* ------------------------------------------------------------- */
+		  comp_level[0] = 16;
+                  /*comp_level[0] = 0;*/
+		  
+#ifdef HAVE_FILTER_SZIP_ENCODER
+		  status = HE5_ZAdefcomp(ZAid,comp_code, comp_level);
+		  printf("\tStatus returned by HE5_ZAdefcomp() :                  %d\n",status);
+#else
+		  printf("SZIP encoder is not available. The data compression test is skipped.\n");
+#endif
+
+                  status = HE5_ZAdefine(ZAid, "Spectra", "Bands,Res2tr,Res2xtr", NULL, H5T_NATIVE_FLOAT);
+                  printf("Status returned by HE5_ZAdefine(...\"Spectra\",...) :     %d\n",status);
+
+                  /* Define Appendable Field */
+                  /* ----------------------- */
+ 
+                  /*           First, define chunking          */
+                  /* (the appendable dataset must be chunked)  */
+                  /* ----------------------------------------  */
+                  chunk_dims[0] = 20;
+ 
+                  status = HE5_ZAdefchunk(ZAid, rank, chunk_dims);
+                  printf("\tStatus returned by HE5_ZAdefchunk() :                 %d\n",status);
+ 
+                  /* Second, define compression scheme */
+                  /* --------------------------------- */
+ 
+                  /* set the value of compression code: */
+                  /*  HDFE_COMP_NONE                  0 */
+                  /*  HDFE_COMP_RLE                   1 */
+                  /*  HDFE_COMP_NBIT                  2 */
+                  /*  HDFE_COMP_SKPHUFF               3 */
+                  /*  HDFE_COMP_DEFLATE               4 */
+                  /*  HDFE_COMP_SZIP_CHIP             5 */
+                  /*  HDFE_COMP_SZIP_K13              6 */
+                  /*  HDFE_COMP_SZIP_EC               7 */
+                  /*  HDFE_COMP_SZIP_NN               8 */
+                  /*  HDFE_COMP_SZIP_K13orEC          9 */
+                  /*  HDFE_COMP_SZIP_K13orNN          10 */
+                  /*  HDFE_COMP_SHUF_DEFLATE          11 */
+                  /*  HDFE_COMP_SHUF_SZIP_CHIP        12 */
+                  /*  HDFE_COMP_SHUF_SZIP_K13         13 */
+                  /*  HDFE_COMP_SHUF_SZIP_EC          14 */
+                  /*  HDFE_COMP_SHUF_SZIP_NN          15 */
+                  /*  HDFE_COMP_SHUF_SZIP_K13orEC     16  */
+                  /*  HDFE_COMP_SHUF_SZIP_K13orNN     17  */
+                  comp_code = 16;
+                  /*comp_code = 0;*/
+ 
+                  /* Set compression level: value 0,1,2,3,4,5,6,7,8,9,10,16, or 32 */
+                  /* ------------------------------------------------------------- */
+                  comp_level[0] = 2;
+                  /*comp_level[0] = 0;*/
+ 
+#ifdef HAVE_FILTER_SZIP_ENCODER
+		  status = HE5_ZAdefcomp(ZAid,comp_code, comp_level);
+		  printf("\tStatus returned by HE5_ZAdefcomp() :                  %d\n",status);
+#else
+		  printf("SZIP encoder is not available. The data compression test is skipped.\n");
+#endif
+ 
+                  status = HE5_ZAdefine(ZAid, "Count", "MyTrack1", "Unlim", H5T_NATIVE_INT);
+                  printf("Status returned by HE5_ZAdefine(...\"Count\",...) :       %d\n",status);
+
+		}
+    }
+  
+  status = HE5_ZAdetach(ZAid);
+  status = HE5_ZAclose(zafid);
+  
+  return 0;
+}
+
+
+
+
+
diff --git a/samples/he5_za_definefieldsF_32.f b/samples/he5_za_definefieldsF_32.f
new file mode 100755
index 0000000..19b8c9a
--- /dev/null
+++ b/samples/he5_za_definefieldsF_32.f
@@ -0,0 +1,93 @@
+!     In this program we (1) open the "za.he5" HDF-EOS file, 
+!     (2) attach to the "ZA1" za, and (3) define the za fields
+!     ========================================================
+
+      program     he5_za_definefieldsF_32
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     he5_zaopen
+      integer     he5_zaattach
+      integer     he5_zadefine
+      integer     he5_zadefchunk
+      integer     he5_zadefcomp
+      integer     he5_zadetach
+      integer     he5_zaclose
+      integer     zafid, zaid
+
+      integer     chunkrank
+      integer*4   chunkdims(3)
+      integer     compparm(1)
+
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+!     Open the HDF-EOS file, "za.he5" using "READ/WRITE" access code
+!     --------------------------------------------------------------
+      zafid = he5_zaopen("za.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_zaopen():  ',zafid 
+      if (zafid .NE. FAIL) then
+
+         zaid = he5_zaattach(zafid, "ZA1")
+         write(*,*) 'ZA ID  returned by he5_zaattach():  ',zaid 
+         if (zaid .NE. FAIL) then
+            
+!     Define Data fields
+!     ------------------
+            
+            status = he5_zadefine(zaid, "Density", 
+     1           "MyTrack1"," ", HE5T_NATIVE_FLOAT)
+            write(*,*) 'Status returned by he5_zadefine():  ',status 
+
+            status = he5_zadefine(zaid, "Temperature",
+     1           "MyTrack2,MyTrack1",
+     2           " ", HE5T_NATIVE_FLOAT)	      
+            write(*,*) 'Status returned by he5_zadefine():  ',status 
+	      
+            status = he5_zadefine(zaid, "Pressure", 
+     1           "Res2xtr,Res2tr",
+     2           " ", HE5T_NATIVE_FLOAT)
+            write(*,*) 'Status returned by he5_zadefine():  ',status 
+	      
+                chunkrank = 3
+                chunkdims(1) = 20
+                chunkdims(2) = 40
+                chunkdims(3) = 15
+                compparm(1) = 6
+ 
+            status = he5_zadefchunk(zaid,chunkrank,chunkdims)
+            write(*,*) 'Status returned by he5_zadefchunk(): ',status
+ 
+            status = he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE,compparm)
+            write(*,*) 'Status returned by he5_zadefcomp():  ',status
+
+            status = he5_zadefine(zaid, "Spectra", 
+     1           "Res2xtr,Res2tr,Bands",
+     2           " ", HE5T_NATIVE_DOUBLE)	      
+            write(*,*) 'Status returned by he5_zadefine():  ',status 
+
+
+
+         endif
+      endif
+      
+!     Detach from the za
+!     ------------------      
+      status = he5_zadetach(zaid)
+      write(*,*) 'Status returned by he5_zadetach():  ',status 
+      
+!     Close the file
+!     --------------      
+      status = he5_zaclose(zafid)
+      write(*,*) 'Status returned by he5_zaclose():  ',status 
+
+      stop
+      end
+
+
+
+
+
diff --git a/samples/he5_za_definefieldsF_64.f b/samples/he5_za_definefieldsF_64.f
new file mode 100755
index 0000000..36898a5
--- /dev/null
+++ b/samples/he5_za_definefieldsF_64.f
@@ -0,0 +1,89 @@
+!	In this program we (1) open the "za.he5" HDF-EOS file, 
+!	(2) attach to the "ZA1" za, and (3) define the za fields
+!       ========================================================
+
+      program     he5_za_definefieldsF_64
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     he5_zaopen
+      integer     he5_zaattach
+      integer     he5_zadefine
+      integer     he5_zadefchunk
+      integer     he5_zadefcomp
+      integer     he5_zadetach
+      integer     he5_zaclose
+      integer     zafid, zaid
+
+      integer     chunkrank
+      integer*8   chunkdims(3)
+      integer     compparm(1)
+
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+!     Open the HDF-EOS file, "za.he5" using "READ/WRITE" access code
+!     --------------------------------------------------------------
+      zafid = he5_zaopen("za.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_zaopen():  ',zafid 
+      if (zafid .NE. FAIL) then
+         
+         zaid = he5_zaattach(zafid, "ZA1")
+         write(*,*) 'ZA ID  returned by he5_zaattach():  ',zaid 
+         if (zaid .NE. FAIL) then
+            
+!     Define Data fields
+!     ------------------
+
+            status = he5_zadefine(zaid,"Density","MyTrack1",
+     1           " ",HE5T_NATIVE_FLOAT)
+            write(*,*) 'Status returned by he5_zadefine():  ',status 
+
+            status = he5_zadefine(zaid,"Temperature", 
+     1           "MyTrack2,MyTrack1"," ",HE5T_NATIVE_FLOAT)
+            write(*,*) 'Status returned by he5_zadefine():  ',status 	      
+	      
+            status = he5_zadefine(zaid,"Pressure","Res2xtr,Res2tr",
+     1           " ", HE5T_NATIVE_FLOAT)
+            write(*,*) 'Status returned by he5_zadefine():  ',status 
+	      
+                chunkrank = 3
+                chunkdims(1) = 20
+                chunkdims(2) = 40
+                chunkdims(3) = 15
+                compparm(1) = 6
+ 
+            status = he5_zadefchunk(zaid,chunkrank,chunkdims)
+            write(*,*) 'Status returned by he5_zadefchunk(): ',status
+ 
+            status = he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE,compparm)
+            write(*,*) 'Status returned by he5_zadefcomp():  ',status
+
+            status = he5_zadefine(zaid, "Spectra", 
+     1           "Res2xtr,Res2tr,Bands"," ",
+     2           HE5T_NATIVE_DOUBLE)	      
+            write(*,*) 'Status returned by he5_zadefine():  ',status 
+            
+
+         endif
+      endif
+      
+!     Detach from the za
+!     ------------------      
+      status = he5_zadetach(zaid)
+      write(*,*) 'Status returned by he5_zadetach():  ',status 
+      
+!     Close the file
+!     --------------      
+      status = he5_zaclose(zafid)
+      write(*,*) 'Status returned by he5_zaclose():  ',status 
+      
+      stop
+      end
+
+
+
+
diff --git a/samples/he5_za_info.c b/samples/he5_za_info.c
new file mode 100755
index 0000000..cd83e29
--- /dev/null
+++ b/samples/he5_za_info.c
@@ -0,0 +1,162 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+
+#include      <HE5_HdfEosDef.h>
+
+/* ------------------------------------------------------------------- */
+/*  In this program we retrieve information about (1) dimensions, (2)  */
+/*  za fields, and (3) the global/group/local attributes               */
+/* ------------------------------------------------------------------- */
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  int             i, *rank, chunk_rank;
+
+  hid_t           zafid = FAIL, ZAid = FAIL;
+
+  hid_t           ntype[10];
+  hid_t           dtype = FAIL;
+
+  long            ndims, strbufsize, nflds, nattr;
+
+  hsize_t         dimsize;
+  hsize_t         *dims, chunk_dim[8];
+  hsize_t         n, nelem = 0;
+    
+  char            version[80] = {0};
+  char            *dimname, *fieldlist; 
+  char            attrlist[80];
+
+  /* Open the ZA HDF-EOS File "ZA.he5" for reading only */
+  /* ------------------------------------------------- */
+  zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDONLY);
+  if (zafid != FAIL)
+    {
+	  HE5_EHgetversion(zafid, version);
+	  printf("HDF-EOS library version: \"%s\" \n", version);
+	
+	  /* Attach the ZA "ZA1" */
+	  /* ------------------- */
+	  ZAid = HE5_ZAattach(zafid, "ZA1");
+	  if (ZAid != FAIL)
+		{
+		  /* Inquire Dimensions */
+		  /* ------------------ */
+		  ndims = HE5_ZAnentries(ZAid, HE5_HDFE_NENTDIM, &strbufsize);
+		  dims = (hsize_t *) calloc(ndims, sizeof(hsize_t));
+		  dimname = (char *) calloc(strbufsize + 1, 1);
+	    
+		  ndims = HE5_ZAinqdims(ZAid, dimname, dims);
+
+		  printf("Dimension list: %s\n", dimname);
+		  for (i = 0; i < ndims; i++)
+			printf("dim size: %li \n", (long)dims[i]);
+	    
+		  free(dims);
+		  free(dimname);
+
+
+		  /* Inquire Data Fields */
+		  /* ------------------- */
+		  nflds = HE5_ZAnentries(ZAid, HE5_HDFE_NENTDFLD, &strbufsize);
+		  rank = (int *) calloc(nflds, sizeof(int));
+		  fieldlist = (char *) calloc(strbufsize + 1, 1);
+		  nflds = HE5_ZAinquire(ZAid, fieldlist, rank, ntype);
+
+		  printf("data fields: %s\n", fieldlist);
+		  for (i = 0; i < nflds; i++)
+			printf("Rank:  %d   Data type:  %d\n", rank[i], ntype[i]);
+
+		  free(rank);
+		  free(fieldlist);
+
+
+		  /* Get info on "MyTrack1" dim */
+		  /* -------------------------- */
+		  dimsize = HE5_ZAdiminfo(ZAid, "MyTrack1");
+		  printf("Size of MyTrack1: %lu\n", (unsigned long)dimsize);
+
+
+                  dtype = FAIL;
+		  /* Get info about Global Attributes */
+		  /* -------------------------------- */
+		  printf("Global Attribute:\n");
+		  status = HE5_ZAattrinfo(ZAid,"GlobalAttribute",&dtype, &nelem);
+		  printf("\t\t Data type:          %d\n", dtype);
+		  printf("\t\t Number of elements: %lu \n", (unsigned long)nelem);    
+
+		  nelem = 0;
+                  dtype = FAIL;
+		  /* Get info about Group Attributes */
+		  /* ------------------------------- */
+		  printf("Group Attribute:\n");
+		  status = HE5_ZAgrpattrinfo(ZAid,"GroupAttribute",&dtype,&nelem);
+		  printf("\t\t Data type:          %d\n", dtype);
+		  printf("\t\t Number of elements: %lu \n", (unsigned long)nelem);    
+
+		  nelem = 777;
+                  dtype = FAIL;
+		  /* Get info about Local Attributes */
+		  /* ------------------------------- */
+		  printf("Local Attribute:\n");
+		  status = HE5_ZAlocattrinfo(ZAid,"Density", "LocalAttribute",&dtype,&nelem);
+		  printf("\t\t Data type:          %d\n", dtype);
+		  printf("\t\t Number of elements: %lu \n", (unsigned long)nelem);    
+
+
+		  /* Inquire Global Attributes */
+		  /* ------------------------- */
+		  printf("Global Attributes:\n");
+		  nattr = HE5_ZAinqattrs(ZAid, NULL, &strbufsize);
+		  printf("\t\t Number of attributes:             %li \n", nattr);
+		  printf("\t\t String length of attribute list:  %li \n", strbufsize);
+		  n = HE5_ZAinqattrs(ZAid, attrlist, &strbufsize);
+		  printf("\t\t Attribute list:                   %s \n", attrlist);
+           
+		  /* Inquire Group Attributes */
+		  /* ------------------------ */
+		  strbufsize = 0;
+		  printf("\n");
+		  printf("Group Attributes:\n");
+		  nattr = HE5_ZAinqgrpattrs(ZAid, NULL, &strbufsize);
+		  printf("\t\t Number of attributes:             %li \n", nattr);
+		  printf("\t\t String length of attribute list:  %li \n", strbufsize);
+		  strcpy(attrlist,"");
+		  nattr = HE5_ZAinqgrpattrs(ZAid, attrlist, &strbufsize);
+		  printf("\t\t Attribute list:                   %s \n", attrlist);
+
+		  /* Inquire Local Attributes */
+		  /* ------------------------ */
+		  strbufsize = 0;
+		  printf("\n");
+		  printf("Local Attributes:\n");
+		  nattr = HE5_ZAinqlocattrs(ZAid, "Density", NULL, &strbufsize);
+		  printf("\t\t Number of attributes:             %li \n", nattr);
+		  printf("\t\t String length of attribute list:  %li \n", strbufsize);
+		  strcpy(attrlist,"");
+		  nattr = HE5_ZAinqlocattrs(ZAid, "Density", attrlist, &strbufsize);
+		  printf("\t\t Attribute list:                   %s \n", attrlist);
+
+                  status = HE5_ZAchunkinfo(ZAid,"Spectra",&chunk_rank,chunk_dim);
+                  printf("\n");
+                  printf("\t\t Spectra chunk_rank: %d\n", chunk_rank);
+                  for (i = 0; i < chunk_rank; i++)
+                        printf("\t\t Spectra chunk_dim dimension %d: %lu\n",i+1, (unsigned long)chunk_dim[i]);
+
+	    
+		}
+    }
+
+  status = HE5_ZAdetach(ZAid);
+  status = HE5_ZAclose(zafid);
+
+  return 0;
+}
+
diff --git a/samples/he5_za_infoF_32.f b/samples/he5_za_infoF_32.f
new file mode 100755
index 0000000..98871e2
--- /dev/null
+++ b/samples/he5_za_infoF_32.f
@@ -0,0 +1,124 @@
+!	  In this program we retrieve (1) information about the
+!	  dimensions, (2) the za fields 
+
+          program         he5_za_infoF_32
+
+          implicit        none
+
+          include         'hdfeos5.inc'
+
+	  integer         i
+          integer         status
+	  integer         zafid, zaid
+	  integer         he5_zaopen
+	  integer         he5_zaattach
+	  integer         he5_zainfo
+          integer         he5_zachunkinfo
+	  integer         he5_zadetach	  
+	  integer         he5_zaclose
+	  integer         rank(32)
+	  integer         ntype(32)
+	  integer         rk
+	  integer         nt
+
+	  integer*4       he5_zainqdims
+          integer*4       he5_zainquire
+          integer*4	  he5_zadiminfo
+	  integer*4       ndims
+	  integer*4       nflds
+	  integer*4       dims(32)
+	  integer*4       dimsize
+
+	  character*72    dimname
+          character*72    dimlist
+          character*72    maxdimlst
+          character*72    fieldlist
+
+          integer         chunkrank
+          integer*4       chunkdims(32)
+
+	  integer         FAIL
+	  parameter       (FAIL=-1)
+
+      
+!     Open the "za.he5" file for "read only" access
+!     ---------------------------------------------
+	  zafid = he5_zaopen("za.he5", HE5F_ACC_RDONLY)
+      write(*,*) 'File ID returned by he5_zaopen():  ',zafid
+
+	  if (zafid .NE. FAIL) then
+	   
+!     Attach the za
+!     -------------
+		 zaid = he5_zaattach(zafid, "ZA1")
+         write(*,*) 'ZA ID returned by he5_zaattach():  ',zaid
+
+		 if (zaid .NE. FAIL) then
+		
+!     Inquire Dimensions
+!     ------------------			
+			ndims = he5_zainqdims(zaid, dimname, dims)
+			write(*,*) 'Dimension list: ', dimname
+			do i = 1,ndims
+			   write(*,*) 'dim size: ', dims(i)
+			enddo
+			write(*,*)	      
+						
+!     Inquire Data Fields	      
+!     -------------------			
+			nflds = he5_zainquire(zaid, fieldlist, rank, ntype)
+			write(*,*) 'Data Fieldlist: ', fieldlist
+			do i=1,nflds
+			   write(*,*) 'field rank & datatype: ',rank(i),ntype(i)
+			enddo
+			write(*,*) 
+			
+!	  Get info on "MyTrack1" dim
+!         --------------------------			
+	      dimsize = he5_zadiminfo(zaid, "MyTrack1")
+	      write(*,*) 'Size of MyTrack1: ', dimsize
+	      write(*,*)
+	      
+
+!	  Get info on "Spectra" Field
+!         ---------------------------		  
+	      status = he5_zainfo(zaid,"Spectra",rk,dims,nt,
+     1         dimlist,maxdimlst)
+	      write(*,*) 'Spectra Rank: ', rk
+	      write(*,*) 'Spectra NumberType: ', nt
+	      write(*,*) 'Spectra Dimlist: ', dimlist
+	      write(*,*) 'Spectra Max Dimlist: ', maxdimlst
+	      do i=1,rk
+			 write(*,*) 'Dimension ',i,dims(i)
+	      enddo
+
+              status = he5_zachunkinfo(zaid,"Spectra",chunkrank,
+     1         chunkdims)
+              write(*,*) 'Spectra Chunking Rank: ', chunkrank
+              do i=1,chunkrank
+                         write(*,*) 'Chunking Dimension ',i,chunkdims(i)
+              enddo
+		  
+	   endif
+	  endif
+	  
+!     Detach from the za
+!     ------------------
+	  status = he5_zadetach(zaid)
+      write(*,*) 'Status returned by he5_zadetach():  ',status
+
+!     Close the file
+!     --------------
+	  status = he5_zaclose(zafid)
+      write(*,*) 'Status returned by he5_zaclose():  ',status
+
+	  stop
+	  end
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_infoF_64.f b/samples/he5_za_infoF_64.f
new file mode 100755
index 0000000..8d06040
--- /dev/null
+++ b/samples/he5_za_infoF_64.f
@@ -0,0 +1,123 @@
+!	In this program we retrieve (1) information about the
+!	dimensions, (2) the za fields 
+
+          program         he5_za_infoF_64
+
+          implicit        none
+
+          include         'hdfeos5.inc'
+
+	  integer         i
+          integer         status
+	  integer         zafid, zaid
+	  integer         he5_zaopen
+	  integer         he5_zaattach
+	  integer         he5_zainfo
+          integer         he5_zachunkinfo
+	  integer         he5_zadetach	  
+	  integer         he5_zaclose
+	  integer         rank(32)
+	  integer         ntype(32)
+	  integer         rk
+          integer         nt
+
+	  integer*8       he5_zainqdims
+          integer*8       he5_zainquire
+	  integer*8       he5_zadiminfo
+	  integer*8       ndims
+	  integer*8       nflds
+	  integer*8       dims(32)
+	  integer*8       dimsize
+
+	  character*72    dimname
+          character*72    dimlist
+          character*72    maxdimlst
+          character*72    fieldlist
+
+          integer         chunkrank
+          integer*8       chunkdims(32)
+	  
+	  integer         FAIL
+	  parameter       (FAIL=-1)
+
+!     Open the "za.he5" file for "read only" access
+!     ---------------------------------------------
+	  zafid = he5_zaopen("za.he5",HE5F_ACC_RDONLY)
+      write(*,*) 'File ID returned by he5_zaopen():  ',zafid
+
+	  if (zafid .NE. FAIL) then
+	   
+!     Attach the za
+!     -------------
+		 zaid = he5_zaattach(zafid, "ZA1")
+         write(*,*) 'ZA ID returned by he5_zaattach():  ',zaid
+
+		 if (zaid .NE. FAIL) then
+		
+!     Inquire Dimensions
+!     ------------------			
+			ndims = he5_zainqdims(zaid, dimname, dims)
+			write(*,*) 'Dimension list: ', dimname
+			do i = 1,ndims
+			   write(*,*) 'dim size: ', dims(i)
+			enddo
+			write(*,*)	      
+            
+!     Inquire Data Fields	      
+!     -------------------			
+			nflds = he5_zainquire(zaid, fieldlist, rank, ntype)
+			write(*,*) 'Data Fieldlist: ', fieldlist
+			do i=1,nflds
+			   write(*,*) 'field rank & datatype: ',rank(i),ntype(i)
+			enddo
+			write(*,*) 
+			
+!	  Get info on "MyTrack1" dim
+!         --------------------------			
+	      dimsize = he5_zadiminfo(zaid, "MyTrack1")
+	      write(*,*) 'Size of MyTrack1: ', dimsize
+	      write(*,*)
+	      
+
+!	  Get info on "Spectra" Field
+!         ---------------------------		  
+	      status = he5_zainfo(zaid,"Spectra",rk,dims,nt,
+     1         dimlist,maxdimlst)
+	      write(*,*) 'Spectra Rank: ', rk
+	      write(*,*) 'Spectra NumberType: ', nt
+	      write(*,*) 'Spectra Dimlist: ', dimlist
+	      write(*,*) 'Spectra Max Dimlist: ', maxdimlst
+	      do i=1,rk
+			 write(*,*) 'Dimension ',i,dims(i)
+	      enddo
+
+              status = he5_zachunkinfo(zaid,"Spectra",chunkrank,
+     1         chunkdims)
+              write(*,*) 'Spectra Chunking Rank: ', chunkrank
+              do i=1,chunkrank
+                         write(*,*) 'Chunking Dimension ',i,chunkdims(i)
+              enddo
+		  
+	   endif
+	  endif
+	  
+!     Detach from the za
+!     ------------------
+	  status = he5_zadetach(zaid)
+      write(*,*) 'Status returned by he5_zadetach():  ',status
+
+!     Close the file
+!     --------------
+	  status = he5_zaclose(zafid)
+      write(*,*) 'Status returned by he5_zaclose():  ',status
+
+	  stop
+	  end
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_rdexternaldata.c b/samples/he5_za_rdexternaldata.c
new file mode 100755
index 0000000..2c77761
--- /dev/null
+++ b/samples/he5_za_rdexternaldata.c
@@ -0,0 +1,140 @@
+/*
+ ---------------------------------------------------------------------------- 
+ |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+
+#include    <HE5_HdfEosDef.h>
+
+#define  DIMIN    100
+#define  DIMOUT   60
+
+int main()
+{
+  FILE            *in_1, *in_2, *in_3;
+
+  herr_t          status = FAIL;
+
+  int             i;
+  int             data_in_1[DIMIN];
+  int             data_in_2[DIMIN];
+  int             data_in_3[DIMIN];
+  int             data_out[DIMOUT];
+  int             nfiles = FAIL;
+
+  hid_t           zafid  = FAIL;
+  hid_t           ZAid   = FAIL;
+
+  size_t          namelength = 48;
+ 
+  off_t           offset[3];
+
+  char            filelist[256];
+
+  hssize_t        start[2];
+
+  hsize_t         count[2];
+  hsize_t         size[3];
+
+
+
+  /* Create the external data sets */
+  /* ----------------------------- */
+  for (i = 0; i < DIMIN; i++)
+	{
+	  data_in_1[i] = 1000 + i + 1;
+	  data_in_2[i] = 2000 + i + 1;
+	  data_in_3[i] = 3000 + i + 1;
+	}
+
+  /* Open the external data files */
+  /* ---------------------------- */
+  in_1 = fopen("external_1.data", "w");
+  in_2 = fopen("external_2.data", "w");
+  in_3 = fopen("external_3.data", "w");
+
+
+  /* Write data buffers to the external data files */
+  /* --------------------------------------------- */
+  fwrite(data_in_1, sizeof(int), DIMIN, in_1);
+  fwrite(data_in_2, sizeof(int), DIMIN, in_2);
+  fwrite(data_in_3, sizeof(int), DIMIN, in_3);
+
+  /* Close the external data files */
+  /* ----------------------------- */
+  fclose(in_1);
+  fclose(in_2);
+  fclose(in_3);
+  
+
+
+  /* Open the HDF-EOS za file, "ZA.he5" */
+  /* --------------------------------- */
+  zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDWR);
+  if (zafid != FAIL)
+	{
+	  /* Attach the "ZA1" za */
+	  /* ------------------- */
+	  ZAid = HE5_ZAattach(zafid, "ZA1");
+	  if (ZAid != FAIL)
+		{
+		  /* Read the external data field */
+		  /* ---------------------------- */
+		  start[0] = 0;
+		  count[0] = DIMOUT;
+		  status = HE5_ZAread(ZAid, "ExtData", start, NULL, count, data_out);
+		  printf("Status returned by HE5_ZAread() :    %d \n", status);
+	    
+		  /* Display external data set */
+		  /* ------------------------- */
+		  printf(" \n");
+		  for (i = 0; i < DIMOUT; i++)
+			printf("%d ", data_out[i]);
+		  
+		  /* Get the number of external files */
+		  /* -------------------------------- */
+		  nfiles = HE5_ZAgetextdata(ZAid, "ExtData", namelength, filelist, offset, size);
+		  printf(" \n");
+		  printf(" \n");
+		  printf("Number of external files returned by HE5_ZAgetextdata() :     %d \n", nfiles);
+		  if (nfiles > 0)
+			{
+			  printf(" \n");
+			  printf("External files: \"%s\"  \n", filelist);
+			  printf(" \n");
+			  printf("offsets:  ");
+			  for (i = 0; i < nfiles; i++)
+				printf("%d ", (int)offset[i]);
+
+			  printf(" \n");
+			  printf("sizes:    ");
+			  for (i = 0; i < nfiles; i++)
+				printf("%lu ", (unsigned long)size[i]);
+			  printf(" \n");
+			  printf(" \n");
+			}
+		}
+	}
+  
+  /* Detach from the za */
+  /* ------------------ */
+  status = HE5_ZAdetach(ZAid);
+  printf("Status returned by HE5_ZAdetach() :       %d \n", status);
+  
+  /* Close the file */
+  /* -------------- */
+  status = HE5_ZAclose(zafid);
+  printf("Status returned by HE5_ZAclose() :        %d \n", status);
+
+  return 0;
+}
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_rdexternaldataF_32.f b/samples/he5_za_rdexternaldataF_32.f
new file mode 100755
index 0000000..0751746
--- /dev/null
+++ b/samples/he5_za_rdexternaldataF_32.f
@@ -0,0 +1,148 @@
+!
+! ----------------------------------------------------------------------------
+! |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |
+! ----------------------------------------------------------------------------
+!
+
+      program            he5_za_rdexternaldataF_32
+
+      implicit           none
+
+      include            'hdfeos5.inc'
+
+      integer            i
+      integer            status
+      integer            he5_zaopen
+      integer            he5_zaattach
+      integer            he5_zaread
+      integer            he5_zagetxdat
+      integer            he5_ehrdwrfile
+      integer            he5_zadetach
+      integer            he5_zaclose
+      integer            zafid, zaid
+      integer            nfiles
+      integer            datain1(100)
+      integer            datain2(100)
+      integer            datain3(100)
+      integer            dataout(60)
+
+      integer*4          start(2)
+      integer*4          stride(2)
+      integer*4          count(2)
+      integer*4          offset(3)
+      integer*4          size(3)
+      integer*4          nmlgth
+      integer*4          num_elements
+
+      character          filelist*256
+
+      integer            FAIL
+      parameter          (FAIL=-1)
+
+!.....Use this for writing (only) to an existing file
+      integer            WRITE_EXISTING_ONLY
+      parameter          (WRITE_EXISTING_ONLY=0)
+
+!.....Use this for reading (only) from an existing file
+      integer            READ_ONLY
+      parameter          (READ_ONLY=1)
+
+!.....Use this for creating and writing to a file
+      integer            WRITE_NEW
+      parameter          (WRITE_NEW=2)
+
+
+
+!     Create the external data sets
+!     -----------------------------
+      do 10 i=1,100
+
+         datain1(i) = 1000+i
+         datain2(i) = 2000+i
+         datain3(i) = 3000+i        
+         
+ 10   continue
+
+      num_elements = 100
+      
+      status = he5_ehrdwrfile("extf1.dat",WRITE_NEW,
+     1HE5T_NATIVE_INT,num_elements,datain1)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf2.dat",WRITE_NEW,
+     1HE5T_NATIVE_INT,num_elements,datain2)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf3.dat",WRITE_NEW,
+     1HE5T_NATIVE_INT,num_elements,datain3)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+!     Open HDF-EOS za file, "za.he5"
+!     ------------------------------
+	  zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned from he5_zaopen():  ',zafid
+
+	  if (zafid .NE. FAIL) then
+		 zaid = he5_zaattach(zafid, "ZA1")
+         write(*,*) 'ZA ID returned from he5_zaattach():  ',zaid
+
+		 if (zaid .NE. FAIL) then
+			
+!     Read the external data field 
+!     ----------------------------
+      start(1)  = 0
+      stride(1) = 1
+      count(1)  = 60
+
+      status = he5_zaread(zaid,"ExtData",
+     1     start,stride,count,dataout)
+      write(*,*) 'Status returned from he5_zaread():  ',status
+
+
+!     Display the data
+!     ----------------
+      do i=1,60
+         write(*,*)'External data',dataout(i)
+      enddo
+
+      nmlgth = 48
+
+!     Get the number of external files
+!     --------------------------------     
+      nfiles = he5_zagetxdat(zaid,"ExtData",nmlgth,
+     1     filelist,offset,size)
+
+      write(*,*) 'Number of external files',nfiles
+      write(*,*) 'External files:',filelist
+      do i=1,nfiles
+         write(*,*) 'offsets:',offset(i)
+         write(*,*) 'sizes:',size(i)
+      enddo
+
+		 endif
+	  endif
+	
+!     Detach from za
+!     --------------
+	  status = he5_zadetach(zaid)
+      write(*,*) 'Status returned from he5_zadetach():  ',status
+
+!     Close the file
+!     --------------
+	  status = he5_zaclose(zafid)
+      write(*,*) 'Status returned from he5_zaclose():  ',status
+      
+	  stop
+	  end
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_rdexternaldataF_64.f b/samples/he5_za_rdexternaldataF_64.f
new file mode 100755
index 0000000..fac790d
--- /dev/null
+++ b/samples/he5_za_rdexternaldataF_64.f
@@ -0,0 +1,142 @@
+!
+! ----------------------------------------------------------------------------
+! |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |
+! ----------------------------------------------------------------------------
+!
+
+      program            he5_za_rdexternaldataF_64
+
+      implicit           none
+ 
+      include            'hdfeos5.inc'
+
+      integer            i
+      integer            status
+      integer            he5_zaopen
+      integer            he5_zaattach
+      integer            he5_zaread
+      integer            he5_zagetxdat
+      integer            he5_ehrdwrfile
+      integer            he5_zadetach
+      integer            he5_zaclose
+      integer            zafid, zaid
+      integer            nfiles
+      integer            datain1(100)
+      integer            datain2(100)
+      integer            datain3(100)
+      integer            dataout(60)
+
+      integer*8          start(2)
+      integer*8          stride(2)
+      integer*8          count(2)
+      integer*8          offset(3)
+      integer*8          size(3)
+      integer*8          nmlgth
+      integer*8          num_elements
+
+      character          filelist*256
+
+      integer            FAIL
+      parameter          (FAIL=-1)
+
+!.....Use this for writing (only) to an existing file
+      integer            WRITE_EXISTING_ONLY
+      parameter          (WRITE_EXISTING_ONLY=0)
+
+!.....Use this for reading (only) from an existing file
+      integer            READ_ONLY
+      parameter          (READ_ONLY=1)
+
+!.....Use this for creating and writing to a file
+      integer            WRITE_NEW
+      parameter          (WRITE_NEW=2)
+
+!     Create the external data sets
+!     -----------------------------
+      do 10 i=1,100
+
+         datain1(i) = 1000+i
+         datain2(i) = 2000+i
+         datain3(i) = 3000+i        
+         
+ 10   continue
+
+      num_elements = 100
+      
+      status = he5_ehrdwrfile("extf1.dat",WRITE_NEW,
+     1HE5T_NATIVE_INT,num_elements,datain1)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf2.dat",WRITE_NEW,
+     1HE5T_NATIVE_INT,num_elements,datain2)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf3.dat",WRITE_NEW,
+     1HE5T_NATIVE_INT,num_elements,datain3)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+!     Open HDF-EOS za file, "za.he5"
+!     ------------------------------
+	  zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned from he5_zaopen():  ',zafid
+
+	  if (zafid .NE. FAIL) then
+		 zaid = he5_zaattach(zafid, "ZA1")
+         write(*,*) 'ZA ID returned from he5_zaattach():  ',zaid
+
+		 if (zaid .NE. FAIL) then
+			
+!     Read the external data field 
+!     ----------------------------
+      start(1)  = 0
+      stride(1) = 1
+      count(1)  = 60
+
+      status = he5_zaread(zaid,"ExtData",
+     1     start,stride,count,dataout)
+      write(*,*) 'Status returned from he5_zaread():  ',status
+
+!     Display the data
+!     ----------------
+      do i=1,60
+         write(*,*)'External data',dataout(i)
+      enddo
+
+      nmlgth = 48
+
+!     Get the number of external files
+!     --------------------------------     
+      nfiles = he5_zagetxdat(zaid,"ExtData",nmlgth,
+     1     filelist,offset,size)
+
+      write(*,*) 'Number of external files',nfiles
+      write(*,*) 'External files:',filelist
+      do i=1,nfiles
+         write(*,*) 'offsets:',offset(i)
+         write(*,*) 'sizes:',size(i)
+      enddo
+
+		 endif
+	  endif
+	
+!     Detach from za 
+!     --------------
+	  status = he5_zadetach(zaid)
+      write(*,*) 'Status returned from he5_zadetach():  ',status
+
+!     Close the file
+!     --------------
+	  status = he5_zaclose(zafid)
+      write(*,*) 'Status returned from he5_zaclose():  ',status
+            
+	  stop
+	  end
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_readdata.c b/samples/he5_za_readdata.c
new file mode 100755
index 0000000..347e417
--- /dev/null
+++ b/samples/he5_za_readdata.c
@@ -0,0 +1,142 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+
+
+#include    <HE5_HdfEosDef.h>
+
+/* ------------------------------------------------------------------- */
+/* In this program we (1) open the "ZA.he5" HDF-EOS file, (2) attach to */
+/* the "ZA1" za, and (3) read data from the "Spectra" field. Also, we  */ 
+/* read the global/group/local attributes                              */
+/* ------------------------------------------------------------------- */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  int             i, j, k;
+  int             attr1[4];		/* data buffer for global attribute     */
+  int             attr2[4];		/* ....  for group attribute            */
+  int             attr3[4];		/* ....  for local attribute            */
+
+  hid_t           zafid = FAIL;
+  hid_t           ZAid  = FAIL;
+
+  char            attr4[7] = {0};     /* ...  for global 'char' attribute     */
+
+  long            attr5[4];     /* ...  for global 'long' attribute     */
+
+  double          attr6[4];     /* ... for global 'double' attribute    */
+
+  hssize_t        start[3];
+  hsize_t         count[3];
+
+  double          plane[15][40][20];
+  char            *charname[10] = {0};
+
+
+  /* Populate spectra data array. Value = 100*(track index)+(band index) */
+  /* ------------------------------------------------------------------- */
+  for (i = 0; i < 15; i++)
+        {
+          for (j = 0; j < 40; j++)
+                for (k = 0; k < 20; k++)
+                  plane[i][j][k] = (double)(j*100 + i);
+    }
+
+
+  /* Open the HDF-EOS za file, "ZA.he5" */
+  /* --------------------------------- */
+  zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDONLY);
+  if (zafid != FAIL)
+	{
+	  /* Attach the "ZA1" za */
+	  /* ------------------- */
+	  ZAid = HE5_ZAattach(zafid, "ZA1");
+	  if (ZAid != FAIL)
+		{
+		  /* Read the entire Spectra field */
+		  /* ----------------------------- */
+		  start[0] = 0;    start[1] = 0;   start[2] = 0;
+		  count[0] = 15;   count[1] = 40;  count[2] = 20;
+		  status = HE5_ZAread(ZAid, "Spectra", start, NULL, count, plane);
+		  printf("Status returned by HE5_ZAread() :    %d \n", status);
+
+                  start[0] = 0;
+                  count[0] = 10;
+                  for (i = 0; i < 10; i++)
+                      charname[i] = (char *)malloc(95*sizeof(char));
+                  status = HE5_ZAread(ZAid, "Test_string", start, NULL, count, charname);
+                  printf("Status returned by HE5_ZAread() :    %d \n", status);
+ 
+                  /* Display Test_string data */
+                  /* ---------------------- */
+                  for (i = 0; i < 10; i++)
+                          printf("i = %d        string =  %s\n", i, charname[i]);
+
+                  for (i = 0; i < 10; i++)
+                       free(charname[i]);
+
+		  /* Read Global 'int' Attribute */
+		  /* --------------------------- */
+		  status = HE5_ZAreadattr(ZAid, "GlobalAttribute", attr1);
+		  printf("Status returned by HE5_ZAreadattr() :     %d \n", status);
+		  printf("Global attribute values:\n");
+		  for (i = 0; i < 4; i++)
+			printf("\t\t %d \n",attr1[i]);
+			
+		  /* Read Group Attribute */
+		  /* -------------------- */
+		  status = HE5_ZAreadgrpattr(ZAid, "GroupAttribute", attr2);
+		  printf("Status returned by HE5_ZAreadgrpattr() :  %d \n", status);
+		  printf("Group attribute values:\n");
+		  for (i = 0; i < 4; i++)
+			printf("\t\t %d \n",attr2[i]);
+		  
+		  /* Read Local Attribute */
+		  /* -------------------- */
+		  status = HE5_ZAreadlocattr(ZAid, "Density", "LocalAttribute", attr3);
+		  printf("Status returned by HE5_ZAreadlocattr() :  %d \n", status);
+		  printf("Local attribute values:\n");
+		  for (i = 0; i < 4; i++)
+			printf("\t\t %d \n",attr3[i]);
+
+		  /* Read Global 'char' Attribute */
+		  /* ---------------------------- */
+		  status = HE5_ZAreadattr(ZAid, "GLOBAL_CHAR_ATTR", attr4);
+		  printf("Status returned by HE5_ZAreadattr() :     %d \n", status);
+		  printf("Global attribute values:\n");
+		  printf("\t\t %s \n",attr4);
+
+		  /* Read Global 'long' Attribute */
+		  /* ---------------------------- */
+		  status = HE5_ZAreadattr(ZAid, "GLOBAL_LONG_ATTR", attr5);
+		  printf("Status returned by HE5_ZAreadattr() :     %d \n", status);
+		  printf("Global attribute values:\n");
+		  for (i = 0; i < 4; i++)
+			printf("\t\t %li \n",attr5[i]);
+
+		  /* Read Global 'double' Attribute */
+		  /* ------------------------------ */
+		  status = HE5_ZAreadattr(ZAid, "GLOBAL_DOUBLE_ATTR", attr6);
+		  printf("Status returned by HE5_ZAreadattr() :     %d \n", status);
+		  printf("Global attribute values:\n");
+		  for (i = 0; i < 4; i++)
+			printf("\t\t %f \n",attr6[i]);
+		  
+		}
+	}
+  
+  status = HE5_ZAdetach(ZAid);
+  status = HE5_ZAclose(zafid);
+  
+  return 0;
+}
+
+
diff --git a/samples/he5_za_readdataF_32.f b/samples/he5_za_readdataF_32.f
new file mode 100755
index 0000000..cb09c96
--- /dev/null
+++ b/samples/he5_za_readdataF_32.f
@@ -0,0 +1,105 @@
+!     In this program we (1) open the "za.he5" file, (2) attach to
+!     the "ZA1" za, and (3) read data from the "Spectra" field
+!     ============================================================
+
+      program            he5_za_readdataF_32
+
+      implicit           none
+
+      include            'hdfeos5.inc'
+
+      integer            status
+      integer            he5_zaopen
+      integer            he5_zaattach
+      integer            he5_zaread
+      integer            he5_zardattr
+      integer            he5_zadetach
+      integer            he5_zaclose
+      integer            zafid, zaid
+      integer            i,j,k
+
+      integer*4          attr(4)
+
+      integer*4          start(3)
+      integer*4          stride(3)
+      integer*4          count(3)
+      
+      real*8		 plane(800)
+
+      integer            FAIL
+      parameter          (FAIL=-1)
+      
+!     Open HDF-EOS za file, "za.he5"
+!     ------------------------------
+	  zafid = he5_zaopen("za.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_zaopen():  ',zafid
+
+	  if (zafid .NE. FAIL) then
+		 zaid = he5_zaattach(zafid, "ZA1")
+         write(*,*) 'ZA ID returned by he5_zaattach():  ',zaid
+
+		 if (zaid .NE. FAIL) then
+			
+	      
+!     Read the entire Spectra field
+!     -----------------------------
+                        start(1)  = 0
+                        start(2)  = 0
+                        count(1)  = 20
+                        count(2)  = 40
+                        count(3)  = 1
+			stride(1) = 1
+			stride(2) = 1
+                        stride(3) = 1
+ 
+                        do i=1,15
+                           start(3) = i - 1
+                           do j=1,40
+                                  do k=1,20
+					plane((j-1)*20+k) = (j-1)*100 + i-1
+                                  enddo
+                           enddo
+                           status = he5_zaread(zaid,"Spectra",start,
+     1              stride,count,plane)
+                        enddo
+
+
+!     Read Attribute
+!     --------------	      
+			status = he5_zardattr(zaid, "TestAttr", attr)
+			do i=1,4
+			   write(*,*) 'Attribute Element', i, ':', attr(i)
+			enddo	      
+			
+		 endif
+	  endif
+      
+!    Detach from the za
+!    ------------------
+	  status = he5_zadetach(zaid)
+      write(*,*) 'Status returned from he5_zadetach:  ',status
+
+!     Close the file
+!     --------------
+	  status = he5_zaclose(zafid)
+      write(*,*) 'Status returned from he5_zaclose:  ',status
+
+	  stop
+	  end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_readdataF_64.f b/samples/he5_za_readdataF_64.f
new file mode 100755
index 0000000..227df7c
--- /dev/null
+++ b/samples/he5_za_readdataF_64.f
@@ -0,0 +1,99 @@
+!     In this program we (1) open the "za.he5" file, (2) attach to
+!     the "ZA1" za, and (3) read data from the "Spectra" field
+!     ============================================================
+
+      program            he5_za_readdataF_64
+
+      implicit           none
+
+      include            'hdfeos5.inc'
+
+      integer            status
+      integer            he5_zaopen
+      integer            he5_zaattach
+      integer            he5_zaread
+      integer            he5_zardattr
+      integer            he5_zadetach
+      integer            he5_zaclose
+      integer            zafid, zaid
+      integer            i,j,k
+
+      integer*4          attr(4)
+
+      integer*8          start(3)
+      integer*8          stride(3)
+      integer*8          count(3)
+
+      real*8             plane(800)
+
+      integer            FAIL
+      parameter          (FAIL=-1)
+
+    
+!     Open HDF-EOS za file, "za.he5"
+!     ------------------------------
+	  zafid = he5_zaopen("za.he5",HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_zaopen():  ',zafid
+
+	  if (zafid .NE. FAIL) then
+		 zaid = he5_zaattach(zafid, "ZA1")
+         write(*,*) 'ZA ID returned by he5_zaattach():  ',zaid
+
+		 if (zaid .NE. FAIL) then
+			
+	      
+!     Read the entire Spectra field
+!     -----------------------------
+                        start(1)  = 0
+                        start(2)  = 0
+                        count(1)  = 20
+                        count(2)  = 40
+                        count(3)  = 1
+                        stride(1) = 1
+                        stride(2) = 1
+                        stride(3) = 1
+ 
+                        do i=1,15
+                           start(3) = i - 1
+                           do j=1,40
+                                  do k=1,20
+					plane((j-1)*20+k) = (j-1)*100 + i-1
+                                  enddo
+                           enddo
+                           status = he5_zaread(zaid,"Spectra",start,
+     1              stride,count,plane)
+                        enddo
+ 
+
+            
+!     Read Attribute
+!     --------------	      
+			status = he5_zardattr(zaid, "TestAttr", attr)
+			do i=1,4
+			   write(*,*) 'Attribute Element', i, ':', attr(i)
+			enddo	      
+			
+		 endif
+	  endif
+      
+!     Detach from the za
+!     ------------------
+	  status = he5_zadetach(zaid)
+      write(*,*) 'Status returned from he5_zadetach:  ',status
+      
+!     Close the file
+!     --------------
+	  status = he5_zaclose(zafid)
+      write(*,*) 'Status returned from he5_zaclose:  ',status
+      
+	  stop
+	  end
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_readdimscale.c b/samples/he5_za_readdimscale.c
new file mode 100755
index 0000000..f251893
--- /dev/null
+++ b/samples/he5_za_readdimscale.c
@@ -0,0 +1,187 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Raytheon Systems Company                         |
+ ----------------------------------------------------------------------------
+ */
+
+#include     <HE5_HdfEosDef.h>
+
+/*
+ * In this example we will open an HDF-EOS file and attach to a
+ * ZA structures within the file to read a dimension scales
+ * and its attributes
+ */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+  hid_t           zafid = FAIL;
+  hid_t           zaid1 = FAIL;
+  int             i,j;
+  int             bufsize;
+  int            *databuff;
+  long            nattr;
+  long            strbufsize;
+  char           *attrlist;
+  size_t          fldnmlen[HE5_HDFE_NAMBUFSIZE];
+  char           *fldnm[HE5_HDFE_NAMBUFSIZE];
+  char           *attrname = (char *)NULL;
+  hid_t          *ntype;
+  hsize_t         count = 0;
+  void           *attr;
+  int            *attr_int;
+  float          *attr_flt;
+  char           *attr_char;
+  hsize_t         dimsize;
+  hid_t           numtype;
+
+  /*
+   * Open the HDF ZA file, "Za.h5".
+   */
+
+  zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDWR);
+ 
+  /*
+   * If the ZA file cannot be found, HE5_ZAopen will return -1 for the file
+   * handle (zafid).  We there check that this is not the case before
+   * proceeding with the other routines.
+   * 
+   * The HE5_ZAattach routine returns the handle to the existing ZA "Za1",
+   * zaid.  If the ZA is not found, HE5_ZAattach returns -1 for the handle.
+   */ 
+
+  if (zafid != FAIL)
+    {	  
+      zaid1 = HE5_ZAattach(zafid, "ZA1");
+
+      /* the field Spectra has Bands dimensions. 
+	 Bands dim is set to 15
+      */
+
+      if (zaid1 == FAIL)
+	{
+	  printf("\t\tError: Cannot attach to ZA \"ZA1\"\n");
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+
+      bufsize = HE5_ZAgetdimscale(zaid1, "Spectra", "Bands", &dimsize, &numtype, NULL);
+      if (bufsize == -1)
+	{
+	  printf("\t\tError: Cannot get Dimension Scale size for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+      else
+	{
+	  printf ("bufsize = %d \n",(int)bufsize);
+	  printf ("dimsize = %d \n",(int)dimsize);
+	  printf ("numtype = %d\n", (int)numtype);
+	}
+      databuff = (int *) malloc(bufsize);
+      bufsize = HE5_ZAgetdimscale(zaid1, "Spectra", "Bands", &dimsize, &numtype, (void *)databuff);
+
+      if (bufsize == -1)
+	{
+	  printf("\t\tError: Cannot get Dimension Scale for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  free(databuff);
+	  return -1;
+	}
+      else
+	{
+	  printf ("First 10 values are:\n");
+	  for( i = 0; i < 10; i++)
+	    {
+	      printf ("DimscaleValue[%d] = %d\n",i,databuff[i]);
+	    }
+	}
+
+      nattr = HE5_ZAinqdscaleattrs(zaid1, "Bands", NULL, &strbufsize);
+      if ( nattr < 0 )
+	{
+	  printf("\t\tError: Cannot get Dimension Scale attribute list for \"Bands\"\n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  free(attrlist);
+	  return -1;
+	}
+
+      attrlist = (char *) calloc(strbufsize + 2, sizeof(char));
+      nattr = HE5_ZAinqdscaleattrs(zaid1, "Bands", attrlist, &strbufsize);
+      if ( nattr < 0 )
+	{
+	  printf("\t\tError: Cannot get Dimension Scale attribute list for \"Bands\"\n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  free(attrlist);
+	  return -1;
+	}
+	  printf(" \n");
+	  printf("Dimension scale for \"Bands\" Attribute: \n");
+      nattr = HE5_EHparsestr(attrlist, ',', fldnm, fldnmlen);
+      if(nattr != FAIL)
+	{
+	  for( i = 0; i < nattr; i++)
+	    {
+	      attrname = (char *)calloc(fldnmlen[i] + 1, sizeof(char));
+	      memmove(attrname,fldnm[i],fldnmlen[i]);
+	      ntype = (hid_t *)calloc(1, sizeof(hid_t));
+	      if(strcmp(attrname, "REFERENCE_LIST") ==0 ) continue;
+	      status = HE5_ZAdscaleattrinfo(zaid1,"Bands", attrname, ntype, &count);
+	      if( (int)*ntype == 0) {
+		attr_int = (int *)malloc(count*sizeof(int));
+		attr = (void *) attr_int;
+	      }
+
+	      if( (int)*ntype == 10) {
+		attr_flt = (float *)malloc(count*sizeof(float));
+		attr = (void *) attr_flt;
+	      }
+
+	      if( (int)*ntype == 57) {
+		attr_char = (char *)malloc((count+1)*sizeof(char));
+		attr = (void *) attr_char;
+	      }
+	      status = HE5_ZAreaddscaleattr(zaid1,"Bands", attrname, attr);
+	      printf("\n");
+	      printf("Status returned by HE5_ZAreaddscaleattr() :  %d \n", status );
+	      printf("\tAttribute Name:               %s  \n",attrname);
+	      printf("\tNumber of attribute elements: %lu \n", (unsigned long)count);
+	      printf("\tData type of attribute:       %d \n", (int)*ntype);
+
+	      if( (int)*ntype == 0) {
+		attr_int = (int *)attr;
+		for (j = 0; j < count; j++)
+		  {
+		    printf("\tAttrvalue[%d]:                 %d \n", j,attr_int[j]);
+		  }
+	      }
+
+	      if( (int)*ntype == 10) {
+		attr_flt = (float *)attr;
+		for (j = 0; j < count; j++)
+		  {
+		    printf("\tAttrvalue[%d]:                 %f \n", j,attr_flt[j]);
+		  }
+	      }
+
+	      if( (int)*ntype == 57) {
+		attr_char = (char *)attr;
+		attr_char[count]='\0';
+		printf("\tAttrvalue:                    %s \n", attr_char);
+		free(attr_char);
+	      }
+	    }
+	}
+
+      HE5_ZAdetach(zaid1);
+
+      HE5_ZAclose(zafid);
+      
+      return 0;
+    }
+}
diff --git a/samples/he5_za_readdimscaleF_32.f b/samples/he5_za_readdimscaleF_32.f
new file mode 100755
index 0000000..6fa0ae5
--- /dev/null
+++ b/samples/he5_za_readdimscaleF_32.f
@@ -0,0 +1,180 @@
+      program     he5_za_readdimscaleF_32
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     i, j, jj
+      integer     he5_zaopen
+      integer     he5_zaattach
+      integer     he5_zawrfld
+      integer     he5_zawrattr
+      integer     he5_zawrgattr
+      integer     he5_ehwrglatt
+      integer     he5_zawrlattr 
+      integer     he5_zadetach
+      integer     he5_zaclose
+      integer     HE5_ZAdscaleattrinfo, HE5_ZAreaddscaleattr
+      integer     HE5_ZAgetdimscale, HE5_ZAinqdscaleattrs
+      integer     ntype
+      integer     zafid,zaid1
+      real*4      datbuf_f(1) 
+      integer*4   datbuf_i(3)
+      integer*4   nbands
+      integer     bands(3)
+      integer*4   datbuf_i2(2) 
+      integer     count(2)
+      integer         attr_int(25)
+      real*4          attr_flt(25)
+      real*8          attr_dbl(25)
+      character       attr_char(25)
+      integer         dimsize
+      integer         bufsize, nattr 
+      integer         data(30)
+      integer         FAIL
+      parameter       (FAIL=-1)
+      character*100   attrlist
+      character*100   strbufsize
+      character*15    attrname(10)
+      integer         numtype
+
+!  /*
+!   * Open the HDF zaath file, "za.he5".
+!   */
+
+      zafid = HE5_ZAopen("za.he5", HE5F_ACC_RDWR)
+ 
+!  /*
+!   * If the zaath file cannot be found, HE5_ZAopen will return -1 for the file
+!   * handle (zafid).  We there check that this is not the case before
+!   * proceeding with the other routines.
+!   * 
+!   * The HE5_ZAattach routine returns the handle to the existing zaath "ZA1",
+!   * ZAid.  If the zaath is not found, HE5_ZAattach returns -1 for the handle.
+!   */ 
+
+      if (zafid .ne. FAIL) then
+     
+         ZAid1 = HE5_ZAattach(zafid, "ZA1")
+
+!      /* the field Pollution has Time,YDim,XDim dimensions. 
+!	 xdim = 120
+!	 ydim = 200
+!	 Time dim is set to 10
+!      */
+
+         if (ZAid1 .eq. FAIL) then
+            
+            write(*,*) 'Error: Cannot attach to zaath  ZA1'
+            status = HE5_ZAclose(zafid)
+            stop
+         endif
+
+         bufsize = HE5_ZAgetdimscale(ZAid1, "Spectra", "Bands", 
+     1        dimsize, numtype, data)
+         if (bufsize .eq. -1) then
+	
+            write(*,*) 'Error:Cannot get Dimension Scale size of Bands',
+     1           ' dimemnsion in field Spectra'
+            status = HE5_ZAdetach(ZAid1)
+            status = HE5_ZAclose(zafid)
+            stop
+            
+         else
+            
+            write(*,*) 'bufsize = ',bufsize
+            write(*,*) 'dimsize = ',dimsize
+            write(*,*) 'numtype = ',numtype
+            
+            write(*,*) 'Values are:'
+            do i = 1,dimsize
+               write(*,*) 'DimscaleValue[',i,'] = ',data(i)
+            enddo
+         endif
+         
+         nattr = HE5_ZAinqdscaleattrs(ZAid1, "Bands", attrlist, 
+     1        strbufsize)
+         if ( nattr .lt. 0 ) then
+            
+            write(*,*) 'Error: Cannot get Dimension Scale attribute',
+     1           ' list for Bands'
+            status = HE5_ZAdetach(ZAid1)
+            status = HE5_ZAclose(zafid)
+            stop
+         endif
+         write(*,*) ' '
+         write(*,*) 'Dimension scale for Bands Attribute:'
+
+         attrname(1) = 'label'
+         attrname(2) = 'unit'
+         attrname(3) = 'format'
+         attrname(4) = 'MissingValue'
+         attrname(5) = 'IntValues'
+         do j = 1,5
+            attr_char = ''
+            count(1)= 0
+            count(2)= 0
+
+            status = HE5_ZAdscaleattrinfo(ZAid1,"Bands", attrname(j), 
+     1        ntype, count)
+                              
+            if( ntype .eq. 0) then
+               status = HE5_ZAreaddscaleattr(ZAid1,"Bands", attrname(j), 
+     1              attr_int)
+            endif
+
+            if( ntype .eq. 10) then
+               status = HE5_ZAreaddscaleattr(ZAid1,"Bands", attrname(j), 
+     1              attr_flt)
+            endif
+            
+            if( ntype .eq. 11) then
+               status = HE5_ZAreaddscaleattr(ZAid1,"Bands", attrname(j), 
+     1              attr_dbl)
+            endif
+            
+            if( ntype .eq. 57) then
+               status = HE5_ZAreaddscaleattr(ZAid1,"Bands", attrname(j), 
+     1              attr_char)
+            endif
+
+            write(*,*) ' '
+            write(*,*) 'Status returned by HE5_ZAreaddscaleattr() :', 
+     1           status
+            write(*,*) 'Attribute Name: ',attrname(j)
+            write(*,*) 'Number of attribute elements: ', count(1),
+     1     '   ',count(2)
+            write(*,*) 'Data type of attribute: ', ntype
+            
+            if( ntype .eq. 0) then
+               do jj = 1,count(1)
+                  write(*,*) 'Attrvalue[',jj,']: ', attr_int(jj)
+               enddo
+            endif
+            
+            if( ntype .eq. 10) then
+               do jj = 1,count(1)
+                  write(*,*) 'Attrvalue[',jj,']: ',attr_flt(jj)
+               enddo
+            endif
+
+            if( ntype .eq. 11) then
+               do jj = 1,count(1)
+                  write(*,*) 'Attrvalue[',jj,']: ',attr_dbl(jj)
+               enddo
+            endif
+
+            if( ntype .eq. 57) then
+               write(*,*) 'Attrvalue: ', attr_char
+            endif
+         enddo
+      endif
+
+      status = HE5_ZAdetach(ZAid1)
+      
+      status = HE5_ZAclose(zafid)
+      
+      stop
+      end
+
diff --git a/samples/he5_za_setup.c b/samples/he5_za_setup.c
new file mode 100755
index 0000000..05d2e06
--- /dev/null
+++ b/samples/he5_za_setup.c
@@ -0,0 +1,83 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include    <HE5_HdfEosDef.h>
+
+
+/*  In this program we (1) open an HDF-EOS file, (2) create the ZA    */
+/*  interface within the file, and (3) define the za field dimensions */
+/*  ----------------------------------------------------------------- */
+
+int main()
+{
+  herr_t         status = FAIL; 
+
+  hid_t          zafid = FAIL;
+  hid_t          ZAid  = FAIL;
+
+
+  
+  /* Open a new HDF-EOS za file, "ZA.he5" */
+  /* ----------------------------------- */
+  zafid = HE5_ZAopen("ZA.he5", H5F_ACC_TRUNC);
+  printf("File ID returned by HE5_ZAopen():       %d \n", zafid);
+  
+  /* Create the ZA, "ZA1", within the file */
+  /* ------------------------------------- */
+  ZAid = HE5_ZAcreate(zafid, "ZA1");
+  printf("ZA ID returned by HE5_ZAcreate():    %d \n", ZAid);
+
+  /* Define dimensions and specify their sizes */
+  /* ----------------------------------------- */
+  status = HE5_ZAdefdim(ZAid, "MyTrack1", 20);
+  printf("Status returned by HE5_ZAdefdim():      %d \n", status);
+
+  status = HE5_ZAdefdim(ZAid, "MyTrack2", 10);
+  printf("Status returned by HE5_ZAdefdim():      %d \n", status);
+
+  status = HE5_ZAdefdim(ZAid, "Res2tr", 40);
+  printf("Status returned by HE5_ZAdefdim():      %d \n", status);
+
+  status = HE5_ZAdefdim(ZAid, "Res2xtr", 20);
+  printf("Status returned by HE5_ZAdefdim():      %d \n", status);
+
+  status = HE5_ZAdefdim(ZAid, "Bands", 15);
+  printf("Status returned by HE5_ZAdefdim():      %d \n", status);
+
+  status = HE5_ZAdefdim(ZAid, "IndxTrack", 12);
+  printf("Status returned by HE5_ZAdefdim():      %d \n", status);
+
+  /* Define "External" Dimension */
+  /* --------------------------- */
+  status = HE5_ZAdefdim(ZAid, "ExtDim", 60);
+  printf("Status returned by HE5_ZAdefdim():      %d \n", status);
+
+  /* Define Unlimited Dimension */
+  /* -------------------------- */
+  status = HE5_ZAdefdim(ZAid, "Unlim", H5S_UNLIMITED);
+  printf("Status returned by HE5_ZAdefdim():      %d \n", status);
+
+
+  /* Close the za interface */
+  /* ---------------------- */
+  status = HE5_ZAdetach(ZAid);
+  printf("Status returned by HE5_ZAdetach():      %d \n", status);
+
+  /* Close the za file */
+  /* ----------------- */
+  status = HE5_ZAclose(zafid);
+  printf("Status returned by HE5_ZAclose():       %d \n", status);
+
+
+  return 0;
+
+}
+
+
+
+
+
diff --git a/samples/he5_za_setupF_32.f b/samples/he5_za_setupF_32.f
new file mode 100755
index 0000000..42b336c
--- /dev/null
+++ b/samples/he5_za_setupF_32.f
@@ -0,0 +1,123 @@
+!     In this program we (1) open an HDF-EOS file, (2) create the 
+!     za interface, and (3) define the za field dimensions
+!     ===========================================================
+      
+      program    he5_za_setupF_32
+
+      implicit   none
+
+      include    'hdfeos5.inc'
+
+      integer    status
+      integer    he5_zaopen
+      integer    he5_zacreate
+      integer    he5_zadefdim
+      integer    he5_zadetach
+      integer    he5_zaclose
+      integer    zafid, zaid
+
+      integer*4  dtrack, extdata
+
+
+!     Open the HDF-EOS file, "za.he5" using "TRUNC" file access code 
+!     --------------------------------------------------------------
+      zafid = he5_zaopen('za.he5',HE5F_ACC_TRUNC)
+      write(*,*) 'File ID returned by he5_zaopen():  ',zafid
+
+!     Create the za, "ZA1", within the file 
+!     -------------------------------------
+      zaid = he5_zacreate(zafid, "ZA1")
+      write(*,*) 'ZA ID returned by he5_zacreate():  ',zaid
+    
+!     Define Data dimensions
+!     ----------------------
+      dtrack = 20
+      status = he5_zadefdim(zaid, "MyTrack1", dtrack)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+      dtrack = 10
+      status = he5_zadefdim(zaid, "MyTrack2", dtrack)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+      dtrack = 40
+      status = he5_zadefdim(zaid, "Res2tr", dtrack)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+      dtrack = 20
+      status = he5_zadefdim(zaid, "Res2xtr", dtrack)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+      dtrack = 15
+      status = he5_zadefdim(zaid, "Bands", dtrack)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+      dtrack = 12
+      status = he5_zadefdim(zaid, "IndxTrack", dtrack)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+!     Define "External" dimension
+!     ---------------------------
+      extdata = 60
+      status = he5_zadefdim(zaid, "ExtDim", extdata)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+!     Define Unlimited (appendable) dimension
+!     ---------------------------------------
+      status = he5_zadefdim(zaid, "Unlim", HE5S_UNLIMITED_F)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+!     Detach from the za
+!     ------------------
+      status = he5_zadetach(zaid)
+      write(*,*) 'Status returned by he5_zadetach():  ',status
+
+!     Close the za file
+!     -----------------
+      status = he5_zaclose(zafid)
+      write(*,*) 'Status returned by he5_zaclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_setupF_64.f b/samples/he5_za_setupF_64.f
new file mode 100755
index 0000000..f6ca5f8
--- /dev/null
+++ b/samples/he5_za_setupF_64.f
@@ -0,0 +1,90 @@
+!     In this program we (1) open an HDF-EOS file, (2) create the 
+!     za interface, and (3) define the za field dimensions
+!     ===========================================================
+
+      program            he5_za_setupF_64
+
+      implicit           none
+
+      include            'hdfeos5.inc'
+      include            'hdfeos5_64.inc'
+
+      integer            status
+      integer            he5_zaopen
+      integer            he5_zacreate
+      integer            he5_zadefdim
+      integer            he5_zadetach
+      integer            he5_zaclose
+      integer            zafid, zaid
+
+      integer*8          dtrack, extdata
+
+
+!     Open the HDF-EOS file, "za.he5" using "TRUNC" file access code 
+!     --------------------------------------------------------------
+      zafid = he5_zaopen("za.he5",HE5F_ACC_TRUNC)
+      write(*,*) 'File ID returned by he5_zaopen():  ',zafid
+
+!     Create the za, "ZA1", within the file 
+!     -------------------------------------
+      zaid = he5_zacreate(zafid, "ZA1")
+      write(*,*) 'ZA ID returned by he5_zacreate():  ',zaid
+    
+!     Define Data dimensions
+!     ----------------------
+      dtrack = 20
+      status = he5_zadefdim(zaid, "MyTrack1", dtrack)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+      dtrack = 10
+      status = he5_zadefdim(zaid, "MyTrack2", dtrack)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+      dtrack = 40
+      status = he5_zadefdim(zaid, "Res2tr", dtrack)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+      dtrack = 20
+      status = he5_zadefdim(zaid, "Res2xtr", dtrack)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+      dtrack = 15
+      status = he5_zadefdim(zaid, "Bands", dtrack)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+      dtrack = 12
+      status = he5_zadefdim(zaid, "IndxTrack", dtrack)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+!     Define "External" dimension
+!     ---------------------------
+      extdata = 60
+      status = he5_zadefdim(zaid, "ExtDim", extdata)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+     
+!     Define Unlimited (appendable) dimension
+!     ---------------------------------------
+      status = he5_zadefdim(zaid, "Unlim", HE5S_UNLIMITED_F_64)
+      write(*,*) 'Status returned by he5_zadefdim():  ',status
+
+      
+!     Detach from the za
+!     ------------------
+      status = he5_zadetach(zaid)
+      write(*,*) 'Status returned by he5_zadetach():  ',status
+
+!     Close the za file
+!     -----------------
+      status = he5_zaclose(zafid)
+      write(*,*) 'Status returned by he5_zaclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_wrexternaldata.c b/samples/he5_za_wrexternaldata.c
new file mode 100755
index 0000000..75e7d5b
--- /dev/null
+++ b/samples/he5_za_wrexternaldata.c
@@ -0,0 +1,120 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |   
+----------------------------------------------------------------------------
+ */
+
+
+#include    <HE5_HdfEosDef.h>
+
+#define  DIM      100
+#define  DIMTOT   60
+
+int main()
+{
+  FILE            *in_1, *in_2, *in_3;
+
+  herr_t          status = FAIL;
+
+  int             i;
+  int             data_out_1[DIM];
+  int             data_out_2[DIM];
+  int             data_out_3[DIM];
+  int             data[DIMTOT];
+
+  hid_t           zafid = FAIL;
+  hid_t           ZAid  = FAIL;
+
+  hssize_t        start[2];
+  hsize_t         count[2];
+
+
+  
+  /* Create new data buffer */
+  /* ---------------------- */
+  for (i = 0; i < DIMTOT; i++)
+	data[ i ] = 9999;
+
+  /* Open the HDF-EOS za file, "ZA.he5" */
+  /* --------------------------------- */
+  zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDWR);
+  if (zafid != FAIL)
+	{
+	  /* Attach the "ZA1" za */
+	  /* ------------------- */
+	  ZAid = HE5_ZAattach(zafid, "ZA1");
+	  if (ZAid != FAIL)
+		{
+		  /* Write new data to the external files */
+		  /* ------------------------------------ */
+		  start[0] = 0;
+		  count[0] = DIMTOT;
+		  status = HE5_ZAwrite(ZAid, "ExtData", start, NULL, count, data);
+		  printf("Status returned by HE5_ZAwrite() :    %d \n", status);
+	    
+
+		  /* Open the external data files */
+		  /* ---------------------------- */
+		  in_1 = fopen("external_1.data", "r");
+		  in_2 = fopen("external_2.data", "r");
+		  in_3 = fopen("external_3.data", "r");
+
+		  /* Read data from external data files */
+		  /* ---------------------------------- */
+		  fread(data_out_1, sizeof(int), DIM, in_1);
+		  fread(data_out_2, sizeof(int), DIM, in_2);
+		  fread(data_out_3, sizeof(int), DIM, in_3);
+		  
+		  /* Close the external data files */
+		  /* ----------------------------- */
+		  fclose(in_1);
+		  fclose(in_2);
+		  fclose(in_3);
+  
+		  /* Check the contents of external files */
+		  /* ------------------------------------ */
+		  printf(" \n");
+		  printf("Reading data from 1st file: \n");
+		  printf(" \n");
+		  for (i = 0; i < DIM; i++)
+			printf("%d ", data_out_1[i]);
+
+		  printf(" \n");
+		  printf(" \n");
+		  printf("Reading data from 2d file: \n");
+		  printf(" \n");
+		  for (i = 0; i < DIM; i++)
+			printf("%d ", data_out_2[i]);
+		  
+		  printf(" \n");
+		  printf(" \n");
+		  printf("Reading data from 3d file: \n");
+		  printf(" \n"); 
+		  for (i = 0; i < DIM; i++)
+			printf("%d ", data_out_3[i]);
+		  printf(" \n");
+		  printf(" \n");
+
+		}
+	}
+
+  /* Detach from the za */
+  /* ------------------ */
+  status = HE5_ZAdetach(ZAid);
+  printf("Status returned by HE5_ZAdetach() :        %d \n", status);
+
+  /* Close the file */
+  /* -------------- */
+  status = HE5_ZAclose(zafid);
+  printf("Status returned by HE5_ZAclose() :         %d \n", status); 
+  
+  return 0;
+}
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_wrexternaldataF_32.f b/samples/he5_za_wrexternaldataF_32.f
new file mode 100755
index 0000000..db8bab2
--- /dev/null
+++ b/samples/he5_za_wrexternaldataF_32.f
@@ -0,0 +1,125 @@
+!
+! ----------------------------------------------------------------------------
+! |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |
+! ----------------------------------------------------------------------------
+!
+
+      program            he5_za_wrexternaldataF_32
+
+      implicit           none
+ 
+      include            'hdfeos5.inc'
+
+      integer            i
+      integer            status
+      integer            he5_zaopen
+      integer            he5_zaattach
+      integer            he5_zawrite
+      integer            he5_ehrdwrfile
+      integer            he5_zadetach
+      integer            he5_zaclose
+      integer            zafid, zaid
+
+      integer            data_out_1(100)
+      integer            data_out_2(100)
+      integer            data_out_3(100)
+      integer            data(60)
+
+      integer*4          start(2)
+      integer*4          stride(2)
+      integer*4          count(2)
+      integer*4          num_elements
+
+      integer            FAIL
+      parameter          (FAIL=-1)
+
+!.....Use this for writing (only) to an existing file
+      integer            WRITE_EXISTING_ONLY
+      parameter          (WRITE_EXISTING_ONLY=0)
+
+!.....Use this for reading (only) from an existing file
+      integer            READ_ONLY
+      parameter          (READ_ONLY=1)
+
+!.....Use this for creating and writing to a file
+      integer            WRITE_NEW
+      parameter          (WRITE_NEW=2)
+
+
+!     Create the new data buffer
+!     --------------------------
+      do 10 i=1,60
+         data(i) = 9999
+ 10   continue
+      
+!     Open HDF-EOS za file, "za.he5"
+!     ------------------------------
+	  zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned from he5_zaopen():  ',zafid
+
+	  if (zafid .NE. FAIL) then
+		 zaid = he5_zaattach(zafid, "ZA1")
+         write(*,*) 'ZA ID returned from he5_zaattach():  ',zaid
+
+		 if (zaid .NE. FAIL) then
+			
+!     Write new data to the external files 
+!     ------------------------------------
+      start(1)  = 0
+      stride(1) = 1
+      count(1)  = 60
+
+      status = he5_zawrite(zaid,"ExtData",
+     1     start,stride,count,data)
+      write(*,*) 'Status returned from he5_zawrite():  ',status
+
+      num_elements = 100
+
+      status = he5_ehrdwrfile("extf1.dat",READ_ONLY,
+     1HE5T_NATIVE_INT,num_elements,data_out_1)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf2.dat",READ_ONLY,
+     1HE5T_NATIVE_INT,num_elements,data_out_2)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf3.dat",READ_ONLY,
+     1HE5T_NATIVE_INT,num_elements,data_out_3)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      write(*,*)'External file extf1.dat:'
+      write(*,*) data_out_1
+      write(*,*) '  '
+
+      write(*,*)'External file extf2.dat:'
+      write(*,*) data_out_2
+      write(*,*) '  '
+
+      write(*,*)'External file extf3.dat:'
+      write(*,*) data_out_3
+      write(*,*) '  '
+
+		 endif
+	  endif
+	
+!     Detach from za
+!     --------------
+	  status = he5_zadetach(zaid)
+      write(*,*) 'Status returned from he5_zadetach():  ',status
+
+!     Close the file
+!     --------------
+	  status = he5_zaclose(zafid)
+      write(*,*) 'Status returned from he5_zaclose():  ',status
+      
+	  stop
+	  end
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_wrexternaldataF_64.f b/samples/he5_za_wrexternaldataF_64.f
new file mode 100755
index 0000000..d6e0f7f
--- /dev/null
+++ b/samples/he5_za_wrexternaldataF_64.f
@@ -0,0 +1,125 @@
+!
+! ----------------------------------------------------------------------------
+! |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |
+! ----------------------------------------------------------------------------
+!
+      program            he5_za_wrexternaldataF_64
+
+      implicit           none
+ 
+      include            'hdfeos5.inc'
+
+      integer            i
+      integer            status
+      integer            he5_zaopen
+      integer            he5_zaattach
+      integer            he5_zawrite
+      integer            he5_ehrdwrfile
+      integer            he5_zadetach
+      integer            he5_zaclose
+      integer            zafid, zaid
+
+      integer            data_out_1(100)
+      integer            data_out_2(100)
+      integer            data_out_3(100)
+      integer            data(60)
+
+      integer*8          start(2)
+      integer*8          stride(2)
+      integer*8          count(2)
+      integer*8          num_elements
+
+      integer            FAIL
+      parameter          (FAIL=-1)
+
+!.....Use this for writing (only) to an existing file
+      integer            WRITE_EXISTING_ONLY
+      parameter          (WRITE_EXISTING_ONLY=0)
+
+!.....Use this for reading (only) from an existing file
+      integer            READ_ONLY
+      parameter          (READ_ONLY=1)
+
+!.....Use this for creating and writing to a file
+      integer            WRITE_NEW
+      parameter          (WRITE_NEW=2)
+
+
+!     Create the new data buffer
+!     --------------------------
+      do 10 i=1,60
+         data(i) = 9999
+ 10   continue
+      
+!     Open HDF-EOS za file, "za.he5"
+!     ------------------------------
+	  zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned from he5_zaopen():  ',zafid
+
+	  if (zafid .NE. FAIL) then
+		 zaid = he5_zaattach(zafid, "ZA1")
+         write(*,*) 'ZA ID returned from he5_zaattach():  ',zaid
+
+		 if (zaid .NE. FAIL) then
+			
+!     Write new data to the external files 
+!     ------------------------------------
+      start(1)  = 0
+      stride(1) = 1
+      count(1)  = 60
+
+      status = he5_zawrite(zaid,"ExtData",
+     1     start,stride,count,data)
+      write(*,*) 'Status returned  from he5_zawrite():  ',status
+
+      num_elements = 100
+
+      status = he5_ehrdwrfile("extf1.dat",READ_ONLY,
+     1HE5T_NATIVE_INT,num_elements,data_out_1)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf2.dat",READ_ONLY,
+     1HE5T_NATIVE_INT,num_elements,data_out_2)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+      status = he5_ehrdwrfile("extf3.dat",READ_ONLY,
+     1HE5T_NATIVE_INT,num_elements,data_out_3)
+      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
+
+
+      write(*,*)'External file extf1.dat:'
+      write(*,*) data_out_1
+      write(*,*) '  '
+
+      write(*,*)'External file extf2.dat:'
+      write(*,*) data_out_2
+      write(*,*) '  '
+
+      write(*,*)'External file extf3.dat:'
+      write(*,*) data_out_3
+      write(*,*) '  '
+
+		 endif
+	  endif
+	
+!     Detach from swath
+!     -----------------
+	  status = he5_zadetach(zaid)
+      write(*,*) 'Status returned from he5_zadetach():  ',status
+
+!     Close the file
+!     --------------
+	  status = he5_zaclose(zafid)
+      write(*,*) 'Status returned from he5_zaclose():  ',status     
+
+	  stop
+	  end
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_writeAlldimscale.c b/samples/he5_za_writeAlldimscale.c
new file mode 100644
index 0000000..133e4d7
--- /dev/null
+++ b/samples/he5_za_writeAlldimscale.c
@@ -0,0 +1,135 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Raytheon Systems Company                         |
+ ----------------------------------------------------------------------------
+ */
+
+#include     <HE5_HdfEosDef.h>
+
+/*
+ * In this example we will open an HDF-EOS file and attach to
+ * a ZA structures within the file to write a dimension scales
+ */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  hid_t           zafid = FAIL;
+  hid_t           zaid1 = FAIL;
+
+  int             data[15]={1,2,3,6,9,12,15,18,23,26,29,32, 33,34,35};
+  char            label[16];
+  char            unit[16];
+  char            format[16];
+  int             nbands;
+  hsize_t         count[3];
+
+  /*
+   * We first open the HDF-EOS ZA file, "Za.h5".  Because this file
+   * already exist and we wish to write to it, we use the H5F_ACC_RDWR access
+   * code in the open statement.  The HE5_ZAopen routine returns the ZA file
+   * id, zafid, which is used to identify the file in subsequent routines.
+   */ 
+
+  zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDWR);
+ 
+  /*
+   * If the ZA file cannot be found, HE5_ZAopen will return -1 for the file
+   * handle (zafid).  We there check that this is not the case before
+   * proceeding with the other routines.
+   * 
+   * The HE5_ZAattach routine returns the handle to the existing ZA "Za1",
+   * zaid1.  If the ZA is not found, HE5_ZAattach returns -1 for the handle.
+   */ 
+
+  if (zafid != FAIL)
+    {	  
+      zaid1 = HE5_ZAattach(zafid, "ZA1");
+
+      /* the field Spectra has Time,YDim,XDim dimensions. 
+	 Bands dim is set to 15
+      */
+
+      if (zaid1 == -1)
+	{
+	  printf("\t\tError: Cannot attach to ZA \"ZA1\"\n");
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+      
+      nbands = 15;
+      
+      status = HE5_ZAdefdimscale(zaid1, "Bands", nbands, H5T_NATIVE_INT, (void *)data);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot def Dimension Scale for Bands dimemnsion in ZA fields \n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+      
+      strcpy(label, "Bands Dim");
+      strcpy(unit, "None");
+      strcpy(format, "I2");
+      
+      count[0]= 12;
+      status = HE5_ZAwritedscaleattr(zaid1, "Bands", "label", H5T_NATIVE_CHAR, count, label);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot def Dimension Scale strs for Bands dimemnsion in ZA fields \n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+
+      count[0]= 6;
+      status = HE5_ZAwritedscaleattr(zaid1, "Bands", "unit", H5T_NATIVE_CHAR, count, unit);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot def Dimension Scale strs for Bands dimemnsion in ZA fields \n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+      
+      count[0]= 4;
+      status = HE5_ZAwritedscaleattr(zaid1, "Bands", "format", H5T_NATIVE_CHAR, count, format);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot def Dimension Scale strs for Bands dimemnsion in ZA fields \n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+         
+      int datbuf_i1[1] = {-999};
+      count[0]= 1;
+      status = HE5_ZAwritedscaleattr(zaid1, "Bands", "MissingValue", H5T_NATIVE_INT, count, datbuf_i1);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot def Dimension Scale strs for Bands dimemnsion in ZA fields \n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+      
+      int datbuf_i2[3] = {-999,0,999};
+      count[0]= 3;
+      status = HE5_ZAwritedscaleattr(zaid1, "Bands", "IntValues", H5T_NATIVE_INT, count, datbuf_i2);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot def Dimension Scale strs for Bands dimemnsion in ZA fields \n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+      
+      HE5_ZAdetach(zaid1);
+      
+      HE5_ZAclose(zafid);
+      
+      return 0;
+    }
+}
diff --git a/samples/he5_za_writedata.c b/samples/he5_za_writedata.c
new file mode 100755
index 0000000..c8b5bff
--- /dev/null
+++ b/samples/he5_za_writedata.c
@@ -0,0 +1,140 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+ */
+
+
+#include  <HE5_HdfEosDef.h>
+
+
+/*  In this program we (1) open the "ZA.he5" file, (2) attach to the    */
+/*  "ZA1" za, and (3) write data to the "Spectra" fields. Also, set up */
+/*  the global, group, and local attributes                            */
+/*  ------------------------------------------------------------------ */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  int             i, j, k;
+  int             attr1[4] = {1, 2, 3, 4};         /* global attribute */
+  int             attr2[4] = {10, 20, 30, 40};     /* group attribute  */
+  int             attr3[4] = {100, 200, 300, 400}; /* local attribute  */
+
+  hid_t           zafid = FAIL;
+  hid_t           ZAid  = FAIL;
+
+  char            attr4[7]; /* Global 'char' attribute */
+ 
+  long            attr5[4] = {1111111L,2222222L,3333333L,4444444L};/* Global 'long' attribute   */ 
+
+  double          attr6[4] = {1.111111,2.222222,3.333333,4.444444};/* Global 'double' attribute */
+
+  hssize_t        start[3];
+    
+  hsize_t         count[3];
+
+  double          plane[15][40][20];
+
+  const char *charname[10] = {
+        "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
+        "BBBBBBBBBBBBBBBB",
+        "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC",
+        "DDDDDDDDDDDDDDDDDDDD",
+        "EEEEEEEE",
+        "FFFFFFFFFFFFF",
+        "GGGGGGGGGGGGG",
+        "HHHHHHHHHH",
+        "IIIIIII",
+        "JJJJJJJJJJJJJ"
+      };
+
+
+  /* Populate spectra data array. Value = 100*(track index)+(band index) */
+  /* ------------------------------------------------------------------- */
+  for (i = 0; i < 15; i++)
+  {
+	  for (j = 0; j < 40; j++)
+		for (k = 0; k < 20; k++)
+		  plane[i][j][k] = (double)(j*100 + i);
+  }
+	
+	
+  /* Open the HDF za file, "ZA.he5" */
+  /* ----------------------------- */
+  zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDWR);
+  if (zafid != FAIL)
+	{
+	  /* Attach the "ZA1" za */
+	  /* ------------------- */
+	  ZAid = HE5_ZAattach(zafid, "ZA1");
+	  if (ZAid != FAIL)
+		{
+		  /* Write Spectra Field */
+		  /* ------------------- */
+		  start[0] = 0;      count[0] = 15;
+		  start[1] = 0;      count[1] = 40;
+		  start[2] = 0;      count[2] = 20;
+			
+		  status = HE5_ZAwrite(ZAid, "Spectra", start, NULL, count, plane);
+		  printf("status returned by HE5_ZAwrite(\"Spectra\"):           %d\n", status);
+
+            start[0] = 0;
+            count[0] = 10;
+                  status = HE5_ZAwrite(ZAid, "Test_string", start, NULL, count, charname);
+                  printf("status returned by HE5_ZAwrite(\"Test_string\"):              %d\n", status);
+            
+		  /* Write Global 'int' Attribute */
+		  /* ---------------------------- */
+		  count[0] = 4;
+		  status = HE5_ZAwriteattr(ZAid, "GlobalAttribute", H5T_NATIVE_INT, count, attr1);
+		  printf("status returned by HE5_ZAwriteattr(\"GlobalAttribute\"):    %d\n", status);
+
+		  /* Write Global 'char' Attribute */
+		  /* ----------------------------- */
+                  strcpy(attr4,"ABCDEF");
+		  count[0] = 6;
+		  status = HE5_ZAwriteattr(ZAid, "GLOBAL_CHAR_ATTR", H5T_NATIVE_CHAR, count, attr4);
+		  printf("status returned by HE5_ZAwriteattr(\"GLOBAL_CHAR_ATTR\"):   %d\n", status);
+			
+		  /* Write Global 'long' Attribute */
+		  /* ----------------------------- */
+		  count[0] = 4;
+		  status = HE5_ZAwriteattr(ZAid, "GLOBAL_LONG_ATTR", H5T_NATIVE_LONG, count, attr5);
+		  printf("status returned by HE5_ZAwriteattr(\"GLOBAL_LONG_ATTR\"):   %d\n", status);
+
+		  /* Write Global 'double' Attribute */
+		  /* ------------------------------- */
+		  count[0] = 4;
+		  status = HE5_ZAwriteattr(ZAid, "GLOBAL_DOUBLE_ATTR", H5T_NATIVE_DOUBLE, count, attr6);
+		  printf("status returned by HE5_ZAwriteattr(\"GLOBAL_DOUBLE_ATTR\"): %d\n", status);
+
+		  /* Write Group Attribute */
+		  /* --------------------- */
+		  status = HE5_ZAwritegrpattr(ZAid, "GroupAttribute", H5T_NATIVE_INT, count, attr2);
+		  printf("status returned by HE5_ZAwritegrpattr(\"GroupAttribute\"):  %d\n", status);
+
+		  /* Write Local Attribute */
+		  /* --------------------- */
+		  status = HE5_ZAwritelocattr(ZAid, "Density", "LocalAttribute", H5T_NATIVE_INT, count, attr3);
+		  printf("status returned by HE5_ZAwritelocattr(\"LocalAttribute\"):%d\n", status);
+
+		}
+	}
+	
+  status = HE5_ZAdetach(ZAid);
+  status = HE5_ZAclose(zafid);
+
+  return 0;
+}
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_writedataF_32.f b/samples/he5_za_writedataF_32.f
new file mode 100755
index 0000000..108b2df
--- /dev/null
+++ b/samples/he5_za_writedataF_32.f
@@ -0,0 +1,109 @@
+!     In this program we (1) open the "za.he5" file, (2) attach to
+!     the "ZA1" za, and (3) write data to the "Spectra" fields 
+
+      program        he5_za_writedataF_32
+      
+      implicit       none
+
+      include        'hdfeos5.inc'
+
+      integer        status
+      integer        he5_zaopen 
+      integer        he5_zaattach 
+      integer        he5_zawrite
+      integer        he5_zawrattr
+      integer        he5_zadetach
+      integer        he5_zaclose
+      integer        zafid, zaid 
+      integer        i, j, k 
+
+      integer*4      attr(4)
+      integer*4      start(3)
+      integer*4      stride(3)
+      integer*4      count(3)
+
+      real*8         plane(800)
+
+      integer        FAIL
+      parameter      (FAIL=-1)	
+
+
+!     Open HDF-EOS file, "za.he5"
+!     ---------------------------
+      zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_zaopen():  ',zafid
+
+      if (zafid .NE. FAIL) then
+		 zaid = he5_zaattach(zafid, "ZA1")      
+         write(*,*) 'ZA ID returned by he5_zaattach():  ',zaid
+
+		 if (zaid .NE. FAIL) then
+            
+!     Write Spectra one plane at a time 
+!     Value is 100 * track index + band index (0-based)
+!     -------------------------------------------------
+			start(1)  = 0
+			start(2)  = 0
+			count(1)  = 20
+			count(2)  = 40
+			count(3)  = 1
+			stride(1) = 1
+			stride(2) = 1
+			stride(3) = 1
+	    
+			do i=1,15
+			   start(3) = i - 1
+			   do j=1,40
+				  do k=1,20
+					 plane((j-1)*20+k) = (j-1)*100 + i-1
+				  enddo
+			   enddo
+			   status = he5_zawrite(zaid,"Spectra",start,
+     1              stride,count,plane)
+			enddo
+	write(*,*) 'Status returned by he5_zawrite(): ',status
+
+		            
+!     Write User defined Attribute
+!     ----------------------------
+			attr(1) = 3
+			attr(2) = 5
+			attr(3) = 7
+			attr(4) = 11
+            count(1) = 4
+			status = he5_zawrattr(zaid,"TestAttr",HE5T_NATIVE_INT,
+     1           count,attr)
+            
+		 endif
+	  endif
+
+!     Detach from the za
+!     ------------------
+      status = he5_zadetach(zaid)
+      write(*,*) 'Status returned by he5_zadetach():  ',status
+ 
+!     Close the file
+!     --------------
+      status = he5_zaclose(zafid)
+      write(*,*) 'Status returned by he5_zaclose():  ',status
+
+      stop
+      end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_writedataF_64.f b/samples/he5_za_writedataF_64.f
new file mode 100755
index 0000000..6d59758
--- /dev/null
+++ b/samples/he5_za_writedataF_64.f
@@ -0,0 +1,100 @@
+!  In this program we (1) open the "za.he5" file, (2) attach to
+!  the "ZA1" za, and (3) write data to the "Spectra" field 
+
+      program        he5_za_writedataF_64
+
+      implicit       none
+
+      include        'hdfeos5.inc'
+
+      integer        status
+      integer        he5_zaopen 
+      integer        he5_zaattach 
+      integer        he5_zawrite
+      integer        he5_zawrattr
+      integer        he5_zadetach
+      integer        he5_zaclose
+      integer        zafid, zaid 
+      integer        i, j , k
+
+      integer*4      attr(4)
+      integer*8      start(3)
+      integer*8      stride(3)
+      integer*8      count(3)
+ 
+      real*8         plane(800)
+
+      integer        FAIL
+      parameter      (FAIL=-1)
+      
+	 
+!     Open HDF-EOS file, "za.he5"
+!     ---------------------------
+      zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_zaopen():  ',zafid
+
+      if (zafid .NE. FAIL) then
+		 zaid = he5_zaattach(zafid, "ZA1")
+         write(*,*) 'ZA ID returned by he5_zaattach():  ',zaid
+
+		 if (zaid .NE. FAIL) then
+
+!     Write Spectra one plane at a time 
+!     Value is 100 * track index + band index (0-based)
+!     -------------------------------------------------
+			start(1)  = 0
+			start(2)  = 0
+			count(1)  = 20
+			count(2)  = 40
+			count(3)  = 1
+			stride(1) = 1
+			stride(2) = 1
+			stride(3) = 1
+	    
+			do i=1,15
+			   start(3) = i - 1
+			   do j=1,40
+				  do k=1,20
+					 plane((j-1)*20+k) = (j-1)*100 + i-1
+				  enddo
+			   enddo
+			   status = he5_zawrite(zaid,"Spectra",start,
+     1              stride,count,plane)
+			enddo
+	write(*,*) 'Status returned by he5_zawrite(): ',status
+
+			
+!     Write User defined Attribute
+!     ----------------------------
+			attr(1)  = 3
+			attr(2)  = 5
+			attr(3)  = 7
+			attr(4)  = 11
+            count(1) = 4
+			status = he5_zawrattr(zaid,"TestAttr",HE5T_NATIVE_INT,
+     1           count,attr)
+	      
+		 endif
+	  endif
+	  
+!     Detach from the za
+!     ------------------
+      status = he5_zadetach(zaid)
+      write(*,*) 'Status returned by he5_zadetach():  ',status
+
+!     Close the file
+!     --------------
+      status = he5_zaclose(zafid)
+      write(*,*) 'Status returned by he5_zaclose():  ',status
+	  
+      stop
+      end
+
+
+
+
+
+
+
+
+
diff --git a/samples/he5_za_writedimscale.c b/samples/he5_za_writedimscale.c
new file mode 100755
index 0000000..4f9ad2c
--- /dev/null
+++ b/samples/he5_za_writedimscale.c
@@ -0,0 +1,135 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Raytheon Systems Company                         |
+ ----------------------------------------------------------------------------
+ */
+
+#include     <HE5_HdfEosDef.h>
+
+/*
+ * In this example we will open an HDF-EOS file and attach to
+ * a ZA structures within the file to write a dimension scales
+ */
+
+
+int main()
+{
+  herr_t          status = FAIL;
+
+  hid_t           zafid = FAIL;
+  hid_t           zaid1 = FAIL;
+
+  int             data[15]={1,2,3,6,9,12,15,18,23,26,29,32, 33,34,35};
+  char            label[16];
+  char            unit[16];
+  char            format[16];
+  int             nbands;
+  hsize_t         count[3];
+
+  /*
+   * We first open the HDF-EOS ZA file, "Za.h5".  Because this file
+   * already exist and we wish to write to it, we use the H5F_ACC_RDWR access
+   * code in the open statement.  The HE5_ZAopen routine returns the ZA file
+   * id, zafid, which is used to identify the file in subsequent routines.
+   */ 
+
+  zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDWR);
+ 
+  /*
+   * If the ZA file cannot be found, HE5_ZAopen will return -1 for the file
+   * handle (zafid).  We there check that this is not the case before
+   * proceeding with the other routines.
+   * 
+   * The HE5_ZAattach routine returns the handle to the existing ZA "Za1",
+   * zaid1.  If the ZA is not found, HE5_ZAattach returns -1 for the handle.
+   */ 
+
+  if (zafid != FAIL)
+    {	  
+      zaid1 = HE5_ZAattach(zafid, "ZA1");
+
+      /* the field Spectra has Time,YDim,XDim dimensions. 
+	 Bands dim is set to 15
+      */
+
+      if (zaid1 == -1)
+	{
+	  printf("\t\tError: Cannot attach to ZA \"ZA1\"\n");
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+      
+      nbands = 15;
+      
+      status = HE5_ZAsetdimscale(zaid1, "Spectra", "Bands", nbands, H5T_NATIVE_INT, (void *)data);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+      
+      strcpy(label, "Bands Dim");
+      strcpy(unit, "None");
+      strcpy(format, "I2");
+      
+      count[0]= 12;
+      status = HE5_ZAwritedscaleattr(zaid1, "Bands", "label", H5T_NATIVE_CHAR, count, label);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+
+      count[0]= 6;
+      status = HE5_ZAwritedscaleattr(zaid1, "Bands", "unit", H5T_NATIVE_CHAR, count, unit);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+      
+      count[0]= 4;
+      status = HE5_ZAwritedscaleattr(zaid1, "Bands", "format", H5T_NATIVE_CHAR, count, format);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+         
+      int datbuf_i1[1] = {-999};
+      count[0]= 1;
+      status = HE5_ZAwritedscaleattr(zaid1, "Bands", "MissingValue", H5T_NATIVE_INT, count, datbuf_i1);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+      
+      int datbuf_i2[3] = {-999,0,999};
+      count[0]= 3;
+      status = HE5_ZAwritedscaleattr(zaid1, "Bands", "IntValues", H5T_NATIVE_INT, count, datbuf_i2);
+      if (status == -1)
+	{
+	  printf("\t\tError: Cannot set Dimension Scale strs for Bands dimemnsion in field \"Spectra\"\n");
+	  HE5_ZAdetach(zaid1);
+	  HE5_ZAclose(zafid);
+	  return -1;
+	}
+      
+      HE5_ZAdetach(zaid1);
+      
+      HE5_ZAclose(zafid);
+      
+      return 0;
+    }
+}
diff --git a/samples/he5_za_writedimscaleF_32.f b/samples/he5_za_writedimscaleF_32.f
new file mode 100755
index 0000000..ab28b76
--- /dev/null
+++ b/samples/he5_za_writedimscaleF_32.f
@@ -0,0 +1,168 @@
+      program     he5_za_writedimscaleF_32
+
+      implicit    none
+
+      include     'hdfeos5.inc'
+
+      integer     status
+      integer     i, j
+      integer     he5_zaopen
+      integer     he5_zaattach
+      integer     he5_zawrfld
+      integer     he5_zawrattr
+      integer     he5_zawrgattr
+      integer     he5_ehwrglatt
+      integer     he5_zawrlattr 
+      integer     he5_zadetach
+      integer     he5_zaclose
+      integer     HE5_ZAsetdimscale
+      integer     HE5_ZAwritedscaleattr
+
+      integer     zafid,zaid1
+      integer*4   datbuf_i1(1) 
+      integer*4   datbuf_i(15)
+      integer     count(2)
+      integer*4   nbands
+      integer     bands(3)
+      integer*4   datbuf_i2(2)
+      integer     xdim, ydim, ntime
+      integer     data(15)
+      integer     FAIL
+      parameter   (FAIL=-1)
+
+
+
+!  /*
+!   * We first open the HDF-EOS zaath file, "za.he5".  Because this file
+!   * already exist and we wish to write to it, we use the H5F_ACC_RDWR access
+!   * code in the open statement.  The HE5_ZAopen routine returns the zaath file
+!   * id, zafid, which is used to identify the file in subsequent routines.
+!   */ 
+      nbands = 15
+      do j=1,nbands
+         data(j)=(j+1)*2
+      enddo
+
+      zafid = HE5_ZAopen("za.he5", HE5F_ACC_RDWR)
+      write(*,*) 'File ID returned by he5_zaopen(): ',zafid
+!  /*
+!   * If the zaath file cannot be found, HE5_ZAopen will return -1 for the file
+!   * handle (zafid).  We there check that this is not the case before
+!   * proceeding with the other routines.
+!   * 
+!   * The HE5_ZAattach routine returns the handle to the existing zaath "ZA1",
+!   * ZAid.  If the zaath is not found, HE5_ZAattach returns -1 for the handle.
+!   */ 
+
+      if (zafid .ne. FAIL) then
+ 
+         ZAid1 = HE5_ZAattach(zafid, "ZA1")
+         write(*,*) 'Za ID returned by he5_zaattach(): ',zaid1
+
+!      /* the field Spectra has Bands,Res2tr,Res2xtr dimensions. 
+!	 xdim = 120;
+!	 ydim = 200;
+!	 Time dim is set to 10
+!      */
+
+         if (ZAid1 .eq. -1) then
+            
+            write(*,*) 'Error: Cannot attach to zaath ZA1. Stpped.'
+            status = HE5_ZAclose(zafid)
+            stop
+            
+         endif
+                  
+         status = HE5_ZAsetdimscale(ZAid1, "Spectra", "Bands", nbands,
+     1                               HE5T_NATIVE_INT, data)
+         write(*,*) 'Status returned by HE5_ZAsetdimscale: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error: Cannot set Dimension Scale for Bands',
+     1                 ' dimemnsion in field Vegetation'
+            status = HE5_ZAdetach(ZAid1)
+            status = HE5_ZAclose(zafid)
+            stop
+         endif
+
+         count(1)= 12
+         status = HE5_ZAwritedscaleattr(ZAid1, "Bands", "label", 
+     1                         HE5T_NATIVE_CHAR, count, "Bands Dim")
+         write(*,*) 'Status returned by HE5_ZAwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale str for Bands',
+     1                ' dimemnsion in field Spectra'
+            status = HE5_ZAdetach(ZAid1)
+            status = HE5_ZAclose(zafid)
+            stop
+         endif
+         
+         count(1)= 6
+         status = HE5_ZAwritedscaleattr(ZAid1, "Bands", "unit", 
+     1                              HE5T_NATIVE_CHAR, count, "None")
+         write(*,*) 'Status returned by HE5_ZAwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale str for Bands',
+     1                 ' dimemnsion in field Spectra'
+            status = HE5_ZAdetach(ZAid1)
+            status = HE5_ZAclose(zafid)
+            stop
+         endif
+         
+         count(1)= 4
+         status = HE5_ZAwritedscaleattr(ZAid1, "Bands", "format", 
+     1                                 HE5T_NATIVE_CHAR, count, "I2")
+         write(*,*) 'Status returned by HE5_ZAwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale str for Bands',
+     1                 ' dimemnsion in field Spectra'
+            status = HE5_ZAdetach(ZAid1)
+            status =  HE5_ZAclose(zafid)
+            stop
+         endif
+
+         datbuf_i1(1) = -999
+         count(1)= 1
+         status = HE5_ZAwritedscaleattr(ZAid1, "Bands", "MissingValue",
+     1                             HE5T_NATIVE_INT, count, datbuf_i1)
+         write(*,*) 'Status returned by HE5_ZAwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale str for Bands',
+     1                 ' dimemnsion in field Spectra'
+            status = HE5_ZAdetach(ZAid1)
+            status = HE5_ZAclose(zafid)
+            stop
+         endif
+         
+         datbuf_i(1) =  -999
+         datbuf_i(2) =  0
+         datbuf_i(3) =  999
+
+
+         count(1)= 3
+         status = HE5_ZAwritedscaleattr(ZAid1, "Bands", "IntValues", 
+     1                               HE5T_NATIVE_INT, count, datbuf_i)
+         write(*,*) 'Status returned by HE5_ZAwritedscaleattr: ',status
+         if (status .eq. -1) then
+            
+            write(*,*) 'Error:Cannot set Dimension Scale str for Bands',
+     1         ' dimemnsion in field Spectra'
+            status = HE5_ZAdetach(ZAid1)
+            status = HE5_ZAclose(zafid)
+            stop
+         endif
+         
+         status = HE5_ZAdetach(ZAid1)
+         write(*,*) 'Status returned by he5_zadetach(): ',status
+
+         status = HE5_ZAclose(zafid)
+         write(*,*) 'Status returned by he5_zaclose(): ',status
+
+      endif
+      stop
+      end
+
diff --git a/samples/makefile_me b/samples/makefile_me
new file mode 100755
index 0000000..df6d921
--- /dev/null
+++ b/samples/makefile_me
@@ -0,0 +1,76 @@
+
+#
+# To use this makefile you must also type the sample C code name. 
+# For example for he5_gd_setup.c "make -f makefile_me he5_gd_setup"
+#
+
+SHELL=/bin/sh
+
+F77LIBS_IRIX64	= $(HDFEOS5_LIB)/libhe5_hdfeos.a $(JPEGLIB)/libjpeg.a $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a $(ZLIBLIB)/libz.a $(SZIPLIB)/libsz.a
+F77LIBS_IRIX	= $(HDFEOS5_LIB)/libhe5_hdfeos.a $(JPEGLIB)/libjpeg.a $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a $(ZLIBLIB)/libz.a $(SZIPLIB)/libsz.a /usr/lib/libmpc.a 
+F77LIBS_SUN	= $(HDFEOS5_LIB)/libhe5_hdfeos.a $(JPEGLIB)/libjpeg.a $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a $(ZLIBLIB)/libz.a $(SZIPLIB)/libsz.a /usr/lib/libnsl.a
+F77LIBS_HP	= $(HDFEOS5_LIB)/libhe5_hdfeos.a $(JPEGLIB)/libjpeg.a $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a $(ZLIBLIB)/libz.a $(SZIPLIB)/libsz.a /lib/libm.a
+F77LIBS_HP11	= $(HDFEOS5_LIB)/libhe5_hdfeos.a $(JPEGLIB)/libjpeg.a $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a $(ZLIBLIB)/libz.a $(SZIPLIB)/libsz.a /usr/lib/libnsl.a /lib/libm.a
+F77LIBS		= $(HDFEOS5_LIB)/libhe5_hdfeos.a $(JPEGLIB)/libjpeg.a $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a $(ZLIBLIB)/libz.a $(SZIPLIB)/libsz.a 
+F77LIBS_linux	= $(HDFEOS5_LIB)/libhe5_hdfeos.a $(JPEGLIB)/libjpeg.a $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a $(ZLIBLIB)/libz.a $(SZIPLIB)/libsz.a
+F77LIBS_MAC     = $(HDFEOS5_LIB)/libhe5_hdfeos.a $(JPEGLIB)/libjpeg.a $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a $(ZLIBLIB)/libz.a $(SZIPLIB)/libsz.a
+
+IFLAG		= -I$(JPEGINC) -I$(ZLIBINC) -I$(HDF5INC) -I$(HDFEOS5_INC) -I$(SZIPINC)
+LIBSH		= -L$(HDFEOS5_LIB) -L$(JPEGLIB) -L$(ZLIBLIB) -L$(SZIPLIB) -L$(HDF5LIB) 
+LIBSM_SUN	= $(HDFEOS5_LIB)/libhe5_hdfeos.a -ljpeg $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a -lGctp -lz $(SZIPLIB)/libsz.a  -lnsl -lm
+LIBSM_hp11	= $(HDFEOS5_LIB)/libhe5_hdfeos.a -ljpeg $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a -lGctp -lz $(SZIPLIB)/libsz.a  -lnsl -lm
+LIBSM_linux	= $(HDFEOS5_LIB)/libhe5_hdfeos.a -ljpeg $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a -lGctp -lz $(SZIPLIB)/libsz.a  -lm -ldl
+LIBSM_MAC       = $(HDFEOS5_LIB)/libhe5_hdfeos.a -ljpeg $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a -lGctp -lz $(SZIPLIB)/libsz.a  -lm -ldl
+LIBSM		= $(HDFEOS5_LIB)/libhe5_hdfeos.a -ljpeg $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a -lGctp -lz $(SZIPLIB)/libsz.a  -lm -ldl
+
+HDFEOS5_SAMPLE_BIN   = /tools/pgs/ataaheri/TK5216_f95/TOOLKIT/hdfeos5/samples
+HDFEOS5_SAMPLE_SRC   = /tools/pgs/ataaheri/TK5216_f95/TOOLKIT/hdfeos5/samples
+
+# compile C to executable
+
+.c:
+	@echo "USING LIBRARY IN $(HDFEOS5_LIB) TO COMPILE for $(BRAND)"
+	\rm -f $(HDFEOS5_SAMPLE_BIN)/$@
+	@if [ $(BRAND) = "sun5" -o $(BRAND) = "sun4" -o $(BRAND) = "sun5.8" -o $(BRAND) = "sun5.9"  -o $(BRAND) = "sun5.10" ] ; then \
+		$(CC) $(CFHFLAGS) -o $(HDFEOS5_SAMPLE_BIN)/$@.o $(IFLAG) -c $(HDFEOS5_SAMPLE_BIN)/$@.c; \
+		$(CC) $(CFHFLAGS) -o $(HDFEOS5_SAMPLE_BIN)/$@ $(HDFEOS5_SAMPLE_BIN)/$@.o $(IFLAG) -D$(HDFSYS) $(LIBSH) $(LIBSM_SUN) -lsocket ; \
+	elif [ $(BRAND) = "dec" ] ; then \
+		$(CC) $(CFHFLAGS) $(IFLAG) -D$(HDFSYS) $< $(F77LIBS) -lm -o $(HDFEOS5_SAMPLE_BIN)/$@ ; \
+	elif [ $(BRAND) = "hp" ] ; then \
+		if [ `/bin/uname -r | cut -d. -f2` = "11" ]; then \
+			$(CC) $(CFHFLAGS) $(IFLAG) -D$(HDFSYS) $< $(F77LIBS_HP11) -o $(HDFEOS5_SAMPLE_BIN)/$@ ; \
+		else \
+			$(CC) $(CFHFLAGS) $(IFLAG) -D$(HDFSYS) $(LIBSH) $< $(LIBSM) -o $(HDFEOS5_SAMPLE_BIN)/$@ ; \
+		fi; \
+	elif [ $(BRAND) = "linux" ] || [ $(BRAND) = "linux32" ] || [ $(BRAND) = "linux64" ] ; then \
+		$(CC) $(CFHFLAGS) $(IFLAG) -D$(HDFSYS) $(LIBSH) $< $(LIBSM_linux) -o $(HDFEOS5_SAMPLE_BIN)/$@ ; \
+        elif [ $(BRAND) = "macintosh" ] ; then \
+                $(CC) $(CFHFLAGS) $(IFLAG) -D$(HDFSYS) $(LIBSH) $< $(LIBSM_MAC) -o $(HDFEOS5_SAMPLE_BIN)/$@ ; \
+	else \
+		$(CC) $(CFHFLAGS) $(IFLAG) -D$(HDFSYS) $(LIBSH) $< $(LIBSM) -o $(HDFEOS5_SAMPLE_BIN)/$@ ; \
+	fi ;
+#	\rm -f $@.o
+
+.f:
+	@echo "USING LIBRARY IN $(HDFEOS5_LIB) TO COMPILE for $(BRAND)"
+	\rm -f $(HDFEOS5_SAMPLE_BIN)/$@
+	@if [ $(BRAND) = "sun5" -o $(BRAND) = "sun4" -o $(BRAND) = "sun5.8" -o $(BRAND) = "sun5.9"  -o $(BRAND) = "sun5.10" ] ; then \
+		$(F77) $(CFHFLAGS) -o $(HDFEOS5_SAMPLE_BIN)/$@.o $(IFLAG) -c $(HDFEOS5_SAMPLE_BIN)/$@.f; \
+		$(F77)  -o $(HDFEOS5_SAMPLE_BIN)/$@ $(HDFEOS5_SAMPLE_BIN)/$@.o $(IFLAG) -D$(HDFSYS) $(LIBSH) $(LIBSM_SUN) -lsocket ; \
+	elif [ $(BRAND) = "dec" ] ; then \
+		$(F77) $(CFHFLAGS) $(IFLAG) -D$(HDFSYS) $< $(F77LIBS) -lm -o $(HDFEOS5_SAMPLE_BIN)/$@ ; \
+	elif [ $(BRAND) = "hp" ] ; then \
+		if [ `/bin/uname -r | cut -d. -f2` = "11" ]; then \
+			$(F77) $(CFHFLAGS) $(IFLAG) -D$(HDFSYS) $< $(F77LIBS_HP11) -o $(HDFEOS5_SAMPLE_BIN)/$@ ; \
+		else \
+			$(F77) $(CFHFLAGS) $(IFLAG) -D$(HDFSYS) $(LIBSH) $< $(LIBSM) -o $(HDFEOS5_SAMPLE_BIN)/$@ ; \
+		fi; \
+	elif [ $(BRAND) = "linux" ] || [ $(BRAND) = "linux32" ] || [ $(BRAND) = "linux64" ] ; then \
+		$(F77) $(CFHFLAGS) $(IFLAG) -D$(HDFSYS) $(LIBSH) $< $(LIBSM_linux) -o $(HDFEOS5_SAMPLE_BIN)/$@ ; \
+        elif [ $(BRAND) = "macintosh" ] ; then \
+                $(F77) $(CFHFLAGS) $(IFLAG) -D$(HDFSYS) $(LIBSH) $< $(LIBSM_MAC) -o $(HDFEOS5_SAMPLE_BIN)/$@ ; \
+	else \
+		$(F77) $(CFHFLAGS) $(IFLAG) -D$(HDFSYS) $(LIBSH) $< $(LIBSM) -o $(HDFEOS5_SAMPLE_BIN)/$@ ; \
+	fi ;
+#	\rm -f $@.o
+
diff --git a/samples/simple.txt b/samples/simple.txt
new file mode 100755
index 0000000..a05b409
--- /dev/null
+++ b/samples/simple.txt
@@ -0,0 +1,15 @@
+   46353400.0  2.98  3.99  2.63  1.41  CO
+   46572420.7  3.99  4.52  2.35  2.52 CO2
+   46853103.3  2.11  3.10  4.81  1.83  CO
+   47485493.4  3.39  3.02  3.09  3.90 CO2
+   48066418.5  2.06  4.49  1.67  1.74  O3
+   48474414.6  1.06  4.63  4.44  3.33 CO2
+   48866282.4  2.18  2.02  1.41  1.00  O3
+   49388188.2  3.73  2.00  2.30  1.46  O3
+   49858070.5  2.97  3.75  2.33  5.02 NOx
+   50370437.1  4.38  3.70  1.96  3.11 NOx
+   50515373.3  0.24  1.91  4.33  1.49  CO
+   51257471.8  3.62  1.40  0.48  2.32 CO2
+   51708197.8  3.53  3.16  2.01  1.56  O3
+   51859454.7  0.62  0.76  2.06  4.01  O3
+   52433289.8  1.68  1.35  1.71  4.06  O3
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..18c2924
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,80 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDFEOS5_SRC C CXX)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+LINK_DIRECTORIES (
+    ${HDFEOS5_SRC_BINARY_DIR}
+    ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+)
+
+SET (HDFEOS_CSRCS
+    ${HDFEOS5_SRC_SOURCE_DIR}/EHapi.c
+    ${HDFEOS5_SRC_SOURCE_DIR}/GDapi.c
+    ${HDFEOS5_SRC_SOURCE_DIR}/PTapi.c
+    ${HDFEOS5_SRC_SOURCE_DIR}/SWapi.c
+    ${HDFEOS5_SRC_SOURCE_DIR}/TSapi.c
+    ${HDFEOS5_SRC_SOURCE_DIR}/ZAapi.c
+)
+
+SET (HDFEOS_CHDRS
+    ${HDFEOS_INC_DIR}/HE5_GctpFunc.h
+    ${HDFEOS_INC_DIR}/HE5_HdfEosDef.h
+#    ${HDFEOS_INC_DIR}/HE5_config.h
+    ${HDFEOS_INC_DIR}/cproj.h
+    ${HDFEOS_INC_DIR}/ease.h
+    ${HDFEOS_INC_DIR}/isin.h
+    ${HDFEOS_INC_DIR}/proj.h
+    ${HDFEOS_INC_DIR}/tutils.h
+    ${HDFEOS_INC_DIR}/cfortHdf.h
+)
+
+IF (H5_USE_HDFEOS2)
+  ADD_DEFINITIONS (-DHAVE_LIBHDFEOS)
+ENDIF (H5_USE_HDFEOS2)
+
+ADD_LIBRARY (${HDFEOS_SRC_LIB_TARGET} ${LIB_TYPE} ${HDFEOS_CSRCS} ${HDFEOS_CHDRS})
+IF (H5_USE_16_API_DEFAULT)
+  ADD_DEFINITIONS (-DH5_USE_16_API)
+ENDIF (H5_USE_16_API_DEFAULT)
+IF(MSVC)
+  TARGET_LINK_LIBRARIES (${HDFEOS_SRC_LIB_TARGET} "ws2_32.lib")
+ELSE (MSVC)
+  SET_TARGET_PROPERTIES (${HDFEOS_SRC_LIB_TARGET} PROPERTIES LINK_FLAGS "-Wl,-single_module")
+ENDIF(MSVC)
+TARGET_LINK_LIBRARIES (${HDFEOS_SRC_LIB_TARGET} ${LINK_LIBS})
+SET_GLOBAL_VARIABLE (HDFEOS_LIBRARIES_TO_EXPORT "${HDFEOS_LIBRARIES_TO_EXPORT};${HDFEOS_SRC_LIB_TARGET}")
+HDFEOS_SET_LIB_OPTIONS (${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_SRC_LIB_NAME} ${LIB_TYPE})
+
+#-----------------------------------------------------------------------------
+# Add file(s) to CMake Install
+#-----------------------------------------------------------------------------
+IF (NOT HDFEOS_INSTALL_NO_DEVELOPMENT)
+  INSTALL (
+      FILES
+          ${HDFEOS_HEADERS}
+      DESTINATION
+          ${HDFEOS_INSTALL_INCLUDE_DIR}
+      COMPONENT
+          headers
+  )
+ENDIF (NOT HDFEOS_INSTALL_NO_DEVELOPMENT)
+
+#-----------------------------------------------------------------------------
+# Add Target(s) to CMake Install for import into other projects
+#-----------------------------------------------------------------------------
+IF (HDFEOS_EXPORTED_TARGETS)
+
+  INSTALL_TARGET_PDB (${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_INSTALL_LIB_DIR} libraries)
+  
+  INSTALL (
+      TARGETS 
+          ${HDFEOS_SRC_LIB_TARGET}
+      EXPORT
+          ${HDFEOS_EXPORTED_TARGETS}
+      LIBRARY DESTINATION ${HDFEOS_INSTALL_LIB_DIR} COMPONENT libraries 
+      ARCHIVE DESTINATION ${HDFEOS_INSTALL_LIB_DIR} COMPONENT libraries
+      RUNTIME DESTINATION ${HDFEOS_INSTALL_BIN_DIR} COMPONENT libraries
+  )
+ENDIF (HDFEOS_EXPORTED_TARGETS)
diff --git a/src/EHapi.c b/src/EHapi.c
new file mode 100755
index 0000000..46a9b5c
--- /dev/null
+++ b/src/EHapi.c
@@ -0,0 +1,11565 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company      |
+ |                                                                          |
+ |  Permission to use, modify, and distribute this software and its         |
+ |  documentation for any purpose without fee is hereby granted, provided   |
+ |  that the above copyright notice appear in all copies and that both that |
+ |  copyright notice and this permission notice appear in supporting        |
+ |                          documentation.                                  |
+ ----------------------------------------------------------------------------
+*/
+
+#include <HE5_HdfEosDef.h>
+
+/* The modification that needs _IGNORE_DIMSCALE_ preprocessor macro definition.
+ It can be defined somewhere other than in EHapi.c, such as when configure script is executed.
+
+Problem ~
+We want to make existing HDF-EOS5 files read by the netCDF-4 library. Although
+the netCDF-4 library is similar to the HDF-EOS5 library, the netCDF-4 library
+cannot read HDF-EOS5 files mainly due to the lack of netCDF-4 dimensions. 
+So, we added netCDF-4 dimensions to existing HDF-EOS5 files.
+
+Attaching a netCDF-4 dimension scale to an HDF-EOS5 field introduces an
+attribute, "DIMENSION_LIST".  Unfortunately, the type class of "DIMENSION_LIST"
+is H5T_VLEN, and its element is of H5T_STD_REF_OBJ type. This type is not
+allowed by the HDF-EOS5 library; so, users may get errors when accessing
+that attribute. For example, HE5_GDlocattrinfo() fails saying
+
+   Cannot retrieve information about Attribute "DIMENSION_LIST" associated
+   with the "..." field.
+
+Goal ~
+Assuming that users do not have hard-coded list of attributes, they will call
+HE5_GDinqlocattrs() to get the attribute names attached to a field. If
+"DIMENSION_LIST" is not contained in the attribute names, users will not know
+that the problematic "DIMENSION_LIST" attribute exists, which prevents users
+from accessing that attribute.
+
+Implementation Details ~
+HE5_GDinqlocattrs() is the function users call to get the list of attribute
+names. This HE5_GDinqlocattrs() will finally call HE5_EHobj_info() for each 
+attribute, and we modified HE5_EHobj_info() function so that this function 
+ignores an attribute if
+   its class is H5T_VLEN, and
+   its base type is H5T_STD_REF_OBJ
+
+If these two conditions are satisfied, HE5_EHobj_info() will return immediately
+without appending this attribute name to the list of attribute names.
+
+*/
+
+#ifndef _IGNORE_DIMSCALE_
+#define _IGNORE_DIMSCALE_
+#endif
+
+#define HE5_EHIDOFFSET    67108864
+#define HE5_VERSIONLEN          32
+#define HE5_NEOSHDF            200
+#define HE5_DYNAMIC_BLKSIZE    32000 /* size of each Structure 
+					metadata block */
+#define MetaBlocks             32 /* Max number of 32000 Structure 
+				     metadata blocks */
+
+/*int HDFEOS5ver_flg ; *//* will be set to 1 if the HDF-EOS5 version 
+			    is later than 5.1.7, otherwise to 0 */
+/*int     HE5_STATIC_BLKSIZE = HE5_BLKSIZE;*/ /* will be used, after mdifications
+						 in EHopen, for buffer size memory
+						 allocatins of StructMetadata.0 for
+						 static method */
+static int error_flg = 0;
+
+typedef struct
+{
+  int               active;    /*  File open flag   */
+  
+  hid_t             HDFfid;    /*  HDF-EOS file ID  */
+  hid_t             gid;       /* "HDFEOS" group ID */
+  
+  uintn             flags;     /*  File access flag */
+  
+  char              *filename; /*  File name        */
+  int               DYNAMIC_flag; /*  Flage for checking for the compatibality
+				      of StruvtMetadata with the version of
+				      HDF-EOS5 */
+  int               HE5_STATIC_BLKSIZE; /* will be used, after mdifications
+					   in EHopen, for buffer size memory
+					   allocatins of StructMetadata.0 for
+					   static method */
+
+}HE5_EHXTable;
+
+HE5_EHXTable HE5_HeosTable[HE5_NEOSHDF];
+
+typedef struct
+{
+  int               metafile_active;
+  char              *saved_metabuf;
+  long              metabuf_length;
+  long              nmeta;
+  int               metaread_flag;
+}HE5_SAVED_METABUF;
+
+HE5_SAVED_METABUF Stored_meta[HE5_NEOSHDF];
+
+/* FORTRAN WRAPPER PROTOTYPES */
+
+int   
+HE5_EHidinfoF(int fileID, int *fid, int *gid);
+double 
+HE5_EHconvAngF(double inAngle, int code);
+int
+HE5_EHwrglatt(int fileID, char *attrname, int ntype, long fortcount[], void *datbuf);
+int    
+HE5_EHrdglatt(int fileID, char *attrname, void *datbuf);
+int
+HE5_EHglattinf(int fileID, char *attrname, int *ntype, long *fortcount);
+long 
+HE5_EHinqglatts(int fileID, char *attrnames, long *strbufsize);
+int   
+HE5_EHrdwrfileF(char *extfilename, uintn Flags, int ntype, long nelmnts, void *data);
+int
+HE5_EHinqglbtype(int fileID, char *attrname, int *Type, int *Class, int *Order, long *size);
+herr_t 
+HE5_EHinsertmeta_Static(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]);
+herr_t 
+HE5_EHinsertmeta_Dynamic(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]);
+char  *
+HE5_EHmetagroup_Static(hid_t fid , char *structname, char *structcode, char *groupname, char *metaptrs[]);
+char  *
+HE5_EHmetagroup_Dynamic(hid_t fid , char *structname, char *structcode, char *groupname, char *metaptrs[]);
+herr_t
+HE5_EHupdatemeta_Static(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]);
+herr_t
+HE5_EHupdatemeta_Dynamic(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]);
+herr_t HE5_EHgetnmeta(hid_t gid, long *nmeta);
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|  FUNCTION:      HE5_EHchkptr                                                |
+|  DESCRIPTION :  Checks if the passed pointer != NULL                        |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|      p          void *              Pointer                                 |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  05/01/01   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_EHchkptr(void *p, char *name)
+{
+  herr_t   status = SUCCEED;
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];
+  
+  if(p == NULL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"INPUT ERROR: Parameter-pointer %s == NULL.\n", name);
+      H5Epush(__FILE__, "HE5_EHchkptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return(status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|  FUNCTION:      HE5_EHchkname                                               |
+|  DESCRIPTION :  Checks if the passed string doesn't contain illegal         |
+|                                             characters                      |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|      p          void *              Pointer                                 |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  06/01/01   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_EHchkname(char *p, char *name)
+{
+  herr_t   status = SUCCEED;
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];
+ 
+  if(p == NULL)
+    {
+	  status = FAIL;
+	  sprintf(errbuf,"HDF-EOS WARNING: The input parameter \"%s\" is a null pointer.\n", name);
+	  H5Epush(__FILE__, "HE5_EHchkname", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  if( strchr(p,',') || strchr(p,';') || strchr(p,'/') )
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"HDF-EOS WARNING: The input string named \"%s\" contains illegal character.\n", name);
+	  H5Epush(__FILE__, "HE5_EHchkname", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+  
+  return(status);
+}
+ 
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|  FUNCTION: HE5_EHdtype2mtype                                                |
+|  DESCRIPTION : Takes file data type ID, converts it to a memory data type ID|
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      mtype      hid_t               Memory data type ID                     |
+|  INPUTS:                                                                    |
+|      dtype      hid_t               File data type ID                       |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|  NOTES:                                                                     |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  07/12/00   A.Muslimov    Original development.                             |
+|  June 02    S.Zhao        Added an H5T_NATIVE_CHAR data type ID.            |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t 
+HE5_EHdtype2mtype(hid_t dtype)
+{
+  hid_t      mtype   = FAIL;
+  hid_t      nativetype;
+  char       *errbuf = NULL;/* Error message buffer */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char *) calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+	  H5Epush(__FILE__, "HE5_EHdtype2mtype", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+	  HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+	  return(FAIL);
+    }
+
+  nativetype = H5Tget_native_type(dtype, H5T_DIR_ASCEND);
+  /* We cannot return nativetype because the caller will not 
+     call H5Tclose() for it. */
+  if (nativetype == FAIL) 
+    {
+      sprintf(errbuf,"The datatype \"%d\" is not supported (unknown).\n", (int)dtype);
+      H5Epush(__FILE__, "HE5_EHdtype2mtype", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+    }
+  else 
+    {
+      int i;
+      hid_t typelists[] = { H5T_NATIVE_CHAR, H5T_NATIVE_SCHAR, H5T_NATIVE_UCHAR, H5T_NATIVE_SHORT, H5T_NATIVE_USHORT, H5T_NATIVE_INT, H5T_NATIVE_UINT, H5T_NATIVE_LONG, H5T_NATIVE_ULONG, H5T_NATIVE_LLONG, H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE };
+      for (i = 0; i < sizeof(typelists) / sizeof(typelists[0]); ++i) {
+	if (H5Tequal(typelists[i], nativetype) > 0) {
+	  mtype = typelists[i];
+	  break;
+	}
+      }
+      if (mtype == FAIL) {
+	sprintf(errbuf,"The datatype \"%d\" is not supported (unknown).\n", (int)dtype);
+	H5Epush(__FILE__, "HE5_EHdtype2mtype", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      }
+      
+      H5Tclose(nativetype);
+  }
+ 
+  free(errbuf);
+
+  return(mtype);
+}
+
+
+/* Data type WRAPPERS */
+/* ================== */
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|  FUNCTION: HE5_EHhid2long                                                   |
+|  DESCRIPTION : Takes a scalar variable of 'hid_t' type, converts it to a    |
+|                  scalar variable of 'long' type, and returns the value.     |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   long                                                        |
+|  INPUTS:                                                                    |
+|      invalue    hid_t                                                       |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|  NOTES:                                                                     |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_EHhid2long(hid_t invalue)
+{
+  long  outvalue = FAIL;
+  
+  if (sizeof(hid_t) == sizeof(int))
+	outvalue = HE5_EHint2long(invalue);
+  else if (sizeof(hid_t) == sizeof(long))
+	outvalue = invalue;
+  
+  return(outvalue);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHint2long                                                   |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'int' type, converts it to a      |
+|                  scalar variable of 'long' type, and returns the value.     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   long                                                        |
+|  INPUTS:                                                                    |
+|      invalue    int                                                         |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_EHint2long(int invalue)
+{
+  herr_t    status   = FAIL;
+  long      outvalue = FAIL;
+  long      buf      = FAIL;
+
+
+  memmove(&buf,&invalue,sizeof(int));
+
+  status = H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_LONG, 1, &buf, NULL, H5P_DEFAULT);
+  if (status == FAIL)
+	{
+	  H5Epush(__FILE__, "HE5_EHint2long", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"int\" to \"long\" data type.");
+	  return(status);
+	}
+ 
+  memmove(&outvalue,&buf,sizeof(long));
+
+  return(outvalue);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHhid2int                                                    |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'hid_t' type, converts it to a    |
+|                  scalar variable of 'int' type, and returns the value.      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   int                                                         |
+|  INPUTS:                                                                    |
+|      invalue    hid_t                                                       |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_EHhid2int(hid_t invalue)
+{
+  int  outvalue = FAIL;
+  
+  if (sizeof(hid_t) == sizeof(int))
+	outvalue = invalue;
+  else if (sizeof(hid_t) == sizeof(long))
+	outvalue = HE5_EHlong2int(invalue);
+  
+  return(outvalue);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHint2hid                                                    |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'int' type, converts it to a      |
+|                  scalar variable of 'hid_t' type, and returns the value.    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   hid_t                                                       |
+|  INPUTS:                                                                    |
+|      invalue    int                                                         |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t 
+HE5_EHint2hid(int invalue)
+{
+  hid_t  outvalue = FAIL;
+  
+  if (sizeof(hid_t) == sizeof(int))
+	outvalue = invalue;
+  else if (sizeof(hid_t) == sizeof(long))
+	outvalue = HE5_EHint2long(invalue);
+  
+  return(outvalue);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHlong2hid                                                   |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'long' type, converts it to a     |
+|                  scalar variable of 'hid_t' type, and returns the value.    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   hid_t                                                       |
+|  INPUTS:                                                                    |
+|      invalue    long                                                        |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t 
+HE5_EHlong2hid(long invalue)
+{
+  hid_t  outvalue = FAIL;
+  
+  if (sizeof(hid_t) == sizeof(int))
+	outvalue = HE5_EHlong2int(invalue);
+  else if (sizeof(hid_t) == sizeof(long))
+	outvalue = invalue;
+  
+  return(outvalue);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHlong2int                                                   |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'long' type, converts it to a     |
+|                  scalar variable of 'int' type, and returns the value.      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   int                                                         |
+|  INPUTS:                                                                    |
+|      invalue    long                                                        |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int     					    
+HE5_EHlong2int(long invalue)
+{
+  
+  herr_t                  status   = FAIL;
+  
+  int                     outvalue = FAIL;
+
+  long                    *buf     = (long *)NULL;
+
+  
+  buf = (long *)calloc(1,sizeof(long));
+		   
+  memmove(buf,&invalue,sizeof(long));
+				 
+  status = H5Tconvert(H5T_NATIVE_LONG, H5T_NATIVE_INT, 1, buf, NULL, H5P_DEFAULT);
+  if (status == FAIL)
+	{
+	  H5Epush(__FILE__, "HE5_EHlong2int", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"long\" to \"int\" data type.");
+	  return(status);
+	}
+				 
+  memmove(&outvalue,buf,sizeof(int));
+				 
+  free(buf);
+	  
+  return(outvalue);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHhid2hsize                                                  |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'hid_t' type, converts it to a    |
+|                  scalar variable of 'hsize_t' type, and returns the value.  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   hsize_t                                                     |
+|  INPUTS:                                                                    |
+|      invalue    hid_t                                                       |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hsize_t 
+HE5_EHhid2hsize(hid_t invalue)
+{
+  hsize_t  outvalue = 0;
+  
+  if (sizeof(hid_t) == sizeof(int))
+	outvalue = HE5_EHint2hsize(invalue);
+  else if (sizeof(hid_t) == sizeof(long) )
+	outvalue = HE5_EHlong2hsize(invalue);
+
+  return(outvalue);  
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHint2hsize                                                  |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'int' type, converts it to a      |
+|                  scalar variable of 'hsize_t' type, and returns the value.  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   hsize_t                                                     |
+|  INPUTS:                                                                    |
+|      invalue    int                                                         |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hsize_t      					    
+HE5_EHint2hsize(int invalue)
+{
+  
+  herr_t   status       = FAIL;
+	
+  int      *buf         = (int *)NULL;
+
+  hsize_t  outvalue     = 0;
+
+  size_t   maxsize      = 0;
+
+  maxsize = MAX(sizeof(int),H5Tget_size(H5T_NATIVE_HSIZE));
+
+  buf = (int *)calloc(1,maxsize);
+
+  memmove(buf,&invalue, sizeof(int));
+				 
+  status = H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_HSIZE, 1, buf, NULL, H5P_DEFAULT);
+  if (status == FAIL)
+	{
+	  H5Epush(__FILE__, "HE5_EHint2hsize", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"int\" to \"hsize_t\" data type.");
+	  return(status);
+	}
+				 
+  memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_HSIZE));
+
+  free(buf);
+	  
+  return(outvalue);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHlong2hsize                                                 |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'long' type, converts it to a     |
+|                  scalar variable of 'hsize_t' type, and returns the value.  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   hsize_t                                                     |
+|  INPUTS:                                                                    |
+|      invalue    long                                                        |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hsize_t       					    
+HE5_EHlong2hsize(long invalue)
+{
+  
+  herr_t   status       = FAIL;
+
+  long     *buf         = (long *)NULL;
+
+  hsize_t  outvalue     = 0;
+
+  size_t   maxsize      = 0;
+
+  maxsize = MAX(H5Tget_size(H5T_NATIVE_LONG),H5Tget_size(H5T_NATIVE_HSIZE));
+
+  buf = (long *)calloc(1,maxsize);
+
+  memmove(buf,&invalue,sizeof(long));
+				 
+  status = H5Tconvert(H5T_NATIVE_LONG, H5T_NATIVE_HSIZE, 1, buf, NULL, H5P_DEFAULT);
+  if (status == FAIL)
+	{
+	  H5Epush(__FILE__, "HE5_EHlong2hsize", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"long\" to \"hsize_t\" data type.");
+	  return(status);
+	}
+				 
+  memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_HSIZE));
+	 
+  free(buf);
+ 
+	  
+  return(outvalue);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHhsize2hid                                                  |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'hsize_t' type, converts it to a  |
+|                  scalar variable of 'hid_t' type, and returns the value.    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   hid_t                                                       |
+|  INPUTS:                                                                    |
+|      invalue    hsize_t                                                     |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t      					    
+HE5_EHhsize2hid(hsize_t invalue)
+{
+  hid_t  outvalue = FAIL;
+  
+  if (sizeof(hid_t) == sizeof(int))
+	outvalue = HE5_EHhsize2int(invalue);
+  else if (sizeof(hid_t) == sizeof(long) )
+	outvalue = HE5_EHhsize2long(invalue);
+
+  return(outvalue);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHhsize2long                                                 |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'hsize_t' type, converts it to a  |
+|                  scalar variable of 'long'  type, and returns the value.    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   long                                                        |
+|  INPUTS:                                                                    |
+|      invalue    hsize_t                                                     |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_EHhsize2long(hsize_t invalue)
+{
+  
+  herr_t   status       = FAIL;
+  
+  long     *buf         = (long *)NULL;
+  long     outvalue     = FAIL;
+
+  size_t   maxsize      = 0;
+
+
+  maxsize = MAX(H5Tget_size(H5T_NATIVE_LONG),H5Tget_size(H5T_NATIVE_HSIZE));
+
+  buf = (long *)calloc(1,maxsize);
+
+  memmove(buf,&invalue,H5Tget_size(H5T_NATIVE_HSIZE));
+				 
+  status = H5Tconvert(H5T_NATIVE_HSIZE, H5T_NATIVE_LONG, 1, buf, NULL, H5P_DEFAULT);
+  if (status == FAIL)
+	{
+	  H5Epush(__FILE__, "HE5_EHhsize2long", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"hsize_t\" to \"long\" data type.");
+	  return(status);
+	}
+				 
+  memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_LONG));
+  
+  free(buf);
+	  
+  return(outvalue);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHhsize2int                                                  |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'hsize_t' type, converts it to a  |
+|                  scalar variable of 'int'  type,  and returns the value.    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   int                                                         |
+|  INPUTS:                                                                    |
+|      invalue    hsize_t                                                     |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_EHhsize2int(hsize_t invalue)
+{
+  
+  herr_t  status       = FAIL;
+
+  int     *buf         = (int *)NULL;
+  int     outvalue     = FAIL;
+
+  size_t  maxsize      = 0;
+
+  maxsize = MAX(H5Tget_size(H5T_NATIVE_INT),H5Tget_size(H5T_NATIVE_HSIZE));
+
+  buf = (int *)calloc(1,maxsize);
+
+  memmove(buf,&invalue,H5Tget_size(H5T_NATIVE_HSIZE));
+				 
+  status = H5Tconvert(H5T_NATIVE_HSIZE, H5T_NATIVE_INT, 1, buf, NULL, H5P_DEFAULT);
+  if (status == FAIL)
+	{
+	  H5Epush(__FILE__, "HE5_EHhsize2int", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"hsize_t\" to \"int\" data type.");
+	  return(status);
+	}
+				 
+  memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_INT));
+	 
+  free(buf);
+	  
+  return(outvalue);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHhid2hssize                                                 |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'hid_t' type, converts it to a    |
+|                  scalar variable of 'hssize_t' type, and returns the value. |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   hssize_t                                                    |
+|  INPUTS:                                                                    |
+|      invalue    hid_t                                                       |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hssize_t      					    
+HE5_EHhid2hssize(hid_t invalue)
+{
+
+  hssize_t  outvalue    = FAIL;
+  
+  if (sizeof(hid_t) == sizeof(int))
+	outvalue = HE5_EHint2hssize(invalue);
+  else if (sizeof(hid_t) == sizeof(long) )
+	outvalue = HE5_EHlong2hssize(invalue);
+
+  return(outvalue);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHint2hssize                                                 |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'int' type, converts it to a      |
+|                  scalar variable of 'hssize_t' type, and returns the value. |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   hssize_t                                                    |
+|  INPUTS:                                                                    |
+|      invalue    int                                                         |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hssize_t      					    
+HE5_EHint2hssize(int invalue)
+{
+  herr_t   status      = FAIL;
+  
+  int      *buf        = (int *)NULL;
+  
+  hssize_t outvalue    = FAIL;
+  
+  size_t   maxsize     = 0;   
+
+
+  maxsize = MAX(sizeof(int),H5Tget_size(H5T_NATIVE_HSSIZE));
+
+  buf = (int *)calloc(1,maxsize);
+  
+  memmove(buf,&invalue, sizeof(int));
+  
+  status = H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_HSSIZE, 1, buf, NULL, H5P_DEFAULT);
+  if (status == FAIL)
+	{
+	  H5Epush(__FILE__, "HE5_EHint2hssize", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"int\" to \"hssize\" data type.");
+	  return(status);
+	}
+  
+  memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_HSSIZE));
+  
+  free(buf);
+  
+  return(outvalue);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHlong2hssize                                                |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'int' type, converts it to a      |
+|                  scalar variable of 'hssize_t' type, and returns the value. |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   hssize_t                                                    |
+|  INPUTS:                                                                    |
+|      invalue    long                                                        |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hssize_t
+HE5_EHlong2hssize(long invalue)
+{
+  
+  herr_t   status      = FAIL;
+
+  long     *buf        = (long *)NULL;
+
+  hssize_t outvalue    = FAIL;
+
+  size_t   maxsize     = 0; 
+
+  maxsize = MAX(sizeof(long),H5Tget_size(H5T_NATIVE_HSSIZE));
+
+  buf = (long *)calloc(1,maxsize);
+
+  memmove(buf,&invalue,sizeof(long));
+				 
+  status = H5Tconvert(H5T_NATIVE_LONG, H5T_NATIVE_HSSIZE, 1, buf, NULL, H5P_DEFAULT);
+  if (status == FAIL)
+	{
+	  H5Epush(__FILE__, "HE5_EHint2ullong", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"long\" to \"hssize_t\" data type.");
+	  return(status);
+	}
+				 
+  memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_HSSIZE));
+	 
+  free(buf);
+	  
+  return(outvalue);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHhssize2hid                                                 |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'hsize_t' type, converts it to a  |
+|                  scalar variable of 'hid_t' type, and returns the value.    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   hid_t                                                       |
+|  INPUTS:                                                                    |
+|      invalue    hssize_t                                                    |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t      					    
+HE5_EHhssize2hid(hssize_t invalue)
+{
+  hid_t  outvalue = FAIL;
+  
+  if (sizeof(hid_t) == sizeof(int))
+	outvalue = HE5_EHhssize2int(invalue);
+  else if (sizeof(hid_t) == sizeof(long) )
+	outvalue = HE5_EHhssize2long(invalue);
+  
+  return(outvalue);  
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHhssize2long                                                |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'hsize_t' type, converts it to a  |
+|                  scalar variable of 'long' type, and returns the value.     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   long                                                        |
+|  INPUTS:                                                                    |
+|      invalue    hssize_t                                                    |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_EHhssize2long(hssize_t invalue)
+{
+  
+  herr_t   status       = FAIL;
+
+  long     *buf         = (long *)NULL;
+  long     outvalue     = FAIL;
+
+  size_t   maxsize      = 0;
+
+  maxsize = MAX(H5Tget_size(H5T_NATIVE_LONG),H5Tget_size(H5T_NATIVE_HSSIZE));
+
+  buf = (long *)calloc(1,maxsize);
+
+  memmove(buf,&invalue,H5Tget_size(H5T_NATIVE_HSSIZE));
+				 
+  status = H5Tconvert(H5T_NATIVE_HSSIZE, H5T_NATIVE_LONG, 1, buf, NULL, H5P_DEFAULT);
+  if (status == FAIL)
+	{
+	  H5Epush(__FILE__, "HE5_EHhssize2long", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"hssize_t\" to \"long\" data type.");
+	  return(status);
+	}
+				 
+  memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_LONG));
+	 
+  free(buf);
+	  
+  return(outvalue);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHhssize2int                                                 |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'hsize_t' type, converts it to a  |
+|                  scalar variable of 'int' type, and returns the value.      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   int                                                         |
+|  INPUTS:                                                                    |
+|      invalue    hssize_t                                                    |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_EHhssize2int(hssize_t invalue)
+{
+  
+  herr_t  status       = FAIL;
+
+  int     *buf         = (int *)NULL;
+  int     outvalue     = FAIL;
+
+  size_t  maxsize      = 0;
+
+  maxsize = MAX(H5Tget_size(H5T_NATIVE_INT),H5Tget_size(H5T_NATIVE_HSSIZE));
+
+  buf = (int *)calloc(1,maxsize);
+
+  memmove(buf,&invalue,H5Tget_size(H5T_NATIVE_HSSIZE));
+				 
+  status = H5Tconvert(H5T_NATIVE_HSSIZE, H5T_NATIVE_INT, 1, buf, NULL, H5P_DEFAULT);
+  if (status == FAIL)
+	{
+	  H5Epush(__FILE__, "HE5_EHhssize2int", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"hssize_t\" to \"int\" data type.");
+	  return(status);
+	}
+				 
+  memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_INT));
+	 
+  free(buf);
+	  
+  return(outvalue);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHint2ullong                                                 |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'int' type, converts it to a      |
+|                  scalar variable of 'ullong' type, and returns the value.   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   ullong                                                      |
+|  INPUTS:                                                                    |
+|      invalue    int                                                         |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  Sept. 04   S.Zhao        Changed "long long" to "LONGLONG" for Windows.    |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+unsigned LONGLONG
+HE5_EHint2ullong(int invalue)
+{
+
+  herr_t              status   = FAIL;
+  unsigned LONGLONG   outvalue = 0;
+  unsigned LONGLONG   buf      = 0;
+
+  memmove(&buf,&invalue,sizeof(int));
+  
+  status = H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_ULLONG, 1, &buf, NULL, H5P_DEFAULT);
+  if (status == FAIL)
+	{
+	  H5Epush(__FILE__, "HE5_EHint2ullong", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"int\" to \"unsigned long long\" data type.");
+	  return(status);
+	}
+
+  memmove(&outvalue,&buf,sizeof(unsigned LONGLONG));
+
+  return(outvalue);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHullong2long                                                |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'ullong' type, converts it to a   |
+|                  scalar variable of 'long' type, and returns the value.     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   long                                                        |
+|  INPUTS:                                                                    |
+|      invalue    ullong                                                      |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  Sept. 04   S.Zhao        Changed "long long" to "LONGLONG" for Windows.    |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_EHullong2long(unsigned LONGLONG invalue)
+{
+
+  herr_t                  status   = FAIL;
+
+  long                    outvalue = FAIL;
+  long                    *buf     =  (long *)NULL;
+
+  size_t                  maxsize  = 0;
+
+  maxsize = MAX(sizeof(unsigned LONGLONG),sizeof(long));
+
+  buf = (long *)calloc(1,maxsize);
+
+  memmove(buf,&invalue,sizeof(unsigned LONGLONG));
+
+  status = H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_LONG, 1, buf, NULL, H5P_DEFAULT);
+  if (status == FAIL)
+	{
+	  H5Epush(__FILE__, "HE5_EHullong2long", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"unsigned long long\" to \"long\" data type.");
+	  return(status);
+	}
+  
+  memmove(&outvalue,buf,sizeof(long));
+
+  free(buf);
+
+  return(outvalue);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHhssize2hsize                                               |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'hssize_t' type, converts it to a |
+|                  scalar variable of 'hsize_t' type, and returns the value.  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   hsize_t                                                     |
+|  INPUTS:                                                                    |
+|      invalue    hssize_t                                                    |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  Sept. 04   S.Zhao        Changed "long long" to "LONGLONG" for Windows.    |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hsize_t  
+HE5_EHhssize2hsize(hssize_t invalue)
+{
+  
+  herr_t     status       = FAIL;
+
+  LONGLONG   *buf         = (LONGLONG *)NULL;
+
+  hsize_t    outvalue     = 0;
+
+  size_t     maxsize      = 0;
+
+  maxsize = MAX(H5Tget_size(H5T_NATIVE_HSIZE),H5Tget_size(H5T_NATIVE_HSSIZE));
+
+  buf = (LONGLONG *)calloc(1,maxsize);
+
+  memmove(buf,&invalue,H5Tget_size(H5T_NATIVE_HSSIZE));
+				 
+  status = H5Tconvert(H5T_NATIVE_HSSIZE, H5T_NATIVE_HSIZE, 1, buf, NULL, H5P_DEFAULT);
+  if (status == FAIL)
+	{
+	  H5Epush(__FILE__, "HE5_EHhssize2hsize", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"hssize_t\" to \"hsize\" data type.");
+	  return(status);
+	}
+				 
+  memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_HSIZE));
+	 
+  free(buf);
+	  
+  return(outvalue);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHhsize2hssize                                               |
+|                                                                             |
+|  DESCRIPTION : Takes a scalar variable of 'hsize_t' type, converts it to a  |
+|                  scalar variable of 'hssize_t' type, and returns the value. |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|      outvalue   hssize_t                                                    |
+|  INPUTS:                                                                    |
+|      invalue    hsize_t                                                     |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ================================================= |
+|  04/25/00   A.Muslimov    Original development.                             |
+|  Sept. 04   S.Zhao        Changed "long long" to "LONGLONG" for Windows.    |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hssize_t  
+HE5_EHhsize2hssize(hsize_t invalue)
+{
+  
+  herr_t     status     = FAIL;
+
+  LONGLONG   *buf       = (LONGLONG *)NULL;
+
+  hssize_t   outvalue   = FAIL;
+
+  size_t     maxsize    = 0;
+
+  maxsize = MAX(H5Tget_size(H5T_NATIVE_HSIZE),H5Tget_size(H5T_NATIVE_HSSIZE));
+
+  buf = (LONGLONG *)calloc(1,maxsize);
+
+  memmove(buf,&invalue,H5Tget_size(H5T_NATIVE_HSIZE));
+				 
+  status = H5Tconvert(H5T_NATIVE_HSIZE, H5T_NATIVE_HSSIZE, 1, buf, NULL, H5P_DEFAULT);
+  if (status == FAIL)
+	{
+	  H5Epush(__FILE__, "HE5_EHhsize2hssize", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"hsize_t\" to \"hssize\" data type.");
+	  return(status);
+	}
+				 
+  memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_HSSIZE));
+	 
+  free(buf);
+	  
+  return(outvalue);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHopen                                                       |
+|                                                                             |
+|  DESCRIPTION: opens HDF-EOS file and returns file handle                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  fid            hid_t   None        HDF-EOS file ID                         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  filename       char*   None        HDF-EOS file name string                |
+|                                                                             |
+|  flags          uintn   None        File access Flag                        |
+|                                                                             |
+|                 valid flags:        H5F_ACC_RDONLY                          |
+|                                     H5F_ACC_RDWR                            |
+|                                     H5F_ACC_TRUNC                           |
+|                                                                             |
+|                                                                             |
+|  access_id      hid_t   None        File access property list ID (or        |
+|                                     H5P_DEFAULT for the default I/O access  |
+|                                     parameters.                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:    The dataset StructMetadata is not extandible. The next release   |
+|            (V5.?)  will be supporting 'variable-length strings'.            |
+|                                                                             |
+|                                -----------                                  |
+|                               | Root "/"  |                                 |
+|                                -----------                                  |
+|                               /           \                                 |
+|               ----------------------    --------------------                |
+|               | HDFEOS INFORMATION |    |      HDFEOS      |                |
+|               ----------------------    --------------------                |
+|               /            |            /   / \   \       \                 |
+|              /             |           /   /   \   \       \                |
+|    <HDFEOSVersion> [StructMetadata.0] /   /     \   \       \               |
+|                                      /   |       |   \       \              |
+|                            ----------  ------ ------- ------- --------      |
+|                           |ADDITIONAL| |GRID| |POINT| |SWATH| |  ZA  |      |
+|                            ----------  ------ ------- ------- --------      |
+|                                /         :       :        :       :         |
+|                               /        [dts]   [dts]    [dts]   [dts]       |
+|                      -----------------                                      |
+|                      |FILE_ATTRIBUTES|                                      |
+|                      -----------------                                      |
+|                             :                                               |
+|                          <attrs>                                            |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  July 99  A.Muslimov    Modified to conform to the HDFEOS file structure    |
+|  07.15.99  A.Muslimov   Implemented creating of two separate groups HDFEOS, |
+|                         and HDFEOS INFORMATION. Added the calls to H5Tcopy  |
+|                         and H5Tset_size(). Modified a block "Create dataset |
+|                         StructMetadata.0 ... " to allocate memory for the   |
+|                         BLKSIZE elements of metabuf array.                  |
+|  9/24/99   A.Muslimov   Added some more error handling after function calls.|
+|  02/07/00  A.Muslimov   Added error handling after function calls and       |
+|                           "free(errbuf)".                                   |
+|  May 01    A.Muslimov   Added "ADDITIONAL/FILE_ATTRIBUTES" group.           |
+|  Nov 01    A.Muslimov   Changed the data space/datatype of Version attribute|
+|                          Retaylored the OPEN/CREATE blocks.                 |
+|  Jun 02    S.Zhao       Added some warnings for "ADDITIONAL/FILE_ATTRIBUTES"|
+|                         groups.                                             |
+|  05/17/04  Abe Taaheri  Modified to adopt alocation of metabuf in chunks of |
+|                         HE5_DYNAMIC_BLKSIZE                                 |
+|  Nov 04    S.Zhao       Modified to save tsize in HE5_HeosTable[HE5_NEOSHDF]|
+|  Sep 06    Abe Taaheri  Added initialize of hdfeosVersion                   |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t
+HE5_EHopen(const char *filename, uintn flags,  hid_t access_id)
+{
+  hid_t           fid       = FAIL;/* HDF-EOS file ID (RETURN VALUE)     */
+  hid_t           HDFfid    = FAIL;/* HDF file ID                        */
+  hid_t           sid1      = FAIL;/* Data space ID                      */
+  hid_t           sid2      = FAIL;/* Data space ID                      */
+  hid_t           atype     = FAIL;/* Data type ID                       */
+  hid_t           attid     = FAIL;/* "HDFEOSVersion" Attribute ID       */
+  hid_t           datid     = FAIL;/* "StructuralMetadata.0" dataset ID  */
+  hid_t           gid       = FAIL;/* "HDFEOS" group ID                  */
+  hid_t           ggid      = FAIL;/* "HDFEOS INFORMATION" group ID      */
+  hid_t           adid      = FAIL;/* "ADDITIONAL" group ID              */
+  hid_t           fagid     = FAIL;/* "FILE_ATTRIBUTES" group ID         */
+  hid_t           i;		   /* Loop index                         */
+  hid_t           iver;		   /* Loop index                         */
+  herr_t          status    = FAIL;/* Status variable                    */
+
+  int             nfileopen =  0;  /* "Number of files opened" Flag      */
+
+  size_t          size      =  0;               /* Data size (bytes)     */
+
+  char            *errbuf   = (char *)NULL;	    /* Error message buffer  */
+  char            *metabuf  = (char *)NULL;	    /* Pointer to SM buffer  */
+  char            hdfeosVersion[HE5_VERSIONLEN];/* HDFEOS version string */
+  char            *version_buf = NULL;
+  char            version_buf1[13];
+  size_t          tsize     = 0;   /* size of dataset                       */
+  int             HDFEOS5ver_flg ; /* will be set to 1 if the HDF-EOS5 version 
+				      is later than 5.1.7, otherwise to 0 */
+  int             newfile_num;
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+	  H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+	  HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+	  return(FAIL);
+    }
+
+  for (i = 0; i < HE5_NEOSHDF; i++)
+    {
+          if (HE5_HeosTable[i].active == 0)
+             Stored_meta[i].metaread_flag = 0;
+    }
+
+  /* Determine number of files currently opened */
+  /* ------------------------------------------ */
+  for (i = 0; i < HE5_NEOSHDF; i++)
+	nfileopen += HE5_HeosTable[i].active;
+
+  /* Setup file interface */
+  /* -------------------- */
+  if (nfileopen < HE5_NEOSHDF)
+    {
+      /* Open HDF-EOS file */
+      /* ================= */
+      if (flags == H5F_ACC_RDWR || flags == H5F_ACC_RDONLY)
+	{
+	  H5Eset_auto(NULL,NULL);
+	  HDFfid = H5Fopen(filename, flags, access_id);
+	  if(HDFfid < 0)
+	    {
+	      sprintf(errbuf,"File \"%s\" cannot be opened. \n", filename);  
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	}
+      else if (flags == H5F_ACC_TRUNC)
+	{
+	  /* H5Eset_auto(NULL,NULL); */
+	  HDFfid = H5Fcreate(filename,flags,H5P_DEFAULT,H5P_DEFAULT);
+	  if(HDFfid < 0)
+	    {
+	      sprintf(errbuf,"File \"%s\" cannot be created. \n", filename);  
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_FILE,H5E_CANTCREATE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	}
+      else 
+	{
+	  sprintf(errbuf,"Invalid file access flag. \n");  
+	  H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_FILE,H5E_CANTOPENFILE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);		  
+	}
+      
+      if(flags == H5F_ACC_RDONLY ) 
+	{
+	  /* open group "HDFEOS" */ 
+	  /* =================== */ 
+	  gid = H5Gopen(HDFfid, "HDFEOS");
+	  if(gid < 0)
+	    {
+	      sprintf(errbuf, "Group \"HDFEOS\" does not exist in \"%s\" file. \n", filename);
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	  
+	  /* open group "ADDITIONAL" */ 
+	  /* ======================= */  
+	  adid = H5Gopen(gid, "ADDITIONAL");
+	  if(adid < 0)
+	    {
+	      sprintf(errbuf, "Warning: Group \"ADDITIONAL\" does not exist in \"%s\" file, the hdfeos5 files produced by hdfeos5.0 or an earlier version. \n", filename);
+	      printf("Warning: Group \"ADDITIONAL\" does not exist in \"%s\" file, the hdfeos5 files produced by hdfeos5.0 or an earlier version. \n", filename);
+	      
+	    }
+	  else if(adid > 0)
+	    {
+	      
+	      /* open group "FILE_ATTRIBUTES" */ 
+	      /* ============================ */ 
+	      fagid = H5Gopen(adid, "FILE_ATTRIBUTES");
+	      if(fagid < 0)
+		{
+		  sprintf(errbuf, "Warning: Group \"FILE_ATTRIBUTES\" does not exist in \"%s\" file. \n", filename);
+		  H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  return(FAIL);
+		} 
+	    }
+	  
+	  /* open group "HDFEOS INFORMATION" */ 
+	  /* =============================== */ 
+	  ggid = H5Gopen(HDFfid,"HDFEOS INFORMATION");
+	  if(ggid < 0)
+	    {
+	      sprintf(errbuf, "Group \"HDFEOS INFORMATION\" does not exist in \"%s\" file. \n", filename);
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    } 
+	}
+      else if (flags == H5F_ACC_RDWR)
+	{
+	  /* open group "HDFEOS" */
+	  /* =================== */
+	  gid = H5Gopen(HDFfid, "HDFEOS");
+	  if(gid < 0)
+	    {
+	      sprintf(errbuf, "Group \"HDFEOS\" does not exist in \"%s\" file. \n", filename);
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	  
+	  /* open group "ADDITIONAL" */
+	  /* ======================= */
+	  adid = H5Gopen(gid, "ADDITIONAL");
+	  if(adid < 0)
+	    {
+	      sprintf(errbuf, "Warning: Group \"ADDITIONAL\" does not exist in \"%s\" file, need to create it. \n", filename);
+	      printf("Warning: Group \"ADDITIONAL\" does not exist in \"%s\" file, need to create it. \n", filename);
+	      
+	      /* Create a group "ADDITIONAL" */
+	      /* =========================== */
+	      adid = H5Gcreate(gid, "ADDITIONAL", 0);
+	      if (adid < 0)
+		{
+		  sprintf(errbuf, "Cannot create \"ADDITIONAL\" group. \n");
+		  H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  return(FAIL);
+		}
+	    }
+	  
+	  /* open group "FILE_ATTRIBUTES" */
+	  /* ============================ */
+	  fagid = H5Gopen(adid, "FILE_ATTRIBUTES");
+	  if(fagid < 0)
+	    {
+	      sprintf(errbuf, "Group \"FILE_ATTRIBUTES\" does not exist in \"%s\" file, need to create it. \n", filename);
+	      printf("Warning: Group \"FILE_ATTRIBUTES\" does not exist in \"%s\" file, need to create it. \n", filename);
+	      
+	      /* Create a group "FILE_ATTRIBUTES" */
+	      /* ================================ */
+	      fagid = H5Gcreate(adid, "FILE_ATTRIBUTES", 0);
+	      if (fagid < 0)
+		{
+		  sprintf(errbuf, "Cannot create \"FILE_ATTRIBUTES\" group. \n");
+		  H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  return(FAIL);
+		}
+	    }
+	  
+	  /* open group "HDFEOS INFORMATION" */
+	  /* =============================== */
+	  ggid = H5Gopen(HDFfid,"HDFEOS INFORMATION");
+	  if(ggid < 0)
+	    {
+	      sprintf(errbuf, "Group \"HDFEOS INFORMATION\" does not exist in \"%s\" file. \n", filename)
+		;
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	}
+      else if (flags == H5F_ACC_TRUNC)
+	{
+	  /* Create a group "HDFEOS" */
+	  /* ======================= */
+	  gid = H5Gcreate(HDFfid, "HDFEOS", 0);
+	  if (gid < 0)
+	    {
+	      sprintf(errbuf, "Cannot create \"HDFEOS\" group. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	  
+	  /* Create a group "ADDITIONAL" */
+	  /* =========================== */
+	  adid = H5Gcreate(gid, "ADDITIONAL", 0);
+	  if (adid < 0)
+	    {
+	      sprintf(errbuf, "Cannot create \"ADDITIONAL\" group. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	  
+	  /* Create a group "FILE_ATTRIBUTES" */
+	  /* ================================ */
+	  fagid = H5Gcreate(adid, "FILE_ATTRIBUTES", 0);
+	  if (fagid < 0)
+	    {
+	      sprintf(errbuf, "Cannot create \"FILE_ATTRIBUTES\" group. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	  
+	  /* Create a group "HDFEOS INFORMATION" */
+	  /* =================================== */
+	  ggid = H5Gcreate(HDFfid, "HDFEOS INFORMATION", 0);
+	  if (ggid == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot create \"HDFEOS INFORMATION\" group. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	  
+	  /* Initialize hdfeosVersion */
+	  
+	  for( iver=0; iver < HE5_VERSIONLEN; iver++)
+	    hdfeosVersion[iver]='\0';
+	  
+
+	  /* Set HDFEOS version number in file */
+	  /* ================================= */ 
+	  sprintf(hdfeosVersion, "%s.%s", "HDFEOS_5", HE5_HDFEOSVERSION); 
+	  
+	  /* create attribute "HDFEOSVersion" under "HDFEOS INFORMATION */
+	  /* ========================================================== */
+	  sid1 = H5Screate(H5S_SCALAR); 
+	  if (sid1 == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot create dataspace for \"HDFEOSVersion\" attribute. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	  
+	  atype = H5Tcopy(H5T_C_S1);
+	  status = H5Tset_size(atype,HE5_VERSIONLEN);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the total size for atomic datatype. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATATYPE, H5E_CANTCREATE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	  
+	  
+	  /* Set up "HDFEOSVersion" attribute */
+	  /* -------------------------------- */
+	  attid = H5Acreate(ggid, "HDFEOSVersion", atype, sid1, H5P_DEFAULT); 
+	  if (attid == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot create \"HDFEOSVersion\" attribute. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_ATTR, H5E_CANTCREATE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	  
+	  /* Write attribute */
+	  /* --------------- */
+	  status = H5Awrite(attid, atype, hdfeosVersion); 
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot write in data to the \"HDFEOSVerion\" attribute. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);  
+	      return(FAIL);
+	    }
+	  
+	  /*
+           ******************************* 
+	   *  Setup Structural Metadata  *
+	   *******************************
+	   */
+	  metabuf = (char *)calloc(HE5_DYNAMIC_BLKSIZE, sizeof(char ));
+	  if (metabuf == NULL)
+	    {
+	      sprintf(errbuf, "Cannot allocate memory for the metadata buffer. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      
+	      return(FAIL);
+	    }
+	  
+	  strcpy(metabuf, "GROUP=SwathStructure\n");
+	  strcat(metabuf, "END_GROUP=SwathStructure\n");
+	  strcat(metabuf, "GROUP=GridStructure\n");
+	  strcat(metabuf, "END_GROUP=GridStructure\n");
+	  strcat(metabuf, "GROUP=PointStructure\n");
+	  strcat(metabuf, "END_GROUP=PointStructure\n");
+	  strcat(metabuf, "GROUP=ZaStructure\n");
+	  strcat(metabuf, "END_GROUP=ZaStructure\n");
+	  strcat(metabuf, "END\n");
+	  
+	  /* 
+	     -----------------------------------------------
+	    | Create dataset "StructMetadata.0" and attach |
+	    |    it to the "HDFEOS INFORMATION"  group     | 
+	     ------------------------------------------------
+	  */
+	  
+	  /* metalen = strlen(metabuf) + 1; */
+	  /* Create dataspace */
+	  /* ---------------- */
+	  sid2    = H5Screate(H5S_SCALAR);
+	  if (sid2 == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot create dataspace for \"StructMetadata.0\" dataset. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(metabuf);
+	      return(FAIL);
+	    }
+	  
+	  atype   = H5Tcopy(H5T_C_S1);
+	  
+	  /* size    = metalen; */
+	  size    = HE5_DYNAMIC_BLKSIZE;		  
+	  /* Set data type size */
+	  /* ------------------ */
+	  status  = H5Tset_size(atype,size);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the total size for atomic datatype. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATATYPE, H5E_CANTCREATE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(metabuf);
+	      return(FAIL);
+	    }
+	  
+	  metabuf[ HE5_DYNAMIC_BLKSIZE - 1 ] = '\0';
+	  
+	  /* Create "StructMetadata" dataset */
+	  /* ------------------------------- */
+	  datid   = H5Dcreate(ggid,"StructMetadata.0", atype, sid2, H5P_DEFAULT);
+	  if (datid == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot create \"StructMetadata.0\" dataset. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASET, H5E_CANTCREATE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(metabuf);			  
+	      return(FAIL);
+	    }
+	  
+	  /* ----------------------------------------------------------- */
+	  /* ! The dataset extension for a string is not supported yet ! */
+	  /*    the corresponding call is  H5Dextend(datid, &metalen);   */
+	  /* ----------------------------------------------------------- */ 
+	  
+	  
+	  /* 
+	     -------------------------------------
+	     |  Write data to "StructMetadata.0" | 
+	     -------------------------------------
+	  */      
+	  status = H5Dwrite(datid,atype,H5S_ALL,H5S_ALL,H5P_DEFAULT,metabuf);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot write in data to the \"StructMetadata.0\" dataset. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(metabuf);			  
+	      return(FAIL);
+	    }		  
+	  
+	  free(metabuf);
+	  
+	  /* Release IDs */
+	  /* ----------- */
+	  status = H5Sclose(sid1);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataspace ID. \n");
+	      H5Epush(__FILE__, "HE5_HE5_EHopen", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	  status = H5Aclose(attid);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the attribute ID. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_ATTR, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	  status = H5Sclose(sid2);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataspace ID. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);			  
+	      return(FAIL);
+	    }
+	  status = H5Dclose(datid);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	}
+      
+      /* Close "HDFEOS INFORMATION" group */
+      /* -------------------------------- */
+      status = H5Gclose(ggid);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the \"HDFEOS INFORMATION\" group ID. \n");
+	  H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}	  
+      
+      /* Close "ADDITIONAL" group */
+      /* ------------------------ */
+      status = H5Gclose(adid);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the \"ADDITIONAL\" group ID. \n");
+	  /*
+	    H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);		  
+	    return(FAIL);
+	  */
+	}
+      
+      /* Close "FILE_ATTRIBUTES" group */
+      /* ----------------------------- */
+      status = H5Gclose(fagid);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the \"FILE_ATTRIBUTES\" group ID. \n");
+	  /*
+	    H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);		  
+	    return(FAIL);
+	  */
+	}
+      
+      
+      /* Assign HDFEOS fid # & Load HDF fid tables */
+      /* ========================================= */
+      for (i = 0; i < HE5_NEOSHDF; i++)
+	{
+	  if (HE5_HeosTable[i].active == 0)
+	    {
+	      HE5_HeosTable[i].flags           = flags;
+	      HE5_HeosTable[i].active          = 1;
+	      HE5_HeosTable[i].gid             = gid;
+	      HE5_HeosTable[i].HDFfid          = HDFfid;
+	      fid                              = i + HE5_EHIDOFFSET;
+	      HE5_HeosTable[i].filename = (char *)calloc((strlen(filename)+1), sizeof(char));
+	      if (HE5_HeosTable[i].filename == NULL)
+		{
+		  sprintf(errbuf, "Cannot allocate memory for file name. \n");
+		  H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+	      strcpy(HE5_HeosTable[i].filename, filename);
+              newfile_num = i;
+	      break;
+	    }
+	}
+      
+      if (flags == H5F_ACC_RDWR || flags == H5F_ACC_RDONLY)
+	{
+	  /* if version is before 5.1.7 set DYNAMIC_SMB
+	     global flag to 1, Otherwise to 0.
+	     
+	     Starting with version 5.1.8 we use dynamic 
+	     memory allocation for StructMetadata buffer */
+	  
+	  /* Allocate memory for error message buffer */
+	  /* ---------------------------------------- */
+	  version_buf = (char * )calloc( 64, sizeof(char));
+	  if(version_buf == NULL)
+	    {
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+	      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  
+	  status = HE5_EHgetversion(fid, version_buf);
+	  
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get version. \n");
+	      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(version_buf);
+	      return(FAIL);
+	    }
+	  if(strlen(version_buf) < 12)
+	    {
+	      strcpy(version_buf1, version_buf);
+	    }
+	  else
+	    {
+	      strncpy(version_buf1, version_buf, 12);
+	      version_buf1[12] = '\0';
+	    }
+	  
+	  if ( strcmp(version_buf1, "HDFEOS_5.0") == 0 ||
+	       strcmp(version_buf1, "HDFEOS_5.1") == 0 ||
+	       strcmp(version_buf1, "HDFEOS_5.1.2") == 0 ||
+	       strcmp(version_buf1, "HDFEOS_5.1.3") == 0 ||
+	       strcmp(version_buf1, "HDFEOS_5.1.4") == 0 ||
+	       strcmp(version_buf1, "HDFEOS_5.1.5") == 0 ||
+	       strcmp(version_buf1, "HDFEOS_5.1.6") == 0 ||
+	       strcmp(version_buf1, "HDFEOS_5.1.7") == 0 )
+	    {
+	      HDFEOS5ver_flg = 1; /* Static StructMetadata type */
+	    }
+	  else
+	    {
+	      HDFEOS5ver_flg = 0; /* Dynamic StructMetadata type */
+	    }
+	  free(version_buf);
+	  version_buf = NULL;
+
+	  if(HDFEOS5ver_flg == 1) /* if StructMetadata is static type, get
+				     size of StructMetadata.0 and save it
+				     in global parameter for later use */
+	    {
+	      /* Open "HDFEOS INFORMATION" group to get its zise for backward 
+		 compatibality issue */
+	      /* =========================================================== */
+	      ggid     = H5Gopen(HDFfid, "HDFEOS INFORMATION");
+	      if(ggid == FAIL)
+		{
+		  status = FAIL;
+		  sprintf(errbuf,"Cannot open \"HDFEOS INFORMATION\" group. \n");
+		  H5Epush(__FILE__, "HE5_EHopen",  __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  
+		  return(status);
+		}
+	      
+	      
+	      /*
+	       *--------------------------------------------------------------*
+	       * Open dataset "StructMetadata.0", get datatype and space ID   *
+	       *--------------------------------------------------------------*
+	       */
+	      datid = H5Dopen(ggid, "StructMetadata.0");
+	      if( datid == FAIL)
+		{
+		  status = FAIL;
+		  sprintf(errbuf,"Cannot open \"StructMetadata.0\" dataset. \n");
+		  H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  
+		  return(status);
+		}
+	      
+	      atype   = H5Dget_type(datid);
+	      
+	      if( atype == FAIL)
+		{
+		  status = FAIL;
+		  sprintf(errbuf,"Cannot get the dataset datatype. \n");
+		  H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  
+		  return(status);
+		}
+	      
+	      /* Get dataset size */
+	      /* ---------------- */
+	      tsize   = H5Tget_size(atype);
+	      if ( tsize == 0 )
+		{
+		  status = FAIL;
+		  sprintf(errbuf, "The datatype is of ZERO size. \n"); 
+		  H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  
+		  return( status );
+		}
+
+              HE5_HeosTable[newfile_num].HE5_STATIC_BLKSIZE = tsize;
+
+	      /* Save tsize in global parameter for later use */
+
+	      /*HE5_STATIC_BLKSIZE = tsize;*/
+	      
+	      status = H5Tclose(atype); 
+	      if( status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot release the data type ID.\n");
+		  H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  
+		  return(status);
+		}
+	      status = H5Dclose(datid);
+	      if( status == FAIL)
+		{
+		  sprintf(errbuf,"Cannot release the dataset ID.\n");
+		  H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  
+		  return(status);
+		}
+	      status = H5Gclose(ggid);
+	      if( status == FAIL)
+		{
+		  sprintf(errbuf,"Cannot release the group ID.\n");
+		  H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  
+		  return(status);
+		}
+	    }
+	}
+      else
+	{
+	  HDFEOS5ver_flg = 0; /* Dynamic StructMetadata type */
+	}
+      /* Load table with the flag */
+      /* ========================================= */
+      for (i = 0; i < HE5_NEOSHDF; i++)
+	{
+	  if ((HE5_HeosTable[i].active == 1) && 
+	      (strcmp(HE5_HeosTable[i].filename, filename) == 0) && 
+              (fid == i + HE5_EHIDOFFSET))
+	    {
+	      HE5_HeosTable[i].DYNAMIC_flag   = HDFEOS5ver_flg;
+
+	      break;
+	    }
+	}
+    }
+  else
+    {
+      /* Too many files opened */
+      /* --------------------- */
+      fid = FAIL;
+      sprintf(errbuf,"Illegal attempt to open more than %d files simultaneously. \n", HE5_NEOSHDF);
+      H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  free(errbuf);
+  errbuf = NULL;
+  
+  return(fid);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHchkfid                                                     |
+|                                                                             |
+|  DESCRIPTION: Checks for valid file id and returns HDF file ID and          |
+|               "HDFEOS" group id                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  July 99  A.Muslimov    Modified to conform to the HDFEOS file structure    |
+|  9/29/99  A.Muslimov    Added dynamic memory allocation for error message   |
+|                         buffer.                                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_EHchkfid(hid_t fid, const char *name,  hid_t *HDFfid,  hid_t *grpID, uintn *access)
+{
+  herr_t     status = FAIL;		    /* routine return status variable */
+
+  hid_t      fid0   = 0;		    /* HDFEOS file ID-offset          */  
+
+  char       *errbuf;		  	    /* Error message buffer           */
+
+
+  CHECKPOINTER(name);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char *) calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+	  H5Epush(__FILE__, "HE5_EHchkfid", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+	  HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+	  return(FAIL);
+    }
+
+  /* Check for valid HDFEOS file ID range */
+  /* ------------------------------------ */
+  if (fid < HE5_EHIDOFFSET || fid > HE5_NEOSHDF + HE5_EHIDOFFSET)
+    {
+	  status = FAIL;
+	  sprintf(errbuf,"Invalid file ID: %d. ID should range from %d to  %d .\n", fid, HE5_EHIDOFFSET, HE5_NEOSHDF + HE5_EHIDOFFSET);
+	  H5Epush(__FILE__, "HE5_EHchkfid", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); 
+	  HE5_EHprint(errbuf, __FILE__, __LINE__); 
+    } 
+  else
+    {
+	  /* Compute "reduced" file ID */
+	  /* ------------------------- */
+	  fid0 = fid % HE5_EHIDOFFSET;
+	  if( HE5_HeosTable[ fid0 ].active == 0) 
+        {
+		  status = FAIL;
+		  sprintf(errbuf,"HE5_EHchkid: File ID %d not active (%s).\n",fid, name);
+		  H5Epush(__FILE__, "HE5_EHchkfid", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); 
+		  HE5_EHprint(errbuf, __FILE__, __LINE__); 
+        }
+	  else
+        {
+		  /* Get HDF file ID, group ID and file access from external arrays */
+		  /* ============================================================== */ 
+		  *HDFfid = HE5_HeosTable[ fid0 ].HDFfid;
+		  *grpID  = HE5_HeosTable[ fid0 ].gid;
+		  *access = HE5_HeosTable[ fid0 ].flags;
+		  status  = SUCCEED;
+        }
+    }
+
+  free(errbuf);
+  errbuf = NULL;
+
+ COMPLETION:
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHidinfo                                                     |
+|                                                                             |
+|  DESCRIPTION: Gets HDF ID and group ID from HDF-EOS ID                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               HDF-EOS file ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  HDFfid         hid_t               HDF File ID                             |
+|  gid            hid_t               group ID                                |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_EHidinfo(hid_t fid, hid_t *HDFfid, hid_t *gid)
+{
+  herr_t          status = FAIL;	/* routine return status variable */
+  uintn           access = 0;	    /* file access code               */
+
+  /* Call HE5_EHchkfid to get HDF-EOS interface IDs */
+  /* ---------------------------------------------- */
+  status = HE5_EHchkfid(fid, "HE5_EHidinfo", HDFfid, gid, &access);
+
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHfilename                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns HDF filename                                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t   None       return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               HDF-EOS file id                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  filename       char*               HDF-EOS file name                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_EHfilename(hid_t  fid, char *filename)
+{
+  herr_t       status = SUCCEED;  /* routine return status variable */
+
+  if( filename == NULL || HE5_HeosTable[fid % HE5_EHIDOFFSET].filename == NULL) 
+	status = FAIL;
+  else 
+	strcpy(filename, HE5_HeosTable[fid % HE5_EHIDOFFSET].filename);
+
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHgetversion                                                 |
+|                                                                             |
+|  DESCRIPTION: Returns HDF-EOS version string                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               HDF-EOS file id                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  version        char*               HDF-EOS version string                  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/23/99  A. Muslimov   Initialized status to -1, and checked for the       |
+|                         statuses returned by H5Tclose() and H5Aclose().     |
+|  9/29/99  A.Muslimov    Added dynamic memory allocation for error message   |
+|                         buffer and  atttribute name string.                 |
+|  2/01/00  A.Muslimov    Fixed a bug associated with a pointing to the wrong |
+|                         group and aborting a call.                          |
+|  2/07/00  A.Muslimov    Added free() calls.                                 |
+|  Nov  01  A.Muslimov    Commented out two blocks, and changed the attribute |
+|                          data type to H5T_NATIVE_CHAR.                      |
+|  Aug 02   S.Zhao        Fixed a bug regarding 'HDFEOSVersion' represented   |
+|                         as a series of integers, not a character string.    |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_EHgetversion(hid_t fid, char *version)
+{
+  herr_t      status   = FAIL;  /* routine return status variable */
+
+  uintn       access   =  0;	/* Access code                    */
+
+  hid_t       gid      = FAIL;	/* "HDFEOS" group ID              */ 
+  hid_t       att_id   = FAIL;	/* attribute ID                   */
+  hid_t       HDFfid   = FAIL;	/* HDF-EOS file ID                */
+  hid_t       InfGrpID = FAIL;	/* "HDFEOS INFORMATION" group ID  */
+  hid_t       atype    = FAIL;  /* Attribute data type ID         */
+  hid_t       mtype    = FAIL;  /* Attribute memory data type ID  */
+
+  char        *errbuf   = (char *)NULL;/* error message buffer    */
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE,  sizeof(char));
+  if(errbuf == NULL)
+    {
+	  H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+	  HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+	  return(FAIL);
+    }
+
+  /* Get HDF-EOS file ID and "HDFEOS" group ID */
+  /* ========================================= */
+  status = HE5_EHchkfid(fid,"HE5_EHgetversion", &HDFfid, &gid, &access);
+  if(status == FAIL)
+    {
+	  H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_FILE, H5E_NOTFOUND, "Invalid file ID. \n");
+	  HE5_EHprint("Error: Invalid file ID, occured", __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+    }
+
+  /* Open "HDFEOS/HDFEOS INFORMATION" group */
+  /* -------------------------------------- */
+  InfGrpID = H5Gopen(HDFfid, "HDFEOS INFORMATION");
+  if(InfGrpID == FAIL)
+    {
+	  status = FAIL;
+	  sprintf(errbuf, "Cannot open \"HDFEOS INFORMATION\" group. \n");
+	  H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(status);
+    }        
+
+  if(status == SUCCEED)
+    {
+	  /* Open attribute "HDFEOSVersion" */
+	  /* ============================== */
+	  att_id = H5Aopen_name(InfGrpID, "HDFEOSVersion");
+	  if(att_id == FAIL)
+		{
+		  status = FAIL;
+		  sprintf(errbuf,"Cannot get the \"HDFEOSVersion\" attribute ID.");
+		  H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  return(status);
+		}
+
+	  atype  = H5Aget_type(att_id);
+	  if( atype == FAIL)
+		{
+		  status = FAIL;
+		  sprintf(errbuf,"Cannot get the \"HDFEOSVersion\" attribute data type ID.");
+		  H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  return(status);
+		}
+	  
+	  /* Get the memory data type ID */
+	  /* --------------------------- */
+	  mtype = HE5_EHdtype2mtype(atype);
+
+          if (mtype < 0)
+          {
+          	atype  = H5Tcopy(H5T_C_S1);
+          	if( atype == FAIL)
+                {
+                  status = FAIL;
+                  sprintf(errbuf,"Cannot copy the \"HDFEOSVersion\" attribute datatype.");
+                  H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+                  HE5_EHprint(errbuf, __FILE__, __LINE__);
+                  free(errbuf);
+ 
+                  return(status);
+                }
+ 
+          	status = H5Tset_size(atype, HE5_VERSIONLEN);
+          	if( status == FAIL)
+                {
+                  sprintf(errbuf,"Cannot set the total size for the \"HDFEOSVersion\" attribute.");
+                  H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+                  HE5_EHprint(errbuf, __FILE__, __LINE__);
+                  free(errbuf);
+ 
+                  return(status);
+                }
+          	/* Read out version attribute */
+          	/* ========================== */
+          	status = H5Aread(att_id, atype, version);
+          	if( status == FAIL)
+                {
+                  sprintf(errbuf,"Cannot read out the \"HDFEOSVersion\" attribute.");
+                  H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+                  HE5_EHprint(errbuf, __FILE__, __LINE__);
+                  free(errbuf);
+ 
+                  return(status);
+                }
+          }
+	  else
+          {
+	  	/* Read out version attribute */
+	  	/* ========================== */
+	  	status = H5Aread(att_id, mtype, (void *)version);
+	  	if( status == FAIL)
+		{
+		  sprintf(errbuf,"Cannot read out the \"HDFEOSVersion\" attribute.");
+		  H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  return(status);
+		}
+          }
+       
+	  /* Release the attribute datatype ID */
+	  /* --------------------------------- */
+	  status = H5Tclose(atype);
+	  if( status == FAIL)
+	    {
+		  sprintf(errbuf,"Cannot release the \"HDFEOSVersion\" attribute datatype ID.");
+		  H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  return(status);
+		}
+			
+	  /* Release the attribute ID */
+	  /* ------------------------ */
+	  status = H5Aclose(att_id);
+	  if( status == FAIL)
+		{
+		  sprintf(errbuf,"Cannot release the \"HDFEOSVersion\" attribute ID.");
+		  H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_ATTR, H5E_CLOSEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  return(status);
+		}
+
+	  status = H5Gclose(InfGrpID);
+	  if( status == FAIL)
+		{
+		  sprintf(errbuf,"Cannot release the \"HDFEOS INFORMATION\" group ID.");
+		  H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  return(status);
+		}
+    }
+
+  free(errbuf);
+  errbuf = NULL;
+    
+  return (status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHconvAng                                                    |
+|                                                                             |
+|  DESCRIPTION: Angle conversion Utility                                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  outAngle       double              Output Angle value                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  inAngle        double              Input Angle value                       |
+|  code           int                 Conversion code                         |
+|                                       HDFE_RAD_DEG (0)                      |
+|                                       HDFE_DEG_RAD (1)                      |
+|                                       HDFE_DMS_DEG (2)                      |
+|                                       HDFE_DEG_DMS (3)                      |
+|                                       HDFE_RAD_DMS (4)                      |
+|                                       HDFE_DMS_RAD (5)                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|     None                                                                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 96   Joel Gales    Original Programmer                                 |
+|  Feb 97   Joel Gales    Correct "60" min & "60" sec in _DMS conversion      |
+|  Feb 06   Abe Taaheri   Modified checking sec not to exceed 60.             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+double 
+HE5_EHconvAng(double inAngle, int code)
+{
+    long      min = 0;        /* Truncated Minutes      */
+    long      deg = 0;        /* Truncated Degrees      */
+
+    double    sec      = 0.;  /* Seconds                */
+    double    outAngle = 0.;  /* Angle in desired units */
+    double    pi  = 3.14159265358979324;/* Pi           */
+    double    r2d = 180 / pi;     /* Rad-deg conversion */
+    double    d2r = 1 / r2d;      /* Deg-rad conversion */
+
+    switch (code)
+    {
+
+        /* Convert radians to degrees */
+        /* -------------------------- */
+    case HE5_HDFE_RAD_DEG:
+        outAngle = inAngle * r2d;
+        break;
+
+        /* Convert degrees to radians */
+        /* -------------------------- */
+    case HE5_HDFE_DEG_RAD:
+        outAngle = inAngle * d2r;
+        break;
+
+
+        /* Convert packed degrees to degrees */
+        /* --------------------------------- */
+    case HE5_HDFE_DMS_DEG:
+        deg = (long)(inAngle / 1000000);
+        min = (long)((inAngle - deg * 1000000) / 1000);
+        sec = (inAngle - deg * 1000000 - min * 1000);
+        outAngle = deg + min / 60.0 + sec / 3600.0;
+        break;
+
+
+        /* Convert degrees to packed degrees */
+        /* --------------------------------- */
+    case HE5_HDFE_DEG_DMS:
+        deg = (long)inAngle;
+        min = (long)((inAngle - deg) * 60);
+        sec = (inAngle - deg - min / 60.0) * 3600;
+	/*
+        if ((int)sec == 60)
+        {
+            sec = sec - 60;
+            min = min + 1;
+        }
+	*/
+	if ( fabs(sec - 0.0) < 1.e-7 )
+	  {
+	    sec = 0.0;
+	  }
+
+        if ( (fabs(sec - 60) < 1.e-7 ) || ( sec > 60.0 ))
+        {
+	  sec = sec - 60;
+	  min = min + 1;
+	  if(sec < 0.0)
+	    {
+	      sec = 0.0;
+	    }
+        }
+        if (min == 60)
+        {
+            min = min - 60;
+            deg = deg + 1;
+        }
+        outAngle = deg * 1000000 + min * 1000 + sec;
+        break;
+
+
+        /* Convert radians to packed degrees */
+        /* --------------------------------- */
+    case HE5_HDFE_RAD_DMS:
+        inAngle = inAngle * r2d;
+        deg = (long)inAngle;
+        min = (long)((inAngle - deg) * 60);
+        sec = ((inAngle - deg - min / 60.0) * 3600);
+	/*
+        if ((int)sec == 60)
+        {
+            sec = sec - 60;
+            min = min + 1;
+        }
+	*/
+	if ( fabs(sec - 0.0) < 1.e-7 )
+	  {
+	    sec = 0.0;
+	  }
+
+        if ( (fabs(sec - 60) < 1.e-7 ) || ( sec > 60.0 ))
+        {
+	  sec = sec - 60;
+	  min = min + 1;
+	  if(sec < 0.0)
+	    {
+	      sec = 0.0;
+	    }
+        }
+        if (min == 60)
+        {
+            min = min - 60;
+            deg = deg + 1;
+        }
+        outAngle = deg * 1000000 + min * 1000 + sec;
+        break;
+
+
+        /* Convert packed degrees to radians */
+        /* --------------------------------- */
+    case HE5_HDFE_DMS_RAD:
+        deg = (long)(inAngle / 1000000);
+        min = (long)((inAngle - deg * 1000000) / 1000);
+        sec = (inAngle - deg * 1000000 - min * 1000);
+        outAngle = deg + min / 60.0 + sec / 3600.0;
+        outAngle = outAngle * d2r;
+        break;
+    }
+    return (outAngle);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHparsestr                                                   |
+|                                                                             |
+|  DESCRIPTION: String Parser Utility                                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  count          long                Number of string entries                |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  instring       char*               Input string                            |
+|  delim          char                string delimitor                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  pntr           char*               Pointer array to beginning of each      |
+|                                     string entry                            |
+|  len            size_t              Array of string entry lengths           |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date       Programmer   Description                                       |
+|  ========   ============  ================================================= |
+|  04/19/00   A.Muslimov    Changed type of 'slen','i','prevDelimPos' and     |
+|                              'len[]' from long to size_t.                   |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_EHparsestr(const char *instring, char delim, char *pntr[], size_t len[])
+{
+  long           count        = 0;/* Number of elements in string list */
+
+  herr_t         status   = FAIL; /* Return status variable            */
+  
+  size_t         slen         = 0;/* String length                     */
+  size_t         i;               /* Loop index                        */
+  size_t         prevDelimPos = 0;/* Previous delimitor position       */
+  
+  char           *delimitor   = (char *)NULL;/* Pointer to delimitor   */
+  
+  CHECKPOINTER(instring);
+
+  /* Get length of input string list & Point to first delimitor */
+  /* ---------------------------------------------------------- */
+  slen      = strlen(instring);
+  delimitor = strchr(instring, delim);
+  
+  /* If NULL string set count to zero otherwise set to 1 */
+  /* --------------------------------------------------- */
+  count = (slen == 0) ? 0 : 1;
+  
+  /* if string pointers are requested set first one to beginning of string */
+  /* --------------------------------------------------------------------- */
+  if (&pntr[0] != NULL)
+	pntr[0] = (char *)instring;
+  
+  /* If delimitor not found ... */
+  /* -------------------------- */
+  if (delimitor == NULL)
+    {
+	  /* if string length requested then set to input string length */
+	  /* ---------------------------------------------------------- */
+	  if (len != NULL)
+		len[0] = slen;
+	}
+  else
+	/* Delimitors Found */
+	/* ---------------- */
+	{
+	  /* Loop through all characters in string */
+	  /* ------------------------------------- */
+	  for (i = 1; i < slen; i++)
+        {
+		  /* If character is a delimitor ... */
+		  /* ------------------------------- */
+		  if (instring[i] == delim)
+            {
+
+			  /* If string pointer requested */
+			  /* --------------------------- */
+			  if (&pntr[0] != NULL)
+                {
+				  /* if requested then compute string length of entry */
+				  /* ------------------------------------------------ */
+				  if (len != NULL)
+					len[count - 1] = i - prevDelimPos;
+
+				  /* Point to beginning of string entry */
+				  /* ---------------------------------- */
+				  pntr[count] = (char *)instring + i + 1;
+                }
+			  /* Reset previous delimitor position and increment counter */
+			  /* ------------------------------------------------------- */
+			  prevDelimPos = i + 1;
+			  count++;
+            }
+        }
+
+	  /* Compute string length of last entry */
+	  /* ----------------------------------- */
+	  if (&pntr[0] != NULL && len != NULL)
+		len[count - 1] = i - prevDelimPos;
+    }
+  
+ COMPLETION:
+  return(count);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHstrwithin                                                  |
+|                                                                             |
+|  DESCRIPTION: Searchs for string within target string                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  indx           long                Element index (0 - based)               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  target         char                Target string                           |
+|  search         char                Search string                           |
+|  delim          char                Delimitor                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  10/05/99 A.Muslimov    Added dynamical memory allocation for the buffers.  |
+|  10/18/99 A.Muslimov    Replaced memcpy() by memmove() to avoid a problem   |
+|                         when arguments 1 and 2 overlap in memory.           |
+|  02/07/00 A.Muslimov    Added free() calls before return(FAIL) and more     |
+|                         error handlings.                                    |
+|  04/19/00 A.Muslimov    Changed type of '*slen' from long to size_t.        |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_EHstrwithin(char *target, char *search, char delim)
+{
+
+  long         indx     = FAIL;       /* Index of searched element (RETURN) */
+  long         nentries = 0;	      /* Number of entries in search string */
+
+  herr_t       status   = FAIL;       /* Return status variable             */
+
+  size_t       *slen = (size_t *)NULL;/* Pointer to string length array     */
+
+  int          found = 0;		      /* Target string found flag           */
+
+  char         **ptr;			      /* Pointer to string pointer array    */
+  char         *buffer = (char *)NULL;/* Buffer to hold "test" string entry */
+  char         *errbuf = (char *)NULL;/* buffer for error message           */
+     
+
+  CHECKPOINTER(target);
+  CHECKPOINTER(search);
+
+  /* Allocate memory for error message buffer */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+	  H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+	  HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+
+	  return(FAIL);
+    }
+
+  /* Allocate memory for buffer */
+  buffer = (char * )calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(buffer == NULL)
+    {
+	  sprintf(errbuf,"Cannot allocate memory for buffer.");
+	  H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+     
+	  return(FAIL);
+    }
+ 
+
+  /* Count number of entries in search string list */
+  /* --------------------------------------------- */
+  nentries = HE5_EHparsestr(search, delim, NULL, NULL);
+  if(nentries == 0)
+    {
+	  sprintf(errbuf,"Input test string has no entries.");
+	  H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(buffer);
+     
+	  return(FAIL);
+    }
+
+
+  /* Allocate string pointer and length arrays */
+  /* ----------------------------------------- */
+  ptr = (char **) calloc(nentries, sizeof(char *));
+  if(ptr == NULL)
+    {
+	  sprintf(errbuf,"Cannot allocate memory for a string pointer.");
+	  H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(buffer);
+     
+	  return(FAIL);
+    }
+
+  slen = (size_t *) calloc(nentries, sizeof(size_t));
+  if(slen == NULL)
+    {
+	  sprintf(errbuf,"Cannot allocate memory for a string length pointer.");
+	  H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(buffer);
+	  free(ptr);
+     
+	  return(FAIL);
+    }
+
+  /* Parse search string */
+  /* ------------------- */
+  nentries = HE5_EHparsestr(search, delim, ptr, slen);
+  if(nentries == 0)
+    {
+	  sprintf(errbuf,"Input test string has no entries.");
+	  H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(buffer);
+	  free(ptr);
+	  free(slen);
+     
+	  return(FAIL);
+    }
+
+  /* Loop through all elements in search string list */
+  /* ----------------------------------------------- */
+  for (indx = 0; indx < nentries; indx++)
+    {
+	  /* Copy string entry into buffer */
+	  /* ----------------------------- */
+	  memmove(buffer, ptr[indx], slen[indx]);
+	  buffer[slen[indx]] = 0;
+	  
+
+	  /* Compare target string with string entry */
+	  /* --------------------------------------- */
+	  if (strcmp(target, buffer) == 0)
+        {
+		  found = 1;
+		  break;
+        }
+    }
+  
+  /* If not found set return to FAIL */
+  /* ------------------------------- */
+  if (found == 0)
+	indx = FAIL;
+
+
+  free(slen);
+  free(ptr);
+  free(errbuf);
+  free(buffer);
+ 
+ COMPLETION:   
+  return(indx);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHloadliststr                                                |
+|                                                                             |
+|  DESCRIPTION: Builds list string from string array                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ptr            char                String pointer array                    |
+|  nentries       long                Number of string array elements         |
+|  delim          char                Delimitor                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  liststr        char                Output list string                      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  10/18/99 A.Muslimov    Replaced memcpy() by memmove() to avoid a problem   |
+|                         when arguments 1 and 2 overlap in memory.           |
+|  04/19/00 A.Muslimov    Changed 'slen', 'off' types from long to size_t.    |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_EHloadliststr(char *ptr[], long nentries, char *liststr, char delim)
+{
+  herr_t          status = SUCCEED;   /* routine return status variable   */
+  
+  long            i;                  /* Loop index                       */
+  
+  size_t          off  = 0;           /* Position of next entry in a list */
+  size_t          slen = 0;           /* String entry length              */
+  
+  char            dstr[2];            /* string containing "delim" value  */
+  
+  dstr[0] = delim;
+  dstr[1] = '\0';
+  
+  
+  /* Loop through all entries in string array */
+  /* ---------------------------------------- */
+  for (i = 0; i < nentries; i++)
+    {
+	  /* Get string length of string array entry */
+	  /* --------------------------------------- */
+	  slen = strlen(ptr[i]);
+
+	  /* Copy string entry to string list */
+	  /* -------------------------------- */
+	  memmove(liststr + off, ptr[i], slen + 1);
+
+	  /* Concatenate with delimitor */
+	  /* -------------------------- */
+	  if (i != nentries - 1)
+        {
+		  strcat(liststr, dstr);
+        }
+	  /* Get position of next entry for string list */
+	  /* ------------------------------------------ */
+	  off += slen + 1;
+	}
+  
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHrevflds                                                    |
+|                                                                             |
+|  DESCRIPTION: Reverses elements in a string list                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  dimlist        char*               Original dimension list                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  revdimlist     char*               Reversed dimension list                 |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  04/19/00 A.Muslimov    Changed type of 'slen' from long to size_t.         |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_EHrevflds(char *dimlist, char *revdimlist)
+{
+  herr_t       status    = FAIL;      /* routine return status variable     */
+  
+  long         indx      = 0;         /* Loop index                         */
+  long         nentries  = 0;         /* Number of entries in search string */
+  
+  size_t       *slen = (size_t *)NULL;/* Pointer to string length array     */
+  
+  char         **ptr;                 /* Pointer to string pointer array    */
+  char         *tempPtr     = (char *)NULL;/* Temporary string pointer      */
+  char         *tempdimlist = (char *)NULL;/* Temporary dimension list      */
+  
+
+  CHECKPOINTER(dimlist);
+  
+  /* Copy dimlist into temp dimlist */
+  /* ------------------------------ */
+  tempdimlist = (char *)calloc((strlen(dimlist) + 1), sizeof(char) );
+  if(tempdimlist == NULL)
+    {
+	  H5Epush(__FILE__, "HE5_EHrevflds", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+	  HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+	  return(FAIL);
+    }
+
+  strcpy(tempdimlist, dimlist);
+    
+  /* Count number of entries in search string list */
+  /* --------------------------------------------- */
+  nentries = HE5_EHparsestr(tempdimlist, ',', NULL, NULL);
+  
+  /* Allocate string pointer and length arrays */
+  /* ----------------------------------------- */
+  ptr = (char **) calloc(nentries, sizeof(char *));
+  if(ptr == NULL)
+    {
+	  H5Epush(__FILE__, "HE5_EHrevflds", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+	  HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+	  if(tempdimlist != NULL) free(tempdimlist);
+	  return(FAIL);
+    }
+  
+  slen = (size_t *)calloc(nentries, sizeof(size_t));
+  if(slen == NULL)
+    {
+	  H5Epush(__FILE__, "HE5_EHrevflds", __LINE__, H5E_RESOURCE,H5E_NOSPACE, "Can not allocate memory");
+	  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	  if (ptr != NULL) free(ptr);
+	  if (tempdimlist != NULL) free(tempdimlist);
+	  return(FAIL);
+    }
+  
+  
+  /* Parse search string */
+  /* ------------------- */
+  nentries = HE5_EHparsestr(tempdimlist, ',', ptr, slen);
+  
+  /* Reverse entries in string pointer array */
+  /* --------------------------------------- */
+  for (indx = 0; indx < nentries / 2; indx++)
+    {
+	  tempPtr   = ptr[indx];
+	  ptr[indx] = ptr[nentries - 1 - indx];
+	  ptr[nentries - 1 - indx] = tempPtr;
+    }
+  
+  
+  /* Replace comma delimitors by nulls */
+  /* --------------------------------- */
+  for (indx = 0; indx < nentries - 1; indx++)
+    {
+	  *(ptr[indx] - 1) = 0;
+    }
+  
+  
+  /* Build new string list */
+  /* --------------------- */
+  status = HE5_EHloadliststr(ptr, nentries, revdimlist, ',');
+  
+  free(slen);
+  free(ptr);
+  free(tempdimlist);
+
+ COMPLETION:  
+  return(status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHcntOBJECT                                                  |
+|                                                                             |
+|  DESCRIPTION: Determines number of OBJECTs in metadata GROUP                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  count          long                Number of OBJECTs in GROUP              |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  metabur        char                Begin & end metadata pointer array      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+| END_PROLOG                                                                  |
+-----------------------------------------------------------------------------*/
+long 
+HE5_EHcntOBJECT(char *metabuf[])
+{
+  long           count    = 0;           /* Counter (RETURN)                */
+
+  herr_t         status   = FAIL;        /* Return status variable          */
+  
+  char           *metaptr = (char *)NULL;/* Beginning of metadata section   */
+  char           *endptr  = (char *)NULL;/* End of metadata section         */
+  char           *tempptr = (char *)NULL;/* Pointer within metadata section */
+  
+  CHECKPOINTER(metabuf[0]);
+  CHECKPOINTER(metabuf[1]);
+  
+  /* Get Pointers to beginning and ending of metadata section */
+  /* -------------------------------------------------------- */
+  metaptr = metabuf[0];
+  endptr  = metabuf[1];
+  
+  
+  /* Find number of "END_OBJECT" strings within section */
+  /* -------------------------------------------------- */
+  tempptr = metaptr;
+  
+  while (tempptr < endptr && tempptr != NULL)
+    {
+	  tempptr = strstr(tempptr + 1, "END_OBJECT");
+	  count++;
+    }
+  count--;
+
+ COMPLETION:  
+  return(count);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHcntGROUP                                                   |
+|                                                                             |
+|  DESCRIPTION: Determines number of GROUPs in metadata GROUP                 |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  count          long                Number of GROUPs in GROUP               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  metabur        char                Begin & end metadata pointer array      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long  
+HE5_EHcntGROUP(char *metabuf[])
+{
+  long            count    = 0;           /* Counter (RETURN)                */
+
+  herr_t          status   = FAIL;        /* Return status variable          */
+
+  char            *metaptr = (char *)NULL;/* Beginning of metadata section   */
+  char            *endptr  = (char *)NULL;/* End of metadata section         */
+  char            *tempptr = (char *)NULL;/* Pointer within metadata section */
+  
+  CHECKPOINTER(metabuf[0]);
+  CHECKPOINTER(metabuf[1]);
+  
+  /* Get Pointers to beginning and ending of metadata section */
+  /* -------------------------------------------------------- */
+  metaptr = metabuf[0];
+  endptr  = metabuf[1];
+  
+  /* Find number of "END_GROUP" strings within section */
+  /* ------------------------------------------------- */
+  tempptr = metaptr;
+  
+  while (tempptr < endptr && tempptr != NULL)
+    {
+	  tempptr = strstr(tempptr + 1, "END_GROUP");
+	  count++;
+    }
+  count--;
+
+ COMPLETION:  
+  return (count);
+}
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHmetalist                                                   |
+|                                                                             |
+|  DESCRIPTION: Converts string list to metadata list                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  instring       char*               Input string list                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  outstring      char*               Output metadata string                  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  10/18/99 A.Muslimov    Replaced memcpy() by memmove() to avoid a problem   |
+|                         when arguments 1 and 2 overlap in memory.           |
+|  04/19/00 A.Muslimov    Changed type of '*slen', 'listlen' from long to     |
+|                            size_t.                                          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_EHmetalist(char *instring, char *outstring)
+{
+
+  herr_t        status   = FAIL;           /* routine return status variable     */
+  
+  long          i;                         /* Loop index                         */
+  long          nentries =  0;             /* Number of entries in search string */
+  
+  size_t        listlen  =  1;             /* String list length                 */
+  size_t        *slen    = (size_t *)NULL; /* Pointer to string length array     */
+  
+  char          **ptr;                     /* Pointer to string pointer array    */
+  
+
+  CHECKPOINTER(instring);
+
+  /* Count number of entries in search string list */
+  /* --------------------------------------------- */
+  nentries = HE5_EHparsestr(instring, ',', NULL, NULL);
+  if(nentries == 0)
+    {
+	  H5Epush(__FILE__, "HE5_EHmetalist", __LINE__, H5E_FUNC, H5E_BADVALUE, "NULL input string");
+	  HE5_EHprint("Error: NULL input string, occured", __FILE__, __LINE__);
+	  return(FAIL);
+    }
+  
+  
+  /* Allocate string pointer  */
+  /* ------------------------ */
+  ptr = (char **) calloc(nentries, sizeof(char *));
+  if(ptr == NULL)
+    {
+	  H5Epush(__FILE__, "HE5_EHmetalist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n");
+	  HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+	  return(FAIL);
+    }
+
+
+  /* Allocate length array */
+  /* --------------------- */
+  slen = (size_t *) calloc(nentries, sizeof(size_t));
+  if(slen == (size_t *)NULL)
+    {
+	  H5Epush(__FILE__, "HE5_EHmetalist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n");
+	  HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+	  if (ptr != NULL) free(ptr);
+	  return(FAIL);
+    }
+  
+  
+  /* Parse input string */
+  /* ------------------ */
+  nentries = HE5_EHparsestr(instring, ',', ptr, slen);
+  if(nentries == 0)
+    {
+	  H5Epush(__FILE__, "HE5_EHmetalist", __LINE__, H5E_ARGS, H5E_BADVALUE, "NULL input string. \n");
+	  HE5_EHprint("Error: NULL input string, occured", __FILE__, __LINE__);
+	  if (ptr != NULL) free(ptr);
+	  if (slen != NULL) free(slen);
+	  return(FAIL);
+    }
+  
+  /* Start output string with leading "(" */
+  /* ------------------------------------ */
+  strcpy(outstring, "(");
+  
+  /* Loop through all entries */
+  /* ------------------------ */
+  for (i = 0; i < nentries; i++)
+    {
+	  /* Add double quote (") to output string */
+	  /* ------------------------------------- */
+	  strcat(outstring, "\"");
+	  listlen++;
+
+	  /* Add input string entry to output string */
+	  /* --------------------------------------- */
+	  memmove(outstring + listlen, ptr[i], slen[i]);
+	  listlen += slen[i];
+	  outstring[listlen] = 0;
+
+
+	  /* Add closing double quote (") to output string */
+	  /* --------------------------------------------- */
+	  strcat(outstring, "\"");
+	  listlen++;
+	  outstring[listlen] = 0;
+
+
+	  /* Add comma delimitor to output string */
+	  /* ------------------------------------ */
+	  if (i != (nentries - 1))
+        {
+		  strcat(outstring, ",");
+		  listlen++;
+        }
+	  /* Place null terminator in output string */
+	  /* -------------------------------------- */
+	  outstring[listlen] = 0;
+    }
+  
+  
+  /* End output string with trailing ")" */
+  /* ----------------------------------- */
+  strcat(outstring, ")");
+  status = SUCCEED;
+  
+  free(ptr);
+  free(slen);
+  
+ COMPLETION:
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHinsertmeta                                                 |
+|                                                                             |
+|  DESCRIPTION: Writes metadata                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|    status       herr_t  None        return status variable (0 for success,  |
+|                                          -1 for failure)                    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|    fid          hid_t   None        HDF-EOS file ID                         |
+|    structname   char*   None        Object name string                      |
+|    structcode   char*   None        "s" for a swath, "g" for a grid,        |
+|                                     "p" for a point, and "z" for a za.      |
+|    metacode     long    None        Code of a metadata block to insert to.  |
+|    metastr      char*   None        Buffer containing metadata information  |
+|                                      to insert.                             |
+|    metadata[]   hsize_t None        Array of data values                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|    None                                                                     |
+|                                                                             |
+|  NOTES:   There is memory allocation of HE5_STATIC_BLKSIZE chunk for the    |
+|           dataset "StructMetadata.0" when the buffer is allocated           |
+|           statically (old scheme), or memory allocation is in cuncks        |
+|           of HE5_DYNAMIC_BLKSIZE (new scheme)  allocated dynamically.       |
+|           The chuncks will be written to datasets "StructMetadata.0",       |
+|           "StructMetadata.1", "StructMetadata.2", etc.                      |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  05/17/04   Abe Taaheri  Initial version                                    |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_EHinsertmeta(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]) 
+{
+  herr_t   status = SUCCEED;
+  int      HDFEOS5ver_flg ; /* will be set to 1 if the HDF-EOS5 version 
+			       is later than 5.1.7, otherwise to 0 */
+  /* Get HDFEOS5ver_flg flag for the file */
+  /* --------------- */
+  HDFEOS5ver_flg = HE5_HeosTable[fid%HE5_EHIDOFFSET].DYNAMIC_flag;
+
+  if(HDFEOS5ver_flg == 1)
+    {
+      status = HE5_EHinsertmeta_Static(fid, structname, structcode, metacode, 
+				       metastr, metadata);
+    }
+  else if(HDFEOS5ver_flg == 0)
+    {
+      status = HE5_EHinsertmeta_Dynamic(fid, structname, structcode, metacode, 
+					metastr, metadata);
+    }
+
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHinsertmeta_Static                                          |
+|                                                                             |
+|  DESCRIPTION: Writes metadata using a static buffer                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|    status       herr_t  None        return status variable (0 for success,  |
+|                                          -1 for failure)                    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|    fid          hid_t   None        HDF-EOS file ID                         |
+|    structname   char*   None        Object name string                      |
+|    structcode   char*   None        "s" for a swath, "g" for a grid,        |
+|                                     "p" for a point, and "z" for a za.      |
+|    metacode     long    None        Code of a metadata block to insert to.  |
+|    metastr      char*   None        Buffer containing metadata information  |
+|                                      to insert.                             |
+|    metadata[]   hsize_t None        Array of data values                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|    None                                                                     |
+|                                                                             |
+|  NOTES:   There is memory allocation of HE5_STATIC_BLKSIZE chunk for the    |
+|           dataset "StructMetadata.0"                                        |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  07/16/99 A.Muslimov    Replaced the 1st argument by fid (file ID). Did     |
+|                         the same change in the call to H5Dopen(). Modified  |
+|                         the first two calls to HDF5 lib.func. and commented |
+|                         out the fourth and fifth calls. Allocated a fixed   |
+|                         chunk of memory of BLKSIZE for the output metabuf[] |
+|                         array.                                              |
+|  08/26/99 A.Muslimov    Added if() condition after the H5Dread() H5Dwrite() |
+|                         calls.                                              |
+|  09/07/99 A.Muslimov    Allocated a BLKSIZE bytes for the newbuf[] array.   |
+|  09/13/99 A.Muslimov    Checked for the value (nentries) returned by        |
+|                         EHparsestr(). Checked for the status returned by    |
+|                         EHmetalist().                                       |
+|  9/29/99  A.Muslimov    Added dynamic memory allocation for error message   |
+|                         buffer.                                             |
+|  01/06/00 A.Muslimov    Changed the datatype of parameter "metadata[]"      |
+|                         from int32_t to hsize_t to allow passing the        |
+|                         Unlimited dimension value. Modified the correspon - |
+|                         ding sprintf() calls.                               |
+| 02/07/00  A.Muslimov    Added free() before return(FAIL).                   |
+| 04/19/00  A.Muslimov    Changed type of 'slen' from long to size_t.         |
+| 09/05/00  A.Muslimov    Added conversion of 'fid' to 'HDFfid'. In the call  |
+|                         H5Gopen(fid, ...) replaced 'fid' by 'HDFfid'.       |
+| 12/12/00  A.Muslimov    Updated to add "case 5" ("Profile Fields").         |
+| Jan 2004  S.Zhao        Added a FAIL status for redefining a dimension.     |
+| Mar 2004  S.Zhao        Modified for redefining a dimension.                |
+| May 2005  S.Zhao        Added data type string designators in the dataset   |
+|                         "StructMetadata.0".                                 |
+|  Feb 06   Abe Taaheri   Casted Switch argument to long for HP11             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_EHinsertmeta_Static(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]) 
+{
+  herr_t         status   = FAIL;    /* routine return status variable            */
+
+  int            i;                  /* Loop index                                */
+ 
+  hid_t          gid      = FAIL;    /* "HDFEOS INFORMATION" group ID             */
+  hid_t          meta_id  = FAIL;    /* "StructuralMetadat.0" group ID            */
+  hid_t          atype    = FAIL;    /* Data type ID                              */
+  hid_t          aspace   = FAIL;    /* Data space ID                             */
+  hid_t          HDFfid   = FAIL;    /* HDF5 file ID                              */
+
+  size_t         slen[HE5_DTSETRANKMAX];/* String length array                    */
+  
+  hsize_t        tempdim  =  0;      /* Temporary variable                        */
+  
+  long           count    = 0;       /* Objects/Groups counter                    */
+  long           offset   = 0;       /* Offset insertion position of new metadata */
+  long           nentries = 0;       /* Number of comma separated string entries  */
+  
+  char           *metabuf = NULL;    /* Pointer to Structural Metadata array      */
+  char           *begptr  = NULL;    /* Pointer to beginning of metadata section  */
+  char           *metaptr = NULL;    /* Metadata pointer                          */
+  char           *prevmetaptr = NULL;/* Previous position of metadata pointer     */
+  char           *ptr[HE5_DTSETRANKMAX];/* String pointer array                   */
+  char           *metaArr[2]={NULL,NULL};/* Array of metadata positions           */
+  char           *colon   = NULL;    /* Colon position                            */
+  char           *colon2  = NULL;    /* 2nd colon position                        */
+  char           *slash   = NULL;    /* Slash postion                             */
+  char           *utlstr  = NULL;    /* Utility string                            */
+  char           *utlstr1 = NULL;    /* Utility string 1                          */
+  char           *utlstr2 = NULL;    /* Utility string 2                          */
+  char           *newbuf  = NULL;    /* updated metadata string                   */
+  char           *type    = NULL;    /* data type string                          */
+  char           *errbuf  = NULL;    /* Error message buffer                      */
+  char           *dimptr  = NULL;    /* Dimension pointer                         */
+  char           *newmetastr = NULL; /* Modified metadata string                  */
+  char           *endptr  = NULL;    /* Pointer to ending of metadata section     */
+  char           *newmetaptr = NULL; /* Updated metadata pointer                  */
+  char           *begptr2  = NULL;   /* Pointer 2 to beginning of metadata section*/
+  int            len1, len2, difflen = 0;
+
+  
+
+  CHECKPOINTER(structname);
+  CHECKPOINTER(structcode);
+  CHECKPOINTER(metastr);
+
+
+  /* Get HDF file ID */
+  /* --------------- */
+  HDFfid = HE5_HeosTable[fid%HE5_EHIDOFFSET].HDFfid;
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+	  HE5_EHprint("Error: Cannot allocate memory for error buffe, occuredr", __FILE__, __LINE__);
+	  return(FAIL);
+    }
+  
+  /* Allocate memory for data type string */
+  /* ------------------------------------ */
+  type = (char * )calloc( HE5_HDFE_TYPESTRSIZE, sizeof(char));
+  if(type == NULL)
+    {
+	  sprintf(errbuf,"Cannot allocate memory for data type string. \n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+     
+	  return(FAIL);
+    }
+  
+  
+  /* Open "HDFEOS INFORMATION" group */
+  /* =============================== */
+  gid     = H5Gopen(HDFfid, "HDFEOS INFORMATION");
+  if(gid == FAIL)
+	{
+      status = FAIL;
+      sprintf(errbuf,"Cannot open \"HDFEOS INFORMATION\" group. \n");
+      H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(type);
+      
+      return(status);
+	}
+  
+  
+  /*
+   *--------------------------------------------------------------*
+   * Open dataset "StructMetadata.0", get datatype and space ID   *
+   *--------------------------------------------------------------*
+   */
+  meta_id = H5Dopen(gid, "StructMetadata.0"); 
+  if( meta_id == FAIL)
+	{
+      status = FAIL;
+      sprintf(errbuf,"Cannot open \"StructMetadata.0\" dataset. \n");
+      H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(type);
+
+      return(status);
+	}
+  atype   = H5Dget_type(meta_id);
+  if( atype == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot get the dataset datatype. \n");
+      H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(type);
+
+      return(status);
+    }
+  aspace  = H5Dget_space(meta_id);
+  if( aspace == FAIL )
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot get the dataset dataspace. \n");
+      H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(type);
+
+      return(status);
+    }
+  
+  
+  /*
+	 
+     NOTE: this call is now supported for a string and is used now 
+           in HE5_EHattrinfo to get the number of elements for string array
+	npoints = H5Sget_simple_extent_npoints(aspace);
+	   it will be implemented for memory allocation for metabuf[] array
+	 
+   */
+   
+  /*
+   *-------------------------------------------------------------*
+   *   Allocate memory for the output array and Read attribute   *
+   *-------------------------------------------------------------*
+   */
+  
+  metabuf  = (char *)calloc( HE5_HeosTable[fid%HE5_EHIDOFFSET].HE5_STATIC_BLKSIZE, sizeof(char));
+  if( metabuf == NULL )
+    {
+	  sprintf(errbuf,"Cannot allocate memory for meta buffer. \n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  status = FAIL;
+	  free(errbuf);
+	  free(type);
+
+	  return(status);
+    }
+  
+  utlstr   = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if( utlstr == NULL )
+    {
+	  sprintf(errbuf,"Cannot allocate memory for utility string buffer. \n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  status = FAIL;
+	  free(errbuf);
+	  free(type);
+	  free(metabuf);
+	
+	  return(status);
+
+    }
+  
+  utlstr2  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if( utlstr2 == NULL )
+    {
+	  sprintf(errbuf,"Cannot allocate memory for the 2nd utility string buffer. \n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  status = FAIL;
+	  free(errbuf);
+	  free(type);
+	  free(metabuf);
+	  free(utlstr);
+	
+	  return(status);
+
+    }
+  
+  status = H5Dread(meta_id, atype,H5S_ALL, H5S_ALL, H5P_DEFAULT,metabuf);
+  if( status == FAIL)
+    {
+	  sprintf(errbuf, "Cannot read structural metadata. \n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(type);
+	  free(metabuf);
+	  free(utlstr);
+	  free(utlstr2);
+
+	  return(status);
+    }
+  
+  
+  
+  /* Find HDF-EOS structure "root" group in metadata */
+  /* ----------------------------------------------- */
+  /* Setup proper search string */
+  if (strcmp(structcode, "s") == 0)
+    {
+	  strcpy(utlstr, "GROUP=SwathStructure");
+    }    
+  else if (strcmp(structcode, "g") == 0)
+    {
+	  strcpy(utlstr, "GROUP=GridStructure");
+    }
+  else if (strcmp(structcode, "p") == 0)
+    {
+	  strcpy(utlstr, "GROUP=PointStructure");
+    }
+  else if (strcmp(structcode, "z") == 0)
+    {
+          strcpy(utlstr, "GROUP=ZaStructure");
+    }
+  
+
+  /* Use string search routine (strstr) to move through metadata */
+  /* ----------------------------------------------------------- */
+  metaptr = strstr(metabuf, utlstr);
+
+  if ((int)abs((int)metacode) == 0)
+   {
+     utlstr1  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char));
+     if( utlstr1 == NULL )
+      {
+          sprintf(errbuf,"Cannot allocate memory for the 2d utility string buffer. \n");
+          H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          status = FAIL;
+          free(errbuf);
+          free(type);
+          free(metabuf);
+          free(utlstr);
+          free(utlstr2);
+ 
+          return(status);
+ 
+      }
+
+     if (strcmp(structcode, "s") == 0)
+      {
+          strcpy(utlstr1, "END_GROUP=SwathStructure");
+      }
+     else if (strcmp(structcode, "g") == 0)
+      {
+          strcpy(utlstr1, "END_GROUP=GridStructure");
+      }
+     else if (strcmp(structcode, "p") == 0)
+      {
+          strcpy(utlstr1, "END_GROUP=PointStructure");
+      }
+     else if (strcmp(structcode, "z") == 0)
+      {
+          strcpy(utlstr1, "END_GROUP=ZaStructure");
+      }
+
+     newmetaptr = (char *)malloc(sizeof(char)*(strlen(metaptr)+1));
+     strcpy(newmetaptr, metaptr);
+     endptr = strstr(newmetaptr, utlstr1);
+     endptr++;
+     *endptr = '\0';
+     free(utlstr1);
+     utlstr1 = NULL;
+
+   }
+
+  /* Find specific (named) structure */
+  /* ------------------------------- */
+  if (metacode < 1000)
+	{
+	  /* Save current metadata pointer */
+	  /* ----------------------------- */
+	  prevmetaptr = metaptr;
+		
+	  /* First loop for "old-style" (non-ODL) metadata string */
+	  /* ---------------------------------------------------- */
+	  if (strcmp(structcode, "s") == 0)
+		{
+		  sprintf(utlstr, "%s%s%s", "SwathName=\"", structname, "\"");
+		}
+	  else if (strcmp(structcode, "g") == 0)
+		{
+		  sprintf(utlstr, "%s%s%s", "GridName=\"", structname, "\"");
+		}
+	  else if (strcmp(structcode, "p") == 0)
+		{
+		  sprintf(utlstr, "%s%s%s", "PointName=\"", structname, "\"");
+		}
+          else if (strcmp(structcode, "z") == 0)
+                {
+                  sprintf(utlstr, "%s%s%s", "ZaName=\"", structname, "\"");
+                }
+	
+        
+	  /* Perform string search */
+	  /* --------------------- */
+	  metaptr = strstr(metaptr, utlstr);
+          if ((int)abs((int)metacode) == 0)
+           {
+             len1 = strlen(newmetaptr);
+             newmetaptr = strstr(newmetaptr, utlstr);
+             len2 = strlen(newmetaptr);
+             difflen = len1 - len2;
+           }
+
+
+	  /*
+	   *--------------------------------------------------------------------*
+	   * If not found then return to previous position in metadata and look *
+	   *             for "new-style" (ODL) metadata string                  *
+	   *--------------------------------------------------------------------*
+	   */         
+	  if (metaptr == NULL)
+		{
+		  sprintf(utlstr, "%s%s%s", "GROUP=\"", structname, "\"");
+		  metaptr = strstr(prevmetaptr, utlstr);
+		}
+	}
+  
+
+  /* Searching for geo fields (3), data fields (4), profile fields (5), */
+  /* or point fields (11) convert type code to string designator        */
+  /* ------------------------------------------------------------------ */
+  if (metacode == 3 || metacode == 4 || metacode == 5 || metacode == 11)
+    {
+#ifndef HP9000 /* HP11 has problem with hsize_t type as switch argumet */
+      switch (metadata[0])
+#else
+	switch ((long)metadata[0])
+#endif
+          {
+          case 0:
+              strcpy(type, "H5T_NATIVE_INT");
+              break;
+          case 1:
+              strcpy(type, "H5T_NATIVE_UINT");
+              break;
+          case 2:
+              strcpy(type, "H5T_NATIVE_SHORT");
+              break;
+          case 3:
+              strcpy(type, "H5T_NATIVE_USHORT");
+              break;
+          case 4:
+              strcpy(type, "H5T_NATIVE_SCHAR");
+              break;
+          case 5:
+              strcpy(type, "H5T_NATIVE_UCHAR");
+              break;
+          case 6:
+              strcpy(type, "H5T_NATIVE_LONG");
+              break;
+          case 7:
+              strcpy(type, "H5T_NATIVE_ULONG");
+              break;
+          case 8:
+              strcpy(type, "H5T_NATIVE_LLONG");
+              break;
+          case 9:
+              strcpy(type, "H5T_NATIVE_ULLONG");
+              break;
+          case 10:
+              strcpy(type, "H5T_NATIVE_FLOAT");
+              break;
+          case 11:
+              strcpy(type, "H5T_NATIVE_DOUBLE");
+              break;
+          case 12:
+              strcpy(type, "H5T_NATIVE_LDOUBLE");
+              break;
+          case 13:
+              strcpy(type, "H5T_NATIVE_INT8");
+              break;
+          case 14:
+              strcpy(type, "H5T_NATIVE_UINT8");
+              break;
+          case 15:
+              strcpy(type, "H5T_NATIVE_INT16");
+              break;
+          case 16:
+              strcpy(type, "H5T_NATIVE_UINT16");
+              break;
+          case 17:
+              strcpy(type, "H5T_NATIVE_INT32");
+              break;
+          case 18:
+              strcpy(type, "H5T_NATIVE_UINT32");
+              break;
+          case 19:
+              strcpy(type, "H5T_NATIVE_INT64");
+              break;
+          case 20:
+              strcpy(type, "H5T_NATIVE_UINT64");
+              break;
+          case 21:
+              strcpy(type, "H5T_NATIVE_B8");
+              break;
+          case 22:
+              strcpy(type, "H5T_NATIVE_B16");
+              break;
+          case 23:
+              strcpy(type, "H5T_NATIVE_B32");
+              break;
+          case 24:
+              strcpy(type, "H5T_NATIVE_B64");
+              break;
+          case 25:
+              strcpy(type, "H5T_NATIVE_HSIZE");
+              break;
+          case 26:
+              strcpy(type, "H5T_NATIVE_HERR");
+              break;
+          case 27:
+              strcpy(type, "H5T_NATIVE_HBOOL");
+              break;
+          case 56:
+              strcpy(type, "H5T_NATIVE_CHAR");
+              break;
+          case 57:
+              strcpy(type, "HE5T_CHARSTRING");
+              break;
+          }
+    }
+
+  
+  /* Metadata Section Switch */
+  /* ----------------------- */
+  switch ((int)abs((int)metacode))
+	{
+	  
+    case 0:
+
+	  /* Dimension Section */
+	  /* ================= */
+          /* Find beginning of metadata section */
+          /* ---------------------------------- */
+          strcpy(utlstr, "\t\tGROUP=Dimension");
+          begptr = strstr(metaptr, utlstr);
+          begptr2 = strstr(newmetaptr, utlstr);
+
+          /* Search for dimension name */
+          /* ------------------------- */
+          newmetastr = (char *)malloc(sizeof(char)*strlen(metastr)+6);
+          strcpy(newmetastr, "\"");       
+          strcat(newmetastr, metastr);
+          strcat(newmetastr, "\""); 
+          dimptr = strstr(begptr2, newmetastr);
+          free(newmetastr); 
+          newmetastr = NULL;
+
+          if (dimptr != NULL)
+		{
+                  status = FAIL;
+          	  sprintf(errbuf,"Cannot redefine the dimension \"%s\". \n", metastr);
+                  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+                  HE5_EHprint(errbuf, __FILE__, __LINE__);
+                  free(errbuf);
+                  free(type);
+                  free(metabuf);
+                  free(utlstr);
+                  free(utlstr2);
+                  free(newmetaptr - difflen);
+                  return(status);
+		}
+	  else
+		{
+                  /* Find ending of metadata section */
+                  /* ------------------------------- */
+	  	  strcpy(utlstr, "\t\tEND_GROUP=Dimension");
+	  	  metaptr = strstr(metaptr, utlstr);
+		
+	  	  /* Count number of existing entries and increment */
+	  	  /* ---------------------------------------------- */
+	  	  metaArr[0] = begptr;
+	  	  metaArr[1] = metaptr;
+	  	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+
+		
+	  	  /* Build metadata entry string */
+	  	  /* --------------------------- */
+	  	  sprintf(utlstr, "%s%li%s%s%s%li%s%li%s", "\t\t\tOBJECT=Dimension_",count,"\n\t\t\t\tDimensionName=\"",&metastr[0],"\"\n\t\t\t\tSize=", (long)metadata[0],"\n\t\t\tEND_OBJECT=Dimension_", count, "\n");
+		
+		}
+
+          if (newmetaptr != NULL)
+           {
+              free(newmetaptr - difflen);
+              newmetaptr = NULL;
+           }
+
+	  break;
+		
+		
+    case 1:
+
+	  /* DimensionMap Section */
+	  /* ==================== */
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=DimensionMap");
+	  begptr = strstr(metaptr, utlstr);
+
+	  strcpy(utlstr, "\t\tEND_GROUP=DimensionMap");
+	  metaptr = strstr(metaptr, utlstr);
+
+
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+
+	  /* Initialize slen[] array */
+	  /* ----------------------- */
+	  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+		slen[ i ] = 0;
+
+	  /* Find slash within input mapping string and replace with NULL */
+	  /* ------------------------------------------------------------ */
+	  nentries = HE5_EHparsestr(metastr, '/', ptr, slen);
+	  if( nentries == 0)
+		{
+		  status = FAIL;
+		  sprintf(errbuf,"Input metadata string has no entries. \n");
+		  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(type);
+		  free(metabuf);
+		  free(utlstr);
+		  free(utlstr2);
+			
+		  return(status);
+		}
+
+	  metastr[slen[0]] = 0;
+		
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%s%s%li%s%li%s%li%s",
+			  "\t\t\tOBJECT=DimensionMap_", count,
+			  "\n\t\t\t\tGeoDimension=\"", &metastr[0],
+			  "\"\n\t\t\t\tDataDimension=\"", &metastr[slen[0] + 1],
+			  "\"\n\t\t\t\tOffset=", (long)metadata[0],
+			  "\n\t\t\t\tIncrement=", (long)metadata[1],
+			  "\n\t\t\tEND_OBJECT=DimensionMap_", count, "\n");
+	  break;
+
+	case 2:
+
+	  /* IndexDimensionMap Section */
+	  /* ========================= */
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=IndexDimensionMap");
+	  begptr = strstr(metaptr, utlstr);
+		
+	  strcpy(utlstr, "\t\tEND_GROUP=IndexDimensionMap");
+	  metaptr = strstr(metaptr, utlstr);
+		
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+		
+
+	  /* Find slash within input mapping string and replace with NULL */
+	  /* ------------------------------------------------------------ */
+	  nentries = HE5_EHparsestr(metastr, '/', ptr, slen);
+	  if( nentries == 0)
+		{
+		  status = FAIL;
+		  sprintf(errbuf,"The input metadata string has no entries. \n");
+		  H5Epush(__FILE__,"HE5_EHinsertmeta_Static", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(type);
+		  free(metabuf);
+		  free(utlstr);
+		  free(utlstr2);
+			
+		  return(status);
+		}
+	  
+	  metastr[slen[0]] = 0;
+
+		
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%s%s%li%s",
+			  "\t\t\tOBJECT=IndexDimensionMap_", count,
+			  "\n\t\t\t\tGeoDimension=\"", &metastr[0],
+			  "\"\n\t\t\t\tDataDimension=\"", &metastr[slen[0] + 1],
+			  "\"\n\t\t\tEND_OBJECT=IndexDimensionMap_", count, "\n");
+	  break;
+		
+		
+
+	case 3:
+
+	  /* Geolocation Fields Section */
+	  /* ========================== */
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=GeoField");
+	  begptr = strstr(metaptr, utlstr);
+		
+	  strcpy(utlstr, "\t\tEND_GROUP=GeoField");
+	  metaptr = strstr(metaptr, utlstr);
+		
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+		
+
+	  /* Find colon (parse off field name) */
+	  /* --------------------------------- */
+	  colon  = strchr(metastr, ':');
+	  *colon = 0;
+		
+	  /* Search for next colon (compression and/or tiling parameters) */
+	  /* ------------------------------------------------------------ */
+	  colon2 = strchr(colon + 1, ':');
+	  if (colon2 != NULL)
+		{
+		  *colon2 = 0;
+		}
+
+	  /* Make metadata string list for dimension list */
+	  /* -------------------------------------------- */
+	  status = HE5_EHmetalist(colon + 1, utlstr2);
+	  if( status == FAIL)
+		{
+		  sprintf(errbuf,"Cannot convert the string list to metadata list. \n");
+		  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(type);
+		  free(metabuf);
+		  free(utlstr);
+		  free(utlstr2);
+			
+		  return(status);
+		}
+		
+		
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%s%s%s",
+			  "\t\t\tOBJECT=GeoField_", count,
+			  "\n\t\t\t\tGeoFieldName=\"", metastr,
+			  "\"\n\t\t\t\tDataType=", type,
+			  "\n\t\t\t\tDimList=", utlstr2);
+
+
+	  /* If compression and/or tiling parameters add to string */
+	  /* ----------------------------------------------------- */
+	  if (colon2 != NULL)
+		{
+		  strcat(utlstr, colon2 + 1);
+		}
+
+	  /* Add END_OBJECT terminator to metadata string */
+	  /* -------------------------------------------- */
+	  sprintf(utlstr2, "%s%li%s", "\n\t\t\tEND_OBJECT=GeoField_", count, "\n");
+	  strcat(utlstr, utlstr2);
+
+	  break;
+
+		
+		
+	case 4:
+
+	  /* Data Fields Section */
+	  /* =================== */
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=DataField");
+	  begptr = strstr(metaptr, utlstr);
+
+	  strcpy(utlstr, "\t\tEND_GROUP=DataField");
+	  metaptr = strstr(metaptr, utlstr);
+
+		
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+
+		
+	  /* Find colon (parse off field name) */
+	  /* --------------------------------- */
+	  colon  = strchr(metastr, ':');
+	  *colon = 0;
+		
+		
+	  /* Search for next colon (compression and/or tiling parameters) */
+	  /* ------------------------------------------------------------ */
+	  colon2 = strchr(colon + 1, ':');
+	  if (colon2 != NULL)
+		{
+		  *colon2 = 0;
+		}
+
+	  /* Make metadata string list from dimension list */
+	  /* --------------------------------------------- */
+	  status = HE5_EHmetalist(colon + 1, utlstr2);
+	  if( status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot convert the string list to metadata list. \n");
+		  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(type);
+		  free(metabuf);
+		  free(utlstr);
+		  free(utlstr2);
+
+		  return(status);
+		}
+		
+		
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%s%s%s",
+			  "\t\t\tOBJECT=DataField_", count,
+			  "\n\t\t\t\tDataFieldName=\"", metastr,
+			  "\"\n\t\t\t\tDataType=", type,
+			  "\n\t\t\t\tDimList=", utlstr2);
+
+		
+
+	  /* If compression and/or tiling parameters add to string */
+	  /* ----------------------------------------------------- */
+	  if (colon2 != NULL)
+		{
+		  strcat(utlstr, colon2 + 1);
+		}
+
+	  /* Add END_OBJECT terminator to metadata string */
+	  /* -------------------------------------------- */
+	  sprintf(utlstr2, "%s%li%s", "\n\t\t\tEND_OBJECT=DataField_", count, "\n");
+	  strcat(utlstr, utlstr2);
+		
+	  break;
+	
+	case 5:
+	  
+	  /* Profile Fields Section */
+	  /* ====================== */
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=ProfileField");
+	  begptr = strstr(metaptr, utlstr);
+
+	  strcpy(utlstr, "\t\tEND_GROUP=ProfileField");
+	  metaptr = strstr(metaptr, utlstr);
+
+		
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+
+		
+	  /* Find colon (parse off profile name) */
+	  /* ----------------------------------- */
+	  colon  = strchr(metastr, ':');
+	  *colon = 0;
+		
+	  /* Search for next colon (compression and/or tiling parameters) */
+	  /* ------------------------------------------------------------ */
+	  colon2 = strchr(colon + 1, ':');
+	  if (colon2 != NULL)
+		{
+		  *colon2 = 0;
+		}
+
+	  /* Make metadata string list from dimension list */
+	  /* --------------------------------------------- */
+	  status = HE5_EHmetalist(colon + 1, utlstr2);
+	  if( status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot convert the string list to metadata list. \n");
+		  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(type);
+		  free(metabuf);
+		  free(utlstr);
+		  free(utlstr2);
+
+		  return(status);
+		}
+		
+		
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%s%s%s",
+			  "\t\t\tOBJECT=ProfileField_", count,
+			  "\n\t\t\t\tProfileFieldName=\"", metastr,
+			  "\"\n\t\t\t\tDataType=", type,
+			  "\n\t\t\t\tDimList=", utlstr2);
+
+		
+
+	  /* If compression and/or tiling parameters add to string */
+	  /* ----------------------------------------------------- */
+	  if (colon2 != NULL)
+		{
+		  strcat(utlstr, colon2 + 1);
+		}
+
+	  /* Add END_OBJECT terminator to metadata string */
+	  /* -------------------------------------------- */
+	  sprintf(utlstr2, "%s%li%s", "\n\t\t\tEND_OBJECT=ProfileField_", count, "\n");
+	  strcat(utlstr, utlstr2);
+		
+	  break;
+		
+
+	case 10:
+
+	  /* Point Level Section */
+	  /* =================== */		
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=Level");
+	  begptr = strstr(metaptr, utlstr);
+		
+	  strcpy(utlstr, "\n\t\tEND_GROUP=Level");
+	  metaptr = strstr(metaptr, utlstr) + 1;
+		
+
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntGROUP(metaArr);
+
+		
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%li%s",
+			  "\t\t\tGROUP=Level_", count,
+			  "\n\t\t\t\tLevelName=\"", metastr,
+			  "\"\n\t\t\tEND_GROUP=Level_", count, "\n");
+	  break;
+		
+		
+	case 11:
+
+	  /* Point Field Section */
+	  /* =================== */		
+	  /* Find colon (parse off point field name) */
+	  /* --------------------------------------- */
+	  colon  = strchr(metastr, ':');
+	  *colon = 0;
+		
+		
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\t\t\tLevelName=\"");
+	  strcat(utlstr, colon + 1);
+	  begptr = strstr(metaptr, utlstr);
+		
+	  strcpy(utlstr, "\t\t\tEND_GROUP=Level_");
+	  metaptr = strstr(begptr, utlstr);
+		
+
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+
+		
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%s%s%li%s%li%s",
+			  "\t\t\t\tOBJECT=PointField_", count,
+			  "\n\t\t\t\t\tPointFieldName=\"", metastr,
+			  "\"\n\t\t\t\t\tDataType=", type,
+			  "\n\t\t\t\t\tOrder=", (long)metadata[1],
+			  "\n\t\t\t\tEND_OBJECT=PointField_", count, "\n");
+	  break;
+		
+
+
+	case 12:
+
+	  /* LevelLink Section */
+	  /* ================= */
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=LevelLink");
+	  begptr = strstr(metaptr, utlstr);
+
+	  strcpy(utlstr, "\t\tEND_GROUP=LevelLink");
+	  metaptr = strstr(metaptr, utlstr);
+		
+
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+
+		
+	  /* Find colon (parse off parent/child level names from link field) */
+	  /* --------------------------------------------------------------- */
+	  colon = strchr(metastr, ':');
+	  *colon = 0;
+		
+
+	  /* Find slash (divide parent and child levels) */
+	  /* ------------------------------------------- */
+	  slash  = strchr(metastr, '/');
+	  *slash = 0;
+
+
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%s%s%s%s%li%s",
+			  "\t\t\tOBJECT=LevelLink_", count,
+			  "\n\t\t\t\tParent=\"", metastr,
+			  "\"\n\t\t\t\tChild=\"", slash + 1,
+			  "\"\n\t\t\t\tLinkField=\"", colon + 1,
+			  "\"\n\t\t\tEND_OBJECT=LevelLink_", count, "\n");
+		
+	  break;
+		
+	case 101:
+	  /* Position metadata pointer for Grid proj parms, pix reg, origin */
+	  /* -------------------------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=Dimension");
+	  metaptr = strstr(metaptr, utlstr);
+	  strcpy(utlstr, metastr);
+		
+	  break;
+		
+	case 1001:
+	  /* Position metadata pointer for new swath structure (SWcreate) */
+	  /* ------------------------------------------------------------ */
+	  strcpy(utlstr, "END_GROUP=SwathStructure");
+	  metaptr = strstr(metaptr, utlstr);
+	  strcpy(utlstr, metastr);
+		
+	  break;
+		
+
+	case 1002:
+	  /* Position metadata pointer for new grid structure (GDcreate) */
+	  /* ----------------------------------------------------------- */
+	  strcpy(utlstr, "END_GROUP=GridStructure");
+	  metaptr = strstr(metaptr, utlstr);
+	  strcpy(utlstr, metastr);
+	  break;
+	  
+	  
+	case 1003:
+	  /* Position metadata pointer for new point structure (PTcreate) */
+	  /* ------------------------------------------------------------ */
+	  strcpy(utlstr, "END_GROUP=PointStructure");
+	  metaptr = strstr(metaptr, utlstr);
+	  strcpy(utlstr, metastr);
+	  break;
+	  
+        case 1004:
+          /* Position metadata pointer for new za structure (ZAcreate) */
+          /* ------------------------------------------------------------ */
+          strcpy(utlstr, "END_GROUP=ZaStructure");
+          metaptr = strstr(metaptr, utlstr);
+          strcpy(utlstr, metastr);
+ 
+          break;
+
+	default:
+	  {
+		sprintf(errbuf, "Unknown metacode.\n");
+		H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  }
+	  break;
+	  
+	}
+  
+  /* Get offset of entry postion within existing metadata */
+  /* ---------------------------------------------------- */
+  offset = (long)(metaptr - metabuf);
+  
+  /* Reallocate memory for a new metadata array, newbuf */
+  /* ------------------------------------------------------ */
+  newbuf = (char *) calloc(HE5_HeosTable[fid%HE5_EHIDOFFSET].HE5_STATIC_BLKSIZE, sizeof(char));
+  if(newbuf==NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for a new metadata string.\n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  status = FAIL;
+	  free(errbuf);
+	  free(type);
+	  free(metabuf);
+	  free(utlstr);
+	  free(utlstr2);
+		
+	  return(status);
+	}
+  
+  /* Copy new metadata string to newbuf array */
+  /* ---------------------------------------- */
+  for(i = 0; i < offset; i++)
+	newbuf[ i ] = metabuf[ i ];
+  
+  newbuf[ offset ] = 0;
+  
+  strcat( newbuf, utlstr);
+  strcat( newbuf, metaptr);
+  
+  tempdim = (hsize_t)strlen( newbuf );
+  
+  tempdim++;
+  
+  /*
+   *-----------------------------------------------------------------*
+   *     Write metadata back  to dataset "StructMetadata.0"          *
+   *-----------------------------------------------------------------*
+   */
+  
+  
+  /*   H5Sset_extent_simple(aspace, 1, &tempdim, 0 ); NOT SUPPORTED YET !!! */ 
+  /*   H5Dextend(meta_id, &tempdim);                  NOT SUPPORTED YET !!! */ 
+  
+  
+  status  = H5Dwrite(meta_id, atype, H5S_ALL, H5S_ALL, H5P_DEFAULT, newbuf); 
+  if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write in structural metadata.\n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(type);
+	  free(metabuf);
+	  free(utlstr);
+	  free(utlstr2);
+	  free(newbuf);
+	
+	  return(status);
+	}
+  
+  free(metabuf);
+  free(newbuf);
+  free(utlstr);
+  free(utlstr2);
+  free(type);
+  
+  metabuf = NULL;
+  newbuf  = NULL;
+  utlstr2 = NULL;
+  utlstr  = NULL; 
+  type    = NULL;
+  
+  status = H5Sclose(aspace); 
+  if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return(status);
+	}
+  
+  status = H5Tclose(atype); 
+  if( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the data type ID.\n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return(status);
+	}
+  status = H5Dclose(meta_id);
+  if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the dataset ID.\n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return(status);
+	}
+  status = H5Gclose(gid);
+  if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the group ID.\n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Static", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return(status);
+	}
+  
+  free(errbuf);
+  errbuf = NULL;
+
+ COMPLETION:  
+
+  return status;
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHinsertmeta_Dynamic                                         |
+|                                                                             |
+|  DESCRIPTION: Writes metadata using dynamic buffer                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|    status       herr_t  None        return status variable (0 for success,  |
+|                                          -1 for failure)                    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|    fid          hid_t   None        HDF-EOS file ID                         |
+|    structname   char*   None        Object name string                      |
+|    structcode   char*   None        "s" for a swath, "g" for a grid,        |
+|                                     "p" for a point, and "z" for a za.      |
+|    metacode     long    None        Code of a metadata block to insert to.  |
+|    metastr      char*   None        Buffer containing metadata information  |
+|                                      to insert.                             |
+|    metadata[]   hsize_t None        Array of data values                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|    None                                                                     |
+|                                                                             |
+|  NOTES:   memory allocation is in cuncks of HE5_DYNAMIC_BLKSIZE (new scheme)|
+|           allocated dynamically.                                            |
+|           The chuncks will be written to datasets "StructMetadata.0",       |
+|           "StructMetadata.1", "StructMetadata.2", etc.                      |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  05/17/04  Abe Taaheri  Added to support dynamic allocation of metadata     |
+|                         buffer                                              |
+|  May 05    S.Zhao       Added data type string designators in the dataset   |
+|                         "StructMetadata.X".                                 |
+|  Feb 06    Abe Taaheri  Casted Switch argument to long for HP11             |
+|  Oct 11    Abe Taaheri  Corrected end of structre metadata by adding one    |
+|                         more NULL character to the end of it (without this  |
+|                         change a garbage character was present at the end   |
+|                         of last piece of multiple 32000 size  structre      |
+|                         metadatas).                                         |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_EHinsertmeta_Dynamic(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]) 
+{
+  herr_t         status   = FAIL;    /* routine return status variable            */
+
+  int            i;                  /* Loop index                                */
+ 
+  hid_t          gid      = FAIL;    /* "HDFEOS INFORMATION" group ID             */
+  hid_t          meta_id[MetaBlocks]  = {FAIL};    /* "StructuralMetadat.0" group ID            */
+  hid_t          atype[MetaBlocks]    = {FAIL};    /* Data type ID                              */
+  hid_t          aspace[MetaBlocks]   = {FAIL};    /* Data space ID                             */
+  hid_t          HDFfid   = FAIL;    /* HDF5 file ID                              */
+
+  size_t         slen[HE5_DTSETRANKMAX];/* String length array                    */
+  
+  hsize_t        tempdim  =  0;      /* Temporary variable                        */
+  
+  long           count    = 0;       /* Objects/Groups counter                    */
+  long           offset   = 0;       /* Offset insertion position of new metadata */
+  long           nentries = 0;       /* Number of comma separated string entries  */
+  
+  char           *metabuf = NULL;    /* Pointer to Structural Metadata array      */
+  char           *begptr  = NULL;    /* Pointer to beginning of metadata section  */
+  char           *metaptr = NULL;    /* Metadata pointer                          */
+  char           *prevmetaptr = NULL;/* Previous position of metadata pointer     */
+  char           *ptr[HE5_DTSETRANKMAX];/* String pointer array                   */
+  char           *metaArr[2]={NULL,NULL};/* Array of metadata positions           */
+  char           *colon   = NULL;    /* Colon position                            */
+  char           *colon2  = NULL;    /* 2nd colon position                        */
+  char           *slash   = NULL;    /* Slash postion                             */
+  char           *utlstr  = NULL;    /* Utility string                            */
+  char           *utlstr1 = NULL;    /* Utility string 1                          */
+  char           *utlstr2 = NULL;    /* Utility string 2                          */
+  char           *newbuf  = NULL;    /* updated metadata string                   */
+  char           *type    = NULL;    /* data type string                          */
+  char           *errbuf  = NULL;    /* Error message buffer                      */
+  char           *dimptr  = NULL;    /* Dimension pointer                         */
+  char           *newmetastr = NULL; /* Modified metadata string                  */
+  char           *endptr  = NULL;    /* Pointer to ending of metadata section     */
+  char           *newmetaptr = NULL; /* Updated metadata pointer                  */
+  char           *begptr2  = NULL;   /* Pointer 2 to beginning of metadata section*/
+  int            len1, len2, difflen = 0;
+
+  long           nmeta;
+  /*char           *metobjectlist;*/
+  /*long           *metstrbufsize = 0;*/
+  char           metutlstr[32];
+  int            ism;
+  long           metalen, seglen;
+  size_t         size      =  0;     /* Data size (bytes)     */
+
+  CHECKPOINTER(structname);
+  CHECKPOINTER(structcode);
+  CHECKPOINTER(metastr);
+
+
+  Stored_meta[fid%HE5_EHIDOFFSET].metaread_flag = 0;
+
+  /* Get HDF file ID */
+  /* --------------- */
+  HDFfid = HE5_HeosTable[fid%HE5_EHIDOFFSET].HDFfid;
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+	  HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+	  return(FAIL);
+    }
+  
+  /* Allocate memory for data type string */
+  /* ------------------------------------ */
+  type = (char * )calloc( HE5_HDFE_TYPESTRSIZE, sizeof(char));
+  if(type == NULL)
+    {
+	  sprintf(errbuf,"Cannot allocate memory for data type string. \n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+     
+	  return(FAIL);
+    }
+  
+  /* Open "HDFEOS INFORMATION" group */
+  /* =============================== */
+  gid     = H5Gopen(HDFfid, "HDFEOS INFORMATION");
+  if(gid == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot open \"HDFEOS INFORMATION\" group. \n");
+      H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(type);
+      
+      return(status);
+    }
+  
+  
+  /* Determine number of structural metadata "sections" */
+  /* -------------------------------------------------- */
+  nmeta = 0;
+  status= HE5_EHgetnmeta(gid, &nmeta);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot find any StructMetadata.X dataset. \n");
+      H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      
+      return(FAIL);
+    }
+
+    /* Allocate space for metadata (in units of 32000 bytes) */
+    /* ----------------------------------------------------- */
+    metabuf = (char *) calloc(HE5_DYNAMIC_BLKSIZE * nmeta, sizeof(char ));
+    if(metabuf == NULL)
+    { 
+      sprintf(errbuf, "Cannot allocate memory for the metadata buffer. \n");
+      H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(type);
+
+      return(FAIL);
+    }
+
+    /* Read structural metadata from all StructMetadata datasets */
+    /* --------------------------------------------------------- */
+    for (ism = 0; ism < nmeta; ism++)
+      {
+	/*
+	 *--------------------------------------------------------------*
+	 * Open dataset "StructMetadata.X", get datatype and space ID   *
+	 *--------------------------------------------------------------*
+	 */
+	sprintf(metutlstr, "%s%d", "StructMetadata.", ism);
+	meta_id[ism] = H5Dopen(gid, metutlstr); 
+	metalen = strlen(metabuf);
+	if( meta_id[ism] == FAIL)
+	  {
+	    status = FAIL;
+	    sprintf(errbuf,"Cannot open %s dataset. \n",metutlstr);
+	    H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    free(type);
+	    free(metabuf);
+	    
+	    return(status);
+	  }
+	atype[ism]   = H5Dget_type(meta_id[ism]);
+	if( atype[ism] == FAIL)
+	  {
+	    status = FAIL;
+	    sprintf(errbuf,"Cannot get the dataset datatype. \n");
+	    H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    free(type);
+	    free(metabuf);
+	    status = H5Dclose(meta_id[ism]);
+	    return(status);
+	  }
+	aspace[ism] = H5Dget_space(meta_id[ism]);
+	if( aspace[ism] == FAIL )
+	  {
+	    status = FAIL;
+	    sprintf(errbuf,"Cannot get the dataset dataspace. \n");
+	    H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    free(type);
+	    free(metabuf);
+	    status = H5Tclose(atype[ism]); 
+	    status = H5Dclose(meta_id[ism]);
+	    return(status);
+	  }
+	
+	
+	/*
+	  
+     NOTE: this call is now supported for a string and is used now 
+           in HE5_EHattrinfo to get the number of elements for string array
+	npoints = H5Sget_simple_extent_npoints(aspace);
+	it will be implemented for memory allocation for metabuf[] array
+	
+	*/
+	
+	
+	
+	/*
+	 *-------------------------------------------------------------*
+	 *   Allocate memory for the output array and Read attribute   *
+	 *-------------------------------------------------------------*
+	 */
+	
+	utlstr   = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char));
+	if( utlstr == NULL )
+	  {
+	    sprintf(errbuf,"Cannot allocate memory for utility string buffer. \n");
+	    H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    status = FAIL;
+	    free(errbuf);
+	    free(type);
+	    free(metabuf);
+	    
+	    return(status);
+	    
+	  }
+	
+	utlstr2  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char));
+	if( utlstr2 == NULL )
+	  {
+	    sprintf(errbuf,"Cannot allocate memory for the 2d utility string buffer. \n");
+	    H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    status = FAIL;
+	    free(errbuf);
+	    free(type);
+	    free(metabuf);
+	    free(utlstr);
+	    
+	    return(status);
+	    
+	  }
+	
+	status = H5Dread(meta_id[ism], atype[ism],H5S_ALL, H5S_ALL, H5P_DEFAULT, 
+			 metabuf + metalen);
+	if( status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot read structural metadata. \n");
+	    H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    free(type);
+	    free(metabuf);
+	    free(utlstr);
+	    free(utlstr2);
+	    
+	    return(status);
+	  }
+      }
+    
+    /* Determine length (# of characters) of metadata */
+    /* ---------------------------------------------- */
+    metalen = strlen(metabuf);
+    
+    /* Find HDF-EOS structure "root" group in metadata */
+    /* ----------------------------------------------- */
+    /* Setup proper search string */
+    if (strcmp(structcode, "s") == 0)
+      {
+	strcpy(utlstr, "GROUP=SwathStructure");
+      }    
+    else if (strcmp(structcode, "g") == 0)
+      {
+	strcpy(utlstr, "GROUP=GridStructure");
+      }
+    else if (strcmp(structcode, "p") == 0)
+      {
+	strcpy(utlstr, "GROUP=PointStructure");
+      }
+    else if (strcmp(structcode, "z") == 0)
+      {
+	strcpy(utlstr, "GROUP=ZaStructure");
+      }
+    
+    
+    /* Use string search routine (strstr) to move through metadata */
+    /* ----------------------------------------------------------- */
+    metaptr = strstr(metabuf, utlstr);
+    
+    if ((int)abs((int)metacode) == 0)
+      {
+	utlstr1  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char));
+	if( utlstr1 == NULL )
+	  {
+	    sprintf(errbuf,"Cannot allocate memory for the 2d utility string buffer. \n");
+	    H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    status = FAIL;
+	    free(errbuf);
+	    free(type);
+	    free(metabuf);
+	    free(utlstr);
+	    free(utlstr2);
+	    
+	    return(status);
+	    
+	  }
+	
+	if (strcmp(structcode, "s") == 0)
+	  {
+	    strcpy(utlstr1, "END_GROUP=SwathStructure");
+	  }
+	else if (strcmp(structcode, "g") == 0)
+	  {
+	    strcpy(utlstr1, "END_GROUP=GridStructure");
+	  }
+	else if (strcmp(structcode, "p") == 0)
+	  {
+	    strcpy(utlstr1, "END_GROUP=PointStructure");
+	  }
+	else if (strcmp(structcode, "z") == 0)
+	  {
+	    strcpy(utlstr1, "END_GROUP=ZaStructure");
+	  }
+	
+	newmetaptr = (char *)malloc(sizeof(char)*(strlen(metaptr)+1));
+	strcpy(newmetaptr, metaptr);
+	endptr = strstr(newmetaptr, utlstr1);
+	endptr++;
+	*endptr = '\0';
+	free(utlstr1);
+	utlstr1 = NULL;
+	
+      }
+    
+    /* Find specific (named) structure */
+    /* ------------------------------- */
+    if (metacode < 1000)
+      {
+	/* Save current metadata pointer */
+	/* ----------------------------- */
+	prevmetaptr = metaptr;
+	
+	/* First loop for "old-style" (non-ODL) metadata string */
+	/* ---------------------------------------------------- */
+	if (strcmp(structcode, "s") == 0)
+	  {
+	    sprintf(utlstr, "%s%s%s", "SwathName=\"", structname, "\"");
+	  }
+	else if (strcmp(structcode, "g") == 0)
+	  {
+	    sprintf(utlstr, "%s%s%s", "GridName=\"", structname, "\"");
+	  }
+	else if (strcmp(structcode, "p") == 0)
+	  {
+	    sprintf(utlstr, "%s%s%s", "PointName=\"", structname, "\"");
+	  }
+	else if (strcmp(structcode, "z") == 0)
+	  {
+	    sprintf(utlstr, "%s%s%s", "ZaName=\"", structname, "\"");
+	  }
+	  
+	
+	/* Perform string search */
+	/* --------------------- */
+	metaptr = strstr(metaptr, utlstr);
+	if ((int)abs((int)metacode) == 0)
+	  {
+	    len1 = strlen(newmetaptr);
+	    newmetaptr = strstr(newmetaptr, utlstr);
+	    len2 = strlen(newmetaptr);
+	    difflen = len1 - len2;
+	  }
+	
+	
+	/*
+	 *--------------------------------------------------------------------*
+	 * If not found then return to previous position in metadata and look *
+	 *             for "new-style" (ODL) metadata string                  *
+	 *--------------------------------------------------------------------*
+	 */         
+	if (metaptr == NULL)
+	  {
+	    sprintf(utlstr, "%s%s%s", "GROUP=\"", structname, "\"");
+	    metaptr = strstr(prevmetaptr, utlstr);
+	  }
+      }
+
+
+    /* Searching for geo fields (3), data fields (4), profile fields (5), */
+    /* or point fields (11) convert type code to string designator        */
+    /* ------------------------------------------------------------------ */
+    if (metacode == 3 || metacode == 4 || metacode == 5 || metacode == 11)
+      {
+#ifndef HP9000 /* HP11 has problem with hsize_t type as switch argumet */
+      switch (metadata[0])
+#else
+	switch ((long)metadata[0])
+#endif
+          {
+          case 0:
+              strcpy(type, "H5T_NATIVE_INT");
+              break;
+          case 1:
+              strcpy(type, "H5T_NATIVE_UINT");
+              break;
+          case 2:
+              strcpy(type, "H5T_NATIVE_SHORT");
+              break;
+          case 3:
+              strcpy(type, "H5T_NATIVE_USHORT");
+              break;
+          case 4:
+              strcpy(type, "H5T_NATIVE_SCHAR");
+              break;
+          case 5:
+              strcpy(type, "H5T_NATIVE_UCHAR");
+              break;
+          case 6:
+              strcpy(type, "H5T_NATIVE_LONG");
+              break;
+          case 7:
+              strcpy(type, "H5T_NATIVE_ULONG");
+              break;
+          case 8:
+              strcpy(type, "H5T_NATIVE_LLONG");
+              break;
+          case 9:
+              strcpy(type, "H5T_NATIVE_ULLONG");
+              break;
+          case 10:
+              strcpy(type, "H5T_NATIVE_FLOAT");
+              break;
+          case 11:
+              strcpy(type, "H5T_NATIVE_DOUBLE");
+              break;
+          case 12:
+              strcpy(type, "H5T_NATIVE_LDOUBLE");
+              break;
+          case 13:
+              strcpy(type, "H5T_NATIVE_INT8");
+              break;
+          case 14:
+              strcpy(type, "H5T_NATIVE_UINT8");
+              break;
+          case 15:
+              strcpy(type, "H5T_NATIVE_INT16");
+              break;
+          case 16:
+              strcpy(type, "H5T_NATIVE_UINT16");
+              break;
+          case 17:
+              strcpy(type, "H5T_NATIVE_INT32");
+              break;
+          case 18:
+              strcpy(type, "H5T_NATIVE_UINT32");
+              break;
+          case 19:
+              strcpy(type, "H5T_NATIVE_INT64");
+              break;
+          case 20:
+              strcpy(type, "H5T_NATIVE_UINT64");
+              break;
+          case 21:
+              strcpy(type, "H5T_NATIVE_B8");
+              break;
+          case 22:
+              strcpy(type, "H5T_NATIVE_B16");
+              break;
+          case 23:
+              strcpy(type, "H5T_NATIVE_B32");
+              break;
+          case 24:
+              strcpy(type, "H5T_NATIVE_B64");
+              break;
+          case 25:
+              strcpy(type, "H5T_NATIVE_HSIZE");
+              break;
+          case 26:
+              strcpy(type, "H5T_NATIVE_HERR");
+              break;
+          case 27:
+              strcpy(type, "H5T_NATIVE_HBOOL");
+              break;
+          case 56:
+              strcpy(type, "H5T_NATIVE_CHAR");
+              break;
+          case 57:
+              strcpy(type, "HE5T_CHARSTRING");
+              break;
+          }
+      }
+
+    
+    /* Metadata Section Switch */
+    /* ----------------------- */
+    switch ((int)abs((int)metacode))
+      {
+	
+      case 0:
+
+	  /* Dimension Section */
+	  /* ================= */
+          /* Find beginning of metadata section */
+          /* ---------------------------------- */
+         strcpy(utlstr, "\t\tGROUP=Dimension");
+          begptr = strstr(metaptr, utlstr);
+          begptr2 = strstr(newmetaptr, utlstr);
+
+          /* Search for dimension name */
+          /* ------------------------- */
+          newmetastr = (char *)malloc(sizeof(char)*strlen(metastr)+6);
+          strcpy(newmetastr, "\"");       
+          strcat(newmetastr, metastr);
+          strcat(newmetastr, "\""); 
+          dimptr = strstr(begptr2, newmetastr);
+          free(newmetastr); 
+          newmetastr = NULL;
+
+          if (dimptr != NULL)
+		{
+                  status = FAIL;
+          	  sprintf(errbuf,"Cannot redefine the dimension \"%s\". \n", metastr);
+                  H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+                  HE5_EHprint(errbuf, __FILE__, __LINE__);
+                  free(errbuf);
+                  free(type);
+                  free(metabuf);
+                  free(utlstr);
+                  free(utlstr2);
+                  free(newmetaptr - difflen);
+                  return(status);
+		}
+	  else
+		{
+                  /* Find ending of metadata section */
+                  /* ------------------------------- */
+	  	  strcpy(utlstr, "\t\tEND_GROUP=Dimension");
+	  	  metaptr = strstr(metaptr, utlstr);
+		
+	  	  /* Count number of existing entries and increment */
+	  	  /* ---------------------------------------------- */
+	  	  metaArr[0] = begptr;
+	  	  metaArr[1] = metaptr;
+	  	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+
+		
+	  	  /* Build metadata entry string */
+	  	  /* --------------------------- */
+	  	  sprintf(utlstr, "%s%li%s%s%s%li%s%li%s", "\t\t\tOBJECT=Dimension_",count,"\n\t\t\t\tDimensionName=\"",&metastr[0],"\"\n\t\t\t\tSize=", (long)metadata[0],"\n\t\t\tEND_OBJECT=Dimension_", count, "\n");
+		
+		}
+
+          if (newmetaptr != NULL)
+           {
+              free(newmetaptr - difflen);
+              newmetaptr = NULL;
+           }
+
+	  break;
+		
+		
+    case 1:
+
+	  /* DimensionMap Section */
+	  /* ==================== */
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=DimensionMap");
+	  begptr = strstr(metaptr, utlstr);
+
+	  strcpy(utlstr, "\t\tEND_GROUP=DimensionMap");
+	  metaptr = strstr(metaptr, utlstr);
+
+
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+
+	  /* Initialize slen[] array */
+	  /* ----------------------- */
+	  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+		slen[ i ] = 0;
+
+	  /* Find slash within input mapping string and replace with NULL */
+	  /* ------------------------------------------------------------ */
+	  nentries = HE5_EHparsestr(metastr, '/', ptr, slen);
+	  if( nentries == 0)
+		{
+		  status = FAIL;
+		  sprintf(errbuf,"Input metadata string has no entries. \n");
+		  H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(type);
+		  free(metabuf);
+		  free(utlstr);
+		  free(utlstr2);
+			
+		  return(status);
+		}
+
+	  metastr[slen[0]] = 0;
+		
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%s%s%li%s%li%s%li%s",
+			  "\t\t\tOBJECT=DimensionMap_", count,
+			  "\n\t\t\t\tGeoDimension=\"", &metastr[0],
+			  "\"\n\t\t\t\tDataDimension=\"", &metastr[slen[0] + 1],
+			  "\"\n\t\t\t\tOffset=", (long)metadata[0],
+			  "\n\t\t\t\tIncrement=", (long)metadata[1],
+			  "\n\t\t\tEND_OBJECT=DimensionMap_", count, "\n");
+	  break;
+
+	case 2:
+
+	  /* IndexDimensionMap Section */
+	  /* ========================= */
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=IndexDimensionMap");
+	  begptr = strstr(metaptr, utlstr);
+		
+	  strcpy(utlstr, "\t\tEND_GROUP=IndexDimensionMap");
+	  metaptr = strstr(metaptr, utlstr);
+		
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+		
+
+	  /* Find slash within input mapping string and replace with NULL */
+	  /* ------------------------------------------------------------ */
+	  nentries = HE5_EHparsestr(metastr, '/', ptr, slen);
+	  if( nentries == 0)
+		{
+		  status = FAIL;
+		  sprintf(errbuf,"The input metadata string has no entries. \n");
+		  H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(type);
+		  free(metabuf);
+		  free(utlstr);
+		  free(utlstr2);
+			
+		  return(status);
+		}
+	  
+	  metastr[slen[0]] = 0;
+
+		
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%s%s%li%s",
+			  "\t\t\tOBJECT=IndexDimensionMap_", count,
+			  "\n\t\t\t\tGeoDimension=\"", &metastr[0],
+			  "\"\n\t\t\t\tDataDimension=\"", &metastr[slen[0] + 1],
+			  "\"\n\t\t\tEND_OBJECT=IndexDimensionMap_", count, "\n");
+	  break;
+		
+		
+
+	case 3:
+
+	  /* Geolocation Fields Section */
+	  /* ========================== */
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=GeoField");
+	  begptr = strstr(metaptr, utlstr);
+		
+	  strcpy(utlstr, "\t\tEND_GROUP=GeoField");
+	  metaptr = strstr(metaptr, utlstr);
+		
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+		
+
+	  /* Find colon (parse off field name) */
+	  /* --------------------------------- */
+	  colon  = strchr(metastr, ':');
+	  *colon = 0;
+		
+	  /* Search for next colon (compression and/or tiling parameters) */
+	  /* ------------------------------------------------------------ */
+	  colon2 = strchr(colon + 1, ':');
+	  if (colon2 != NULL)
+		{
+		  *colon2 = 0;
+		}
+
+	  /* Make metadata string list for dimension list */
+	  /* -------------------------------------------- */
+	  status = HE5_EHmetalist(colon + 1, utlstr2);
+	  if( status == FAIL)
+		{
+		  sprintf(errbuf,"Cannot convert the string list to metadata list. \n");
+		  H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(type);
+		  free(metabuf);
+		  free(utlstr);
+		  free(utlstr2);
+			
+		  return(status);
+		}
+		
+		
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%s%s%s",
+			  "\t\t\tOBJECT=GeoField_", count,
+			  "\n\t\t\t\tGeoFieldName=\"", metastr,
+			  "\"\n\t\t\t\tDataType=", type,
+			  "\n\t\t\t\tDimList=", utlstr2);
+
+
+	  /* If compression and/or tiling parameters add to string */
+	  /* ----------------------------------------------------- */
+	  if (colon2 != NULL)
+		{
+		  strcat(utlstr, colon2 + 1);
+		}
+
+	  /* Add END_OBJECT terminator to metadata string */
+	  /* -------------------------------------------- */
+	  sprintf(utlstr2, "%s%li%s", "\n\t\t\tEND_OBJECT=GeoField_", count, "\n");
+	  strcat(utlstr, utlstr2);
+
+	  break;
+
+		
+		
+	case 4:
+
+	  /* Data Fields Section */
+	  /* =================== */
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=DataField");
+	  begptr = strstr(metaptr, utlstr);
+
+	  strcpy(utlstr, "\t\tEND_GROUP=DataField");
+	  metaptr = strstr(metaptr, utlstr);
+
+		
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+
+		
+	  /* Find colon (parse off field name) */
+	  /* --------------------------------- */
+	  colon  = strchr(metastr, ':');
+	  *colon = 0;
+		
+		
+	  /* Search for next colon (compression and/or tiling parameters) */
+	  /* ------------------------------------------------------------ */
+	  colon2 = strchr(colon + 1, ':');
+	  if (colon2 != NULL)
+		{
+		  *colon2 = 0;
+		}
+
+	  /* Make metadata string list from dimension list */
+	  /* --------------------------------------------- */
+	  status = HE5_EHmetalist(colon + 1, utlstr2);
+	  if( status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot convert the string list to metadata list. \n");
+		  H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(type);
+		  free(metabuf);
+		  free(utlstr);
+		  free(utlstr2);
+
+		  return(status);
+		}
+		
+		
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%s%s%s",
+			  "\t\t\tOBJECT=DataField_", count,
+			  "\n\t\t\t\tDataFieldName=\"", metastr,
+			  "\"\n\t\t\t\tDataType=", type,
+			  "\n\t\t\t\tDimList=", utlstr2);
+
+		
+
+	  /* If compression and/or tiling parameters add to string */
+	  /* ----------------------------------------------------- */
+	  if (colon2 != NULL)
+		{
+		  strcat(utlstr, colon2 + 1);
+		}
+
+	  /* Add END_OBJECT terminator to metadata string */
+	  /* -------------------------------------------- */
+	  sprintf(utlstr2, "%s%li%s", "\n\t\t\tEND_OBJECT=DataField_", count, "\n");
+	  strcat(utlstr, utlstr2);
+		
+	  break;
+	
+	case 5:
+	  
+	  /* Profile Fields Section */
+	  /* ====================== */
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=ProfileField");
+	  begptr = strstr(metaptr, utlstr);
+
+	  strcpy(utlstr, "\t\tEND_GROUP=ProfileField");
+	  metaptr = strstr(metaptr, utlstr);
+
+		
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+
+		
+	  /* Find colon (parse off profile name) */
+	  /* ----------------------------------- */
+	  colon  = strchr(metastr, ':');
+	  *colon = 0;
+		
+	  /* Search for next colon (compression and/or tiling parameters) */
+	  /* ------------------------------------------------------------ */
+	  colon2 = strchr(colon + 1, ':');
+	  if (colon2 != NULL)
+		{
+		  *colon2 = 0;
+		}
+
+	  /* Make metadata string list from dimension list */
+	  /* --------------------------------------------- */
+	  status = HE5_EHmetalist(colon + 1, utlstr2);
+	  if( status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot convert the string list to metadata list. \n");
+		  H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(type);
+		  free(metabuf);
+		  free(utlstr);
+		  free(utlstr2);
+
+		  return(status);
+		}
+		
+		
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%s%s%s",
+			  "\t\t\tOBJECT=ProfileField_", count,
+			  "\n\t\t\t\tProfileFieldName=\"", metastr,
+			  "\"\n\t\t\t\tDataType=", type,
+			  "\n\t\t\t\tDimList=", utlstr2);
+
+		
+
+	  /* If compression and/or tiling parameters add to string */
+	  /* ----------------------------------------------------- */
+	  if (colon2 != NULL)
+		{
+		  strcat(utlstr, colon2 + 1);
+		}
+
+	  /* Add END_OBJECT terminator to metadata string */
+	  /* -------------------------------------------- */
+	  sprintf(utlstr2, "%s%li%s", "\n\t\t\tEND_OBJECT=ProfileField_", count, "\n");
+	  strcat(utlstr, utlstr2);
+		
+	  break;
+		
+
+	case 10:
+
+	  /* Point Level Section */
+	  /* =================== */		
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=Level");
+	  begptr = strstr(metaptr, utlstr);
+		
+	  strcpy(utlstr, "\n\t\tEND_GROUP=Level");
+	  metaptr = strstr(metaptr, utlstr) + 1;
+		
+
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntGROUP(metaArr);
+
+		
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%li%s",
+			  "\t\t\tGROUP=Level_", count,
+			  "\n\t\t\t\tLevelName=\"", metastr,
+			  "\"\n\t\t\tEND_GROUP=Level_", count, "\n");
+	  break;
+		
+		
+	case 11:
+
+	  /* Point Field Section */
+	  /* =================== */		
+	  /* Find colon (parse off point field name) */
+	  /* --------------------------------------- */
+	  colon  = strchr(metastr, ':');
+	  *colon = 0;
+		
+		
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\t\t\tLevelName=\"");
+	  strcat(utlstr, colon + 1);
+	  begptr = strstr(metaptr, utlstr);
+		
+	  strcpy(utlstr, "\t\t\tEND_GROUP=Level_");
+	  metaptr = strstr(begptr, utlstr);
+		
+
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+
+		
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%s%s%li%s%li%s",
+			  "\t\t\t\tOBJECT=PointField_", count,
+			  "\n\t\t\t\t\tPointFieldName=\"", metastr,
+			  "\"\n\t\t\t\t\tDataType=", type,
+			  "\n\t\t\t\t\tOrder=", (long)metadata[1],
+			  "\n\t\t\t\tEND_OBJECT=PointField_", count, "\n");
+	  break;
+		
+
+
+	case 12:
+
+	  /* LevelLink Section */
+	  /* ================= */
+	  /* Find beginning and ending of metadata section */
+	  /* --------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=LevelLink");
+	  begptr = strstr(metaptr, utlstr);
+
+	  strcpy(utlstr, "\t\tEND_GROUP=LevelLink");
+	  metaptr = strstr(metaptr, utlstr);
+		
+
+	  /* Count number of existing entries and increment */
+	  /* ---------------------------------------------- */
+	  metaArr[0] = begptr;
+	  metaArr[1] = metaptr;
+	  count      = HE5_EHcntOBJECT(metaArr) + 1;
+
+		
+	  /* Find colon (parse off parent/child level names from link field) */
+	  /* --------------------------------------------------------------- */
+	  colon = strchr(metastr, ':');
+	  *colon = 0;
+		
+
+	  /* Find slash (divide parent and child levels) */
+	  /* ------------------------------------------- */
+	  slash  = strchr(metastr, '/');
+	  *slash = 0;
+
+
+	  /* Build metadata entry string */
+	  /* --------------------------- */
+	  sprintf(utlstr, "%s%li%s%s%s%s%s%s%s%li%s",
+			  "\t\t\tOBJECT=LevelLink_", count,
+			  "\n\t\t\t\tParent=\"", metastr,
+			  "\"\n\t\t\t\tChild=\"", slash + 1,
+			  "\"\n\t\t\t\tLinkField=\"", colon + 1,
+			  "\"\n\t\t\tEND_OBJECT=LevelLink_", count, "\n");
+		
+	  break;
+		
+	case 101:
+	  /* Position metadata pointer for Grid proj parms, pix reg, origin */
+	  /* -------------------------------------------------------------- */
+	  strcpy(utlstr, "\t\tGROUP=Dimension");
+	  metaptr = strstr(metaptr, utlstr);
+	  strcpy(utlstr, metastr);
+		
+	  break;
+		
+	case 1001:
+	  /* Position metadata pointer for new swath structure (SWcreate) */
+	  /* ------------------------------------------------------------ */
+	  strcpy(utlstr, "END_GROUP=SwathStructure");
+	  metaptr = strstr(metaptr, utlstr);
+	  strcpy(utlstr, metastr);
+		
+	  break;
+		
+
+	case 1002:
+	  /* Position metadata pointer for new grid structure (GDcreate) */
+	  /* ----------------------------------------------------------- */
+	  strcpy(utlstr, "END_GROUP=GridStructure");
+	  metaptr = strstr(metaptr, utlstr);
+	  strcpy(utlstr, metastr);
+	  break;
+	  
+	  
+	case 1003:
+	  /* Position metadata pointer for new point structure (PTcreate) */
+	  /* ------------------------------------------------------------ */
+	  strcpy(utlstr, "END_GROUP=PointStructure");
+	  metaptr = strstr(metaptr, utlstr);
+	  strcpy(utlstr, metastr);
+	  break;
+	  
+        case 1004:
+          /* Position metadata pointer for new za structure (ZAcreate) */
+          /* ------------------------------------------------------------ */
+          strcpy(utlstr, "END_GROUP=ZaStructure");
+          metaptr = strstr(metaptr, utlstr);
+          strcpy(utlstr, metastr);
+ 
+          break;
+
+	default:
+	  {
+		sprintf(errbuf, "Unknown metacode.\n");
+		H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  }
+	  break;
+	  
+	}
+
+    /* Get length of metadata string to insert */
+    /* --------------------------------------- */
+    seglen = strlen(utlstr);
+    
+    /* Get offset of entry postion within existing metadata */
+    /* ---------------------------------------------------- */
+    offset = (long)(metaptr - metabuf);
+    
+    /* If end of new metadata string outside of current metadata buffer ... */
+    /* -------------------------------------------------------------------- */
+    if (metalen + seglen > HE5_DYNAMIC_BLKSIZE * nmeta - 1)
+      {
+	/* Reallocate metadata buffer with additional HE5_DYNAMIC_BLKSIZE bytes */
+	/* -------------------------------------------------------------------- */
+	newbuf = (char *) calloc(HE5_DYNAMIC_BLKSIZE * (nmeta + 1), sizeof(char));
+	
+	if(newbuf == NULL)
+	  { 
+	    sprintf(errbuf, "Cannot allocate memory for a new metadata string.\n");
+	    H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    status = FAIL;
+	    free(errbuf);
+	    free(type);
+	    free(metabuf);
+	    free(utlstr);
+	    free(utlstr2);
+	    
+	    return(status);
+	  }
+	
+	/* Increment metadata section counter */
+	/* ---------------------------------- */
+	nmeta++;
+	sprintf(metutlstr, "%s%ld", "StructMetadata.", nmeta - 1);
+	
+	/* and create meta_id, atype and aspace for the new block */
+	
+	/* Create dataspace first*/
+	/* ---------------- */
+	aspace[nmeta - 1] = H5Screate(H5S_SCALAR);
+	if (aspace[nmeta - 1] == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot create dataspace for %s dataset. \n",metutlstr);
+	    H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    free(type);
+	    free(metabuf);
+	    free(utlstr);
+	    free(utlstr2);
+	    return(FAIL);
+	  }
+	
+	atype[nmeta - 1] = H5Tcopy(H5T_C_S1);
+	
+	size    = HE5_DYNAMIC_BLKSIZE;		  
+	/* Set data type size */
+	/* ------------------ */
+	status  = H5Tset_size(atype[nmeta - 1], size);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot set the total size for atomic datatype. \n");
+	    H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATATYPE, H5E_CANTCREATE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    free(type);
+	    free(metabuf);
+	    free(utlstr);
+	    free(utlstr2);
+	    return(FAIL);
+	  }
+	
+	/* Create "StructMetadata" dataset */
+	/* ------------------------------- */
+	meta_id[nmeta - 1] = H5Dcreate(gid, metutlstr, atype[nmeta - 1], 
+				       aspace[nmeta - 1], H5P_DEFAULT);
+	if (meta_id[nmeta - 1] == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot create %s dataset. \n", metutlstr);
+	    H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASET, H5E_CANTCREATE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    free(type);
+	    free(metabuf);
+	    free(utlstr);
+	    free(utlstr2);
+	    return(FAIL);
+	  }
+
+	/* Reposition metadata pointer (entry position) */
+	/* -------------------------------------------- */
+	metaptr = metabuf + offset;
+      }
+    else
+      {
+	newbuf = (char *) calloc(HE5_DYNAMIC_BLKSIZE * (nmeta), sizeof(char));
+	
+	if(newbuf == NULL)
+	  { 
+	    sprintf(errbuf, "Cannot allocate memory for a new metadata string.\n");
+	    H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    status = FAIL;
+	    free(errbuf);
+	    free(type);
+	    free(metabuf);
+	    free(utlstr);
+	    free(utlstr2);
+	    
+	    return(status);
+	  }
+	
+	/* Reposition metadata pointer (entry position) */
+	/* -------------------------------------------- */
+	metaptr = metabuf + offset;
+      }
+  
+  /* Copy new metadata string to newbuf array */
+  /* ---------------------------------------- */
+  for(i = 0; i < offset; i++)
+	newbuf[ i ] = metabuf[ i ];
+  
+  newbuf[ offset ] = 0;
+  
+  strcat( newbuf, utlstr);
+  strcat( newbuf, metaptr);
+  
+  /* set to null character remaining of the metabuf */
+  
+  memset((newbuf + metalen + seglen), '\0', (nmeta*HE5_DYNAMIC_BLKSIZE - (metalen +
+                                                                seglen)));
+  /* Add new null string terminator */
+  /* ------------------------------ */
+  newbuf[metalen + seglen] = 0;
+  
+  tempdim = (hsize_t)strlen( newbuf );
+  
+  tempdim++;
+  
+  /*
+   *-----------------------------------------------------------------*
+   *     Write metadata back  to dataset "StructMetadata.X"          *
+   *-----------------------------------------------------------------*
+   */
+  
+  
+  /*   H5Sset_extent_simple(aspace, 1, &tempdim, 0 ); NOT SUPPORTED YET !!! */ 
+  /*   H5Dextend(meta_id, &tempdim);                  NOT SUPPORTED YET !!! */ 
+  
+  for (ism = 0; ism < nmeta; ism++)
+    {
+      status  = H5Dwrite(meta_id[ism], atype[ism], H5S_ALL, H5S_ALL, H5P_DEFAULT, newbuf + ism * HE5_DYNAMIC_BLKSIZE); 
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write in structural metadata.\n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(type);
+	  free(metabuf);
+	  free(utlstr);
+	  free(utlstr2);
+	  free(newbuf);
+	  
+	  return(status);
+	}
+    }
+
+  free(metabuf);
+  free(newbuf);
+  free(utlstr);
+  free(utlstr2);
+  free(type);
+  
+  metabuf = NULL;
+  newbuf  = NULL;
+  utlstr2 = NULL;
+  utlstr  = NULL; 
+  type    = NULL;
+
+  for (ism = 0; ism < nmeta; ism++)
+    {  
+      status = H5Sclose(aspace[ism]); 
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  
+	  return(status);
+	}
+      
+      status = H5Tclose(atype[ism]); 
+      if( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the data type ID.\n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  
+	  return(status);
+	}
+      status = H5Dclose(meta_id[ism]);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the dataset ID.\n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return(status);
+	}
+    }
+  status = H5Gclose(gid);
+  if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the group ID.\n");
+	  H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return(status);
+	}
+  
+  free(errbuf);
+  errbuf = NULL;
+
+ COMPLETION:  
+
+  return status;
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHgetmetavalue                                               |
+|                                                                             |
+|  DESCRIPTION: Returns metadata value                                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  metaptrs       char                Begin and end of metadata section       |
+|  parameter      char                parameter to access                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  metaptr        char                Ptr to (updated) beginning of metadata  |
+|  retstr         char                return string containing value          |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  10/18/99 A.Muslimov    Replaced memcpy() by memmove() to avoid a problem   |
+|                         when arguments 1 and 2 overlap in memory.           |
+|  4/19/00  A.Muslimov    Changed type of 'slen' from int to size_t.          |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_EHgetmetavalue(char *metaptrs[], char *parameter, char *retstr)
+{
+  herr_t        status   = FAIL;		/* routine return status variable */
+  
+  size_t        slen     = 0;		    /* String length                  */
+  
+  char          *newline = (char *)NULL;/* Position of new line character */
+  char          *sptr    = (char *)NULL;/* String pointer within metadata */
+  
+  CHECKPOINTER(metaptrs[0]);
+  CHECKPOINTER(metaptrs[1]);
+  CHECKPOINTER(parameter);
+
+  
+  /* Get string length of parameter string + 1 */
+  /* ----------------------------------------- */
+  slen = strlen(parameter) + 1;
+  
+  /* Build search string (parameter string + "=") */
+  /* -------------------------------------------- */
+  strcpy(retstr, parameter);
+  strcat(retstr, "=");
+  
+  /* Search for string within metadata (beginning at metaptrs[0]) */
+  /* ------------------------------------------------------------ */
+  sptr = strstr(metaptrs[0], retstr);
+  
+  /* If string found within desired section ... */
+  /* ------------------------------------------ */
+  if (sptr != NULL && sptr < metaptrs[1])
+    {
+	  /* Store position of string within metadata */
+	  /* ---------------------------------------- */
+	  metaptrs[0] = sptr;
+
+	  /* Find newline "\n" character */
+	  /* --------------------------- */
+	  newline = strchr(metaptrs[0], '\n');
+
+	  /* Copy from "=" to "\n" (exclusive) into return string */
+	  /* ---------------------------------------------------- */
+	  memmove(retstr, metaptrs[0] + slen, newline - metaptrs[0] - slen);
+
+	  /* Terminate return string with null */
+	  /* --------------------------------- */
+	  retstr[newline - metaptrs[0] - slen] = 0;
+	  status = SUCCEED;
+	} 
+  else
+	{
+	  /*
+	   * if parameter string not found within section, null return string
+	   * and set status to FAIL.
+	   */
+	  retstr[0] = 0;
+	  status = FAIL;
+	}
+  
+ COMPLETION:
+  return (status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHmetagroup                                                  |
+|                                                                             |
+|  DESCRIPTION: Returns pointers to beginning and end of metadata group       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  metabuf        char*    None       Pointer to HDF-EOS object in metadata   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gid            hid_t    None       group ID                                |
+|  structname     char*    None       HDF-EOS structure name                  |
+|  structcode     char*    None       Structure code ("s/g/p/z")              |
+|  groupname      char*    None       Metadata group name                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  metaptrs       char*    None       pointers to begin and end of metadata   |
+|                                                                             |
+|  NOTES:  Allocates memory of fixed size (= HE5_STATIC_BLKSIZE)              |
+|          for metabuf[] array (old scheme), or allocates buffer in chuncks   |
+|          of HE5_DYNAMIC_BLKSIZE (new scheme).                               |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  05/17/04  Abe Taaheri  Initial version                                     |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+char  *
+HE5_EHmetagroup(hid_t fid , char *structname, char *structcode, char *groupname, char *metaptrs[])
+{
+  char          *metabuf=(char *)NULL;      /* Ptr to StrucMetadata (SM)    */
+  int      HDFEOS5ver_flg ; /* will be set to 1 if the HDF-EOS5 version 
+			       is later than 5.1.7, otherwise to 0 */
+  /* Get HDFEOS5ver_flg flag for the file */
+  /* --------------- */
+  HDFEOS5ver_flg = HE5_HeosTable[fid%HE5_EHIDOFFSET].DYNAMIC_flag;
+
+  if(HDFEOS5ver_flg == 1)
+    {
+      metabuf = (char *)HE5_EHmetagroup_Static(fid , structname, structcode, 
+					       groupname, metaptrs);
+    }
+  else if(HDFEOS5ver_flg == 0)
+    {
+      metabuf = (char *)HE5_EHmetagroup_Dynamic(fid , structname, structcode, 
+						groupname, metaptrs);
+
+    }
+
+  return(metabuf);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHmetagroup_Static                                           |
+|                                                                             |
+|  DESCRIPTION: Returns pointers to beginning and end of metadata group       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  metabuf        char*    None       Pointer to HDF-EOS object in metadata   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gid            hid_t    None       group ID                                |
+|  structname     char*    None       HDF-EOS structure name                  |
+|  structcode     char*    None       Structure code ("s/g/p/z")              |
+|  groupname      char*    None       Metadata group name                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  metaptrs       char*    None       pointers to begin and end of metadata   |
+|                                                                             |
+|  NOTES:        A.M.: Temporarily allocates memory of fixed size (= BLKSIZE) |
+|                      for metabuf[] array. Also allocates memory of fixed    |
+|                      size (= HDFE_UTLBUFSIZE) for utlstr[].                 |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  3/30/99                Make metadata ODL compliant                         |
+|  7/28/99  A.Muslimov    Replaced the 1st argument of EHmetagroup by fid     |
+|                         (file ID). Did the same change in the call to       |
+|                         H5Gopen(). Added error handling right after the     |
+|                         call to H5Dread().                                  |
+|  9/02/99  A.Muslimov    Replaced the call in 'OPEN "HDFEOS INFORMATION"     |
+|                         GROUP' block by two calls to pass the HDFfid        |
+|                         instead of fid to H5Gopen().                        |
+|  9/29/99  A.Muslimov    Added dynamic memory allocation for error message   |
+|                         buffer.                                             |
+|  02/07/00 A.Muslimov    Added free() calls before return(NULL).             |
+|  July 02  S.Zhao        Added H5Gclose(gid) to release the "HDFEOS          |
+|                         INFORMATION" group ID.                              |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+char  *
+HE5_EHmetagroup_Static(hid_t fid , char *structname, char *structcode, char *groupname, char *metaptrs[])
+{
+
+  herr_t     status      = FAIL;/* return status variable                          */
+    
+  hid_t      meta_id     = FAIL;/*  metadata ID                                    */
+  hid_t      gid         = FAIL;/* "HDFEOS INFORMATION" group ID                   */
+  hid_t      atype       = FAIL;/* datatype ID                                     */
+  hid_t      aspace      = FAIL;/* dataspace ID                                    */
+  hid_t      HDFfid      = FAIL;/* HDF-EOS file ID                                 */
+  hid_t      grpID       = FAIL;/* HDFEOS group ID                                 */
+ 
+  size_t     tsize       = 0;	/* number of elements in a dataset                 */
+
+  uintn      access      = 0;	/* read-write access mode                          */ 
+    
+  char       *metabuf  = NULL;	/* Pointer (handle) to structural metadata         */
+  char       *endptr   = NULL;	/* Pointer to end of metadata section              */
+  char       *metaptr  = NULL;	/* Metadata pointer                                */
+  char       *prevmetaptr =NULL;/* Previous position of metadata pointer           */
+  char       *utlstr   = NULL;	/* Utility string                                  */
+  char       *errbuf   = NULL;  /* buffer for error message                        */
+
+
+  CHECKPOINTER(structname);
+  CHECKPOINTER(structcode);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+	{
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+	  HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+		
+	  return(NULL);
+	}
+
+  /* Check HDF-EOS file ID */
+  /* --------------------- */
+  status = HE5_EHchkfid(fid, "HE5_EHmetagroup_Static", &HDFfid, &grpID, &access);
+  if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Checking for file ID failed.\n");
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Static",   __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return(NULL);
+	}
+
+  /*
+   *-------------------------------------------------------------------------*
+   *               O P E N  "HDFEOS INFORMATION" G R O U P                   *
+   *-------------------------------------------------------------------------*
+   */
+  gid = H5Gopen(HDFfid,"HDFEOS INFORMATION");
+  if ( gid == FAIL )
+	{
+	  sprintf(errbuf,"Cannot open \"HDFEOS INFORMATION\" group. \n");
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_OHDR, H5E_NOTFOUND,errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return( NULL );
+	}
+    
+  /* 
+   *--------------------------------------------------------------------------*
+   *                    Open dataset "StructMetadata.0"                       *
+   *--------------------------------------------------------------------------*
+   */
+  meta_id = H5Dopen(gid, "StructMetadata.0");
+  if ( meta_id == FAIL )
+	{
+	  sprintf(errbuf,"Cannot open \"StructMetadata.0\" dataset. \n"); 
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return( NULL );
+	}
+	
+  /* Get dataset type */
+  /* ---------------- */
+  atype   = H5Dget_type(meta_id);
+  if ( atype == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get datatype ID. \n");
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return( NULL );
+	}
+	
+  /* Get dataset size */
+  /* ---------------- */
+  tsize   = H5Tget_size(atype);
+  if ( tsize == 0 )
+	{
+	  sprintf(errbuf, "The datatype is of ZERO size. \n"); 
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return( NULL );
+	}
+	
+  /* Get dataset space */
+  /* ----------------- */
+  aspace  = H5Dget_space(meta_id);
+  if ( aspace == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get the data space ID. \n");
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return( NULL );
+	}
+	
+  /* -------------------------------------------------------------- */
+  /* Get attribute size                                             */
+  /* NOTE: this call is now supported for a string and is used now  */
+  /* in HE5_EHattrinfoto get the number of elements for string array*/
+  /* npoints = H5Sget_simple_extent_npoints(aspace);                */
+  /* It'll be implemented for memory allocation for metabuf[] array */
+  /* -------------------------------------------------------------- */
+
+	
+  /* Allocate memory */
+  /* --------------- */
+  metabuf = (char *)calloc( HE5_HeosTable[fid%HE5_EHIDOFFSET].HE5_STATIC_BLKSIZE, sizeof(tsize) );
+  if( metabuf==NULL)
+    {
+      sprintf(errbuf,"Can not allocate memory for meta bufer. \n");
+      H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(NULL);
+    }
+
+  utlstr  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(tsize) );
+  if( utlstr==NULL)
+    {
+      sprintf(errbuf,"Can not allocate memory for utility string. \n");
+      H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(metabuf);
+		
+      return(NULL);
+    }
+
+  /* Read the metadata buffer */
+  /* ------------------------ */
+  status = H5Dread(meta_id,atype,H5S_ALL, H5S_ALL, H5P_DEFAULT, metabuf);
+  if (status == FAIL )
+    {
+      metabuf = NULL;
+      sprintf(errbuf,"Cannot read the metadata buffer. \n");
+      H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(metabuf);
+      free(utlstr);
+	    
+      return(NULL);
+    }
+
+	
+  /* Find HDF-EOS structure "root" group in metadata */
+  /* ----------------------------------------------- */
+	
+  /* Setup proper search string */
+  /* -------------------------- */
+  if (strcmp(structcode, "s") == 0)
+    strcpy(utlstr, "GROUP=SwathStructure");
+  else if (strcmp(structcode, "g") == 0)
+    strcpy(utlstr, "GROUP=GridStructure");
+  else if (strcmp(structcode, "p") == 0)
+    strcpy(utlstr, "GROUP=PointStructure");
+  else if (strcmp(structcode, "z") == 0)
+    strcpy(utlstr, "GROUP=ZaStructure");
+	
+  /* Use string search routine (strstr) to move through metadata */
+  /* ----------------------------------------------------------- */
+  metaptr = strstr(metabuf, utlstr);
+	
+  /* Save current metadata pointer */
+  /* ----------------------------- */
+  prevmetaptr = metaptr;
+	
+
+  /* First loop for "old-style" (non-ODL) metadata string */
+  /* ---------------------------------------------------- */
+  if (strcmp(structcode, "s") == 0)
+    sprintf(utlstr, "%s%s%s", "SwathName=\"", structname, "\"");
+  else if (strcmp(structcode, "g") == 0)
+    sprintf(utlstr, "%s%s%s", "GridName=\"", structname, "\"");
+  else if (strcmp(structcode, "p") == 0)
+    sprintf(utlstr, "%s%s%s", "PointName=\"", structname, "\"");
+  else if (strcmp(structcode, "z") == 0)
+    sprintf(utlstr, "%s%s%s", "ZaName=\"", structname, "\"");
+    
+  /* Do string search */
+  /* ---------------- */
+  metaptr = strstr(metaptr, utlstr);
+	
+  /*
+   * If not found then return to previous position in metadata and look for
+   * "new-style" (ODL) metadata string
+   */
+  if (metaptr == NULL)
+    {
+      sprintf(utlstr, "%s%s%s", "GROUP=\"", structname, "\"");
+      metaptr = strstr(prevmetaptr, utlstr);
+    }
+	
+  /* Find group within structure */
+  /* --------------------------- */
+  if (groupname != NULL)
+    {
+      sprintf(utlstr, "%s%s", "GROUP=", groupname);
+      metaptr = strstr(metaptr, utlstr);
+		
+      sprintf(utlstr, "%s%s", "\t\tEND_GROUP=", groupname);
+      endptr = strstr(metaptr, utlstr);
+    } else
+    {
+      /* If groupname == NULL then find end of structure in metadata */
+      /* ----------------------------------------------------------- */
+      sprintf(utlstr, "%s", "\n\tEND_GROUP=");
+      endptr = strstr(metaptr, utlstr);
+    }
+	
+
+  /* Return beginning and ending pointers */
+  /* ------------------------------------ */
+  metaptrs[0] = metaptr;
+  metaptrs[1] = endptr;
+
+  /* Release the dataspace ID */
+  /* ------------------------ */
+  status = H5Sclose(aspace);
+  if (status == FAIL )
+    {
+      sprintf(errbuf,  "Cannot release the dataspace ID. \n");
+      H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(metabuf);
+      free(utlstr);
+		
+      return(NULL);
+    }
+
+  /* Release the datatype ID */
+  /* ----------------------- */
+  status = H5Tclose(atype);
+  if (status == FAIL )
+    {
+      sprintf(errbuf,"Cannot release the datatype ID. \n");
+      H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(metabuf);
+      free(utlstr);
+		
+      return(NULL);
+    }
+
+  /* Release the dataset ID */
+  /* ---------------------- */
+  status = H5Dclose(meta_id);
+  if (status == FAIL )
+    {
+      sprintf(errbuf,"Cannot release the dataset ID. \n");
+      H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(metabuf);
+      free(utlstr);
+		
+      return(NULL);
+    }
+
+  /* Release the "HDFEOS INFORMATION" group ID */
+  /* ----------------------------------------- */ 
+  status = H5Gclose(gid);
+  if (status == FAIL )
+    {
+      sprintf(errbuf,"Cannot release the \"HDFEOS INFORMATION\" group ID. \n");
+      H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(metabuf);
+      free(utlstr);
+
+      return(NULL);
+    }
+
+  free(errbuf);
+  free(utlstr);
+    
+ COMPLETION:
+  return(metabuf);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHmetagroup_Dynamic                                          |
+|                                                                             |
+|  DESCRIPTION: Returns pointers to beginning and end of metadata group       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  metabuf        char*    None       Pointer to HDF-EOS object in metadata   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gid            hid_t    None       group ID                                |
+|  structname     char*    None       HDF-EOS structure name                  |
+|  structcode     char*    None       Structure code ("s/g/p/z")              |
+|  groupname      char*    None       Metadata group name                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  metaptrs       char*    None       pointers to begin and end of metadata   |
+|                                                                             |
+|  NOTES:  Allocates buffer in chuncks of HE5_DYNAMIC_BLKSIZE (new scheme).   |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  05/17/04 Abe Taaheri   Modified the version with static buffer allocation  |
+|                         to adopt dynamic buffer allocation in chuncks of    |
+|                         HE5_DYNAMIC_BLKSIZE                                 |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+char  *
+HE5_EHmetagroup_Dynamic(hid_t fid , char *structname, char *structcode, char *groupname, char *metaptrs[])
+{
+
+  herr_t     status      = FAIL;/* return status variable                          */
+    
+  hid_t      meta_id[MetaBlocks]     = {FAIL};/*  metadata ID                                    */
+  hid_t      gid         = FAIL;/* "HDFEOS INFORMATION" group ID                   */
+  hid_t      atype[MetaBlocks]       = {FAIL};/* datatype ID                                     */
+  hid_t      aspace[MetaBlocks]      = {FAIL};/* dataspace ID                                    */
+  hid_t      HDFfid      = FAIL;/* HDF-EOS file ID                                 */
+  hid_t      grpID       = FAIL;/* HDFEOS group ID                                 */
+ 
+  size_t     tsizeblk[MetaBlocks]    = {0};   /* number of elements in a dataset                 */
+  size_t     tsize       = 0;	/* number of elements in a dataset                 */
+
+  uintn      access      = 0;	/* read-write access mode                          */ 
+    
+  char       *metabuf  = NULL;	/* Pointer (handle) to structural metadata         */
+  char       *endptr   = NULL;	/* Pointer to end of metadata section              */
+  char       *metaptr  = NULL;	/* Metadata pointer                                */
+  char       *prevmetaptr =NULL;/* Previous position of metadata pointer           */
+  char       *utlstr   = NULL;	/* Utility string                                  */
+  char       *errbuf   = NULL;  /* buffer for error message                        */
+  int            ism;
+  long           nmeta;
+  /*long           *metstrbufsize = 0;*/
+  char           metutlstr[32];
+  long           metalen;
+
+  CHECKPOINTER(structname);
+  CHECKPOINTER(structcode);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+		
+      return(NULL);
+    }
+
+  /* Check HDF-EOS file ID */
+  /* --------------------- */
+  status = HE5_EHchkfid(fid, "HE5_EHmetagroup_Dynamic", &HDFfid, &grpID, &access);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for file ID failed.\n");
+      H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic",  __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(NULL);
+    }
+
+  /*
+   *-------------------------------------------------------------------------*
+   *               O P E N  "HDFEOS INFORMATION" G R O U P                   *
+   *-------------------------------------------------------------------------*
+   */
+  gid = H5Gopen(HDFfid,"HDFEOS INFORMATION");
+  if ( gid == FAIL )
+    {
+      sprintf(errbuf,"Cannot open \"HDFEOS INFORMATION\" group. \n");
+      H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return( NULL );
+    }
+    
+  /* 
+   *--------------------------------------------------------------------------*
+   *                    Open dataset "StructMetadata.X"                       *
+   *--------------------------------------------------------------------------*
+   */
+  
+  /* Determine number of structural metadata "sections" */
+  /* -------------------------------------------------- */
+  nmeta = 0;
+  status= HE5_EHgetnmeta(gid, &nmeta);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot find any StructMetadata.X dataset. \n");
+      H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      
+      return(NULL);
+    }
+  for (ism = 0; ism < nmeta; ism++)
+    {
+      sprintf(metutlstr, "%s%d", "StructMetadata.", ism);
+      meta_id[ism] = H5Dopen(gid, metutlstr);
+      if ( meta_id[ism] == FAIL )
+	{
+	  sprintf(errbuf,"Cannot open %s dataset. \n", metutlstr); 
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  
+	  return( NULL );
+	}
+      
+      /* Get dataset type */
+      /* ---------------- */
+      atype[ism]   = H5Dget_type(meta_id[ism]);
+      if ( atype[ism] == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get datatype ID. \n");
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  
+	  return( NULL );
+	}
+      
+      /* Get dataset size */
+      /* ---------------- */
+      tsizeblk[ism]   = H5Tget_size(atype[ism]);
+      if ( tsizeblk[ism] == 0 )
+	{
+	  sprintf(errbuf, "The datatype is of ZERO size for StructMetadata block (zero based) %d. \n", ism); 
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  
+	  return( NULL );
+	}
+      
+      /* Get dataset space */
+      /* ----------------- */
+      aspace[ism]  = H5Dget_space(meta_id[ism]);
+      if ( aspace[ism] == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get the data space ID for StructMetadata block (zero based) %d. \n", ism);
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  
+	  return( NULL );
+	}
+    }
+  tsize = tsizeblk[0];
+  for (ism = 0; ism < nmeta; ism++)
+    {
+      if(tsizeblk[ism] != tsize)
+	{
+	  sprintf(errbuf,"Data sizes are not the same for StructMetadata blocks. \n");
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  
+	  return( NULL );
+	}
+    }
+  /* --------------------------------------------------------------  */
+  /* Get attribute size                                              */
+  /* NOTE: this call is now supported for a string and is used now   */
+  /* in HE5_EHattrinfo to get the number of elements for string array*/
+  /* npoints = H5Sget_simple_extent_npoints(aspace);                 */
+  /* It'll be implemented for memory allocation for metabuf[] array  */
+  /* --------------------------------------------------------------  */
+
+	
+  /* Allocate memory */
+  /* --------------- */
+  metabuf = (char *)calloc( HE5_DYNAMIC_BLKSIZE * nmeta, sizeof(tsize) );
+  if( metabuf==NULL)
+    {
+      sprintf(errbuf,"Can not allocate memory for meta bufer. \n");
+      H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(NULL);
+    }
+
+  utlstr  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(tsize) );
+  if( utlstr==NULL)
+    {
+      sprintf(errbuf,"Can not allocate memory for utility string. \n");
+      H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(metabuf);
+		
+      return(NULL);
+    }
+
+  /* Read the metadata buffer */
+  /* ------------------------ */
+  metalen = 0;
+  if (Stored_meta[fid%HE5_EHIDOFFSET].metaread_flag == 0)
+    {
+      for (ism = 0; ism < nmeta; ism++)
+	{
+	  status = H5Dread(meta_id[ism],atype[ism],H5S_ALL, H5S_ALL, H5P_DEFAULT, metabuf + metalen);
+	  if (status == FAIL )
+	    {
+	      metabuf = NULL;
+	      sprintf(errbuf,"Cannot read the metadata buffer. \n");
+	      H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__,  H5E_DATASET, H5E_READERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(metabuf);
+	      free(utlstr);
+	  
+	      return(NULL);
+	    }
+
+	  /* Determine length (# of characters) of metadata */
+	  /* ---------------------------------------------- */
+	  metalen = strlen(metabuf);
+	}
+
+      Stored_meta[fid%HE5_EHIDOFFSET].metabuf_length = strlen(metabuf);
+      Stored_meta[fid%HE5_EHIDOFFSET].saved_metabuf = (char *)realloc(Stored_meta[fid%HE5_EHIDOFFSET].saved_metabuf,(Stored_meta[fid%HE5_EHIDOFFSET].metabuf_length+1)*sizeof(tsize));
+      strcpy(Stored_meta[fid%HE5_EHIDOFFSET].saved_metabuf, metabuf);
+      Stored_meta[fid%HE5_EHIDOFFSET].nmeta = nmeta;
+      Stored_meta[fid%HE5_EHIDOFFSET].metaread_flag = 1;
+
+    }
+  else
+    {
+      strcpy(metabuf,Stored_meta[fid%HE5_EHIDOFFSET].saved_metabuf);
+    }
+
+
+  /* Find HDF-EOS structure "root" group in metadata */
+  /* ----------------------------------------------- */
+	
+  /* Setup proper search string */
+  /* -------------------------- */
+  if (strcmp(structcode, "s") == 0)
+    strcpy(utlstr, "GROUP=SwathStructure");
+  else if (strcmp(structcode, "g") == 0)
+    strcpy(utlstr, "GROUP=GridStructure");
+  else if (strcmp(structcode, "p") == 0)
+    strcpy(utlstr, "GROUP=PointStructure");
+  else if (strcmp(structcode, "z") == 0)
+    strcpy(utlstr, "GROUP=ZaStructure");
+	
+  /* Use string search routine (strstr) to move through metadata */
+  /* ----------------------------------------------------------- */
+  metaptr = strstr(metabuf, utlstr);
+	
+  /* Save current metadata pointer */
+  /* ----------------------------- */
+  prevmetaptr = metaptr;
+	
+
+  /* First loop for "old-style" (non-ODL) metadata string */
+  /* ---------------------------------------------------- */
+  if (strcmp(structcode, "s") == 0)
+    sprintf(utlstr, "%s%s%s", "SwathName=\"", structname, "\"");
+  else if (strcmp(structcode, "g") == 0)
+    sprintf(utlstr, "%s%s%s", "GridName=\"", structname, "\"");
+  else if (strcmp(structcode, "p") == 0)
+    sprintf(utlstr, "%s%s%s", "PointName=\"", structname, "\"");
+  else if (strcmp(structcode, "z") == 0)
+    sprintf(utlstr, "%s%s%s", "ZaName=\"", structname, "\"");
+    
+  /* Do string search */
+  /* ---------------- */
+  metaptr = strstr(metaptr, utlstr);
+	
+  /*
+   * If not found then return to previous position in metadata and look for
+   * "new-style" (ODL) metadata string
+   */
+  if (metaptr == NULL)
+    {
+      sprintf(utlstr, "%s%s%s", "GROUP=\"", structname, "\"");
+      metaptr = strstr(prevmetaptr, utlstr);
+    }
+	
+  /* Find group within structure */
+  /* --------------------------- */
+  if (groupname != NULL)
+    {
+      sprintf(utlstr, "%s%s", "GROUP=", groupname);
+      metaptr = strstr(metaptr, utlstr);
+		
+      sprintf(utlstr, "%s%s", "\t\tEND_GROUP=", groupname);
+      endptr = strstr(metaptr, utlstr);
+    } else
+    {
+      /* If groupname == NULL then find end of structure in metadata */
+      /* ----------------------------------------------------------- */
+      sprintf(utlstr, "%s", "\n\tEND_GROUP=");
+      endptr = strstr(metaptr, utlstr);
+    }
+	
+
+  /* Return beginning and ending pointers */
+  /* ------------------------------------ */
+  metaptrs[0] = metaptr;
+  metaptrs[1] = endptr;
+
+  /* Release the dataspace ID */
+  /* ------------------------ */
+  for (ism = 0; ism < nmeta; ism++)
+    {
+      status = H5Sclose(aspace[ism]);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf,  "Cannot release the dataspace ID. \n");
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(metabuf);
+	  free(utlstr);
+	  
+	  return(NULL);
+	}
+      
+      /* Release the datatype ID */
+      /* ----------------------- */
+      status = H5Tclose(atype[ism]);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the datatype ID. \n");
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(metabuf);
+	  free(utlstr);
+	  
+	  return(NULL);
+	}
+      
+      /* Release the dataset ID */
+      /* ---------------------- */
+      status = H5Dclose(meta_id[ism]);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the dataset ID. \n");
+	  H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(metabuf);
+	  free(utlstr);
+	  
+	  return(NULL);
+	}
+    }
+  /* Release the "HDFEOS INFORMATION" group ID */
+  /* ----------------------------------------- */ 
+  status = H5Gclose(gid);
+  if (status == FAIL )
+    {
+      sprintf(errbuf,"Cannot release the \"HDFEOS INFORMATION\" group ID. \n");
+      H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(metabuf);
+      free(utlstr);
+      
+      return(NULL);
+    }
+  
+  free(errbuf);
+  free(utlstr);
+    
+ COMPLETION:
+  return(metabuf);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHbisect                                                     |
+|                                                                             |
+|  DESCRIPTION: Finds root of function using bisection                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  func()         double              Function to bisect                      |
+|  funcParms      double              Function parameters (fixed)             |
+|  nParms         long                Number of function parameters           |
+|  limLft         double              Lower limit of function arguement       |
+|  limRgt         double              Upper limit of function arguement       |
+|  convCrit       double              Convergence criterion                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  root           double              Function root                           |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_EHbisect(double(*func) (double[]), double funcParms[], long nParms, double limLft, double limRgt, double convCrit, double *root)
+{
+  herr_t         status  = SUCCEED;/* routine return status variable    */
+
+  int            i;                /* Loop index                        */
+
+  double         midPnt       = 0.;/* Mid-point value                   */
+  double         newmidPnt    = 0.;/* New mid-point value               */
+  double         funcLft      = 0.;/* Function value at left-hand limit */
+  double         funcMid      = 0.;/* Function value at mid-point       */
+  double         funcRgt      = 0.;/* Function value at right-hand limit*/
+  double         *parms=(double *)NULL;/* Function parameters           */
+
+
+  /* Allocate space for function parameters */
+  /* -------------------------------------- */
+  parms = (double *)calloc(nParms + 1, sizeof(double));
+  if(parms == NULL)
+    {
+      H5Epush(__FILE__,"HE5_EHbisect", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+      HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+	
+  /* Copy (fixed) function parameters */
+  /* -------------------------------- */
+  for (i = 0; i < nParms; i++)
+    parms[i + 1] = funcParms[i];
+
+  /* Copy left-hand limit to "floating" parameter */
+  /* -------------------------------------------- */
+  parms[0] = limLft;
+
+  /* Determine function value */
+  /* ------------------------ */
+  funcLft = (*func) (parms);
+
+  /* Copy right-hand limit to "floating" parameter */
+  /* --------------------------------------------- */
+  parms[0] = limRgt;
+
+  /* Determine function value */
+  /* ------------------------ */
+  funcRgt = (*func) (parms);
+
+  /* If left and right limits function values of same sign then no root */
+  /* ------------------------------------------------------------------ */
+  if (funcLft * funcRgt > 0)
+    {
+      if (parms != NULL) free(parms);
+      return (FAIL);
+    }
+  /* Compute (initial) mid-point */
+  /* --------------------------- */
+  newmidPnt = 0.5 * (limLft + limRgt);
+	
+  /* Bisection Loop */
+  /* -------------- */
+  while (1)
+    {
+      /* Compute function at new mid-point */
+      /* --------------------------------- */
+      midPnt   = newmidPnt;
+      parms[0] = midPnt;
+      funcMid  = (*func) (parms);
+		
+      /* If left limit same sign as mid-point move it to mid-point */
+      /* --------------------------------------------------------- */
+      if (funcLft * funcMid > 0.0)
+	{
+	  limLft = midPnt;
+	}else
+	{
+	  /* Otherwise move over right-hand limit */
+	  /* ------------------------------------ */
+	  limRgt = midPnt;
+	}
+		
+		
+      /* Compute new mid-point */
+      /* --------------------- */
+      newmidPnt = 0.5 * (limLft + limRgt);
+		
+      /* If relative change in midpoint < convergence crit then exit loop */
+      /* ---------------------------------------------------------------- */
+      if (fabs((newmidPnt - midPnt) / midPnt) < convCrit)
+	break;
+    }
+	
+  /* Save root */
+  /* --------- */
+  *root = newmidPnt;
+	
+  free(parms);
+	
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|  FUNCTION: HE5_EHattr                                                       |
+|                                                                             |
+|  DESCRIPTION: Reads/Writes attributes for HDF-EOS structures                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               HDF-EOS file ID                         |
+|  attrname       char                attribute name                          |
+|  numbertype     hid_t               attribute HDF numbertype                |
+|  count[]        hsize_t             Number of attribute elements            |
+|  wrcode         char                Read/Write Code "w/r"                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|                                                                             |
+|  Date        Programmer    Description                                      |
+|  =========   ============  ==============================================   |
+|  July 1999   A.Muslimov    Changed the sequence of calls in "write attri-   |
+|                            bute" block (the change is based on examples     |
+|                            provided in "Introduction to HDF5 Release 1.0"   |
+|                            Chapter 4, Paragraph 8).                         |
+|  9/29/99  A.Muslimov       Added dynamic memory allocation for error message|
+|                            buffer. Added error handlings after the function |
+|                            calls.                                           |
+|  12/13/99 A.Muslimov       Fixed a bug associated with the attempt to       |
+|                            close the data space outside the block in which  |
+|                            it was created. Put a call to H5Sclose() inside  |
+|                            this block and separated the rest by else{}      |
+|                            block.                                           |
+|  07/12/00 A.Muslimov       Added conversion of disk/file data type ID into  |
+|                            memory data type ID before H5Aread() call.       |
+|  July 02  S.Zhao           Updated for writing a character string attribute.|
+|  Mar  04  S.Zhao           Modified for a character string attribute.       |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_EHattr(hid_t  grpID, const char *attrname, hid_t numbertype, hsize_t count[], char *wrcode, void *datbuf)
+{
+  herr_t      status  = FAIL;        /* Return status variable    */
+
+  int         RANK    = 1;	         /* Rank of attribute dataset */     
+
+  hid_t       attid   = FAIL;        /* Attribute ID              */
+  hid_t       sid     = FAIL;        /* dataspace ID              */
+  hid_t       atype   = FAIL;        /* attribute datatype ID     */
+  hid_t       mtype   = FAIL;        /* memory data type ID       */
+
+  char        *errbuf = (char *)NULL;/* Error message buffer      */
+  size_t      size    = 0;
+    
+  CHECKPOINTER(attrname);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Probe , if Attribute does not exist, Create it */
+  /* ---------------------------------------------- */
+  H5E_BEGIN_TRY
+    {
+      attid = H5Aopen_name(grpID,attrname);
+    }
+  H5E_END_TRY;
+	
+  /* Write Attribute Section */
+  /* ----------------------- */
+  if (strcmp(wrcode, "w") == 0)
+    {
+      if( attid == FAIL)
+	{
+	  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR)
+	      || (numbertype == H5T_C_S1))
+	    {
+	      /* Create attribute dataspace */
+	      /* -------------------------- */
+	      sid = H5Screate(H5S_SCALAR);
+	      if(sid == FAIL)
+		{
+		  status = FAIL;
+		  sprintf(errbuf, "Cannot create the data space for attribute \"%s\".\n", attrname);
+		  H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+
+		  return(status);
+		}      
+	      numbertype = H5Tcopy(H5T_C_S1);
+	      if( (size_t)count[0] > strlen(datbuf) )
+		{
+		  size = strlen(datbuf);
+		}
+	      else
+		{
+		  size = (size_t)count[0];
+		}
+	      status = H5Tset_size(numbertype, size);
+	      if( status == FAIL)
+		{
+		  sprintf(errbuf,"Cannot set the total size for the attribute \"%s\".\n", attrname);
+		  H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+
+		  return(status);
+		} 
+	    }
+	  else
+	    {
+
+	      /* Create attribute dataspace */
+	      /* -------------------------- */
+	      sid    = H5Screate(H5S_SIMPLE);
+	      if(sid == FAIL)
+		{
+		  status = FAIL;
+		  sprintf(errbuf, "Cannot create the data space for attribute \"%s\".\n", attrname);
+		  H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf  );
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+				
+		  return(status);
+		}
+
+	      /* Extend the dataspace */
+	      /* -------------------- */
+	      status = H5Sset_extent_simple(sid,RANK,count,NULL);
+	      if(status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot extend data space.\n");
+		  H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf  );
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+	    
+		  return(status);
+		}
+	    }
+
+	  /* Create the attribute */
+	  /* -------------------- */
+	  attid  = H5Acreate(grpID,attrname,numbertype,sid,H5P_DEFAULT);
+	  if(attid == FAIL)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot create the attribute \"%s\".\n",attrname);
+	      H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_CANTCREATE, errbuf  );
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(status);
+	    }
+
+	  /* Write attribute data */
+	  /* -------------------- */
+	  status = H5Awrite(attid,numbertype,datbuf);
+	  if(status == FAIL)
+	    { 
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot write in data to the attribute.\n");
+	      H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf  );
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	   
+	      return(status);
+	    }
+		  
+	  /* Release the dataspace ID */
+	  /* ------------------------ */
+	  status = H5Sclose(sid);
+	  if(status == FAIL)
+	    { 
+	      sprintf(errbuf, "Cannot release the data space ID.\n");
+	      H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf  );
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(status);
+	    }
+
+	  /* Release the attribute ID */
+	  /* ------------------------ */
+	  status = H5Aclose(attid);
+	  if(status == FAIL)
+	    { 
+	      sprintf(errbuf, "Cannot release the attribute ID.\n");
+	      H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_CLOSEERROR, errbuf  );
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(status);
+	    }
+
+	}
+      else 
+	{
+	  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR)
+	      || (numbertype == H5T_C_S1))
+	    {
+	      numbertype = H5Tcopy(H5T_C_S1);
+	      if( (size_t)count[0] > strlen(datbuf) )
+		{
+		  size = strlen(datbuf);
+		}
+	      else
+		{
+		  size = (size_t)count[0];
+		}
+	      status = H5Tset_size(numbertype, size);
+	      if( status == FAIL)
+		{
+		  sprintf(errbuf,"Cannot set the total size for the attribute \"%s\".\n", attrname);
+		  H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+ 
+		  return(status);
+		}
+	    }
+
+	  /* Write data to the attribute */
+	  /* --------------------------- */
+	  status = H5Awrite(attid,numbertype,datbuf);
+	  if(status == FAIL)
+	    { 
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot write in data to the attribute.\n");
+	      H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf  );
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(status);
+	    }
+		  
+	  /* Release the attribute ID */
+	  /* ------------------------ */
+	  status = H5Aclose(attid);
+	  if(status == FAIL)
+	    { 
+	      sprintf(errbuf, "Cannot release the attribute ID.\n");
+	      H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_CLOSEERROR, errbuf  );
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(status);
+	    }
+
+	}
+		
+		
+    }
+	
+  /* Read Attribute Section */
+  /* ---------------------- */
+  else if (strcmp(wrcode, "r") == 0)
+    {
+      if(attid == FAIL)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Attribute \"%s\" not defined.", attrname);
+	  H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf  );
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(status);
+	}
+      else
+	{
+	  atype  = H5Aget_type(attid);
+	  if(atype == FAIL)
+	    { 
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot get the data type ID for attribute \"%s\".\n",attrname);
+	      H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf  );
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(status);
+	    }
+			
+
+          /* Get the memory data type ID */
+          /* --------------------------- */
+          mtype = HE5_EHdtype2mtype(atype);
+
+          if (mtype < 0)
+	    {
+              mtype = atype;
+	    }
+
+	  /* Read attribute */
+	  /* -------------- */
+	  status = H5Aread(attid, mtype, datbuf);
+	  if(status == FAIL)
+	    { 
+	      sprintf(errbuf, "Cannot read out data from the attribute \"%s\".\n",attrname);
+	      H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf  );
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+		
+	      return(status);
+	    }
+       
+
+	  /* Release the attribute datatype ID */
+	  /* --------------------------------- */
+	  status = H5Tclose(atype);
+	  if(status == FAIL)
+	    { 
+	      sprintf(errbuf, "Cannot release the data type ID.\n");
+	      H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf  );
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(status);
+	    }
+			
+	  /* Release the attribute ID */
+	  /* ------------------------ */
+	  status = H5Aclose(attid);
+	  if(status == FAIL)
+	    { 
+	      sprintf(errbuf, "Cannot release the attribute ID.\n");
+	      H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_CLOSEERROR, errbuf  );
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(status);
+	    }
+			
+	}
+		
+    }
+    
+  free(errbuf);
+
+ COMPLETION:    
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHattrinfo                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns numbertype and count of given HDF-EOS attribute       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  grpID          hid_t               Attribute group ID                      |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datatype       hid_t*              Attribute Data type ID                  |
+|  count          hsize_t *           Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|                                                                             |
+|  9/29/99  A.Muslimov    Added dynamic memory allocation for error message   |
+|                         buffer.                                             |
+|  Feb 03   S.Zhao        Changed the type of 'datatype' from an H5T_class_t  |
+|                         to an hid_t.                                        |
+|  Mar 04   S.Zhao        Modified for a character string attribute.          |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_EHattrinfo( hid_t grpID, const char *attrname, hid_t *datatype, hsize_t *count)
+{
+  herr_t      status     = FAIL;         /* Return status variable  */
+  
+  hid_t       aspace     = FAIL;         /* attribute data space ID */
+  hid_t       atype      = FAIL;         /* attribute data type ID  */
+  hid_t       attid      = FAIL;         /* attribute object ID     */
+
+  H5T_class_t  classid = H5T_NO_CLASS;   /* data type class ID      */
+  
+  char        *errbuf    = (char  *)NULL;/* Error message buffer    */
+  
+  CHECKPOINTER(attrname);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  
+  /* Try to open up specified attribute  */
+  /* ----------------------------------  */
+  H5E_BEGIN_TRY
+    {
+      attid = H5Aopen_name(grpID, attrname);
+    }
+  H5E_END_TRY;
+  
+  if( attid == FAIL )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Attribute \"%s\" not defined.", attrname);
+      H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(status);
+    }
+  
+  /* Get attribute data type ID */
+  /* -------------------------- */
+  atype  = H5Aget_type(attid);
+  if(atype == FAIL)
+    { 
+      status = FAIL;
+      sprintf(errbuf, "Cannot get the data type ID for attribute \"%s\".\n",attrname);
+      H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf  );
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(status);
+    }
+  /* Get attribute data space ID */
+  /* --------------------------- */
+  aspace = H5Aget_space(attid);
+  if(aspace == FAIL)
+    { 
+      status = FAIL;
+      sprintf(errbuf, "Cannot get the data space ID for attribute \"%s\".\n",attrname);
+      H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf  );
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(status);
+    }
+  
+  /* Get attribute Data type class ID */
+  /* -------------------------------- */
+  classid    = H5Tget_class(atype);
+  if( classid == FAIL )
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot get the data type class ID for attribute \"%s\".\n", attrname);
+      H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(status);
+    }
+  
+  /* Get the number of attribute elements */
+  /* ------------------------------------ */
+  if (classid == H5T_STRING)
+    {
+      *count = H5Sget_simple_extent_npoints(aspace);
+      if( *count == 0)
+	{
+          status = FAIL;
+          sprintf(errbuf,"Cannot get the size of string in attribute \"%s\".\n", attrname);
+          H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(errbuf);
+          return(status);
+	}
+      *datatype = HE5T_CHARSTRING;
+    }
+  else
+    {
+      *count = H5Sget_simple_extent_npoints(aspace);
+      if( *count == 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Cannot get the number of elements in attribute \"%s\".\n", attrname);
+	  H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return(status);
+	}
+      *datatype = HE5_EHdtype2numtype(atype);
+      if(*datatype == FAIL)
+        {
+          status = FAIL;
+          sprintf(errbuf,"Cannot get the number type in attribute \"%s\".\n", attrname);
+          H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(errbuf);
+          return(status);
+        }
+        
+    }
+
+  
+  /* Release the data type ID */
+  /* ------------------------ */
+  status = H5Tclose(atype);
+  if(status == FAIL)
+    { 
+      sprintf(errbuf, "Cannot release the data type ID.\n");
+      H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf  );
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(status);
+    }
+  
+  /* Release the data space ID */
+  /* ------------------------- */	
+  status = H5Sclose(aspace);
+  if(status == FAIL)
+    { 
+      sprintf(errbuf, "Cannot release the data space ID.\n");
+      H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf  );
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(status);
+    }
+  
+  /* Release the attribute ID */
+  /* ------------------------ */
+  status = H5Aclose(attid);
+  if(status == FAIL)
+    { 
+      sprintf(errbuf, "Cannot release the attribute ID.\n");
+      H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_ATTR, H5E_CLOSEERROR, errbuf  );
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+
+      return(status);
+    }
+  
+  free(errbuf);
+  errbuf = NULL;
+  
+ COMPLETION:
+  return(status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHobj_info                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns number and names of objects in HDF-EOS structure      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|   10/15/99 A.Muslimov   Replaced memcmp() by strncmp() to fix an ABR        |
+|                         associated with the the first if() block for        |
+|                         name string containing less than 13 characters.     |
+|   04/19/00 A.Muslimov   Changed type of 'slen' from long to size_t.         |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_EHobj_info(hid_t loc_id, const char *name, void *opdata)
+{
+  size_t        slen     = 0;
+    
+  HE5_OBJINFO   *ptr;     
+
+  char          *indxstr = "_INDEXMAP:";
+  char          *bsom    = "_BLKSOM";
+  char          *lvwr    = "_LevelWritten";
+
+#ifdef _IGNORE_DIMSCALE_
+  hid_t		attid    = FAIL;
+  hid_t		atype    = FAIL;
+  H5T_class_t	atclass;
+  hid_t		suptype  = FAIL;
+  char		errbuf[HE5_HDFE_ERRBUFSIZE];
+#endif
+
+  ptr = (HE5_OBJINFO *)opdata;
+   
+#ifdef _IGNORE_DIMSCALE_
+  H5E_BEGIN_TRY
+  {
+      attid = H5Aopen_name(loc_id,name);
+  }
+  H5E_END_TRY;
+  if ( attid != FAIL )
+  {
+      /* Check if the type class is H5T_VLEN, and its base type is H5T_STD_REF_OBJ. */
+      atype  = H5Aget_type(attid);
+      if ( atype == FAIL)
+      { 
+	  sprintf(errbuf, "Cannot get the data type ID for attribute \"%s\".\n", name);
+	  H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf  );
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  H5Aclose(attid);
+	  return 0;
+      }
+      atclass = H5Tget_class(atype);
+      if ( atclass == H5T_NO_CLASS )
+      {
+	  sprintf(errbuf, "Cannot get the data type class for attribute \"%s\".\n", name);
+	  H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf  );
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  H5Aclose(attid);
+	  return 0;
+      }
+      else if ( atclass == H5T_VLEN )
+      {
+	  suptype = H5Tget_super(atype);
+	  if ( suptype >= 0 )
+	  {
+	      if ( H5Tequal(suptype, H5T_STD_REF_OBJ) == TRUE )
+	      {
+		  /* Do not append the attribute name because this attribute is not a proper
+		   * attribute like "DIMENSION_LIST". */
+		  H5Aclose(attid);
+		  return 0;
+	      }
+	  }
+      }
+      H5Aclose(attid);
+  }
+
+#endif
+   
+  if (  strncmp(name, indxstr, strlen(indxstr)) != 0 && strncmp(name, bsom, strlen(bsom)) != 0  &&  strncmp(name, lvwr, strlen(lvwr)) != 0  )
+    {
+
+      /* Get the number of objects */
+      /* ------------------------- */
+      ptr->count++;
+		
+      /* Compute string length of object entry */
+      /* ------------------------------------- */
+      slen = ( ptr->count == 1) ? strlen(name) : strlen(name) + 1;
+      ptr->strsize = ptr->strsize + slen;
+
+      /* Get comma separated name list */
+      /* ----------------------------- */
+      if( ptr->count == 1)
+	{ 
+	  ptr->name = (char *)calloc( (strlen(name)+1),  sizeof(char) );
+	  strcpy( ptr->name, name);
+	}
+      else 
+	{
+	  ptr->name = (char *)realloc( ptr->name, sizeof(char)*(ptr->strsize+1));
+	  strcat( ptr->name, ",");
+	  strcat( ptr->name, name);
+	}
+    }
+  
+  return 0;
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHinquire                                                    |
+|                                                                             |
+|  DESCRIPTION: Returns number and names of HDF-EOS structures in file        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nobj           long                Number of HDF-EOS structures in file    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  filename       char                HDF-EOS filename                        |
+|  grpname        char                Object Group name("SWATH/GRID/POINT/ZA")|
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  objectlist     char                List of object names (comma-separated)  |
+|  strbufsize     long                Length of objectlist                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/01/99  A.Muslimov    Checked for the statuses returned by H5Gclose() and |
+|                         H5Fclose() calls.                                   |
+|  9/29/99  A.Muslimov    Added dynamic memory allocation for error message   |
+|                         buffer.                                             |
+|  Nov. 00  A.Muslimov    Disabled error message and set return value to      |
+|                         "0" if a specified group is not found.              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_EHinquire(const char  *filename,  char *grpname, char *objectlist, long *strbufsize)
+{
+  long            nobj    = FAIL;/* Number of objects in the group   */
+
+  herr_t          status  = FAIL;/* Return status variable           */
+    
+  HE5_OBJINFO     inout;         /* Output "info" data structure     */
+
+  hid_t           HDFfid  = FAIL;/* HDFEOS file ID                   */
+  hid_t           heos_id = FAIL;/* Group ID for a specified group   */
+
+  int             index   = FAIL;/* Return value from an operator    */
+
+  char            *errbuf;		 /* Buffer for error message         */
+
+  CHECKPOINTER(filename);
+  CHECKPOINTER(grpname);
+
+  /* Initialize the data */
+  /* ------------------- */
+  inout.strsize = 0;
+  inout.count   = 0;
+  inout.name    = (char *)NULL;
+	
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHinquire", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Try to open HDFEOS file for read-only */
+  /* ------------------------------------- */
+  H5E_BEGIN_TRY
+    {
+      HDFfid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);   
+    }
+  H5E_END_TRY;
+  if(HDFfid == FAIL )  
+    {
+      sprintf(errbuf, " Cannot open \"%s\" file. Check the file name. \n", filename);
+      H5Epush(__FILE__, "HE5_EHinquire", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      nobj = FAIL;
+      free(errbuf);		
+      return(nobj);
+    }
+
+  /* Try to open  group "grpname" */
+  /* ---------------------------  */
+  H5E_BEGIN_TRY
+    {
+      heos_id = H5Gopen(HDFfid, grpname);
+    }
+  H5E_END_TRY;
+  if(heos_id == FAIL)
+    {
+      nobj = 0;
+      H5Fclose(HDFfid); 
+      free(errbuf);		
+      return(nobj);
+    }
+
+	
+  /* Loop to get hdfeos object information */
+  /* ------------------------------------- */
+  index = H5Giterate(heos_id, grpname,  NULL, HE5_EHobj_info, &inout);
+  if( index == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_EHinquire",__LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot get HDFEOS object information. \n");
+      HE5_EHprint("Error: Cannot get HDFEOS object information, occured", __FILE__, __LINE__);
+      nobj = FAIL;
+      goto done;
+    }
+	
+  if(objectlist != (char *)NULL)
+    memmove(objectlist, inout.name, strlen(inout.name));
+  
+  if(strbufsize != (long *)NULL) 
+    *strbufsize = inout.strsize;
+  
+  nobj = inout.count;
+  
+ done:
+  
+  /* inout.name is allocated in HE5_EHobj_info() */
+  /* ------------------------------------------- */
+  if( inout.name != NULL)
+    free( inout.name);
+  
+  
+  /* Release group ID */
+  /* ---------------- */
+  status = H5Gclose(heos_id);
+  if( status == FAIL)
+    {
+      sprintf(errbuf, "Cannot close the group \"%s\". \n", grpname);
+      H5Epush(__FILE__, "HE5_EHinquire",__LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      errbuf = NULL;
+      return(nobj);
+    }
+
+  /* Release file ID */
+  /* --------------- */
+  status = H5Fclose(HDFfid);
+  if( status == FAIL)
+    {
+      sprintf(errbuf, "Cannot close the HDFEOS file \"%s\" . \n", filename);
+      H5Epush(__FILE__, "HE5_EHinquire",__LINE__, H5E_FILE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  free(errbuf);
+  errbuf = NULL;
+
+ COMPLETION:  
+  return(nobj);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHattrcat                                                    |
+|                                                                             |
+|  DESCRIPTION: Returns a listing of attributes within an HDF-EOS structure   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nobj           long                Number of attributes in a struct        |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               HDF-EOS file ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  grpname        char*               Group name                              |
+|  objectlist     char*               Attribute names in a struct             |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  NOTES:  attributes "INDXMAP:..", "_FV_", "_BLKSOM:.." are not counted.     |
+|                                                                             |
+|  9/29/99  A.Muslimov    Added dynamic memory allocation for error message   |
+|                         buffer.                                             |
+|  2/1/00   A.Muslimov    Added H5Dopen(dts_id, ...) call for the case of     |
+|                         accessing dataset.                                  |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_EHattrcat(hid_t fid,  char *grpname, char *objectlist, long *strbufsize)
+{
+  long            nobj    = FAIL;/* number of attributes in a structure */
+
+  HE5_OBJINFO     inout;
+
+  hid_t           heos_id = FAIL;/* Group ID of a specified group       */
+  hid_t           HDFfid  = FAIL;
+  hid_t           dts_id  = FAIL;/* Dataset ID of a specified dataset   */
+    
+  herr_t          status  = FAIL;/* return status variable              */
+
+  int             index   = FAIL;/* return value of index               */
+
+  char            *errbuf = NULL;/* buffer for error message            */
+
+  CHECKPOINTER(grpname);
+
+  /* Initialize the data */
+  /* ------------------- */
+  inout.strsize = 0;			 /* object list size                    */
+  inout.count   = 0;			 /* number of objects                   */
+  inout.name    = NULL;			 /* onject name (comma separated) list  */
+
+  /* Get HDF file ID */
+  /* --------------- */
+  HDFfid = HE5_HeosTable[fid%HE5_EHIDOFFSET].HDFfid;
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHattrcat", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+	
+
+  /* Try to open group with name "grpname" */
+  /* ------------------------------------- */
+  H5E_BEGIN_TRY
+    {
+      heos_id = H5Gopen(HDFfid, grpname);
+    }
+  H5E_END_TRY;
+	
+  if(heos_id == FAIL)
+    {
+		
+      /* Try to open dataset with name "grpname" */
+      /* --------------------------------------- */ 
+      H5E_BEGIN_TRY
+	{
+	  dts_id = H5Dopen(HDFfid, grpname);
+	}
+      H5E_END_TRY;
+		
+      if(dts_id == FAIL)
+	{
+	  sprintf(errbuf, "No group/dataset named \"%s\" exists. \n", grpname);
+	  H5Epush(__FILE__, "HE5_EHattrcat", __LINE__, H5E_FILE, H5E_CANTOPENOBJ, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  nobj = FAIL;
+	  free(errbuf);
+		  
+	  return(nobj);
+	}
+	  
+    }
+	
+  /* Loop to get attributes information */
+  /* ---------------------------------- */
+  if (heos_id != FAIL)
+    index = H5Aiterate(heos_id,  NULL, HE5_EHobj_info, &inout);
+	
+  if (dts_id != FAIL)
+    index = H5Aiterate(dts_id,  NULL, HE5_EHobj_info, &inout);
+  if( index == FAIL)
+    {
+      sprintf(errbuf,"Cannot get attribute information. \n");
+      H5Epush(__FILE__, "HE5_EHattrcat", __LINE__, H5E_ATTR, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      nobj = FAIL;
+      goto done;
+    }
+
+  if(objectlist != NULL && inout.name != NULL ) 
+    strcpy( objectlist, inout.name);
+  if(strbufsize != NULL)  
+    *strbufsize = inout.strsize;
+  nobj = inout.count;
+	
+ done:
+
+  /* inout.name is allocated in HE5_EHobj_info() */
+  /* ------------------------------------------- */
+  if( inout.name != NULL) free( inout.name);
+	
+
+  if (heos_id != FAIL)
+    {
+      status = H5Gclose(heos_id);
+      if( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot release the group ID.\n");
+	  H5Epush(__FILE__, "HE5_EHattrcat",__LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+	
+  if (dts_id != FAIL)
+    {
+      status = H5Dclose(dts_id);
+      if( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot release the dataset ID.\n");
+	  H5Epush(__FILE__, "HE5_EHattrcat",__LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+    
+  free(errbuf);
+  errbuf = NULL;
+    
+ COMPLETION:
+  return(nobj);
+}
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHdatasetcat                                                 |
+|                                                                             |
+|  DESCRIPTION: Returns a listing of datasets within an HDF-EOS structure     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               HDF-EOS file ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  9/29/99  A.Muslimov    Added dynamic memory allocation for error message   |
+|                         buffer.                                             |
+|                                                                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_EHdatasetcat(hid_t fid,  char *grpname, char *objectlist, long *strbufsize)
+{
+  long            nobj    = FAIL;/* Number of datasets (RETURN)  */   
+
+  herr_t          status  = FAIL;/* Return status variable       */ 
+
+  int             index   = FAIL;/* Return value of an operation */
+    
+  HE5_OBJINFO     inout;
+
+  hid_t           heos_id = FAIL;/* Group ID                     */     
+  hid_t           HDFfid  = FAIL;/* HDF-EOS file ID              */ 
+
+  char            *errbuf;		 /* buffer for error message     */
+
+
+  CHECKPOINTER(grpname);
+
+  /* Initialize data */
+  /* --------------- */
+  inout.strsize = 0;			/*object list size*/
+  inout.count   = 0;			/*number of objects*/
+  inout.name    = NULL;			/*onject name list, seperated by comma*/
+
+  /* Get HDF file ID */
+  /* --------------- */
+  HDFfid = HE5_HeosTable[fid%HE5_EHIDOFFSET].HDFfid;
+
+  /* Allocate memory for error message buffer */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHdatasetcat", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+	
+  /* Try to open group "grpname" */
+  /* --------------------------- */
+  H5E_BEGIN_TRY
+    {
+      heos_id = H5Gopen(HDFfid, grpname);
+    }
+  H5E_END_TRY;
+  if(heos_id == FAIL)
+    {
+      sprintf(errbuf, "Cannot open \"%s\" group. Group may not exist. \n", grpname);
+      H5Epush(__FILE__, "HE5_EHdatasetcat", __LINE__, H5E_FILE, H5E_CANTOPENOBJ, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      nobj = FAIL;
+      free(errbuf);
+		
+      return(nobj);
+    }
+
+  /* Loop to get datasets information */
+  /* -------------------------------- */
+  index = H5Giterate(heos_id, grpname,  NULL, HE5_EHobj_info, &inout);
+  if( index == FAIL )
+    {
+      sprintf(errbuf,"Cannot get datasets information.\n");
+      H5Epush(__FILE__, "HE5_EHdatasetcat", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      nobj = FAIL;
+      goto done;
+    }
+
+  if(objectlist != NULL)  strcpy( objectlist, inout.name);
+  if(strbufsize != NULL)  *strbufsize = inout.strsize;
+  nobj = inout.count;
+	
+ done:
+  /* inout.name is allocated in HE5_EHobj_info() */
+  if( inout.name != NULL) free( inout.name);
+	
+  status = H5Gclose(heos_id);
+  if( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release the group ID.\n");
+      H5Epush(__FILE__, "HE5_EHdatasetcat",__LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+	
+  free(errbuf);
+  errbuf = NULL;
+	
+
+ COMPLETION:	
+  return(nobj);
+}
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHclose                                                      |
+|                                                                             |
+|  DESCRIPTION: close HDF-EOS file and returns status                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|  INPUTS: fid    hid_t   None        HDF-EOS file ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|   =======  ==========   =================================================   |
+|   July 99  A.Muslimov   Modified to conform to the HDFEOS file structure    |
+|   9/01/99  A.Muslimov   Added error handling right after the calls to       |
+|                         H5Gclose() and H5Fclose().                          |
+|   9/29/99  A.Muslimov   Added dynamic memory allocation for error message   |
+|                         buffer.                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_EHclose(hid_t fid)
+{
+  herr_t      status  = FAIL;/* routine return status variable  */
+  
+  hid_t       idx     = FAIL;/* HDF-EOS file index (reduced ID) */
+  
+  char        *errbuf = NULL;/* Error message  buffer           */
+  
+  /*
+  int i;
+  ssize_t nobj,nobj1,nobj2;
+  hid_t obj_id_list[100];
+  */
+
+   /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHclose", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+    
+  /* Check for valid HDFEOS file ID range */
+  /* ------------------------------------ */
+  if (fid >= HE5_EHIDOFFSET && fid < HE5_NEOSHDF + HE5_EHIDOFFSET)
+    {
+      /* Compute "reduced" file ID */
+      /* ------------------------- */
+      idx = fid % HE5_EHIDOFFSET;
+		
+      /* Close "HDFEOS" group */
+      /* -------------------- */
+      status = H5Gclose(HE5_HeosTable[ idx ].gid);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release \"HDFEOS\" group ID. \n");
+	  H5Epush(__FILE__, "HE5_EHclose", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+
+	  return(FAIL);
+	}
+
+      /* To see if user has forgotten to use detach somewhere in his/her code and because 
+	 of that there is any open IDs before reaching this point,user can uncomment out the 
+	 following few lines of code (and a few declerations above), recompile HDFEOS5, and link 
+	 the library to the user code */
+
+      /*
+      nobj1 = H5Fget_obj_count(HE5_HeosTable[idx].HDFfid,
+                               H5F_OBJ_DATASET |  H5F_OBJ_GROUP |  H5F_OBJ_DATATYPE | H5F_OBJ_ATTR);
+      nobj2 = H5Fget_obj_count(HE5_HeosTable[idx].HDFfid,H5F_OBJ_ALL);
+      printf("nobj1=%d\n",(int)nobj1);
+      printf("nobj2=%d\n",(int)nobj2);
+      nobj = H5Fget_obj_ids(HE5_HeosTable[idx].HDFfid,
+			    H5F_OBJ_DATASET |  H5F_OBJ_GROUP |  H5F_OBJ_DATATYPE | H5F_OBJ_ATTR , 100, obj_id_list);
+
+      printf("nobj=%d\n",(int)nobj);
+      for(i=0; i<nobj; i++)
+	{
+	  char name[1024];
+	  memset(name, 0, 1024);
+	  ssize_t charsread;
+	  charsread = H5Iget_name(obj_id_list[i], name,1024);
+	  printf("obj_id_lis=%d name =%s\n", obj_id_list[i], name);
+	}
+      */
+
+      /* Close HDF-EOS file */
+      /* ------------------ */
+      status = H5Fclose(HE5_HeosTable[idx].HDFfid);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the file ID. \n");
+	  H5Epush(__FILE__, "HE5_EHclose", __LINE__, H5E_FILE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+			
+	  return(FAIL);
+	}
+		
+      /* Clear out external array entries */
+      /* -------------------------------- */
+      HE5_HeosTable[ idx ].active      =   0;
+      HE5_HeosTable[ idx ].flags       =   0;
+      HE5_HeosTable[ idx ].HDFfid      =   FAIL;
+      HE5_HeosTable[ idx ].gid         =   FAIL;
+      if(HE5_HeosTable[ idx ].filename != NULL)
+	{
+	  free(HE5_HeosTable[ idx ].filename);
+	  HE5_HeosTable[ idx ].filename = NULL;
+	}
+      if(Stored_meta[ idx ].saved_metabuf != NULL)
+	{
+	  free(Stored_meta[ idx ].saved_metabuf);
+	  Stored_meta[ idx ].saved_metabuf = NULL;
+	}
+    }
+  else
+    {
+      status = FAIL;
+      sprintf(errbuf,"Invalid file ID: %d . ID should range from %d to %d . \n", fid, HE5_EHIDOFFSET, HE5_NEOSHDF + HE5_EHIDOFFSET);
+      H5Epush(__FILE__,  "HE5_EHclose", __LINE__, H5E_FILE, H5E_BADFILE, errbuf); 
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  free(errbuf);
+  errbuf = NULL;
+  
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHconvdatatype                                               |
+|                                                                             |
+|  DESCRIPTION: Returns native data types for C functions                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|  cdatatype      hid_t               datatype uesd in C functions            |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fdatatype      int                 code for datatypes                      |
+|                                                                             |
+|  OUTPUTS:       none                                                        |
+|                                                                             |
+|  11/06/99      Abe Taaheri                                                  |
+|  Aug 00        A.Muslimov           Updated                                 |
+|  Mar 02        A.Muslimov           Added more data type tags               |
+|  Mar 04        S.Zhao               Added a data type tag HE5T_CHARSTRING   |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t
+HE5_EHconvdatatype(int fdatatype)
+{
+  hid_t      cdatatype = FAIL;            /* return data type ID  */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */
+    
+  /* Check the input datatype flag and set data type ID */
+  /* -------------------------------------------------- */
+  if(fdatatype == HE5T_NATIVE_INT || fdatatype == 0)
+    cdatatype = H5T_NATIVE_INT;
+  else if(fdatatype == HE5T_NATIVE_UINT || fdatatype == 1)
+    cdatatype = H5T_NATIVE_UINT;
+  else if(fdatatype == HE5T_NATIVE_SHORT || fdatatype == 2)
+    cdatatype = H5T_NATIVE_SHORT;
+  else if(fdatatype == HE5T_NATIVE_USHORT || fdatatype == 3)
+    cdatatype = H5T_NATIVE_USHORT;
+  else if(fdatatype == HE5T_NATIVE_SCHAR || fdatatype == 4)
+    cdatatype = H5T_NATIVE_SCHAR;
+  else if(fdatatype == HE5T_NATIVE_UCHAR || fdatatype == 5)
+    cdatatype = H5T_NATIVE_UCHAR;
+  else if(fdatatype == HE5T_NATIVE_LONG || fdatatype == 6)
+    cdatatype = H5T_NATIVE_LONG;
+  else if(fdatatype == HE5T_NATIVE_ULONG || fdatatype == 7)
+    cdatatype = H5T_NATIVE_ULONG;
+  else if(fdatatype == HE5T_NATIVE_LLONG || fdatatype == 8)
+    cdatatype = H5T_NATIVE_LLONG;
+  else if(fdatatype == HE5T_NATIVE_ULLONG || fdatatype == 9)
+    cdatatype = H5T_NATIVE_ULLONG;
+  else if(fdatatype == HE5T_NATIVE_FLOAT || fdatatype == 10)
+    cdatatype = H5T_NATIVE_FLOAT;
+  else if(fdatatype == HE5T_NATIVE_DOUBLE || fdatatype == 11)
+    cdatatype = H5T_NATIVE_DOUBLE;
+  else if(fdatatype == HE5T_NATIVE_LDOUBLE || fdatatype == 12)
+    cdatatype = H5T_NATIVE_LDOUBLE;
+  else if(fdatatype == HE5T_NATIVE_INT8 || fdatatype == 13)
+    {
+      cdatatype = H5Tcopy(H5T_NATIVE_INT);
+      H5Tset_size(cdatatype, 1);
+    }
+  else if(fdatatype == HE5T_NATIVE_UINT8 || fdatatype == 14)
+    {
+      cdatatype = H5Tcopy(H5T_NATIVE_UINT);
+      H5Tset_size(cdatatype, 1);
+    }
+  else if(fdatatype == HE5T_NATIVE_INT16 || fdatatype == 15)
+    {
+      cdatatype = H5Tcopy(H5T_NATIVE_INT);
+      H5Tset_size(cdatatype, 2);
+    }
+  else if(fdatatype == HE5T_NATIVE_UINT16 || fdatatype == 16)
+    {
+      cdatatype = H5Tcopy(H5T_NATIVE_UINT);
+      H5Tset_size(cdatatype, 2);
+    }
+  else if(fdatatype == HE5T_NATIVE_INT32 || fdatatype == 17)
+    {
+      cdatatype = H5Tcopy(H5T_NATIVE_INT);
+      H5Tset_size(cdatatype, 4);
+    }
+  else if(fdatatype == HE5T_NATIVE_UINT32 || fdatatype == 18)
+    {
+      cdatatype = H5Tcopy(H5T_NATIVE_UINT);
+      H5Tset_size(cdatatype, 4);
+    }
+  else if(fdatatype == HE5T_NATIVE_INT64 || fdatatype == 19)
+    {
+      cdatatype = H5Tcopy(H5T_NATIVE_INT);
+      H5Tset_size(cdatatype, 8);
+    }
+  else if(fdatatype == HE5T_NATIVE_UINT64 || fdatatype == 20)
+    {
+      cdatatype = H5Tcopy(H5T_NATIVE_UINT);
+      H5Tset_size(cdatatype, 8);
+    }
+  else if(fdatatype == HE5T_NATIVE_B8 || fdatatype == 21)
+    cdatatype = H5T_NATIVE_B8;
+  else if(fdatatype == HE5T_NATIVE_B16 || fdatatype == 22)
+    cdatatype = H5T_NATIVE_B16;
+  else if(fdatatype == HE5T_NATIVE_B32 || fdatatype == 23)
+    cdatatype = H5T_NATIVE_B32;
+  else if(fdatatype == HE5T_NATIVE_B64 || fdatatype == 24)
+    cdatatype = H5T_NATIVE_B64;
+  else if(fdatatype == HE5T_NATIVE_HSIZE || fdatatype == 25)
+    cdatatype = H5T_NATIVE_HSIZE;
+  else if(fdatatype == HE5T_NATIVE_HERR || fdatatype == 26)
+    cdatatype = H5T_NATIVE_HERR;
+  else if(fdatatype == HE5T_NATIVE_HBOOL || fdatatype == 27)
+    cdatatype = H5T_NATIVE_HBOOL;
+  else if(fdatatype == HE5T_STD_I8BE || fdatatype == 28 || fdatatype == HE5T_STD_I8LE || fdatatype == 29)
+    cdatatype = H5T_NATIVE_SCHAR;
+  else if(fdatatype == HE5T_STD_I16BE || fdatatype == 30 || fdatatype == HE5T_STD_I16LE || fdatatype == 31)
+    cdatatype = H5T_NATIVE_SHORT;
+  else if(fdatatype == HE5T_STD_I32BE || fdatatype == 32 || fdatatype == HE5T_STD_I32LE || fdatatype == 33)
+    cdatatype = H5T_NATIVE_INT;
+  else if(fdatatype == HE5T_STD_I64BE || fdatatype == 34 || fdatatype == HE5T_STD_I64LE || fdatatype == 35)
+    cdatatype = H5T_NATIVE_LONG;
+  else if(fdatatype == HE5T_STD_U8BE || fdatatype == 36 || fdatatype == HE5T_STD_U8LE || fdatatype == 37)
+    cdatatype = H5T_NATIVE_UCHAR;
+  else if(fdatatype == HE5T_STD_U16BE || fdatatype == 38 || fdatatype == HE5T_STD_U16LE || fdatatype == 39)
+    cdatatype = H5T_NATIVE_USHORT;
+  else if(fdatatype == HE5T_STD_U32BE || fdatatype == 40 || fdatatype == HE5T_STD_U32LE || fdatatype == 41)
+    cdatatype = H5T_NATIVE_UINT;
+  else if(fdatatype == HE5T_STD_U64BE || fdatatype == 42 || fdatatype == HE5T_STD_U64LE || fdatatype == 43)
+    cdatatype = H5T_NATIVE_ULONG;
+  else if(fdatatype == HE5T_STD_B8BE || fdatatype == 44)
+    cdatatype = H5T_STD_B8BE;
+  else if(fdatatype == HE5T_STD_B8LE || fdatatype == 45)
+    cdatatype = H5T_STD_B8LE;
+  else if(fdatatype == HE5T_STD_B16BE || fdatatype == 46)
+    cdatatype = H5T_STD_B16BE;
+  else if(fdatatype == HE5T_STD_B16LE || fdatatype == 47)
+    cdatatype = H5T_STD_B16LE;
+  else if(fdatatype == HE5T_STD_B32BE || fdatatype == 48)
+    cdatatype = H5T_STD_B32BE;
+  else if(fdatatype == HE5T_STD_B32LE || fdatatype == 49)
+    cdatatype = H5T_STD_B32LE;
+  else if(fdatatype == HE5T_STD_B64BE || fdatatype == 50)
+    cdatatype = H5T_STD_B64BE;
+  else if(fdatatype == HE5T_STD_B64LE || fdatatype == 51)
+    cdatatype = H5T_STD_B64LE;
+  else if(fdatatype == HE5T_IEEE_F32BE || fdatatype == 52 || fdatatype == HE5T_IEEE_F32LE || fdatatype == 53)
+    cdatatype = H5T_NATIVE_FLOAT;
+  else if(fdatatype == HE5T_IEEE_F64BE || fdatatype == 54 || fdatatype == HE5T_IEEE_F64LE || fdatatype == 55)
+    cdatatype = H5T_NATIVE_DOUBLE;
+  else if(fdatatype == HE5T_NATIVE_CHAR || fdatatype == 56)
+    cdatatype = H5T_NATIVE_CHAR;
+  else if(fdatatype == HE5T_CHARSTRING || fdatatype == 57)
+    cdatatype = H5T_C_S1;
+  /* The error will be issued after the call */
+  /*
+  else
+    {
+      sprintf(errbuf,"Invalid FORTRAN datatype flag (\"%d\").\n", fdatatype);
+      H5Epush(__FILE__,  "HE5_EHconvdatatype", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); 
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  */
+  return(cdatatype);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHdtype2numtype                                              |
+|                                                                             |
+|  DESCRIPTION: Takes file data type ID, and converts it to a number type ID  |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|  numtype         hid_t              Number type ID                          |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  dtype           hid_t              File data type ID                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 02    S.Zhao       Original development                                |
+|  Dec 03    S.Zhao       Updated                                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t
+HE5_EHdtype2numtype(hid_t dtype)
+{
+  hid_t      numtype = FAIL;
+  /*  char       *errbuf = NULL;*/    /* Error message buffer */
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];
+ 
+ 
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  /*
+    errbuf = (char *) calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+    if(errbuf == NULL)
+    {
+    H5Epush(__FILE__, "HE5_EHdtype2numtype", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+    HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+    return(FAIL);
+    }
+  */
+ 
+  if ((dtype == HE5T_CHARSTRING) ||
+      H5Tequal(dtype,H5T_C_S1))
+    numtype = HE5T_CHARSTRING;
+  else if(H5Tequal(dtype, H5T_NATIVE_INT) ||
+          H5Tequal(dtype,H5T_STD_I32BE) ||
+          H5Tequal(dtype,H5T_STD_I32LE))
+    numtype = HE5T_NATIVE_INT;
+  else if(H5Tequal(dtype, H5T_NATIVE_UINT) ||
+          H5Tequal(dtype,H5T_STD_U32BE) ||
+          H5Tequal(dtype,H5T_STD_U32LE))
+    numtype = HE5T_NATIVE_UINT;
+  else if(H5Tequal(dtype, H5T_NATIVE_SHORT))
+    numtype = HE5T_NATIVE_SHORT;
+  else if(H5Tequal(dtype, H5T_NATIVE_USHORT))
+    numtype = HE5T_NATIVE_USHORT;
+  else if(H5Tequal(dtype, H5T_NATIVE_SCHAR))
+    numtype = HE5T_NATIVE_SCHAR;
+  else if(H5Tequal(dtype, H5T_NATIVE_UCHAR))
+    numtype = HE5T_NATIVE_UCHAR;
+  else if(H5Tequal(dtype, H5T_NATIVE_LONG) ||
+          H5Tequal(dtype,H5T_STD_I64BE) ||
+          H5Tequal(dtype,H5T_STD_I64LE))
+    numtype = HE5T_NATIVE_LONG;
+  else if(H5Tequal(dtype, H5T_NATIVE_ULONG) ||
+          H5Tequal(dtype,H5T_STD_U64BE) ||
+          H5Tequal(dtype,H5T_STD_U64LE))
+    numtype = HE5T_NATIVE_ULONG;
+  else if(H5Tequal(dtype, H5T_NATIVE_LLONG))
+    numtype = HE5T_NATIVE_LLONG;
+  else if(H5Tequal(dtype, H5T_NATIVE_ULLONG))
+    numtype = HE5T_NATIVE_ULLONG;
+  else if(H5Tequal(dtype, H5T_NATIVE_FLOAT) ||
+          H5Tequal(dtype,H5T_IEEE_F32BE) ||
+          H5Tequal(dtype,H5T_IEEE_F32LE))
+    numtype = HE5T_NATIVE_FLOAT;
+  else if(H5Tequal(dtype, H5T_NATIVE_DOUBLE) ||
+          H5Tequal(dtype,H5T_IEEE_F64BE) ||
+          H5Tequal(dtype,H5T_IEEE_F64LE))
+    numtype = HE5T_NATIVE_DOUBLE;
+  else if(H5Tequal(dtype, H5T_NATIVE_LDOUBLE))
+    numtype = HE5T_NATIVE_LDOUBLE;
+  else if(H5Tequal(dtype, H5T_NATIVE_INT8) ||
+          H5Tequal(dtype,H5T_STD_I8BE) ||
+          H5Tequal(dtype,H5T_STD_I8LE)) 
+    numtype = HE5T_NATIVE_INT8;
+  else if(H5Tequal(dtype, H5T_NATIVE_UINT8) ||
+          H5Tequal(dtype,H5T_STD_U8BE) ||
+          H5Tequal(dtype,H5T_STD_U8LE))
+    numtype = HE5T_NATIVE_UINT8;
+  else if(H5Tequal(dtype, H5T_NATIVE_INT16) ||
+          H5Tequal(dtype,H5T_STD_I16BE) ||
+          H5Tequal(dtype,H5T_STD_I16LE))
+    numtype = HE5T_NATIVE_INT16;
+  else if(H5Tequal(dtype, H5T_NATIVE_UINT16) ||
+          H5Tequal(dtype,H5T_STD_U16BE) ||
+          H5Tequal(dtype,H5T_STD_U16LE))
+    numtype = HE5T_NATIVE_UINT16;
+  else if(H5Tequal(dtype, H5T_NATIVE_INT32))
+    numtype = HE5T_NATIVE_INT32;
+  else if(H5Tequal(dtype, H5T_NATIVE_UINT32))
+    numtype = HE5T_NATIVE_UINT32;
+  else if(H5Tequal(dtype, H5T_NATIVE_INT64))
+    numtype = HE5T_NATIVE_INT64;
+  else if(H5Tequal(dtype, H5T_NATIVE_UINT64))
+    numtype = HE5T_NATIVE_UINT64;
+  else if(H5Tequal(dtype, H5T_NATIVE_B8) ||
+          H5Tequal(dtype,H5T_STD_B8BE) ||
+          H5Tequal(dtype,H5T_STD_B8LE))
+    numtype = HE5T_NATIVE_B8;
+  else if(H5Tequal(dtype, H5T_NATIVE_B16) ||
+          H5Tequal(dtype,H5T_STD_B16BE) ||
+          H5Tequal(dtype,H5T_STD_B16LE))
+    numtype = HE5T_NATIVE_B16;
+  else if(H5Tequal(dtype, H5T_NATIVE_B32) ||
+          H5Tequal(dtype,H5T_STD_B32BE) ||
+          H5Tequal(dtype,H5T_STD_B32LE))
+    numtype = HE5T_NATIVE_B32;
+  else if(H5Tequal(dtype, H5T_NATIVE_B64) ||
+          H5Tequal(dtype,H5T_STD_B64BE) ||
+          H5Tequal(dtype,H5T_STD_B64LE))
+    numtype = HE5T_NATIVE_B64;
+  else if(H5Tequal(dtype, H5T_NATIVE_HSIZE))
+    numtype = HE5T_NATIVE_HSIZE;
+  else if(H5Tequal(dtype, H5T_NATIVE_HERR))
+    numtype = HE5T_NATIVE_HERR;
+  else if(H5Tequal(dtype, H5T_NATIVE_HBOOL))
+    numtype = HE5T_NATIVE_HBOOL;
+  else if (H5Tequal(dtype, H5T_NATIVE_CHAR))
+    numtype = HE5T_NATIVE_CHAR;
+  else {
+    numtype = FAIL;
+    sprintf(errbuf,"The datatype \"%d\" is not supported (unknown).\n", (int)dtype);
+    H5Epush(__FILE__, "HE5_EHdtype2numtype", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+    HE5_EHprint(errbuf, __FILE__, __LINE__);
+  }
+ 
+  /*free(errbuf);*/
+ 
+  return(numtype);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHwriteglbattr                                               |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with the "FILE_ATTRIBUTES"|
+|               group in a Swath/Grid/Point/ZA.                               |
+|                                                                             |
+|                                -----------                                  |
+|                               | Root "/"  |                                 |
+|                                -----------                                  |
+|                               /           \                                 |
+|               ----------------------    ---------------------               |
+|               | HDFEOS INFORMATION |    |       HDFEOS      |               |
+|               ----------------------    ---------------------               |
+|               /            |            /   / \   \        \                |
+|              /             |           /   /   \   \        \               |
+|    <HDFEOSVersion> [StructMetadata.0] /   /     \   \        \              |
+|                                      /   |       |   \        \             |
+|                            ----------  ------ ------- ------- --------      |
+|                           |ADDITIONAL| |GRID| |POINT| |SWATH| |  ZA  |      |
+|                            ----------  ------ ------- ------- --------      |
+|                                /         :       :        :       :         |
+|                               /        [dts]   [dts]    [dts]   [dts]       |
+|                      -----------------                                      |
+|                      |FILE_ATTRIBUTES|                                      |
+|                      -----------------                                      |
+|                               :                                             |
+| Writes/Updates data here=> <attrs>                                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               HDFEOS File ID                          |
+|  attrname       char                attribute name                          |
+|  numbertype     hid_t               attribute dataset datatype ID           |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 01   A.Muslimov    Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_EHwriteglbattr(hid_t fid, const char *attrname, hid_t numbertype, hsize_t  count[], void *datbuf)
+{
+  herr_t     status          = FAIL;     /* Return status variable     */
+
+  uintn      access          =  0;	     /* Access code                */
+
+  hid_t      gid             = FAIL;     /* "HDFEOS" group ID          */
+
+  hid_t      AddGrpID        = FAIL;     /* "ADDITIONAL" group ID      */
+  hid_t      FileAttrGrpID   = FAIL;     /* "FILE_ATTRIBUTES" group ID */
+  hid_t      HDFfid          = FAIL;	 /* HDF-EOS file ID            */
+   
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+
+
+  /* Get HDF-EOS file ID and "HDFEOS" group ID */
+  /* ========================================= */
+  status = HE5_EHchkfid(fid,"HE5_EHwriteglbattr", &HDFfid, &gid, &access);
+  if(status == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_EHwriteglbattr", __LINE__, H5E_FILE, H5E_NOTFOUND, "Invalid file ID. \n");
+      HE5_EHprint("Error: Invalid file ID, occured", __FILE__, __LINE__);
+     
+      return(FAIL);
+    }
+
+  if (status == SUCCEED)
+    {
+      /* Get "ADDITIONAL" group ID */
+      /* ------------------------- */
+      AddGrpID = H5Gopen(gid, "ADDITIONAL");
+      if(AddGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"ADDITIONAL\" group. \n");
+	  H5Epush(__FILE__, "HE5_EHwriteglbattr", __LINE__, H5E_OHDR, H5E_NOTFOUND,errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	} 
+
+
+      /* Get "FILE_ATTRIBUTES" group ID and call HE5_EHattr to perform I/O */
+      /* ----------------------------------------------------------------- */
+      FileAttrGrpID = H5Gopen(AddGrpID, "FILE_ATTRIBUTES");
+      if(FileAttrGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"FILE_ATTRIBUTES\" group. \n");
+	  H5Epush(__FILE__, "HE5_EHwriteglbattr", __LINE__, H5E_OHDR, H5E_NOTFOUND,errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	} 
+
+      status = HE5_EHattr(FileAttrGrpID, attrname, numbertype, count,"w", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write Attribute \"%s\"to the \"FILE_ATTRIBUTES\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_EHwriteglbattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      status = H5Gclose(AddGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"ADDITIONAL\" group ID. \n");
+	  H5Epush(__FILE__, "HE5_EHwriteglbattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      status = H5Gclose(FileAttrGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"FILE_ATTRIBUTES\" group ID. \n");
+	  H5Epush(__FILE__, "HE5_EHwriteglbattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+    }
+
+ COMPLETION:
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHreadglbattr                                                |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from the "FILE_ATTRIBUTES" group in a file.   |
+|                                                                             |
+|                                                                             |
+|                                -----------                                  |
+|                                | Root "/"|                                  |
+|                                -----------                                  |
+|                               /           \                                 |
+|               ----------------------    ---------------------               |
+|               | HDFEOS INFORMATION |    |       HDFEOS      |               |
+|               ----------------------    ---------------------               |
+|               /            |            /   / \   \        \                |
+|              /             |           /   /   \   \        \               |
+|    <HDFEOSVersion> [StructMetadata.0] /   /     \   \        \              |
+|                                      /   |       |   \        \             |
+|                            ----------  ------ ------- ------- --------      |
+|                           |ADDITIONAL| |GRID| |POINT| |SWATH| |  ZA  |      |
+|                            ----------  ------ ------- ------- --------      |
+|                                /         :       :        :       :         |
+|                               /        [dts]   [dts]    [dts]   [dts]       |
+|                      -----------------                                      |
+|                      |FILE_ATTRIBUTES|                                      |
+|                      -----------------                                      |
+|                             :                                               |
+| Reads attributes from => <attrs>                                            |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               file ID                                 |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 01   A.Muslimov    Original development.                               |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_EHreadglbattr(hid_t fid, const char *attrname, void * datbuf)
+{
+  herr_t      status          = FAIL;     /* return status variable     */
+  
+  uintn       access          =  0;	      /* Access code                */
+
+  hid_t       gid             = FAIL;     /* "HDFEOS" group ID          */
+  hid_t       AddGrpID        = FAIL;     /* "ADDITIONAL" group ID      */
+  hid_t       FileAttrGrpID   = FAIL;     /* "FILE_ATTRIBUTES" group ID */
+  hid_t       HDFfid          = FAIL;	  /* HDF-EOS file ID            */
+  hid_t       ntype           = FAIL;     /* Data type ID               */
+  
+  hsize_t     count[]         = { 0 };    /* # of attribute elements    */
+  
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+  
+  CHECKPOINTER(attrname);
+
+
+  /* Get HDF-EOS file ID and "HDFEOS" group ID */
+  /* ========================================= */
+  status = HE5_EHchkfid(fid,"HE5_EHreadglbattr", &HDFfid, &gid, &access);
+  if (status == SUCCEED)
+    {
+      /* Get "ADDITIONAL"  group ID  */
+      /* --------------------------- */
+      AddGrpID = H5Gopen(gid, "ADDITIONAL");
+      if(AddGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"ADDITIONAL\" group.\n");
+	  H5Epush(__FILE__, "HE5_EHreadglbattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+        }
+
+      /* Get "FILE_ATTRIBUTES"  group ID and call HE5_EHattr to perform I/O */
+      /* ------------------------------------------------------------------ */
+      FileAttrGrpID = H5Gopen(AddGrpID, "FILE_ATTRIBUTES");
+      if(FileAttrGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"FILE_ATTRIBUTES\" group.\n");
+	  H5Epush(__FILE__, "HE5_EHreadglbattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+        }
+
+      status = HE5_EHattr(FileAttrGrpID,attrname,ntype,count,"r", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot read Attribute \"%s\" from the \"FILE_ATTRIBUTES\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_EHreadglbattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }
+
+      status = H5Gclose(AddGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"ADDITIONAL\" group ID.\n");
+	  H5Epush(__FILE__,"HE5_EHreadglbattr", __LINE__,  H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      status = H5Gclose(FileAttrGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"FILE_ATTRIBUTES\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_EHreadglbattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+	  
+    }
+
+ COMPLETION:
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHglbattrinfo                                                |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about attributes in "FILE_ATTRIBUTES"   |
+|                  group within a file.                                       |
+|                                                                             |
+|                                -----------                                  |
+|                                | Root "/"|                                  |
+|                                -----------                                  |
+|                               /           \                                 |
+|               ----------------------    ---------------------               |
+|               | HDFEOS INFORMATION |    |       HDFEOS      |               |
+|               ----------------------    ---------------------               |
+|               /            |            /   / \   \        \                |
+|              /             |           /   /   \   \        \               |
+|    <HDFEOSVersion> [StructMetadata.0] /   /     \   \        \              |
+|                                      /   |       |   \        \             |
+|                            ----------  ------ ------- ------- --------      |
+|                           |ADDITIONAL| |GRID| |POINT| |SWATH| |  ZA  |      |
+|                            ----------  ------ ------- ------- --------      |
+|                                /         :       :        :       :         |
+|                               /        [dts]   [dts]    [dts]   [dts]       |
+|                      -----------------                                      |
+|                      |FILE_ATTRIBUTES|                                      |
+|                      -----------------                                      |
+|                             :                                               |
+|                          <attrs>                                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               file ID                                 |
+|  attrname       const char*         attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               data type ID                            |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 01   A.Muslimov    Original development.                               |
+|  Feb 03   S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_EHglbattrinfo(hid_t fid, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t     status          = FAIL;     /* Return status variable     */
+
+  uintn      access          =  0;	     /* Access code                */
+
+  hid_t      gid             = FAIL;     /* "HDFEOS" group ID          */
+  hid_t      AddGrpID        = FAIL;     /* "ADDITIONAL" group ID      */
+  hid_t      FileAttrGrpID   = FAIL;     /* "FILE_ATTRIBUTES" group ID */
+  hid_t      HDFfid          = FAIL;	 /* HDF-EOS file ID            */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/*  Error message buffer      */
+
+  CHECKPOINTER(attrname);
+
+
+  /* Get HDF-EOS file ID and "HDFEOS" group ID */
+  /* ========================================= */
+  status = HE5_EHchkfid(fid,"HE5_EHglbattrinfo", &HDFfid, &gid, &access);
+  if (status == SUCCEED)
+    {
+      /* Get "ADDITIONAL"  group ID */
+      /* -------------------------- */
+      AddGrpID = H5Gopen(gid, "ADDITIONAL");
+      if(AddGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"ADDITIONAL\" group.\n");
+	  H5Epush(__FILE__, "HE5_EHglbattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Get "FILE_ATTRIBUTES"  group ID and call HE5_EHattrinfo */
+      /* ------------------------------------------------------- */
+      FileAttrGrpID = H5Gopen(AddGrpID, "FILE_ATTRIBUTES");
+      if(FileAttrGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"FILE_ATTRIBUTES\" group.\n");
+	  H5Epush(__FILE__,"HE5_EHglbattrinfo", __LINE__,  H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      status = HE5_EHattrinfo(FileAttrGrpID,attrname,ntype,count);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"FILE_ATTRIBUTES\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_EHglbattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      status = H5Gclose(AddGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"ADDITIONAL\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_EHglbattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      status = H5Gclose(FileAttrGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"FILE_ATTRIBUTES\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_EHglbattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  
+ COMPLETION:
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHinqglbattrs                                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list in "FILE_ATTRIBUTES" group                    |
+|                                                                             |
+|                                -----------                                  |
+|                                | Root "/"|                                  |
+|                                -----------                                  |
+|                               /           \                                 |
+|               ----------------------    --------------------                |
+|               | HDFEOS INFORMATION |    |      HDFEOS      |                |
+|               ----------------------    --------------------                |
+|               /            |            /   / \   \       \                 |
+|              /             |           /   /   \   \       \                |
+|    <HDFEOSVersion> [StructMetadata.0] /   /     \   \       \               |
+|                                      /   |       |   \       \              |
+|                            ----------  ------ ------- ------- --------      |
+|                           |ADDITIONAL| |GRID| |POINT| |SWATH| |  ZA  |      |
+|                            ----------  ------ ------- ------- --------      |
+|                                /         :       :        :       :         |
+|                               /        [dts]   [dts]    [dts]   [dts]       |
+|                      -----------------                                      |
+|                      |FILE_ATTRIBUTES|                                      |
+|                      -----------------                                      |
+|                             :                                               |
+|                          <attrs>                                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in                 |
+|                                        "FILE_ATTRIBUTES" group.             |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               file ID                                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in "FILE_ATTRIBUTES"    |
+|                                         group (Comma-separated list)        |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 01   A.Muslimov    Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_EHinqglbattrs(hid_t fid, char *attrnames, long *strbufsize)
+{
+  long            nattr           = FAIL;     /* Number of attributes     */
+
+  herr_t          status          = FAIL;     /* Return status variable   */
+
+  uintn           access          =  0;	      /* Access code              */
+
+  hid_t           gid             = FAIL;     /* "HDFEOS" group ID        */
+  hid_t           HDFfid          = FAIL;	  /* HDF-EOS file ID          */
+    
+  char            *grpname = (char *)NULL;    /* Group name string        */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */
+
+
+  /* Get HDF-EOS file ID and "HDFEOS" group ID */
+  /* ========================================= */
+  status = HE5_EHchkfid(fid,"HE5_EHinqglbattrs", &HDFfid, &gid, &access);
+  if(status == SUCCEED )
+    {
+      grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) );
+      if( grpname == NULL)
+        {
+          H5Epush(__FILE__, "HE5_EHinqgrpattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+          HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      /* Set the Group name */
+      /* ------------------ */
+      strcpy(grpname,"/HDFEOS/ADDITIONAL/FILE_ATTRIBUTES");
+	
+      /* search group with grpname for the number of attributes */
+      /* ------------------------------------------------------ */ 
+      nattr = HE5_EHattrcat(fid, grpname, attrnames, strbufsize);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot find the attributes. \n");
+	  H5Epush(__FILE__, "HE5_EHinqglbattrs",   __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	}
+
+      if (grpname != NULL) free(grpname);
+    }
+  
+  return (nattr);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHinqglbdatatype                                             |
+|                                                                             |
+|  DESCRIPTION: Inquires the data type of attributes in "FILE_ATTRIBUTES"     |
+|               group within a file.                                          |
+|                                                                             |
+|                                -----------                                  |
+|                                | Root "/"|                                  |
+|                                -----------                                  |
+|                               /           \                                 |
+|               ----------------------    --------------------                |
+|               | HDFEOS INFORMATION |    |      HDFEOS      |                |
+|               ----------------------    --------------------                |
+|               /            |            /   / \   \       \                 |
+|              /             |           /   /   \   \       \                |
+|    <HDFEOSVersion> [StructMetadata.0] /   /     \   \       \               |
+|                                      /   |       |   \       \              |
+|                            ----------  ------ ------- ------- --------      |
+|                           |ADDITIONAL| |GRID| |POINT| |SWATH| |  ZA  |      |
+|                            ----------  ------ ------- ------- --------      |
+|                                /         :       :        :       :         |
+|                               /        [dts]   [dts]    [dts]   [dts]       |
+|                      -----------------                                      |
+|                      |FILE_ATTRIBUTES|                                      |
+|                      -----------------                                      |
+|                             :                                               |
+|                          <attrs>                                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               file ID                                 |
+|  attrname       const char*         attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datatype       hid_t                                                       |
+|  classid        H5T_class_t                                                 |
+|  order          H5T_order_t                                                 |
+|  size           size_t                                                      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Mar 03    S.Zhao       Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_EHinqglbdatatype(hid_t fid, const char *attrname, hid_t *datatype, H5T_class_t *classid, H5T_order_t *order, size_t *size)
+{
+  herr_t     status          = FAIL;     /* Return status variable     */
+ 
+  uintn      access          =  0;       /* Access code                */
+ 
+  hid_t      gid             = FAIL;     /* "HDFEOS" group ID          */
+  hid_t      AddGrpID        = FAIL;     /* "ADDITIONAL" group ID      */
+  hid_t      FileAttrGrpID   = FAIL;     /* "FILE_ATTRIBUTES" group ID */
+  hid_t      HDFfid          = FAIL;     /* HDF-EOS file ID            */
+  hid_t      attr            = FAIL;     /* attribute dataset ID       */
+ 
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/*  Error message buffer      */
+ 
+  CHECKPOINTER(attrname);
+ 
+ 
+  /* Get HDF-EOS file ID and "HDFEOS" group ID */
+  /* ========================================= */
+  status = HE5_EHchkfid(fid,"HE5_EHinqglbdatatype", &HDFfid, &gid, &access);
+  if (status == SUCCEED)
+    {
+      /* Get "ADDITIONAL"  group ID */
+      /* -------------------------- */
+      AddGrpID = H5Gopen(gid, "ADDITIONAL");
+      if(AddGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"ADDITIONAL\" group.\n");
+	  H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+ 
+      /* Get "FILE_ATTRIBUTES"  group ID */
+      /* ------------------------------- */
+      FileAttrGrpID = H5Gopen(AddGrpID, "FILE_ATTRIBUTES");
+      if(FileAttrGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"FILE_ATTRIBUTES\" group.\n");
+	  H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+ 
+      /* Get data type information about global attribute */
+      /* ------------------------------------------------ */
+      attr = H5Aopen_name(FileAttrGrpID,attrname);
+      if (attr == FAIL)
+	{
+	  sprintf(errbuf, "Cannot open the \"%s\" attribute.\n", attrname);
+	  H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      *datatype = H5Aget_type(attr);
+      if (*datatype == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the data type for the \"%s\" attribute.\n", attrname);
+	  H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      *classid = H5Tget_class(*datatype);
+      if (*classid == H5T_NO_CLASS)
+	{
+	  sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" attribute.\n", attrname);
+	  H5Epush(__FILE__,"HE5_EHinqglbdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      *order = H5Tget_order(*datatype);
+      if (*order == H5T_ORDER_ERROR)
+	{
+	  sprintf(errbuf, "Cannot get the data type order for the \"%s\" attribute.\n", attrname);
+	  H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	} 
+
+      if (*classid == H5T_STRING)
+	{
+          *size = H5Tget_size(*datatype);
+          if (*size == 0)
+	    {
+	      sprintf(errbuf, "Cannot get the data type size for the \"%s\" string attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	}
+      else
+	{
+          *size = H5Tget_size(*datatype);
+          if (*size == 0)
+	    {
+	      sprintf(errbuf, "Cannot get the data type size for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	}
+
+      status = H5Aclose(attr);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname);
+	  H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	} 
+
+      status = H5Gclose(AddGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"ADDITIONAL\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+      status = H5Gclose(FileAttrGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"FILE_ATTRIBUTES\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+ 
+ COMPLETION:
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHupdatemeta                                                 |
+|                                                                             |
+|  DESCRIPTION: Updates metadata                                              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|    status       herr_t  None        return status variable (0 for success,  |
+|                                          -1 for failure)                    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|    fid          hid_t   None        HDF-EOS file ID                         |
+|    structname   char*   None        Object name string                      |
+|    structcode   char*   None        "s" for a swath, "g" for a grid,        |
+|                                     "p" for a point, and "z" for a za.      |
+|    metacode     long    None        Code of a metadata block to insert to.  |
+|    metastr      char*   None        Buffer containing metadata information  |
+|                                      to insert.                             |
+|    metadata[]   hsize_t None        Array of data values                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|    None                                                                     |
+|                                                                             |
+|  NOTES:   Allocates memory of fixed size (= HE5_STATIC_BLKSIZE)             |
+|           for metabuf[] array (old scheme), or allocates buffer in chuncks  |
+|           of HE5_DYNAMIC_BLKSIZE (new scheme).                              |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  05/17/04  Abe Taaheri  Initial version                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_EHupdatemeta(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[])
+{
+  herr_t   status = SUCCEED;
+  int      HDFEOS5ver_flg ; /* will be set to 1 if the HDF-EOS5 version 
+			       is later than 5.1.7, otherwise to 0 */
+  /* Get HDFEOS5ver_flg flag for the file */
+  /* --------------- */
+  HDFEOS5ver_flg = HE5_HeosTable[fid%HE5_EHIDOFFSET].DYNAMIC_flag;
+
+  if(HDFEOS5ver_flg == 1)
+    {
+      status = HE5_EHupdatemeta_Static(fid, structname, structcode, metacode,
+				       metastr, metadata);
+    }
+  else if(HDFEOS5ver_flg == 0)
+    {
+      status = HE5_EHupdatemeta_Dynamic(fid, structname, structcode, metacode,
+					metastr, metadata);
+    }
+
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHupdatemeta_Static                                          |
+|                                                                             |
+|  DESCRIPTION: Updates metadata                                              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|    status       herr_t  None        return status variable (0 for success,  |
+|                                          -1 for failure)                    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|    fid          hid_t   None        HDF-EOS file ID                         |
+|    structname   char*   None        Object name string                      |
+|    structcode   char*   None        "s" for a swath, "g" for a grid,        |
+|                                     "p" for a point, and "z" for a za.      |
+|    metacode     long    None        Code of a metadata block to insert to.  |
+|    metastr      char*   None        Buffer containing metadata information  |
+|                                      to insert.                             |
+|    metadata[]   hsize_t None        Array of data values                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|    None                                                                     |
+|                                                                             |
+|  NOTES:   There is memory allocation of BLKSIZE chunk for the               |
+|           dataset "StructMetadata.0"                                        |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct. 02  S. ZHAO       Original development                                |
+|  Dec. 02  H. LO         Update dimension size                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_EHupdatemeta_Static(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[])
+{
+  herr_t         status   = FAIL;    /* routine return status variable            */
+ 
+  int            i;                  /* Loop index                                */
+ 
+  hid_t          gid      = FAIL;    /* "HDFEOS INFORMATION" group ID             */
+  hid_t          meta_id  = FAIL;    /* "StructuralMetadat.0" group ID            */
+  hid_t          atype    = FAIL;    /* Data type ID                              */
+  hid_t          aspace   = FAIL;    /* Data space ID                             */
+  hid_t          HDFfid   = FAIL;    /* HDF5 file ID                              */
+ 
+  hsize_t        tempdim  =  0;      /* Temporary variable                        */
+ 
+  long           count = 0;          /* Objects/Groups counter                    */
+ 
+  char           *metabuf = NULL;    /* Pointer to Structural Metadata array      */
+  char           *metaptr = NULL;    /* Metadata pointer                          */
+  char           *prevmetaptr = NULL;/* Previous position of metadata pointer     */
+  char           *utlstr  = NULL;    /* Utility string                            */
+  char           *utlstr2 = NULL;    /* Utility string 2                          */
+  char           *newbuf  = NULL;    /* updated metadata string                   */
+  char           *type    = NULL;    /* data type string                          */
+  char           *errbuf  = NULL;    /* Error message buffer                      */
+ 
+  char           *meta_dim_name = NULL;
+  char           *utl_dim_name  = NULL;
+  int            ii, jj, i1, j1;
+ 
+  CHECKPOINTER(structname);
+  CHECKPOINTER(structcode);
+  CHECKPOINTER(metastr);
+ 
+ 
+ 
+  /* Get HDF file ID */
+  /* --------------- */
+  HDFfid = HE5_HeosTable[fid%HE5_EHIDOFFSET].HDFfid;
+ 
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Allocate memory for data type string */
+  /* ------------------------------------ */
+  type = (char * )calloc( HE5_HDFE_TYPESTRSIZE, sizeof(char));
+  if(type == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for data type string. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+ 
+      return(FAIL);
+    }
+ 
+ 
+  /* Open "HDFEOS INFORMATION" group */
+  /* =============================== */
+  gid     = H5Gopen(HDFfid, "HDFEOS INFORMATION");
+  if(gid == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot open \"HDFEOS INFORMATION\" group. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(type);
+ 
+      return(status);
+    }
+ 
+ 
+  /*
+   *--------------------------------------------------------------*
+   * Open dataset "StructMetadata.0", get datatype and space ID   *
+   *--------------------------------------------------------------*
+   */
+  meta_id = H5Dopen(gid, "StructMetadata.0");
+  if( meta_id == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot open \"StructMetadata.0\" dataset. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(type);
+ 
+      return(status);
+    }
+  atype   = H5Dget_type(meta_id);
+  if( atype == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot get the dataset datatype. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(type);
+ 
+      return(status);
+    }
+  aspace  = H5Dget_space(meta_id);
+  if( aspace == FAIL )
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot get the dataset dataspace. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(type);
+ 
+      return(status);
+    }
+ 
+ 
+  /*
+   *-------------------------------------------------------------*
+   *   Allocate memory for the output array and Read attribute   *
+   *-------------------------------------------------------------*
+   */
+ 
+  metabuf  = (char *)calloc( HE5_HeosTable[fid%HE5_EHIDOFFSET].HE5_STATIC_BLKSIZE, sizeof(char));
+  if( metabuf == NULL )
+    {
+      sprintf(errbuf,"Cannot allocate memory for meta buffer. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+      free(errbuf);
+      free(type);
+ 
+      return(status);
+    }
+ 
+  utlstr   = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if( utlstr == NULL )
+    {
+      sprintf(errbuf,"Cannot allocate memory for utility string buffer. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+      free(errbuf);
+      free(type);
+      free(metabuf);
+ 
+      return(status);
+ 
+    }
+ 
+  utlstr2  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if( utlstr2 == NULL )
+    {
+      sprintf(errbuf,"Cannot allocate memory for the 2d utility string buffer. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+      free(errbuf);
+      free(type);
+      free(metabuf);
+      free(utlstr);
+ 
+      return(status);
+ 
+    }
+ 
+  status = H5Dread(meta_id, atype,H5S_ALL, H5S_ALL, H5P_DEFAULT,metabuf);
+  if( status == FAIL)
+    {
+      sprintf(errbuf, "Cannot read structural metadata. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(type);
+      free(metabuf);
+      free(utlstr);
+      free(utlstr2);
+ 
+      return(status);
+    }
+ 
+ 
+ 
+  /* Find HDF-EOS structure "root" group in metadata */
+  /* ----------------------------------------------- */
+  /* Setup proper search string */
+  if (strcmp(structcode, "s") == 0)
+    {
+      strcpy(utlstr, "GROUP=SwathStructure");
+    }
+  else if (strcmp(structcode, "g") == 0)
+    {
+      strcpy(utlstr, "GROUP=GridStructure");
+    }
+  else if (strcmp(structcode, "p") == 0)
+    {
+      strcpy(utlstr, "GROUP=PointStructure");
+    }
+  else if (strcmp(structcode, "z") == 0)
+    {
+      strcpy(utlstr, "GROUP=ZaStructure");
+    }
+
+ 
+  /* Use string search routine (strstr) to move through metadata */
+  /* ----------------------------------------------------------- */
+  metaptr = strstr(metabuf, utlstr);
+ 
+  /* Find specific (named) structure */
+  /* ------------------------------- */
+  if (metacode < 1000)
+    {
+      /* Save current metadata pointer */
+      /* ----------------------------- */
+      prevmetaptr = metaptr;
+ 
+      /* First loop for "old-style" (non-ODL) metadata string */
+      /* ---------------------------------------------------- */
+      if (strcmp(structcode, "s") == 0)
+	{
+	  sprintf(utlstr, "%s%s%s", "SwathName=\"", structname, "\"");
+	}
+      else if (strcmp(structcode, "g") == 0)
+	{
+	  sprintf(utlstr, "%s%s%s", "GridName=\"", structname, "\"");
+	}
+      else if (strcmp(structcode, "p") == 0)
+	{
+	  sprintf(utlstr, "%s%s%s", "PointName=\"", structname, "\"");
+	}
+      else if (strcmp(structcode, "z") == 0)
+	{
+	  sprintf(utlstr, "%s%s%s", "ZaName=\"", structname, "\"");
+	}
+
+
+      /* Perform string search */
+      /* --------------------- */
+ 
+      metaptr = strstr(metaptr, utlstr);
+ 
+      /*
+       *--------------------------------------------------------------------*
+       * If not found then return to previous position in metadata and look *
+       *             for "new-style" (ODL) metadata string                  *
+       *--------------------------------------------------------------------*
+       */
+      if (metaptr == NULL)
+	{
+	  sprintf(utlstr, "%s%s%s", "GROUP=\"", structname, "\"");
+	  metaptr = strstr(prevmetaptr, utlstr);
+	}
+    }
+ 
+ 
+  /* Metadata Section Switch */
+  /* ----------------------- */
+  switch ((int)abs((int)metacode))
+    {
+ 
+    case 0:
+ 
+      /* Dimension Section */
+      /* ================= */
+
+      /* Find beginning and end of metadata section */
+      /* ------------------------------------------ */
+      strcpy(utlstr, "\t\tGROUP=Dimension");
+      /* begptr = strstr(metaptr, utlstr);*/
+
+      strcpy(utlstr, "\t\tEND_GROUP=Dimension");
+      metaptr = strstr(metaptr, utlstr);
+ 
+      count = 1;
+ 
+ 
+      /* Build metadata entry string */
+      /* --------------------------- */
+      sprintf(utlstr, "%s%li%s%s%s%li%s%li%s", "\t\t\tOBJECT=Dimension_",count,"\n\t\t\t\tDimensionName=\"",&metastr[0],"\"\n\t\t\t\tSize=", (long)metadata[0],"\n\t\t\tEND_OBJECT=Dimension_", count, "\n");
+ 
+      break;
+ 
+ 
+    default:
+      {
+	sprintf(errbuf, "Unknown metacode.\n");
+	H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	HE5_EHprint(errbuf, __FILE__, __LINE__);
+      }
+      break;
+ 
+    }
+ 
+ 
+  /* Reallocate memory for a new metadata array, newbuf */
+  /* ------------------------------------------------------ */
+  newbuf = (char *) calloc(HE5_HeosTable[fid%HE5_EHIDOFFSET].HE5_STATIC_BLKSIZE, sizeof(char));
+  if(newbuf==NULL)
+    { 
+      sprintf(errbuf, "Cannot allocate memory for a new metadata string.\n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+      free(errbuf);
+      free(type);
+      free(metabuf);
+      free(utlstr);
+      free(utlstr2);
+ 
+      return(status);
+    }
+ 
+  /* Copy new metadata string to newbuf array */
+  /* ---------------------------------------- */
+  strncpy(newbuf, prevmetaptr, strlen(prevmetaptr));
+  newbuf[strlen(prevmetaptr)] = '\0';
+ 
+  meta_dim_name = strstr(newbuf, metastr);
+  utl_dim_name = strstr(utlstr, metastr);
+ 
+  ii = strlen(newbuf) - strlen(meta_dim_name);
+  jj = strlen(utlstr) - strlen(utl_dim_name);
+ 
+ 
+  for(i = 1; i < jj+1; i++)
+    {
+      i1 = ii+i;
+      j1 = jj+i;
+      newbuf[i1] = utlstr[j1];
+    }
+ 
+  tempdim = (hsize_t)strlen( newbuf );
+ 
+  tempdim++;
+ 
+  /*
+   *-----------------------------------------------------------------*
+   *     Write updated metadata back  to dataset "StructMetadata.0"  *
+   *-----------------------------------------------------------------*
+   */
+ 
+  status  = H5Dwrite(meta_id, atype, H5S_ALL, H5S_ALL, H5P_DEFAULT, newbuf);
+  if( status == FAIL)
+    {
+      sprintf(errbuf,"Cannot write in structural metadata.\n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(type);
+      free(metabuf);
+      free(utlstr);
+      free(utlstr2);
+      free(newbuf);
+ 
+      return(status);
+    }
+ 
+  free(metabuf);
+  free(newbuf);
+  free(utlstr);
+  free(utlstr2);
+  free(type);
+ 
+  metabuf = NULL;
+  newbuf  = NULL;
+  utlstr2 = NULL;
+  utlstr  = NULL;
+  type    = NULL;
+ 
+  status = H5Sclose(aspace);
+  if( status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release the data space ID.\n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+ 
+      return(status);
+    }
+ 
+  status = H5Tclose(atype);
+  if( status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the data type ID.\n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+ 
+      return(status);
+    }
+  status = H5Dclose(meta_id);
+  if( status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release the dataset ID.\n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+ 
+      return(status);
+    }
+  status = H5Gclose(gid);
+  if( status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release the group ID.\n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+ 
+      return(status);
+    }
+ 
+  free(errbuf);
+  errbuf = NULL;
+ 
+ COMPLETION:
+  return status;
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHupdatemeta_Dynamic                                         |
+|                                                                             |
+|  DESCRIPTION: Updates metadata                                              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|    status       herr_t  None        return status variable (0 for success,  |
+|                                          -1 for failure)                    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|    fid          hid_t   None        HDF-EOS file ID                         |
+|    structname   char*   None        Object name string                      |
+|    structcode   char*   None        "s" for a swath, "g" for a grid,        |
+|                                     "p" for a point, and "z" for a za.      |
+|    metacode     long    None        Code of a metadata block to insert to.  |
+|    metastr      char*   None        Buffer containing metadata information  |
+|                                      to insert.                             |
+|    metadata[]   hsize_t None        Array of data values                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|    None                                                                     |
+|                                                                             |
+|  NOTES:   Allocates buffer in chuncks of HE5_DYNAMIC_BLKSIZE (new scheme).  |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  05/17/04 Abe Taaheri   Modified the version with static buffer allocation  |
+|                         to adopt dynamic buffer allocation in chuncks of    |
+|                         HE5_DYNAMIC_BLKSIZE                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_EHupdatemeta_Dynamic(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[])
+{
+  herr_t         status   = FAIL;    /* routine return status variable            */
+ 
+  int            i;                  /* Loop index                                */
+ 
+  hid_t          gid      = FAIL;    /* "HDFEOS INFORMATION" group ID             */
+  hid_t          meta_id[MetaBlocks]  = {FAIL};    /* "StructuralMetadat.0" group ID            */
+  hid_t          atype[MetaBlocks]    = {FAIL};    /* Data type ID                              */
+  hid_t          aspace[MetaBlocks]   = {FAIL};    /* Data space ID                             */
+  hid_t          HDFfid   = FAIL;    /* HDF5 file ID                              */
+ 
+  hsize_t        tempdim  =  0;      /* Temporary variable                        */
+ 
+  long           count = 0;          /* Objects/Groups counter                    */
+ 
+  char           *metabuf = NULL;    /* Pointer to Structural Metadata array      */
+  char           *metaptr = NULL;    /* Metadata pointer                          */
+  char           *prevmetaptr = NULL;/* Previous position of metadata pointer     */
+  char           *utlstr  = NULL;    /* Utility string                            */
+  char           *utlstr2 = NULL;    /* Utility string 2                          */
+  char           *newbuf  = NULL;    /* updated metadata string                   */
+  char           *type    = NULL;    /* data type string                          */
+  char           *errbuf  = NULL;    /* Error message buffer                      */
+ 
+  char           *meta_dim_name = NULL;
+  char           *utl_dim_name  = NULL;
+  int            ii, jj, i1, j1;
+  long           nmeta;
+  /*long           *metstrbufsize = 0;*/
+  char           metutlstr[32];
+  int            ism;
+  long           metalen;
+
+ 
+  CHECKPOINTER(structname);
+  CHECKPOINTER(structcode);
+  CHECKPOINTER(metastr);
+ 
+ 
+ 
+  /* Get HDF file ID */
+  /* --------------- */
+  HDFfid = HE5_HeosTable[fid%HE5_EHIDOFFSET].HDFfid;
+ 
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Allocate memory for data type string */
+  /* ------------------------------------ */
+  type = (char * )calloc( HE5_HDFE_TYPESTRSIZE, sizeof(char));
+  if(type == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for data type string. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+ 
+      return(FAIL);
+    }
+ 
+  /* Open "HDFEOS INFORMATION" group */
+  /* =============================== */
+  gid     = H5Gopen(HDFfid, "HDFEOS INFORMATION");
+  if(gid == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot open \"HDFEOS INFORMATION\" group. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(type);
+ 
+      return(status);
+    }
+
+  
+  /* Determine number of structural metadata "sections" */
+  /* -------------------------------------------------- */
+  nmeta = 0;
+  status= HE5_EHgetnmeta(gid, &nmeta);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot find any StructMetadata.X dataset. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      
+      return(FAIL);
+    }
+  
+  for (ism = 0; ism < nmeta; ism++)
+    {
+      
+      /*
+       *--------------------------------------------------------------*
+       * Open dataset "StructMetadata.X", get datatype and space ID   *
+       *--------------------------------------------------------------*
+       */
+      sprintf(metutlstr, "%s%d", "StructMetadata.", ism);
+      meta_id[ism] = H5Dopen(gid, metutlstr); 
+      if( meta_id[ism] == FAIL)
+        {
+	  status = FAIL;
+	  sprintf(errbuf,"Cannot open %s dataset. \n", metutlstr);
+	  H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(type);
+	  
+	  return(status);
+        }
+      atype[ism]   = H5Dget_type(meta_id[ism]);
+      if( atype[ism] == FAIL)
+        {
+	  status = FAIL;
+	  sprintf(errbuf,"Cannot get the dataset datatype. \n");
+	  H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(type);
+	  
+	  return(status);
+        }
+      aspace[ism]  = H5Dget_space(meta_id[ism]);
+      if( aspace[ism] == FAIL )
+        {
+	  status = FAIL;
+	  sprintf(errbuf,"Cannot get the dataset dataspace. \n");
+	  H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(type);
+	  
+	  return(status);
+        }
+    }
+ 
+  /*
+   *-------------------------------------------------------------*
+   *   Allocate memory for the output array and Read attribute   *
+   *-------------------------------------------------------------*
+   */
+ 
+  metabuf  = (char *)calloc( HE5_DYNAMIC_BLKSIZE * nmeta, sizeof(char));
+  if( metabuf == NULL )
+    {
+      sprintf(errbuf,"Cannot allocate memory for meta buffer. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+      free(errbuf);
+      free(type);
+ 
+      return(status);
+    }
+ 
+  utlstr   = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if( utlstr == NULL )
+    {
+      sprintf(errbuf,"Cannot allocate memory for utility string buffer. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+      free(errbuf);
+      free(type);
+      free(metabuf);
+ 
+      return(status);
+ 
+    }
+ 
+  utlstr2  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if( utlstr2 == NULL )
+    {
+      sprintf(errbuf,"Cannot allocate memory for the 2d utility string buffer. \n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+      free(errbuf);
+      free(type);
+      free(metabuf);
+      free(utlstr);
+ 
+      return(status);
+ 
+    }
+
+  metalen = 0;
+  for (ism = 0; ism < nmeta; ism++)
+    {
+      status = H5Dread(meta_id[ism], atype[ism],H5S_ALL, H5S_ALL, H5P_DEFAULT,metabuf + metalen);
+      if( status == FAIL)
+	{
+          sprintf(errbuf, "Cannot read structural metadata. \n");
+          H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(errbuf);
+          free(type);
+          free(metabuf);
+          free(utlstr);
+          free(utlstr2);
+ 
+          return(status);
+	}
+    
+      /* Determine length (# of characters) of metadata */
+      /* ---------------------------------------------- */
+      metalen = strlen(metabuf);
+ 
+    }
+ 
+ 
+  /* Find HDF-EOS structure "root" group in metadata */
+  /* ----------------------------------------------- */
+  /* Setup proper search string */
+  if (strcmp(structcode, "s") == 0)
+    {
+      strcpy(utlstr, "GROUP=SwathStructure");
+    }
+  else if (strcmp(structcode, "g") == 0)
+    {
+      strcpy(utlstr, "GROUP=GridStructure");
+    }
+  else if (strcmp(structcode, "p") == 0)
+    {
+      strcpy(utlstr, "GROUP=PointStructure");
+    }
+  else if (strcmp(structcode, "z") == 0)
+    {
+      strcpy(utlstr, "GROUP=ZaStructure");
+    }
+
+ 
+  /* Use string search routine (strstr) to move through metadata */
+  /* ----------------------------------------------------------- */
+  metaptr = strstr(metabuf, utlstr);
+ 
+  /* Find specific (named) structure */
+  /* ------------------------------- */
+  if (metacode < 1000)
+    {
+      /* Save current metadata pointer */
+      /* ----------------------------- */
+      prevmetaptr = metaptr;
+ 
+      /* First loop for "old-style" (non-ODL) metadata string */
+      /* ---------------------------------------------------- */
+      if (strcmp(structcode, "s") == 0)
+	{
+	  sprintf(utlstr, "%s%s%s", "SwathName=\"", structname, "\"");
+	}
+      else if (strcmp(structcode, "g") == 0)
+	{
+	  sprintf(utlstr, "%s%s%s", "GridName=\"", structname, "\"");
+	}
+      else if (strcmp(structcode, "p") == 0)
+	{
+	  sprintf(utlstr, "%s%s%s", "PointName=\"", structname, "\"");
+	}
+      else if (strcmp(structcode, "z") == 0)
+	{
+	  sprintf(utlstr, "%s%s%s", "ZaName=\"", structname, "\"");
+	}
+
+
+      /* Perform string search */
+      /* --------------------- */
+ 
+      metaptr = strstr(metaptr, utlstr);
+ 
+      /*
+       *--------------------------------------------------------------------*
+       * If not found then return to previous position in metadata and look *
+       *             for "new-style" (ODL) metadata string                  *
+       *--------------------------------------------------------------------*
+       */
+      if (metaptr == NULL)
+	{
+	  sprintf(utlstr, "%s%s%s", "GROUP=\"", structname, "\"");
+	  metaptr = strstr(prevmetaptr, utlstr);
+	}
+    }
+ 
+ 
+  /* Metadata Section Switch */
+  /* ----------------------- */
+  switch ((int)abs((int)metacode))
+    {
+ 
+    case 0:
+ 
+      /* Dimension Section */
+      /* ================= */
+
+      /* Find beginning and end of metadata section */
+      /* ------------------------------------------ */
+      strcpy(utlstr, "\t\tGROUP=Dimension");
+      /* begptr = strstr(metaptr, utlstr);*/
+
+      strcpy(utlstr, "\t\tEND_GROUP=Dimension");
+      metaptr = strstr(metaptr, utlstr);
+ 
+      count = 1;
+ 
+ 
+      /* Build metadata entry string */
+      /* --------------------------- */
+      sprintf(utlstr, "%s%li%s%s%s%li%s%li%s", "\t\t\tOBJECT=Dimension_",count,"\n\t\t\t\tDimensionName=\"",&metastr[0],"\"\n\t\t\t\tSize=", (long)metadata[0],"\n\t\t\tEND_OBJECT=Dimension_", count, "\n");
+ 
+      break;
+ 
+ 
+    default:
+      {
+	sprintf(errbuf, "Unknown metacode.\n");
+	H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	HE5_EHprint(errbuf, __FILE__, __LINE__);
+      }
+      break;
+ 
+    }
+ 
+  /* The size of the whole structure metadat will not change 
+     during the the update (????),
+     so no need for extending newbuf by one more block size */
+
+  /* Reallocate memory for a new metadata array, newbuf */
+  /* ------------------------------------------------------ */
+  newbuf = (char *) calloc(HE5_DYNAMIC_BLKSIZE * (nmeta), sizeof(char));
+  if(newbuf==NULL)
+    { 
+      sprintf(errbuf, "Cannot allocate memory for a new metadata string.\n");
+      H5Epush(__FILE__,"HE5_EHupdatemeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+      free(errbuf);
+      free(type);
+      free(metabuf);
+      free(utlstr);
+      free(utlstr2);
+ 
+      return(status);
+    }
+ 
+  /* Copy new metadata string to newbuf array */
+  /* ---------------------------------------- */
+  strncpy(newbuf, prevmetaptr, strlen(prevmetaptr));
+  newbuf[strlen(prevmetaptr)] = '\0';
+ 
+  meta_dim_name = strstr(newbuf, metastr);
+  utl_dim_name = strstr(utlstr, metastr);
+ 
+  ii = strlen(newbuf) - strlen(meta_dim_name);
+  jj = strlen(utlstr) - strlen(utl_dim_name);
+ 
+ 
+  for(i = 1; i < jj+1; i++)
+    {
+      i1 = ii+i;
+      j1 = jj+i;
+      newbuf[i1] = utlstr[j1];
+    }
+ 
+  tempdim = (hsize_t)strlen( newbuf );
+ 
+  tempdim++;
+ 
+  /*
+   *-----------------------------------------------------------------*
+   *     Write updated metadata back  to dataset "StructMetadata.X"  *
+   *-----------------------------------------------------------------*
+   */
+
+  for (ism = 0; ism < nmeta; ism++)
+    {
+      status  = H5Dwrite(meta_id[ism], atype[ism], H5S_ALL, H5S_ALL, H5P_DEFAULT, newbuf + ism * HE5_DYNAMIC_BLKSIZE);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write in structural metadata.\n");
+	  H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(type);
+	  free(metabuf);
+	  free(utlstr);
+	  free(utlstr2);
+	  free(newbuf);
+	   
+	  return(status);
+	}
+    }
+  free(metabuf);
+  free(newbuf);
+  free(utlstr);
+  free(utlstr2);
+  free(type);
+   
+  metabuf = NULL;
+  newbuf  = NULL;
+  utlstr2 = NULL;
+  utlstr  = NULL;
+  type    = NULL;
+   
+  for (ism = 0; ism < nmeta; ism++)
+    {
+      status = H5Sclose(aspace[ism]);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	   
+	  return(status);
+	}
+       
+      status = H5Tclose(atype[ism]);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the data type ID.\n");
+	  H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	   
+	  return(status);
+	}
+      status = H5Dclose(meta_id[ism]);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the dataset ID.\n");
+	  H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	   
+	  return(status);
+	}
+    }
+  status = H5Gclose(gid);
+  if( status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release the group ID.\n");
+      H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+       
+      return(status);
+    }
+   
+  free(errbuf);
+  errbuf = NULL;
+   
+ COMPLETION:
+  return status;
+}
+
+
+
+
+/* 
+******************************************************************************
+|                                                                            |
+|          F  O  R  T  R  A  N  7 7      W  R  A  P  P  E  R  S              |
+|                                                                            |
+******************************************************************************
+*/
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHidinfoF  (FORTRAN wrapper)                                 |
+|                                                                             |
+|  DESCRIPTION: Gets HDF ID and group ID from HDF-EOS ID                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int                 HDF-EOS file ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fileID         int                 HDF File ID                             |
+|  gid            int                 group ID                                |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 01   A. Muslimov   Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_EHidinfoF(int FileID, int *fileID, int *gid)
+{
+  int          ret    = FAIL;/* routine return status variable */
+
+  hid_t        fid    = FAIL;/* Input hdf5 type file ID        */ 
+  hid_t        HDFfid = FAIL;/* Output hdf5 file ID            */ 
+  hid_t        Gid    = FAIL;/* HDF-EOS group ID               */
+
+  herr_t       status = FAIL; /* Return status                 */
+
+  char         *errbuf;		  /* Error message buffer          */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char *) calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHidinfoF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  fid = (hid_t)FileID;
+
+  /* Call HE5_EHidinfo to get HDF-EOS interface IDs */
+  /* ---------------------------------------------- */
+  status = HE5_EHidinfo(fid,&HDFfid,&Gid);
+  if(status == FAIL)
+    {
+      sprintf(errbuf, "Error calling \"HE5_EHidinfo\" from FORTAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_EHidinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  *fileID = (int)HDFfid;
+  *gid    = (int)Gid;
+
+  free(errbuf);
+
+  ret=(int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHconvAngF   (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Angle conversion Utility                                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  outAngle       double              Output Angle value                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  inAngle        double              Input Angle value                       |
+|  code           int                 Conversion code                         |
+|                                       HDFE_RAD_DEG (0)                      |
+|                                       HDFE_DEG_RAD (1)                      |
+|                                       HDFE_DMS_DEG (2)                      |
+|                                       HDFE_DEG_DMS (3)                      |
+|                                       HDFE_RAD_DMS (4)                      |
+|                                       HDFE_DMS_RAD (5)                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|     None                                                                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 01   A.Muslimov    Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+double 
+HE5_EHconvAngF(double inAngle, int code)
+{
+  double    outAngle = 0.;          /* Angle in desired units   */
+  
+  char      *errbuf  = (char *)NULL;/* error message buffer     */
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE,  sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHconvAngF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+    }
+
+  /* Call HE5_EHconvAngF */
+  /* ------------------- */
+  outAngle = HE5_EHconvAng(inAngle,code);
+
+  if(errbuf != NULL) free(errbuf);
+  return(outAngle);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHwrglatt                                                    |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper to (Over)Write global attribute in a file.    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int                 file ID                                 |
+|  attrname       char*               Global attribute name                   |
+|  numtype        int                 HDFEOS datatype Flag                    |
+|  fortcount[]    long                Number of global attribute elements     |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                   It is assumed that fortcout has just one element to agree |
+|                   with EHattr() call.                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 01   A.Muslimov    Original Programmer                                 |
+|  Nov 02   S.Zhao        Updated for writing character string attributes.    |
+|  Mar 04   S.Zhao        Modified for a character string attribute.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_EHwrglatt(int FileID, char *attrname, int numtype, long fortcount[], void *datbuf)
+{
+  int          ret    = FAIL;            /* (int) Return status variable      */
+  int		   rank   = 1;               /* Rank variable                     */
+  int		   i;                        /* Loop index                        */
+
+  herr_t	   status     = FAIL;        /* routine return status variable    */
+  
+  hid_t        fileID     = FAIL;        /* HDF5 type File ID                 */
+  hid_t        numbertype = FAIL;        /* HDF5 data type ID                 */
+             
+  hsize_t      *count  = (hsize_t *)NULL;/* Pointer to count array (C order)  */
+  
+  char         *errbuf = (char *)NULL;   /* error message buffer              */
+  char         *tempbuf = (char *)NULL;  /* temp buffer                       */
+  
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHwrglatt", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get HDF5 data type ID */
+  /* --------------------- */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID.\n");
+      H5Epush(__FILE__, "HE5_EHwrglatt", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+
+  count = (hsize_t *)calloc(rank, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_EHwrglatt", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < rank; i++)
+    count[i] = (hsize_t)fortcount[rank - 1 - i];
+  
+  
+  fileID = (hid_t)FileID;
+
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of global attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_EHwrglatt", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n");
+	  H5Epush(__FILE__, "HE5_EHwrglatt", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+ 
+      status = HE5_EHwriteglbattr(fileID, attrname, numbertype, count, tempbuf);
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write data to the global attribute.\n");
+          H5Epush(__FILE__, "HE5_EHwrglatt", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(errbuf);
+          free(count);
+          free(tempbuf);
+          return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    {
+      status = HE5_EHwriteglbattr(fileID, attrname, numbertype, count, datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write data to the global attribute.\n");
+	  H5Epush(__FILE__, "HE5_EHwrglatt", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(count);
+	  return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+    }
+  
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHrdglatt     (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from the "FILE_ATTRIBUTES" group in a file.   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int                 file ID                                 |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 01   A.Muslimov    Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_EHrdglatt(int FileID, char *attrname, void *datbuf)
+{
+  int         ret             = FAIL;     /* (int) return status    */
+
+  herr_t      status          = FAIL;     /* return status variable */
+  
+  hid_t       fileID          = FAIL;     /* HDF5 type File ID      */
+  
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+  
+  fileID = (hid_t)FileID;
+
+  status = HE5_EHreadglbattr(fileID,attrname,datbuf);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot read Attribute \"%s\" from the \"FILE_ATTRIBUTES\" group.\n", attrname);
+      H5Epush(__FILE__, "HE5_EHrdglatt", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHglattinfo                                                   |
+|                                                                             |
+|  DESCRIPTION:  FORTRAN wrapper for HE5_EHglbattrinfo()                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int                 File ID                                 |
+|  attrname       char*               Attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  numbertype     int                 Attribute HDFEOS data type Flag         |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 01   A.Muslimov    Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+|                                                                             |
+-----------------------------------------------------------------------------*/
+int
+HE5_EHglattinf(int FileID, char *attrname, int *numbertype, long *fortcount)
+{
+  int	   	  ret     = FAIL;	        /* (int) Return status variable   */
+
+  herr_t   	  status  = FAIL;           /* routine return status variable */
+
+  hid_t       *ntype  = (hid_t *)NULL;  /* Data type ID                   */
+
+  hid_t       fileID  = FAIL;           /* HDF5 type File ID              */
+
+  hsize_t     *count  = (hsize_t *)NULL;/* Pointer to count  (C order)    */
+  
+  char        *errbuf = (char *)NULL;   /* error message buffer           */
+  
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHglattinf", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_EHglattinf", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+  if( ntype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for ntype.\n");
+      H5Epush(__FILE__, "HE5_EHglattinf", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      return(FAIL);
+    }
+
+
+  fileID = (hid_t)FileID;
+
+  status = HE5_EHglbattrinfo(fileID, attrname, ntype, count);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about global attribute from \"FILE_ATTRIBUTES\" group.\n");
+      H5Epush(__FILE__, "HE5_EHglattinf", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      free(ntype);
+      return(FAIL);
+    }
+  
+  *fortcount  = (long)(*count);
+  *numbertype = (int)(*ntype);
+
+  free(errbuf);
+  free(count);
+  free(ntype);
+  
+  ret = (int)status;
+  return(ret);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHinqglatts (FORTRAN wrapper)                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list from "FILE_ATTRIBUTES" group                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                No. of attributes in "FILE_ATTRIBUTES"  |
+|                                       group.                                |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int                 file ID                                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in "FILE_ATTRIBUTES"    |
+|                                      group (Comma-separated list)           |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 01   A.Muslimov    Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_EHinqglatts(int FileID, char *attrnames, long *strbufsize)
+{
+  long            nattr   = FAIL;             /* Number of attributes (return) */
+
+  hid_t           fileID  = FAIL;             /* HDF5 type file ID             */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer          */
+
+  fileID = (hid_t)FileID;
+  
+  nattr = HE5_EHinqglbattrs(fileID, attrnames, strbufsize);
+  if ( nattr < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+      H5Epush(__FILE__, "HE5_EHinqglatts", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  return(nattr);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHinqglbtype                                                 |
+|                                                                             |
+|  DESCRIPTION:  FORTRAN wrapper for HE5_EHinqglbdatatype()                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int                 File ID                                 |
+|  attrname       char*               Attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  Type         int                                                           |
+|  Class        int                                                           |
+|  Order        int                                                           |
+|  size         long                                                          |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Mar 03    S.Zhao       Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+|                                                                             |
+-----------------------------------------------------------------------------*/
+int
+HE5_EHinqglbtype(int FileID, char *attrname, int *Type, int *Class, int *Order, long *size)
+{
+  int              ret      = FAIL;               /* (int) status variable  */
+ 
+  herr_t           status   = FAIL;               /* return status variable */
+ 
+  size_t           *tsize   = (size_t *)NULL;     /* data size variable     */
+ 
+  hid_t        *typeID  = (hid_t *)NULL;      /* HDF5 Data type ID      */
+  hid_t        fileID  = FAIL;                /* HDF5 type File ID      */
+ 
+  H5T_class_t  *classID = (H5T_class_t *)NULL;/*  Data type class ID    */
+  H5T_order_t  *order   = (H5T_order_t *)NULL;/* Byte order of datatype */
+ 
+  char         *errbuf  = (char *)NULL;       /* error message buffer   */
+ 
+ 
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHinqglbtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  typeID = (hid_t *)calloc(1, sizeof(hid_t));
+  if(typeID == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for typeID.\n");
+      H5Epush(__FILE__,"HE5_EHinqglbtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+ 
+  tsize = (size_t *)calloc(1, sizeof(size_t));
+  if(tsize == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tsize.\n");
+      H5Epush(__FILE__, "HE5_EHinqglbtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      return(FAIL);
+    }
+ 
+  classID = (H5T_class_t *)calloc(1, sizeof(H5T_class_t));
+  if(classID == (H5T_class_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for classID.\n");
+      H5Epush(__FILE__, "HE5_EHinqglbtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      free(tsize);
+      return(FAIL);
+    }
+ 
+  order = (H5T_order_t *)calloc(1, sizeof(H5T_order_t));
+  if(order == (H5T_order_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for order.\n");
+      H5Epush(__FILE__, "HE5_EHinqglbtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      free(tsize);
+      free(classID);
+      return(FAIL);
+    }
+ 
+  fileID = (hid_t)FileID;
+ 
+  /* Get data type information */
+  /* ------------------------- */
+  status = HE5_EHinqglbdatatype(fileID, attrname, typeID, classID, order, tsize);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about data type.\n");
+      H5Epush(__FILE__, "HE5_EHinqglbtype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      free(tsize);
+      free(classID);
+      free(order);
+      return(FAIL);
+    }
+ 
+  *Type   = (int)(*typeID);
+  *Class  = (int)(*classID);
+  *Order  = (int)(*order);
+  *size   = (long)(*tsize);
+ 
+  free(errbuf);
+  free(typeID);
+  free(classID);
+  free(order);
+  free(tsize);
+ 
+  ret = (int)status;
+  return(ret);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHrdwrfileF       (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION: Opens and reads or writes an external binary file which is in |
+|               non-Fortran format.  This is needed for HDF-EOS5 routines     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  extfilename    char                External file name                      |
+|  Flags          uintn               Access Code                             |
+|  ntype          int                 HDF numbertype of field datatype        |
+|  nelmnts        long                Number of datatype elements in data     |
+|                                     buffer.                                 |
+|  data           char*               Data buffer                             |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 01   C.Praderas    Original development.                               |
+|  Dec 05   T.Roegner     NCR 44092 - Added CYGWIN capability                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_EHrdwrfileF(char *extfilename, uintn Flags, int ntype, long nelmnts, void *data)
+{
+  herr_t            status    = SUCCEED;/* routine return status variable */
+
+  int               ret       = SUCCEED;/* (int) return status variable   */
+
+  long              datatype_size = 0;   /* Size of datatype */   
+  long              numread       = 0;
+  long              numwrite      = 0;
+
+  char              *access_code = (char *)NULL;
+  char              *errbuf = (char *)NULL;/*Error message buffer   */
+  
+  FILE              *fptr;
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHrdwrfileF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate memory for access code */
+  /* ------------------------------- */
+  access_code = (char * )calloc( 3, sizeof(char));
+  if(access_code == NULL)
+    {
+      H5Epush(__FILE__, "HE5_EHrdwrfileF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for access_code buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for access_code buffer, occured", __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Determine access_code */
+  /* --------------------- */
+  switch (Flags)
+    {
+    case 0:
+      { 
+	strcpy(access_code, "r+");
+	access_code[2] = 0;
+      }
+      break;
+    case 1:
+      {
+	strcpy(access_code, "r");
+	access_code[1] = 0;
+      }
+      break;
+    case 2:
+      {
+	strcpy(access_code, "w");
+	access_code[1] = 0;
+      }
+      break;		  
+    default:
+      break;  
+    } 	
+
+  /* Open external file */
+  /* ------------------ */
+  fptr = fopen( extfilename, access_code );
+  if(fptr == NULL)
+    {
+      sprintf(errbuf, "Cannot open external file:\"%s\".\n",extfilename) ;
+      H5Epush(__FILE__, "HE5_EHrdwrfileF", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(access_code);
+      return(FAIL);		 
+    }
+
+  /* Determine datatype size */
+  /* ----------------------- */
+  switch( ntype )
+    {
+    case 0:
+      {	datatype_size = sizeof(int); }
+      break;  
+    case 1:
+      {	datatype_size = sizeof(float); }
+      break;  
+    case 2:
+      {	datatype_size = sizeof(double); }
+      break;  
+    case 3:
+      {	datatype_size = 1; }
+      break;  
+    case 4:
+      {	datatype_size = 2; }
+      break;  
+    case 5:
+      {	datatype_size = sizeof(char); }
+      break;  
+    case 6:
+      {	datatype_size = sizeof(long); }
+      break;  
+    default:
+      break;  
+    }
+
+  /* Read or write data to external file */
+  /* ----------------------------------- */
+  if( Flags == 0 || Flags == 2 )
+    {
+      numwrite= fwrite( data, datatype_size, nelmnts, fptr );
+      if(numwrite <= 0)
+	{
+	  sprintf(errbuf, "Cannot write to file:\"%s\".\n",extfilename) ;
+	  H5Epush(__FILE__, "HE5_EHrdwrfileF", __LINE__, H5E_FILE, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(access_code);
+	  return(FAIL);		 
+	}
+    }
+
+  if( Flags == 1 )
+    {
+      numread = fread( data, datatype_size, nelmnts, fptr );
+      if(numread <= 0)
+	{
+	  sprintf(errbuf, "Cannot read from file:\"%s\".\n",extfilename) ;
+	  H5Epush(__FILE__, "HE5_EHrdwrfileF", __LINE__, H5E_FILE, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(access_code);
+	  return(FAIL);		 
+	}
+    }
+
+  /* Close external file */
+  /* ------------------- */
+  fclose(fptr);
+
+  free(errbuf);
+  free(access_code);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+
+herr_t HE5_EHgetnmeta(hid_t gid, long *nmeta)
+{
+  char           metutlstr[32];
+  hid_t          status = -1;
+  *nmeta = 0;
+  while (1)
+    {
+      /* Search for "StructMetadata.x" attribute */
+      /* --------------------------------------- */
+      sprintf(metutlstr, "%s%ld", "StructMetadata.", *nmeta);
+      H5Eset_auto(NULL,NULL);
+      status =  H5Dopen(gid, metutlstr); 
+
+
+      /* If found then increment metadata section counter else exit loop */
+      /* --------------------------------------------------------------- */
+      if (status != -1)
+	{
+	  *nmeta = *nmeta + 1;
+	  H5Dclose(status);
+	  status = 0;
+	} else
+	{
+	  status = 0;
+	  break;
+	}
+    }
+
+  if(*nmeta < 1)
+    { 
+      return(FAIL);
+    }
+
+  return(status);
+}
+
+hsize_t HE5_EHset_error_on(int flag, int err_level)
+{
+  H5Eclear();
+  if (flag == 0 || flag == 1 || flag == 2)
+    {
+      error_flg = flag;
+    }
+  else
+    {
+      error_flg = 0;
+    }
+  return(error_flg);
+}
+
+long HE5_EHset_error_onF(int flag, int err_level)
+{
+  hsize_t status;
+  status = HE5_EHset_error_on(flag, err_level);
+
+  return((long)status);
+}
+
+
+herr_t HE5_EHprint(char *errbuf, const char *file, unsigned line)
+{
+  if (error_flg == 0)
+    {
+      H5Eprint(stderr);
+    }
+  else if(error_flg == 1)
+    {
+      fprintf(stderr, "%s in %s on line %d \n", errbuf, file, line);
+    }
+  H5Eclear();
+  return(SUCCEED);
+}
+
+#ifdef H5_HAVE_FILTER_SZIP
+
+/*-----------------------------------------------------------------------------
+| Function:    HE5_szip_can_encode                                            |
+|                                                                             |
+|  Purpose:     Retrieve the filter config flags for szip, tell if            |
+|               encoder is available.                                         |
+|                                                                             |
+|  Return:      1:  decode+encode is enabled                                  |
+|               0:  only decode is enabled                                    |
+|              -1: other                                                      |
+|                                                                             |
+|  Programmer:                                                                |
+|                                                                             |
+|  Modifications:                                                             |
+|                                                                             |
+-----------------------------------------------------------------------------*/
+int HE5_szip_can_encode(void )
+{
+
+  herr_t       status;
+  unsigned int filter_config_flags;
+  
+  status =H5Zget_filter_info(H5Z_FILTER_SZIP, &filter_config_flags);
+  if ((filter_config_flags &
+       (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) {
+    /* filter present but neither encode nor decode is supported (???) */
+    return -1;
+  } else if ((filter_config_flags &
+	      (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+	     H5Z_FILTER_CONFIG_DECODE_ENABLED) {
+    /* decoder only: read but not write */
+    return 0;
+  } else if ((filter_config_flags &
+	      (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+	     H5Z_FILTER_CONFIG_ENCODE_ENABLED) {
+    /* encoder only: write but not read (???) */
+    return -1;
+  } else if ((filter_config_flags &
+	      (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+	     (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
+    return 1;
+  }
+  return(-1);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_EHHEisHE5                                                    |
+|                                                                             |
+|  DESCRIPTION: Find out if hdf file is HDF-EOS5 file (HDF5 based hdf-eos)    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units   Description                               |
+|  ============   ======  =======  =====================================      |
+|  retstatus      int              return TRUE  (or 1) if file is HE5         |
+|                                       (can be opened by EHopen and has      |
+|                                        SWATH, GRID, ZA, or POINT objects )  |
+|                                  return FALSE (or 0) otherwise              |
+|                                  return -1 if file does not exist           |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  filename        char            Input file name                            |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES: Although any HDF4 file with ECS and structure metadata is HDFEOS    |
+|         file, but in practice we will consider a file as HDFEOS5 file if it |
+|         is HDF5 based and contains one or more of the objects GRID, SWATH,  |
+|         ZA, and POINT.                                                      |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Dec 13   Abe Taaheri   Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_EHHEisHE5(char *filename)
+{
+  int       status = 0;	        /* return status variable for open calls */
+  int       retstatus = 0;	/* routine return status variable        */
+  hid_t     fid;
+  herr_t    cstatus;	        /* return status variable for close calls */
+  FILE      *fp;
+  int       nGrid  = FAIL;     /* Number of grid structures in file */
+  int       nSwath = FAIL;     /* Number of swaths in file */
+  int       nPoint = FAIL;     /* Number of point structures in file */
+  int       nZA    = FAIL;     /* Number of zas in file */
+
+  if ((fp = fopen(filename,"r")) == NULL)
+    {
+      /* file does not exist */
+      return(-1);
+    }
+  else
+    {
+      fclose( fp );
+    }
+
+  /* Open file using EHopen                   */
+  /* If fails, then file is not HE5 file      */
+  /* ---------------------------------------- */
+  
+  HE5_EHset_error_on(2, 0);/* suppress both HDFEOS5 and  HDF5 error repoets */
+
+  /* open HDF-EOS5 file for reading */
+  fid = HE5_EHopen( filename, H5F_ACC_RDONLY, H5P_DEFAULT );
+  if ( fid == FAIL )
+    {
+      return(0); /* File is not HDF5 or HDFEOS5 file */
+    }
+  else
+    {
+      cstatus = HE5_EHclose(fid);
+    }
+  
+  /* File is  HDF5 or HDFEOS5 file. See if it is HDFEOS5 */
+
+  /* Call "HE5_EHinquire" routine for grid */
+  /* ------------------------------------- */
+  nGrid = (int)HE5_EHinquire(filename, "/HDFEOS/GRIDS", NULL, NULL);
+  if(nGrid == FAIL )
+    {
+      /* Call "HE5_EHinquire" routine for swath */
+      /* -------------------------------------- */
+      nSwath = (int)HE5_EHinquire(filename, "/HDFEOS/SWATHS", NULL, NULL);
+      if(nSwath == FAIL )
+	{
+	  /* Call HE5_EHinquire for point */
+	  /* ---------------------------- */
+	  nPoint = (int)HE5_EHinquire(filename, "/HDFEOS/POINTS", NULL, NULL);
+	  if(nPoint == FAIL )
+	    {
+	      /* Call "HE5_EHinquire" routine for za */
+	      /* ----------------------------------- */
+	      nZA = HE5_EHinquire(filename, "/HDFEOS/ZAS",  NULL, NULL);
+	      if ( nZA == FAIL )
+		{
+		  retstatus = 0;
+		}
+	      else
+		{
+		  retstatus = 1;
+		}
+	    }
+	}
+      else
+	{
+	  retstatus = 1;
+	}
+    }
+  else
+    {
+      retstatus = 1;
+    }
+
+  HE5_EHset_error_on(0, 0);/* reset error report to default  HDF5 errors only*/
+
+  if( retstatus == 0 )
+    {
+      /* Failed to open file using GDopen, SWopen, ZAopen, and PTopen */
+      /* File is not HE5 file */
+      return(0);
+    }
+  else
+    {
+      /* File is HE5 file */
+      return(1);
+    }
+}
+
+#endif /* H5_HAVE_FILTER_SZIP */
+
+
+#ifndef __cplusplus
+
+/* HDF types used in FORTRAN bindings */
+ 
+#if defined(DEC_ALPHA) || defined(IRIX) || defined(UNICOS) || defined(LINUX64) || defined(IA64) || defined(MACINTOSH) || defined(MACINTEL) || defined(IBM6000) || defined(CYGWIN)
+ 
+#define INT32  INT
+#define INT32V INTV
+#define PINT32 PINT
+ 
+#else
+ 
+#define INT32  LONG
+#define INT32V LONGV
+#define PINT32 PLONG
+ 
+#endif
+
+/* FORTRAN Macros */
+
+FCALLSCFUN3(INT, HE5_EHidinfoF, HE5_EHIDINFO, he5_ehidinfo, INT, PINT,  PINT)
+FCALLSCFUN2(DOUBLE, HE5_EHconvAngF, HE5_EHCONVANG, he5_ehconvang, DOUBLE, INT)
+FCALLSCFUN5(INT, HE5_EHwrglatt, HE5_EHWRGLATT, he5_ehwrglatt, INT, STRING, INT, LONGV,PVOID)
+FCALLSCFUN3(INT, HE5_EHrdglatt, HE5_EHRDGLATT, he5_ehrdglatt,INT,STRING,PVOID)
+FCALLSCFUN4(INT, HE5_EHglattinf, HE5_EHGLATTINF, he5_ehglattinf, INT, STRING, PINT, PLONG)
+FCALLSCFUN3(LONG, HE5_EHinqglatts, HE5_EHINQGLATTS, he5_ehinqglatts,INT,PSTRING,PLONG)
+FCALLSCFUN5(INT, HE5_EHrdwrfileF, HE5_EHRDWRFILE, he5_ehrdwrfile, STRING, INT, INT, LONG, PVOID)
+FCALLSCFUN6(INT, HE5_EHinqglbtype, HE5_EHINQGLBTYPE, he5_ehinqglbtype, INT, STRING, PINT, PINT, PINT, PLONG)
+FCALLSCFUN2(LONG, HE5_EHset_error_onF, HE5_EHSET_ERROR_ONF, he5_ehset_error_onf, INT, INT)
+FCALLSCFUN2(INT, HE5_EHgetversion, HE5_EHGETVERSION, he5_ehgetver, INT, PSTRING)
+FCALLSCFUN1(INT, HE5_EHHEisHE5, HE5_EHHEISHE5, he5_ehheishe5, STRING)
+
+#ifdef H5_HAVE_FILTER_SZIP
+FCALLSCFUN0(INT, HE5_szip_can_encode, HE5_SZIP_CAN_ENCODE, he5_szip_can_encode)
+#endif
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/GDapi.c b/src/GDapi.c
new file mode 100755
index 0000000..da144a5
--- /dev/null
+++ b/src/GDapi.c
@@ -0,0 +1,28031 @@
+/*
+  ----------------------------------------------------------------------------
+  |    Copyright (c) 1999  Emergent IT Inc.  and Raytheon Systems Company    |
+  |                                                                          |
+  |  Permission to use, modify, and distribute this software and its         |
+  |  documentation for any purpose without fee is hereby granted, provided   |
+  |  that the above copyright notice appear in all copies and that both that |
+  |  copyright notice and this permission notice appear in supporting        |
+  |                          documentation.                                  |
+  ----------------------------------------------------------------------------
+*/
+
+
+#include <HE5_HdfEosDef.h>
+#include <ease.h>
+#include <math.h>
+
+#define	HE5_GRIDOFFSET 671088642    /* (2**26)*10 + 2  */
+#define HE5_NGRID            400
+#define HE5_NGRIDREGN        512
+#define M_PI1           3.14159265358979323846
+#define SQUARE(x)       ((x) * (x))   /* x**2 */
+
+char    HE5_GDXSDname[HE5_HDFE_NAMBUFSIZE];
+char    HE5_GDXSDdims[HE5_HDFE_DIMBUFSIZE];
+
+/* Grid Structure External Arrays */
+struct HE5_gridStructure 
+{
+  hid_t     fid;                      /* HDF-EOS file ID                   */
+  hid_t     obj_id;                   /* "GRIDS" group ID                  */
+  hid_t     gd_id;                    /* one grid group ID                 */
+  hid_t     data_id;                  /* "Data Fields" group ID            */
+  hid_t     plist;                    /* current dataset creation property */
+
+  HE5_DTSinfo  *ddataset;             /* Ptr to dataset info structure     */
+  
+  int       compparm[5];              /* compression level                 */
+  int 	    active;                   /* Flag: if file is active or not    */
+  int  	    tilecode;                 /* tile/no-tile flag                 */
+  int  	    tilerank;                 /* rank of a dataset to tile         */
+  
+  long      nDFLD;                    /* number of data fields             */
+  
+  hsize_t   tiledims[HE5_DTSETRANKMAX];/* dimension sizes of tiled dataset */
+  
+  char      gdname[HE5_OBJNAMELENMAX]; /* grid name                        */
+  char      compmethod[HE5_HDFE_NAMBUFSIZE];/* compression method          */
+};
+
+struct HE5_gridStructure HE5_GDXGrid[HE5_NGRID];
+
+
+struct HE5_gridRegion
+{
+  hid_t     fid;
+  hid_t	    gridID;
+  
+  double    upleftpt[2];
+  double    lowrightpt[2];
+  
+  long 	    xStart;
+  long 	    xCount;
+  long 	    yStart;
+  long 	    yCount;
+  long      somStart;
+  long      somCount;
+  long	    StartVertical[HE5_DTSETRANKMAX];
+  long 	    StopVertical[HE5_DTSETRANKMAX];
+  
+  char 	    *DimNamePtr[HE5_DTSETRANKMAX];
+};
+
+struct HE5_gridRegion *HE5_GDXRegion[HE5_NGRIDREGN];
+
+/* Grid Function Prototypes (internal routines)  */
+/* --------------------------------------------- */
+
+static size_t HE5_GDfielddatasize(hid_t gridID, const char *fieldname );
+static herr_t HE5_GDgetfieldID(hid_t gridID, const char *fieldname, hid_t *fieldID);
+static herr_t HE5_GDchkgdid(hid_t gridID, const char *routname, hid_t *fid, hid_t *gid, long *idx );
+static herr_t HE5_GDwrrdfield(hid_t gridID, const char *fieldname, char *code,const hssize_t start[], const hsize_t stride[], const hsize_t  edge[], void *datbuf);
+static herr_t HE5_GDtangentpnts(int, double[], double[], double[], double[], double[], long *);
+herr_t HE5_GDgetdefaults(int projcode, int zonecode, double projparm[], int spherecode, double upleftpt[], double lowrightpt[]);
+static int HE5_GDfldnameinfo(hid_t gridID, const char *fieldname, char *fldactualname);
+herr_t HE5_GDll2mm_cea(int projcode,int zonecode, int spherecode, double projparm[], long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[], long npnts, double lon[], double lat[], double x[], double y[], double *scaleX, double *scaleY);
+herr_t HE5_GDmm2ll_cea(int projcode,int zonecode, int spherecode, double projparm[], long xdimsize, long ydimsize, double  upleftpt[], double lowrightpt[], long npnts, double x[], double  y[], double longitude[], double latitude[]);
+int HE5_szip_can_encode(void );
+void HE5_GDgetEastAndNorthFiles(char *eastFile, char *northFile);
+
+static herr_t HE5_GDflddiminfo(int gridID, char *fieldname, int *rank,  hsize_t dims[], hsize_t maxdims[]);
+static herr_t HE5_GDupdatedim(int gridhID,  char *dimname, hsize_t dim);
+
+/* FORTRAN wrappers */
+/* ================ */
+
+/* File/Grid access routine */
+
+int HE5_GDopenF(char *filename, int Flags);
+int HE5_GDcreateF(int fileID, char *gridname, long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[]);
+int HE5_GDattachF(int fileID, char *gridname);
+int HE5_GDdetachF(int gridID);
+int HE5_GDcloseF(int fileID);
+
+
+/* Definition routines */
+
+int HE5_GDdefdimF(int gridID,  char *dimname, long dim);
+int HE5_GDdefprojF(int gridID, int projcode, int zonecode,  int spherecode, double projparm[]);
+int HE5_GDdeforiginF(int gridID, int origincode);
+int HE5_GDdeffld(int gridID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int ntype, int merge);
+int HE5_GDsetfill(int gridID, char *fieldname, int ntype, void *fillval);
+int HE5_GDdefcompF(int gridID, int compcode, int compparm[]);
+int HE5_GDdeftileF(int gridID, int tilecode, int tilerank, long *tiledims);
+int HE5_GDdefcomtileF(int gridID, int compcode, int compparm[], int tilerank, long *tiledims );
+int HE5_GDdefpixregF(int gridID, int pixregcode);
+int HE5_GDsetaliasF(int gridID, char *fieldname, char *fortaliaslist);
+int HE5_GDdropaliasF(int gridID, int fldgroup, char *aliasname);
+
+
+/* I/O routines */
+
+int HE5_GDwrfld(int gridID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *data);
+int HE5_GDwrcharfld(int gridID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *data);
+int HE5_GDrdfld(int gridID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *buffer);
+int HE5_GDrdcharfld(int gridID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *buffer);
+int HE5_GDgetfill(int gridID, char *fieldname, void *fillval);
+int HE5_GDwrattr(int gridID, char *attrname, int ntype, long fortcount[], void *datbuf);
+int HE5_GDwrgattr(int gridID, char *attrname, int ntype, long fortcount[], void *datbuf);
+int HE5_GDwrlattr(int gridID, char *fieldname, char *attrname, int ntype,long fortcount[], void *datbuf);
+int HE5_GDrdattr(int gridID, char *attrname, void *datbuf);
+int HE5_GDrdgattr(int gridID, char *attrname, void *datbuf);
+int HE5_GDrdlattr(int gridID, char *fieldname, char *attrname, void *datbuf);
+
+
+
+/* Inquiry routines */
+
+long HE5_GDinqdimsF(int gridID, char *dimnames, long dims[]);
+long HE5_GDdiminfoF(int gridID, char *dimname);
+int HE5_GDinqflds(int gridID, char *fieldlist, int rank[], int ntype[]);
+int HE5_GDfldinfo(int gridID, char *fieldname, int *rank, long dims[], int *ntype, char *fortdimlist, char *fortmaxdimlist); 
+int HE5_GDinqdatatypeF(int gridID, char *fieldname, char *attrname, int fieldgroup, int *type, int *TypeClass, int *TypeOrder, long *TypeSize); 
+long HE5_GDinqgridF(char *filename, char *gridlist, long *strbufsize);
+int HE5_GDgridinfoF(int gridID, long *xdimsize, long *ydimsize, double upleftpt[], double lowrightpt[]);
+int HE5_GDatinfo(int gridID, char *attrname, int *ntype, long *fortcount);
+int HE5_GDgatinfo(int gridID, char *attrname, int *ntype, long *fortcount);
+int HE5_GDlatinfo(int gridID, char *fieldname, char *attrname, int *ntype, long *fortcount);
+int HE5_GDprojinfoF(int gridID, int *projcode,  int *zonecode, int *spherecode, double projparm[]);
+int HE5_GDorigininfoF(int gridID, int *origincode);
+int HE5_GDreginfo(int gridID, int regionID, char *fieldname, int *ntype, int *rank, long dims[], long  *size, double upleftpt[], double lowrightpt[]);
+int HE5_GDpixreginfoF(int gridID, int *pixregcode);
+int HE5_GDcompinfoF(int gridID, char *fieldname, int *compcode, int compparm[]);
+long HE5_GDnentriesF(int gridID, int entrycode, long *strbufsize);
+long HE5_GDinqattrsF(int gridID, char *attrnames, long *strbufsize);
+long HE5_GDinqgrpattrsF(int gridID, char *attrnames, long *strbufsize);
+long HE5_GDinqlocattrsF(int gridID, char *fieldname, char *attrnames, long *strbufsize);
+int HE5_GDtileinfoF(int gridID, char *fieldname, int *tilecode, int *tilerank, long tiledims[]);
+int HE5_GDaliasinfoF(int gridID, int fldgroup, char *aliasname, int *length, char *buffer);
+long HE5_GDinqfldaliasF(int gridID, char *fldalias, long *strbufsize);
+long HE5_GDgetaliaslistF(int gridID, int fldgroup, char *aliaslist, long *strbufsize);
+
+
+
+/* Subsetting/Retrieving routines */
+
+int HE5_GDdefboxregionF(int gridID, double cornerlon[], double cornerlat[]);
+int HE5_GDextractregionF(int gridID, int regionID, char *fieldname, void *buffer);
+int HE5_GDdeftimeperiodF(int gridID, int periodID, double starttime, double stoptime);
+int HE5_GDdefvrtregionF(int gridID, int regionID, char *vertObj, double range[]);
+int HE5_GDdupregionF(int oldregionID);
+int HE5_GDgetpixelsF(int gridID, long nLonLat, double lonVal[], double latVal[], long pixRow[], long pixCol[]);
+long HE5_GDgetpixvaluesF(int gridID, long nPixels, long pixRow[], long pixCol[], char *fieldname, void *buffer);
+long HE5_GDinterpolateF(int gridID, long nValues, double lonVal[], double latVal[], char *fieldname, double interpVal[]);
+
+
+/* EXTERNAL DATA FILE INTERFACE */
+
+int HE5_GDsetextdataF(int gridID, char *fortfilelist, long offset[], long size[]);
+int HE5_GDgetextdataF(int gridID, char *fieldname, long namelength, char *fortfilelist, long offset[], long size[]);
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDopen                                                       |
+|                                                                             |
+|  DESCRIPTION: Opens or creates HDF file in order to create, read, or write  |
+|                a grid.                                                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  fid            hid_t   None        HDF-EOS file ID                         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  filename       char*   None        Filename                                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/24/99  A. Muslimov   Changed the return type from int32_t to hid_t.      |
+|  7/12/00  A. Muslimov   Unmasked the hdf5 data types.                       |
+|  END_PROLOG                                                                 |
+  -----------------------------------------------------------------------------*/
+hid_t
+HE5_GDopen(const char *filename, uintn flags)
+{
+  hid_t     fid     = FAIL;/* hdf5 type file ID    */ 
+
+  char      *errbuf = NULL;/* Error message buffer */
+
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDopen", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory to error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }  
+
+  /* Call EHopen to perform file access */
+  /* ---------------------------------- */
+  fid = HE5_EHopen(filename,flags, H5P_DEFAULT );
+  if(fid == FAIL)
+    {
+      sprintf(errbuf, "Cannot open the file \"%s\". Check the file name. \n", filename);
+      H5Epush(__FILE__, "HE5_GDopen", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }  
+
+  free(errbuf);
+  return(fid);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDcreate                                                     |
+|                                                                             |
+|  DESCRIPTION: Creates a grid within the file.                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  gridID         hid_t   None        Grid structure ID                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t   None        File ID                                 |
+|  gridname       char    None        Grid structure name                     |
+|  xdimsize       long    None        Number of columns in grid               |
+|  ydimsize       long    None        Number of rows in grid                  |
+|  upleftpt       double  None        Location (m/deg) of upper left corner   |
+|  lowrightpt     double  None        Location (m/deg) of lower right corner  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|             H5Gopen                                                         |
+|             H5Gcreate                                                       |
+|             H5Gclose                                                        |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/24/99  A. Muslimov   Replaced gid by fid in the call to EHinsertmeta().  |
+|                         Added a statement 'nGrid = ngridopen;' to fix a bug |
+|                         associated with grid numbering in StructMetadata.   |
+|                         Also,  added the calls gd_id = H5Gcreate( GRIDS_ID, |
+|                         gridname, 0). Dynamically allocated memory for      |
+|                         buffers.   Replaced the call to EHattrcat() by      |
+|                         EHdatasetcat(). Added error hadling after the calls |
+|                         to EHinsertmeta() and EHdatasetcat().               |
+|  3/29/00  A. Muslimov   Added "Data Fields" group for consistency with the  |
+|                         Swath interface.                                    |
+|  7/12/00  A. Muslimov   Unmasked the hdf5 data types.                       |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t 
+HE5_GDcreate(hid_t fid, const char *gridname, long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[])
+{
+  hid_t           gridID    = FAIL;/* grid ID (return value)              */
+  hid_t           HDFfid    = FAIL;/* HDF file id                         */
+  hid_t           gd_id     = FAIL;/* gridname group ID                   */
+  hid_t           GRIDS_ID  = FAIL;/* GRIDS group ID                      */
+  hid_t           gid       = FAIL;/* HDF-EOS group ID                    */
+  hid_t           data_id   = FAIL;/* "Data Fields" group ID              */
+  hid_t           i;		   /* Loop index                          */
+
+  herr_t          status    = FAIL;/* routine status variable             */
+
+  int             ngridopen =  0;  /* # of grid structures opened         */
+
+  long            nGrid     =  0;  /* Grid counter                        */
+
+  char            *errbuf  = (char *)NULL; /* Buffer for error message          */
+  char            *utlbuf  = (char *)NULL; /* Utility buffer                    */
+  char            *header  = (char *)NULL; /* Structural metadata header string */
+  char            *footer  = (char *)NULL; /* Structural metadata footer string */
+  char            *refstr1 = (char *)NULL; /* Upper left ref string (metadata)  */
+  char            *refstr2 = (char *)NULL; /* Lower right ref string (metadata) */
+
+  uintn           acs      = 777;          /* Read/Write file access code       */
+
+  HE5_LOCK;
+  CHECKNAME(gridname);
+
+  errbuf  = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char) );
+  if (errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate memory for buffers */
+  /* --------------------------- */
+  utlbuf  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if ( utlbuf == NULL )
+    {
+      sprintf(errbuf, "Cannot allocate memory for buffer.\n");
+      H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+   
+      return(FAIL);
+    }
+  header  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if ( header == NULL )
+    {
+      sprintf(errbuf, "Cannot allocate memory for buffer.\n");
+      H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(utlbuf);
+   
+      return(FAIL);
+    }
+   
+  footer  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if ( footer == NULL )
+    {
+      sprintf(errbuf, "Cannot allocate memory for buffer.\n");
+      H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(utlbuf);
+      free(header);
+   
+      return(FAIL);
+    }
+
+  refstr1 = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if ( refstr1 == NULL )
+    {
+      sprintf(errbuf, "Cannot allocate memory for buffer.\n");
+      H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(utlbuf);
+      free(header);
+      free(footer);
+	
+      return(FAIL);
+    }
+
+  refstr2 = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if ( refstr1 == NULL )
+    {
+      sprintf(errbuf, "Cannot allocate memory for buffer.\n");
+      H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(utlbuf);
+      free(header);
+      free(footer);
+      free(refstr1);
+	
+      return(FAIL);
+    }
+
+  /*
+**********************************************************
+*  Check for proper file ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and access code               *  
+**********************************************************
+*/
+  status = HE5_EHchkfid(fid,"HE5_GDcreate", &HDFfid, &gid, &acs);
+  /* Check file access */
+  /* -------------------------- */
+  if ( acs == 0 )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot call HE5_GDcreate on a file opened read-only.\n");
+      H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for file ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(utlbuf);
+      free(header);
+      free(footer);
+      free(refstr1);
+      free(refstr2);
+	
+      return(FAIL);
+    }
+ 
+
+  /* Check gridname for length */
+  /* ------------------------- */
+  if ( strlen(gridname) > HE5_OBJNAMELENMAX)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Gridname \"%s\" must be less than %d characters.\n", gridname, HE5_OBJNAMELENMAX);
+      H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_FILE, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+
+  /* Determine number of grids currently opened */
+  /* ------------------------------------------- */
+  for (i = 0; i < HE5_NGRID; i++)
+    ngridopen += HE5_GDXGrid[i].active;
+	
+  /* Setup file interface */
+  /* -------------------- */
+  if (ngridopen < HE5_NGRID)
+    {
+      /* Probe , check if GRIDS group exists */
+      /* ----------------------------------- */
+      H5E_BEGIN_TRY {
+	GRIDS_ID = H5Gopen(gid, "GRIDS");
+      }
+      H5E_END_TRY;
+		
+      if(GRIDS_ID == FAIL )
+	{
+	  nGrid = 0;         
+			
+	  /* Create the "GRIDS" group */
+	  /* ------------------------ */
+	  GRIDS_ID = H5Gcreate(gid,"GRIDS",0);
+	  if ( GRIDS_ID == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot create \"GRIDS\" group.\n");
+	      H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (errbuf  != NULL)  free(errbuf);
+	      if (utlbuf  != NULL)  free(utlbuf);
+	      if (header  != NULL)  free(header);
+	      if (footer  != NULL)  free(footer);
+	      if (refstr1 != NULL)  free(refstr1);
+	      if (refstr2 != NULL)  free(refstr2);
+
+	      return( FAIL );
+	    }
+			
+
+	}
+      /* Group "GRIDS" exists */
+      else
+	{
+	  /* Probe , check if gridname group exists */
+	  /* -------------------------------------- */
+	  H5E_BEGIN_TRY{
+	    gd_id = H5Gopen(GRIDS_ID, gridname);
+	  }
+	  H5E_END_TRY;
+			
+	  if( gd_id == FAIL )
+	    {
+	      /* Get the number of grids in "GRIDS" group */
+	      /* ---------------------------------------- */
+	      nGrid = HE5_EHdatasetcat(fid, "/HDFEOS/GRIDS", NULL,  NULL);
+	      if (nGrid == FAIL )
+		{
+		  sprintf(errbuf,"Cannot retrieve the number of grids.");
+		  H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  H5Gclose(GRIDS_ID);
+
+		  if (errbuf  != NULL)  free(errbuf);
+		  if (utlbuf  != NULL)  free(utlbuf);
+		  if (header  != NULL)  free(header);
+		  if (footer  != NULL)  free(footer);
+		  if (refstr1 != NULL)  free(refstr1);
+		  if (refstr2 != NULL)  free(refstr2);
+					  
+		  return(FAIL);
+		}
+
+	    }
+	  else
+	    {
+	      sprintf(errbuf, "Grid \"%s\" already exists.", gridname);
+	      H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_BTREE, H5E_EXISTS, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      H5Gclose(GRIDS_ID);
+
+	      if (errbuf  != NULL)  free(errbuf);
+	      if (utlbuf  != NULL)  free(utlbuf);
+	      if (header  != NULL)  free(header);
+	      if (footer  != NULL)  free(footer);
+	      if (refstr1 != NULL)  free(refstr1);
+	      if (refstr2 != NULL)  free(refstr2);
+
+	      return(FAIL);
+	    }
+
+	}
+
+      /* gridname does not exist */
+      /* ----------------------- */
+	      
+      /* Create gridname group */
+      /* --------------------- */
+      gd_id = H5Gcreate( GRIDS_ID, gridname, 0);
+      if ( gd_id == FAIL )
+	{
+	  sprintf(errbuf, "Cannot create \"%s\" group.\n", gridname);
+	  H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (errbuf  != NULL)  free(errbuf);
+	  if (utlbuf  != NULL)  free(utlbuf);
+	  if (header  != NULL)  free(header);
+	  if (footer  != NULL)  free(footer);
+	  if (refstr1 != NULL)  free(refstr1);
+	  if (refstr2 != NULL)  free(refstr2);
+
+	  return( FAIL );
+	}
+		
+		
+      /* Create "gridname/Data Fields" group */
+      /* ----------------------------------- */
+      data_id = H5Gcreate( gd_id, "Data Fields", 0);
+      if ( data_id == FAIL )
+	{
+	  sprintf(errbuf, "Cannot create \"Data Fields\" group.\n");
+	  H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (errbuf  != NULL)  free(errbuf);
+	  if (utlbuf  != NULL)  free(utlbuf);
+	  if (header  != NULL)  free(header);
+	  if (footer  != NULL)  free(footer);
+	  if (refstr1 != NULL)  free(refstr1);
+	  if (refstr2 != NULL)  free(refstr2);
+
+	  return( FAIL );
+	}
+		
+		
+		
+      /* Establish Grid in Structural MetaData Block */
+      /* -------------------------------------------- */
+      sprintf(header, "%s%li%s%s%s%s%li%s%s%li%s",
+	      "\tGROUP=GRID_", nGrid + 1,
+	      "\n\t\tGridName=\"", gridname, "\"\n",
+	      "\t\tXDim=", xdimsize, "\n",
+	      "\t\tYDim=", ydimsize, "\n");
+		
+      sprintf(footer,
+	      "%s%s%s%s%s%s%s%li%s",
+	      "\t\tGROUP=Dimension\n",
+	      "\t\tEND_GROUP=Dimension\n",
+	      "\t\tGROUP=DataField\n",
+	      "\t\tEND_GROUP=DataField\n",
+	      "\t\tGROUP=MergedFields\n",
+	      "\t\tEND_GROUP=MergedFields\n",
+	      "\tEND_GROUP=GRID_", nGrid + 1, "\n");
+
+
+      /* Build Ref point Col-Row strings */
+      /* ------------------------------- */
+      if ( upleftpt == NULL || ( upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0))
+	{
+	  strcpy(refstr1, "DEFAULT");
+	  strcpy(refstr2, "DEFAULT");
+	}
+      else
+	{
+	  sprintf(refstr1, "%s%lf%s%lf%s","(", upleftpt[0], ",", upleftpt[1], ")");		 
+	  sprintf(refstr2, "%s%lf%s%lf%s", "(", lowrightpt[0], ",", lowrightpt[1], ")");
+	}
+		
+      sprintf(utlbuf, "%s%s%s%s%s%s%s%s", header, "\t\tUpperLeftPointMtrs=", refstr1, "\n","\t\tLowerRightMtrs=", refstr2, "\n",footer);
+		
+      /* Insert record to SM dataset */
+      /* --------------------------- */
+      status = HE5_EHinsertmeta(fid, (char*)gridname, "g", 1002L, utlbuf, NULL);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot insert metadata.");
+	  H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);  
+	  H5Gclose(GRIDS_ID);
+
+	  if (errbuf  != NULL)  free(errbuf);
+	  if (utlbuf  != NULL)  free(utlbuf);
+	  if (header  != NULL)  free(header);
+	  if (footer  != NULL)  free(footer);
+	  if (refstr1 != NULL)  free(refstr1);
+	  if (refstr2 != NULL)  free(refstr2);
+		  
+	  return(FAIL);
+	}
+		
+
+      /* Release "GRIDS" group ID */
+      /* ------------------------ */		
+      status = H5Gclose(GRIDS_ID);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot close \"GRIDS\" group.\n");
+	  H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+
+	  if (errbuf  != NULL)  free(errbuf);
+	  if (utlbuf  != NULL)  free(utlbuf);
+	  if (header  != NULL)  free(header);
+	  if (footer  != NULL)  free(footer);
+	  if (refstr1 != NULL)  free(refstr1);
+	  if (refstr2 != NULL)  free(refstr2);
+		  
+	  return( FAIL );
+	}
+		
+		
+      /* Set up entries in external Table */
+      /* -------------------------------- */
+      for (i = 0; i < HE5_NGRID; i++)
+	{
+	  if (HE5_GDXGrid[ i ].active == 0)
+	    {
+	      gridID                        = i + HE5_GRIDOFFSET;
+	      HE5_GDXGrid[ i ].active           = 1;
+	      HE5_GDXGrid[ i ].fid              = fid;
+	      HE5_GDXGrid[ i ].gd_id            = gd_id;
+	      HE5_GDXGrid[ i ].data_id          = data_id;
+	      HE5_GDXGrid[ i ].obj_id           = GRIDS_ID;
+	      HE5_GDXGrid[ i ].plist            = FAIL;
+	      HE5_GDXGrid[ i ].tilecode         = HE5_HDFE_NOTILE;
+	      strcpy(HE5_GDXGrid[ i ].gdname, gridname);
+	      strcpy(HE5_GDXGrid[ i ].compmethod,"HE5_HDFE_COMP_NONE");
+	      break;
+	    }
+			
+	}
+		
+    }
+  else
+    {
+      /* Too many files opened */
+      /* --------------------- */
+      gridID = FAIL;
+      sprintf(errbuf, "No more than %d grids may be opened simutaneously.\n", HE5_NGRID);
+      H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+	
+  /* Deallocate memory */
+  /* ----------------- */
+  if (errbuf  != NULL)  free(errbuf);
+  if (utlbuf  != NULL)  free(utlbuf);
+  if (header  != NULL)  free(header);
+  if (footer  != NULL)  free(footer);
+  if (refstr1 != NULL)  free(refstr1);
+  if (refstr2 != NULL)  free(refstr2);
+    
+  utlbuf  = NULL;
+  header  = NULL;
+  footer  = NULL;
+  refstr1 = NULL;
+  refstr2 = NULL;
+  errbuf  = NULL;
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(gridID);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDattach                                                     |
+|                                                                             |
+|  DESCRIPTION: Attaches to an existing grid within the file.                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t   None        HDF-EOS file id                         |
+|  gridname       char*   None        grid sructure name                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|             H5Gopen                                                         |
+|             H5Giterate                                                      |
+|             H5Dopen                                                         |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/24/99  A.Muslimov    Added proper error handling after function calls.   |
+|                         Removed redundant if(status==0){} brackets.         |
+|                         In the block if( inout.name != NULL){} changed the  |
+|                         statement before the last one from                  |
+|                            "if(inout.name==NULL) free(inout.name);" onto    |
+|                            "if(inout.name!=NULL) free(inout.name);"         |
+|                         Changed the datatype of idx from int32_t to int.    |
+| 10/18/99  A.Muslimov    Replaced memcpy() by memmove() to avoid a problem   |
+|                         when arguments 1 and 2 overlap in memory.           |
+| 10/18/99  A.Taaheri     Replaced strcpy() by memmove() to avoid a problem   |
+|                         when arguments 1 and 2 overlap in memory.           |
+| 01/21/00  A.Muslimov    Reset the value of "tilecode" to HDFE_NOTILE in     |
+|                         external array.                                     |
+| 02/24/00  A.Muslimov    Added more error checkings and cleanings.           |
+| 03/29/00  A.Muslimov    Added attaching to the "Data Fields" group.         |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| Sep   01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t
+HE5_GDattach(hid_t fid, const char *gridname)
+{
+  hid_t           gridID    = FAIL;	/* Return value of the Grid ID    */
+  hid_t           HDFfid    = FAIL;	/* HDF-EOS file ID                */
+  hid_t           datid     = FAIL;	/* dataset ID                     */
+  hid_t           infogid   = FAIL;	/* "HDFEOS" group ID              */
+  hid_t           gd_id     = FAIL;	/* Grid group ID                  */
+  hid_t           data_id   = FAIL;	/* "Data Fields" Group ID         */
+  hid_t           i;			/* Loop index                     */
+  hid_t           emptyslot = FAIL;	/* "empty" grid index             */
+
+  herr_t          status    = FAIL;	/* routine return status variable */
+
+  int             ngridopen = 0;        /* no. of grid structures opened  */
+  int             idx       = FAIL;	/* Object index                   */
+
+  uintn           acs       = 777;	/* Read/Write file access code    */
+ 
+  HE5_OBJINFO     inout;	        /* IN/OUT data of the operation   */
+
+  char            *grpname = (char *)NULL; /* Grid group name string  */
+  char            *errbuf  = (char *)NULL; /* Error message buffer    */
+  char            *namebuf = (char *)NULL; /* Name list buffer        */
+  char            *fldname = (char *)NULL; /* Dataset name buffer     */
+  char            *comma   = (char *)NULL; /* Pointer to the comma    */
+
+
+  HE5_LOCK;
+  CHECKPOINTER(gridname);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory to error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /*
+**********************************************************
+*  Check for proper file ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and access code               *  
+**********************************************************
+*/
+  status = HE5_EHchkfid(fid, "HE5_GDattach", &HDFfid, &infogid, &acs);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(FAIL);
+    }
+
+  /* Determine number of grids currently opened */
+  /* ------------------------------------------ */ 
+  for (i = 0; i < HE5_NGRID; i++)
+    ngridopen += HE5_GDXGrid[ i ].active;
+
+  if (ngridopen < HE5_NGRID)
+    {
+      /* Allocate memory to the "HDFEOS/GRIDS/gridname" buffer */
+      grpname = (char *)calloc( (strlen(gridname)+40), sizeof(char));
+      if(grpname == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory to the grpname.\n");
+	  H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		  
+	  return(FAIL);
+	}
+
+      strcpy( grpname, "/HDFEOS/GRIDS/");
+      strcat( grpname, gridname);
+
+      /* Try to open the Grid group */
+      /* ========================== */
+      H5E_BEGIN_TRY{
+	gd_id = H5Gopen(HDFfid,grpname);
+      }
+      H5E_END_TRY;
+
+      if( gd_id == FAIL )
+	{  
+	  sprintf(errbuf, "Grid:\"%s\" does not exist within HDF file.",gridname) ;
+	  H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if(grpname != NULL) free(grpname);
+	  free(errbuf);
+
+	  return(FAIL);
+	}
+
+
+      /* Try to open the "Data Fields" group */
+      /* =================================== */
+      H5E_BEGIN_TRY{
+	data_id = H5Gopen(gd_id,"Data Fields");
+      }
+      H5E_END_TRY;
+
+      if( data_id == FAIL )
+	{  
+	  sprintf(errbuf, "Group \"Data Fields\" does not exist in \"%s\" grid.",gridname) ;
+	  H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if(grpname != NULL) free(grpname);
+	  free(errbuf);
+
+	  return(FAIL);
+	}
+
+
+
+      /* Setup External Arrays */
+      /* ===================== */
+      for (i = 0; i < HE5_NGRID; i++)
+	{
+	  /* Find empty entry in array of grids */
+	  /* ---------------------------------- */
+	  if (HE5_GDXGrid[ i ].active == 0)
+	    {
+	      /* Set IDs, Flags, and  Codes */
+	      /* -------------------------- */
+	      HE5_GDXGrid[ i ].active           = 1;
+	      HE5_GDXGrid[ i ].fid              = fid;
+	      HE5_GDXGrid[ i ].gd_id            = gd_id;
+	      HE5_GDXGrid[ i ].data_id          = data_id;              
+	      HE5_GDXGrid[ i ].plist            = FAIL;
+	      HE5_GDXGrid[ i ].tilecode         = HE5_HDFE_NOTILE;
+	      strcpy(HE5_GDXGrid[ i ].compmethod,"HE5_HDFE_COMP_NONE");
+	      gridID                            = i + HE5_GRIDOFFSET;
+	      strcpy(HE5_GDXGrid[ i ].gdname, gridname);
+	      break;
+	    }
+	}
+
+      emptyslot = i;
+
+		
+      /* Get the number of OBJECTS within the "Data Fields"  group */
+      /* ========================================================= */ 
+      inout.count   = 0;
+      inout.name    = NULL;
+      inout.strsize = 0;
+
+      strcat( grpname, "/Data Fields");
+      idx = H5Giterate(data_id, grpname , NULL, HE5_EHobj_info, &inout);
+      if (idx == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get information about \"Data Fields\" group.\n");
+	  H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  if (grpname != NULL) free(grpname);
+		   
+	  return(FAIL);
+	}
+      if(grpname != NULL) free(grpname);
+
+      /* Set the data members of external structure */
+      /* ========================================== */   
+      HE5_GDXGrid[ emptyslot ].nDFLD = inout.count;
+
+
+      /*--------------------------------------------------*/
+      /* Loop through all datasets and open them          */
+      /*          Allocate space for namebuf,             */
+      /*   copy inout.name into it, append comma, etc.    */
+      /*--------------------------------------------------*/
+      if( inout.name != NULL && inout.count > 0 )
+	{
+
+	  /* Allocate memory to "ddataset" struct */
+	  HE5_GDXGrid[emptyslot].ddataset = (HE5_DTSinfo *)realloc((void *)HE5_GDXGrid[emptyslot].ddataset,(HE5_GDXGrid[emptyslot].nDFLD) * sizeof(HE5_DTSinfo));
+	  if(HE5_GDXGrid[ emptyslot ].ddataset == NULL)
+	    {
+	      sprintf(errbuf, "Cannot allocate memory to the ddataset structure.\n");
+	      H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+		       
+	      return(FAIL);
+	    }
+
+	  /* Allocate memory to the name list buffer */
+	  namebuf = (char *) calloc(strlen(inout.name) + 2, sizeof(char));
+	  if(namebuf == NULL)
+	    {
+	      sprintf(errbuf, "Cannot allocate memory to the name list buffer.\n");
+	      H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+
+	      return(FAIL);
+	    }
+
+	  strcpy(namebuf, inout.name);
+	  strcat(namebuf, ",");
+
+	  /* Find comma */
+	  comma = strchr(namebuf, ',');
+
+	  i = 0;
+
+	  /* Loop through entries in name list */
+	  /* ================================= */
+	  while (comma != NULL)
+	    {
+	      /* Copy field list entry to fldname */
+	      fldname = (char *) calloc(comma - namebuf + 1, sizeof(char));
+	      if(fldname == NULL)
+		{
+		  sprintf(errbuf, "Cannot allocate memory to fldname.\n");
+		  H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(namebuf);
+		       
+		  return(FAIL);
+		}
+	      memmove(fldname, namebuf, comma - namebuf);
+	      fldname[comma - namebuf] = 0;
+
+	      /* Open the dataset */
+	      /* ================ */
+	      datid = H5Dopen(data_id, fldname);		   
+	      if ( datid == FAIL)
+		{
+		  sprintf(errbuf, "Cannot open the dataset \"%s\" .\n", fldname);
+		  H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(namebuf);
+		  free(fldname);
+		       
+		  return(FAIL);
+		}
+
+	      /*allocate memory to the dataset name*/
+	      HE5_GDXGrid[ emptyslot ].ddataset[ i ].name = (char *) calloc((strlen(fldname)+1), sizeof(char) );
+	      if(HE5_GDXGrid[ emptyslot ].ddataset[ i ].name == NULL)
+		{
+		  sprintf(errbuf, "Cannot allocate memory to the dataset name.\n");
+		  H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(namebuf);
+		  free(fldname);
+
+		  return(FAIL);
+		}
+
+	      /* Set the data members of external structure */
+	      /* ========================================== */   
+	      HE5_GDXGrid[ emptyslot ].ddataset[ i ].ID = datid;
+	      strcpy(HE5_GDXGrid[ emptyslot ].ddataset[ i ].name, fldname);
+
+				
+	      /* Go to the next dataset/field entry */
+	      /* ================================== */  
+	      memmove(namebuf, comma + 1, strlen(comma)-1);
+	      namebuf[strlen(comma)-1] = 0;
+	      comma = strchr(namebuf, ',');
+	      if (fldname != NULL) free(fldname);
+	      i++;
+				
+	    }
+
+	  if (namebuf != NULL) 
+	    {
+	      free(namebuf);
+	      namebuf = NULL;
+	    }
+	  if(inout.name != NULL )
+	    {
+	      free( inout.name);
+	      inout.name = NULL;
+	    }
+		   
+	} /* end 'if(name!==NULL)' */
+
+    }
+  else
+    {
+      /* Too many Grids opened */
+      gridID = FAIL;
+      sprintf(errbuf, "No more than %d grids may be open simultaneously", HE5_NGRID);
+      H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_FILE, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  if (errbuf != NULL) free(errbuf);
+  
+ COMPLETION:    
+  HE5_UNLOCK;
+  return(gridID);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDchkgdid                                                    |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        hdf5  type grid  ID                     |
+|  routname       char    None        Name of routine calling GDchkgdid       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fid            hid_t   None        HDF-EOS file ID                         |
+|  gid            hid_t   None        "HDFEOS" group ID                       |
+|  idx            long    None        Grid index                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/30/99  A.Muslimov    Added error handlings after the function calls.     |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t   
+HE5_GDchkgdid(hid_t gridID, const char *routname, hid_t *fid, hid_t *gid, long *idx )
+{
+  herr_t          status     = SUCCEED;/* routine return status variable */
+  
+  uintn           access     = 777;    /* Read/Write file access code    */
+  
+  hid_t           HDFfid     = FAIL;   /* HDF-EOS file ID                */
+  
+  long            idOffset   = HE5_GRIDOFFSET;/* HDF-EOS Grid ID offset  */
+  
+  char            message1[] = "Invalid grid id: %d in routine \"%s\".  ID must be >= %d and < %d.\n";
+  char            message2[] = "Grid id %d in routine \"%s\" not active.\n";
+					       char            errbuf[HE5_HDFE_ERRBUFSIZE];
+  
+  /*
+*******************************
+*  Check for proper grid ID   *   
+*******************************
+*/ 
+  if (gridID < idOffset || gridID >= HE5_NGRID + idOffset)
+    {
+      status = FAIL;
+      sprintf(errbuf, message1, gridID, routname, idOffset, HE5_NGRID + idOffset);
+      H5Epush(__FILE__, "HE5_GDchkgdid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	
+    }
+  else
+    {
+      /* Check for active grid ID */
+      /* ------------------------- */
+      if (HE5_GDXGrid[gridID % idOffset].active == 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf,  message2, gridID, routname);
+	  H5Epush(__FILE__, "HE5_GDchkgdid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf) ;
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+      else
+        {
+          /* Get Grid index */
+          /* -------------- */
+	  *idx = HE5_EHhid2long(gridID) % idOffset;
+	  if ( *idx == FAIL)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot get the Grid index \n");
+	      H5Epush(__FILE__, "HE5_GDchkgdid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf) ;
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+
+	  /* Get HDF-EOS file ID and "HDFEOS" group ID */
+	  /* ----------------------------------------- */
+	  *fid = HE5_GDXGrid[ *idx ].fid;
+	  status = HE5_EHchkfid(*fid,"", &HDFfid, gid, &access);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Checking for file ID failed.\n");
+	      H5Epush(__FILE__,"HE5_GDchkgdid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+	    
+        }
+    }
+  
+  return (status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefdim                                                     |
+|                                                                             |
+|  DESCRIPTION: Defines a new dimension within the grid.                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  dimname        char*   None        Dimension name to define                |
+|  dim            hsize_t   None      Dimemsion value                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/20/99  A.Muslimov    In the call to EHinsertmeta() replaced the argument |
+|                         gid by fid.                                         |
+|  9/27/99  A.Muslimov    Added proper error handlings. Removed redundant     |
+|                         if(status == 0){} brackets.                         |
+|  1/06/00  A.Muslimov    Changed the datatype of "dim" from int32_t to       |
+|                         hsize_t to make a call to EHinsertmeta() successfull|
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDdefdim(hid_t gridID, char *dimname, hsize_t dim)
+{
+  herr_t       status  = FAIL;        /* routine return status variable */
+  
+  hid_t        gid     = FAIL;        /* "HDFEOS" group ID              */
+  hid_t        fid     = FAIL;        /* HDF-EOS file ID                */
+  
+  long         idx     = FAIL;        /* Grid index                     */
+  
+  char         *errbuf = (char *)NULL;/* Buffer for error message       */
+  
+  HE5_LOCK;
+  CHECKNAME(dimname);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdefdim", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/  
+  status = HE5_GDchkgdid(gridID, "HE5_GDdefdim", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDdefdim", __LINE__,  H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+  
+  /* Insert Dimension value to Structural MetaData */
+  /* --------------------------------------------- */
+  status = HE5_EHinsertmeta(fid, HE5_GDXGrid[idx].gdname, "g", 0L, dimname, &dim);
+  if (status == FAIL )
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot insert metadata.");
+      H5Epush(__FILE__, "HE5_GDdefdim", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  free(errbuf);
+  errbuf = NULL;
+
+ COMPLETION:  
+  HE5_UNLOCK;
+  return(status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefproj                                                    |
+|                                                                             |
+|  DESCRIPTION: Defines projection of grid.                                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units       Description                           |
+|  ============   ======    =========   ===================================== |
+|  status         herr_t    None        return status (0) SUCCEED, (-1) FAIL  |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t     None        HDF-EOS type grid  ID                 |
+|  projcode       int                   GCTP projection code                  |
+|  zonecode       int                   UTM zone code                         |
+|  spherecode     int                   GCTP spheriod code                    |
+|  projparm       double                Projection parameters                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/24/99  A.Muslimov    In the call to EHinsertmeta() replaced the argument |
+|                         gid by fid. Added error handling after the call to  |
+|                         EHinsertmeta().                                     |
+|  4/19/00  A.Muslimov    Changed 'slen' type from long to size_t.            |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDdefproj(hid_t gridID, int projcode, int zonecode,  int spherecode, double projparm[])
+{
+  herr_t          status   = FAIL;      /* routine return status variable  */  
+
+  int             i;                    /* Loop index                      */
+  
+  hid_t           fid      = FAIL;      /* HDF-EOS file ID                 */
+  hid_t           gid      = FAIL;      /* Grid group ID                   */
+  
+  long            idx      = FAIL;      /* Grid index                      */
+
+  size_t          slen     = 0;             /* String length               */
+  
+  char            *utlbuf  = (char *)NULL;    /* Utility Buffer            */
+  char            projparmbuf[HE5_HDFE_UTLBUFSIZE];/* Projection parameter */
+  char            *GCTPproj[128] = {"HE5_GCTP_GEO","HE5_GCTP_UTM","HE5_GCTP_SPCS",
+				    "HE5_GCTP_ALBERS","HE5_GCTP_LAMCC","HE5_GCTP_MERCAT",
+				    "HE5_GCTP_PS","HE5_GCTP_POLYC","HE5_GCTP_EQUIDC",
+				    "HE5_GCTP_TM","HE5_GCTP_STEREO", "HE5_GCTP_LAMAZ",
+				    "HE5_GCTP_AZMEQD", "HE5_GCTP_GNOMON","HE5_GCTP_ORTHO", 
+				    "HE5_GCTP_GVNSP","HE5_GCTP_SNSOID","HE5_GCTP_EQRECT",
+				    "HE5_GCTP_MILLER","HE5_GCTP_VGRINT","HE5_GCTP_HOM",
+				    "HE5_GCTP_ROBIN","HE5_GCTP_SOM","HE5_GCTP_ALASKA",
+				    "HE5_GCTP_GOOD", "HE5_GCTP_MOLL","HE5_GCTP_IMOLL", 
+				    "HE5_GCTP_HAMMER","HE5_GCTP_WAGIV","HE5_GCTP_WAGVII",
+				    "HE5_GCTP_OBLEQA"/*,"HE5_GCTP_CEA","HE5_GCTP_BCEA",
+						       "HE5_GCTP_ISINUS"*/};/* GCTP projection codes    */
+  char            *errbuf = (char *)NULL;     /* Buffer for error message */
+  
+  HE5_LOCK;
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdefproj", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate memory for utility buffer */
+  /* ---------------------------------- */
+  utlbuf  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if(utlbuf == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_GDdefproj", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+  
+  
+  /* Add "non-standard" GCTP codes */
+  /* ----------------------------- */
+  GCTPproj[ 97 ] = (char *)calloc( (strlen("HE5_GCTP_CEA")+ 1),  sizeof(char) );
+  if(GCTPproj[ 97 ] == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_GDdefproj", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(utlbuf);
+
+      return(FAIL);
+    }
+  strcpy(GCTPproj[97], "HE5_GCTP_CEA");
+ 
+  GCTPproj[ 98 ] = (char *)calloc( (strlen("HE5_GCTP_BCEA")+ 1),  sizeof(char) );
+  if(GCTPproj[ 98 ] == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_GDdefproj", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(utlbuf);
+      free(GCTPproj[97]);
+
+      return(FAIL);
+    }
+  strcpy(GCTPproj[98], "HE5_GCTP_BCEA");
+
+ 
+
+  GCTPproj[ 99 ] = (char *)calloc( (strlen("HE5_GCTP_ISINUS") + 1), sizeof(char) );
+  if(GCTPproj[ 99 ] == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_GDdefproj", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(utlbuf);
+      free(GCTPproj[97]);
+      free(GCTPproj[98]);
+	
+      return(FAIL);
+    }
+  strcpy(GCTPproj[99], "HE5_GCTP_ISINUS");
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/    
+  status = HE5_GDchkgdid(gridID, "HE5_GDdefproj", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /*
+       * If projection not GEO, UTM, or State Code build projection
+       * parameter string
+       */
+      if (projcode != HE5_GCTP_GEO &&  projcode != HE5_GCTP_UTM && projcode != HE5_GCTP_SPCS)
+        {
+
+	  /* Begin projection parameter list with "(" */
+	  strcpy(projparmbuf, "(");
+
+	  /* Add each projection parameter to string */
+	  for (i = 0; i < 13; i++)
+            {
+	      /* If projparm[i] = 0 ... */
+	      if (projparm[i] == 0.0)
+                {
+		  strcpy(utlbuf, "0,");
+                }
+	      else
+                {
+		  /* if projparm[i] is integer ... */
+		  if ( ((long)projparm[ i ]) == projparm[ i ])
+		    {
+		      sprintf(utlbuf, "%li%s", (long)projparm[ i ], ",");
+		    }
+		  /* else if projparm[i] is between 0 and 1 ... */
+		  else if ((i == 1) && (projparm[1] > 0) && (projparm[1] < 1))
+		    {
+		      sprintf(utlbuf, "%g%s", projparm[i], ",");
+		    }
+		  else
+		    {
+		      sprintf(utlbuf, "%lf%s", projparm[i], ",");
+		    }
+                }
+	      strcat(projparmbuf, utlbuf);
+            }
+	  slen = strlen(projparmbuf);
+
+	  /* Add trailing ")" */
+	  projparmbuf[slen - 1] = ')';
+        }
+
+
+      /* Build metadata string */
+      /* --------------------- */
+      if (projcode == HE5_GCTP_GEO)
+        {
+	  sprintf(utlbuf,
+		  "%s%s%s", "\t\tProjection=", GCTPproj[projcode], "\n");
+        }
+      else if (projcode == HE5_GCTP_UTM || projcode == HE5_GCTP_SPCS)
+        {
+	  sprintf(utlbuf,
+		  "%s%s%s%s%d%s%s%d%s",
+		  "\t\tProjection=", GCTPproj[projcode], "\n",
+		  "\t\tZoneCode=", zonecode, "\n",
+		  "\t\tSphereCode=", spherecode, "\n");
+        }
+      else
+        {
+	  sprintf(utlbuf,
+		  "%s%s%s%s%s%s%s%d%s",
+		  "\t\tProjection=", GCTPproj[projcode], "\n",
+		  "\t\tProjParams=", projparmbuf, "\n",
+		  "\t\tSphereCode=", spherecode, "\n");
+        }
+
+
+      /* Insert in structural metadata */
+      /* ----------------------------- */
+      status = HE5_EHinsertmeta(fid, HE5_GDXGrid[ idx ].gdname, "g", 101L, utlbuf, NULL);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot insert metadata.\n");
+	  H5Epush(__FILE__, "HE5_GDdefproj", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(utlbuf);
+	  if (GCTPproj[97] != NULL) free(GCTPproj[97]);
+	  if (GCTPproj[98] != NULL) free(GCTPproj[98]);
+	  if (GCTPproj[99] != NULL) free(GCTPproj[99]);
+
+	  return(FAIL);
+	}
+
+    }
+  
+  free(errbuf);
+  free(utlbuf);
+  free(GCTPproj[97]);
+  free(GCTPproj[98]);
+  free(GCTPproj[99]);
+  GCTPproj[97] = NULL;
+  GCTPproj[98] = NULL;
+  GCTPproj[99] = NULL;
+  utlbuf = NULL;
+  errbuf = NULL;
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDblkSOMoffset                                               |
+|                                                                             |
+|  DESCRIPTION: Writes Block SOM offset values                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  offset         long                Offset values                           |
+|  count[]        hsize_t             Number of offset values                 |
+|  code           char                w/r code (w/r)                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 00   A.Muslimov    Added more checkings.                               |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDblkSOMoffset(hid_t gridID, long offset[], hsize_t count[], char *code)
+{
+  herr_t          status   = FAIL;        /* routine return status variable */
+
+  int             projcode = FAIL;        /* GCTP projection code           */
+  int             i;                      /* Loop index                     */
+  
+  hid_t           fid      = FAIL;        /* HDF-EOS file ID                */
+  hid_t           gid      = FAIL;        /* "HDFEOS" group ID              */
+  
+  long            idx      = FAIL;        /* Grid index                     */
+    
+  double          projparm[13];           /* Projection parameters          */
+  
+  char            utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility Buffer             */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message Buffer       */
+  
+  HE5_LOCK;
+  CHECKPOINTER(offset);
+  CHECKPOINTER(count);
+  CHECKPOINTER(code);
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDblkSOMoffset", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Initialize projection parameters */
+      /* -------------------------------- */
+      for (i = 0; i < 13; i++)
+	projparm[i] = 0.;
+	  
+      /* Get projection parameters */
+      /* ------------------------- */
+      status = HE5_GDprojinfo(gridID, &projcode, NULL, NULL, projparm);
+      if ( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get projection information.\n");
+	  H5Epush(__FILE__, "HE5_GDblkSOMoffset", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	
+	  return(status);
+	}
+
+      /* If SOM projection with projparm[11] non-zero ... */
+      /* ------------------------------------------------ */
+      if (projcode == HE5_GCTP_SOM && projparm[11] != 0) 
+        {
+	  sprintf(utlbuf, "%s", "_BLKSOM");
+
+	  /* Write offset values as attribute */
+	  if (strcmp(code, "w") == 0)
+            {
+	      status = HE5_GDwriteattr(gridID, "_BLKSOM", H5T_NATIVE_LONG, count, offset);
+	      if ( status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot write in offset values.\n");
+		  H5Epush(__FILE__, "HE5_GDblkSOMoffset", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	
+		  return(status);
+		}
+            }
+	  /* Read offset values from attribute */
+	  /* --------------------------------- */
+	  else if (strcmp(code, "r") == 0)
+            {
+	      status = HE5_GDreadattr(gridID, utlbuf, offset);
+	      if ( status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot read out the offset values.\n");
+		  H5Epush(__FILE__, "HE5_GDblkSOMoffset", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	
+		  return(status);
+		}
+            }
+        }
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefcomp                                                    |
+|                                                                             |
+|  DESCRIPTION: Defines compression type and parameters                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  compcode       int                 compression code                        |
+|  compparm       int                 compression parameters                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:   Before calling this function, storage must be CHUNKED             |
+|                      Values of compression code                             |
+|                         HDFE_COMP_NONE                  0                   |
+|                         HDFE_COMP_RLE                   1                   |
+|                         HDFE_COMP_NBIT                  2                   |
+|                         HDFE_COMP_SKPHUFF               3                   |
+|                         HDFE_COMP_DEFLATE               4                   |
+|                         HDFE_COMP_SZIP_CHIP             5                   |
+|                         HDFE_COMP_SZIP_K13              6                   |
+|                         HDFE_COMP_SZIP_EC               7                   |
+|                         HDFE_COMP_SZIP_NN               8                   |
+|                         HDFE_COMP_SZIP_K13orEC          9                   |
+|                         HDFE_COMP_SZIP_K13orNN          10                  |
+|                         HDFE_COMP_SHUF_DEFLATE          11                  |
+|                         HDFE_COMP_SHUF_SZIP_CHIP        12                  |
+|                         HDFE_COMP_SHUF_SZIP_K13         13                  |
+|                         HDFE_COMP_SHUF_SZIP_EC          14                  |
+|                         HDFE_COMP_SHUF_SZIP_NN          15                  |
+|                         HDFE_COMP_SHUF_SZIP_K13orEC     16                  |
+|                         HDFE_COMP_SHUF_SZIP_K13orNN     17                  |
+|  RLE=Run Length Encoding                                                    |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|             H5Pget_layout                                                   |
+|             H5Pset_layout                                                   |
+|             H5Pset_deflate                                                  |
+|             H5Pset_szip                                                     |
+|             H5Pset_shuffle                                                  |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/24/99  A.Muslimov    Changed the return type from intn to int   .        |
+|  1/18/99  A.Muslimov    Added compcode parameter, and "switch (comcode)"    |
+|                         block.                                              |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 06/04/01  A.Muslimov    Added checking for compression code/level.          |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  Aug  03  S.Zhao        Added Szip compression methods.                     |
+|  Oct  03  S.Zhao        Added the shuffling method.                         |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDdefcomp(hid_t gridID, int compcode, int compparm[])
+{
+  herr_t          status   = FAIL;/* routine return status variable */
+
+  int             level    = 0;   /* compression level              */
+  
+  hid_t           fid      = FAIL;/* HDF-EOS file id                */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID              */
+  hid_t           (*func)(void*);
+    
+  void            *edata = (void *)NULL;
+  
+  long            idx      = FAIL;/* Grid index                     */
+  
+  H5D_layout_t    layout   = H5D_LAYOUT_ERROR;/* Type of storage    */
+  int             can_encode=0;     /* szip encoder presence flag     */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer  */
+
+  H5Eget_auto(&func,&edata);
+
+  HE5_LOCK;  
+  CHECKPOINTER(compparm);
+
+  /* Check if compression code is valid */
+  /* ---------------------------------- */
+  if( compcode != HE5_HDFE_COMP_DEFLATE && compcode != HE5_HDFE_COMP_NONE && 
+      compcode != HE5_HDFE_COMP_SZIP_CHIP && compcode != HE5_HDFE_COMP_SZIP_K13 &&
+      compcode != HE5_HDFE_COMP_SZIP_EC && compcode != HE5_HDFE_COMP_SZIP_NN &&
+      compcode != HE5_HDFE_COMP_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SZIP_K13orNN &&
+      compcode != HE5_HDFE_COMP_SHUF_DEFLATE && compcode != HE5_HDFE_COMP_SHUF_SZIP_CHIP &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_K13 && compcode != HE5_HDFE_COMP_SHUF_SZIP_EC &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_NN && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orEC &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orNN )
+    {
+      status = FAIL;
+      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Invalid/unsupported compression code. \n");
+      HE5_EHprint("Error: Invalid/unsupported compression code, occured", __FILE__, __LINE__);
+      return(status);
+    }
+
+  if( compcode == HE5_HDFE_COMP_DEFLATE || compcode == HE5_HDFE_COMP_NONE || compcode == HE5_HDFE_COMP_SHUF_DEFLATE)
+    {
+      /* Check GZIP compression level */
+      /* ---------------------------- */
+      if( compparm[0] < 0 || compparm[0] > 9)
+	{
+	  status = FAIL;
+	  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Invalid GZIP compression level. \n");
+	  HE5_EHprint("Error: Invalid GZIP compression level, occured", __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  else
+    {
+      /* Check SZIP compression block size */
+      /* --------------------------------- */
+      if( compparm[0] != 2 && compparm[0] != 4 && compparm[0] != 6 && compparm[0] != 8 &&
+	  compparm[0] != 10 && compparm[0] != 12 && compparm[0] != 14 && compparm[0] != 16 &&
+	  compparm[0] != 18 && compparm[0] != 20 && compparm[0] != 22 && compparm[0] != 24 &&
+	  compparm[0] != 26 && compparm[0] != 28 && compparm[0] != 30 && compparm[0] != 32)
+	{
+	  status = FAIL;
+	  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Invalid SZIP compression block size. \n");
+	  HE5_EHprint("Error: Invalid SZIP compression block size, occured", __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  
+#ifdef H5_HAVE_FILTER_SZIP
+  can_encode = HE5_szip_can_encode();
+#endif
+
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDdefcomp", &fid, &gid, &idx);
+  if (status == FAIL) 
+    {
+      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADRANGE, "Checking for grid ID failed.\n");
+      HE5_EHprint("Error: Checking for grid ID failed, occured", __FILE__, __LINE__);
+      return( status );
+    }
+  
+  /* if current property instance has not been created, report error */
+  /* --------------------------------------------------------------- */
+  if( HE5_GDXGrid[ idx ].plist == FAIL )
+    {
+      if (compcode != HE5_HDFE_COMP_NONE)
+	{
+	  status = FAIL;
+	  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_PLIST, H5E_NOTFOUND, "Unable to compress, dataset storage layout has not been set to CHUNKED.");
+	  HE5_EHprint("Error: Unable to compress, dataset storage layout has not been set to CHUNKED, occured", __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  else
+    {
+      layout = H5Pget_layout(HE5_GDXGrid[ idx ].plist);
+      if( layout != H5D_CHUNKED )
+	{
+	  status = H5Pset_layout(HE5_GDXGrid[idx].plist, H5D_CHUNKED);
+	  if ( status == FAIL )
+	    {
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set the layout.\n");
+	      HE5_EHprint("Error: Cannot set the layout, occured", __FILE__, __LINE__);
+	      return(status );
+	    }
+	}
+	   
+      switch(compcode)
+	{
+	  /* Set NBIT compression parameters in ext. array */
+	  /* --------------------------------------------- */
+	case HE5_HDFE_COMP_NBIT:
+ 
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+	  HE5_GDXGrid[ idx ].compparm[ 1 ] = compparm[ 1 ];
+	  HE5_GDXGrid[ idx ].compparm[ 2 ] = compparm[ 2 ];
+	  HE5_GDXGrid[ idx ].compparm[ 3 ] = compparm[ 3 ];
+ 
+	  break;
+
+	  /* Set compression method to HE5_HDFE_COMP_DEFLATE */
+	  /* ----------------------------------------------- */
+	case HE5_HDFE_COMP_DEFLATE:
+
+	  level = compparm[0];
+	  status = H5Pset_deflate(HE5_GDXGrid[ idx ].plist, level);
+	  if ( status == FAIL)
+	    {
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set GZIP compression method.\n");
+	      HE5_EHprint("Error: Cannot set GZIP compression method, occured", __FILE__, __LINE__);
+	      return(status );
+	    }
+ 
+	  /* ------------------------------------------------- */
+	  /* Set GZIP compression method and compression       */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_DEFLATE");
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+
+	  break;
+
+	case HE5_HDFE_COMP_SZIP_CHIP:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_CHIP_OPTION_MASK,compparm[0]);
+	      if ( status == FAIL)
+		{
+		  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_CHIP compression method.\n");
+		  HE5_EHprint("Error: Cannot set SZIP_CHIP compression method, occured", __FILE__, __LINE__);
+		  return(status );
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set SZIP_CHIP compression method and compression  */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_CHIP");
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+		  
+	  break;
+ 
+	case HE5_HDFE_COMP_SZIP_K13:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK,compparm[0]);
+	      if ( status == FAIL)
+		{
+		  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_K13 compression method.\n");
+		  HE5_EHprint("Error: Cannot set SZIP_K13 compression method, occured", __FILE__, __LINE__);
+		  return(status );
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set SZIP_K13 compression method and compression   */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_K13");
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+		  
+	  break;
+		  
+	case HE5_HDFE_COMP_SZIP_EC:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_EC_OPTION_MASK,compparm[0]);
+	      if ( status == FAIL)
+		{
+		  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_EC compression method.\n");
+		  HE5_EHprint("Error: Cannot set SZIP_EC compression method, occured", __FILE__, __LINE__);
+		  return(status );
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set SZIP_EC compression method and compression    */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_EC");
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+		  
+	  break;
+		  
+	case HE5_HDFE_COMP_SZIP_NN:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_NN_OPTION_MASK,compparm[0]);
+	      if ( status == FAIL)
+		{
+		  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_NN compression method.\n");
+		  HE5_EHprint("Error: Cannot set SZIP_NN compression method, occured", __FILE__, __LINE__);
+		  return(status );
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set SZIP_NN compression method and compression    */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_NN");
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+		  
+	  break;
+		  
+	case HE5_HDFE_COMP_SZIP_K13orEC:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK,compparm[0]);
+	      if ( status == FAIL)
+		{
+		  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_K13orSZIP_EC compression method.\n");
+		  HE5_EHprint("Error: Cannot set SZIP_K13orSZIP_EC compression method, occured", __FILE__, __LINE__);
+		  return(status );
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------------- */
+	  /* Set SZIP_K13orEC compression method and compression     */
+	  /*    parameters in external array                         */
+	  /* ------------------------------------------------------- */
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_K13orHE5_HDFE_COMP_SZIP_EC");
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+		  
+	  break;
+		  
+	case HE5_HDFE_COMP_SZIP_K13orNN:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK,compparm[0]);
+	      if ( status == FAIL)
+		{
+		  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_K13orSZIP_NN compression method.\n");
+		  HE5_EHprint("Error: Cannot set SZIP_K13orSZIP_NN compression method, occured", __FILE__, __LINE__);
+		  return(status );
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ----------------------------------------------------- */
+	  /* Set SZIP_K13orNN compression method and compression   */
+	  /*    parameters in external array                       */
+	  /* ----------------------------------------------------- */
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_K13orHE5_HDFE_COMP_SZIP_NN");
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+ 
+	  break;
+
+	case HE5_HDFE_COMP_SHUF_DEFLATE:
+ 
+	  status = H5Pset_shuffle(HE5_GDXGrid[idx].plist);
+	  if (status == FAIL)
+	    {
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot set the shuffling method. \n");
+	      HE5_EHprint("Error: Cannot set the shuffling method, occured", __FILE__, __LINE__);
+	      return(status);
+	    }
+
+	  level = compparm[0];
+	  status = H5Pset_deflate(HE5_GDXGrid[ idx ].plist, level);
+	  if ( status == FAIL)
+	    {
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set GZIP compression method.\n");
+	      HE5_EHprint("Error: Cannot set GZIP compression method, occured", __FILE__, __LINE__);
+	      return(status );
+	    }
+ 
+	  /* ------------------------------------------------- */
+	  /* Set shuffling+GZIP method and compression         */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_DEFLATE");
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+ 
+	  break;
+		  
+	case HE5_HDFE_COMP_SHUF_SZIP_CHIP:
+		  
+	  status = H5Pset_shuffle(HE5_GDXGrid[idx].plist);
+	  if (status == FAIL)
+	    {
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot set the shuffling method. \n");
+	      HE5_EHprint("Error: Cannot set the shuffling method, occured", __FILE__, __LINE__);
+	      return(status);
+	    }
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_CHIP_OPTION_MASK,compparm[0]);
+	      if ( status == FAIL)
+		{
+		  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_CHIP compression method.\n");
+		  HE5_EHprint("Error: Cannot set SZIP_CHIP compression method, occured", __FILE__, __LINE__);
+		  return(status );
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set shuffling+SZIP_CHIP method and compression    */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_CHIP");
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+		  
+	  break;
+		  
+	case HE5_HDFE_COMP_SHUF_SZIP_K13:
+		  
+	  status = H5Pset_shuffle(HE5_GDXGrid[idx].plist);
+	  if (status == FAIL)
+	    {
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot set the shuffling method. \n");
+	      HE5_EHprint("Error: Cannot set the shuffling method, occured", __FILE__, __LINE__);
+	      return(status);
+	    }
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK,compparm[0]);
+	      if ( status == FAIL)
+		{
+		  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_K13 compression method.\n");
+		  HE5_EHprint("Error: Cannot set SZIP_K13 compression method, occured", __FILE__, __LINE__);
+		  return(status );
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    } 
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set shuffling+SZIP_K13 method and compression     */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13");
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+		  
+	  break;
+		  
+	case HE5_HDFE_COMP_SHUF_SZIP_EC:
+		  
+	  status = H5Pset_shuffle(HE5_GDXGrid[idx].plist);
+	  if (status == FAIL)
+	    {
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot set the shuffling method. \n");
+	      HE5_EHprint("Error: Cannot set the shuffling method, occured", __FILE__, __LINE__);
+	      return(status);
+	    }
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_EC_OPTION_MASK,compparm[0]);
+	      if ( status == FAIL)
+		{
+		  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_EC compression method.\n");
+		  HE5_EHprint("Error: Cannot set SZIP_EC compression method, occured", __FILE__, __LINE__);
+		  return(status );
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    } 
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set shuffling+SZIP_EC method and compression      */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_EC");
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+		  
+	  break;
+		  
+	case HE5_HDFE_COMP_SHUF_SZIP_NN:
+		  
+	  status = H5Pset_shuffle(HE5_GDXGrid[idx].plist);
+	  if (status == FAIL)
+	    {
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot set the shuffling method. \n");
+	      HE5_EHprint("Error: Cannot set the shuffling method, occured", __FILE__, __LINE__);
+	      return(status);
+	    }
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_NN_OPTION_MASK,compparm[0]);
+	      if ( status == FAIL)
+		{
+		  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_NN compression method.\n");
+		  HE5_EHprint("Error: Cannot set SZIP_NN compression method, occured", __FILE__, __LINE__);
+		  return(status );
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    } 
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set shuffling+SZIP_NN method and compression      */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_NN");
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+		  
+	  break;
+		  
+	case HE5_HDFE_COMP_SHUF_SZIP_K13orEC:
+		  
+	  status = H5Pset_shuffle(HE5_GDXGrid[idx].plist);
+	  if (status == FAIL)
+	    {
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot set the shuffling method. \n");
+	      HE5_EHprint("Error: Cannot set the shuffling method, occured", __FILE__, __LINE__);
+	      return(status);
+	    }
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK,compparm[0]);
+	      if ( status == FAIL)
+		{
+		  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_K13orEC compression method.\n");
+		  HE5_EHprint("Error: Cannot set SZIP_K13orEC compression method, occured", __FILE__, __LINE__);
+		  return(status );
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    } 
+#endif
+ 
+	  /* ------------------------------------------------------ */
+	  /* Set shuffling+SZIP_K13orEC method and compression      */
+	  /*    parameters in external array                        */
+	  /* ------------------------------------------------------ */
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13orEC");
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+		  
+	  break;
+		  
+	case HE5_HDFE_COMP_SHUF_SZIP_K13orNN:
+ 
+	  status = H5Pset_shuffle(HE5_GDXGrid[idx].plist);
+	  if (status == FAIL)
+	    {
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot set the shuffling method. \n");
+	      HE5_EHprint("Error: Cannot set the shuffling method, occured", __FILE__, __LINE__);
+	      return(status);
+	    }
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK,compparm[0]);
+	      if ( status == FAIL)
+		{
+		  H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_K13orNN compression method.\n");
+		  HE5_EHprint("Error: Cannot set SZIP_K13orNN compression method, occured", __FILE__, __LINE__);
+		  return(status );
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    } 
+#endif
+		  
+	  /* ------------------------------------------------------ */
+	  /* Set shuffling+SZIP_K13orNN method and compression      */
+	  /*    parameters in external array                        */
+	  /* ------------------------------------------------------ */
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13orNN");
+	  HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+		  
+	  break;
+		  
+	case HE5_HDFE_COMP_NONE:
+		  
+	  strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_NONE");
+	  HE5_GDXGrid[idx].compparm[0] = compparm[0];
+   
+	  break;
+
+	default:
+	  {
+	    status = FAIL;
+	    H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Compression method is not specified.\n");
+	    HE5_EHprint("Error: Compression method is not specified, occured", __FILE__, __LINE__);
+	  }
+	  break;
+		  
+	}
+	  
+    }
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdeftile                                                    |
+|                                                                             |
+|  DESCRIPTION: Defines tiling parameters                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  tilecode       int                 tile code                               |
+|  tilerank       int                 number of tiling dimensions             |
+|  tiledims       hsize_t             tiling dimensions                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|  None                                                                       |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|             H5Pcreate                                                       |
+|             H5Pset_layout                                                   |
+|             H5Pset_chunk                                                    |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jan 00   A.Muslimov    Changed the datatype of tiledims[] from int32_t to  |
+|                         const hsize_t. Added retrieving/creation of the     |
+|                         property list. Added setting up of the dataset      |
+|                         chunking.                                           |
+|  Feb 00   A.Muslimov    Added error checkings.                              |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDdeftile(hid_t gridID, int tilecode, int tilerank, const hsize_t *tiledims)
+{
+
+  herr_t          status   = FAIL;          /* routine return status variable */  
+
+  int             i;                        /* Loop index                     */
+  
+  hid_t           fid      = FAIL;          /* HDF-EOS file id                */
+  hid_t           gid      = FAIL;          /* "HDFEOS" group ID              */
+  
+  long            idx      = FAIL;          /* Grid index                     */
+  
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message Buffer         */
+  int             temp_tilerank;
+  hsize_t         temp_dims[8];
+
+  HE5_LOCK;    
+  /*CHECKPOINTER(tiledims);*/
+
+  if (tilerank == 0)
+    {
+      temp_tilerank = 1;
+    }
+  else
+    {   
+      temp_tilerank = tilerank;
+    }
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDdeftile", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Initialize external array */
+      /* ------------------------- */
+      for (i = 0; i < HE5_DTSETRANKMAX; i++)
+	{
+	  HE5_GDXGrid[ idx ].tiledims[ i ] = 0;
+	}
+	  
+      HE5_GDXGrid[ idx ].tilecode = tilecode;
+
+      switch (tilecode)
+	{
+	case HE5_HDFE_NOTILE:
+
+	  HE5_GDXGrid[idx].tilerank = 0;
+
+	  break;
+
+	case HE5_HDFE_TILE:
+
+	  HE5_GDXGrid[ idx ].tilerank = temp_tilerank;
+
+	  for (i = 0; i < temp_tilerank; i++)
+	    {
+	      HE5_GDXGrid[ idx ].tiledims[ i ] = tiledims[ i ];
+
+	      if (HE5_GDXGrid[ idx ].tiledims[i] == 0)
+		{
+		  HE5_GDXGrid[ idx ].tiledims[ i ] = 1;
+		}
+	    }
+
+	  break;
+		  
+	default:
+	  {
+	    sprintf(errbuf, "Unknown tile code.\n");
+	    H5Epush(__FILE__, "HE5_GDdeftile", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  }
+	  break;
+
+	}
+
+      /* get the current dataset creation property ID from external array  */
+      /* if current property instance has not been created, then create it */
+      /* ----------------------------------------------------------------- */
+      if( HE5_GDXGrid[idx].plist == FAIL)
+	{
+	  HE5_GDXGrid[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+	  if ( HE5_GDXGrid[idx].plist == FAIL )
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot create the property list.\n");
+	      H5Epush(__FILE__, "HE5_GDdeftile", __LINE__, H5E_PLIST, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  
+	      return(status);
+	    }
+	}
+
+      /* Set layout */
+      /* ---------- */
+      status = H5Pset_layout( HE5_GDXGrid[idx].plist, H5D_CHUNKED);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot set the type of storage of the raw data to \"CHUNKED\".\n");
+	  H5Epush(__FILE__, "HE5_GDdeftile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	
+	  return(status);
+	}
+       
+      /* Set chunking */
+      /* ------------ */
+      if (tiledims == NULL)
+	{
+	  for (i = 0; i < temp_tilerank; i++)
+	    {
+	      temp_dims[ i ] = 1;
+	      HE5_GDXGrid[ idx ].tiledims[ i ] = temp_dims[ i ];
+	    }
+	}
+      else
+	{
+	  for (i = 0; i < temp_tilerank; i++)
+	    {
+	      temp_dims[ i ] = tiledims[i];
+	      HE5_GDXGrid[ idx ].tiledims[ i ] = temp_dims[ i ];
+	    }
+	}
+
+      status = H5Pset_chunk( HE5_GDXGrid[idx].plist, temp_tilerank, temp_dims); 
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot set the sizes of the chunks.\n");
+	  H5Epush(__FILE__, "HE5_GDdeftile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}  
+    }
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefcomtile                                                 |
+|                                                                             |
+|  DESCRIPTION: Defines compression type and parameters and sets tiling/      |
+|                                                       chunking              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  compcode       int                 compression code                        |
+|  compparm[]     int                 compression parameters                  |
+|  tilerank       int                 number of tiling dimensions             |
+|  tiledims       hsize_t             tiling dimensions                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|             H5Pcreate                                                       |
+|             H5Pget_layout                                                   |
+|             H5Pset_layout                                                   |
+|             H5Pset_deflate                                                  |
+|             H5Pset_szip                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer    Description                                        |
+|  ========  ============  =================================================  |
+|  07/24/00  A.Muslimov    Original development.                              |
+|  06/04/01  A.Muslimov    Added checking for compression code/level.         |
+|  09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                 |
+|  Aug  03   S.Zhao        Added Szip compression methods.                    |
+|  Oct  03   S.Zhao        Added the shuffling method.                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDdefcomtile(hid_t gridID, int compcode, int compparm[], int tilerank, const hsize_t *tiledims )
+{
+  herr_t          status   = FAIL;/* routine return status variable */
+
+  int             i;              /* Loop index                     */   
+
+  hid_t           fid      = FAIL;/* HDF-EOS file id                */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID              */
+  hid_t           (*func)(void*);
+
+  hsize_t         dims[HE5_DTSETRANKMAX];/* default dimension sizes */
+   
+  void            *edata = (void *)NULL;
+  
+  long            idx      = FAIL;/* Grid index                     */
+  
+  H5D_layout_t    layout   = H5D_LAYOUT_ERROR;/* Type of storage of the raw data */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message Buffer  */
+  int             can_encode;        /* szip encoder presence flag  */
+
+  H5Eget_auto(&func,&edata);
+  
+  HE5_LOCK;
+  CHECKPOINTER(compparm);
+  /*CHECKPOINTER(tiledims);*/
+
+  /* Check if compression code is valid */
+  /* ---------------------------------- */
+  if( compcode != HE5_HDFE_COMP_DEFLATE && compcode != HE5_HDFE_COMP_NONE &&
+      compcode != HE5_HDFE_COMP_SZIP_CHIP && compcode != HE5_HDFE_COMP_SZIP_K13 &&
+      compcode != HE5_HDFE_COMP_SZIP_EC && compcode != HE5_HDFE_COMP_SZIP_NN &&
+      compcode != HE5_HDFE_COMP_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SZIP_K13orNN &&
+      compcode != HE5_HDFE_COMP_SHUF_DEFLATE && compcode != HE5_HDFE_COMP_SHUF_SZIP_CHIP &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_K13 && compcode != HE5_HDFE_COMP_SHUF_SZIP_EC &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_NN && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orEC &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orNN )
+    {
+      status = FAIL;
+      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_ARGS, H5E_BADVALUE, "Invalid/unsupported compression code. \n");
+      HE5_EHprint("Error: Invalid/unsupported compression code, occured", __FILE__, __LINE__);
+      return(status);
+    }
+
+  if( compcode == HE5_HDFE_COMP_DEFLATE || compcode == HE5_HDFE_COMP_NONE || compcode == HE5_HDFE_COMP_SHUF_DEFLATE)
+    {
+      /* Check GZIP compression level */
+      /* ---------------------------- */
+      if( compparm[0] < 0 || compparm[0] > 9)
+	{
+	  status = FAIL;
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_ARGS, H5E_BADVALUE, "Invalid GZIP compression level. \n");
+	  HE5_EHprint("Error: Invalid GZIP compression level, occured", __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  else
+    {
+      /* Check SZIP compression block size */
+      /* --------------------------------- */
+      if( compparm[0] != 2 && compparm[0] != 4 && compparm[0] != 6 && compparm[0] != 8 &&
+	  compparm[0] != 10 && compparm[0] != 12 && compparm[0] != 14 && compparm[0] != 16 &&
+	  compparm[0] != 18 && compparm[0] != 20 && compparm[0] != 22 && compparm[0] != 24 &&
+	  compparm[0] != 26 && compparm[0] != 28 && compparm[0] != 30 && compparm[0] != 32)
+	{
+	  status = FAIL;
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_ARGS, H5E_BADVALUE, "Invalid SZIP compression block size. \n");
+	  HE5_EHprint("Error: Invalid SZIP compression block size, occured", __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+
+#ifdef H5_HAVE_FILTER_SZIP
+  can_encode = HE5_szip_can_encode();
+#endif
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDdefcomtile", &fid, &gid, &idx);
+  if (status == FAIL) 
+    {
+      sprintf(errbuf,"Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return( status );
+    }
+  
+  
+  /* Initialize arrays */
+  /* ----------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      HE5_GDXGrid[ idx ].tiledims[ i ] = 0;
+      dims[ i ] = 0;
+    }
+  
+  /* Get the current property list ID */
+  /* -------------------------------- */
+  if( HE5_GDXGrid[ idx ].plist == FAIL )
+    {
+      /* create property list */
+      /* -------------------- */
+      HE5_GDXGrid[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+      if (HE5_GDXGrid[idx].plist == FAIL )
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Cannot create the property list.");
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_PLIST, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+      /* set layout to "H5D_CHUNKED" */
+      /* --------------------------- */
+      status = H5Pset_layout( HE5_GDXGrid[idx].plist, H5D_CHUNKED);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage.");
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_STORAGE, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  else
+    {
+      /* Get layout of the raw data */
+      /* -------------------------- */
+      layout = H5Pget_layout(HE5_GDXGrid[ idx ].plist);
+      if (layout == H5D_LAYOUT_ERROR)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Cannot get the layout of the raw data.");
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_STORAGE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+      if( layout != H5D_CHUNKED )
+	{
+	  /* set layout to "H5D_CHUNKED" */
+	  /* --------------------------- */
+	  status = H5Pset_layout(HE5_GDXGrid[idx].plist, H5D_CHUNKED);
+	  if ( status == FAIL )
+	    {
+	      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set the layout.\n");
+	      HE5_EHprint("Error: Cannot set the layout, occured", __FILE__, __LINE__);
+	      return(status );
+	    }
+	}
+	   
+    }
+
+  /* Set tiling/chunking */
+  /* ------------------- */
+  if ( tilerank > 0 && tiledims != (hsize_t *)NULL)
+    {
+      status = H5Pset_chunk( HE5_GDXGrid[idx].plist, tilerank, tiledims); 
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot set the sizes of chunks.");
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+      /* Set tile/chunk sizes */
+      /* -------------------- */
+      for (i = 0; i < tilerank; i++)
+	HE5_GDXGrid[ idx ].tiledims[ i ] = tiledims[ i ];
+    }  
+  else if ( tilerank > 0 && tiledims == (hsize_t *)NULL)
+    {
+      /* Set default tile/chunk sizes */
+      /* ---------------------------- */
+      for (i = 0; i < tilerank; i++)
+	{
+	  /* dims[ i ] = HE5_CHUNKSIZE;*/
+	  dims[ i ] = 1;
+	  HE5_GDXGrid[ idx ].tiledims[ i ] = dims[ i ];
+	}
+
+      if (compcode == HE5_HDFE_COMP_NONE)
+	{
+	  HE5_GDXGrid[idx].tilecode = HE5_HDFE_NOTILE;
+	}
+
+      status = H5Pset_chunk( HE5_GDXGrid[idx].plist, tilerank, dims); 
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the sizes of chunks.");
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  else
+    {
+      sprintf(errbuf, "Invalid dataset rank: %d .", tilerank);
+      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  HE5_GDXGrid[ idx ].tilerank = tilerank;
+
+  switch(compcode)
+    {
+      /* Set NBIT compression parameters in ext. array */
+    case HE5_HDFE_COMP_NBIT:
+ 
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+      HE5_GDXGrid[ idx ].compparm[ 1 ] = compparm[ 1 ];
+      HE5_GDXGrid[ idx ].compparm[ 2 ] = compparm[ 2 ];
+      HE5_GDXGrid[ idx ].compparm[ 3 ] = compparm[ 3 ];
+ 
+      break;
+
+      /* Set compression method to HE5_HDFE_COMP_DEFLATE */
+      /* ----------------------------------------------- */
+    case HE5_HDFE_COMP_DEFLATE:
+	  
+      status = H5Pset_deflate(HE5_GDXGrid[ idx ].plist,compparm[0]);
+      if ( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set GZIP compresssion method and level.");
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      /* ------------------------------------------------- */
+      /* Set GZIP compression method and compression       */
+      /*    parameters in external array                   */
+      /* ------------------------------------------------- */
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_DEFLATE");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+	  
+      break;
+
+    case HE5_HDFE_COMP_SZIP_CHIP:
+
+#ifdef H5_HAVE_FILTER_SZIP
+      if(can_encode == 1)
+	{
+	  status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_CHIP_OPTION_MASK,compparm[0]);
+	  if ( status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set SZIP_CHIP compression method and block size.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	} 
+      else
+	{
+	  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	  H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	} 
+#endif
+	  
+      /* ------------------------------------------------- */
+      /* Set SZIP_CHIP compression method and compression  */
+      /*    parameters in external array                   */
+      /* ------------------------------------------------- */
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_CHIP");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+	  
+      break;
+	  
+    case HE5_HDFE_COMP_SZIP_K13:
+
+#ifdef H5_HAVE_FILTER_SZIP
+      if(can_encode == 1)
+	{
+	  status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_EC_OPTION_MASK,compparm[0]);
+	  if ( status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set SZIP_K13 cmpression method and block size.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	} 
+      else
+	{
+	  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	  H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	} 
+#endif
+
+      /* ------------------------------------------------- */ 
+      /* Set SZIP_K13 compression method and compression   */
+      /*    parameters in external array                   */
+      /* ------------------------------------------------- */
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_K13");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+ 
+      break;
+
+    case HE5_HDFE_COMP_SZIP_EC:
+
+#ifdef H5_HAVE_FILTER_SZIP
+      if(can_encode == 1)
+	{
+	  status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_EC_OPTION_MASK,compparm[0]);
+	  if ( status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set SZIP_EC compression method and block size.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	} 
+      else
+	{
+	  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	  H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	} 
+#endif
+	  
+      /* ------------------------------------------------- */
+      /* Set SZIP_EC compression method and compression    */
+      /*    parameters in external array                   */
+      /* ------------------------------------------------- */
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_EC");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+
+      break;
+ 
+    case HE5_HDFE_COMP_SZIP_NN:
+
+#ifdef H5_HAVE_FILTER_SZIP
+      if(can_encode == 1)
+	{
+	  status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_NN_OPTION_MASK,compparm[0]);
+	  if ( status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set SZIP_NN compression method and block size.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	} 
+      else
+	{
+	  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	  H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	} 
+#endif
+	  
+      /* ------------------------------------------------- */
+      /* Set SZIP_NN compression method and compression    */
+      /*    parameters in external array                   */
+      /* ------------------------------------------------- */
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_NN");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+
+      break;
+
+    case HE5_HDFE_COMP_SZIP_K13orEC:
+
+#ifdef H5_HAVE_FILTER_SZIP
+      if(can_encode == 1)
+	{
+	  status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK,compparm[0]);
+	  if ( status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set SZIP_K13orEC compression method and block size.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	} 
+      else
+	{
+	  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	  H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	} 
+#endif
+	   
+      /* ---------------------------------------------------------- */
+      /* Set SZIP_K13orEC compression method and compression        */
+      /*    parameters in external array                            */
+      /* ---------------------------------------------------------- */
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_K13orEC");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+ 
+      break;
+ 
+    case HE5_HDFE_COMP_SZIP_K13orNN:
+
+#ifdef H5_HAVE_FILTER_SZIP
+      if(can_encode == 1)
+	{
+	  status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK,compparm[0]);
+	  if ( status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set SZIP_K13orNN compression method and block size.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	} 
+      else
+	{
+	  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	  H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	} 
+#endif
+	   
+      /* ---------------------------------------------------------- */
+      /* Set SZIP_K13orNN compression method and compression        */
+      /*    parameters in external array                            */
+      /* ---------------------------------------------------------- */
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_K13orNN");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+ 
+      break;
+
+    case HE5_HDFE_COMP_SHUF_DEFLATE:
+         
+      status = H5Pset_shuffle(HE5_GDXGrid[idx].plist);
+      if ( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the shuffling method.");
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+          
+      status = H5Pset_deflate(HE5_GDXGrid[ idx ].plist,compparm[0]);
+      if ( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set GZIP compresssion method and level.");
+	  H5Epush(__FILE__,"HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+      /* ------------------------------------------------- */
+      /* Set shuffling+GZIP method and compression         */
+      /*    parameters in external array                   */
+      /* ------------------------------------------------- */
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_DEFLATE");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+         
+      break;
+ 
+    case HE5_HDFE_COMP_SHUF_SZIP_CHIP:
+         
+      status = H5Pset_shuffle(HE5_GDXGrid[idx].plist);
+      if ( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the shuffling method.");
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+#ifdef H5_HAVE_FILTER_SZIP
+      if(can_encode == 1)
+	{
+	  status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_CHIP_OPTION_MASK,compparm[0]);
+	  if ( status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set SZIP_CHIP compression method and block size.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	} 
+      else
+	{
+	  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	  H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	} 
+#endif
+	   
+      /* ------------------------------------------------- */
+      /* Set shuffling+SZIP_CHIP method and compression    */
+      /*    parameters in external array                   */
+      /* ------------------------------------------------- */
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_CHIP");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+ 
+      break;
+ 
+    case HE5_HDFE_COMP_SHUF_SZIP_K13:
+ 
+      status = H5Pset_shuffle(HE5_GDXGrid[idx].plist);
+      if ( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the shuffling method.");
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+#ifdef H5_HAVE_FILTER_SZIP
+      if(can_encode == 1)
+	{
+	  status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_EC_OPTION_MASK,compparm[0]);
+	  if ( status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set SZIP_K13 cmpression method and block size.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	} 
+      else
+	{
+	  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	  H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	} 
+#endif
+	   
+      /* ------------------------------------------------- */
+      /* Set shuffling+SZIP_K13 method and compression     */
+      /*    parameters in external array                   */
+      /* ------------------------------------------------- */
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+ 
+      break;
+ 
+    case HE5_HDFE_COMP_SHUF_SZIP_EC:
+ 
+      status = H5Pset_shuffle(HE5_GDXGrid[idx].plist);
+      if ( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the shuffling method.");
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+#ifdef H5_HAVE_FILTER_SZIP
+      if(can_encode == 1)
+	{
+	  status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_EC_OPTION_MASK,compparm[0]);
+	  if ( status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set SZIP_EC compression method and block size.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	} 
+      else
+	{
+	  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	  H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	} 
+#endif
+	   
+      /* ------------------------------------------------- */
+      /* Set shuffling+SZIP_EC method and compression      */
+      /*    parameters in external array                   */
+      /* ------------------------------------------------- */
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_EC");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+ 
+      break;
+ 
+    case HE5_HDFE_COMP_SHUF_SZIP_NN:
+ 
+      status = H5Pset_shuffle(HE5_GDXGrid[idx].plist);
+      if ( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the shuffling method.");
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+#ifdef H5_HAVE_FILTER_SZIP
+      if(can_encode == 1)
+	{
+	  status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_NN_OPTION_MASK,compparm[0]);
+	  if ( status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set SZIP_NN compression method and block size.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	} 
+      else
+	{
+	  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	  H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	} 
+#endif
+	   
+      /* ------------------------------------------------- */
+      /* Set shuffling+SZIP_NN method and compression      */
+      /*    parameters in external array                   */
+      /* ------------------------------------------------- */
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_NN");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+ 
+      break;
+ 
+    case HE5_HDFE_COMP_SHUF_SZIP_K13orEC:
+ 
+      status = H5Pset_shuffle(HE5_GDXGrid[idx].plist);
+      if ( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the shuffling method.");
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+#ifdef H5_HAVE_FILTER_SZIP
+      if(can_encode == 1)
+	{
+	  status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK,compparm[0]);
+	  if ( status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set SZIP_K13orEC compression method and block size.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	} 
+      else
+	{
+	  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	  H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	} 
+#endif
+	   
+      /* ---------------------------------------------------------- */
+      /* Set shuffling+SZIP_K13orEC method and compression          */
+      /*    parameters in external array                            */
+      /* ---------------------------------------------------------- */
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13orEC");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+ 
+      break;
+ 
+    case HE5_HDFE_COMP_SHUF_SZIP_K13orNN:
+ 
+      status = H5Pset_shuffle(HE5_GDXGrid[idx].plist);
+      if ( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the shuffling method.");
+	  H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+#ifdef H5_HAVE_FILTER_SZIP
+      if(can_encode == 1)
+	{
+	  status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK,compparm[0]);
+	  if ( status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set SZIP_K13orNN compression method and block size.\n");
+	      H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	} 
+      else
+	{
+	  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	  H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	} 
+#endif
+	   
+      /* ---------------------------------------------------------- */
+      /* Set shuffling+SZIP_K13orNN method and compression          */
+      /*    parameters in external array                            */
+      /* ---------------------------------------------------------- */
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13orNN");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+ 
+      break;
+
+    case HE5_HDFE_COMP_NONE:
+
+      strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_NONE");
+      HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ];
+
+      break;
+
+    default:
+      {
+	status = FAIL;
+	sprintf(errbuf, "Compression method is not specified.\n"); 
+	H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	HE5_EHprint(errbuf, __FILE__, __LINE__);
+      }
+      break;
+	  
+    }
+	   
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdeforigin                                                  |
+|                                                                             |
+|  DESCRIPTION: Defines the origin of the grid data.                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  origincode     int                 origin code                             |
+|                                     HDFE_GD_UL (0)                          |
+|                                     HDFE_GD_UR (1)                          |
+|                                     HDFE_GD_LL (2)                          |
+|                                     HDFE_GD_LR (3)                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/20/99  A.Muslimov    In the call to EHinsertmeta() replaced the argument |
+|                         gid by fid.                                         |
+|  9/27/99  A.Muslimov    Added proper error handlings. Removed redundant     |
+|                         if(status == 0){} brackets.                         |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDdeforigin(hid_t gridID, int origincode)
+{
+  herr_t          status = FAIL;              /* routine return status variable */
+  
+  hid_t           fid    = FAIL;              /* HDF-EOS file ID                */
+  hid_t           gid    = FAIL;              /* "HDFEOS" group ID              */
+  
+  long            idx    = FAIL;              /* Grid index                     */
+  
+  char            *utlbuf = (char *)NULL;    /* Utility buffer                  */
+  char            *errbuf = (char *)NULL;    /* Buffer for error message        */
+  char            *originNames[] = {"HE5_HDFE_GD_UL", "HE5_HDFE_GD_UR", "HE5_HDFE_GD_LL", "HE5_HDFE_GD_LR"};
+
+
+  HE5_LOCK;
+  
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdeforigin", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDdeforigin", &fid, &gid, &idx);
+  if ( status == FAIL)
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDdeforigin", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+  
+  utlbuf  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if( utlbuf  == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_GDdeforigin", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	  
+      return(FAIL);
+    }
+  
+  /* If proper origin code then write to structural metadata */
+  /* ------------------------------------------------------- */
+  if (origincode >= 0 && origincode <= 3)
+    {
+      sprintf(utlbuf, "%s%s%s", "\t\tGridOrigin=", originNames[origincode], "\n");
+
+      status = HE5_EHinsertmeta(fid, HE5_GDXGrid[idx].gdname, "g", 101L,  utlbuf, NULL);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot insert metadata.");
+	  H5Epush(__FILE__, "HE5_GDdeforigin", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+
+    }
+  else
+    {
+      status = FAIL;
+      sprintf(errbuf, "Improper Grid Origin code: %d\n", origincode);
+      H5Epush(__FILE__,  "HE5_GDdeforigin", __LINE__, H5E_FILE, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  free(utlbuf);
+  free(errbuf);
+  utlbuf = NULL;
+  errbuf = NULL;
+  
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefpixreg                                                  |
+|                                                                             |
+|  DESCRIPTION: Defines pixel registration within grid cell.                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  pixregcode     int     None        Pixel registration code                 |
+|                                     HDFE_CENTER (0)                         |
+|                                     HDFE_CORNER (1)                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/20/99  A.Muslimov    In the call to EHinsertmeta() replaced gid by fid.  |
+|  9/27/99  A.Muslimov    Added proper error hadlings. Removed redundant      |
+|                         if(status == 0){} brackets.                         |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDdefpixreg(hid_t gridID, int pixregcode)
+{
+  herr_t          status = FAIL;            /* routine return status variable */
+  
+  hid_t           fid    = FAIL;            /* HDF-EOS file ID                */
+  hid_t           gid    = FAIL;            /* "HDFEOS" group ID              */
+  
+  long            idx    = FAIL;            /* Grid index                     */
+  
+  char            *utlbuf = (char *)NULL;   /* Utility buffer                 */
+  char            *pixregNames[] = {"HE5_HDFE_CENTER", "HE5_HDFE_CORNER"};/* Pixel Registration Codes */
+  char            *errbuf = (char *)NULL;   /* Buffer for error message       */ 
+
+
+  HE5_LOCK;
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdefpixreg", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDdefpixreg", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDdefpixreg", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+  
+  /* Allocate memory for utility buffer */
+  utlbuf  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if(utlbuf == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_GDdefpixreg", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+  
+  
+  
+  /* If proper pix reg code then write to structural metadata */
+  /* -------------------------------------------------------- */
+  if (pixregcode >= 0 && pixregcode <= 1)
+    {
+      sprintf(utlbuf, "%s%s%s", "\t\tPixelRegistration=", pixregNames[pixregcode], "\n");
+
+      status = HE5_EHinsertmeta(fid, HE5_GDXGrid[idx].gdname, "g", 101L,utlbuf, NULL);
+      if(status == FAIL)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Cannot insert metadata.\n");
+	  H5Epush(__FILE__, "HE5_GDdefpixreg", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+
+    }
+  else
+    {
+      status = FAIL;
+      sprintf(errbuf, "Improper Pixel Registration code: %d\n", pixregcode);
+      H5Epush(__FILE__, "HE5_GDdefpixreg", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  free(utlbuf);
+  free(errbuf);
+  
+  utlbuf = NULL;
+  errbuf = NULL;
+  
+ COMPLETION:
+  HE5_UNLOCK;  
+  return (status);
+
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdiminfo                                                    |
+|                                                                             |
+|  DESCRIPTION: Retrieve size of specified dimension.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  size           hsize_t None        Size of dimension                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  dimname        char*   None        Dimension name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/21/99  A.Muslimov    In the call to EHmetagroup() replaced the argument  |
+|                         gid by fid.                                         |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 04/11/01  A.Muslimov    Initialized size to 0, but "Unlim" returns -1!,     |
+|                          not 0!                                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hsize_t
+HE5_GDdiminfo(hid_t gridID, char *dimname)
+{
+  hsize_t       size   = 0;              /* Dimension size (return value)  */
+
+  herr_t        status = FAIL;           /* routine return status variable */
+  
+  hid_t         fid    = FAIL;           /* HDF-EOS file ID                */
+  hid_t         gid    = FAIL;           /* "HDFEOS" group ID              */
+  
+  long          idx    = FAIL;           /* Grid index                     */
+    
+  char          *metabuf = (char *)NULL;   /* Pointer to structural metadata (SM)     */
+  char          *metaptrs[2] = {NULL,NULL};/* Pointers to begin and end of SM section */
+  char          *utlstr  = (char *)NULL;   /* Utility string                          */
+  char          *errbuf  = (char *)NULL;   /* Buffer for error mesage                 */
+  
+  CHECKPOINTER(dimname);
+  
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdiminfo", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(0);
+    }
+
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDdiminfo", &fid, &gid, &idx);
+  if ( status == FAIL)
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDdiminfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(0);
+    }
+  
+  /* Allocate memory for utility string */
+  /* ---------------------------------- */
+  utlstr  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if(utlstr == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for utility string.\n");
+      H5Epush(__FILE__, "HE5_GDdiminfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(0);
+    }
+  
+  
+  /* Get pointers to "Dimension" section within SM */
+  /* --------------------------------------------- */
+  metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g", "Dimension", metaptrs);
+  if(metabuf == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for metabuffer.\n");
+      H5Epush(__FILE__, "HE5_GDdiminfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(utlstr);
+	 
+      return(0);
+    }
+  
+  /* Search for dimension name (surrounded by quotes) */
+  /* ------------------------------------------------ */
+  sprintf(utlstr, "%s%s%s", "\"", dimname, "\"\n");
+  metaptrs[0] = strstr(metaptrs[0], utlstr);
+  
+  /*
+   * If dimension found within grid structure then get dimension value
+   */
+  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+    {
+      /* Set endptr at end of dimension definition entry */
+      metaptrs[1] = strstr(metaptrs[0], "\t\t\tEND_OBJECT");
+
+      status = HE5_EHgetmetavalue(metaptrs, "Size", utlstr);
+      if (status == SUCCEED)
+	size = atol(utlstr);
+      else
+	{
+	  size = 0;
+	  sprintf(errbuf,  "\"Size\" string not found in metadata.");
+	  H5Epush(__FILE__, "HE5_GDdiminfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+  else
+    {
+      size = 0;    
+      sprintf(errbuf, "Dimension \"%s\" not found.", dimname);
+      H5Epush(__FILE__, "HE5_GDdiminfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  free(metabuf);
+  free(utlstr);
+  free(errbuf);
+  
+  metabuf = NULL;
+  utlstr = NULL;
+  errbuf = NULL;
+ 
+ COMPLETION:
+  return(size);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgridinfo                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns xdim, ydim and location of upper left and lower       |
+|                right corners, in meters.                                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  xdimsize       long                Number of columns in grid               |
+|  ydimsize       long                Number of rows in grid                  |
+|  upleftpt       double              Location (m/deg) of upper left corner   |
+|  lowrightpt     double              Location (m/deg) of lower right corner  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/21/99  A.Muslimov    In the call to EHmetagroup() replaced the argument  |
+|                         gid by fid. Changed the data type of statmeta from  |
+|                         intn to int   .                                     |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDgridinfo(hid_t gridID, long *xdimsize, long *ydimsize, double upleftpt[], double lowrightpt[])
+{
+  herr_t          status   = FAIL;           /* routine return status variable          */
+  herr_t          statmeta = FAIL;           /* EHgetmetavalue return status            */
+  
+  hid_t           fid      = FAIL;           /* HDF-EOS file ID                         */
+  hid_t           gid      = FAIL;           /* "HDFEOS" group ID                       */
+  
+  long            idx      = FAIL;           /* Grid index                              */
+  
+  char            *metabuf = (char *)NULL;   /* Pointer to structural metadata (SM)     */
+  char            *metaptrs[2] = {NULL,NULL};/* Pointers to begin and end of SM section */
+  char            *utlstr = (char *)NULL;    /* Utility string                          */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];
+  
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDgridinfo", &fid, &gid, &idx);
+  if ( status == FAIL)
+    {
+      sprintf(errbuf,"Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDgridinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	
+      return( FAIL );
+    }
+  
+  /* Allocate memory for utility string */
+  /* ---------------------------------- */
+  utlstr  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if(utlstr == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for utility string.\n");
+      H5Epush(__FILE__, "HE5_GDgridinfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	
+      return(FAIL);
+    }
+  
+  /* Get pointers to grid structure section within SM */
+  /* ------------------------------------------------ */
+  metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g", NULL, metaptrs);
+  if(metabuf == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for metabuffer  string.\n");
+      H5Epush(__FILE__, "HE5_GDgridinfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(utlstr);
+	    
+      return(FAIL);
+    }
+  
+  /* Get xdimsize if requested */
+  /* ------------------------- */
+  if (xdimsize != NULL)
+    {
+      statmeta = HE5_EHgetmetavalue(metaptrs, "XDim", utlstr);
+      if (statmeta == SUCCEED)
+	{
+	  *xdimsize = atol(utlstr);
+	}
+      else
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "\"XDim\" string not found in metadata.\n");
+	  H5Epush(__FILE__, "HE5_GDgridinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+  
+  /* Get ydimsize if requested */
+  /* ------------------------- */
+  if (ydimsize != NULL)
+    {
+      statmeta = HE5_EHgetmetavalue(metaptrs, "YDim", utlstr);
+      if (statmeta == SUCCEED)
+	{
+	  *ydimsize = atol(utlstr);
+	}
+      else
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "\"YDim\" string not found in metadata.\n");
+	  H5Epush(__FILE__, "HE5_GDgridinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+  
+  
+  /* Get upleftpt if requested */
+  /* ------------------------- */
+  if (upleftpt != NULL)
+    {
+      statmeta = HE5_EHgetmetavalue(metaptrs, "UpperLeftPointMtrs", utlstr);
+      if (statmeta == SUCCEED)
+	{
+	  /* If value is "DEFAULT" then return zeros */
+	  /* --------------------------------------- */
+	  if (strcmp(utlstr, "DEFAULT") == 0)
+	    {
+	      upleftpt[0] = 0;
+	      upleftpt[1] = 0;
+	    }
+	  else
+	    {
+	      sscanf(utlstr, "(%lf,%lf)", &upleftpt[0], &upleftpt[1]);
+	    }
+	}
+      else
+	{
+	  status = FAIL;
+	  sprintf( errbuf, "\"UpperLeftPointMtrs\" string not found in metadata.\n");
+	  H5Epush(__FILE__, "HE5_GDgridinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+
+    }
+  
+  /* Get lowrightpt if requested */
+  /* --------------------------- */
+  if (lowrightpt != NULL)
+    {
+      statmeta = HE5_EHgetmetavalue(metaptrs, "LowerRightMtrs", utlstr);
+      if (statmeta == SUCCEED)
+	{
+	  /* If value is "DEFAULT" then return zeros */
+	  if (strcmp(utlstr, "DEFAULT") == 0)
+	    {
+	      lowrightpt[0] = 0;
+	      lowrightpt[1] = 0;
+	    }
+	  else
+	    {
+	      sscanf(utlstr, "(%lf,%lf)", &lowrightpt[0], &lowrightpt[1]);
+	    }
+	}
+      else
+	{
+	  status = FAIL;
+	  sprintf( errbuf,"\"LowerRightMtrs\"  string not found in metadata.\n");
+	  H5Epush(__FILE__, "HE5_GDgridinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+  
+  free(metabuf);
+  free(utlstr);
+   
+  metabuf = NULL; 
+  utlstr  = NULL;
+  
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDprojinfo                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns GCTP projection code, zone code, spheroid code        |
+|                and projection parameters.                                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  projcode       int                 GCTP projection code                    |
+|  zonecode       int                 UTM zone code                           |
+|  spherecode     int                 GCTP spheriod code                      |
+|  projparm       double              Projection parameters                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/21/99  A.Muslimov    In the call to EHmetagroup() replaced the argument  |
+|                         gid by fid. Changed the datatype of statmeta from   |
+|                         intn to int   , and initialized the return statuses |
+|                         to -1.                                              |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDprojinfo(hid_t gridID, int *projcode,  int *zonecode, int *spherecode, double projparm[])
+{
+
+  herr_t          status   = FAIL;    /* routine return status variable */
+  herr_t          statmeta = FAIL;    /* EHgetmetavalue return status   */  
+
+  int             i;                  /* Loop index                     */
+  
+  hid_t           fid      = FAIL;    /* HDF-EOS file ID                */
+  hid_t           gid      = FAIL;    /* "HDFEOS" group ID              */
+  
+  long            idx      = FAIL;    /* Grid index                     */
+  
+  char            *metabuf = (char *)NULL;   /*Pointer to structural metadata (SM)      */
+  char            *metaptrs[2] = {NULL,NULL};/* Pointers to begin and end of SM section */
+  char            *utlstr  = (char *)NULL;   /* Utility string                          */
+  char            fmt[96];                   /* Format String                           */
+  char            *GCTPproj[128] = {"HE5_GCTP_GEO", "HE5_GCTP_UTM", "HE5_GCTP_SPCS", 
+				    "HE5_GCTP_ALBERS", "HE5_GCTP_LAMCC", "HE5_GCTP_MERCAT", "HE5_GCTP_PS", 
+				    "HE5_GCTP_POLYC", "HE5_GCTP_EQUIDC", "HE5_GCTP_TM", "HE5_GCTP_STEREO", 
+				    "HE5_GCTP_LAMAZ", "HE5_GCTP_AZMEQD", "HE5_GCTP_GNOMON", "HE5_GCTP_ORTHO",
+				    "HE5_GCTP_GVNSP","HE5_GCTP_SNSOID", "HE5_GCTP_EQRECT", "HE5_GCTP_MILLER",
+				    "HE5_GCTP_VGRINT","HE5_GCTP_HOM", "HE5_GCTP_ROBIN","HE5_GCTP_SOM",
+				    "HE5_GCTP_ALASKA", "HE5_GCTP_GOOD", "HE5_GCTP_MOLL","HE5_GCTP_IMOLL",
+				    "HE5_GCTP_HAMMER","HE5_GCTP_WAGIV", "HE5_GCTP_WAGVII","HE5_GCTP_OBLEQA"
+				    /*,"HE5_GCTP_CEA", "HE5_GCTP_BCEA", "HE5_GCTP_ISINUS"*/};/* GCTP projection codes */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDprojinfo", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return( FAIL);
+    }
+  
+  
+  /* Allocate memory for utility string */
+  /* ---------------------------------- */
+  utlstr  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if(utlstr == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for utility string.\n");
+      H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Add "non-standard" GCTP codes */
+  /* ----------------------------- */  
+  GCTPproj[ 97 ] = (char *)calloc( HE5_HDFE_NAMBUFSIZE,  sizeof(char) );
+  if(GCTPproj[ 97 ] == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(utlstr);
+  
+      return(FAIL);
+    }
+  strcpy(GCTPproj[97], "HE5_GCTP_CEA");
+ 
+  GCTPproj[ 98 ] = (char *)calloc( HE5_HDFE_NAMBUFSIZE,  sizeof(char) );
+  if(GCTPproj[ 98 ] == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(utlstr);
+      free(GCTPproj[ 97 ]); 
+      return(FAIL);
+    }
+  strcpy(GCTPproj[98], "HE5_GCTP_BCEA");
+
+
+  GCTPproj[99] = (char *) calloc( HE5_HDFE_NAMBUFSIZE, sizeof(char) );
+  if(GCTPproj[99] == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for GCTP codes string.\n");
+      H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(utlstr);
+      free(GCTPproj[ 97 ]);
+      free(GCTPproj[ 98 ]);
+      return(FAIL);
+    }
+  strcpy(GCTPproj[99],"HE5_GCTP_ISINUS");
+  
+  /* Get pointers to grid structure section within SM */
+  /* ------------------------------------------------ */
+  metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g", NULL, metaptrs);
+  if(metabuf == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for metabuffer string.\n");
+      H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(utlstr);
+      free(GCTPproj[ 97 ]);
+      free(GCTPproj[ 98 ]);
+      free(GCTPproj[99]);
+	    
+      return(FAIL);
+    }
+  
+  /* Get projcode if requested */
+  /* ------------------------- */
+  if (projcode != NULL)
+    {
+      *projcode = FAIL;
+		
+      statmeta = HE5_EHgetmetavalue(metaptrs, "Projection", utlstr);
+      if (statmeta == SUCCEED)
+	{
+	  /* Loop through projection codes until found */
+	  /* ----------------------------------------- */
+	  for (i = 0; i < 128; i++)
+	    {
+	      if (GCTPproj[i] != NULL)
+		{
+		  if (strcmp(utlstr, GCTPproj[i]) == 0)
+		    {
+		      *projcode = i;
+		      break;
+		    }
+		}
+	    }
+	}
+      else
+	{
+	  sprintf(errbuf, "Projection Code not defined for \"%s\".\n", HE5_GDXGrid[idx].gdname);
+	  H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (projparm != NULL)
+	    {
+	      for (i = 0; i < 13; i++)
+		{
+		  projparm[i] = FAIL;
+		}
+	    }
+	  free(utlstr);
+	  free(GCTPproj[97]);
+	  free(GCTPproj[98]);
+	  free(GCTPproj[99]);
+	  free(metabuf);
+			
+	  return(FAIL);
+			
+	}
+    }
+  
+  
+  /* Get zonecode if requested */
+  /* ------------------------- */
+  if (zonecode != NULL)
+    {
+      *zonecode = FAIL;
+		
+      /* Zone code only relevant for UTM and State Code projections */
+      /* ---------------------------------------------------------- */
+      if (*projcode == HE5_GCTP_UTM || *projcode == HE5_GCTP_SPCS)
+	{
+	  statmeta = HE5_EHgetmetavalue(metaptrs, "ZoneCode", utlstr);
+	  if (statmeta == SUCCEED)
+	    {
+	      *zonecode = atoi(utlstr);
+	    }
+	  else
+	    {
+	      sprintf(errbuf, "Zone Code not defined for \"%s\".\n", HE5_GDXGrid[idx].gdname);
+	      H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(utlstr);
+	      free(GCTPproj[97]);
+	      free(GCTPproj[98]);
+	      free(GCTPproj[99]);
+	      free(metabuf);
+					
+	      return(FAIL);
+	    }
+	}
+    }
+  
+  /* Get projection parameters if requested */
+  /* -------------------------------------- */
+  if (projparm != NULL)
+    {
+
+      /*
+       * Note: No projection parameters for GEO, UTM, and State Code
+       * projections
+       */
+      if (*projcode == HE5_GCTP_GEO || *projcode == HE5_GCTP_UTM || *projcode == HE5_GCTP_SPCS)
+	{
+	  for (i = 0; i < 13; i++)
+	    {
+	      projparm[i] = 0.0;
+	    }
+
+	}
+      else
+	{
+	  statmeta = HE5_EHgetmetavalue(metaptrs, "ProjParams", utlstr);
+	  if (statmeta == SUCCEED)
+	    {
+
+	      /* Build format string to read projection parameters */
+	      /* ------------------------------------------------- */
+	      strcpy(fmt, "%lf,");
+	      for (i = 1; i <= 11; i++)
+		strcat(fmt, "%lf,");
+	      strcat(fmt, "%lf");
+					
+					
+	      /* Read parameters from numeric list */
+	      /* --------------------------------- */
+	      sscanf(&utlstr[1], fmt,
+		     &projparm[0], &projparm[1],
+		     &projparm[2], &projparm[3],
+		     &projparm[4], &projparm[5],
+		     &projparm[6], &projparm[7],
+		     &projparm[8], &projparm[9],
+		     &projparm[10], &projparm[11],
+		     &projparm[12]);
+	    }
+	  else
+	    {
+	      sprintf(errbuf, "Projection parameters not defined for \"%s\".\n", HE5_GDXGrid[idx].gdname);
+	      H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(utlstr);
+	      free(GCTPproj[97]);
+	      free(GCTPproj[98]);
+	      free(GCTPproj[99]);
+	      free(metabuf);
+					
+	      return(FAIL);
+	    }
+	}
+    }
+  
+  
+  /* Get spherecode if requested */
+  /* --------------------------- */
+  if (spherecode != NULL)
+    {
+      *spherecode = 0;
+		
+      /* Note: Spherecode not defined for GEO projection */
+      /* ----------------------------------------------- */
+      if (*projcode != HE5_GCTP_GEO)
+	{
+	  statmeta = HE5_EHgetmetavalue(metaptrs, "SphereCode", utlstr);
+	  if (statmeta == SUCCEED)
+	    {
+	      *spherecode = atoi(utlstr);
+	    }
+	}
+    }
+  
+  free(metabuf);
+  free(GCTPproj[97]);
+  free(GCTPproj[98]);
+  free(GCTPproj[99]);
+  free(utlstr);
+  
+  metabuf      = NULL;
+  GCTPproj[97] = NULL;
+  GCTPproj[98] = NULL;
+  GCTPproj[99] = NULL;
+  utlstr       = NULL;
+  
+  return (status);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDorigininfo                                                 |
+|                                                                             |
+|  DESCRIPTION: Returns origin code                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  origincode     int                   grid origin code                      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/21/99  A.Muslimov    In the call to EHmetagroup() replaced the argument  |
+|                         gid by fid.  Changed the type of statmeta from intn |
+|                         to int   , and  initialized the return statuses to  |
+|                         -1.                                                 |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Mar 04   S.Zhao        Changed the default origin code from 0 to FAIL.     |
+|  Aug 11   Abe Taaheri   Modified to return default value if it is not found |
+|                         in structure metadata                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDorigininfo(hid_t gridID, int *origincode)
+{
+
+  herr_t          status   = FAIL;          /* routine return status variable */
+  herr_t          statmeta = FAIL;          /* EHgetmetavalue return status   */  
+
+  int             i;                        /* Loop index                     */
+  
+  hid_t           fid      = FAIL;          /* HDF-EOS file ID                */
+  hid_t           gid      = FAIL;          /* "HDFEOS" group ID              */
+  
+  long            idx      = FAIL;          /* Grid index                     */
+  
+  char            *metabuf = (char *)NULL;      /* Pointer to structural metadata (SM)     */
+  char            *metaptrs[2] = {NULL,NULL};   /* Pointers to begin and end of SM section */
+  char            *utlstr  = (char *)NULL;      /* Utility string                          */
+  char            *originNames[] = {"HE5_HDFE_GD_UL", "HE5_HDFE_GD_UR","HE5_HDFE_GD_LL", "HE5_HDFE_GD_LR"};                                      /* Array of origin codes                   */
+  char            *errbuf = (char *)NULL;/* Buffer for error message                */ 
+  
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDorigininfo", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDorigininfo", &fid, &gid, &idx);
+  if ( status == FAIL)
+    {
+      *origincode = FAIL;
+      sprintf(errbuf,"Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDorigininfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+  
+  /* Allocate memory for utility string */
+  /* ---------------------------------- */
+  utlstr  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if(utlstr == NULL)
+    {
+      *origincode = FAIL;
+      sprintf(errbuf, "Cannot allocate memory for utility string.\n");
+      H5Epush(__FILE__, "HE5_GDorigininfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(FAIL);
+    }
+  
+  /* Set default origin code */
+  /* ----------------------- */
+  *origincode = FAIL;
+  
+  /* Get pointers to grid structure section within SM */
+  /* ------------------------------------------------ */
+  metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g",NULL, metaptrs);
+  if(metabuf == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for metabuffer string.\n");
+      H5Epush(__FILE__, "HE5_GDorigininfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(utlstr);
+	    
+      return(FAIL);
+    }
+  
+  /* Get "GridOrigin" metadata string */
+  /* -------------------------------- */
+  statmeta = HE5_EHgetmetavalue(metaptrs, "GridOrigin", utlstr);
+  if (statmeta == FAIL)
+    {
+      /* return default value */
+      status = 0;
+      *origincode = 0;
+      
+      /*
+      sprintf(errbuf,"Cannot get metadata string.\n");
+      H5Epush(__FILE__, "HE5_GDorigininfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status=FAIL;
+      */
+
+      free(errbuf);
+      free(utlstr);
+      free(metabuf);
+      metabuf = NULL;
+      utlstr = NULL;
+      errbuf = NULL;
+   
+      return(status);
+    }
+  
+  /*
+   * If "GridOrigin" string found in metadata then convert to
+   *        numeric origin code (fixed added: Jan 97)
+   */
+  for (i = 0; i < 4; i++)
+    {
+      if (strcmp(utlstr, originNames[i]) == 0)
+	{
+	  *origincode = i;
+	  break;
+	}
+    }
+  
+  
+  free(metabuf);
+  free(utlstr);
+  free(errbuf);
+  
+  metabuf = NULL;
+  utlstr = NULL;
+  errbuf = NULL;
+  
+  return (status);
+
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDpixreginfo                                                 |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  pixregcode     int       None      Pixel registration code                 |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/21/99  A.Muslimov    In the call to EHmetagroup() replaced the argument  |
+|                         gid by fid. Changed the type of statmeta from intn  |
+|                         to int   , and  initialized the return statuses to  |
+|                         -1.                                                 |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Mar 04   S.Zhao        Changed the default pixreg code from 0 to FAIL.     |
+|  Aug 11   Abe Taaheri   Modified to return default value if it is not found |
+|                         in structure metadata                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDpixreginfo(hid_t gridID, int *pixregcode)
+{
+
+  herr_t          status   = FAIL;      /* routine return status variable */
+  herr_t          statmeta = FAIL;      /* EHgetmetavalue return status   */  
+
+  int             i;                    /* Loop index                     */
+  
+  hid_t           fid    = FAIL;        /* HDF-EOS file ID                */
+  hid_t           gid    = FAIL;        /* "HDFEOS" group ID              */
+  
+  long            idx    = FAIL;        /* Grid index                     */
+  
+  char            *metabuf = (char *)NULL;      /* Ptr to structural metadata (SM) */
+  char            *metaptrs[2] = {NULL,NULL};   /* Ptrs to begin/end of SM section */
+  char            *utlstr = (char *)NULL;       /* Utility string                  */
+  char            *pixregNames[] = {"HE5_HDFE_CENTER", "HE5_HDFE_CORNER"};/* Pixel Registration Codes */
+  char            *errbuf = (char *)NULL;                                 /* Buffer for error message */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDpixreginfo", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDpixreginfo", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      *pixregcode = FAIL;
+      sprintf(errbuf,"Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDpixreginfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return( FAIL );
+    }
+  
+  /* Set default pixreg code */
+  /* ----------------------- */
+  *pixregcode = FAIL;
+  
+  /* Allocate memory for utility string */
+  /* ---------------------------------- */
+  utlstr  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if(utlstr == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for utility string.\n");
+      H5Epush(__FILE__, "HE5_GDpixreginfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	 
+      return(FAIL);
+    }
+  
+  
+  /* Get pointers to Grid structure section within SM */
+  /* ------------------------------------------------ */
+  metabuf = (char *)HE5_EHmetagroup(fid , HE5_GDXGrid[idx].gdname, "g",  NULL, metaptrs);
+  if(metabuf == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for metabuffer string.\n");
+      H5Epush(__FILE__, "HE5_GDpixreginfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(utlstr);
+	    
+      return(FAIL);
+    }
+  
+  /* Get "PixelRegistration" metadata string */
+  /* --------------------------------------- */
+  statmeta = HE5_EHgetmetavalue(metaptrs, "PixelRegistration", utlstr);
+
+  if (statmeta == FAIL)
+    {
+      /* return default value */
+      status = 0;
+      *pixregcode = 0;
+ 
+      /*
+      sprintf(errbuf,"Cannot get metadata string.\n");
+      H5Epush(__FILE__, "HE5_GDpixreginfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+      */
+
+      free(errbuf);
+      free(utlstr);
+      free(metabuf);   
+      metabuf = NULL;
+      utlstr = NULL;
+      errbuf = NULL;
+
+      return(status);
+    }
+  
+  /*
+   * If "PixelRegistration" string found in metadata then convert
+   * to numeric origin code (fixed added: Jan 97)
+   */
+  for (i = 0; i < 2; i++)
+    {
+      if (strcmp(utlstr, pixregNames[i]) == 0)
+	{
+	  *pixregcode = i;
+	  break;
+	}
+    }
+  
+  free(metabuf);
+  free(utlstr);
+  free(errbuf);
+  
+  metabuf = NULL;
+  utlstr = NULL;
+  errbuf = NULL;
+  
+  return (status);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDcompinfo                                                   |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char*   None                                                |
+|  compcode       int*    None                                                |
+|  compparm       int     none                                                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/24/99  A.Muslimov    Changed the return type from intn to int   .        |
+|  9/21/99  A.Muslimov    In the call to EHmetagroup() replaced the argument  |
+|                         gid by fid. Changed the type of gridID from int32_t |
+|                         to hid_t. Changed the type of statmeta from intn    |
+|                         to int   , and  initialized the return statuses to  |
+|                         -1.                                                 |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  June 03  S.Zhao        Changed the type of compcode from *char to *int.    |
+|  Aug  03  S.Zhao        Added Szip compression methods.                     |
+|  Apr  04  S.Zhao        Added the HE5_GDfldnameinfo() call.                 |
+|  Dec  13  Abe Taaheri   Added compression detection from field, if it is    |
+|                          not found from the structure metadata              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDcompinfo(hid_t gridID, const char *fieldname, int *compcode, int compparm[])
+{
+
+  herr_t          status   = FAIL;            /* routine return status variable */
+  herr_t          statmeta = FAIL;            /* EHgetmetavalue return status   */  
+
+  int             i;                          /* Loop Index                     */
+
+  hid_t           (*func)(void*);
+  hid_t           fid    = FAIL;              /* HDF-EOS file ID                */
+  hid_t           gid    = FAIL;              /* "HDFEOS" group ID              */
+  
+  long            idx    = FAIL;              /* Grid index                     */
+  long            idOffset   = HE5_GRIDOFFSET;/* HDF-EOS Grid ID offset         */
+  int             nameflag = FAIL;            /* Name flag (0-alias,1-actual)   */
+  char            fldname[HE5_HDFE_NAMBUFSIZE];      /* Field name buffer       */
+  char            fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual name of a field  */
+  char            *metabuf = (char *)NULL;   /* Ptr to structural metadata (SM) */
+  char            *metaptrs[2] = {NULL,NULL};/* Ptrs to begin/end of SM section */
+  char            *utlstr = (char *)NULL;    /* Utility string                  */
+  char            *errbuf = (char *)NULL;    /* buffer for error message        */
+  hid_t           sdid,dcpl;
+  size_t          nelmts;
+  unsigned int    flags,filter_info;
+  int             got_compparm = 0;
+  int             found = 0;
+  int             numfilt;
+  hid_t           plist_id;
+  int             done_loop = 0;
+  H5Z_filter_t    filter_type;
+  void            *edata = (void *)NULL;
+  char            *HDFcomp[18] = {"HE5_HDFE_COMP_NONE", "HE5_HDFE_COMP_RLE", "HE5_HDFE_COMP_NBIT", "HE5_HDFE_COMP_SKPHUFF", "HE5_HDFE_COMP_DEFLATE", "HE5_HDFE_COMP_SZIP_CHIP", "HE5_HDFE_COMP_SZIP_K13", "HE5_HDFE_COMP_SZIP_EC", "HE5_HDFE_COMP_SZIP_NN", "HE5_HDFE_COMP_SZIP_K13orEC", "HE5_HDFE_COMP_SZIP_K13orNN", "HE5_HDFE_COMP_SHUF_DEFLATE", "HE5_HDFE_COMP_SHUF_SZIP_CHIP", "HE5_HDFE_COMP_SHUF_SZIP_K13", "HE5_HDFE_COMP_SHUF_SZIP_EC", "HE5_HDFE_COMP_SHUF_SZIP_NN", "HE5_HDFE_COMP_SHUF_SZIP_K1 [...]
+  
+  H5Eget_auto(&func, &edata);
+
+  CHECKPOINTER(fieldname);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDcompinfo", &fid, &gid, &idx);
+  if ( status == FAIL)
+    {
+      sprintf(errbuf,"Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return( FAIL );
+    }
+  
+  /* Allocate memory for utility string */
+  /* ---------------------------------- */
+  utlstr  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if(utlstr == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for utility string.\n");
+      H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+  
+  /* Call HE5_GDfldnameinfo() to get actual field name */
+  /* ------------------------------------------------- */
+  nameflag = HE5_GDfldnameinfo(gridID, fieldname, fldactualname);
+  if ( nameflag == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the actual name of the field.\n");
+      H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(utlstr);
+ 
+      return(FAIL);
+    }
+
+  /* If fldname is alias, then change it to the actual name */
+  /* ------------------------------------------------------ */
+  if (nameflag == FALSE)
+    {
+      strcpy(fldname,"");
+      strcpy(fldname,fldactualname);
+    }
+ 
+  if (nameflag == TRUE)
+    {
+      strcpy(fldname,"");
+      strcpy(fldname,fieldname);
+    }
+
+  /* Get pointers to "DataField" section within SM */
+  /* --------------------------------------------- */
+  metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g","DataField", metaptrs);
+  if(metabuf == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for metabuffer string.\n");
+      H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(utlstr);
+	    
+      return(FAIL);
+    }
+  
+  /* Search for field */
+  /* ---------------- */
+  sprintf(utlstr, "%s%s%s", "\"", fldname, "\"\n");
+  metaptrs[0] = strstr(metaptrs[0], utlstr);
+  
+  
+  /* If field found and user wants compression code ... */
+  /* -------------------------------------------------- */
+  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+    {
+      if (compcode != NULL)
+	{
+	  /* Set endptr at end of field's definition entry */
+	  /* --------------------------------------------- */
+	  metaptrs[1] = strstr(metaptrs[0], "\t\t\tEND_OBJECT");
+			
+	  /* Get compression type */
+	  /* -------------------- */
+	  statmeta = HE5_EHgetmetavalue(metaptrs, "CompressionType", utlstr);
+	  /*
+	    if (statmeta == FAIL)
+	    {
+	    sprintf(errbuf,"Cannot get metadata string.\n");
+	    H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    free(utlstr);
+	    free(metabuf);
+		   
+	    return( FAIL );
+	    }
+	  */
+    
+	  /*
+	   * Default is no compression if "CompressionType" string not
+	   * in metadata
+	   */
+	  *compcode = HE5_HDFE_COMP_NONE;
+	  /* strcpy( compcode, utlstr);*/
+
+	  /* If compression code is found ... */
+	  /* -------------------------------- */
+	  if (statmeta == SUCCEED)
+	    {
+	      /* Loop through compression types until match */
+	      /* ------------------------------------------ */
+	      for (i = 0; i < 18; i++)
+		{
+		  if (strcmp(utlstr, HDFcomp[i]) == 0)
+		    {
+		      *compcode = i;
+		      break;
+		    }
+		}
+	    }
+	}
+		
+      
+      /* If user wants compression parameters ... */
+      
+      /* Compression is not listed in the structure metadata. 
+	 Lets see if the field is compressed by other means such 
+	 as herepack where the compression is done but does not 
+	 show up in the structure metadata.
+      */
+      got_compparm = 0;
+      if(*compcode == HE5_HDFE_COMP_NONE)
+	{
+	  if (HE5_GDXGrid[gridID % idOffset].active != 0)
+	    {
+	      /* Get Grid index */
+	      /* -------------- */
+	      idx = HE5_EHhid2long(gridID) % idOffset;
+	      if ( idx == FAIL)
+		{
+		  status = FAIL;
+		  sprintf(errbuf, "Cannot get the Grid index \n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf) ;
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+	    }
+	  /* Loop through all datasets in grid */
+	  /* ------------------------------ */
+	  for (i = 0; i < HE5_GDXGrid[idx].nDFLD; i++)
+	    {
+	      /* Get dataset name */
+	      if( strcmp(fieldname, HE5_GDXGrid[ idx ].ddataset[ i ].name) == 0 )
+		{
+		  found = 1; 
+		  sdid = HE5_GDXGrid[ idx ].ddataset[ i ].ID;
+		  break;
+		} 
+	    }
+	  
+	  if(found == 1) /* did not find fieldname */
+	    {
+	      /*
+	       * Retrieve dataset creation property list.
+	       */
+	      dcpl = H5Dget_create_plist (sdid); 
+	      numfilt = H5Pget_nfilters (plist_id);
+
+	      done_loop = 0;	      
+	      for (i=0; i<numfilt; i++) {
+		nelmts = 0;
+		filter_type = H5Pget_filter2 (plist_id, (unsigned)i, &flags, &nelmts, 
+					      NULL, 0, NULL,
+					      &filter_info);
+		switch(filter_type)
+		  {
+		    /*-------------------------------------------------------------------------
+		     * H5Z_FILTER_DEFLATE      1 , deflation like gzip
+		     *-------------------------------------------------------------------------
+		     */
+		  case H5Z_FILTER_DEFLATE:
+		    if(numfilt == 1)
+		      {
+			*compcode = 4; /* HE5_HDFE_COMP_DEFLATE */
+			compparm[0] = 6; /* default value */
+			done_loop = 1;
+		      }
+		    else
+		      {
+			*compcode = 11; /* HE5_HDFE_COMP_SHUF_DEFLATE */
+			compparm[0] = 6; /* default value */
+			done_loop = 1;
+		      }
+		    break;
+		    /*-------------------------------------------------------------------------
+		     * H5Z_FILTER_NBIT
+		     *-------------------------------------------------------------------------
+		     */
+		  case H5Z_FILTER_NBIT:
+			*compcode = 2; /* HE5_HDFE_COMP_NBIT */
+			/* Initialize to zero */
+			for (i = 0; i < 4; i++)
+			  {
+			    compparm[i] = 0.0;
+			  }
+			done_loop = 1;
+		    break;
+		    /*-------------------------------------------------------------------------
+		     * H5Z_FILTER_SZIP       4 , szip compression
+		     *-------------------------------------------------------------------------
+		     */
+		  case H5Z_FILTER_SZIP:
+		    if(numfilt == 1)
+		      {
+			*compcode = 7; /* HE5_HDFE_COMP_SZIP_CHIP */
+			compparm[0] = 16;
+			compparm[1] = 4;  /* SZ_EC */
+			done_loop = 1;
+		      }
+		    else
+		      {
+			*compcode = 8; /* HE5_HDFE_COMP_SZIP_K13 */
+			compparm[0] = 16;
+			compparm[1] = 32;  /* SZ_NN */
+			done_loop = 1;
+		      }
+		    break;
+		    /*-------------------------------------------------------------------------
+		     * H5Z_FILTER_SHUFFLE    2 , shuffle the data
+		     *-------------------------------------------------------------------------
+		     */
+		  case H5Z_FILTER_SHUFFLE:
+		    if(numfilt == 2)
+		      {
+			*compcode = 11;  /* HE5_HDFE_COMP_SHUF_DEFLATE */
+			compparm[0] = 6;
+			done_loop = 1;
+		      }
+		    else if(numfilt > 2)
+		      {
+			*compcode = 12;  /* HE5_HDFE_COMP_SHUF_SZIP_CHIP */
+			compparm[0] = 16;
+			done_loop = 1;
+		      }
+		    break;
+		    /*-------------------------------------------------------------------------
+		     * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
+		     *-------------------------------------------------------------------------
+		     */
+		  case H5Z_FILTER_FLETCHER32:
+		    done_loop =  1;
+		    break;
+		       
+		    /*-------------------------------------------------------------------------
+		     * H5Z_FILTER_SCALEOFFSET
+		     *-------------------------------------------------------------------------
+		     */
+		  case H5Z_FILTER_SCALEOFFSET:
+		    done_loop =  1;
+		    break;
+		  }/*switch*/
+		if(done_loop ==  1) break;
+	      }/*for*/
+	    }
+	  got_compparm = 1;
+	}	  
+
+      /* if compression parameters are obtained from field itself when
+	 calling SDgetcompinfo, we will skip next if statement */
+  
+      
+      /* If user wants compression parameters ... */
+      /* ---------------------------------------- */
+      if (compparm != NULL && compcode != NULL && got_compparm != 1)
+	{
+	  /* Initialize to zero */
+	  for (i = 0; i < 5; i++)
+	    {
+	      compparm[i] = 0;
+	    }
+
+	  /*
+	   * Get compression parameters 
+	   */
+	  if(*compcode == HE5_HDFE_COMP_NBIT)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "CompressionParams", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"CompressionParams\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+					
+		  return( FAIL );
+		}
+	      sscanf(utlstr, "(%d,%d,%d,%d)",&compparm[0], &compparm[1],&compparm[2], &compparm[3]);
+	    }
+	  else if (*compcode == HE5_HDFE_COMP_DEFLATE)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "DeflateLevel", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"DeflateLevel\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+					
+		  return( FAIL);
+		}
+	      sscanf(utlstr, "%d", &compparm[0]);
+	    }
+	  else if (*compcode == HE5_HDFE_COMP_SZIP_CHIP)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+ 
+		  return( FAIL);
+		}
+	      sscanf(utlstr, "%d", &compparm[0]);
+	    }
+	  else if (*compcode == HE5_HDFE_COMP_SZIP_K13)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+ 
+		  return( FAIL);
+		}
+	      sscanf(utlstr, "%d", &compparm[0]);
+	    }
+	  else if (*compcode == HE5_HDFE_COMP_SZIP_EC)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+ 
+		  return( FAIL);
+		}
+	      sscanf(utlstr, "%d", &compparm[0]);
+	    }
+	  else if (*compcode == HE5_HDFE_COMP_SZIP_NN)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+ 
+		  return( FAIL);
+		}
+	      sscanf(utlstr, "%d", &compparm[0]);
+	    }
+	  else if (*compcode == HE5_HDFE_COMP_SZIP_K13orEC)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+ 
+		  return( FAIL);
+		}
+	      sscanf(utlstr, "%d", &compparm[0]);
+	    }
+	  else if (*compcode == HE5_HDFE_COMP_SZIP_K13orNN)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+ 
+		  return( FAIL);
+		}
+	      sscanf(utlstr, "%d", &compparm[0]);
+	    }
+	  else if (*compcode == HE5_HDFE_COMP_SHUF_DEFLATE)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "DeflateLevel", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"DeflateLevel\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+ 
+		  return( FAIL);
+		}
+	      sscanf(utlstr, "%d", &compparm[0]);
+	    }
+	  else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_CHIP)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+ 
+		  return( FAIL);
+		}
+	      sscanf(utlstr, "%d", &compparm[0]);
+	    }
+	  else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+ 
+		  return( FAIL);
+		}
+	      sscanf(utlstr, "%d", &compparm[0]);
+	    }
+	  else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_EC)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+ 
+		  return( FAIL);
+		}
+	      sscanf(utlstr, "%d", &compparm[0]);
+	    }
+	  else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_NN)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+ 
+		  return( FAIL);
+		}
+	      sscanf(utlstr, "%d", &compparm[0]);
+	    }
+	  else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13orEC)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+ 
+		  return( FAIL);
+		}
+	      sscanf(utlstr, "%d", &compparm[0]);
+	    }
+	  else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13orNN)
+	    {
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+	      if (statmeta == FAIL)
+		{
+		  sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n");
+		  H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+ 
+		  return( FAIL);
+		}
+	      sscanf(utlstr, "%d", &compparm[0]);
+	    }
+
+	}
+    }
+  else
+    {   
+      status = FAIL;
+      sprintf(errbuf, "Fieldname \"%s\" not found.\n", fldname);
+      H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FILE, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  free(metabuf);
+  free(utlstr);
+  free(errbuf);
+  
+  metabuf = NULL;
+  utlstr  = NULL;
+  errbuf  = NULL;
+  
+ COMPLETION:
+  return (status);
+
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDfieldinfo                                                  |
+|                                                                             |
+|  DESCRIPTION: Retrieve information about a specific geolocation or data     |
+|                field in the grid.                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char*               name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  rank           int                 rank of field (# of dims)               |
+|  dims           hsize_t             field dimensions                        |
+|  ntype          hid_t               field number types                      |
+|  dimlist        char*               field dimension list                    |
+|  maxdimlist     char*               field maximum dimension list            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|             H5Dopen                                                         |
+|             H5Dget_type                                                     |
+|             H5Tget_class                                                    |
+|             H5Dclose                                                        |
+|             H5Dget_space                                                    |
+|             H5Sget_simple_extent_ndims                                      |
+|             H5Sget_simple_extent_dims                                       |
+|             H5Sclose                                                        |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/21/99  A.Muslimov    In the call to EHmetagroup() replaced the argument  |
+|                         gid by fid. Changed the type of statmeta from intn  |
+|                         to int   , and  initialized the return status to    |
+|                         -1.                                                 |
+|  9/27/99  A.Muslimov    Added proper error handlings.                       |
+|  10/18/99 A.Muslimov    Replace memcpy() by memmove() to avoid a problem    |
+|                         when arguments 1 and 2 overlap in memory.           |
+| 01/13/00  A.Muslimov    Added "maxdimlist" parameter to make it possible    |
+|                         working with the appendable datasets. Modified the  |
+|                         blocks retrieving the dimension lists. Added proper |
+|                         error handlings after the function calls.           |
+| Feb 00    A.Muslimov    Casted the type of a variable assigned to rank to   |
+|                         "int".                                              |
+| Mar 00    A.Muslimov    Changed the ID of field group from gd_id to data_id.|
+| Apr 00    A.Muslimov    Changed type of 'slen' from long to size_t.         |
+| 5/10/00   A.Muslimov    Changed 'H5T_class_t' type to 'int' data type.      |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| Jan 03    S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+| Oct. 03   S.Zhao        Added the H5Tclose(datatype) call.                  |
+| Jan. 04   S.Zhao        Modified to enable a character string dataset.      |
+| Mar  04   S.Zhao        Modified for a character string dataset.            |
+| Apr  04   S.Zhao        Added the  HE5_GDfldnameinfo() call.                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDfieldinfo(hid_t gridID, const char *fieldname, int *rank, hsize_t dims[], hid_t ntype[], char *dimlist, char *maxdimlist)
+{
+
+  herr_t            status   = FAIL;   /* routine return status variable     */
+  herr_t            statmeta = FAIL;   /* EHgetmetavalue return status       */
+  herr_t            Dstatus  = FAIL;   /* Status for H5Dclose                */
+
+  int               i;                 /* Loop index                         */
+  
+  hid_t             fid       = FAIL;  /* HDF-EOS file ID                    */
+  hid_t             gid       = FAIL;  /* "HDFEOS" group ID                  */
+  hid_t             datasetid = FAIL;  /* dataset ID                         */
+  hid_t             datatype  = FAIL;  /* data type ID                       */
+  hid_t             fieldID   = FAIL;  /* field ID                           */
+  hid_t             dspace    = FAIL;  /* data space ID                      */
+
+  size_t            slen[HE5_DTSETRANKMAX];/* Length of each entry in a list */
+  
+  long              idx   = FAIL;      /* Grid index                         */
+  long              ndims = 0;         /* Number of dimensions               */
+  long              xdim  = 0;         /* X dim size                         */
+  long              ydim  = 0;         /* Y dim size                         */
+     
+  H5T_class_t       classid = H5T_NO_CLASS;        /* Data type class ID     */
+  
+  char              *metabuf = (char *)NULL;       /* Pointer to structural metadata (SM) */
+  char              *metaptrs[2] = {NULL,NULL};    /* Pnts to begin and end of SM section */
+  char              *utlstr = (char *)NULL;        /* Utility string                      */
+  char              *ptr[HE5_DTSETRANKMAX];        /* String pointers for parsed string   */
+  char              dimstr[HE5_HDFE_DIMBUFSIZE];   /* Individual dimension entry string   */
+  char              maxdimstr[HE5_HDFE_DIMBUFSIZE];/* Maximum dimension entry string      */
+  char              errbuf[HE5_HDFE_ERRBUFSIZE];
+  int               nameflag    = FAIL;            /* Actual(1)/Alias(0) field name       */
+  char              fldname[HE5_HDFE_NAMBUFSIZE];  /* field name buffer                   */
+  char              fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual field name               */
+  htri_t            str_is_variable;               /* boolean: TRUE if string is variable 
+						      lengeth FALSE if string is fixed length
+						      -1 if error in H5Tis_variavle_str() */
+  
+  CHECKPOINTER(fieldname);
+
+  /* Allocate memory for utility string */
+  /* ---------------------------------- */
+  utlstr  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if(utlstr == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for utility string.\n");
+      H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		
+      return(FAIL);
+    }
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/  
+  status = HE5_GDchkgdid(gridID, "HE5_GDfieldinfo", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for Grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(utlstr);
+		
+      return(FAIL);
+    }
+  
+  /* Call HE5_GDfldnameinfo() to get actual field name */
+  /* ------------------------------------------------- */
+  nameflag = HE5_GDfldnameinfo(gridID, fieldname, fldactualname);
+  if ( nameflag == FAIL )
+    {
+      sprintf(errbuf, "Cannot get actual name of the field.\n");
+      H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(utlstr);
+ 
+      return(FAIL);
+    }
+
+  /* Name is not alias */
+  /* ----------------- */
+  if (nameflag == TRUE)
+    {
+      strcpy(fldname,"");
+      strcpy(fldname,fieldname);
+    }
+
+  /* Name is alias */
+  /* ------------- */
+  if (nameflag == FALSE)
+    {
+      strcpy(fldname,"");
+      strcpy(fldname,fldactualname);
+    }
+
+  /* Allocate memory for metabuf string */
+  /* ---------------------------------- */
+  metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g", "DataField", metaptrs);
+  if(metabuf == NULL)
+    {
+      sprintf(errbuf, "cannot allocate memory for metabuffer.\n");
+      H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(utlstr);
+		
+      return(FAIL);
+    }
+  
+  /* Search for field */
+  /* ---------------- */
+  sprintf(utlstr, "%s%s%s", "\"", fldname, "\"\n");
+  metaptrs[0] = strstr(metaptrs[0], utlstr);
+  
+  /* If field found ... */
+  /* ------------------ */
+  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+    {
+      /* initialize the rank value */
+      /* ------------------------- */
+      *rank = FAIL;
+	    
+		
+      /* Set endptr at end of dimension definition entry */
+      /* ----------------------------------------------- */
+      metaptrs[1] = strstr(metaptrs[0], "\t\t\tEND_OBJECT");
+
+      /* Get "DataType" string */
+      /* --------------------- */
+      statmeta = HE5_EHgetmetavalue(metaptrs, "DataType", utlstr);
+	  
+      /* Convert to numbertype code */
+      /* -------------------------- */
+      if (statmeta == SUCCEED)
+	{
+	  datasetid     = H5Dopen(HE5_GDXGrid[idx].data_id, fldname);
+	  if (datasetid == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the dataset \"%s\".", fldname);
+	      H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (utlstr  != NULL) free(utlstr);
+	      if (metabuf != NULL) free(metabuf);
+			  
+	      return(FAIL);
+	    }
+
+	  /* Get data type ID */
+	  /* ---------------- */
+	  datatype      = H5Dget_type(datasetid);
+	  if (datatype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the data type for \"%s\" dataset.", fldname);
+	      H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (utlstr  != NULL) free(utlstr);
+	      if (metabuf != NULL) free(metabuf);
+			  
+	      return(FAIL);
+	    }
+
+	  /* Get data class ID */
+	  /* ----------------- */
+	  classid       = H5Tget_class(datatype);
+	  if (classid == H5T_NO_CLASS)
+	    {
+	      sprintf(errbuf, "Cannot get the data type class ID for \"%s\" dataset.", fldname);
+	      H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (utlstr  != NULL) free(utlstr);
+	      if (metabuf != NULL) free(metabuf);
+			  
+	      return(FAIL);
+	    }
+
+	  if (classid == H5T_STRING)
+	    {
+	      /* HE5T_CHARSTRING has variable length for data fields */
+	      str_is_variable = H5Tis_variable_str(datatype);
+	      if(str_is_variable == TRUE)
+		{
+		  ntype[0] = HE5T_CHARSTRING;
+		}
+	      else if(str_is_variable == FALSE)
+		{
+		  ntype[0] = HE5T_NATIVE_CHAR;
+		}
+	      else
+		{
+		  status = FAIL;
+		  sprintf(errbuf, "Failed to see if string field is varaible or fixed length for the \"%s\" field.\n",fldname);
+		  H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (utlstr  != NULL) free(utlstr);
+		  if (metabuf != NULL) free(metabuf);
+		  return(status);
+		}
+		      
+	      /*HE5_GDgetstringtype(swathID, fieldname,classid);*/
+	      /*ntype[0] = HE5T_CHARSTRING;*/
+	    }
+	  else
+	    {
+	      /* ntype[0]      = classid; */
+	      ntype[0] = HE5_EHdtype2numtype(datatype);
+	      if (ntype[0] == FAIL)
+		{
+		  sprintf(errbuf, "Cannot get the number type for \"%s\" dataset.", fldname);
+		  H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (utlstr  != NULL) free(utlstr);
+		  if (metabuf != NULL) free(metabuf);
+			  
+		  return(FAIL);
+		}
+	    }
+
+	  /* Release datatype ID */
+	  /* ------------------- */
+	  status = H5Tclose(datatype);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot close the datatype \"%s\".", fldname);
+	      H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (utlstr  != NULL) free(utlstr);
+	      if (metabuf != NULL) free(metabuf);
+ 
+	      return(FAIL);
+	    }
+
+	  /* Release dataset ID */
+	  /* ------------------ */
+	  Dstatus       = H5Dclose(datasetid);
+	  if (Dstatus == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot close the dataset \"%s\".", fldname);
+	      H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (utlstr  != NULL) free(utlstr);
+	      if (metabuf != NULL) free(metabuf);
+			  
+	      return(FAIL);
+	    }          
+	}
+      else
+	{
+	  sprintf(errbuf, "\"DataType\" string not found in metadata.");
+	  H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(utlstr);
+	  free(metabuf);
+			
+	  return(FAIL);
+	}
+      /*
+       * Get DimList string and trim off leading and trailing parens
+       * "()"
+       */
+      statmeta = HE5_EHgetmetavalue(metaptrs, "DimList", utlstr); 		
+      if (statmeta == SUCCEED)
+	{
+	  /* Initialize slen[] array */
+	  /* ----------------------- */
+	  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+	    slen[ i ] = 0;
+
+	  memmove(utlstr, utlstr + 1, strlen(utlstr) - 2);
+	  utlstr[strlen(utlstr) - 2] = 0;
+			
+	  /* Parse trimmed DimList string and get rank */
+	  /* ----------------------------------------- */
+	  ndims = HE5_EHparsestr(utlstr, ',', ptr, slen);
+	  *rank = (int)ndims;
+	}
+      else
+	{
+	  sprintf(errbuf, "\"DimList\" string not found in metadata.");
+	  H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(utlstr);
+	  free(metabuf);
+			
+	  return(FAIL);
+	}
+		
+      /* Get information about grid */
+      /* -------------------------- */
+      status = HE5_GDgridinfo(gridID, &xdim, &ydim, NULL, NULL);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get information about Grid.\n");
+	  H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(utlstr);
+	  free(metabuf);
+
+	  return(FAIL);
+	}
+		
+
+      for (i = 0; i < ndims; i++)
+	{
+	  memmove(dimstr, ptr[i] + 1, slen[i] - 2);
+	  dimstr[slen[i] - 2] = 0;
+			
+	  if (strcmp(dimstr, "XDim") == 0)
+	    {
+	      dims[i] = (hsize_t)xdim;
+	    }
+	  else if (strcmp(dimstr, "YDim") == 0)
+	    {
+	      dims[i] = (hsize_t)ydim;
+	    }
+	  else
+	    {
+	      /* Get dimension size */
+	      /* ------------------ */
+	      dims[i] = (hsize_t)HE5_GDdiminfo(gridID, dimstr);
+	      if ( dims[i] == FAIL)
+		{
+		  sprintf(errbuf, "Cannot get the size of dimension.\n");
+		  H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(utlstr);
+		  free(metabuf);
+					
+		  return(FAIL);
+		}				
+	    }
+			
+
+	  /* If DimList string is requested ... */
+	  /* ---------------------------------- */
+	  if (dimlist != NULL)
+	    {
+	      if (i == 0)
+		{
+		  dimlist[0] = 0;
+		}
+
+	      if (i > 0)
+		{
+		  strcat(dimlist, ",");
+		}
+	      strcat(dimlist, dimstr);
+	    }
+	}
+
+	    
+      /* If MaxdimList is requested ...   */  
+      /* -------------------------------  */
+      if (maxdimlist != NULL )
+	{
+	  statmeta = HE5_EHgetmetavalue(metaptrs, "MaxdimList", utlstr);
+	  if (statmeta == SUCCEED)
+	    {
+	      memmove(utlstr, utlstr + 1, strlen(utlstr) - 2);
+	      utlstr[strlen(utlstr) - 2] = 0;
+				
+	      /* Parse trimmed MaxdimList string and get rank */
+	      /* -------------------------------------------- */
+	      ndims = HE5_EHparsestr(utlstr, ',', ptr, slen);
+	    }
+	  else
+	    {
+	      sprintf(errbuf, "\"MaxdimList\" string not found in metadata.");
+	      H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(utlstr);
+	      free(metabuf);
+				
+	      return(FAIL);
+	    }
+
+	  strcpy(maxdimstr,"");
+	  strcpy(maxdimlist,"");
+			
+	  for (i = 0; i < ndims; i++)
+	    {
+	      memmove(maxdimstr, ptr[i] + 1, slen[i] - 2);
+	      maxdimstr[slen[i] - 2] = 0;
+				
+	      /* If MaxdimList string is requested ... */
+	      /* ------------------------------------- */
+	      if (maxdimlist != NULL)
+		{
+		  if (i > 0)
+		    {
+		      strcat(maxdimlist, ",");
+		    }
+		  strcat(maxdimlist, maxdimstr);
+		}
+	    }
+			
+	}
+	    
+
+      /* Get field-related dataset ID */
+      /* ---------------------------- */
+      status = HE5_GDgetfieldID(gridID, fldname, &fieldID);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get the dataset ID for the \"%s\" field.\n", fldname);
+	  H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(utlstr);
+	  free(metabuf);
+			
+	  return(status);
+	}
+   	    
+      /* Get data space ID */
+      /* ----------------- */
+      dspace = H5Dget_space( fieldID );
+      if (dspace == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the dataspace ID for the \"%s\" field.\n", fldname);
+	  H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(utlstr);
+	  free(metabuf);
+			
+	  return(FAIL);
+	}
+	    
+      /* Get dataset rank */
+      /* ---------------- */
+      *rank = H5Sget_simple_extent_ndims(dspace);
+      if ( *rank == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get the dataset rank for the \"%s\" field.\n", fldname);
+	  H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(utlstr);
+	  free(metabuf);
+			
+	  return(FAIL);
+	}
+	    
+      /* Get dataset dimension sizes */
+      /* --------------------------- */
+      status = H5Sget_simple_extent_dims(dspace,dims, NULL);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get the dataset dimension sizes for the \"%s\" field.\n", fldname);
+	  H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(utlstr);
+	  free(metabuf);
+			
+	  return(status);
+	}
+
+	    
+      /* Release the dataspace ID */
+      /* ------------------------ */
+      status = H5Sclose(dspace);
+      if ( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" field.\n", fldname);
+	  H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(utlstr);
+	  free(metabuf);
+
+	  return(status);
+	}
+	   
+   
+    }
+  
+  free(metabuf);
+  free(utlstr);
+   
+  metabuf = NULL;
+  utlstr  = NULL;
+  
+ COMPLETION:
+  return (status);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDtileinfo                                                   |
+|                                                                             |
+|  DESCRIPTION: Retrieves tiling information                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               Grid structure ID                       |
+|  fldname        char*               name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  tilecode       int*                tile code                               |
+|  tilerank       int*                number of tiling dimensions             |
+|  tiledims       hsize_t             the array containing sizes              |
+|                                     of each dimension of a tile             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  Date        Programmer    Description                                      |
+|  =========   ============  ==============================================   |
+|  Dec 03      S.Zhao        Original development                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_GDtileinfo(hid_t gridID, char *fldname, int *tilecode, int *tilerank,  hsize_t tiledims[])
+{
+  herr_t          status   = FAIL;/* Return status variable */
+ 
+  hid_t           fid      = FAIL;/* HDF-EOS file ID        */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID      */
+  long            idx      = FAIL;/* Grid index             */
+  hid_t           fieldID  = FAIL;/* field dataset ID       */
+  hid_t           plist    = FAIL;/* field dataset property list ID   */
+  hid_t           dspace   = FAIL;/* "fieldname" Dataspace ID         */
+ 
+  int             ndims    = 0;   /* Number of dimensions   */
+ 
+  H5D_layout_t    layout = H5D_LAYOUT_ERROR; /* Storage layout type   */
+ 
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+ 
+ 
+  HE5_LOCK;
+  CHECKPOINTER(fldname);
+ 
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Grid index */
+  /* ----------------------------------------------------- */
+  status = HE5_GDchkgdid(gridID, "HE5_GDtileinfo", &fid, &gid, &idx);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Checking for valid grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+ 
+  /* Check out the field group and get field ID */
+  /* ------------------------------------------ */
+  status = HE5_GDgetfieldID(gridID, fldname, &fieldID);
+  if(status == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the field ID for the \"%s\" field.\n", fldname);
+      H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get the property list ID */
+  /* ------------------------ */
+  plist = H5Dget_create_plist(fieldID);
+  if (plist == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fldname);
+      H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get the data space ID */
+  /* --------------------- */
+  dspace = H5Dget_space(fieldID);
+  if(dspace == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the data space ID for the \"%s\" data field.\n", fldname);
+      H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get the dataset rank */
+  /* -------------------- */
+  ndims  = H5Sget_simple_extent_ndims(dspace);
+  if(ndims == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the rank of the dataset.\n");
+      H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get Layout */
+  /* ---------- */
+  layout = H5Pget_layout(plist);
+  if (layout == H5D_LAYOUT_ERROR)
+    {
+      sprintf(errbuf, "Cannot get the layout of the raw data. \n");
+      H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_PLIST, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else if (layout == H5D_CHUNKED)
+    {
+      *tilecode = HE5_HDFE_TILE;
+
+      /* Get chunking */
+      /* ------------ */
+      *tilerank = H5Pget_chunk(plist, ndims, tiledims);
+      if (*tilerank == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the sizes of chunks. \n");
+	  H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+  else
+    {
+      *tilecode = HE5_HDFE_NOTILE;
+      *tilerank = 0;
+    }
+ 
+  /* Release property list ID */
+  /* ------------------------ */
+  status = H5Pclose(plist);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release property list ID. \n");
+      H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Release the data space ID */
+  /* ------------------------- */
+  status = H5Sclose(dspace);
+  if( status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the data space ID.\n");
+      H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdeffield                                                   |
+|                                                                             |
+|  DESCRIPTION: Defines a new data field within the grid.                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char*               fieldname                               |
+|  dimlist        char*               Dimension list (comma-separated list)   |
+|  maxdimlist     char*               Maximum Dimension list                  |
+|  ntype          hid_t               Data type ID of the field               |
+|  merge          int                 merge code                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|             H5Tequal                                                        |
+|             H5Pget_layout                                                   |
+|             H5Screate_simple                                                |
+|             H5Dcreate                                                       |
+|             H5Dextend                                                       |
+|             H5Tget_size                                                     |
+|             H5Pget_fill_value                                               |
+|             H5Pclose                                                        |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/20/99  A.Muslimov    In the call to EHinsertmeta() replaced the argument |
+|                         gid by fid. Added error handling after the function |
+|                         calls. In the call to H5Dcreate() replaced the first|
+|                         argument by gd_id (data field group ID).            |
+|  9/30/99  A.Muslimov    Added more error handlings after the function calls.|
+|                         Removed 'if(status == -1){}' block from the         |
+|                         'if((tilecode == HDFE_TILE ){}' block.              |
+|  10/18/99 A.Muslimov    Replace memcpy() by memmove() to avoid a problem    |
+|                         when arguments 1 and 2 overlap in memory.           |
+| 10/18/99  A.Taaheri     Replaced strcpy() by memmove() to avoid a problem   |
+|                         when arguments 1 and 2 overlap in memory.           |
+| Jan 2000  A.Muslimov    Modified to enable the functioning of routines      |
+|                         dealing with extendible datsets.                    |
+| Mar,2000  A.Muslimov    Changed the ID of field group from gd_id to         |
+|                         data_id.                                            |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| Nov 2000  A.Muslimov    Modified to enable appendability of any dimension.  |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  Aug  03  S.Zhao        Added checking for SOMBlockDim in the dimlist.      |
+|  Aug  03  S.Zhao        Added Szip compression methods.                     |
+|  Jan  04  S.Zhao        Added to create a character string dataset.         |
+|  Mar  04  S.Zhao        Modified for a character string dataset.            |
+|  Apr  04  S.Zhao        Modified for a character string dataset.            |
+|  May  04  S.Zhao        Added to check in the maxdimlist section for "XDim" |
+|                         set to xdimsize and "YDim" set to ydimsize.         |
+|  May  05  S.Zhao        Added HE5_EHdtype2numtype() and HE5_EHhid2hsize()   |
+|                         functions calls.                                    |
+|  Aug  08  Abe Taaheri   Fixed problem with fillvalue setting. Value set for |
+|                         fillvalue is used only in the field that intended.  |
+|                         It must be set before defining the field.           |
+|  Sep  11  Abe Taaheri   Modified for correcting Unlimited dimension         |
+|                         behavior and extension, removing hardcoded name     |
+|                         Unlim                                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDdeffield(hid_t gridID, const char *fieldname, char *dimlist, char *maxdimlist, hid_t numbertype_in, int merge)
+{
+
+  herr_t          status      = FAIL; /* routine return status variable */
+
+  hid_t           fid         = FAIL; /* HDF-EOS file ID                */
+  hid_t           gid         = FAIL; /* "HDFEOS" group ID              */ 
+  hid_t           data_id     = FAIL; /* "Data Fields" group ID         */          
+  hid_t           dataset     = FAIL; /* dataset ID                     */
+  hid_t           data_space  = FAIL; /* dataspace ID                   */
+
+  int             i;		      /* Loop index                     */
+  int             found       = 0;    /* "Found" flag                   */
+  int             foundNT     = 0;    /* "Found number type" flag       */
+  int             foundAllDim = 1;    /* "Found all dimensions" flag    */
+  int             first       = 1;    /* "First entry" flag             */
+  int             append      = FALSE;/* "Appendibility" flag           */
+  int             tilecode    = FAIL; /* Tiling code                    */
+  int             projcode    = FAIL; /* Projection Code                */
+  int             rank        = 0;    /* Field rank                     */
+  int             maxrank     = 0;    /* Maximum dimension  rank        */
+
+  long            idx         = FAIL; /* Grid index                     */
+  long            xdim        = 0;    /* Grid "X" dimension size        */
+  long            ydim        = 0;    /* Grid "Y" dimension size        */
+
+  hsize_t         dims[HE5_DTSETRANKMAX];   /* Dimension size array     */
+  hsize_t         maxdims[HE5_DTSETRANKMAX];/* Max.Dimension size array */
+  hsize_t         count[]     = { 1 } ;	    /* Number of elements array */
+  hsize_t         dimsize     = 0;	    /* Dimension size           */
+    
+  double          projparm[13];	            /* Projection Parameters    */
+
+  H5D_layout_t    layout = H5D_LAYOUT_ERROR;/* Type of storage ID       */
+
+  void            *value;	            /* Fill value buffer        */
+
+  size_t          tsize = 0;	            /* Size of a data type      */
+
+  char            compmethod[HE5_HDFE_NAMBUFSIZE];/* Compression code            */
+  char            *dimbuf   = (char *)NULL;       /* Dimension buffer            */
+  char            *dimlist0 = (char *)NULL;       /* Auxilliary dimension list   */
+  char            *comma    = (char *)NULL;       /* Pointer to ","              */
+  char            *dimcheck = (char *)NULL;       /* Individual dimen. string    */
+  char            *utlbuf   = (char *)NULL;       /* Utility buffer              */
+  char            *utlbuf2  = (char *)NULL;       /* Utility buffer 2            */
+  char            gridname[HE5_HDFE_NAMBUFSIZE];  /* Grid name buffer            */
+  char            parmbuf[HE5_HDFE_NAMBUFSIZE];	  /* Parameter string buffer     */
+  char            *errbuf1  = (char *)NULL;       /* Error message buffer #1     */
+  char            *errbuf2  = (char *)NULL;       /* Error message buffer #2     */
+  char            *errmsg1  = "Dimension: %d (size: %lu) not divisible by ";
+  char            *errmsg2  = "tile dimension (size:  %lu).\n";
+  char            *errmsg   = (char *)NULL;        /* Tiling error message       */
+  /*  char            *HDFcomp[5] = {"HE5_HDFE_COMP_NONE", "HE5_HDFE_COMP_RLE","HE5_HDFE_COMP_NBIT", "HE5_HDFE_COMP_SKPHUFF","HE5_HDFE_COMP_DEFLATE"};                      Compression code names */
+  char            compparmbuf[HE5_HDFE_NAMBUFSIZE]; /* Compression string buffer */
+  char            maxdimlstbuf[HE5_HDFE_NAMBUFSIZE];/* Max.Dimension list buffer */
+  char            *errbuf   = (char *)NULL;         /* Error message buffer      */
+  char            *nameptr = (char *)NULL;
+  char            tempname[HE5_HDFE_NAMBUFSIZE];
+  hid_t           numbertype = FAIL;                /* Number type ID            */
+  int             attr      = 0;                    /* attribute value           */
+
+  H5D_fill_value_t fill_status;      /* to see if fill value is set or not  */
+
+  hid_t           numtype   = FAIL;
+  hsize_t         metavalue = 0;                    /* Metavalue to insert       */
+  hid_t           ntype;
+
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKPOINTER(dimlist);
+  	
+  /* assuming that fillvalue is undefined for the field */
+  fill_status = H5D_FILL_VALUE_UNDEFINED;
+
+ 
+  /* Convert HDF-EOS5 datatype to HDF5 datatype */
+  if (
+      H5Tequal(numbertype_in, H5T_NATIVE_CHAR)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SHORT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_INT)    == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UINT)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LONG)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LLONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_FLOAT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== SUCCEED ||
+      H5Tequal(numbertype_in, H5T_C_S1) == SUCCEED)
+    {
+      ntype = numbertype_in;
+    }
+  else
+    {
+      ntype = HE5_EHconvdatatype((int) numbertype_in);
+    }
+
+  if(ntype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID for defining field.\n");
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  errbuf1 = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf1 == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for error buffer1.\n");
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+     
+      return(FAIL);
+    }
+
+  errbuf2 = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf2 == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for error buffer2.\n");
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(errbuf1);
+		
+      return(FAIL);
+    }
+
+
+  /* Allocate memory for tiling error message */
+  /* ---------------------------------------- */
+  errmsg  = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errmsg == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tiling error message.\n");
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(errbuf1);
+      free(errbuf2);
+
+      return(FAIL);
+    }
+    
+  /* Setup error message strings */
+  /* --------------------------- */
+  strcpy(errbuf1, "HE5_GDXSDname array too small.\nPlease increase ");
+  strcat(errbuf1, "size of HE5_HDFE_NAMBUFSIZE in \"HE5_HdfEosDef.h\".\n");
+  strcpy(errbuf2, "HE5_GDXSDdims array too small.\nPlease increase ");
+  strcat(errbuf2, "size of HE5_HDFE_DIMBUFSIZE in \"HE5_HdfEosDef.h\".\n");
+
+  /* Build tiling dimension error message */
+  /* ------------------------------------ */
+  strcpy(errmsg, errmsg1);
+  strcat(errmsg, errmsg2);
+
+  /* Initialize dims and maxdims arrays */
+  /* ---------------------------------- */
+  for(i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      dims[i]    = 0;
+      maxdims[i] = 0;
+    }
+  
+  /* Initialize projparm[] array */
+  /* --------------------------- */
+  for ( i = 0; i < 13; i++)
+    projparm[ i ] = 0.;
+	
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDdeffield", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for Grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(errbuf1);
+      free(errbuf2);
+      free(errmsg);
+		
+      return(FAIL);
+    }
+	
+
+  /* Allocate memory for utility buffers */
+  /* ----------------------------------- */
+  utlbuf   = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if( utlbuf == NULL )
+    {
+      sprintf(errbuf,"Can not allocate memory for utility buffer.\n");
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(errbuf1);
+      free(errbuf2);
+      free(errmsg);
+		
+      return(FAIL);
+    }
+  utlbuf2  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if( utlbuf2 == NULL )
+    {
+      sprintf(errbuf,"Can not allocate memory for utility buffer2.\n");
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(errbuf1);
+      free(errbuf2);
+      free(errmsg);
+      free(utlbuf);
+		
+      return(FAIL);
+    }
+	
+
+  strcpy(gridname, HE5_GDXGrid[idx].gdname);
+	
+  /* Allocate space for dimension buffer and auxilliary dimension list */
+  /* ----------------------------------------------------------------- */
+  dimbuf = (char *)calloc(strlen(dimlist) + 64, sizeof(char));
+  if(dimbuf == NULL)
+    {
+      sprintf(errbuf,"Can not allocate memory for dimension buffer.\n");
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(errbuf1);
+      free(errbuf2);
+      free(errmsg);
+      free(utlbuf);
+      free(utlbuf2);
+    
+      return(FAIL);
+    }
+
+  dimlist0 = (char *)calloc(strlen(dimlist) + 64, sizeof(char));
+  if(dimlist0 == NULL)
+    {
+      sprintf(errbuf,"Can not allocate memory for dimension list string.\n");
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(errbuf1);
+      free(errbuf2);
+      free(errmsg);
+      free(utlbuf);
+      free(utlbuf2);
+      free(dimbuf);
+
+      return(FAIL);
+    }
+	
+  status = HE5_GDgridinfo(gridID, &xdim, &ydim, NULL, NULL);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about Grid.\n");
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(errbuf1);
+      free(errbuf2);
+      free(errmsg);
+      free(utlbuf);
+      free(utlbuf2);
+      free(dimbuf);
+      free(dimlist0);
+		
+      return(FAIL);
+    }
+
+ /* Get Grid and Projection info */
+  /* ---------------------------- */	
+  status = HE5_GDprojinfo(gridID, &projcode, NULL, NULL, projparm);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get Grid projection information.\n");  
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(errbuf1);
+      free(errbuf2);
+      free(errmsg);
+      free(utlbuf);
+      free(utlbuf2);
+      free(dimbuf);
+      free(dimlist0);
+		
+      return(FAIL);
+    }
+	
+
+  /* Setup Block Dimension if "Blocked" SOM projection */
+  /* ------------------------------------------------- */
+  if (projcode == HE5_GCTP_SOM && (long)projparm[11] != 0)
+    {
+      dimsize = HE5_GDdiminfo(gridID, "SOMBlockDim");
+		
+      /* If "SOMBlockDim" not yet defined then do it */
+      if (dimsize == 0)
+	{
+	  status = HE5_GDdefdim(gridID, "SOMBlockDim", (hsize_t)projparm[11]);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot define \"SOMBlockDim\" dimension.\n");  
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      free(dimbuf);
+	      free(dimlist0);
+
+	      return(FAIL);
+	    }
+			
+	}
+		
+      /* If not 1D field then prepend to dimension list */
+      if (strchr(dimlist, ',') != NULL)
+	{
+	  strcpy(tempname, dimlist);
+	  nameptr = strchr( tempname, ',' );
+	  if ( nameptr != NULL )
+	    {
+	      nameptr[0] = '\0';
+	    }
+ 
+	  if ( strcmp(tempname, "SOMBlockDim") != 0)
+	    {
+	      strcpy(dimbuf, "SOMBlockDim,");
+	      strcat(dimbuf, dimlist);
+	    }
+	  else
+	    {
+	      strcpy(dimbuf, dimlist);
+	    }
+	}
+      else
+	{
+	  strcpy(dimbuf, dimlist);
+	}
+    }
+  else
+    {
+      /* If not "Blocked" SOM then just copy dim list to dim buffer */
+      strcpy(dimbuf, dimlist);
+    }
+
+  /*
+   * Copy dimension buffer to auxilliary dimlist and Append comma to
+   * end of dimension list
+   */
+  strcpy(dimlist0, dimbuf);
+  strcat(dimbuf, ",");
+
+	
+  /* Find comma */
+  /* ---------- */
+  comma = strchr(dimbuf, ',');
+	
+  /*
+   * Loop through entries in dimension list to make sure they are
+   * defined in grid
+   */
+  while (comma != NULL)
+    {
+      /* Copy dimension list entry to dimcheck */
+      /* ------------------------------------- */
+      dimcheck = (char *)calloc(comma - dimbuf + 1, sizeof(char));
+      if(dimcheck == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory.\n");
+	  H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if(dimbuf != NULL) free(dimbuf);
+	  if(dimlist0 != NULL) free(dimlist0);
+	  free(errbuf);
+	  free(errbuf1);
+	  free(errbuf2);
+	  free(errmsg);
+	  free(utlbuf);
+	  free(utlbuf2);
+
+	  return(FAIL);
+	}
+      memmove(dimcheck, dimbuf, comma - dimbuf);
+		
+      /* Get Dimension Size */
+      /* ------------------ */
+      if (strcmp(dimcheck, "XDim") == 0)
+	{
+	  /* If "XDim" then use xdim value for grid definition */
+	  /* ------------------------------------------------- */
+	  dimsize = (hsize_t)xdim;
+	  found = 1;
+	  dims[ rank ] = dimsize;
+	  rank++;
+	}
+      else if (strcmp(dimcheck, "YDim") == 0)
+	{
+	  /* If "YDim" then use ydim value for grid definition */
+	  /* ------------------------------------------------- */
+	  dimsize = (hsize_t)ydim;
+	  found = 1;
+	  dims[ rank ] = dimsize;
+	  rank++;
+	}
+      else
+	{
+	  /* "Regular" Dimension */
+	  /* ------------------- */
+	  dimsize = HE5_GDdiminfo(gridID, dimcheck);
+	  if (dimsize > 0)
+	    {
+	      found = 1;
+	      dims[ rank ] = dimsize;
+	      rank++;
+	    }
+	  else
+	    {
+	      found = 0;
+	    }
+	}
+		
+      /*
+       * If dimension list entry not found - set error return status,
+       * append name to utility buffer for error report
+       */
+      if (found == 0)
+	{
+	  foundAllDim = 0;
+	  if (first == 1)
+	    {
+	      strcpy(utlbuf, dimcheck);
+	    }
+	  else
+	    {
+	      strcat(utlbuf, ",");
+	      strcat(utlbuf, dimcheck);
+	    }
+	  first = 0;
+	}
+	  
+      /*
+       * Go to next dimension entry, find next comma, & free up
+       * dimcheck buffer
+       */
+      memmove(dimbuf, comma + 1, strlen(comma)-1);
+      dimbuf[strlen(comma)-1]= 0;
+      comma = strchr(dimbuf, ',');
+      if(dimcheck != NULL) free(dimcheck);
+    }
+  if(dimbuf != NULL) free(dimbuf);
+	
+	
+  /* If all dimensions not found then report error */
+  /* --------------------------------------------- */
+  if (foundAllDim == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot find dimensions for \"%s\" field.\n", fieldname);
+      H5Eclear();
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FILE, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (dimlist0 != NULL) 
+	free(dimlist0);
+      free(errbuf);
+      free(errbuf1);
+      free(errbuf2);
+      free(errmsg);
+      free(utlbuf);
+      free(utlbuf2);
+		
+      return (status);
+    }
+
+  /* Check maxdimlist  */
+  /* Allocate space for dimbuf, copy dimlist into it, & append comma */
+  /*----------------------------------------------------------------*/
+  if(maxdimlist != NULL)
+    {
+      dimbuf = (char *)calloc(strlen(maxdimlist) + 64, sizeof(char));
+      strcpy(dimbuf, maxdimlist);
+      strcat(dimbuf, ",");
+		
+      /* Find comma */
+      comma = strchr(dimbuf, ',');
+		
+      /*
+       * Loop through entries in dimension list to make sure they are
+       * defined in grid
+       */
+      while (comma != NULL)
+	{
+	  /* Copy dimension list entry to dimcheck buffer */
+	  /* -------------------------------------------- */
+	  dimcheck = (char *)calloc(comma - dimbuf + 1, sizeof(char));
+	  if(dimcheck == NULL)
+	    {
+	      sprintf(errbuf, "Cannot allocate memory.\n");
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (dimbuf != NULL) 
+		free(dimbuf);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+		free(dimlist0);
+				
+	      return(FAIL);
+	    }
+	  memmove(dimcheck, dimbuf, comma - dimbuf);
+			
+	  /* Get dimension size */
+	  /* ------------------ */
+	  if (strcmp(dimcheck, "XDim") == 0)
+	    {
+	      /* If "XDim" then use xdim value for grid definition */
+	      /* ------------------------------------------------- */
+	      dimsize = (hsize_t)xdim;
+	      maxdims[ maxrank ] = dimsize;
+	      maxrank++;
+	    }
+	  else if (strcmp(dimcheck, "YDim") == 0)
+	    {
+	      /* If "YDim" then use ydim value for grid definition */
+	      /* ------------------------------------------------- */
+	      dimsize = (hsize_t)ydim;
+	      maxdims[ maxrank ] = dimsize;
+	      maxrank++;
+	    }
+	  else
+	    {
+	      dimsize = HE5_GDdiminfo(gridID, dimcheck);
+	      if ( (dimsize > 0) || (dimsize == H5S_UNLIMITED)  )
+		{
+		  maxdims[ maxrank ] = dimsize;
+		  maxrank++;
+		}
+	      else
+		{
+		  /*
+		   * If dimension list entry not found - set error return
+		   * status, append name to utility buffer for error report
+		   */
+		  foundAllDim = 0;
+		  if (first == 1)
+		    strcpy(utlbuf, dimcheck);
+		  else
+		    {
+		      strcat(utlbuf, ",");
+		      strcat(utlbuf, dimcheck);
+		    }
+		  first = 0;
+		}
+	    }
+			
+			
+	  /*
+	   * Go to next dimension entry, find next comma, & free up
+	   * dimcheck buffer
+	   */
+
+	  memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); 
+	  comma = strchr(dimbuf, ',');
+	  if (dimcheck != NULL) free(dimcheck);
+        }
+		
+      if(dimbuf != NULL) free(dimbuf);
+
+      /* If all dimensions not found then report error */
+      /* --------------------------------------------- */
+      if (foundAllDim == 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "Cannot find dimensions for \"%s\" field.\n", fieldname);
+	  H5Eclear();
+	  H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FILE, H5E_SEEKERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(errbuf1);
+	  free(errbuf2);
+	  free(errmsg);
+	  free(utlbuf);
+	  free(utlbuf2);
+	  if (dimlist0 != NULL)
+	    free(dimlist0);
+		  
+	  return(status);	 
+        }
+		
+
+    } /* end if */
+	
+  /* max dimmension equal to dims */
+  else
+    {
+      for(i = 0; i < rank; i++ )
+	maxdims[ i ] = dims[ i ];
+    }
+	
+	
+  /* Check out if dataset dimension is appendible */
+  /* -------------------------------------------- */
+  for(i = 0; i < rank; i++)
+    {
+      if(   dims[i] == maxdims[i] )
+	append = FALSE;
+      else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED))
+	{
+	  append = TRUE;
+	  break;
+	}
+      else
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Maximum dimension size is smaller than dimension size.\n");
+	  H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(errbuf1);
+	  free(errbuf2);
+	  free(errmsg);
+	  free(utlbuf);
+	  free(utlbuf2);
+	  if (dimlist0 != NULL)
+	    free(dimlist0);
+			  
+	  return(status);
+	}
+    } 
+	
+	
+  /* Check for valid data type ID  */
+  /* ----------------------------- */
+  if (ntype == HE5T_CHARSTRING)
+    {
+      foundNT=1;
+    }
+  else
+    {
+      if (H5Tequal(ntype, H5T_NATIVE_CHAR))
+	foundNT=1;
+      else if (H5Tequal(ntype, H5T_NATIVE_UCHAR))
+	foundNT=1;
+      else if (H5Tequal(ntype, H5T_NATIVE_SHORT))
+	foundNT=1;
+      else if (H5Tequal(ntype, H5T_NATIVE_USHORT))
+	foundNT=1;
+      else if (H5Tequal(ntype, H5T_NATIVE_INT))
+	foundNT=1;
+      else if (H5Tequal(ntype, H5T_NATIVE_UINT))
+	foundNT=1;
+      else if (H5Tequal(ntype, H5T_NATIVE_LONG))
+	foundNT=1;
+      else if (H5Tequal(ntype, H5T_NATIVE_ULONG))
+	foundNT=1;
+      else if (H5Tequal(ntype, H5T_NATIVE_LLONG))
+	foundNT=1;
+      else if (H5Tequal(ntype, H5T_NATIVE_ULLONG))
+	foundNT=1;
+      else if (H5Tequal(ntype, H5T_NATIVE_FLOAT))
+	foundNT=1;
+      else if (H5Tequal(ntype, H5T_NATIVE_DOUBLE))
+	foundNT=1;
+      else if (H5Tequal(ntype, H5T_NATIVE_LDOUBLE))
+	foundNT=1;
+      else if (H5Tequal(ntype, H5T_C_S1))
+        foundNT=1;
+      else
+	foundNT=0;
+    }
+	
+	
+  if (foundNT == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Invalid number type for \"%s\" field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_DATATYPE, H5E_BADTYPE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(errbuf1);
+      free(errbuf2);
+      free(errmsg);
+      free(utlbuf);
+      free(utlbuf2);
+      if (dimlist0 != NULL)
+	free(dimlist0);
+			
+      return(status);
+    }
+	
+
+
+  if (status == SUCCEED)
+    {
+      /* Get Field group ID, compresion code, & tiling code */
+      /* -------------------------------------------------- */
+      data_id = HE5_GDXGrid[idx].data_id;
+      strcpy(compmethod, HE5_GDXGrid[idx].compmethod);
+      tilecode = HE5_GDXGrid[idx].tilecode;
+
+      /* Check that field dims are divisible by tile dims */
+      /* ------------------------------------------------ */
+      if (tilecode == HE5_HDFE_TILE)
+	{
+	  for (i = 0; i < HE5_GDXGrid[idx].tilerank; i++)
+	    {
+	      if ((dims[ i ] % HE5_GDXGrid[ idx ].tiledims[ i ]) != 0)
+		{
+		  status = FAIL;
+		  sprintf(errbuf, errmsg, i, (unsigned long)dims[i],(unsigned long)HE5_GDXGrid[idx].tiledims[i]);
+		  H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(errbuf1);
+		  free(errbuf2);
+		  free(errmsg);
+		  free(utlbuf);
+		  free(utlbuf2);
+		  if (dimlist0 != NULL)
+		    free(dimlist0);
+					
+		  return(status);
+		}
+	    }
+			
+	}
+		
+		
+      /*      Create dataspace then create dataset       */
+      /* dataset creation property is not set outside by */
+      /*         GDdefchunksize() or GDdefcom()          */
+		
+
+      if(HE5_GDXGrid[ idx ].plist == FAIL)
+	{
+	  HE5_GDXGrid[ idx ].plist = H5Pcreate(H5P_DATASET_CREATE);
+	  if(HE5_GDXGrid[ idx ].plist == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot create a new property list.\n");  
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+		free(dimlist0);
+				
+	      return(FAIL);
+	    }
+	}
+		
+      /* Get layout information */
+      /* ---------------------- */		
+      layout = H5Pget_layout(HE5_GDXGrid[ idx ].plist);
+      if(layout == H5D_LAYOUT_ERROR)
+	{
+	  sprintf(errbuf,"Cannot get layout information for the dataset.\n");  
+	  H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(errbuf1);
+	  free(errbuf2);
+	  free(errmsg);
+	  free(utlbuf);
+	  free(utlbuf2);
+	  if (dimlist0 != NULL)
+	    free(dimlist0);
+			
+	  return(FAIL);
+	}
+		
+
+      if(append == FALSE)
+	{
+	  data_space = H5Screate_simple(rank, dims, NULL);
+	  if(data_space == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot create dataspace for the dataset.\n");  
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+		free(dimlist0);
+				
+	      return(FAIL);
+	    }
+	}
+      else
+	{
+	  if( layout == H5D_CHUNKED)
+	    {
+	      data_space = H5Screate_simple(rank, dims, maxdims);
+	      if(data_space == FAIL)
+		{
+		  sprintf(errbuf,"Cannot create dataspace for the dataset.\n");  
+		  H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(errbuf1);
+		  free(errbuf2);
+		  free(errmsg);
+		  free(utlbuf);
+		  free(utlbuf2);
+		  if (dimlist0 != NULL)
+		    free(dimlist0);
+							
+		  return(FAIL);
+		}
+	    }
+	  else
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Dataset MUST BE CHUNKED if it is extendible.\n");
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_DATASPACE, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+		free(dimlist0);
+						
+	      return(status);
+	    }
+	}
+	
+      /* Note: in inquiry routines HE5T_CHARSTRING is distinguished 
+	 from HE5T_NATIVE_CHAR for the field data (not attributes) based
+	 on whether string has variable or fixed length as set below.
+	 The field data of type HE5T_NATIVE_CHAR has fixed length of 1, and
+	 the field is array of characters, not strings. However, HE5T_CHARSTRING
+	 sets array of vaiable length strings for the field data.
+	 Currently HE5_EHattr treats HE5T_NATIVE_CHAR, HE5T_CHARSTRING, and
+	 H5T_C_S1 as fixed (any size) for attributes. 
+      */
+	
+      numbertype = ntype;
+      if ((ntype == HE5T_CHARSTRING) || (ntype == H5T_C_S1))
+	{
+	  numbertype = H5Tcopy(H5T_C_S1);
+	  status = H5Tset_size(numbertype, H5T_VARIABLE);
+	  if( status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the total size for \"%s\" field. \n", fieldname);
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+		free(dimlist0);
+	      return(status);
+	    }
+ 
+	  /* Create dataset */
+	  /* -------------- */
+	  dataset = H5Dcreate(data_id, fieldname, numbertype, data_space, HE5_GDXGrid[ idx ].plist);
+	  if (dataset == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", fieldname);
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+                free(dimlist0);
+	      return(FAIL);
+	    }
+ 
+	}
+      else if (numbertype == H5T_NATIVE_CHAR)
+	{
+	  numbertype = H5Tcopy(H5T_C_S1);
+	  status = H5Tset_size(numbertype, 1);
+	  if( status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the total size for \"%s\" field. \n", fieldname);
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+		free(dimlist0);
+	      return(status);
+	    }
+ 
+	  /* Create dataset */
+	  /* -------------- */
+	  dataset = H5Dcreate(data_id, fieldname, numbertype, data_space, HE5_GDXGrid[ idx ].plist);
+	  if (dataset == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", fieldname);
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+                free(dimlist0);
+	      return(FAIL);
+	    }
+ 
+	}
+      else
+	{
+	  /* Create dataset */
+	  /* -------------- */
+	  dataset = H5Dcreate(data_id, fieldname, ntype, data_space, HE5_GDXGrid[ idx ].plist);
+	  if(dataset == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot create dataset \"%s\".\n", fieldname);
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+		free(dimlist0);
+			
+	      return(FAIL);
+	    }
+	}
+		
+      /* Extend dataset. Assure that dataset is at least dims */
+      /* ---------------------------------------------------- */
+      if(append == TRUE)
+	{
+	  status = H5Dextend(dataset,dims);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot extend the dataset.\n");  
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+		free(dimlist0);
+				
+	      return(status);
+	    }
+	}
+		
+
+      /* Allocate space for the ID array */
+      /* ------------------------------- */
+      if (HE5_GDXGrid[idx].nDFLD > 0)
+	{
+	  /* Array already exists therefore reallocate */
+	  /* ----------------------------------------- */
+	  HE5_GDXGrid[idx].ddataset = (HE5_DTSinfo *) realloc((void *)HE5_GDXGrid[idx].ddataset,(HE5_GDXGrid[idx].nDFLD + 1) * sizeof(HE5_DTSinfo));
+	  if(HE5_GDXGrid[idx].ddataset == NULL)
+	    {
+	      sprintf(errbuf,"Cannot reallocate memory for the dataset.\n"); 
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+		free(dimlist0);
+				
+	      return(FAIL);
+	    }
+	}
+      else
+	{
+	  /* Array does not exist */
+	  /* -------------------- */
+	  HE5_GDXGrid[idx].ddataset = (HE5_DTSinfo *) calloc(1, sizeof(HE5_DTSinfo));
+	  if(HE5_GDXGrid[idx].ddataset == NULL)
+	    {
+	      sprintf(errbuf,"Cannot allocate memory for the dataset.\n");
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+		free(dimlist0);
+				
+	      return(FAIL);
+	    }
+	}
+		
+      /* Allocate memory for the dataset name string */
+      /* ------------------------------------------- */
+      HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name = (char *)calloc( (strlen(fieldname)+1), sizeof(char) );
+      if(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for the dataset name string.\n");
+	  H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(errbuf1);
+	  free(errbuf2);
+	  free(errmsg);
+	  free(utlbuf);
+	  free(utlbuf2);
+	  if (dimlist0 != NULL)
+	    free(dimlist0);
+	  free(HE5_GDXGrid[idx].ddataset);
+			
+	  return(FAIL);
+	}
+		
+      /* Save the field/dataset ID and field/dataset name */
+      /* ------------------------------------------------ */
+      HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].ID = dataset;
+      strcpy( HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name, fieldname);
+		
+      HE5_GDXGrid[idx].nDFLD++;
+		
+      if ((ntype != HE5T_CHARSTRING) && (ntype != H5T_NATIVE_CHAR) && (ntype != H5T_C_S1))
+	{
+	  /* Get the data size (bytes) */
+	  /* ------------------------- */
+	  tsize = H5Tget_size(ntype);
+
+	  /* Allocate memory for the fillvalue buffer */
+	  /* ---------------------------------------- */
+	  value = (void *)calloc( 1,  tsize );
+	  if(value == (void *)NULL)
+	    {
+	      sprintf(errbuf,"Cannot allocate memory for the \"value\" variable.\n");
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+		free(dimlist0);
+	      free(HE5_GDXGrid[idx].ddataset);
+	      free(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name);
+			
+	      return(FAIL);
+	    }
+
+
+	  /* Try to get fill value */
+	  /* --------------------- */
+	  H5E_BEGIN_TRY {
+	    status = H5Pfill_value_defined(HE5_GDXGrid[idx].plist, &fill_status );
+	  }
+	  H5E_END_TRY;
+	  if (fill_status == H5D_FILL_VALUE_USER_DEFINED)
+	    {
+	      H5E_BEGIN_TRY {
+		status = H5Pget_fill_value( HE5_GDXGrid[idx].plist,  ntype,  value);
+	      }
+	      H5E_END_TRY;
+	      
+	      /* Store fill value in the dataset attribute "_FillValue" */
+	      /* -----------------------------------------------------  */ 
+	      if( status != FAIL )
+		{
+		  status = HE5_EHattr( dataset, "_FillValue", ntype, count, "w", value);
+		  if(status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot write fill value to the \"_FillValue\" attribute.\n");
+		      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(errbuf);
+		      free(errbuf1);
+		      free(errbuf2);
+		      free(errmsg);
+		      free(utlbuf);
+		      free(utlbuf2);
+		      if (dimlist0 != NULL) free(dimlist0);
+		      free(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name);
+		      free(HE5_GDXGrid[idx].ddataset);
+		      free(value);
+		      return(FAIL);
+		    }
+		}
+	    }
+	  free( value);
+		
+	}
+		
+      /* 
+************************************************************
+*             SET  UP  METADATA   STRINGS                  *
+************************************************************
+*/
+	  
+	  
+      /* set up "DimList" string content */
+      /* ------------------------------- */
+      strcpy(utlbuf,"");
+      sprintf(utlbuf, "%s%s%s", fieldname, ":", dimlist0);
+		
+      /* set up max dim list string */
+      /* -------------------------- */
+      if ( maxdimlist != NULL)
+	{
+	  /* Make metadata string list for max dimension list */
+	  /* ------------------------------------------------ */
+	  strcpy(utlbuf2,"");
+	  strcpy(maxdimlstbuf,"");
+	  status = HE5_EHmetalist(maxdimlist , maxdimlstbuf);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot make metadata string list for the max dimension list.\n");
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+		free(dimlist0);
+	      free(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name);
+	      free(HE5_GDXGrid[idx].ddataset);
+				
+	      return(FAIL);
+	    }
+	  sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=",maxdimlstbuf);
+	  strcat(utlbuf,utlbuf2);
+	}
+      if ( maxdimlist == NULL )
+	{
+	  strcpy(utlbuf2,"");
+	  strcpy(maxdimlstbuf,"");
+	  status = HE5_EHmetalist(dimlist0, maxdimlstbuf);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot make metadata string list for the max dimension list.\n");
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+		free(dimlist0);
+	      free(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name);
+	      free(HE5_GDXGrid[idx].ddataset);
+				
+	      return(FAIL);
+	    }
+	  sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=",maxdimlstbuf);
+	  strcat(utlbuf,utlbuf2);
+	}
+		
+		
+      /* Setup compression metadata */
+      /* -------------------------- */
+      strcpy(compmethod, HE5_GDXGrid[idx].compmethod);
+		
+      if ( strcmp(compmethod,  "HE5_HDFE_COMP_NONE" ) != 0 )
+	{
+	  if(maxdimlist != NULL)
+	    {
+	      sprintf(utlbuf2, "%s%s", "\n\t\t\t\tCompressionType=", compmethod);
+	    }
+	  else
+	    {
+	      sprintf(utlbuf2, "%s%s", "\n\t\t\t\tCompressionType=", compmethod);
+	    }
+			
+	  if( strcmp(compmethod,"HE5_HDFE_COMP_NBIT") == 0 )
+	    {
+	      strcpy(compparmbuf,""); 
+	      sprintf(compparmbuf, "%s%d,%d,%d,%d%s","\n\t\t\t\tCompressionParams=(", HE5_GDXGrid[idx].compparm[0], HE5_GDXGrid[idx].compparm[1], HE5_GDXGrid[idx].compparm[2], HE5_GDXGrid[idx].compparm[3], ")");
+	      strcat(utlbuf2, compparmbuf);
+	    }
+			
+	  else if ( strcmp(compmethod, "HE5_HDFE_COMP_DEFLATE") == 0)
+	    {
+	      strcpy(compparmbuf,"");
+	      sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_GDXGrid[idx].compparm[0]);
+	      strcat(utlbuf2, compparmbuf);
+	    }
+
+	  else if ( strcmp(compmethod, "HE5_HDFE_COMP_SZIP_CHIP") == 0)
+	    {
+	      strcpy(compparmbuf,"");
+	      sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]);
+	      strcat(utlbuf2, compparmbuf);
+	    }
+
+	  else if ( strcmp(compmethod, "HE5_HDFE_COMP_SZIP_K13") == 0)
+	    {
+	      strcpy(compparmbuf,"");
+	      sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]);
+	      strcat(utlbuf2, compparmbuf);
+	    }
+
+	  else if ( strcmp(compmethod, "HE5_HDFE_COMP_SZIP_EC") == 0)
+	    {
+	      strcpy(compparmbuf,"");
+	      sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]);
+	      strcat(utlbuf2, compparmbuf);
+	    }
+
+	  else if ( strcmp(compmethod, "HE5_HDFE_COMP_SZIP_NN") == 0)
+	    {
+	      strcpy(compparmbuf,"");
+	      sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]);
+	      strcat(utlbuf2, compparmbuf);
+	    }
+
+	  else if ( strcmp(compmethod, "HE5_HDFE_COMP_SZIP_K13orEC") == 0)
+	    {
+	      strcpy(compparmbuf,"");
+	      sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]);
+	      strcat(utlbuf2, compparmbuf);
+	    }
+
+	  else if ( strcmp(compmethod, "HE5_HDFE_COMP_SZIP_K13orNN") == 0)
+	    {
+	      strcpy(compparmbuf,"");
+	      sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]);
+	      strcat(utlbuf2, compparmbuf);
+	    }
+
+	  else if ( strcmp(compmethod, "HE5_HDFE_COMP_SHUF_DEFLATE") == 0)
+	    {
+	      strcpy(compparmbuf,"");
+	      sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_GDXGrid[idx].compparm[0]);
+	      strcat(utlbuf2, compparmbuf);
+	    }
+ 
+	  else if ( strcmp(compmethod, "HE5_HDFE_COMP_SHUF_SZIP_CHIP") == 0)
+	    {
+	      strcpy(compparmbuf,"");
+	      sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]);
+	      strcat(utlbuf2, compparmbuf);
+	    }
+ 
+	  else if ( strcmp(compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13") == 0)
+	    {
+	      strcpy(compparmbuf,"");
+	      sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]);
+	      strcat(utlbuf2, compparmbuf);
+	    }
+ 
+	  else if ( strcmp(compmethod, "HE5_HDFE_COMP_SHUF_SZIP_EC") == 0)
+	    {
+	      strcpy(compparmbuf,"");
+	      sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]);
+	      strcat(utlbuf2, compparmbuf);
+	    }
+ 
+	  else if ( strcmp(compmethod, "HE5_HDFE_COMP_SHUF_SZIP_NN") == 0)
+	    {
+	      strcpy(compparmbuf,"");
+	      sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]);
+	      strcat(utlbuf2, compparmbuf);
+	    }
+ 
+	  else if ( strcmp(compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13orEC") == 0)
+	    {
+	      strcpy(compparmbuf,"");
+	      sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]);
+	      strcat(utlbuf2, compparmbuf);
+	    }
+ 
+	  else if ( strcmp(compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13orNN") == 0)
+	    {
+	      strcpy(compparmbuf,"");
+	      sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]);
+	      strcat(utlbuf2, compparmbuf);
+	    }
+ 
+	  /* Append compression parameters with compression code */
+	  /* --------------------------------------------------- */
+	  strcat(utlbuf, utlbuf2);
+	}
+
+		
+      /* Setup tiling information metadata */
+      /* --------------------------------- */
+      if (tilecode == HE5_HDFE_TILE)
+	{
+	  if ( strcmp(compmethod,  "HE5_HDFE_COMP_NONE" ) != 0 )
+	    {
+	      strcpy(utlbuf2,"");
+	      sprintf(utlbuf2,"%s%li","\n\t\t\t\tTilingDimensions=(", (long)HE5_GDXGrid[idx].tiledims[0]);
+	    }
+	  else
+	    {
+	      strcpy(utlbuf2,"");
+	      sprintf(utlbuf2, "%s%li","\n\t\t\t\tTilingDimensions=(", (long)HE5_GDXGrid[idx].tiledims[0]);
+	    }
+			
+	  for (i = 1; i < HE5_GDXGrid[idx].tilerank; i++)
+	    {
+	      sprintf(parmbuf, ",%li", (long)HE5_GDXGrid[idx].tiledims[ i ]);
+	      strcat(utlbuf2, parmbuf);
+	    }
+	  strcat(utlbuf2, ")");
+	  strcat(utlbuf, utlbuf2);
+	}
+		
+		
+      numtype = HE5_EHdtype2numtype(ntype);
+      if (numtype == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the number type ID. \n");
+	  H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(errbuf1);
+	  free(errbuf2);
+	  free(errmsg);
+	  free(utlbuf);
+	  free(utlbuf2);
+	  if (dimlist0 != NULL)
+	    free(dimlist0);
+	  free(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name);
+	  free(HE5_GDXGrid[idx].ddataset);
+
+	  return(FAIL);
+	}
+      else if (numtype == 0)
+	{
+	  metavalue = 0;
+	}
+      else
+	{
+	  metavalue = HE5_EHhid2hsize(numtype);
+	  if (metavalue == 0)
+	    {
+	      sprintf(errbuf, "Cannot convert \"hid_t\" to \"hsize_t\" data type. \n");
+	      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(errbuf1);
+	      free(errbuf2);
+	      free(errmsg);
+	      free(utlbuf);
+	      free(utlbuf2);
+	      if (dimlist0 != NULL)
+		free(dimlist0);
+	      free(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name);
+	      free(HE5_GDXGrid[idx].ddataset);
+
+	      return(FAIL);
+	    }
+	}
+
+
+      /* Insert field metadata within File Structural Metadata */
+      /* ----------------------------------------------------- */
+      status = HE5_EHinsertmeta(fid, gridname, "g", 4L, utlbuf, &metavalue);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot insert metadata.\n");
+	  H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(errbuf1);
+	  free(errbuf2);
+	  free(errmsg);
+	  free(utlbuf);
+	  free(utlbuf2);
+	  if (dimlist0 != NULL)
+	    free(dimlist0);
+	  free(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name);
+	  free(HE5_GDXGrid[idx].ddataset);
+			
+	  return(FAIL);
+	}
+		
+
+    }
+	
+  /* Release the property list ID */
+  /* ---------------------------- */
+
+  status = H5Pclose(HE5_GDXGrid[idx].plist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release the property list ID.\n");
+      H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }	
+
+  /* Reset property list ID */
+  /* ---------------------- */
+
+  HE5_GDXGrid[idx].plist = FAIL;
+  strcpy(HE5_GDXGrid[idx].compmethod,"HE5_HDFE_COMP_NONE");
+  HE5_GDXGrid[idx].tilecode         = HE5_HDFE_NOTILE;
+
+  if (dimlist0 != NULL) free(dimlist0);
+  if (utlbuf   != NULL) free(utlbuf);
+  if (utlbuf2  != NULL) free(utlbuf2);
+  if (errbuf   != NULL) free(errbuf);
+  if (errbuf1  != NULL) free(errbuf1);
+  if (errbuf2  != NULL) free(errbuf2);
+  if (errmsg   != NULL) free(errmsg);
+
+  if ((ntype == HE5T_CHARSTRING) || (ntype == H5T_C_S1))
+    {
+      attr = HE5T_CHARSTRING;
+      status = HE5_GDwritelocattr(gridID, fieldname, "ARRAYOFSTRINGS", H5T_NATIVE_INT, count, &attr);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write attribute to the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+    }
+    	
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDupdatedim                                                  |
+|                                                                             |
+|  DESCRIPTION: Updates numerical value of dimension                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Grid structure ID                       |
+|  dimname        char*               Dimension name                          |
+|  dim            hsize_t             Dimension size                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date      Programmer   Description                                        |
+|  ========   ============  ================================================  |
+|  Sep 2011   Abe Taaheri  Original development                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t
+HE5_GDupdatedim(hid_t gridID,  char *dimname, hsize_t dim)
+{
+  herr_t       status    = FAIL;/* routine return status variable  */
+ 
+  hid_t        fid       = FAIL;/* HDF-EOS file ID                 */
+  hid_t        gid       = FAIL;/* "HDFEOS" group ID               */
+ 
+  long         idx       = FAIL;/* Grid index                     */
+ 
+  char         errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  hsize_t      predims;
+  long        xdim  = 0;                  /* X dim size                */
+  long        ydim  = 0;                  /* Y dim size                */
+ 
+  HE5_LOCK;
+  CHECKNAME(dimname);
+ 
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+status = HE5_GDchkgdid(gridID, "HE5_GDupdatedim", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDupdatedim", __LINE__,  
+	      H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Make certain that dim != 0 */
+  /* -------------------------- */
+  if ( dim == 0 )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Invalid (zero) dimension size.\n");
+      H5Epush(__FILE__, "HE5_GDupdatedim", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get dimension size */
+  /* ------------------ */
+  if ((strcmp(dimname, "XDim") == 0) || (strcmp(dimname, "YDim") == 0))
+    {
+      status = HE5_GDgridinfo(gridID, &xdim, &ydim, NULL, NULL);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get information about Grid.\n");
+	  H5Epush(__FILE__, "HE5_GDupdatedim", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      
+      if(strcmp(dimname, "XDim") == 0)
+	{
+	  predims =  (hsize_t)xdim;
+	}
+      else if(strcmp(dimname, "YDim") == 0)
+	{
+	  predims = (hsize_t)ydim;
+	}
+    }
+  else
+    {
+      predims = HE5_GDdiminfo(gridID, dimname);
+    }
+
+  if (predims == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Failed to retrieve the size of \"%s\" dimension. \n", dimname);
+      H5Epush(__FILE__, "HE5_GDupdatedim", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+ 
+
+  /* Write updated dimension back to the dataset "StructMetadata.0" */
+  /* -------------------------------------------------------------- */
+  if (dim > predims)
+    {
+      status = HE5_EHupdatemeta(fid, HE5_GDXGrid[idx].gdname, "g", 0L, dimname, &dim);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot update the value for \"%s\" dimension in Metadata.\n", dimname);
+	  H5Epush(__FILE__, "HE5_GDupdatedim", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefdimscale                                                |
+|                                                                             |
+|  DESCRIPTION: Defines dimension scale for all fields that use the given     |
+|               dimesion                                                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               grid structure ID                       |
+|  dimname        char                dim name                                |
+|  dimsize        hsize_t             Dimemsion size value                    |
+|  numbertype_in  hid_t               dim scale data type such as DFNT_INT32, |
+|                                     DFNT_FLOAT64, DFNT_FLOAT32, etc.        |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES: This function finds out which field in a grid has the dimension     |
+|         and sets dimension scale for that field calling HE5_GDsetdimscale() |
+|         User must detach grid after creating fields and attach again before |
+|         calling the routine.                                                |
+|                                                                             |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ===============================================   |
+|  Dec 2013   Abe Taaheri   Original Programmer                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_GDdefdimscale(hid_t gridID,  char *dimname,
+		  const hsize_t dimsize, hid_t numbertype_in, void * data)
+{
+  herr_t       status    = FAIL;/* routine return status variable  */
+  hid_t        fid       = FAIL;/* HDF-EOS file ID                 */
+  hid_t        gid       = FAIL;/* "HDFEOS" group ID               */
+  long         idx       = FAIL;/* Swath index                     */
+  char         errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+  char         *fieldlist = NULL;
+  long         strbufsize;
+  long         nflds   = FAIL;
+
+  HE5_LOCK;
+  CHECKNAME(dimname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_GDchkgdid(gridID, "HE5_GDdefdimscale", &fid, &gid, &idx); 
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for Grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDdefdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Make certain that dimsize != 0 */
+  /* ------------------------------ */
+  if ( dimsize == 0 )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Invalid (zero) dimension size.\n");
+      H5Epush(__FILE__, "HE5_GDdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Loop over all fields in the grid and find out if 
+     field's dimension list  has the dimension name. 
+     If true then set the dimension scale for the dim 
+     in that field
+  */
+
+  /* Inquire Data Fields first*/
+  /* ------------------------ */
+  nflds = HE5_GDnentries(gridID, HE5_HDFE_NENTDFLD, &strbufsize);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n");
+      H5Epush(__FILE__, "HE5_GDdefdimscale", __LINE__, 
+	      H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else
+    {
+      fieldlist = (char *) calloc(strbufsize + 1, sizeof(char));
+      if(fieldlist == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory.\n");
+	  H5Epush(__FILE__, "HE5_GDdefdimscale", __LINE__, 
+		  H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      nflds = HE5_GDinqfields(gridID, fieldlist, NULL, NULL);
+      if (nflds == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the list of fields in \"Data Fields\" group. \n");
+	  H5Epush(__FILE__, "HE5_GDdefdimscale", __LINE__, 
+		  H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(fieldlist);
+	  return(FAIL);
+	}
+
+      if(nflds > 0)
+	{
+	  size_t        fldnmlen[HE5_FLDNUMBERMAX];      /* Array of namelengths */
+	  char          *fldnm[HE5_FLDNUMBERMAX];        /* Array of names       */
+	  char          tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list       */
+	  int           rank     = FAIL;                 /* Rank of dataset       */
+	  hsize_t	tempdims[HE5_DTSETRANKMAX];      /* Dimension sizes array*/
+	  hid_t         dtype[1] = {FAIL};               /* Data type            */
+	  long          ntflds   =  0;                   /* field counter        */
+	  int           i;
+	  char          *tempfield = NULL;
+	  unsigned int  Dimindex;
+
+	  ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen);
+	  if(ntflds != FAIL)
+	    {
+	      for(i = 0; i < ntflds; i++)
+		{
+		  tempfield      = (char *)calloc(fldnmlen[i] + 1, sizeof(char));
+		  memmove(tempfield,fldnm[i],fldnmlen[i]);
+		  tempfield[fldnmlen[i]]='\0';
+
+		  /* for this field see if the dimlist contains dimname */
+		  status = HE5_GDfieldinfo(gridID, tempfield, &rank, tempdims, 
+					   dtype, tempdimlist, NULL);
+
+		  if (status != SUCCEED)
+		    {
+		      sprintf(errbuf, "Field \"%s\" not found.\n", tempfield);
+		      H5Epush(__FILE__, "HE5_GDdefdimscale", __LINE__, H5E_ARGS, 
+			      H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(tempfield);
+		      free(fieldlist);
+		      return(FAIL);
+		    }
+
+		  Dimindex = FAIL;
+		  Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ',');
+		  if (Dimindex == FAIL) /* dimension not found */
+		    {
+		      continue; /*dimlist does not contain dim name */
+		    }
+		  else
+		    {
+		      /* call HE5_GDsetdimscle */
+		      status = HE5_GDsetdimscale(gridID, (char *)tempfield, 
+						 dimname,
+						 dimsize, 
+						 numbertype_in, 
+						 data);
+		      if ( status == FAIL )
+			{
+			  sprintf(errbuf,"Cannot set dimension scale %s for the field %s. \n", 
+				  dimname, tempfield);
+			  H5Epush(__FILE__, "HE5_GDdefdimscale", __LINE__, 
+				  H5E_OHDR, H5E_NOTFOUND, errbuf);
+			  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  free(tempfield);
+			  free(fieldlist);
+			  return(status);
+			}
+		    }
+		}
+	      free(tempfield);
+	      tempfield = NULL;
+	    }
+	}
+      free(fieldlist);
+      fieldlist = NULL;
+    }
+
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDsetdimscale                                                |
+|                                                                             |
+|  DESCRIPTION: Defines a dimension scale for a dimension for fields of a grid|
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               grid structure ID                       |
+|  fieldname      char                field name                              |
+|  dimname        char                Dimension name                          |
+|  dimsize        hsize_t             Dimemsion size value                    |
+|  numbertype_in  hid_t               dim scale data type such as DFNT_INT32, |
+|                                     DFNT_FLOAT64, DFNT_FLOAT32, etc.        |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_GDsetdimscale(hid_t gridID, char *fieldname, char *dimname,
+		  const hsize_t dimsize, hid_t numbertype_in, void * data)
+{
+  herr_t         status;
+  hid_t          ntype;
+  hsize_t        dims[HE5_DTSETRANKMAX];
+  int            rankSDS;
+  hid_t          field_ntype[1] = {FAIL};       /* number types       */ 
+  char           dimlist[HE5_HDFE_DIMBUFSIZE];
+  char           maxdimlist[HE5_HDFE_DIMBUFSIZE];
+  long           xdimsize;
+  long           ydimsize;
+  double         upleftpt[2];
+  double         lowrightpt[2];
+  double         pixsizeX;
+  double         pixsizeY;
+  hid_t          fid    = FAIL; 	       /* HDF-EOS file ID     */
+  hid_t          gid    = FAIL;	               /* "HDFEOS" group ID   */
+  hid_t          did;
+  hid_t          dsid;
+  hid_t          fspace   = FAIL;              /* File dataspace ID   */
+  unsigned int   Dimindex;
+  hid_t          dsplist  = FAIL;              /* Property list ID    */
+  H5D_layout_t   layout   = H5D_LAYOUT_ERROR;  /* Type of storage     */
+  hid_t          data_space  = FAIL;           /* dataspace ID        */
+  long           idx         = FAIL;           /* Grid index          */
+  char          *errbuf      = (char *)NULL;   /* buffer for error message*/
+  double        *data_bufff64= NULL;
+  void          *data_buff;
+  int            i, found;
+  int            rankds;
+  hsize_t        dimsds[1];
+
+  int projcode;
+  int zonecode;
+  int spherecode;
+  double projparm[13];
+
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKNAME(dimname);
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+    
+  /* Convert HDF-EOS5 datatype to HDF5 datatype */
+  if (
+      H5Tequal(numbertype_in, H5T_NATIVE_CHAR)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SHORT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_INT)    == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UINT)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LONG)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LLONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_FLOAT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== SUCCEED ||
+      H5Tequal(numbertype_in, H5T_C_S1) == SUCCEED)
+    {
+      ntype = numbertype_in;
+    }
+  else
+    {
+      ntype = HE5_EHconvdatatype((int) numbertype_in);
+    }
+
+  if(ntype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID for dimscale.\n");
+      H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get the data size (bytes) */
+  /* ------------------------- */
+  /*tsize = H5Tget_size(ntype);*/
+  if((data == NULL) || 
+     (strcmp(dimname, "XDim") == 0) || 
+     (strcmp(dimname, "YDim") == 0))
+    {
+      data_bufff64 = (double *)calloc(dimsize, sizeof(double));
+      
+      if(data_bufff64 == NULL)
+	{ 
+	  sprintf(errbuf, "Cannot allocate memory for buffer.\n");
+	  H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+    }
+
+  /************************************************************************
+   * Check for proper grid ID and return HDF-EOS file ID, SDinterface ID, *
+   * and grid root Vgroup ID                                              *
+   ************************************************************************/
+  status = HE5_GDchkgdid(gridID, "HE5_GDsetdimscale", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__,  H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      if(data_bufff64 != NULL) free(data_bufff64);
+      return(FAIL);
+    }
+
+  if (status == 0)
+    {
+      /* Check that field exists */
+      /* ----------------------- */
+      status = HE5_GDfieldinfo(gridID, fieldname, &rankSDS, dims, field_ntype, dimlist, maxdimlist);
+
+      if (status != 0)
+	{
+	  sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__,  H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  if(data_bufff64 != NULL) free(data_bufff64);
+	  return(FAIL);
+	}
+      
+      /* get gridname */
+      /*strcpy(gridname, HE5_GDXGrid[idx].gdname);*/
+      
+      /* if dimname is XDim or YDim, data scale will be recalculated 
+	 using xdim, ydim, upleft and lowright for the grid*/
+      
+      if((data == NULL) || 
+	 (strcmp(dimname, "XDim") == 0) || 
+	 (strcmp(dimname, "YDim") == 0))
+	{
+	  status = HE5_GDgridinfo(gridID, &xdimsize, &ydimsize, upleftpt, lowrightpt);
+
+
+	  /* Get proj info */
+	  /* ------------- */
+	  status = HE5_GDprojinfo(gridID, &projcode, &zonecode,
+				  &spherecode, projparm);
+	  
+	  
+	  /* If no projection code defined then bail */
+	  /* --------------------------------------- */
+	  if (projcode == -1 || status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot get Grid projection information.\n");  
+	      H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      if(data_bufff64 != NULL) free(data_bufff64);
+	      return(FAIL);
+	    }
+	  
+	  /* Get default values for upleft and lowright if necessary */
+	  /* ------------------------------------------------------- */
+	  if (upleftpt[0] == 0 && upleftpt[1] == 0 &&
+	      lowrightpt[0] == 0 && lowrightpt[1] == 0)
+	    {
+	      status = HE5_GDgetdefaults(projcode, zonecode, projparm, spherecode,
+				     upleftpt, lowrightpt);
+	      
+	      /* If error then bail */
+	      /* ------------------ */
+	      if (status != 0)
+		{
+		  sprintf(errbuf,"Failed to get default values for uplft and lowrght points.\n" );
+		  H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  if(data_bufff64 != NULL) free(data_bufff64);
+		  status = -1;
+		  return (status);
+		}
+	    }
+	  
+	  if (projcode == HE5_GCTP_GEO)
+	    {
+	      /* GEO projection */
+	      /* -------------- */
+	      /* Convert upleft and lowright X coords from DMS to degrees */
+	      /* -------------------------------------------------------- */
+	      upleftpt[0] = HE5_EHconvAng(upleftpt[0], HE5_HDFE_DMS_DEG);
+	      lowrightpt[0] = HE5_EHconvAng(lowrightpt[0], HE5_HDFE_DMS_DEG);
+	      upleftpt[1] = HE5_EHconvAng(upleftpt[1], HE5_HDFE_DMS_DEG);
+	      lowrightpt[1] = HE5_EHconvAng(lowrightpt[1], HE5_HDFE_DMS_DEG);
+	    }
+
+	  if(strcmp(dimname, "XDim") == 0)
+	    {
+	      pixsizeX = (lowrightpt[0] - upleftpt[0])/dimsize;
+	      for (i = 0; i <dimsize ; i++)
+		{
+		  data_bufff64[i] = upleftpt[0] + i * pixsizeX;
+		}
+	      data_buff = data_bufff64;
+	    }
+	  else if(strcmp(dimname, "YDim") == 0)
+	    {
+	      pixsizeY = (lowrightpt[1] - upleftpt[1])/dimsize;
+	      for (i = 0; i <dimsize ; i++)
+		{
+		  data_bufff64[i] = upleftpt[1] + i * pixsizeY;
+		}
+	      data_buff = data_bufff64;
+	    }
+	}
+      else
+	{
+	  data_buff = data;
+	}
+      
+      /* Loop through all datasets in grid */
+      /* ------------------------------ */
+	for (i = 0; i < HE5_GDXGrid[idx].nDFLD; i++)
+	  {
+	    /* Get dataset name */
+	    if( strcmp(fieldname, HE5_GDXGrid[ idx ].ddataset[ i ].name) == 0 )
+	      {
+		found = 1; 
+		did = HE5_GDXGrid[ idx ].ddataset[ i ].ID;
+		break;
+	      } 
+	  }
+
+	if(found != 1) /* did not find fieldname */
+	  {
+	    sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname);
+	    H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__,  H5E_ARGS, H5E_BADRANGE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    if(data_bufff64 != NULL) free(data_bufff64);
+	    return(FAIL);
+	  }
+	/* Dimension index */
+
+	Dimindex = FAIL;
+	Dimindex = HE5_EHstrwithin(dimname, dimlist, ',');
+
+	if (Dimindex == FAIL) /* dimension not found */
+	  {
+	    status = FAIL;
+	    sprintf( errbuf, "Dimname \"%s\" does not exist for field \"%s\".\n", 
+		     dimname, fieldname );
+	    H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    if(data_bufff64 != NULL) free(data_bufff64); 
+	    return(status);
+	  }
+	
+	/* If dimension found ... */
+	/* Found the dimname; Use its dimid to set Dimension Scale*/
+	
+	/* See if dimscale dataset already exist */
+	
+	dsid = H5Dopen(HE5_GDXGrid[idx].gd_id, dimname);
+
+	if(dsid < 0) /* dimscale dataset does not exist. Create it */
+	  {
+	    /* create Dim Scale dataset */
+	    /* Try to open the " group */
+	    /* =================================== */
+	    
+	    dsplist = H5Pcreate(H5P_DATASET_CREATE);
+	    if(dsplist == FAIL)
+	      {
+		sprintf(errbuf,"Cannot create a new property list.\n");  
+		H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		if(data_bufff64 != NULL) free(data_bufff64); 		
+		return(FAIL);
+	      }
+	    /* Get layout information */
+	    /* ---------------------- */		
+	    layout = H5Pget_layout(dsplist);
+	    if(layout == H5D_LAYOUT_ERROR)
+	      {
+		sprintf(errbuf,"Cannot get layout information for the dataset.\n");  
+		H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		if(data_bufff64 != NULL) free(data_bufff64); 	
+		return(FAIL);
+	      }
+
+	    rankds = 1;
+	    dimsds[0] = dims[Dimindex];
+
+	    data_space = H5Screate_simple(rankds, dimsds, NULL);
+	    if(data_space == FAIL)
+	      {
+		sprintf(errbuf,"Cannot create dataspace for the dimension scale dataset.\n");  
+		H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		if(data_bufff64 != NULL) free(data_bufff64); 	
+		return(FAIL);
+	      }
+	    
+	    dsid = H5Dcreate(HE5_GDXGrid[idx].gd_id,dimname,ntype, data_space, dsplist);
+	    
+	    if( dsid == FAIL )
+	      {
+		sprintf(errbuf, "Cannot create dataset for Dimension Scale \"%s\" field. \n", dimname);
+		H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		if(data_bufff64 != NULL) free(data_bufff64); 
+		return(FAIL);
+	      }
+
+	    /* write data_buff to it */
+
+	    /* Get the field space ID */
+	    /* --------------------- */
+	    fspace = H5Dget_space(dsid);
+	    if ( fspace == FAIL)
+	      {
+		sprintf(errbuf, "Cannot get the file data space ID.\n");
+		H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		if(data_bufff64 != NULL) free(data_bufff64); 
+		return(FAIL);
+	      }
+
+	    status = H5Dwrite(dsid, ntype, data_space, fspace,  H5P_DEFAULT, data_buff);
+	    if( status == FAIL )
+	      {
+		sprintf(errbuf,"Cannot write data to the dataset.\n");
+		H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		if(data_bufff64 != NULL) free(data_bufff64); 
+		return(FAIL);
+	      }    
+	  }
+
+	/* Dataset exist. See if it is dimension Scale already. If not make it */
+	if ((H5DSis_scale(dsid)) <= 0 )
+	  {
+
+	    status = H5DSset_scale(dsid, dimname);
+	    if( status < 0)
+	      {
+		status = -1;
+		free(errbuf);
+		if(data_bufff64 != NULL) free(data_bufff64); 
+		goto COMPLETION;
+	      }
+
+	    if(H5DSattach_scale(did, dsid, Dimindex) < 0)
+	      {
+		status = -1;
+		free(errbuf);
+		if(data_bufff64 != NULL) free(data_bufff64); 
+		goto COMPLETION;
+	      }
+	  }
+	else
+	  {
+	    if(H5DSattach_scale(did, dsid, Dimindex) < 0)
+	      {
+		status = -1;
+		free(errbuf);
+		if(data_bufff64 != NULL) free(data_bufff64); 
+		goto COMPLETION;
+	      }
+	  }
+   
+	if( H5Dclose(dsid) < 0)
+	  {
+	    status = -1;
+	    free(errbuf);
+	    if(data_bufff64 != NULL) free(data_bufff64); 
+	    goto COMPLETION;
+	  }
+    }
+  free(errbuf);
+  if(data_bufff64 != NULL) free(data_bufff64);
+
+ COMPLETION:  
+  HE5_UNLOCK;
+
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetdimscale                                                |
+|                                                                             |
+|  DESCRIPTION: Get dimension scale for a dimension of a field in a grid      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         long                return databuffsize  SUCCEED, (-1) FAIL |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               grid structure ID                       |
+|  fieldname      char                field name                              |
+|  dimname        char                dim name                                |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dimsize        hsize_t             dimension size                          |
+|  ntype          hid_t               dtata type of dimension scale           |
+|  databuff       void                data buffer for read                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_GDgetdimscale(hid_t gridID, char *fieldname, char *dimname,
+		  hsize_t *dimsize, hid_t *ntype, void * databuff)
+{
+  int             i,j;		                   /* Loop index             */
+  long            status;	                   /* routine return status  */
+  long            idx    = FAIL;                   /* Grid index             */
+  hid_t           fid    = FAIL; 	           /* HDF-EOS file ID        */
+  hid_t           gid    = FAIL;	           /* "HDFEOS" group ID      */
+  hid_t           did    = FAIL;                   /* dataset ID             */
+  hid_t           dsid   = FAIL;                   /* dimscale dataset ID    */
+  hid_t           dspace = FAIL;                   /* data space ID          */
+  hid_t           mspace = FAIL;                   /* memory data space ID   */
+  hid_t           dtype  = FAIL;                   /* data type ID           */
+  hid_t           mtype  = FAIL;                   /* memory data type ID    */
+  H5T_class_t     classid = H5T_NO_CLASS;          /* Data type class ID     */
+  hsize_t         dimsds[HE5_DTSETRANKMAX];        /* Field dimensions       */
+  char           *errbuf = (char *)NULL;           /* buff for error message */
+  long            size   = 0;                      /* data buffer size(bytes)*/
+  int             rankds;
+  size_t          sd_type_size = 0;	           /* Size of a data type    */
+  unsigned int    Dimindex;
+  int             rankSDS;
+  hid_t           *field_ntype = (hid_t *)NULL;    /* number types           */
+  char            dimlist[HE5_HDFE_DIMBUFSIZE];
+  char            maxdimlist[HE5_HDFE_DIMBUFSIZE];
+  hsize_t         dims[HE5_DTSETRANKMAX];
+  int             found = 0;
+  htri_t          str_is_variable; /* boolean: TRUE if string is variable 
+				      lengeth FALSE if string is fixed length
+				      -1 if error in H5Tis_variavle_str() */
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKNAME(dimname);
+
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDgetdimscale", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for Grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* See if dimscale dataset exist */
+
+  dsid = H5Dopen(HE5_GDXGrid[idx].gd_id, dimname);
+  if(dsid < 0)
+    {
+      status = FAIL;
+      sprintf( errbuf, "Dimension scale dataset \"%s\" does not exist.\n", 
+	       dimname);
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+
+  /* Loop through all datasets in grid */
+  /* ------------------------------ */
+  for (i = 0; i < HE5_GDXGrid[idx].nDFLD; i++)
+    {
+      /* Get dataset name */
+      if( strcmp(fieldname, HE5_GDXGrid[ idx ].ddataset[ i ].name) == 0 )
+	{
+	  found = 1; 
+	  did = HE5_GDXGrid[ idx ].ddataset[ i ].ID;
+	  break;
+	}
+    }
+  if(found != 1) /* did not find fieldname */
+    {
+      sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname);
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__,  H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Check that field exists */
+  /* ----------------------- */
+  status = HE5_GDfieldinfo(gridID, fieldname, &rankSDS, dims, field_ntype, dimlist, maxdimlist);
+  
+  if (status != 0)
+    {
+      sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname);
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__,  H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* find the index of the dimension in the field */
+
+  Dimindex = FAIL;
+  Dimindex = HE5_EHstrwithin(dimname, dimlist, ',');
+  if (Dimindex == FAIL) /* dimension not found */
+    {
+      status = FAIL;
+      sprintf( errbuf, "Dimname \"%s\" does not exist for field \"%s\".\n", 
+	       dimname, fieldname );
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+
+  /* check that dimname is dimension scale name for the field dimname */
+  status = H5DSis_attached(did, dsid, Dimindex);
+
+  if( status < 0)
+    {
+      status = FAIL;
+      sprintf( errbuf, "Dimname \"%s\" is not dimension scale for a dimension in the field \"%s\".\n", dimname, fieldname );
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+
+  /* OK. dsid is a dimension scale for did. It is time to read Dimension 
+     Scale dataset for output */
+
+  /* get size first ... */
+  /* ------------------ */
+  dtype = H5Dget_type(dsid);
+  if ( dtype == FAIL )
+    {
+      size = 0;
+      sprintf(errbuf, "Cannot get data type ID.\n");
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Get data type size (bytes) */
+  /* -------------------------- */   
+  sd_type_size = H5Tget_size(dtype);
+  if ( sd_type_size == 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve data type size.\n");
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Get data space ID */
+  /* ----------------- */
+  dspace = H5Dget_space( dsid );
+  if (dspace == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the dataspace ID for the \"%s\" dataset.\n", dimname);
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /* Get dataset rank */
+  /* ---------------- */
+  rankds = H5Sget_simple_extent_ndims(dspace);
+  if ( rankds == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the dataset rank for the \"%s\" dataset.\n", dimname);
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /* Get dataset dimension sizes */
+  /* --------------------------- */
+  status = H5Sget_simple_extent_dims(dspace,dimsds, NULL);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the dataset dimension sizes for the \"%s\" dataset.\n", dimname);
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+  
+  /*----------------------------------------------------------------------*/
+
+  /* Get data class ID */
+  /* ----------------- */
+  classid       = H5Tget_class(dtype);
+  if (classid == H5T_NO_CLASS)
+    {
+      sprintf(errbuf, "Cannot get the data type class ID for \"%s\" dataset.",
+	      dimname);
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_DATATYPE, 
+	      H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (errbuf  != NULL) free(errbuf);
+      return(FAIL);
+    }
+  
+  if (classid == H5T_STRING)
+    {
+      /* HE5T_CHARSTRING has variable length for data fields */
+      str_is_variable = H5Tis_variable_str(dtype);
+      if(str_is_variable == TRUE)
+	{
+	  *ntype = HE5T_CHARSTRING;
+	}
+      else if(str_is_variable == FALSE)
+	{
+	  *ntype = HE5T_NATIVE_CHAR;
+	}
+      else
+	{
+	  sprintf(errbuf, "Failed to see if string field is varaible or fixed length for the \"%s\" field.\n",dimname);
+	  H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_DATATYPE, 
+		  H5E_NOTFOUND, errbuf);
+	  
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (errbuf  != NULL) free(errbuf);
+	  return(FAIL);
+	}
+    }
+  else
+    {
+      *ntype = HE5_EHdtype2numtype(dtype);
+       if (*ntype == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the number type for \"%s\" dataset.", 
+		  dimname);
+	  H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_DATATYPE, 
+		  H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (errbuf  != NULL) free(errbuf);
+	  return(FAIL);
+	}
+    }
+  /*----------------------------------------------------------------------*/
+		
+  status = H5Tclose(dtype);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot release the datatype ID.\n");
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /* Release the dataspace ID */
+  /* ------------------------ */
+  status = H5Sclose(dspace);
+  if ( status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" dataset.\n", dimname);
+      H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+
+  size = (long)dimsds[ 0 ];
+  *dimsize = (hsize_t)size;
+
+  for (j = 1; j < rankds; j++)
+    size *= (long)dimsds[j];
+ 
+  size *= (long)sd_type_size;
+
+  /* If data values are requested ... */
+  /* -------------------------------- */
+  if (databuff != NULL)
+    {
+      /* Create a data space in memory */
+      /* ----------------------------- */ 		
+      mspace = H5Screate_simple(rankds, (const hsize_t *)dimsds, NULL);
+      if ( mspace == FAIL )
+	{
+	  sprintf(errbuf,"Cannot create the data space.\n");
+	  H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_DATASPACE, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      dspace = H5Dget_space(dsid );
+      if (dspace == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the dataspace ID for the \"%s\" dataset.\n", dimname);
+	  H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+		
+      dtype = H5Dget_type(dsid);
+      if ( dtype == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get the datatype ID.\n");
+	  H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      /* Get the memory data type ID */
+      /* --------------------------- */
+      mtype = HE5_EHdtype2mtype(dtype);
+      if ( mtype == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get the memory data type.\n");
+	  H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      /* Read the selected points into the buffer */
+      /* ---------------------------------------  */
+      status = H5Dread(dsid, mtype, mspace, dspace, H5P_DEFAULT, databuff);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot read out the data from the dataset.\n");
+	  H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+				
+      status = H5Tclose(dtype);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the datatype ID.\n");
+	  H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+		
+      status = H5Sclose(mspace);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the memory data space ID.\n");
+	  H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+		
+      status = H5Sclose(dspace);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the file data space ID.\n");
+	  H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+    }
+
+  free(errbuf);
+ COMPLETION:
+  HE5_UNLOCK;
+  return (size);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDreaddscaleattr                                             |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with a dimension scale field       |
+|               from a grid.                                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char                field name                              |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 10   Abe Taaheri   Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDreaddscaleattr(hid_t gridID, const char *fieldname, const char *attrname, void *datbuf)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+
+  hid_t      ntype         = FAIL;/* hdf5 type data type ID         */
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      fieldID       = FAIL;/* Field-related dataset ID       */
+     
+  long       idx           = FAIL;/* Grid index                     */
+     
+  hsize_t    count[]={0};	   /* array with the number of elements */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer   */
+
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(attrname);
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDreaddscaleattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get field ID */
+      /* ------------ */
+      fieldID = H5Dopen(HE5_GDXGrid[idx].gd_id, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_GDreaddscaleattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+		
+      /* Call EHattr to perform I/O */
+      /* -------------------------- */
+      status = HE5_EHattr(fieldID, attrname, ntype, count, "r", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" field.\n", attrname,fieldname);
+	  H5Epush(__FILE__, "HE5_GDreaddscaleattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+        
+      /* Release dataset ID */
+      /* ------------------ */
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_GDreaddscaleattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}			
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:  HE5_GDwritedscaleattr                                           |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with a dimension scale    |
+|               field in a grid.                                              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               grid structure ID                       |
+|  fieldname      char*               dimension scale SDS name                |
+|  attrname       char*               attribute name                          |
+|  numtype        hid_t               attribute datatype ID                   |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10   Abe Taaheri   Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_GDwritedscaleattr(hid_t gridID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t  count[],  void *datbuf)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+  
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      fieldID       = FAIL;/* Field-related dataset ID       */
+  
+  long       idx           = FAIL;/* Grid index                     */
+  
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+  hid_t      ntype;
+  
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+  
+  /* 
+     if numtype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use ntype itself
+  */
+  ntype = HE5_EHconvdatatype(numtype);
+  if(ntype == FAIL)
+    {
+      ntype = numtype;
+    }
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDwritedscaleattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      
+      /* Get field ID */
+      /* ------------ */
+      fieldID = H5Dopen(HE5_GDXGrid[idx].gd_id, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_GDwritedscaleattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      
+      /* Call EHattr to perform I/O */
+      /* -------------------------- */
+      status = HE5_EHattr(fieldID, attrname, ntype, count,"w", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write Attribute \"%s\" for the \"%s\" field.\n", attrname, fieldname);
+	  H5Epush(__FILE__, "HE5_GDwritedscaleattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+      
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_GDwritedscaleattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+    }
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdscaleattrinfo                                             |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about dimension scale attribute         |
+|               (attribute associated with a specified dimension scale field) |
+|                in a grid.                                                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char*               field name                              |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               attribute data type ID                  |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10   Abe Taaheri   Original Development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_GDdscaleattrinfo(hid_t gridID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+  
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      fieldID       = FAIL;/* Field-related dataset ID       */
+  
+  long       idx           = FAIL;/* Grid index                     */
+  
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+  
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(attrname);
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDdscaleattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get field ID */
+      /* ------------ */
+
+      fieldID = H5Dopen(HE5_GDXGrid[idx].gd_id, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_GDdscaleattrinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Call EHattrinfo */
+      /* --------------- */
+      if(strcmp(attrname,"REFERENCE_LIST") !=0)/* do not need ntype for 
+						  internal dimension
+						  scale attribute */
+	{
+	  status = HE5_EHattrinfo(fieldID, attrname, ntype, count);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" associated with the dimension scale\"%s\".\n", attrname, fieldname);
+	      H5Epush(__FILE__, "HE5_GDdscaleattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	}
+      else
+	{
+	  status = -1;
+	  *ntype = -1;
+	  *count = 0;
+	  sprintf(errbuf,"Will not retrieve information about internal Attribute \"%s\" associated with the dimension scale \"%s\" .\n", attrname, fieldname);
+	  H5Epush(__FILE__, "HE5_GDdscaleattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_GDdscaleattrinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+    }
+
+ COMPLETION:
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDwritefieldmeta                                             |
+|                                                                             |
+|  DESCRIPTION: Writes field meta data for an existing grid field not         |
+|               defined within the grid API routine "HE5_GDdeffield".         |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char*               fieldname                               |
+|  dimlist        char*               Dimension list (comma-separated list)   |
+|  ntype          hid_t               Data type ID metadata value             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/20/99  A.Muslimov    In the call to EHinsertmeta() replaced the argument |
+|                         gid by fid.                                         |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  May  05  S.Zhao        Added HE5_EHdtype2numtype() function call.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDwritefieldmeta(hid_t gridID, const char *fieldname, char *dimlist, hid_t ntype)
+{
+  herr_t          status     = FAIL; /* routine return status variable */
+
+  hsize_t         metavalue  = 0;    /* Metavalue to insert            */
+  hid_t           fid        = FAIL; /* HDF-EOS file ID                */
+  hid_t           gid        = FAIL; /* "HDFEOS" group ID              */
+  
+  long            idx        = FAIL; /* Grid index                     */
+
+  char            utlbuf[HE5_HDFE_DIMBUFSIZE]; /* Utility buffer       */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* error message buffer */
+  hid_t           numtype    = FAIL;           /* Number type ID       */
+
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKPOINTER(dimlist);
+
+  numtype = HE5_EHdtype2numtype(ntype);
+  if (numtype == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number type ID. \n");
+      H5Epush(__FILE__, "HE5_GDwritefieldmeta", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else if (numtype == 0)
+    {
+      metavalue = 0;
+    }
+  else
+    {
+      metavalue = HE5_EHhid2hsize(numtype);
+      if ( metavalue == 0 )
+	{
+	  sprintf(errbuf, "Cannot convert metadata value. \n");
+	  H5Epush(__FILE__, "HE5_GDwritefieldmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+
+
+  status = HE5_GDchkgdid(gridID, "HE5_GDwritefieldmeta", &fid, &gid,  &idx);
+  if (status == SUCCEED)
+    {
+      sprintf(utlbuf, "%s%s%s", fieldname, ":", dimlist);
+      status = HE5_EHinsertmeta(fid, HE5_GDXGrid[idx].gdname, "g", 4L, utlbuf, &metavalue);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot insert metadata value. \n");
+	  H5Epush(__FILE__, "HE5_GDwritefieldmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDwrrdfield                                                  |
+|                                                                             |
+|  DESCRIPTION: Writes/Reads fields                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               grid structure ID                       |
+|  fieldname      char*               fieldname                               |
+|  code           char*               Write/Read code (w/r)                   |
+|  start          hssize_t            start array                             |
+|  stride         hsize_t             stride array                            |
+|  edge           hsize_t             edge array                              |
+|  count          hsize_t             array of the size of each dimension     |
+|  datbuf         void                data buffer for read                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                data buffer for write                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|              H5Dextend                                                      |
+|              H5Dget_space                                                   |
+|              H5Sselect_hyperslab                                            |
+|              H5Screate_simple                                               |
+|              H5Dget_type                                                    |
+|              H5Dwrite                                                       |
+|              H5Dread                                                        |
+|              H5Sclose                                                       |
+|              H5Tclose                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/21/99  A.Muslimov    Changed the data type of status variable from intn  |
+|                         to int   . Checked for the statuses returned by     |
+|                         H5Tclose() and H5Sclose(). Removed second call to   |
+|                         H5Sselect_hyperslab(). Renamed  variable numbertype |
+|                         by tid. Initialized dims[] array. In the call to    |
+|                         H5Screate_simple() replaced the second argument by  |
+|                         count. In the call to H5Tclose() passed tid as an   |
+|                         argument.                                           |
+| Jan 00   A.Muslimov     Modified to enable extendibility of a  dataset.     |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 07/17/00  A.Muslimov    Added EHdtype2mtype() before the call to H5Dread(). |
+| Dec 4,00  A.Muslimov    Modified to fix a problem with appending data to the|
+|                          extendible dataset.                                |
+|  Aug  03  S.Zhao        Added checking for SOMBlockDim in the dimlist.      |
+|  Jan  04  S.Zhao        Added to create a character string dataset.         |
+|  Apr  04  S.Zhao        Added the HE5_GDfldnameinfo() call.                 |
+|  Apr  04  S.Zhao        Modified for a character string dataset.            |
+|  Feb  05  S.Zhao        Replaced the "count" array by the "dims" array if   |
+|                         it was declared larger than the dimension size.     |
+|  Sep  11  Abe Taaheri   Modified for correcting Unlimited dimension         |
+|                         behavior and extension                              |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t  
+HE5_GDwrrdfield(hid_t gridID, const char *fieldname, char *code, const hssize_t start[], 
+const hsize_t stride[], const hsize_t  count[], void * datbuf)
+{
+  herr_t          status   = FAIL; /* routine return status variable     */
+
+  int             i;		   /* Loop index                         */
+  int             startf   =  0;   /* flag (if start is NULL)            */
+  int             countf   =  0;   /* flag (if counf is NULL)            */
+  int             bothf    =  0;   /* flag (if start and count are NULL) */
+  hssize_t        *tstart =(hssize_t *)NULL;/* Not NULL "start" value    */
+  hsize_t         *tcount = (hsize_t *)NULL;/* Not NULL "count" value    */
+  hsize_t         *lcount = (hsize_t *)NULL;
+  int             append   = FALSE;/* Flag                            */
+  int             rank     = FAIL; /* Rank of dataset                 */
+  int             rankidx1 = 0;	   /* Dummy rank index                */
+  int             rankidx2 = 0;	   /* Dummy rank index                */
+  int             projcode = FAIL; /* Projection Code                 */
+     
+
+  hid_t           fid      = FAIL;/* HDF-EOS file ID                  */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID                */
+  hid_t           tid      = FAIL;/* datatype ID                      */
+  hid_t           fspace   = FAIL;/* File dataspace ID                */
+  hid_t           dtsid    = FAIL;/* field dataset ID                 */
+  hid_t	          mid      = FAIL;/* Memory dataspace ID              */
+  hid_t           mtype    = FAIL;/* Memory data type ID              */
+
+  long            idx      = FAIL;/* Grid index                       */
+  long            xdim     = FAIL;/* Grid X dimension size            */
+  long            ydim     = FAIL;/* Grid Y dimension size            */
+     
+  hsize_t         dims[HE5_DTSETRANKMAX]    = {0, 0, 0, 0, 0, 0, 0, 0 };/* Field dataset dimensions      */
+  hsize_t         maxdims[HE5_DTSETRANKMAX] = {0, 0, 0, 0, 0, 0, 0, 0 };/* Field dataset max. dimensions */
+  hsize_t         dimsize                   = 0;		                /* Dimension size                */
+  hsize_t         size[HE5_DTSETRANKMAX]    = {0, 0, 0, 0, 0, 0, 0, 0 };/* Size to extend the dataset to */
+    
+  hid_t           *ntype                    = (hid_t *)NULL;            /* number types                  */ 
+
+  double          projparm[13] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};/* Projection Parameters        */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];
+  char            maxdimlist[HE5_HDFE_DIMBUFSIZE];
+  char            dimlist[HE5_HDFE_DIMBUFSIZE];
+  char            *dimcheck = (char *)NULL;
+  char            *comma    = (char *)NULL;
+  char            *dimbuf   = (char *)NULL;
+  char            *dimlist0 = (char *)NULL;	     /* Auxilliary dimension list */
+  char            *nameptr  = (char *)NULL;
+  char            tempname[HE5_HDFE_NAMBUFSIZE];
+  H5T_class_t     classid = H5T_NO_CLASS;            /* data type class ID     */
+  int             nameflag = FAIL;                   /* Actual (1)/Alias (0) field name    */
+  char            fldname[HE5_HDFE_NAMBUFSIZE];      /* Field name buffer      */
+  char            fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual field name      */
+
+  int             ibuf;                /* Loop index                        */
+  char            **chardatbuf = NULL; /* string data buffer                */
+  int             maxlen = 0;          /* max length in array of string     */
+  int             strsize = 0;         /* each str length in array of str   */
+  hsize_t         numattr[1];          /* number of attribute elements      */
+  int             mycount = 0;         /* flag                              */
+  long            strbufsize1;         /* string buffer size                */
+  long            strbufsize2;         /* string buffer size                */
+  long            nattr = 0;           /* number of attributes              */
+  char            *attrlist1 = (char *)NULL;/* attribute list               */
+  char            *attrlist2 = (char *)NULL;/* attribute list               */
+  char            *attptr = (char *)NULL;   /* attribute pointer            */
+  hsize_t	  dimsize_dim, dimsize_maxdim;
+  char            *dimname[HE5_DTSETRANKMAX];
+  CHECKNAME(fieldname);
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDwrrdfield", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		
+      return(FAIL);
+    }
+
+  /* Call HE5_GDfldnameinfo() to get actual field name */
+  /* ------------------------------------------------- */
+  nameflag = HE5_GDfldnameinfo(gridID, fieldname, fldactualname);
+  if ( nameflag == FAIL )
+    {
+      sprintf(errbuf, "Cannot get actual name of the field.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+ 
+      return(FAIL);
+    }
+ 
+  /* Name is not alias */
+  /* ----------------- */
+  if (nameflag == TRUE)
+    {
+      strcpy(fldname,"");
+      strcpy(fldname,fieldname);
+    }
+ 
+  /* Name is an alias */
+  /* ---------------- */
+  if (nameflag == FALSE)
+    {
+      strcpy(fldname,"");
+      strcpy(fldname,fldactualname);
+    }
+
+  /* Check that field exists */
+  /* ----------------------- */
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+  if(ntype == (hid_t *)NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+ 		
+      return(FAIL);
+    } 
+    
+  strcpy(dimlist,"");
+  strcpy(maxdimlist,"");
+
+  /* Get Field info */
+  /* -------------- */
+  status = HE5_GDfieldinfo(gridID, fldname, &rank, dims, ntype, dimlist, maxdimlist);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot get information about %s field.\n", fldname );
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(ntype);
+	
+      return(FAIL);
+    }
+  free(ntype);
+    
+	
+  /* Allocate space for dimension buffer  */
+  /* ------------------------------------ */
+  dimbuf = (char *)calloc(strlen(dimlist) + 64, sizeof(char));
+  if(dimbuf == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for dimension buffer.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      
+      return(FAIL);
+    }
+	
+  /* Allocate space for an auxilliary dimension list */
+  /* ----------------------------------------------- */
+  dimlist0 = (char *)calloc(strlen(dimlist) + 64, sizeof(char));
+  if(dimlist0 == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for dimension list string.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(dimbuf);
+		
+      return(FAIL);
+    }
+	
+
+  /* Get Grid info */
+  /* ------------- */
+  status = HE5_GDgridinfo(gridID, &xdim, &ydim, NULL, NULL);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about Grid.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(dimbuf);
+      free(dimlist0);
+	  
+      return(FAIL);
+    }
+	
+  /* Get Projection info */
+  /* ------------------- */
+  status = HE5_GDprojinfo(gridID, &projcode, NULL, NULL, projparm);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get Grid projection information.\n");  
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(dimbuf);
+      free(dimlist0);
+		
+      return(FAIL);
+    }
+	
+	
+  /* Setup Block Dimension if "Blocked" SOM projection */
+  /* ------------------------------------------------- */
+  if (projcode == HE5_GCTP_SOM && (long)projparm[11] != 0)
+    {
+      dimsize = HE5_GDdiminfo(gridID, "SOMBlockDim");
+		
+      /* If not 1D field then prepend to dimension list */
+      /* ---------------------------------------------- */
+      if (strchr(dimlist, ',') != NULL)
+	{
+	  strcpy(tempname, dimlist);
+	  nameptr = strchr( tempname, ',' );
+	  if ( nameptr != NULL )
+	    {
+	      nameptr[0] = '\0';
+	    }
+ 
+	  if ( strcmp(tempname, "SOMBlockDim") != 0)
+	    {
+	      strcpy(dimbuf, "SOMBlockDim,");
+	      strcat(dimbuf, dimlist);
+	    }
+	  else
+	    {
+	      strcpy(dimbuf, dimlist);
+	    }
+	}
+      else
+	{
+	  strcpy(dimbuf, dimlist);
+	}
+    }
+  else
+    {
+      /* If not "Blocked" SOM then just copy dim list to dim buffer */
+      strcpy(dimbuf, dimlist);
+    }
+	
+  /*
+   * Copy dimension buffer to auxilliary dimlist and Append comma to
+   * end of dimension list
+   */
+  strcpy(dimlist0, dimbuf);
+  strcat(dimbuf, ",");
+	
+	
+  /* Find comma */
+  /* ---------- */
+  comma = strchr(dimbuf, ',');
+	
+  /*
+   * Loop through entries in dimension list to make sure they are
+   * defined in grid
+   */
+  while (comma != NULL)
+    {
+      /* Copy dimension list entry to dimcheck */
+      /* ------------------------------------- */
+      dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char));
+      if(dimcheck == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory.\n");
+	  H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if(dimbuf != NULL) free(dimbuf);
+	  if(dimlist0 != NULL) free(dimlist0);
+			
+	  return(FAIL);
+	}
+      memmove(dimcheck, dimbuf, comma - dimbuf);
+		
+      /* Get Dimension Size */
+      /* ------------------ */
+      if (strcmp(dimcheck, "XDim") == 0)
+	{
+	  /* If "XDim" then use xdim value for grid definition */
+	  /* ------------------------------------------------- */
+	  dimsize        = (hsize_t)xdim;
+	  dims[rankidx1] = dimsize;
+	  dimname[rankidx1] = (char *)malloc(HE5_HDFE_NAMBUFSIZE * sizeof(char));
+	  strcpy(dimname[rankidx1],dimcheck);
+	  rankidx1++;
+	}
+      else if (strcmp(dimcheck, "YDim") == 0)
+	{
+	  /* If "YDim" then use ydim value for grid definition */
+	  /* ------------------------------------------------- */
+	  dimsize        = (hsize_t)ydim;
+	  dims[rankidx1] = dimsize;
+	  dimname[rankidx1] = (char *)malloc(HE5_HDFE_NAMBUFSIZE * sizeof(char));
+	  strcpy(dimname[rankidx1],dimcheck);
+	  rankidx1++;
+	}
+      else
+	{
+	  /* "Regular" Dimension */
+	  /* ------------------- */
+	  dimsize = HE5_GDdiminfo(gridID, dimcheck);
+	  if (dimsize > 0)
+	    {
+	      dims[rankidx1] = dimsize;
+	      dimname[rankidx1] = (char *)malloc(HE5_HDFE_NAMBUFSIZE * sizeof(char));
+	      strcpy(dimname[rankidx1],dimcheck);
+	      rankidx1++;
+	    }
+	  else
+	    {
+	      sprintf(errbuf, "Dimension \"%s\" not found.\n", dimcheck);
+	      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if(dimbuf != NULL) free(dimbuf);
+	      if(dimlist0 != NULL) free(dimlist0);
+				
+	      return(FAIL);
+	    }
+	}
+
+      memmove(dimbuf, comma + 1, strlen(comma)-1);
+      dimbuf[strlen(comma)-1]= 0;
+      comma = strchr(dimbuf, ',');
+      if(dimcheck != NULL) free(dimcheck);
+    }
+
+  if(dimbuf != NULL)
+    free(dimbuf);
+	
+  free(dimlist0);
+    
+	
+  /* Initialize maxdims[] array with dims[] array values */
+  /* --------------------------------------------------- */
+  for (i = 0; i < rank; i++)
+    maxdims[i] = dims[i];
+  
+	
+  /* Check out if the field is appendible */
+  /* in the following it is assumed that XDim and YDim 
+     cannot be appendible since they define a grid that
+     has a preset corner lat/lon (x/y) coordinates. The other
+     dimensions represent band, etc abd can be appendible */
+  /* ---------------------------------------------------- */
+  dimbuf = (char *)calloc(strlen(maxdimlist) + 64, sizeof(char));   
+  if(dimbuf == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		
+      return(FAIL);
+    }
+	
+  strcpy(dimbuf, maxdimlist);
+  strcat(dimbuf,",");
+  comma = strchr(dimbuf,',');
+    
+  while(comma != NULL)
+    {
+      dimcheck = (char *)calloc(comma-dimbuf +1, 1);
+      memmove(dimcheck,dimbuf,comma-dimbuf);
+      if (strcmp(dimcheck,"XDim") == 0)
+	{
+	  dimsize = (hsize_t)xdim; /* XDim will not be appendible */
+	}
+      else if (strcmp(dimcheck,"YDim") == 0)
+	{
+	  dimsize = (hsize_t)ydim; /* YDim will not be appendible */
+	}
+      else 
+	dimsize = HE5_GDdiminfo(gridID, dimcheck);
+	
+      /* update maxdim array */	
+      if ( (dimsize > 0) || (dimsize == H5S_UNLIMITED)  )
+	{
+	  maxdims[ rankidx2 ] = dimsize;
+
+	  /* see if we need to update dim in the structuremetadata */
+
+	  if ( (dims[rankidx2] < maxdims[rankidx2]) || 
+	       (maxdims[rankidx2] == H5S_UNLIMITED))
+	    {
+	      /* update dim if new dim is still <= maxdim */
+	      if((start[rankidx2]+1) > maxdims[rankidx2] && 
+		 (maxdims[rankidx2] != H5S_UNLIMITED))
+		{
+		  sprintf(errbuf, "Cannot update the dimension, new dimension size is larger than the max dimension size in the datafiled.\n");
+		  H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, 
+			  H5E_DATASET, H5E_WRITEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+	      else
+		{
+		  status = HE5_GDupdatedim(gridID,dimname[rankidx2], start[rankidx2]+1);
+		  if( status == FAIL )
+		    {
+		      sprintf(errbuf, "Cannot update the dimension.\n");
+		      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, 
+			      H5E_DATASET, H5E_WRITEERROR, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(FAIL);
+		    } 
+		}
+	    }
+
+	  rankidx2++;
+	}
+
+      memmove(dimbuf,comma+1,strlen(comma+1)+1); 
+      comma=strchr(dimbuf,',');
+      free(dimcheck);
+    }
+  free(dimbuf);
+
+  for(i = 0; i < rank; i++)
+    {
+      if(dimname[i] != NULL)
+	{
+	  free(dimname[i]);
+	  dimname[i] = NULL;
+	}
+    }
+
+  for(i = 0; i < rank; i++)
+    {
+      if( dims[i] == maxdims[i] )
+	append = FALSE;
+      else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED))
+	{
+	  append = TRUE;
+	  break;
+	}
+      else
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Maximum dimension size is smaller than dimension size.\n");
+	  H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			
+	  return(status);
+	}
+    } 
+ 
+  /* ============================================================== */
+  /* start and count are being passed as NULL from GDdefvrtregion   */
+  /* which calls GDreadfield, which have NULL for start and count.  */
+  /* H5Sselect_hyperslab won't take NULL values for start and count */
+  /* ============================================================== */
+  if(start == NULL)
+    {
+      tstart = (hssize_t *)calloc(rank, sizeof(hssize_t));
+      for(i = 0; i < rank; i++)
+	tstart[ i ] = 0;
+      startf = 1;
+    }
+  if(count == NULL)
+    {
+      tcount = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      for(i = 0; i < rank; i++)
+	tcount[ i ] = dims[ i ];
+      if(startf == 1)
+	bothf = 1;
+      else
+	countf = 1;
+    }
+  else
+    {
+      lcount =  (hsize_t *)calloc(rank, sizeof(hsize_t));
+
+      /* get dims and maxdims for the field after 
+	 dim update for appendable dim*/
+      status = HE5_GDflddiminfo(gridID, fldname, &rank, dims, maxdims);
+
+      for(i = 0; i < rank; i++)
+	{
+	  if(count[ i ] > dims[ i ])
+	    lcount[ i ] = dims[ i ];
+	  else
+	    lcount[ i ] = count[ i ];
+	}
+    }
+
+  if (append == TRUE)
+    {
+      /* Get the field-related dataset ID */
+      /* -------------------------------- */
+      status = HE5_GDgetfieldID(gridID, fldname, &dtsid);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get %s field ID.\n", fldname );
+	  H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (start == NULL)
+	    {
+	      if (tstart != NULL)
+		free(tstart);
+	    }
+	  if (count == NULL)
+	    {
+	      if (tcount != NULL)
+		free(tcount);
+	    }
+	  if (lcount != NULL)
+	    free(lcount);
+			
+	  return(FAIL);
+	}
+
+      if(bothf == 1)
+	status = H5Dextend(dtsid, tcount);
+      else if(startf == 1)
+	status = H5Dextend(dtsid, lcount);
+      else if(countf == 1)
+	status = H5Dextend(dtsid, tcount);
+      else
+	{
+	  /* Calculate the size to extend the dataset to */
+	  /* ------------------------------------------- */
+	  for (i = 0; i < rank; i++)
+	    size[ i ] = start[ i ] + lcount[ i ]; 
+	  
+	  /* Extend the dataset size */
+	  /* ----------------------- */
+	  status = H5Dextend(dtsid, size);
+	}
+
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot extend dataset for the \"%s\" field.\n", fldname );
+	  H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (start == NULL)
+	    {
+	      if (tstart != NULL)
+		free(tstart);
+	    }
+	  if (count == NULL)
+	    {
+	      if (tcount != NULL)
+		free(tcount);
+	    }
+	  if (lcount != NULL)
+	    free(lcount);
+			
+	  return(FAIL);
+	}	
+		
+    }
+	
+  if (append == FALSE)
+    {
+      /* Get the field-related dataset ID only */
+      status = HE5_GDgetfieldID(gridID, fldname, &dtsid);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get %s field ID.\n", fldname );
+	  H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (start == NULL)
+	    {
+	      if (tstart != NULL)
+		free(tstart);
+	    }
+	  if (count == NULL)
+	    {
+	      if (tcount != NULL)
+		free(tcount);
+	    }
+	  if (lcount != NULL)
+	    free(lcount);
+			
+	  return(FAIL);
+	}
+		
+    }
+    
+	
+  /* Get the field space ID */
+  /* --------------------- */
+  fspace = H5Dget_space(dtsid);
+  if ( fspace == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the file data space ID.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL)
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL)
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+		
+      return(FAIL);
+    }
+
+  /* Select the hyperslab */
+  /* -------------------- */
+  if(bothf == 1)
+    status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)tstart,stride,tcount,NULL);
+  else if(startf == 1)
+    status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)tstart,stride,lcount,NULL);
+  else if(countf == 1)
+    status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)start,stride,tcount,NULL);
+  else
+    status = H5Sselect_hyperslab(fspace,H5S_SELECT_SET,(const hsize_t *)start,stride,lcount,NULL) ;
+
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot select the hyperslab.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL)
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL)
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+		
+      return(FAIL);
+    }
+    
+  /* Create dataspace for the dataset */
+  /* -------------------------------- */
+  if(countf == 1 || bothf == 1)
+    mid = H5Screate_simple(rank, tcount, NULL);
+  else
+    mid = H5Screate_simple(rank,lcount, NULL);
+
+  if ( mid == FAIL )
+    {
+      sprintf(errbuf, "Cannot create the dataspace for the dataset.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL)
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL)
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+		
+      return(FAIL);
+    }
+	
+  /* Get the data type ID */
+  /* -------------------- */
+  tid = H5Dget_type( dtsid );
+  if ( tid == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the data type ID.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL)
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL)
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+		
+      return(FAIL);
+    }
+
+  /* Get the data type class ID */
+  /* -------------------------- */
+  classid = H5Tget_class(tid);
+  if (classid == H5T_NO_CLASS)
+    {
+      sprintf(errbuf, "Cannot get the data type ID.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL)
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL)
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+ 
+      return(FAIL);
+    }
+
+  /* Write whole data to dataset */
+  /* --------------------------- */
+  if( strcmp(code,"w")==0)
+    {
+      strbufsize1 = 0;
+      nattr = HE5_GDinqlocattrs(gridID, fldname, NULL, &strbufsize1);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot retrieve the attributes. \n");
+	  H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (start == NULL)
+	    {
+	      if (tstart != NULL)
+		free(tstart);
+	    }
+	  if (count == NULL)
+	    {
+	      if (tcount != NULL)
+		free(tcount);
+	    }
+	  if (lcount != NULL)
+	    free(lcount);
+ 
+	  return(FAIL);
+ 
+	}
+ 
+      attrlist1 = (char *) calloc(strbufsize1 + 2, sizeof(char));
+      if (attrlist1 == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for attrlist1.\n") ;
+	  H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (start == NULL)
+	    {
+	      if (tstart != NULL)
+		free(tstart);
+	    }
+	  if (count == NULL)
+	    {
+	      if (tcount != NULL)
+		free(tcount);
+	    }
+	  if (lcount != NULL)
+	    free(lcount);
+ 
+	  return(FAIL);
+ 
+	}
+ 
+      nattr = HE5_GDinqlocattrs(gridID, fldname, attrlist1, &strbufsize1);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot retrieve the attributes. \n");
+	  H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (attrlist1 != NULL)
+	    {
+	      free(attrlist1);
+	      attrlist1 = NULL;
+	    }
+	  if (start == NULL)
+	    {
+	      if (tstart != NULL)
+		free(tstart);
+	    }
+	  if (count == NULL)
+	    {
+	      if (tcount != NULL)
+		free(tcount);
+	    }
+	  if (lcount != NULL)
+	    free(lcount);
+ 
+	  return(FAIL);
+ 
+	}
+ 
+      attptr = strstr(attrlist1,"ARRAYOFSTRINGS");
+      if ( (classid == H5T_STRING) && (attptr == NULL) )
+	{
+	  status = H5Dwrite(dtsid, tid, mid, fspace,  H5P_DEFAULT, datbuf);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot write data to the dataset.\n");
+	      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(status);
+	    }
+	}
+ 
+      else if ( (classid == H5T_STRING) && (attptr != NULL) )
+	{
+	  strbufsize2 = 0;
+	  nattr = HE5_GDinqlocattrs(gridID, fldname, NULL, &strbufsize2);
+	  if ( nattr < 0 )
+	    {
+	      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+	      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(FAIL);
+ 
+	    }
+ 
+	  attrlist2 = (char *) calloc(strbufsize2 + 2, sizeof(char));
+	  if (attrlist2 == NULL)
+	    {
+	      sprintf(errbuf, "Cannot allocate memory for attrlist2.\n") ;
+	      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(FAIL);
+ 
+	    }
+ 
+	  nattr = HE5_GDinqlocattrs(gridID, fldname, attrlist2, &strbufsize2);
+	  if ( nattr < 0 )
+	    {
+	      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+	      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (attrlist2 != NULL)
+		{
+		  free(attrlist2);
+		  attrlist2 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(FAIL);
+ 
+	    }
+ 
+	  if ( (nattr == 0) || ((attptr = strstr(attrlist2,"StringLengthAttribute")) == NULL) )
+	    {
+	      chardatbuf = (char **)datbuf;
+	      if (count == NULL) mycount = tcount[0];
+	      if (count != NULL) mycount = *lcount;
+	      for (ibuf = 0; ibuf < mycount; ibuf++)
+		{
+		  if (chardatbuf[ibuf] == NULL)
+		    strsize = 0;
+		  else
+		    strsize = strlen(chardatbuf[ibuf]);
+		  if (strsize > maxlen)
+		    maxlen = strsize;
+ 
+		}
+ 
+	      numattr[0] = 1;
+	      status = HE5_GDwritelocattr(gridID, fldname, "StringLengthAttribute", H5T_NATIVE_INT, numattr, &maxlen);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot write attribute to the field \"%s\".",fldname) ;
+		  H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (attrlist1 != NULL)
+		    {
+		      free(attrlist1);
+		      attrlist1 = NULL;
+		    }
+		  if (attrlist2 != NULL)
+		    {
+		      free(attrlist2);
+		      attrlist2 = NULL;
+		    }
+		  if (start == NULL)
+		    {
+		      if (tstart != NULL)
+			free(tstart);
+		    }
+		  if (count == NULL)
+		    {
+		      if (tcount != NULL)
+			free(tcount);
+		    }
+		  if (lcount != NULL)
+		    free(lcount);
+ 
+		  return(status);
+		}
+ 
+	    }
+ 
+	  status = H5Dwrite(dtsid, tid, mid, fspace,  H5P_DEFAULT, datbuf);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot write data to the dataset.\n");
+	      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (attrlist2 != NULL)
+		{
+		  free(attrlist2);
+		  attrlist2 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(status);
+	    }
+	}
+      else
+	{
+	  /* Get memory data type ID */
+	  /* ----------------------- */
+	  mtype  = HE5_EHdtype2mtype(tid);
+	  if( mtype == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot convert to memory data type.\n");
+	      status = FAIL;
+	      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(status);
+	    }
+ 
+	  status = H5Dwrite(dtsid, mtype, mid, fspace, H5P_DEFAULT, datbuf);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot write data to the dataset.\n");
+	      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(status);
+	    }
+	}
+ 
+      if (attrlist1 != NULL)
+	{
+	  free(attrlist1);
+	  attrlist1 = NULL;
+	}
+      if (attrlist2 != NULL)
+	{
+	  free(attrlist2);
+	  attrlist2 = NULL;
+	}
+ 
+    }	
+  else
+    {
+      if (classid == H5T_STRING)
+	{
+	  /* Read the data buffer */
+	  /* -------------------- */
+	  status = H5Dread(dtsid, tid, mid, fspace , H5P_DEFAULT, datbuf);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot read out data from the dataset.\n");
+	      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(status);
+	    }
+ 
+	}
+      else
+	{
+	  /* Get memory data type ID */
+	  /* ----------------------- */
+          mtype  = HE5_EHdtype2mtype(tid);
+	  if ( mtype == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot get the memory data type.\n");
+	      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+			
+	      return(FAIL);
+	    }
+
+	  status = H5Dread(dtsid, mtype, mid,fspace , H5P_DEFAULT, datbuf);
+	  if ( status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot read out data from the dataset.\n");
+	      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+			
+	      return(FAIL);
+	    }
+	}
+		
+    }
+
+  if ( count  == NULL)
+    {
+      if(tcount != NULL) free(tcount);
+    }
+  if( start == NULL)
+    {
+      if(tstart != NULL) free(tstart);
+    }
+  if (lcount != NULL)
+    free(lcount);
+	
+  /* Release data space ID */
+  /* --------------------- */
+  status = H5Sclose(fspace);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release the dataspace ID.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+
+      return(FAIL);
+    }
+	
+  /* Release data space ID */
+  /* --------------------- */
+  status = H5Sclose(mid);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release the dataspace ID.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		   
+      return(FAIL);
+    }
+	
+  /* Release data type  ID */
+  /* --------------------- */
+  status = H5Tclose( tid );
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release the datatype ID.\n");
+      H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		
+      return(FAIL);
+    }
+	
+ COMPLETION:
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDwritefield                                                 |
+|                                                                             |
+|  DESCRIPTION: Writes data to a grid field.                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char*               fieldname                               |
+|  start          hssize_t            start array                             |
+|  stride         hsize_t             stride array                            |
+|  edge           hsize_t             edge array                              |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+| 09/29/11  Abe Taaheri   Modified for correcting Unlimited dimension         |
+|                         behavior and extension                              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDwritefield(hid_t gridID, const char *fieldname, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void *data)
+{
+  herr_t          status = FAIL;            /* routine return status variable */
+  hsize_t         dims[HE5_DTSETRANKMAX];   /* Field dimensions          */
+  int   	  rank     = 0;             /* Field rank                */
+  int             unlimdim;
+  hsize_t         maxdims[HE5_DTSETRANKMAX];/* Field maximum dimensions  */
+  int             append   = FALSE;         /* FLAG (if field is appendible)*/
+  int             i;                        /* Loop index                   */
+  char            *errbuf = (char *)NULL;   /* error message buffer        */
+  char            *temp_fieldname = (char *)NULL;
+  int             stlen;
+
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKPOINTER(data);
+
+  /* If a field is appendable and need to be extended, do extension here 
+     before writing extended data into it 
+  */
+  stlen = strlen(fieldname);
+  temp_fieldname = (char *)malloc((stlen+1)*sizeof(char));
+  if(temp_fieldname == (char *)NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDwritefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, 
+	      "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for temp_fieldname, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else
+    {
+      strcpy(temp_fieldname,fieldname);
+      temp_fieldname[stlen] = '\0';
+    }
+
+  /* get maxdims for the field */
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == (char *)NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDwritefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, 
+	      "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      free(temp_fieldname);
+      temp_fieldname = (char *)NULL;
+      return(FAIL);
+    }
+
+  status = HE5_GDflddiminfo(gridID, temp_fieldname, &rank, dims, maxdims);
+  
+/* see if we need first to extend data dimensions for unlimited 
+     dimensions */
+  
+  for (i = 0; i < rank; i++)
+    {
+      if( dims[i] == maxdims[i] )
+	append = FALSE;
+      else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED))
+	{
+	  append = TRUE;
+	  break;
+	}
+    }
+  unlimdim = i;
+
+  if((append == TRUE) && (edge[unlimdim] > dims[unlimdim]))
+    {
+      hssize_t newstart[8];
+      hsize_t newedge[8];
+      
+      for (i = 0; i < rank; i++)
+	{
+	  if (start != NULL)
+	    {
+	      newstart[i]=start[i];
+	    }
+	  else
+	    {
+	      newstart[i]= 0;
+	    }
+
+	  if (edge!= NULL)
+	    {
+	      newedge[i] = edge[i];
+	    }
+	  else
+	    {
+	      newedge[i]=dims[i];
+	    }
+	}
+      newstart[unlimdim]=edge[unlimdim]-1;
+
+      newedge[unlimdim] = 1;
+
+      status = HE5_GDwrrdfield(gridID, fieldname, "w", newstart, stride, newedge, data);
+
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_GDwritefield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(temp_fieldname);
+	  temp_fieldname = (char *)NULL;
+	  return(FAIL);
+	}
+      else
+	{
+	  for (i = 0; i < rank; i++)
+	    {
+	      dims[i]=edge[i];
+	    }
+	 
+	}
+    }
+ 
+  status = HE5_GDwrrdfield(gridID, fieldname, "w", start, stride, edge, data);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ;
+      H5Epush(__FILE__, "HE5_GDwritefield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      errbuf = (char *)NULL;
+      free(temp_fieldname);
+      temp_fieldname = (char *)NULL;
+      return(FAIL);
+    }
+  else
+    {
+      status = SUCCEED;
+      free(errbuf);
+      errbuf = (char *)NULL;
+      free(temp_fieldname);
+      temp_fieldname = (char *)NULL;
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDreadfield                                                  |
+|                                                                             |
+|  DESCRIPTION: Reads data from a grid field.                                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char                fieldname                               |
+|  start          hssize_t            start array                             |
+|  stride         hsize_t             stride array                            |
+|  edge           hsize_t             edge array                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  buffer         void                data buffer for read                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDreadfield(hid_t gridID, const char *fieldname, const hssize_t start[], const hsize_t stride[],  const hsize_t edge[], void *buffer)
+
+{
+  herr_t            status = FAIL;            /* routine return status variable */
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+
+  status = HE5_GDwrrdfield(gridID, fieldname, "r", start, stride, edge, buffer);
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDwriteattr                                                  |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute in a grid.                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  attrname       char*               attribute name                          |
+|  ntype          hid_t               Attribute data type ID                  |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDwriteattr(hid_t gridID, const char *attrname, hid_t ntype, hsize_t  count[],  void *datbuf)
+{
+  herr_t     status     = FAIL;/* routine return status variable */
+  
+  hid_t      fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid        = FAIL;/* "HDFEOS" group ID              */
+  
+  long       idx        = FAIL;/* Grid index                     */
+  hid_t      dtype;
+
+  HE5_LOCK;
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+
+  /* 
+     if ntype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use ntype itself
+  */
+  dtype = HE5_EHconvdatatype(ntype);
+  if(dtype == FAIL)
+    {
+      dtype = ntype;
+    }
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDwriteattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get "Grid Attributes" group ID and call EHattr to perform I/O */
+      /* ------------------------------------------------------------- */
+      status = HE5_EHattr(HE5_GDXGrid[idx].gd_id, attrname, ntype, count,"w", datbuf);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDreadattr                                                   |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from a grid.                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDreadattr(hid_t gridID, const char *attrname, void *datbuf)
+{
+  herr_t      status     = FAIL;/* routine return status variable */
+
+  hid_t       fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t       ntype      = FAIL;/* Data type ID                   */
+  hid_t       gid        = FAIL;/* "HDFEOS" group ID              */
+
+  hsize_t     count[]    =  {0};/* array with elements number     */
+
+  long        idx        = FAIL;/* Grid index                     */
+
+  HE5_LOCK;
+  CHECKPOINTER(attrname);
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDreadattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get attribute group ID and call EHattr to perform I/O */
+      /* ------------------------------------------------------ */
+      status = HE5_EHattr(HE5_GDXGrid[idx].gd_id, attrname, ntype, count, "r", datbuf);
+    }
+
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqgrid                                                    |
+|                                                                             |
+|  DESCRIPTION: Returns number and names of grid structures in file           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nGrid          long                Number of grid structures in file       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  filename       char                HDF-EOS filename                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  gridlist       char                List of grid names (comma-separated)    |
+|  strbufsize     long                Length of gridlist                      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDinqgrid(const char *filename, char *gridlist, long *strbufsize)
+{
+  long           nGrid  = FAIL;/* Number of grid structures in file */
+
+  herr_t         status = FAIL;/* status variable                   */
+
+  CHECKPOINTER(filename);
+
+  /* Call "HE5_EHinquire" routine */
+  /* ---------------------------- */
+  nGrid = HE5_EHinquire(filename, "/HDFEOS/GRIDS", gridlist, strbufsize);
+
+ COMPLETION:
+  return (nGrid);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDsetfillvalue                                               |
+|                                                                             |
+|  DESCRIPTION: Sets fill value for the specified field.                      |
+|               write attribute "_FillValue" to dataset(field)                |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char*               field name                              |
+|  ntype          hid_t   None        data type ID                            |
+|  fillval        void                fill value                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|             H5Pset_fill_value                                               |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  10/5/99  A.Muslimov    Added dynamical memory allocation for errbuf, and   |
+|                         nt arrays. Added error handlings after the function |
+|                         calls.                                              |
+|                                                                             |
+|  12/3/99  A.Muslimov    Fixed a bug resulted in not writing a fill value    |
+|                         into the dataset.                                   |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  Mar  04  S.Zhao        Modified for a character string dataset.            |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_GDsetfillvalue(hid_t gridID, const char *fieldname, hid_t numbertype_in, void *fillval)
+{
+  herr_t     status     = FAIL;/* routine return status variable */
+
+  hid_t      fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid        = FAIL;/* "HDFEOS" group ID              */
+  
+  long       idx        = FAIL;/* Grid index                     */
+
+  char       *errbuf    = (char *)NULL;/*error message buffer    */
+  hid_t       ntype;
+
+  HE5_LOCK;
+  CHECKPOINTER(fillval);
+
+
+  /* Convert HDF-EOS5 datatype to HDF5 datatype */
+  if (
+      H5Tequal(numbertype_in, H5T_NATIVE_CHAR)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SHORT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_INT)    == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UINT)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LONG)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LLONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_FLOAT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== SUCCEED ||
+      H5Tequal(numbertype_in, H5T_C_S1) == SUCCEED)
+    {
+      ntype = numbertype_in;
+    }
+  else
+    {
+      ntype = HE5_EHconvdatatype((int) numbertype_in);
+    }
+
+  if(ntype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID for fillvalue.\n");
+      H5Epush(__FILE__, "HE5_GDsetfillvalue", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDsetfillvalue", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDsetfillvalue", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDsetfillvalue", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return( status );
+    }
+	
+  /* Get current dataset creation property ID, set dataset fill value */
+  /* ---------------------------------------------------------------- */
+  if( HE5_GDXGrid[idx].plist == FAIL)
+    {
+      HE5_GDXGrid[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+      if ( HE5_GDXGrid[idx].plist == FAIL )
+	{
+	  sprintf(errbuf, "Cannot create the dataset property list.\n");
+	  H5Epush(__FILE__, "HE5_GDsetfillvalue", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return(FAIL);
+	}
+
+    }
+	
+  /* Set fill value */
+  /* -------------- */
+  if ((ntype != HE5T_CHARSTRING) && (ntype != H5T_NATIVE_CHAR) && (ntype != H5T_C_S1))
+    {
+      status = H5Pset_fill_value(HE5_GDXGrid[idx].plist, ntype, fillval);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot set the fill value for a dataset creation property list.\n");
+	  H5Epush(__FILE__, "HE5_GDsetfillvalue", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return(status );
+	}
+    }
+	
+	
+  free(errbuf);    
+  errbuf = NULL;
+    
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetfillvalue                                               |
+|                                                                             |
+|  DESCRIPTION: Retrieves fill value for a specified field.                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char*               field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fillval        void                fill value                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|             H5Dget_type                                                     |
+|             H5Tclose                                                        |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/22/99  A.Muslimov    Changed the type of status variable from intn to    |
+|                         int   . Added error handlings. Removed redundant    |
+|                         'if else' statements. Initialized return status     |
+|                         variable to -1.                                     |
+|                                                                             |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+| Aug 22,11 Abe Taaheri   Add code to return error if fillvalue attribute     |
+|                         not found.                                          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDgetfillvalue(hid_t gridID, const char *fieldname, void *fillval)
+{
+  herr_t          status  = FAIL;/* routine return status variable */
+
+  int             rank    = FAIL;/* Dummy rank variable            */
+  int             i;		  	 /* loop index                     */
+  int             found   = 0;	 /* found (1), not found (0) flag  */
+
+  hid_t           *nt = (hid_t *)NULL;      /* number types        */
+                                           
+  hid_t           fid     = FAIL;/* HDF-EOS file ID                */
+  hid_t           gid     = FAIL;/* "HDFEOS" group ID              */
+  hid_t           fieldid = FAIL;/* dataset ID                     */    
+  hid_t           typeID  = FAIL;/* datatype ID                    */
+
+  long            idx     = FAIL;/* Grid index                     */
+
+  hsize_t         dims[HE5_DTSETRANKMAX];/* Dimensions array       */
+  hsize_t         count[] = { 1 };/* number of attribute elements  */
+
+  char            *errbuf = (char *)NULL;/* error message buffer   */
+  char            *attrnames;
+  long             strbufsize;
+  long             nattr = 0;
+
+  HE5_LOCK;
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDgetfillvalue", &fid,  &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+
+
+  /* Get field info  */
+  /* --------------  */
+  nt = (hid_t *)calloc(1, sizeof(hid_t));
+  if ( nt == (hid_t *)NULL )
+    {
+      sprintf(errbuf, "Cannot allocate memory for data type class ID.\n");
+      H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[ i ] = 0;
+  
+  status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, nt, NULL, NULL); 
+  if( status == FAIL)
+    {
+      sprintf(errbuf, "Failed to get information about \"%s\" data field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(nt);
+	    
+      return(FAIL);
+    }
+    
+  /* Loop through all data datasets in grid */
+  /* -------------------------------------- */
+  for (i = 0; i < HE5_GDXGrid[ idx ].nDFLD; i++)
+    {
+      /* Get dataset name */
+      if( strcmp(fieldname, HE5_GDXGrid[ idx ].ddataset[ i ].name) == 0 )
+	{
+	  found = 1; 
+	  break;
+	} 
+    }
+	
+  /* Get dataset ID */
+  /* -------------- */
+  if( found == 1) 
+    {
+      fieldid = HE5_GDXGrid[ idx ].ddataset[ i ].ID; 
+      typeID = H5Dget_type(fieldid);
+      if ( typeID == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get the dataset data type ID.\n");
+	  H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(nt);
+			
+	  return(FAIL);
+	}
+	
+      /* if fillvalue attribute exist, get the value */
+
+      nattr = HE5_GDinqlocattrs(gridID, fieldname, NULL, &strbufsize);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot retrieve fillvalue attribute. \n");
+	  H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(nt);
+
+	  return(FAIL);
+	}
+      
+      attrnames = (char*)malloc(sizeof(char)*(strbufsize+1));
+      if (attrnames == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for attrnames.\n") ;
+	  H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(nt);
+
+	  return(FAIL);
+	}
+      
+      nattr = HE5_GDinqlocattrs(gridID, fieldname, attrnames, &strbufsize);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot retrieve fillvalue attribute. \n");
+	  H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(nt);
+
+	  return(FAIL);
+	}
+      
+      if(strstr(attrnames, "_FillValue")!=NULL)
+	{
+	  /* Retrieve the fill value */
+	  /* ----------------------- */
+	  status = HE5_EHattr( fieldid, "_FillValue", typeID, count, "r", fillval);
+	  if ( status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot retrieve the fill value.\n");
+	      H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(nt);
+	      
+	      return(FAIL);
+	    }
+	  
+	  /* Release the data type ID */
+	  /* ------------------------ */
+	  status = H5Tclose(typeID);
+	  if ( status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot release the data type ID.\n");
+	      H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(nt);	
+	      
+	      return(FAIL);
+	    }
+	}
+      else
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Cannot retrieve fillvalue attribute. \n");
+	  H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+  else
+    {
+      status = FAIL;
+      sprintf(errbuf, "Data field \"%s\" not found. \n", fieldname);
+      H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+    
+  free(errbuf);
+  errbuf = NULL;
+  if (nt != NULL) free(nt);
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqdatatype                                                |
+|                                                                             |
+|  DESCRIPTION: Inquires about data fields in grid                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status          herr_t              return status (0) SUCCEED, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID          hid_t   None        HDF-EOS type grid  ID                  |
+|  fieldname       char *                                                     |
+|  attrname        char *                                                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dtype           H5T_class_t  None   HDF-EOS data type ID                   |
+|  Class           H5T_class_t                                                |
+|  Order           H5T_order_t                                                |
+|  size            size_t                                                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|             H5Dopen                                                         |
+|             H5Dget_type                                                     |
+|             H5Tget_class                                                    |
+|             H5Tget_order                                                    |
+|             H5Tget_size                                                     |
+|             H5Dclose                                                        |
+|             H5Aopen_name                                                    |
+|             H5Aget_type                                                     |
+|             H5Aclose                                                        |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 99   D.Wynne       Original Programmer                                 |
+|  Dec 99   A.Muslimov    Changed the status return data type from hid_t to   |
+|                         int   .                                             |
+|  Feb 00   A.Muslimov    Added error checkings.                              |
+|  Mar 00   A.Muslimov    Changed the ID of field group from gd_id to data_id.|
+|  Mar 00   A.Muslimov    Updated to include Group/Local attributes.          |
+|  5/10/00  A.Muslimov    Changed 'H5T_class_t' type to 'int' data type.      |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDinqdatatype(hid_t gridID, const char *fieldname, const char *attrname, int fieldgroup, hid_t *dtype, H5T_class_t *classID, H5T_order_t *Order, size_t *size)
+{
+ 
+  herr_t      status    = FAIL;	/* routine return status          */
+
+  hid_t       datasetid = FAIL;	/* dataset ID                     */
+  hid_t       fid       = FAIL;	/* HDF-EOS file ID                */
+  hid_t       gid       = FAIL;	/* "HDFEOS" group ID              */
+  hid_t       attr      = FAIL;	/* attribute dataset ID           */
+  hid_t       fldgroup  = FAIL;	/* group ID                       */
+  hid_t       fieldID   = FAIL;	/* Data field dataset ID          */
+ 
+  long        idx       = FAIL;	/* Grid index                     */
+
+  char        *errbuf   = (char *)NULL;/* Error message buffer    */
+
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+   
+ 
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDinqdatatype", &fid, &gid, &idx);
+  if(status == SUCCEED)
+    {
+      if(fieldgroup == HE5_HDFE_DATAGROUP)
+	fldgroup = HE5_GDXGrid[idx].data_id;
+      else if(fieldgroup == HE5_HDFE_ATTRGROUP)
+	fldgroup = HE5_GDXGrid[idx].gd_id;
+      else if(fieldgroup == HE5_HDFE_GRPATTRGROUP)
+	fldgroup = HE5_GDXGrid[idx].data_id;
+      else if(fieldgroup == HE5_HDFE_LOCATTRGROUP)
+	fldgroup = HE5_GDXGrid[idx].data_id;
+      else
+	{
+	  sprintf(errbuf, "Group \"%d\" unknown.\n", fieldgroup);
+	  H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+			
+	  return(FAIL);
+	}
+
+		
+      /* Call HDF 5 routines */
+      /* =================== */
+      if(fieldgroup == HE5_HDFE_DATAGROUP)
+	{
+	  datasetid = H5Dopen(fldgroup, fieldname);
+	  if (datasetid == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the dataset for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(FAIL);
+	    }
+			
+	  *dtype = H5Dget_type(datasetid);
+	  if (*dtype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the datatype for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(FAIL);
+	    }
+		   
+	  *classID  = H5Tget_class(*dtype);
+	  if (*classID == H5T_NO_CLASS)
+	    {
+	      sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(FAIL);
+	    }
+			
+	  *Order    = H5Tget_order(*dtype);
+	  if (*Order == H5T_ORDER_ERROR)
+	    {
+	      sprintf(errbuf, "Cannot get the data type order for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(FAIL);
+	    }
+			
+	  if (*classID == H5T_STRING)
+	    {
+	      *size = H5Tget_size(*dtype);
+	    }
+	  else
+	    {
+	      *size     = H5Tget_size(*dtype);
+	      if (*size == 0)
+		{
+		  sprintf(errbuf, "Cannot get the data type size for the \"%s\" field.\n", fieldname);
+		  H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+				
+		  return(FAIL);
+		}
+	    }
+			
+	  status = H5Dclose(datasetid);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(FAIL);
+	    }
+			
+	}
+      else if(fieldgroup == HE5_HDFE_ATTRGROUP || fieldgroup == HE5_HDFE_GRPATTRGROUP)
+	{
+	  attr      = H5Aopen_name(fldgroup, attrname);
+	  if (attr == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(FAIL);
+	    }
+			
+	  *dtype = H5Aget_type(attr);
+	  if (*dtype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the data type for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(FAIL);
+	    }
+			
+	  *classID  = H5Tget_class(*dtype);
+	  if (*classID == H5T_NO_CLASS)
+	    {
+	      sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(FAIL);
+	    }
+			
+	  *Order    = H5Tget_order(*dtype);
+	  if (*Order == H5T_ORDER_ERROR)
+	    {
+	      sprintf(errbuf, "Cannot get the data type order for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(FAIL);
+	    }
+			
+	  if (*classID == H5T_STRING)
+	    {
+	      *size = H5Tget_size(*dtype);
+	    }
+	  else
+	    {
+	      *size     = H5Tget_size(*dtype);
+	      if (*size == 0)
+		{
+		  sprintf(errbuf, "Cannot get the data type size for the \"%s\" attribute.\n", attrname);
+		  H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+				
+		  return(FAIL);
+		}
+	    }
+			
+	  status = H5Aclose(attr);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(FAIL);
+	    } 
+	}
+
+      else if(fieldgroup == HE5_HDFE_LOCATTRGROUP)
+	{
+			
+	  fieldID = H5Dopen(fldgroup, fieldname);
+	  if (fieldID == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+			
+	  attr      = H5Aopen_name(fieldID, attrname);
+	  if (attr == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__,  "HE5_GDinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+			   
+	      return(FAIL);
+	    }
+			
+	  *dtype = H5Aget_type(attr);
+	  if (*dtype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the data type for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(FAIL);
+	    }
+			
+	  *classID  = H5Tget_class(*dtype);
+	  if (*classID == H5T_NO_CLASS)
+	    {
+	      sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(FAIL);
+	    }
+			
+	  *Order    = H5Tget_order(*dtype);
+	  if (*Order == H5T_ORDER_ERROR)
+	    {
+	      sprintf(errbuf, "Cannot get the data type order for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(FAIL);
+	    }
+			
+	  if (*classID == H5T_STRING)
+	    {
+	      *size = H5Tget_size(*dtype);
+	    }
+	  else
+	    {
+	      *size     = H5Tget_size(*dtype);
+	      if (*size == 0)
+		{
+		  sprintf(errbuf, "Cannot get the data type size for the \"%s\" attribute.\n", attrname);
+		  H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+				
+		  return(FAIL);
+		}
+	    }
+			
+	  status = H5Aclose(attr);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+				
+	      return(FAIL);
+	    } 
+			
+	  status = H5Dclose(fieldID);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }		
+			
+	}
+
+    }
+	
+  free(errbuf);    
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDnentries                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns number of entries and descriptive string buffer       |
+|                size for a specified entity.                                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nEntries       long                Number of entries                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  entrycode      int     None        Entry code                              |
+|                                     HDFE_NENTDIM  (0)                       |
+|                                     HDFE_NENTDFLD (4)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                Length of comma-separated list          |
+|                                     (Does not include null-terminator)      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/21/99  A.Muslimov    In the call to EHmetagroup() replaced the argument  |
+|                         gid by fid.                                         |
+|  9/28/99  A.Muslimov    Added proper error handlings after function calls.  |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDnentries(hid_t gridID, int entrycode, long *strbufsize)
+{
+  herr_t          status   = FAIL;/* routine return status variable  */
+
+  int             metaflag = FAIL;/* Old (0), New (1) metadata flag) */
+  int             nVal     = FAIL;/* Number of strings to search for */
+
+  hid_t           fid      = FAIL;/* HDF-EOS file ID                 */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID               */
+
+  long            i;		  /* Loop index                      */
+  long            idx      = FAIL;/* Grid index                      */
+  long            nEntries = 0;	  /* Number of entries               */
+
+  char            *metabuf=(char *)NULL;     /* Ptr to structural metadata (SM) */
+  char            *metaptrs[2] = {NULL,NULL};/* Ptrs to begin/end of SM section */
+  char            *utlstr = (char *)NULL;       /* Utility string               */
+  char            valName[2][32];               /* Strings to search for        */
+  char            *errbuf = (char *)NULL;       /* buffer for error message     */
+
+     
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDnentries", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDnentries", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDnentries", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	    
+      return(FAIL);
+    }
+
+  /* Allocate memory for utility string */
+  /* ---------------------------------- */
+  utlstr  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if(utlstr == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for utility string.\n");
+      H5Epush(__FILE__, "HE5_GDnentries", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	    
+      return(FAIL);
+    }
+    
+  /* Zero out string buffer size */
+  /* --------------------------- */
+  *strbufsize = 0;
+
+  /*
+   * Get pointer to  relevant section within SM and Get names of
+   * metadata strings to inquire about
+   */
+  switch (entrycode)
+    {
+    case HE5_HDFE_NENTDIM:
+      {
+	metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g", "Dimension", metaptrs);
+	if(metabuf == NULL)
+	  {
+	    sprintf(errbuf, "Cannot allocate memory for metabuffer.\n");
+	    H5Epush(__FILE__, "HE5_GDnentries", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    free(utlstr);
+		    
+	    return(FAIL);
+	  }
+	nVal = 1;
+	strcpy(&valName[0][0], "DimensionName");
+      }
+      break;
+
+    case HE5_HDFE_NENTDFLD:
+      {
+	metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g", "DataField", metaptrs);
+	if(metabuf == NULL)
+	  {
+	    sprintf(errbuf, "Cannot allocate memory for metabuffer.\n");
+	    H5Epush(__FILE__, "HE5_GDnentries", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    free(utlstr);
+
+	    return(FAIL);
+	  }
+	nVal = 1;
+	strcpy(&valName[0][0], "DataFieldName");
+      }
+      break;
+
+    default:
+      {
+	sprintf(errbuf, "Unknown entry code.\n");
+	H5Epush(__FILE__, "HE5_GDnentries", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	HE5_EHprint(errbuf, __FILE__, __LINE__);
+      }
+      break;
+	  
+    }
+
+
+  /*
+   * Check for presence of 'GROUP="' string If found then old metadata,
+   * search on OBJECT string
+   */
+  metaflag = (strstr(metabuf, "GROUP=\"") == NULL) ? 1 : 0;
+  if (metaflag == 0)
+    {
+      nVal = 1;
+      strcpy(&valName[0][0], "\t\tOBJECT");
+    }
+
+
+  /* Begin loop through entries in metadata */
+  /* -------------------------------------- */
+  while (1)
+    {
+      /* Search for first string */
+      strcpy(utlstr, &valName[0][0]);
+      strcat(utlstr, "=");
+      metaptrs[0] = strstr(metaptrs[0], utlstr);
+
+      /* If found within relevant metadata section ... */
+      if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+	{
+	  for (i = 0; i < nVal; i++)
+	    {
+	      /*
+	       * Get all string values Don't count quotes
+	       */
+	      status = HE5_EHgetmetavalue(metaptrs, &valName[i][0], utlstr);
+	      if ( status == FAIL )
+		{
+		  sprintf(errbuf, "Cannot get metadata string.\n");
+		  H5Epush(__FILE__, "HE5_GDnentries", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(utlstr);
+		  free(metabuf);
+			
+		  return(FAIL);
+		}
+	      *strbufsize += strlen(utlstr) - 2;
+	    }
+	  /* Increment number of entries */
+	  nEntries++;
+
+	  /* Go to end of OBJECT */
+	  metaptrs[0] = strstr(metaptrs[0], "END_OBJECT");
+	}
+      else
+	/* No more entries found */
+	{
+	  break;
+	}
+    }
+  if (metabuf != NULL) free(metabuf);
+
+  /* Count comma separators & slashes (if mappings) */
+  /* ---------------------------------------------- */
+  if (nEntries > 0)
+    {
+      *strbufsize += nEntries - 1;
+      *strbufsize += (nVal - 1) * nEntries;
+    }
+
+
+
+
+  free(errbuf);
+  free(utlstr);
+    
+  errbuf = NULL;
+  utlstr = NULL;
+    
+
+  return (nEntries);
+}
+
+
+#define REMQUOTE					\
+							\
+  memmove(utlstr, utlstr + 1, strlen(utlstr) - 2);	\
+  utlstr[strlen(utlstr) - 2] = 0;
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqdims                                                    |
+|                                                                             |
+|  DESCRIPTION: Retrieve information about all dimensions defined in a grid.  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nDim           int                 Number of defined dimensions            |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dimnames       char                Dimension names (comma-separated)       |
+|  dims           hsize_t             Dimension values                        |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/21/99  A.Muslimov    In the call to EHmetagroup() replaced the argument  |
+|                         gid by fid.                                         |
+|  9/28/99  A.Muslimov    Added proper error handlings after function calls.  |
+|  10/18/99 A.Muslimov    Replace memcpy() by memmove() to avoid a problem    |
+|                         when arguments 1 and 2 overlap in memory.           |
+| 07/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_GDinqdims(hid_t gridID, char *dimnames, hsize_t dims[])
+{
+  int            nDim   =  0;  /* Number of dimensions (return)  */
+
+  herr_t         status = FAIL;/* routine return status variable */
+  
+  hid_t          fid    = FAIL;/* HDF-EOS file ID                */
+  hid_t          gid    = FAIL;/* "HDFEOS" group ID              */
+  
+  long           idx    = FAIL;/* Grid index                     */
+  
+  hsize_t        size   =  0;  /* Dimension size                 */
+    
+  char           *metabuf = (char *)NULL;      /* Ptr to structural metadata (SM) */
+  char           *metaptrs[2] = {NULL,NULL};   /* Ptrs to begin/end of SM section */
+  char           *utlstr = (char *)NULL;       /* Utility string                  */
+  char           *errbuf = (char *)NULL;       /* Buffer for error message        */
+  
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDinqdims", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDinqdims", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDinqdims", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+  
+  utlstr  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if(utlstr == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for utility string.\n");
+      H5Epush(__FILE__, "HE5_GDinqdims", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+  
+  /* If dimension names or sizes are requested */
+  /* ----------------------------------------- */
+  if (dimnames != NULL || dims != NULL)
+    {
+      /* Get pointers to "Dimension" section within SM */
+      /* --------------------------------------------- */
+      metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g","Dimension", metaptrs);
+      if(metabuf == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for metabuffer.\n");
+	  H5Epush(__FILE__, "HE5_GDinqdims", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(utlstr);
+		  
+	  return(FAIL);
+	}
+
+      /* If dimension names are requested then "clear" name buffer */
+      /* --------------------------------------------------------- */
+      if (dimnames != NULL)
+	{
+	  dimnames[0] = 0;
+	}
+
+      while (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+	{
+	  strcpy(utlstr, "\t\tOBJECT=");
+	  metaptrs[0] = strstr(metaptrs[0], utlstr);
+	  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+	    {
+	      /* Get Dimension Name */
+	      /* ------------------ */
+	      if (dimnames != NULL)
+		{
+		  /* Check 1st for old meta data then new */
+		  /* ------------------------------------ */
+		  status = HE5_EHgetmetavalue(metaptrs, "OBJECT", utlstr);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf,  "\"OBJECT\" string not found in metadata.");
+		      H5Epush(__FILE__, "HE5_GDinqdims", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(errbuf);
+		      free(utlstr);
+		      free(metabuf);
+			    
+		      return(FAIL);
+			    
+		    }
+
+		  if (utlstr[0] != '"')
+		    {
+		      metaptrs[0] = strstr(metaptrs[0], "\t\t\t\tDimensionName=");
+		      status = HE5_EHgetmetavalue(metaptrs, "DimensionName", utlstr);
+		      if (status == FAIL)
+			{
+			  sprintf(errbuf,  "\"DimensionName\" string not found in metadata.");
+			  H5Epush(__FILE__, "HE5_GDinqdims", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+			  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  free(errbuf);
+			  free(utlstr);
+			  free(metabuf);
+								
+			  return(FAIL);
+			}
+							
+		    }
+
+		  /* Strip off double quotes */
+		  /* ----------------------- */
+		  memmove(utlstr, utlstr + 1, strlen(utlstr) - 2);
+		  utlstr[strlen(utlstr) - 2] = 0;
+		  if (nDim > 0)
+		    {
+		      strcat(dimnames, ",");
+		    }
+		  strcat(dimnames, utlstr);
+		}
+
+	      /* Get Dimension Size */
+	      /* ------------------ */
+	      if (dims != NULL)
+		{
+		  status = HE5_EHgetmetavalue(metaptrs, "Size", utlstr);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf,  "\"Size\" string not found in metadata.");
+		      H5Epush(__FILE__, "HE5_GDinqdims", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(errbuf);
+		      free(utlstr);
+		      free(metabuf);
+							
+		      return(FAIL);
+		    }
+		  size = (hsize_t)atol(utlstr);
+		  dims[ nDim ] = size;
+		}
+	      nDim++;
+	    }
+	}
+      if (metabuf != NULL) free(metabuf);		
+    }
+  
+  free(utlstr);
+  free(errbuf);
+  
+  utlstr = NULL;
+  errbuf = NULL;
+  
+  return (nDim);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDattrinfo                                                   |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               Data type ID                            |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/28/99  A.Muslimov    Changed the type of return value from intn          |
+|                         to int   .                                          |
+|  5/10/00  A.Muslimov    Changed 'H5T_class_t' type to 'int' data type.      |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Feb 03   S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDattrinfo(hid_t gridID, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t        status = FAIL;/* routine return status variable */
+
+  hid_t         fid    = FAIL;/* HDF-EOS file ID                */
+  hid_t         gid    = FAIL;/* "HDFEOS" group ID              */
+
+  long          idx    = FAIL;/* Grid index                     */
+
+  CHECKPOINTER(attrname);
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get attribute group ID and call EHattrinfo */
+      /* ------------------------------------------ */
+      status = HE5_EHattrinfo( HE5_GDXGrid[idx].gd_id, attrname, ntype, count);
+    }
+
+ COMPLETION:
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqattrs                                                   |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                number of attributes (-1 if fails)      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  attrnames      char                attribute name(s)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                String length of attribute (in bytes)   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/21/99  A.Muslimov    Changed the data type of status variable from intn  |
+|                         to int   . Added error handling after the call to   |
+|                         GDchkgdid().                                        |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDinqattrs(hid_t gridID, char *attrnames, long *strbufsize)
+{
+  herr_t          status   = FAIL;/* routine return status variable  */
+  
+  hid_t           fid      = FAIL;/* HDF-EOS file ID                 */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID               */
+  
+  long            nattr    =  0;  /* Number of attributes            */
+  long            idx      = FAIL;/* Grid index                      */
+  
+  char            *grpname = (char *)NULL;/* Buffer for group name   */
+  char            *errbuf  = (char *)NULL;/* error message buffer    */
+  
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDinqattrs", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDinqattrs", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Checking for grid ID failed.\n" );
+      H5Epush(__FILE__, "HE5_GDinqattrs", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(FAIL);
+    }
+
+  /* Allocate memory for the group name string */
+  /* ----------------------------------------- */
+  grpname = (char *) calloc( (strlen(HE5_GDXGrid[idx].gdname)+40), sizeof(char));
+  if( grpname == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for the group name string.\n");
+      H5Epush(__FILE__, "HE5_GDinqattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(FAIL);
+    }
+	
+  strcpy(grpname,"/HDFEOS/GRIDS/");
+  strcat(grpname, HE5_GDXGrid[idx].gdname);
+	
+  nattr = HE5_EHattrcat(fid,  grpname, attrnames, strbufsize);
+	
+  if (grpname != NULL) free(grpname);
+    
+
+  free(errbuf);
+  errbuf = NULL;
+    
+  return (nattr);
+}
+
+
+
+/*----------------------------------------------------------------------------r
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqfields                                                  |
+|                                                                             |
+|  DESCRIPTION: Retrieve information about all data fields defined in a grid. |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nFld           int                 Number of fields in grid                |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fieldlist      char*               Field names (comma-separated)           |
+|  rank           int                 Array of ranks                          |
+|  ntype          hid_t               Array of field number types             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|             H5Dopen                                                         |
+|             H5Dget_type                                                     |
+|             H5Tget_class                                                    |
+|             H5Dclose                                                        |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/21/99  A.Muslimov    In the call to EHmetagroup() replaced the argument  |
+|                         gid by fid. Added propere error handling after the  |
+|                         function calls.                                     |
+|  Mar 00   A.Muslimov    Changed the ID of field group from gd_id to data_id.|
+|  Apr 00   A.Muslimvo    Changed type of 'slen', 'fldnmlen' from long to     |
+|                              size_t.                                        |
+|  May 00   A.Muslimov    Changed 'H5T_class_t" type to 'int' data type.      |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Jan 03   S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|  Oct. 03  S.Zhao        Added the H5Tclose(datatype) call.                  |
+|  Jan. 04  S.Zhao        Modified to enable a character string dataset.      |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_GDinqfields(hid_t gridID, char *fieldlist, int rank[], hid_t ntype[])
+{
+  int           nFld       =  0;  /* Number of fields (return)      */
+  int           i;                /* loop index                     */ 
+
+  herr_t        status     = FAIL;/* routine return status variable */
+  herr_t        Dstatus    = FAIL;/* Status for H5Dclose            */
+
+  long          ntflds     = 0;   /* Number of entries in field list*/
+  long          idx        = FAIL;/* Grid index                     */
+
+  hid_t         fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t         gid        = FAIL;/* "HDFEOS" group ID              */
+  hid_t         datasetid  = FAIL;/* Dataset ID                     */
+  hid_t         datatype   = FAIL;/* Datatype ID                    */
+ 
+  size_t        slen[HE5_DTSETRANKMAX]; /* String length array      */
+  size_t        fldnmlen[HE5_HDFE_NAMBUFSIZE];
+ 
+  char          *tempfield = (char *)NULL;
+  char          *fldnm[HE5_HDFE_NAMBUFSIZE];     
+  char          *metabuf = (char *)NULL;/* Pointer to structural metadata (SM)     */
+  char          *metaptrs[2];           /* Pointers to begin and end of SM section */
+  char          *utlstr = (char *)NULL; /* Utility string                          */
+  char          *ptr[HE5_DTSETRANKMAX]; /* String pointer array                    */
+  char          *errbuf = (char *)NULL; /* error message buffer                    */
+  H5T_class_t   classid = H5T_NO_CLASS; /* Data type class ID                      */
+  htri_t        str_is_variable;        /* boolean: TRUE if string is variable 
+					   lengeth FALSE if string is fixed length
+					   -1 if error in H5Tis_variavle_str()     */
+  
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDinqfields", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+  
+  utlstr  = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) );
+  if(utlstr == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for utility string.\n");
+      H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+	
+
+  /* If field names, ranks,  or number types desired ... */
+  /* --------------------------------------------------- */
+  if (fieldlist != NULL || rank != NULL || ntype != NULL)
+    {
+      /* Get pointers to "DataField" section within SM */
+      /* --------------------------------------------- */
+      metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname,"g","DataField", metaptrs);
+      if(metabuf == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for metabuffer.\n");
+	  H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(utlstr);
+		
+	  return(FAIL);
+	}
+
+      /* If field names are desired then "clear" name buffer */
+      /* --------------------------------------------------- */
+      if (fieldlist != NULL)
+	fieldlist[0] = 0;
+		
+      /* Begin loop through mapping entries in metadata */
+      /* ---------------------------------------------- */
+      while (1)
+	{
+	  /* Search for OBJECT string */
+	  /* ------------------------ */
+	  metaptrs[0] = strstr(metaptrs[0], "\t\tOBJECT=");
+
+			
+	  /* If found within "Data" Field metadata section .. */
+	  /* ------------------------------------------------ */
+	  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+	    {
+	      /* Get Fieldnames (if desired) */
+	      /* --------------------------- */
+	      if (fieldlist != NULL)
+		{
+		  /* Check 1st for old meta data then new */
+		  /* ------------------------------------ */
+		  status = HE5_EHgetmetavalue(metaptrs, "OBJECT", utlstr);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf,  "\"OBJECT\" string not found in metadata.");
+		      H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(errbuf);
+		      free(utlstr);
+		      free(metabuf);
+						
+		      return(FAIL);
+		    }
+					
+		  /*
+		   * If OBJECT value begins with double quote then old
+		   * metadata, field name is OBJECT value. Otherwise
+		   * search for "DataFieldName" string
+		   */
+					
+		  if (utlstr[0] != '"')
+		    {
+		      strcpy(utlstr, "\t\t\t\t");
+		      strcat(utlstr, "DataFieldName");
+		      strcat(utlstr, "=");
+		      metaptrs[0] = strstr(metaptrs[0], utlstr);
+		      status = HE5_EHgetmetavalue(metaptrs, "DataFieldName", utlstr);
+		      if (status == FAIL)
+			{
+			  sprintf(errbuf,  "\"DataFieldName\" string not found in metadata.");
+			  H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+			  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  free(errbuf);
+			  free(utlstr);
+			  free(metabuf);
+
+			  return(FAIL);
+			}
+						
+		    }
+
+		  /* Strip off double quotes */
+		  /* ----------------------- */
+		  REMQUOTE
+					  
+					  
+		    /* Add to fieldlist */
+		    /* ---------------- */
+		    if (nFld > 0)
+		      {
+			strcat(fieldlist, ",");
+		      }
+		  strcat(fieldlist, utlstr);
+					
+		}
+				
+	      if (ntype != NULL)
+		{
+		  ntflds = HE5_EHparsestr(fieldlist, ',', fldnm, fldnmlen);
+		  if(ntflds != FAIL)
+		    {
+		      for( i = 0; i < ntflds; i++)
+			{
+			  tempfield = (char *)calloc(fldnmlen[i] + 1, sizeof(char));
+			  if (tempfield == NULL)
+			    {
+			      sprintf(errbuf,  "Cannot allocate memory.");
+			      H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (errbuf  != NULL) free(errbuf);
+			      if (utlstr  != NULL) free(utlstr);
+			      if (metabuf != NULL) free(metabuf);
+							  
+			      return(FAIL);
+			    }
+			  memmove(tempfield,fldnm[i],fldnmlen[i]);
+			  datasetid     = H5Dopen(HE5_GDXGrid[idx].data_id, tempfield);
+			  if (datasetid == FAIL)
+			    {
+			      sprintf(errbuf,  "Cannot open the dataset.");
+			      H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (errbuf  != NULL) free(errbuf);
+			      if (utlstr  != NULL) free(utlstr);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+
+			      return(FAIL);
+			    }
+
+			  datatype      = H5Dget_type(datasetid);
+			  if (datatype == FAIL)
+			    {
+			      sprintf(errbuf,  "Cannot get the data type.");
+			      H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (errbuf  != NULL) free(errbuf);
+			      if (utlstr  != NULL) free(utlstr);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+
+			      return(FAIL);
+			    }
+
+			  classid      = H5Tget_class(datatype);
+			  if (classid == H5T_NO_CLASS)
+			    {
+			      sprintf(errbuf,  "Cannot get the data type class.");
+			      H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (errbuf  != NULL) free(errbuf);
+			      if (utlstr  != NULL) free(utlstr);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+
+			      return(FAIL);
+			    }
+ 
+			  if (classid == H5T_STRING)
+			    {
+			      /* HE5T_CHARSTRING has variable length for data fields */
+			      str_is_variable = H5Tis_variable_str(datatype);
+			      if(str_is_variable == TRUE)
+				{
+				  ntype[i] = HE5T_CHARSTRING;
+				}
+			      else if(str_is_variable == FALSE)
+				{
+				  ntype[i] = HE5T_NATIVE_CHAR;
+				}
+			      else
+				{
+				  status = FAIL;
+				  sprintf(errbuf, "Failed to see if string field is varaible or fixed length.\n");
+				  H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+				  HE5_EHprint(errbuf, __FILE__, __LINE__);
+				  if (errbuf  != NULL) free(errbuf);
+				  if (utlstr  != NULL) free(utlstr);
+				  if (metabuf != NULL) free(metabuf);
+				  free(tempfield);
+				  return(status);
+				}
+			      /*ntype[i] = HE5T_CHARSTRING;*/
+			    }
+			  else
+			    {
+			      ntype[i] = HE5_EHdtype2numtype(datatype);
+			      if (ntype[i] == FAIL)
+				{
+				  sprintf(errbuf,  "Cannot get the number type.\n");
+				  H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+				  HE5_EHprint(errbuf, __FILE__, __LINE__);
+				  if (errbuf  != NULL) free(errbuf);
+				  if (utlstr  != NULL) free(utlstr);
+				  if (metabuf != NULL) free(metabuf);
+				  free(tempfield);
+							  
+				  return(FAIL);
+				}
+			    }
+
+			  status = H5Tclose(datatype);
+			  if ( status == FAIL )
+			    {
+			      sprintf(errbuf,  "Cannot close the datatype.");
+			      H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (errbuf  != NULL) free(errbuf);
+			      if (utlstr  != NULL) free(utlstr);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+ 
+			      return(FAIL);
+			    }
+
+			  Dstatus       = H5Dclose(datasetid);
+			  if (Dstatus == FAIL)
+			    {
+			      sprintf(errbuf,  "Cannot close the dataset.");
+			      H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (errbuf  != NULL) free(errbuf);
+			      if (utlstr  != NULL) free(utlstr);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+
+			      return(FAIL);
+			    }
+
+			  free(tempfield);
+			}
+		    }
+		}
+			  
+	      /*
+	       * Get Rank (if desired) by counting # of dimensions in
+	       * "DimList" string
+	       */
+	      if (rank != NULL)
+		{
+		  status = HE5_EHgetmetavalue(metaptrs, "DimList", utlstr);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf,  "\"DimList\" string not found in metadata.");
+		      H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      if (errbuf  != NULL) free(errbuf);
+		      if (utlstr  != NULL) free(utlstr);
+		      if (metabuf != NULL) free(metabuf);
+
+		      return(FAIL);
+		    }
+					
+		  rank[ nFld ] = (int)HE5_EHparsestr(utlstr, ',', ptr, slen);
+		}
+	      /* Increment number of fields */
+	      nFld++;
+	    }
+	  else
+	    /* No more fields found */
+	    {
+	      break;
+	    }
+	}
+      if (metabuf != NULL) free(metabuf);
+    }
+	
+
+  free(utlstr);
+  free(errbuf);
+    
+	
+  return (nFld);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdetach                                                     |
+|                                                                             |
+|  DESCRIPTION: Detaches from grid interface and performs file housekeeping.  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|             H5Dclose                                                        |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/24/99  A.Muslimov    Changed the return type from intn to int   .        |
+|  9/9/99   A.Muslimov    Checked for the statuses returned by H5Dclose() and |
+|                         H5Gclose(). Cleaned up minor things.                |
+|  Feb,2000 A.Muslimov    Fixed bug-prone release of IDs.                     |
+|  Mar,2000 A.Muslimov    Added detaching from the "Data Fields" group.       |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDdetach(hid_t gridID)
+{
+
+  herr_t          status = FAIL;/* routine return status variable */    
+
+  int             i, k;		    /* loop indices                   */
+     
+  long            idx    = FAIL;/* Grid index                     */
+    
+  hid_t           fid    = FAIL;/* HDF-EOS file ID                */
+  hid_t           gid    = FAIL;/* "HDFEOS" group ID              */
+
+  char            *errbuf = (char *)NULL;/*Error message buffer   */
+
+
+  HE5_LOCK;
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdetach", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDdetach", &fid, &gid, &idx);
+  if( status == FAIL)
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDdetach", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+     
+      return(status);
+    }
+
+
+  /* "Detach" from previously attached datasets */
+  /* ------------------------------------------ */
+  if( HE5_GDXGrid[ idx ].nDFLD > 0 )
+    {
+      for (k = 0; k < HE5_GDXGrid[ idx ].nDFLD; k++)
+	{
+	  if ( HE5_GDXGrid[ idx ].ddataset[ k ].ID > 0 )
+	    {
+	      status = H5Dclose(HE5_GDXGrid[ idx ].ddataset[ k ].ID);
+	      if( status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot close the dataset.");
+		  H5Epush(__FILE__, "HE5_GDdetach", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		   
+		  return(status);
+		}
+	    }
+	  if (HE5_GDXGrid[ idx ].ddataset[ k ].name != NULL) 
+	    free(HE5_GDXGrid[ idx ].ddataset[ k ].name);
+	}
+      if ( HE5_GDXGrid[ idx ].ddataset != NULL )
+	free(HE5_GDXGrid[ idx ].ddataset); 
+    }
+
+  /* Detach from "Data Fields" groups */
+  /* -------------------------------- */
+
+  if (  HE5_GDXGrid[ idx ].data_id > 0 )
+    {
+      status = H5Gclose(HE5_GDXGrid[ idx ].data_id);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot close the group.");
+	  H5Epush(__FILE__, "HE5_GDdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  
+	  return(status);
+	}
+    }
+
+
+  /* Detach from Grid groups */
+  /* ----------------------- */
+  if (  HE5_GDXGrid[ idx ].gd_id > 0 )
+    {
+      status = H5Gclose(HE5_GDXGrid[ idx ].gd_id);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot close the group.");
+	  H5Epush(__FILE__, "HE5_GDdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  
+	  return(status);
+	}
+    }
+	    
+
+  /* Delete entries from External Arrays */
+  /* ----------------------------------- */
+  HE5_GDXGrid[  idx  ].active     =       0;
+  HE5_GDXGrid[  idx  ].fid        =       0;
+  HE5_GDXGrid[  idx  ].gd_id      =       0;
+  HE5_GDXGrid[  idx  ].data_id    =       0;
+  HE5_GDXGrid[  idx  ].obj_id     =       0;
+  HE5_GDXGrid[  idx  ].ddataset   =    NULL;
+  HE5_GDXGrid[  idx  ].nDFLD      =       0;
+
+
+  /* Free Region Pointers */
+  /* -------------------- */
+  for (k = 0; k < HE5_NGRIDREGN; k++)
+    {
+      if (HE5_GDXRegion[ k ] != NULL && HE5_GDXRegion[ k ]->gridID == gridID)
+	{
+	  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+	    {
+	      if (HE5_GDXRegion[ k ]->DimNamePtr[ i ] != NULL)
+		{
+		  if( HE5_GDXRegion[ k ]->DimNamePtr[ i ] != NULL )
+		    {
+		      free(HE5_GDXRegion[ k ]->DimNamePtr[ i ]);
+		      HE5_GDXRegion[ k ]->DimNamePtr[ i ] = NULL;
+		    }
+		}
+	    }
+
+	  if ( HE5_GDXRegion[ k ] != NULL )
+	    {
+	      free(HE5_GDXRegion[ k ]);
+	      HE5_GDXRegion[ k ] = NULL;
+	    }
+	}
+    }
+	
+	
+  free(errbuf);
+  errbuf = (char *)NULL;
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDclose                                                      |
+|                                                                             |
+|  DESCRIPTION: Closes file.                                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               HDF-EOS type file ID                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_GDclose(hid_t fid)
+{
+  herr_t            status = FAIL;/* routine return status variable */
+
+  /* Call HE5_EHclose to perform file close */
+  /* -------------------------------------- */
+  status = HE5_EHclose(fid);
+
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetdefaults                                                |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  projcode       int                 GCTP projection code                    |
+|  zonecode       int                 UTM zone code                           |
+|  projparm       double              Projection parameters                   |
+|  spherecode     int                 GCTP spheriod code                      |
+|  upleftpt       double              upper left corner coordinates           |
+|  lowrightpt     double              lower right corner coordinates          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  upleftpt       double              upper left corner coordinates           |
+|  lowrightpt     double              lower right corner coordinates          |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/24/99  A.Muslimov    Changed the return type from intn to int   .        |
+|  9/28/99  A.Muslimov    Added proper error handlings after the function     |
+|                         calls.                                              |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_GDgetdefaults(int projcode, int zonecode, double projparm[], int spherecode, double upleftpt[], double lowrightpt[])
+{
+
+  herr_t          status    = SUCCEED;/* routine return status variable */
+   
+#if defined(SGI64) || defined(UNICOS) || defined(LINUX64) || defined(IA64) || defined(MACINTOSH) || defined(MACINTEL) || defined(IBM6000) || defined(CYGWIN) || defined(DEC_ALPHA)
+  int             (*for_trans[100]) (double, double, double*, double*);
+  int             errorcode = 0;
+#else
+  long            (*for_trans[100]) (double, double, double*, double*);
+  long            errorcode = 0;
+#endif
+
+  double          lon   = 0.;
+  double          lat   = 0.;
+  double          plat  = 0.;
+  double          x     = 0.;
+  double          y     = 0.;
+  double          plon  = 0.; 
+  double          tlon  = 0.;
+  double          llon  = 0.; 
+  double          rlon  = 0.;
+  double          pplon = 0.;
+  double	  RLon = 0.;
+  double 	  RLat = 0.;
+  double 	  LLon = 0.;
+  double 	  LLat = 0.;
+
+  char            *errbuf;		/* buffer for error message       */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* invoke GCTP initialization routine */
+  /* ---------------------------------- */
+  for_init(projcode, zonecode, projparm, spherecode, NULL, NULL,&errorcode, for_trans);
+
+  /* Report error if any */
+  /* ------------------- */
+  if (errorcode != 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+      H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return (status);
+    }
+
+  /* Compute Default Boundary Points for EASE Grid          */
+  /* Use Global coverage */
+  /* ------------------------------------------------------ */
+  if (projcode == HE5_GCTP_BCEA &&
+      upleftpt[0] == 0 && upleftpt[1] == 0 &&
+      lowrightpt[0] == 0 && lowrightpt[1] == 0)
+    {
+      upleftpt[0] = HE5_EHconvAng(EASE_GRID_DEFAULT_UPLEFT_LON, HE5_HDFE_DEG_DMS);
+      upleftpt[1] = HE5_EHconvAng(EASE_GRID_DEFAULT_UPLEFT_LAT, HE5_HDFE_DEG_DMS);
+      lowrightpt[0] = HE5_EHconvAng(EASE_GRID_DEFAULT_LOWRGT_LON, HE5_HDFE_DEG_DMS);
+      lowrightpt[1] = HE5_EHconvAng(EASE_GRID_DEFAULT_LOWRGT_LAT, HE5_HDFE_DEG_DMS);
+    }
+
+  /* Compute Default Boundary Points for CEA     */
+  /* --------------------------------------------*/
+  if (projcode ==HE5_GCTP_CEA &&
+      upleftpt[0] == 0 && upleftpt[1] == 0 &&
+      lowrightpt[0] == 0 && lowrightpt[1] == 0)
+    {
+      LLon = HE5_EHconvAng(EASE_GRID_DEFAULT_UPLEFT_LON, HE5_HDFE_DEG_RAD);
+      LLat = HE5_EHconvAng(EASE_GRID_DEFAULT_UPLEFT_LAT, HE5_HDFE_DEG_RAD);
+      RLon = HE5_EHconvAng(EASE_GRID_DEFAULT_LOWRGT_LON, HE5_HDFE_DEG_RAD);
+      RLat = HE5_EHconvAng(EASE_GRID_DEFAULT_LOWRGT_LAT, HE5_HDFE_DEG_RAD);
+
+      errorcode = for_trans[projcode] (LLon, LLat, &x, &y);
+      if (errorcode != 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return (status);
+	}
+      upleftpt[0] = x;
+      upleftpt[1] = y;
+ 
+      errorcode = for_trans[projcode] (RLon, RLat, &x, &y);
+      if (errorcode != 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return (status);
+        }
+      lowrightpt[0] = x;
+      lowrightpt[1] = y;
+
+    }
+
+
+  /* Compute Default Boundary Points for Polar Sterographic */
+  /* ------------------------------------------------------ */
+  if (projcode == HE5_GCTP_PS && upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0)
+    {
+      /*
+       * Convert the longitude and latitude from the DMS to decimal degree
+       * format.
+       */
+      plon = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG);
+      plat = HE5_EHconvAng(projparm[5], HE5_HDFE_DMS_DEG);
+
+      /*
+       * Compute the longitudes at 90, 180 and 270 degrees from the central
+       * longitude.
+       */
+
+      if (plon <= 0.0)
+        {
+	  tlon  = 180.0 + plon;
+	  pplon = plon + 360.0;
+        }
+      else
+        {
+	  tlon  = plon - 180.0;
+	  pplon = plon;
+        }
+
+      rlon = pplon + 90.0;
+      if (rlon > 360.0)
+	rlon = rlon - 360.;
+
+      if (rlon > 180.0)
+	rlon = rlon - 360.0;
+
+      if (rlon <= 0.0)
+	llon = 180.0 + rlon;
+      else
+	llon = rlon - 180.0;
+
+
+      /* Convert all four longitudes from decimal degrees to radians */
+      plon = HE5_EHconvAng(plon, HE5_HDFE_DEG_RAD);
+      tlon = HE5_EHconvAng(tlon, HE5_HDFE_DEG_RAD);
+      llon = HE5_EHconvAng(llon, HE5_HDFE_DEG_RAD);
+      rlon = HE5_EHconvAng(rlon, HE5_HDFE_DEG_RAD);
+
+      errorcode = for_trans[projcode] (llon, 0., &x, &y);
+      if (errorcode != 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	    
+	  return (status);
+        }
+
+      upleftpt[0] = x;
+
+      errorcode = for_trans[projcode](rlon, 0.0, &x, &y);
+      if (errorcode != 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	    
+	  return (status);
+        }
+
+      lowrightpt[0] = x;
+
+      /*
+       * Compute the upperleft and lowright y values based on the south or
+       * north polar projection
+       */
+
+      if (plat < 0.0)
+        {
+	  errorcode = for_trans[projcode] (plon, 0.0, &x, &y);
+	  if (errorcode != 0)
+            {
+	      status = FAIL;
+	      sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	      H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+		
+	      return (status);
+            }
+
+	  upleftpt[1] = y;
+
+	  errorcode = for_trans[projcode] (tlon, 0.0, &x, &y);
+	  if (errorcode != 0)
+            {
+	      status = FAIL;
+	      sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	      H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+		
+	      return (status);
+            }
+	  lowrightpt[1] = y;
+        }
+      else
+        {
+	  errorcode = for_trans[projcode] (tlon, 0.0, &x, &y);
+	  if (errorcode != 0)
+            {
+	      status = FAIL;
+	      sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	      H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+		
+	      return (status);
+            }
+
+	  upleftpt[1] = y;
+
+	  errorcode = for_trans[projcode](plon, 0., &x, &y);
+	  if (errorcode != 0)
+            {
+	      status = FAIL;
+	      sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	      H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+		
+	      return (status);
+            }
+
+	  lowrightpt[1] = y;
+        }
+    }
+
+  /* Compute Default Boundary Points for Goode Homolosine */
+  /* ---------------------------------------------------- */
+  if (projcode == HE5_GCTP_GOOD && upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0)
+    {
+      lon = HE5_EHconvAng(-180, HE5_HDFE_DEG_RAD);
+      lat = 0.0;
+
+      errorcode = for_trans[projcode] (lon, lat, &x, &y);
+      if (errorcode != 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	    
+	  return (status);
+        }
+
+      upleftpt[0]   = -fabs(x);
+      lowrightpt[0] = +fabs(x);
+
+      lat = HE5_EHconvAng(90, HE5_HDFE_DEG_RAD);
+
+      errorcode = for_trans[projcode] (lon, lat, &x, &y);
+      if (errorcode != 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	    
+	  return (status);
+        }
+
+      upleftpt[1]   = +fabs(y);
+      lowrightpt[1] = -fabs(y);
+    }
+
+  /* Compute Default Boundary Points for Lambert Azimuthal */
+  /* ----------------------------------------------------- */
+  if (projcode == HE5_GCTP_LAMAZ && upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0)
+    {
+      /*
+       * Convert the longitude and latitude from the DMS to decimal degree
+       * format.
+       */
+      plon = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG);
+      plat = HE5_EHconvAng(projparm[5], HE5_HDFE_DMS_DEG);
+
+      /*
+       * Compute the longitudes at 90, 180 and 270 degrees from the central
+       * longitude.
+       */
+
+      if (plon <= 0.0)
+        {
+	  tlon  = 180.0 + plon;
+	  pplon = plon + 360.0;
+        }
+      else
+        {
+	  tlon  = plon - 180.0;
+	  pplon = plon;
+        }
+
+      rlon = pplon + 90.0;
+      if (rlon > 360.0)
+	rlon = rlon - 360.;
+
+      if (rlon > 180.0)
+	rlon = rlon - 360.0;
+
+      if (rlon <= 0.0)
+	llon = 180.0 + rlon;
+      else
+	llon = rlon - 180.0;
+
+      /* Convert all four longitudes from decimal degrees to radians */
+      plon = HE5_EHconvAng(plon, HE5_HDFE_DEG_RAD);
+      tlon = HE5_EHconvAng(tlon, HE5_HDFE_DEG_RAD);
+      llon = HE5_EHconvAng(llon, HE5_HDFE_DEG_RAD);
+      rlon = HE5_EHconvAng(rlon, HE5_HDFE_DEG_RAD);
+
+      errorcode = for_trans[projcode] (llon, 0.0, &x, &y);
+      if (errorcode != 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	    
+	  return (status);
+        }
+
+      upleftpt[0] = x;
+
+      errorcode = for_trans[projcode] (rlon, 0.0, &x, &y);
+      if (errorcode != 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	    
+	  return (status);
+        }
+
+      lowrightpt[0] = x;
+
+      /*
+       * Compute upperleft and lowerright values based on whether the
+       * projection is south polar, north polar or equitorial
+       */
+
+      if (plat == -90.0)
+        {
+	  errorcode = for_trans[projcode] (plon, 0.0, &x, &y);
+	  if (errorcode != 0)
+            {
+	      status = FAIL;
+	      sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	      H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+		
+	      return (status);
+            }
+
+	  upleftpt[1] = y;
+
+	  errorcode = for_trans[projcode] (tlon, 0.0, &x, &y);
+	  if (errorcode != 0)
+            {
+	      status = FAIL;
+	      sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	      H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+		
+	      return (status);
+            }
+
+	  lowrightpt[1] = y;
+        }
+      else if (plat == 90.0)
+        {
+	  errorcode = for_trans[projcode] (tlon, 0.0, &x, &y);
+	  if (errorcode != 0)
+            {
+	      status = FAIL;
+	      sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+	      H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+		
+	      return (status);
+            }
+
+	  upleftpt[1] = y;
+
+	  errorcode = for_trans[projcode] (plon, 0.0, &x, &y);
+	  if (errorcode != 0)
+            {
+	      status = FAIL;
+	      sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	      H5Epush(__FILE__,  "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+		
+	      return (status);
+            }
+
+	  lowrightpt[1] = y;
+        }
+      else
+        {
+	  lat = HE5_EHconvAng(90, HE5_HDFE_DEG_RAD);
+	  errorcode = for_trans[projcode] (plon, lat, &x, &y);
+	  if (errorcode != 0)
+            {
+	      status = FAIL;
+	      sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	      H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+		
+	      return (status);
+            }
+	  upleftpt[1] = y;
+
+	  lat = HE5_EHconvAng(-90, HE5_HDFE_DEG_RAD);
+	  errorcode = for_trans[projcode] (plon, lat, &x, &y);
+	  if (errorcode != 0)
+            {
+	      status = FAIL;
+	      sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	      H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+		
+	      return (status);
+            }
+
+	  lowrightpt[1] = y;
+        }
+    }
+
+  /* Compute Default Boundary Points for Integerized Sinusoidal Grid */
+  /* --------------------------------------------------------------- */
+  if (projcode == HE5_GCTP_ISINUS && upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0)
+    {
+      /*
+       * Convert the longitude and latitude from the DMS to decimal degree
+       * format.
+       */
+      plon = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG);
+      plat = HE5_EHconvAng(projparm[5], HE5_HDFE_DMS_DEG);
+      /*
+       * Compute the longitudes at 90, 180 and 270 degrees from the central
+       * longitude.
+       */
+
+      if (plon <= 0.0)
+        {
+	  tlon = 180.0 + plon;
+	  pplon = plon + 360.0;
+        }
+      else
+        {
+	  tlon = plon - 180.0;
+	  pplon = plon;
+        }
+
+      rlon = pplon + 90.0;
+      if (rlon > 360.0)
+	rlon = rlon - 360.;
+
+      if (rlon > 180.0)
+	rlon = rlon - 360.0;
+
+      if (rlon <= 0.0)
+	llon = 180.0 + rlon;
+      else
+	llon = rlon - 180.0;
+
+      /* Convert all four longitudes from decimal degrees to radians */
+      plon = HE5_EHconvAng(plon, HE5_HDFE_DEG_RAD);
+      tlon = HE5_EHconvAng(tlon, HE5_HDFE_DEG_RAD);
+      llon = HE5_EHconvAng(llon, HE5_HDFE_DEG_RAD);
+      rlon = HE5_EHconvAng(rlon, HE5_HDFE_DEG_RAD);
+
+      errorcode = for_trans[projcode] (llon, 0.0, &x, &y);
+      if (errorcode != 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	    
+	  return (status);
+        }
+
+      upleftpt[0] = x;
+
+      errorcode = for_trans[projcode] (rlon, 0.0, &x, &y);
+      if (errorcode != 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	    
+	  return (status);
+        }
+
+      lowrightpt[0] = x;
+
+      lat = HE5_EHconvAng(90, HE5_HDFE_DEG_RAD);
+      errorcode = for_trans[projcode] (plon, lat, &x, &y);
+      if (errorcode != 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	    
+	  return (status);
+        }
+
+      upleftpt[1] = y;
+
+      lat = HE5_EHconvAng(-90, HE5_HDFE_DEG_RAD);
+      errorcode = for_trans[projcode] (plon, lat, &x, &y);
+      if (errorcode != 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li \n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	    
+	  return (status);
+        }
+
+      lowrightpt[1] = y;
+    }
+
+  free(errbuf);
+  errbuf = NULL;
+    
+  return (status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDll2ij                                                      |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  projcode       int                 GCTP projection code                    |
+|  zonecode       int                 UTM zone code                           |
+|  projparm       double              Projection parameters                   |
+|  spherecode     int                 GCTP spheriod code                      |
+|  xdimsize       long                xdimsize from GDcreate                  |
+|  ydimsize       long                ydimsize from GDcreate                  |
+|  upleftpt       double              upper left corner coordinates           |
+|  lowrightpt     double              lower right corner coordinates          |
+|  npnts          long                number of lon-lat points                |
+|  longitude      double              longitude array (decimal degrees)       |
+|  latitude       double              latitude array (decimal degrees)        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  row            long                Row array                               |
+|  col            long                Column array                            |
+|  xval           double              X value array                           |
+|  yval           double              Y value array                           |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/24/99  A.Muslimov    Changed the return type from intn to int   .        |
+|                         Added proper error handlings.                       |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  2/02/08  Abe Taaheri   Created Fortran Wrapper, and made it an API         |
+|  Jun 11   Abe Taaher    Modified for State Plane Files inclusion            |
+|                                                                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDll2ij(int projcode, int zonecode, double projparm[],
+	    int spherecode, long xdimsize, long ydimsize,
+	    double upleftpt[], double lowrightpt[],
+	    long  npnts, double longitude[], double latitude[],
+	    long row[], long col[], double xval[], double yval[])
+{
+  
+  herr_t          status = SUCCEED;         /* routine return status variable       */
+  
+  long            i;                     /* Loop index                           */
+
+#if defined(SGI64) || defined(UNICOS) || defined(LINUX64) || defined(IA64) || defined(MACINTOSH) || defined(MACINTEL) || defined(IBM6000) || defined(CYGWIN) || defined(DEC_ALPHA)
+  int             (*for_trans[100]) (double, double, double *, double *);
+  int              errorcode = 0;         /* GCTP error code   */  
+#else
+  long            (*for_trans[100]) (double, double, double *, double *);
+  long             errorcode = 0;         /* GCTP error code   */  
+#endif
+
+  double          xVal    = 0.;          /* Scaled x distance                    */
+  double          yVal    = 0.;          /* Scaled y distance                    */
+  double          xMtr    = 0.;          /* X value in meters from GCTP          */
+  double          yMtr    = 0.;          /* Y value in meters from GCTP          */
+  double          lonrad0 = 0.;          /* Longitude in radians of upleft point */
+  double          latrad0 = 0.;          /* Latitude in radians of upleft point  */
+  double          lonrad  = 0.;          /* Longitude in radians of point        */
+  double          latrad  = 0.;          /* Latitude in radians of point         */
+  double          scaleX  = 0.;          /* X scale factor                       */
+  double          scaleY  = 0.;          /* Y scale factor                       */
+  double          HE5_EHconvAng(double, int);/* Angle conversion routine         */
+  double	  xMtr0, xMtr1, yMtr0, yMtr1;
+  
+  char            *errbuf;               /* Buffer for error message             */
+  char            *eastFile = NULL;
+  char            *northFile = NULL;
+
+  CHECKPOINTER(upleftpt);
+  CHECKPOINTER(lowrightpt);
+  CHECKPOINTER(longitude);
+  CHECKPOINTER(latitude);
+ 
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDll2ij", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  
+  /* If projection not GEO call GCTP initialization routine */
+  /* ------------------------------------------------------ */
+  if (projcode != HE5_GCTP_GEO)
+    {
+
+      eastFile = (char *) malloc(300*sizeof(char));
+      northFile = (char *) malloc(300*sizeof(char));
+
+      HE5_GDgetEastAndNorthFiles(eastFile,northFile); 
+
+      for_init(projcode, zonecode, projparm, spherecode, eastFile, northFile,  
+	       &errorcode, for_trans);
+	  
+      free (eastFile);
+      free (northFile);
+      eastFile = NULL;
+      northFile = NULL;
+
+      /* Report error if any */
+      /* ------------------- */
+      if (errorcode != 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDll2ij", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+
+	  return (status);
+	}
+    }
+  
+  if (status == SUCCEED)
+    {
+      /* GEO projection */
+      /* -------------- */
+      if (projcode == HE5_GCTP_GEO)
+	{
+	  /* Convert upleft and lowright X coords from DMS to radians */
+	  /* -------------------------------------------------------- */
+	  lonrad0 = HE5_EHconvAng(upleftpt[0], HE5_HDFE_DMS_RAD);
+	  lonrad  = HE5_EHconvAng(lowrightpt[0], HE5_HDFE_DMS_RAD);
+		  
+	  /* Compute x scale factor */
+	  /* ---------------------- */
+	  scaleX = (lonrad - lonrad0) / xdimsize;
+		  
+		  
+	  /* Convert upleft and lowright Y coords from DMS to radians */
+	  /* -------------------------------------------------------- */
+	  latrad0 = HE5_EHconvAng(upleftpt[1], HE5_HDFE_DMS_RAD);
+	  latrad  = HE5_EHconvAng(lowrightpt[1], HE5_HDFE_DMS_RAD);
+
+		  
+	  /* Compute y scale factor */
+	  /* ---------------------- */
+	  scaleY = (latrad - latrad0) / ydimsize;
+	}
+      /* BCEA projection */
+      /* -------------- */
+      else if ( projcode == HE5_GCTP_BCEA)
+	{
+	  /* Convert upleft and lowright X coords from DMS to radians */
+	  /* ----------------------------------------------------------*/
+    
+	  lonrad0 = HE5_EHconvAng(upleftpt[0], HE5_HDFE_DMS_RAD);
+	  lonrad = HE5_EHconvAng(lowrightpt[0],HE5_HDFE_DMS_RAD);
+  
+	  /* Convert upleft and lowright Y coords from DMS to radians */
+	  /* ----------------------------------------------------------*/
+	  latrad0 = HE5_EHconvAng(upleftpt[1], HE5_HDFE_DMS_RAD);
+	  latrad = HE5_EHconvAng(lowrightpt[1], HE5_HDFE_DMS_RAD);
+  
+	  /* Convert from lon/lat to meters(or whatever unit is, i.e unit
+	     of r_major and r_minor) using GCTP */
+	  /* ----------------------------------------- */
+	  errorcode = for_trans[projcode] (lonrad0, latrad0, &xMtr0, &yMtr0);
+
+	  /* Report error if any */
+	  /* ------------------- */
+	  if (errorcode != 0)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+	      H5Epush(__FILE__, "HE5_GDll2ij", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return (status);
+	    }
+  
+	  /* Convert from lon/lat to meters(or whatever unit is, i.e unit
+	     of r_major and r_minor) using GCTP */
+	  /* ----------------------------------------- */
+	  errorcode = for_trans[projcode] (lonrad, latrad, &xMtr1, &yMtr1);
+              
+	  /* Report error if any */
+	  /* ------------------- */
+	  if (errorcode != 0)
+	    { status = FAIL;
+	      sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+	      H5Epush(__FILE__, "HE5_GDll2ij", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return (status);  
+	    }
+  
+	  /* Compute x scale factor */
+	  /* ---------------------- */
+	  scaleX = (xMtr1 - xMtr0) / xdimsize;
+ 
+	  /* Compute y scale factor */
+	  /* ---------------------- */
+	  scaleY = (yMtr1 - yMtr0) / ydimsize;
+	}
+
+      else
+        {
+	  /* Non-GEO, Non-BCEA  projections */
+	  /* ------------------ */
+		  
+	  /* Compute x & y scale factors */
+	  /* --------------------------- */
+	  scaleX = (lowrightpt[0] - upleftpt[0]) / xdimsize;
+	  scaleY = (lowrightpt[1] - upleftpt[1]) / ydimsize;
+        }
+	  
+	  
+	  
+      /* Loop through all points */
+      /* ----------------------- */
+      for (i = 0; i < npnts; i++)
+        {
+	  /* Convert lon & lat from decimal degrees to radians */
+	  /* ------------------------------------------------- */
+	  lonrad = HE5_EHconvAng(longitude[i], HE5_HDFE_DEG_RAD);
+	  latrad = HE5_EHconvAng(latitude[i], HE5_HDFE_DEG_RAD);
+
+	  /* GEO projection */
+	  /* -------------- */
+	  if (projcode == HE5_GCTP_GEO)
+	    {
+	      /* Compute scaled distance to point from origin */
+	      /* -------------------------------------------- */
+	      xVal = (lonrad - lonrad0) / scaleX;
+	      yVal = (latrad - latrad0) / scaleY;
+	    }
+	  else
+	    {
+	      /* Convert from lon/lat to meters using GCTP */
+	      /* ----------------------------------------- */
+	      errorcode = for_trans[projcode](lonrad, latrad, &xMtr, &yMtr);
+			  
+
+	      /* Report error if any */
+	      /* ------------------- */
+	      if (errorcode != 0)
+		{
+		  status = FAIL;
+		  sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+		  H5Epush(__FILE__, "HE5_GDll2ij", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+	      else {
+		/* if projection is BCEA normalize x and y by cell size and
+		   measure it from the uperleft corner of the grid */
+  
+		/* Compute scaled distance to point from origin */
+		/* -------------------------------------------- */
+		if(  projcode == HE5_GCTP_BCEA)
+		  {
+		    xVal = (xMtr - xMtr0) / scaleX;
+		    yVal = (yMtr - yMtr0) / scaleY;
+		  }
+		else
+		  {
+		    xVal = (xMtr - upleftpt[0]) / scaleX;
+		    yVal = (yMtr - upleftpt[1]) / scaleY;
+		  }
+	      }
+	    }		  
+                        			  
+		  
+
+	  /* Compute row and col from scaled distance */
+	  /* ---------------------------------------- */
+	  col[i] = (long)xVal;
+	  row[i] = (long)yVal;
+		  
+		  
+	  /* Store scaled distances if requested */
+	  /* ----------------------------------- */
+	  if (xval != NULL)
+	    {
+	      xval[i] = xVal;
+	    }
+		  
+	  if (yval != NULL)
+	    {
+	      yval[i] = yVal;
+	    }
+	}
+    }
+  
+  if (errbuf != NULL) free(errbuf);
+  
+ COMPLETION:
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDij2ll                                                      |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  projcode       int                 GCTP projection code                    |
+|  zonecode       int                 UTM zone code                           |
+|  projparm       double              Projection parameters                   |
+|  spherecode     int                 GCTP spheriod code                      |
+|  xdimsize       long                xdimsize from GDcreate                  |
+|  ydimsize       long                ydimsize from GDcreate                  |
+|  upleftpt       double              upper left corner coordinates           |
+|  lowrightpt     double              lower right corner coordinates          |
+|  pixcen         int                 pixel center code                       |
+|  npnts          long                number of lon-lat points                |
+|  row            long                Row array                               |
+|  col            long                Column array                            |
+|  pixcen         int                 Code from GDpixreginfo                  |
+|  pixcnr         int                 Code from GDorigininfo                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  longitude      double              longitude array (decimal degrees)       |
+|  latitude       double              latitude array  (decimal degrees)       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/24/99  A.Muslimov    Changed the return type from intn to int   .        |
+|                         Added proper error handling after the function calls|
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  2/02/08  Abe Taaheri   Created Fortran Wrapper, and made it an API         |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_GDij2ll(int projcode, int zonecode, double projparm[],
+	    int spherecode, long xdimsize, long ydimsize,
+	    double upleftpt[], double lowrightpt[],
+	    long npnts, long row[], long col[],
+	    double longitude[], double latitude[], int pixcen, int pixcnr)
+{
+
+  herr_t          status    = FAIL;/* routine return status variable      */
+
+  long            i;			  /* Loop index                           */
+
+#if defined(SGI64) || defined(UNICOS) || defined(LINUX64) || defined(IA64) || defined(MACINTOSH) || defined(MACINTEL) || defined(IBM6000) || defined(CYGWIN) || defined(DEC_ALPHA)
+  int             (*inv_trans[100]) (double, double, double*, double*);	
+  int             errorcode = 0;  /* GCTP error code                      */
+#else
+  long            (*inv_trans[100]) (double, double, double*, double*);	
+  long            errorcode = 0;  /* GCTP error code                      */
+#endif
+ 
+#if defined(SGI64) || defined(UNICOS) || defined(LINUX64) || defined(IA64) || defined(MACINTOSH) || defined(MACINTEL) || defined(IBM6000) || defined(CYGWIN) || defined(DEC_ALPHA)
+  int             (*for_trans[100]) (double, double, double*, double*);
+#else
+  long            (*for_trans[100]) (double, double, double*, double*);
+#endif
+
+  double          arg1, arg2;
+  double          pixadjX  = 0.;  /* Pixel adjustment (x)                 */
+  double          pixadjY  = 0.;  /* Pixel adjustment (y)                 */
+  double          lonrad0  = 0.;  /* Longitude in radians of upleft point */
+  double          latrad0  = 0.;  /* Latitude in radians of upleft point  */
+  double          scaleX   = 0.;  /* X scale factor                       */
+  double          scaleY   = 0.;  /* Y scale factor                       */
+  double          lonrad   = 0.;  /* Longitude in radians of point        */
+  double          latrad   = 0.;  /* Latitude in radians of point         */
+  double          HE5_EHconvAng(double, int);/* Angle conversion routine  */
+  double	  xMtr0, yMtr0, xMtr1, yMtr1;
+
+  char            *errbuf;		  /* buffer for error message     */
+  char            *eastFile = NULL;
+  char            *northFile = NULL;
+
+  CHECKPOINTER(upleftpt);
+  CHECKPOINTER(lowrightpt);
+  CHECKPOINTER(row);
+  CHECKPOINTER(col);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+  /* Compute adjustment of position within pixel */
+  /* ------------------------------------------- */
+  if (pixcen == HE5_HDFE_CENTER)
+    {
+      /* Pixel defined at center */
+      /* ----------------------- */
+      pixadjX = 0.5;
+      pixadjY = 0.5;
+    }
+  else
+    {
+      switch (pixcnr)
+        {
+		  
+        case HE5_HDFE_GD_UL:
+	  {
+	    /* Pixel defined at upper left corner */
+	    /* ---------------------------------- */
+	    pixadjX = 0.0;
+	    pixadjY = 0.0;
+	    break;
+	  }
+
+        case HE5_HDFE_GD_UR:
+	  {
+	    /* Pixel defined at upper right corner */
+	    /* ----------------------------------- */
+	    pixadjX = 1.0;
+	    pixadjY = 0.0;
+	    break;
+	  }
+
+        case HE5_HDFE_GD_LL:
+	  {
+	    /* Pixel defined at lower left corner */
+	    /* ---------------------------------- */
+	    pixadjX = 0.0;
+	    pixadjY = 1.0;
+	    break;
+	  }
+
+        case HE5_HDFE_GD_LR:
+	  {
+	    /* Pixel defined at lower right corner */
+	    /* ----------------------------------- */
+	    pixadjX = 1.0;
+	    pixadjY = 1.0;
+	    break;
+	  }
+
+	default:
+	  {
+	    sprintf(errbuf, "Unknown pixel corner.\n");
+	    H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    return(FAIL);
+	  }
+        }
+    }
+
+
+
+  /* If projection not GEO or BCEA call GCTP initialization routine */
+  /* ------------------------------------------------------ */
+  if (projcode != HE5_GCTP_GEO && projcode != HE5_GCTP_BCEA)
+    {
+      eastFile = (char *) malloc(300*sizeof(char));
+      northFile = (char *) malloc(300*sizeof(char));
+
+      HE5_GDgetEastAndNorthFiles(eastFile,northFile); 
+
+      scaleX = (lowrightpt[0] - upleftpt[0]) / xdimsize;
+      scaleY = (lowrightpt[1] - upleftpt[1]) / ydimsize;
+
+      inv_init(projcode, zonecode, projparm, spherecode, eastFile, northFile, 
+	       &errorcode, inv_trans);
+
+      free (eastFile);
+      free (northFile);
+      eastFile = NULL;
+      northFile = NULL;
+
+
+      /* Report error if any */
+      /* ------------------- */
+      if (errorcode != 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(status);
+        }
+      else
+        {
+	  /* For each point ... */
+	  /* ------------------ */
+	  for (i = 0; i < npnts; i++)
+            {
+	      /* Convert from meters to lon/lat (radians) using GCTP */
+	      /* --------------------------------------------------- */
+	      /*errorcode = inv_trans[projcode] ((col[i] + pixadjX) * scaleX + upleftpt[0], (row[i] + pixadjY) * scaleY + upleftpt[1], &lonrad, &latrad);*/
+
+	      /* modified previous line to the following for the linux64 with -fPIC in cmpilation. 
+		 Whithout the change col[] and row[] values are ridiclous numbers, resulting a strange 
+		 number (very big) for arg1 and arg2. But with (int) typecast they become normal integers,
+		 resulting in a acceptable values for arg1 and arg2. The problem was discovered during the
+		 lat/lon geolocating of an hdfeos5 file with 64-bit hadview plug-in, developped for linux64.
+	      */
+	      arg1 = (((int)col[i] + pixadjX) * scaleX + upleftpt[0]);
+	      arg2 = (((int)row[i] + pixadjY) * scaleY + upleftpt[1]);
+	      errorcode = inv_trans[projcode] (arg1, arg2, &lonrad, &latrad);
+
+	      /* Report error if any */
+	      /* ------------------- */
+	      if (errorcode != 0)
+		{
+		  status = FAIL;
+		  sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+		  H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  return(status);
+		}
+	      else
+		{
+		  /* Convert from radians to decimal degrees */
+		  /* --------------------------------------- */
+		  longitude[i] = HE5_EHconvAng(lonrad, HE5_HDFE_RAD_DEG);
+		  latitude[i]  = HE5_EHconvAng(latrad, HE5_HDFE_RAD_DEG);
+		}
+	    }
+	}
+    }
+  else if (projcode == HE5_GCTP_BCEA)
+    {
+      /* BCEA projection */
+      /* -------------- */
+ 
+      /* Note: upleftpt and lowrightpt are in packed degrees, so they
+	 must be converted to meters for this projection */
+
+      /* Initialize forward transformation */
+      /* --------------------------------- */
+      for_init(projcode, zonecode, projparm, spherecode, NULL, NULL,&errorcode, for_trans);
+
+      /* Report error if any */
+      /* ------------------- */
+      if (errorcode != 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return (-1);
+	}
+
+      /* Convert upleft and lowright X coords from DMS to radians */
+      /* -------------------------------------------------------- */
+      lonrad0 =HE5_EHconvAng(upleftpt[0], HE5_HDFE_DMS_RAD);
+      lonrad = HE5_EHconvAng(lowrightpt[0], HE5_HDFE_DMS_RAD);
+
+      /* Convert upleft and lowright Y coords from DMS to radians */
+      /* -------------------------------------------------------- */
+      latrad0 = HE5_EHconvAng(upleftpt[1], HE5_HDFE_DMS_RAD);
+      latrad = HE5_EHconvAng(lowrightpt[1], HE5_HDFE_DMS_RAD);
+
+      /* Convert form lon/lat to meters(or whatever unit is, i.e unit
+	 of r_major and r_minor) using GCTP */
+      /* ----------------------------------------- */
+      errorcode = for_trans[projcode] (lonrad0, latrad0, &xMtr0, &yMtr0);
+
+      /* Report error if any */
+      if (errorcode != 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return (status);
+	}
+
+      /* Convert from lon/lat to meters or whatever unit is, i.e unit
+	 of r_major and r_minor) using GCTP */
+      /* ----------------------------------------- */
+      errorcode = for_trans[projcode] (lonrad, latrad, &xMtr1, &yMtr1);
+
+      /* Report error if any */
+      if (errorcode != 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return (status);
+	}
+
+      /* Compute x scale factor */
+      /* ---------------------- */
+      scaleX = (xMtr1 - xMtr0) / xdimsize;
+
+      /* Compute y scale factor */
+      /* ---------------------- */
+      scaleY = (yMtr1 - yMtr0) / ydimsize;
+
+      /* Initialize inverse transformation */
+      /* --------------------------------- */
+      inv_init(projcode, zonecode, projparm, spherecode, NULL, NULL, &errorcode, inv_trans);
+      /* Report error if any */
+      /* ------------------- */
+      if (errorcode != 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return (-1);
+	}
+      /* For each point ... */
+      /* ------------------ */
+      for (i = 0; i < npnts; i++)
+	{
+	  /* Convert from meters (or any units that r_major and
+	     r_minor has) to lon/lat (radians) using GCTP */
+	  /* --------------------------------------------------- */
+	  errorcode = inv_trans[projcode] (
+					   (col[i] + pixadjX) * scaleX + xMtr0,
+					   (row[i] + pixadjY) * scaleY + yMtr0,
+					   &lonrad, &latrad);
+
+	  /* Report error if any */
+	  /* ------------------- */
+	  if (errorcode != 0)
+	    {
+              /* status = -1;
+		 sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+		 H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+		 HE5_EHprint(errbuf, __FILE__, __LINE__);
+                 return (status); */
+	      longitude[i] = 1.0e51; /* PGSd_GCT_IN_ERROR */
+	      latitude[i] = 1.0e51; /* PGSd_GCT_IN_ERROR */
+	    }
+
+	  /* Convert from radians to decimal degrees */
+	  /* --------------------------------------- */
+	  longitude[i] = HE5_EHconvAng(lonrad, HE5_HDFE_RAD_DEG);
+	  latitude[i] = HE5_EHconvAng(latrad, HE5_HDFE_RAD_DEG);
+	}
+    }
+
+  else if (projcode == HE5_GCTP_GEO)
+    {
+      /* GEO projection */
+      /* -------------- */
+
+      /*
+       * Note: lonrad, lonrad0, latrad, latrad0 are actually in degrees for
+       * the GEO projection case.
+       */
+
+
+      /* Convert upleft and lowright X coords from DMS to degrees */
+      /* -------------------------------------------------------- */
+      lonrad0 = HE5_EHconvAng(upleftpt[0], HE5_HDFE_DMS_DEG);
+      lonrad  = HE5_EHconvAng(lowrightpt[0], HE5_HDFE_DMS_DEG);
+
+      /* Compute x scale factor */
+      /* ---------------------- */
+      scaleX = (lonrad - lonrad0) / xdimsize;
+
+      /* Convert upleft and lowright Y coords from DMS to degrees */
+      /* -------------------------------------------------------- */
+      latrad0 = HE5_EHconvAng(upleftpt[1], HE5_HDFE_DMS_DEG);
+      latrad  = HE5_EHconvAng(lowrightpt[1], HE5_HDFE_DMS_DEG);
+
+      /* Compute y scale factor */
+      /* ---------------------- */
+      scaleY = (latrad - latrad0) / ydimsize;
+
+      /* For each point ... */
+      /* ------------------ */
+      for (i = 0; i < npnts; i++)
+        {
+	  /* Convert to lon/lat (decimal degrees) */
+	  /* ------------------------------------ */
+	  longitude[i] = (col[i] + pixadjX) * scaleX + lonrad0;
+	  latitude[i]  = (row[i] + pixadjY) * scaleY + latrad0;
+        }
+    }
+
+  if (errbuf != NULL) free(errbuf);
+  
+ COMPLETION:
+  return (status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: GDrs2ll                                                          |
+|                                                                             |
+|  DESCRIPTION:  Converts EASE grid's (r,s) coordinates to longitude and      |
+|                latitude (in decimal degrees).                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         intn                return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  projcode       int                 GCTP projection code                    |
+|  projparm       double              Projection parameters                   |
+|  xdimsize       long                xdimsize from GDcreate                  |
+|  ydimsize       long                ydimsize from GDcreate                  |
+|  pixcen         int                 pixel center code                       |
+|  npnts          long                number of lon-lat points                |
+|  s              long                s coordinate                            |
+|  r              long                r coordinate                            |
+|  pixcen         int                 Code from GDpixreginfo                  |
+|  pixcnr         int                 Code from GDorigininfo                  |
+|  upleft         double              upper left corner coordinates (DMS)     |
+|  lowright       double              lower right corner coordinates (DMS)    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  longitude      double              longitude array (decimal degrees)       |
+|  latitude       double              latitude array  (decimal degrees)       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer    Description                                        |
+|  ======   ============   =================================================  |
+|  Dec 04   Adura Adekunjo Added function to  hdfeos5                         |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_GDrs2ll(int projcode, double projparm[],
+	    long xdimsize, long ydimsize,
+	    double upleft[], double lowright[],
+	    int npnts, double r[], double s[],
+	    double longitude[], double latitude[], int pixcen, int pixcnr)
+{
+  herr_t          status    = SUCCEED;/* routine return status variable      */
+  long            i;          /* Loop index */
+
+#if defined(SGI64) || defined(UNICOS) || defined(LINUX64) || defined(IA64) || defined(MACINTOSH) || defined(MACINTEL) || defined(IBM6000) || defined(CYGWIN) || defined(DEC_ALPHA)
+  int             (*inv_trans[100]) (double, double, double*, double*);
+  int           errorcode = 0;      /* GCTP error code */
+#else
+  long            (*inv_trans[100]) (double, double, double*, double*);
+  long           errorcode = 0;      /* GCTP error code */
+#endif
+
+  double          pixadjX;    /* Pixel adjustment (x) */
+  double          pixadjY;    /* Pixel adjustment (y) */
+  double          lonrad;     /* Longitude in radians of point */
+  double          latrad;     /* Latitude in radians of point */
+  double          HE5_EHconvAng(double, int);/* Angle conversion routine */
+  double          xMtr;       /* X value in meters from GCTP */
+  double          yMtr;       /* Y value in meters from GCTP */
+  double          epsilon;
+  double          beta;
+  double          qp_cea;
+  double          kz_cea;
+  double          eccen, eccen_sq;
+  double          phi1, sinphi1, cosphi1;
+  double          scaleX, scaleY;
+
+  int             zonecode=0;
+
+  int             spherecode=0;
+  double          lon[2],lat[2];
+  double          xcor[2], ycor[2];
+  int             nlatlon;
+
+  char            *errbuf;                /* buffer for error message             */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDrs2ll", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* If projection is BCEA define scale, r0 and s0 */
+  if (projcode == HE5_GCTP_BCEA)
+    {
+      eccen_sq = 1.0 - SQUARE(projparm[1]/projparm[0]);
+      eccen = sqrt(eccen_sq);
+      if(eccen < 0.00001)
+	{
+	  qp_cea = 2.0;
+	}
+      else
+	{
+	  qp_cea =
+	    (1.0 - eccen_sq)*((1.0/(1.0 - eccen_sq))-(1.0/(2.0*eccen))*
+			      log((1.0 - eccen)/(1.0 + eccen)));
+	}
+      phi1 = HE5_EHconvAng(projparm[5],HE5_HDFE_DMS_RAD);
+      cosphi1 = cos(phi1);
+      sinphi1 = sin(phi1);
+      kz_cea = cosphi1/(sqrt(1.0 - (eccen_sq*sinphi1*sinphi1)));
+    }
+    else /* fail for all other projections */
+      {
+	    sprintf(errbuf, "Error: HE5_GDrs2ll can be called only for HE5_GCTP_BCEA projection.");
+	    H5Epush(__FILE__, "HE5_GDrs2ll", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    return(FAIL);
+      }
+
+
+  /* Compute adjustment of position within pixel */
+  /* ------------------------------------------- */
+  if (pixcen == HE5_HDFE_CENTER)
+    {
+      /* Pixel defined at center */
+      /* ----------------------- */
+      pixadjX = 0.5;
+      pixadjY = 0.5;
+    }
+  else
+    {
+      switch (pixcnr)
+        {
+        case HE5_HDFE_GD_UL:
+	  {
+	    /* Pixel defined at upper left corner */
+	    /* ---------------------------------- */
+	    pixadjX = 0.0;
+	    pixadjY = 0.0;
+	    break;
+	  }
+
+        case HE5_HDFE_GD_UR:
+	  {
+	    /* Pixel defined at upper right corner */
+	    /* ----------------------------------- */
+	    pixadjX = 1.0;
+	    pixadjY = 0.0;
+	    break;
+	  }
+
+        case HE5_HDFE_GD_LL:
+	  {
+	    /* Pixel defined at lower left corner */
+	    /* ---------------------------------- */
+	    pixadjX = 0.0;
+	    pixadjY = 1.0;
+	    break;
+	  }
+	case HE5_HDFE_GD_LR:
+	  {
+	    /* Pixel defined at lower right corner */
+	    /* ----------------------------------- */
+	    pixadjX = 1.0;
+	    pixadjY = 1.0;
+	    break;
+	  }
+	default:
+	  {
+	    sprintf(errbuf, "Unknown pixel corner.\n");
+	    H5Epush(__FILE__, "HE5_GDrs2ll", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    return(FAIL);
+	  }
+	}
+    }
+
+  /* If projection is BCEA call GCTP initialization routine */
+  /* ------------------------------------------------------ */
+  if (projcode == HE5_GCTP_BCEA)
+    {
+       
+      inv_init(projcode, 0, projparm, 0, NULL, NULL, &errorcode, inv_trans);
+
+      /* Report error if any */
+      /* ------------------- */
+      if (errorcode != 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDrs2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(status); 
+        }
+      else
+        {
+	  /* For each point ... */
+	  /* ------------------ */
+          for (i = 0; i < npnts; i++)
+            {
+              /* Convert from EASE grid's (r,s) to lon/lat (radians)
+                 using GCTP */
+              /* --------------------------------------------------- */
+              nlatlon = 2;
+              lon[0] = upleft[0];
+              lon[1] = lowright[0];
+              lat[0] = upleft[1];
+              lat[1] = lowright[1];
+              status = HE5_GDll2mm_cea(projcode,zonecode,spherecode,projparm, xdimsize, ydimsize,
+				       upleft, lowright, nlatlon, lon, lat, xcor, ycor, &scaleX, &scaleY);
+              if (status == FAIL)
+		{
+		  sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+		  H5Epush(__FILE__, "HE5_GDrs2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  return(status);
+		}
+            
+	      xMtr = (r[i]/ scaleX + pixadjX - 0.5)* scaleX;
+	      yMtr = - (s[i]/fabs(scaleY) + pixadjY - 0.5)* fabs(scaleY);
+
+
+              /* allow .5 cell tolerance in arcsin function
+                 (used in bceainv function) so that grid
+                 coordinates which are less than .5 cells
+                 above 90.00N or below 90.00S are given lat of 90.00
+              */
+
+              epsilon = 1 + 0.5 * (fabs(scaleY)/projparm[0]);
+              beta = 2.0 * (yMtr - projparm[7]) * kz_cea/(projparm[0] * qp_cea);
+
+	      if( fabs (beta) > epsilon)
+                {
+                  status = FAIL;
+                  sprintf(errbuf, "GCTP Error:  %s %s %s\n", "grid coordinates",
+                          "are more than .5 cells", "above 90.00N or below 90.00S. ");  
+                  H5Epush(__FILE__, "HE5_GDrs2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  return(status);
+                }
+	      else if( beta <= -1)
+                {
+                  errorcode = inv_trans[projcode] (xMtr, 0.0,
+                                                   &lonrad, &latrad);
+                  latrad = - M_PI1/2;
+                }
+              else if( beta >= 1)
+                {
+                  errorcode = inv_trans[projcode] (xMtr, 0.0,
+                                                   &lonrad, &latrad);
+                  latrad = M_PI1/2;
+                }
+              else
+                {
+                  errorcode = inv_trans[projcode] (xMtr, yMtr,
+                                                   &lonrad, &latrad);
+                }
+          
+	      /* Report error if any */
+	      /* ------------------- */
+	      if (errorcode != 0)
+		{
+		  status = FAIL;
+		  sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+		  H5Epush(__FILE__, "HE5_GDrs2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  return (status);
+		}
+           
+	      /* Convert from radians to decimal degrees */
+	      /* --------------------------------------- */
+	      longitude[i] = HE5_EHconvAng(lonrad, HE5_HDFE_RAD_DEG);
+	      latitude[i] =  HE5_EHconvAng(latrad, HE5_HDFE_RAD_DEG);
+	    }
+        }
+    }
+  if (errbuf != NULL) free(errbuf);
+ 
+ COMPLETION:
+  return (status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_lamazDxDtheta                                                |
+|                                                                             |
+|  DESCRIPTION: Partial derivative along longitude line for Lambert Azimuthal |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                 double              Dx/D(theta) for LAMAZ projection        |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  parms          double              Parameters defining partial derivative  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+double 
+HE5_lamazDxDtheta(double  parms[])
+{
+  double  ans      = 0.;
+  double  snTheta  = 0.;
+  double  sn2Theta = 0.;
+  double  snTheta1 = 0.;
+  double  csTheta1 = 0.;
+  double  csLamda  = 0.;
+  
+  herr_t  status   = FAIL;
+
+  CHECKPOINTER(parms);
+
+  snTheta  = sin(HE5_EHconvAng(parms[0], HE5_HDFE_DEG_RAD));
+  sn2Theta = sin(2. * HE5_EHconvAng(parms[0], HE5_HDFE_DEG_RAD));
+  snTheta1 = sin(HE5_EHconvAng(parms[1], HE5_HDFE_DEG_RAD));
+  csTheta1 = cos(HE5_EHconvAng(parms[1], HE5_HDFE_DEG_RAD));
+  csLamda  = cos(HE5_EHconvAng(parms[2], HE5_HDFE_DEG_RAD) - HE5_EHconvAng(parms[3], HE5_HDFE_DEG_RAD));
+
+  ans = 4. * snTheta + (csTheta1 * csLamda * sn2Theta) + (2. * snTheta1 * (1. + (snTheta * snTheta)));
+  
+ COMPLETION:
+  return(ans); 
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_lamazDxDlamda                                                |
+|                                                                             |
+|  DESCRIPTION: Partial derivative along latitude line for Lambert Azimuthal  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                 double              Dx/D(lamda) for LAMAZ projection        |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  parms          double              Parameters defining partial derivative  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+double 
+HE5_lamazDxDlamda(double parms[])
+{
+  double   ans      = 0.;
+  double   snTheta  = 0.;
+  double   csTheta  = 0.;
+  double   snTheta1 = 0.;
+  double   csTheta1 = 0.;
+  double   csLamda  = 0.;
+  double   cs       = 0.; 
+  double   sn       = 0.;
+
+  herr_t   status   = FAIL;
+
+  CHECKPOINTER(parms);
+
+  snTheta  = sin(HE5_EHconvAng(parms[2], HE5_HDFE_DEG_RAD));
+  csTheta  = cos(HE5_EHconvAng(parms[2], HE5_HDFE_DEG_RAD));
+  snTheta1 = sin(HE5_EHconvAng(parms[1], HE5_HDFE_DEG_RAD));
+  csTheta1 = cos(HE5_EHconvAng(parms[1], HE5_HDFE_DEG_RAD));
+  csLamda  = cos(HE5_EHconvAng(parms[0], HE5_HDFE_DEG_RAD) - HE5_EHconvAng(parms[3], HE5_HDFE_DEG_RAD));
+  
+  cs = csTheta * csTheta1;
+  sn = snTheta * snTheta1;
+
+  ans = cs + (2. * (1. + sn) + (cs * csLamda)) * csLamda;
+
+ COMPLETION:
+  return(ans);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_lamazDyDtheta                                                |
+|                                                                             |
+|  DESCRIPTION: Partial derivative along longitude line for Lambert Azimuthal |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                 double              Dy/D(theta) for LAMAZ projection        |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  parms          double              Parameters defining partial derivative  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+double 
+HE5_lamazDyDtheta(double parms[])
+{
+  double  ans      = 0.;
+  double  snTheta  = 0.;
+  double  csTheta  = 0.;
+  double  snTheta1 = 0.;
+  double  csTheta1 = 0.;
+  double  csLamda  = 0.;
+  double  sn2      = 0.;
+  double  cs2      = 0.;
+  double  sndiff   = 0.;
+
+  herr_t  status   = FAIL; 
+ 
+  CHECKPOINTER(parms);
+
+  snTheta  = sin(HE5_EHconvAng(parms[0], HE5_HDFE_DEG_RAD));
+  csTheta  = cos(HE5_EHconvAng(parms[0], HE5_HDFE_DEG_RAD));
+  snTheta1 = sin(HE5_EHconvAng(parms[1], HE5_HDFE_DEG_RAD));
+  csTheta1 = cos(HE5_EHconvAng(parms[1], HE5_HDFE_DEG_RAD));
+  csLamda  = cos(HE5_EHconvAng(parms[2], HE5_HDFE_DEG_RAD) - HE5_EHconvAng(parms[3], HE5_HDFE_DEG_RAD));
+  
+  sn2    = snTheta1 * snTheta;
+  cs2    = csTheta1 * csTheta;
+  sndiff = snTheta1 - snTheta;
+
+  ans = cs2 * (sn2 * (1. + (csLamda * csLamda)) + 2.) + csLamda * (2. * (1. + sn2 * sn2) - (sndiff * sndiff));
+
+ COMPLETION:
+  return(ans);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_homDyDtheta                                                  |
+|                                                                             |
+|  DESCRIPTION: Partial derivative along longitude line for Oblique Mercator  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                 double              Dx/D(theta) for HOM projection          |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  parms          double              Parameters defining partial derivative  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+double 
+HE5_homDyDtheta(double parms[])
+{
+  double  ans      = 0.;
+  double  tnTheta  = 0.;
+  double  tnTheta1 = 0.;
+  double  snLamda  = 0.;
+
+  herr_t  status   = FAIL;
+
+  CHECKPOINTER(parms);
+
+  tnTheta  = tan(HE5_EHconvAng(parms[0], HE5_HDFE_DEG_RAD));
+  tnTheta1 = tan(HE5_EHconvAng(parms[1], HE5_HDFE_DEG_RAD));
+  snLamda  = cos(HE5_EHconvAng(parms[2], HE5_HDFE_DEG_RAD) - HE5_EHconvAng(parms[3], HE5_HDFE_DEG_RAD));
+
+  ans = tnTheta * snLamda + tnTheta1;
+
+ COMPLETION:
+  return(ans);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDtangentpnts                                                |
+|                                                                             |
+|  DESCRIPTION: Finds tangent points along lon/lat lines                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  projcode       int                 Projection code                         |
+|  projparm       double              Projection parameters                   |
+|  cornerlon      double   dec deg    Longitude of opposite corners of box    |
+|  cornerlat      double   dec deg    Latitude of opposite corners of box     |
+|  longitude      double   dec deg    Longitude of points to check            |
+|  latitude       double   dec deg    Latitude of points to check             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  npnts          long                Number of points to check in subset     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/24/99  A.Muslimov    Changed the return type from intn to int   .        |
+|  3/16/00  A.Muslimov    Added Abe Taaheri's update (MERCATOR and ALBERS     |
+|                         projections) from HDF-EOSv2.                        |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  May  04  S.Zhao        Added a case for GEO projections.                   |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t   
+HE5_GDtangentpnts(int projcode, double projparm[], double cornerlon[], double cornerlat[], double longitude[], double latitude[], long *npnts)
+{
+
+  herr_t          status       = FAIL;/* return status variable      */  
+  
+  int             i;                  /* Loop index                  */
+  
+  double          lonrad         = 0.;/* Longitude (radians)         */
+  double          latrad         = 0.;/* Latitude (radians)          */
+  double          cs[4]={0.,0.,0.,0.};/* Cosine array                */
+  double          sn[4]={0.,0.,0.,0.};/* Sine array                  */
+  double          csTest         = 0.;/* Cosine test value           */
+  double          snTest         = 0.;/* Sine test value             */
+  double          crs01          = 0.;/* Cross product               */
+  double          crsTest[2]= {0.,0.};/* Cross product array         */
+  double          longPol        = 0.;/* Longitude beneath pole      */
+  double          minLat         = 0.;/* Minimum latitude            */
+  double          bisectParm[4]={0.,0.,0.,0.};/* Bisection parms     */
+  double          tanLat         = 0.;/* Tangent latitude            */
+  double          tanLon         = 0.;/* Tangent lontitude           */
+  double          dotPrd         = 0.;/* Dot product                 */
+  double          centMerd       = 0.;/* Central Meridian            */
+  double          orgLat         = 0.;/* Latitude of origin          */
+  double          dpi            = 0.;/* Double precision pi         */
+  double          HE5_lamazDxDtheta(double *);/* Lambert Azimuthal Dx/Dtheta */
+  double          HE5_lamazDxDlamda(double *);/* Lambert Azimuthal Dx/Dlamda */
+  double          HE5_lamazDyDtheta(double *);/* Lambert Azimuthal Dy/Dtheta */
+  double          HE5_homDyDtheta(double *);  /* Oblique Mercator  Dy/Dtheta */
+  
+  char            *errbuf;            /* Buffer for error message    */
+ 
+  CHECKPOINTER(projparm);
+  CHECKPOINTER(cornerlon);
+  CHECKPOINTER(cornerlat);
+  CHECKPOINTER(longitude);
+  CHECKPOINTER(latitude);
+ 
+  /* Allocate memory for error message buffer */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDtangentpnts", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Conpute pi (double precsion) */
+  /* ---------------------------- */
+  dpi = atan(1.) * 4.;
+  
+  switch (projcode)
+    {
+
+    case HE5_GCTP_GEO:
+      {
+	/* No need for tangent points, since GEO projection is rectangular */
+      }
+      break;
+
+    case HE5_GCTP_MERCAT:
+      {
+	/* No need for tangent points, since MERCAT projection is rectangular */
+      }
+      break;
+    case HE5_GCTP_BCEA:
+      {
+	/* No need for tangent points, since BCEA projection
+	   is rectangular */
+      }
+      break;
+    case HE5_GCTP_CEA:
+      {
+	/* No need for tangent points, since CEA projection
+	   is rectangular */
+      }
+      break;
+    case HE5_GCTP_PS:
+      {
+	/* Add "xy axis" points for Polar Stereographic if necessary */
+	/* --------------------------------------------------------- */
+
+
+	/* Get minimum of corner latitudes */
+	/* ------------------------------- */
+	minLat = (fabs(cornerlat[0]) <= fabs(cornerlat[1])) ? cornerlat[0] : cornerlat[1];
+
+
+	/* Compute sine and cosine of corner longitudes */
+	/* -------------------------------------------- */
+	for (i = 0; i < 2; i++)
+	  {
+	    lonrad = HE5_EHconvAng(cornerlon[i], HE5_HDFE_DEG_RAD);
+	    cs[i]  = cos(lonrad);
+	    sn[i]  = sin(lonrad);
+	  }
+
+
+	/* Compute cross product */
+	/* --------------------- */
+	crs01 = cs[0] * sn[1] - cs[1] * sn[0];
+
+
+	/* Convert longitude beneath pole from DMS to DEG */
+	/* ---------------------------------------------- */
+	longPol = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_RAD);
+
+
+
+	for (i = 0; i < 4; i++)
+	  {
+	    csTest = cos(longPol);
+	    snTest = sin(longPol);
+
+	    crsTest[0] = cs[0] * snTest - csTest * sn[0];
+	    crsTest[1] = cs[1] * snTest - csTest * sn[1];
+
+	    if ((crs01 > 0 && crsTest[0] > 0 && crsTest[1] < 0) ||
+		(crs01 < 0 && crsTest[0] < 0 && crsTest[1] < 0) ||
+		(crs01 < 0 && crsTest[0] > 0 && crsTest[1] < 0) ||
+		(crs01 < 0 && crsTest[0] > 0 && crsTest[1] > 0))
+	      {
+		longitude[*npnts] = HE5_EHconvAng(longPol, HE5_HDFE_RAD_DEG);
+		latitude[*npnts] = minLat;
+		(*npnts)++;
+	      }
+	    longPol += 0.5 * dpi;
+	  }
+      }
+      break;
+
+
+    case HE5_GCTP_LAMAZ:
+      {
+	if ((long)projparm[5] == +90000000 || (long)projparm[5] == -90000000)
+	  {
+	    /* Add "xy axis" points for Polar Lambert Azimuthal */
+	    /* ------------------------------------------------ */
+	    minLat = (fabs(cornerlat[0]) <= fabs(cornerlat[1]))
+	      ? cornerlat[0] : cornerlat[1];
+
+	    for (i = 0; i < 2; i++)
+	      {
+		lonrad = HE5_EHconvAng(cornerlon[i], HE5_HDFE_DEG_RAD);
+		cs[i]  = cos(lonrad);
+		sn[i]  = sin(lonrad);
+	      }
+	    crs01 = cs[0] * sn[1] - cs[1] * sn[0];
+
+	    longPol = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_RAD);
+	    for (i = 0; i < 4; i++)
+	      {
+		csTest = cos(longPol);
+		snTest = sin(longPol);
+
+		crsTest[0] = cs[0] * snTest - csTest * sn[0];
+		crsTest[1] = cs[1] * snTest - csTest * sn[1];
+
+		if ((crs01 > 0 && crsTest[0] > 0 && crsTest[1] < 0) ||
+		    (crs01 < 0 && crsTest[0] < 0 && crsTest[1] < 0) ||
+		    (crs01 < 0 && crsTest[0] > 0 && crsTest[1] < 0) ||
+		    (crs01 < 0 && crsTest[0] > 0 && crsTest[1] > 0))
+		  {
+		    longitude[*npnts] = HE5_EHconvAng(longPol, HE5_HDFE_RAD_DEG);
+		    latitude[*npnts] = minLat;
+		    (*npnts)++;
+		  }
+		longPol += 0.5 * dpi;
+	      }
+	  }
+	else if ((long)projparm[5] == 0)
+	  {
+	    /* Add "Equator" points for Equatorial Lambert Azimuthal */
+	    /* ----------------------------------------------------- */
+	    if (cornerlat[0] * cornerlat[1] < 0)
+	      {
+		longitude[4] = cornerlon[0];
+		latitude[4] = 0;
+
+		longitude[5] = cornerlon[1];
+		latitude[5] = 0;
+
+		*npnts = 6;
+	      }
+	  }
+	else
+	  {
+	    /* Add tangent points for Oblique Lambert Azimuthal */
+	    /* ------------------------------------------------ */
+	    bisectParm[0] = HE5_EHconvAng(projparm[5], HE5_HDFE_DMS_DEG);
+	    bisectParm[2] = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG);
+
+	    /* Tangent to y-axis along longitude */
+	    /* --------------------------------- */
+	    for (i = 0; i < 2; i++)
+	      {
+		bisectParm[1] = cornerlon[i];
+
+		if (HE5_EHbisect(HE5_lamazDxDtheta, bisectParm, 3, cornerlat[0], cornerlat[1], 0.0001, &tanLat) == 0)
+		  {
+		    longitude[*npnts] = cornerlon[i];
+		    latitude[*npnts] = tanLat;
+		    (*npnts)++;
+		  }
+	      }
+
+	    /* Tangent to y-axis along latitude */
+	    /* -------------------------------- */
+	    for (i = 0; i < 2; i++)
+	      {
+		bisectParm[1] = cornerlat[i];
+
+		if (HE5_EHbisect(HE5_lamazDxDlamda, bisectParm, 3, cornerlon[0], cornerlon[1], 0.0001, &tanLon) == 0)
+		  {
+		    longitude[*npnts] = tanLon;
+		    latitude[*npnts] = cornerlat[i];
+		    (*npnts)++;
+		  }
+	      }
+
+
+	    /* Tangent to x-axis along longitude */
+	    /* --------------------------------- */
+	    for (i = 0; i < 2; i++)
+	      {
+		bisectParm[1] = cornerlon[i];
+
+		if (HE5_EHbisect(HE5_lamazDyDtheta, bisectParm, 3, cornerlat[0], cornerlat[1],  0.0001, &tanLat) == 0)
+		  {
+		    longitude[*npnts] = cornerlon[i];
+		    latitude[*npnts] = tanLat;
+		    (*npnts)++;
+		  }
+	      }
+
+	    /* Tangent to x-axis along latitude */
+	    /* -------------------------------- */
+	    for (i = 0; i < 2; i++)
+	      {
+		lonrad = HE5_EHconvAng(cornerlon[i], HE5_HDFE_DEG_RAD);
+		cs[i]  = cos(lonrad);
+		sn[i]  = sin(lonrad);
+	      }
+	    crs01 = cs[0] * sn[1] - cs[1] * sn[0];
+
+	    longPol = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_RAD);
+	    for (i = 0; i < 2; i++)
+	      {
+		csTest = cos(longPol);
+		snTest = sin(longPol);
+
+		crsTest[0] = cs[0] * snTest - csTest * sn[0];
+		crsTest[1] = cs[1] * snTest - csTest * sn[1];
+
+		if ((crs01 > 0 && crsTest[0] > 0 && crsTest[1] < 0) ||
+		    (crs01 < 0 && crsTest[0] < 0 && crsTest[1] < 0) ||
+		    (crs01 < 0 && crsTest[0] > 0 && crsTest[1] < 0) ||
+		    (crs01 < 0 && crsTest[0] > 0 && crsTest[1] > 0))
+		  {
+		    longitude[*npnts] = HE5_EHconvAng(longPol, HE5_HDFE_RAD_DEG);
+		    latitude[*npnts]  = cornerlat[0];
+		    (*npnts)++;
+		    longitude[*npnts] = HE5_EHconvAng(longPol, HE5_HDFE_RAD_DEG);
+		    latitude[*npnts]  = cornerlat[1];
+		    (*npnts)++;
+		  }
+		longPol += dpi;
+	      }
+	  }
+      }
+      break;
+
+
+    case HE5_GCTP_GOOD:
+      {
+	/* Add "Equator" points for Goode Homolosine if necessary */
+	/* ------------------------------------------------------ */
+	if (cornerlat[0] * cornerlat[1] < 0)
+	  {
+	    longitude[4] = cornerlon[0];
+	    latitude[4] = 0;
+
+	    longitude[5] = cornerlon[1];
+	    latitude[5] = 0;
+
+	    *npnts = 6;
+	  }
+      }
+      break;
+
+
+
+    case HE5_GCTP_LAMCC:
+      {
+	/* Compute sine and cosine of corner longitudes */
+	/* -------------------------------------------- */
+	for (i = 0; i < 2; i++)
+	  {
+	    lonrad = HE5_EHconvAng(cornerlon[i], HE5_HDFE_DEG_RAD);
+	    cs[i] = cos(lonrad);
+	    sn[i] = sin(lonrad);
+	  }
+
+
+	/* Compute dot product */
+	/* ------------------- */
+	dotPrd = cs[0] * cs[1] + sn[0] * sn[1];
+
+
+	/* Convert central meridian (DMS to DEG) & compute sin & cos */
+	/* --------------------------------------------------------- */
+	centMerd = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG);
+	lonrad   = HE5_EHconvAng(centMerd, HE5_HDFE_DEG_RAD);
+	cs[1]    = cos(lonrad);
+	sn[1]    = sin(lonrad);
+
+
+	/* If box brackets central meridian ... */
+	/* ------------------------------------ */
+	if (cs[0] * cs[1] + sn[0] * sn[1] > dotPrd)
+	  {
+	    latitude[4]  = cornerlat[0];
+	    longitude[4] = centMerd;
+
+	    latitude[5]  = cornerlat[1];
+	    longitude[5] = centMerd;
+
+	    *npnts = 6;
+	  }
+      }
+      break;
+
+
+    case HE5_GCTP_ALBERS:
+      {
+	/* Compute sine and cosine of corner longitudes */
+	/* -------------------------------------------- */
+	for (i = 0; i < 2; i++)
+	  {
+	    lonrad = HE5_EHconvAng(cornerlon[i], HE5_HDFE_DEG_RAD);
+	    cs[i]  = cos(lonrad);
+	    sn[i]  = sin(lonrad);
+	  }
+
+
+	/* Compute dot product */
+	/* ------------------- */
+	dotPrd = cs[0] * cs[1] + sn[0] * sn[1];
+
+
+	/* Convert central meridian (DMS to DEG) & compute sin & cos */
+	/* --------------------------------------------------------- */
+	centMerd = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG);
+	lonrad   = HE5_EHconvAng(centMerd, HE5_HDFE_DEG_RAD);
+	cs[1]    = cos(lonrad);
+	sn[1]    = sin(lonrad);
+
+
+	/* If box brackets central meridian ... */
+	/* ------------------------------------ */
+	if (cs[0] * cs[1] + sn[0] * sn[1] > dotPrd)
+	  {
+	    latitude[4]  = cornerlat[0];
+	    longitude[4] = centMerd;
+
+	    latitude[5]  = cornerlat[1];
+	    longitude[5] = centMerd;
+
+	    *npnts = 6;
+	  }
+      }
+      break;
+
+
+    case HE5_GCTP_POLYC:
+      {
+	/* Compute sine and cosine of corner longitudes */
+	/* -------------------------------------------- */
+	for (i = 0; i < 2; i++)
+	  {
+	    lonrad = HE5_EHconvAng(cornerlon[i], HE5_HDFE_DEG_RAD);
+	    cs[i]  = cos(lonrad);
+	    sn[i]  = sin(lonrad);
+	  }
+
+
+	/* Compute dot product */
+	/* ------------------- */
+	dotPrd = cs[0] * cs[1] + sn[0] * sn[1];
+
+
+	/* Convert central meridian (DMS to DEG) & compute sin & cos */
+	/* --------------------------------------------------------- */
+	centMerd = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG);
+	lonrad   = HE5_EHconvAng(centMerd, HE5_HDFE_DEG_RAD);
+	cs[1] = cos(lonrad);
+	sn[1] = sin(lonrad);
+
+
+	/* If box brackets central meridian ... */
+	/* ------------------------------------ */
+	if (cs[0] * cs[1] + sn[0] * sn[1] > dotPrd)
+	  {
+	    latitude[4]  = cornerlat[0];
+	    longitude[4] = centMerd;
+
+	    latitude[5]  = cornerlat[1];
+	    longitude[5] = centMerd;
+	    *npnts       = 6;
+	  }
+      }
+      break;
+
+
+    case HE5_GCTP_TM:
+      {
+	/* Compute sine and cosine of corner longitudes */
+	/* -------------------------------------------- */
+	for (i = 0; i < 2; i++)
+	  {
+	    lonrad = HE5_EHconvAng(cornerlon[i], HE5_HDFE_DEG_RAD);
+	    cs[i]  = cos(lonrad);
+	    sn[i]  = sin(lonrad);
+	  }
+
+
+	/* Compute dot product */
+	/* ------------------- */
+	dotPrd = cs[0] * cs[1] + sn[0] * sn[1];
+
+
+	for (i = -1; i <= 1; i++)
+	  {
+	    centMerd = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG);
+	    lonrad   = HE5_EHconvAng(centMerd + 90 * i, HE5_HDFE_DEG_RAD);
+	    csTest   = cos(lonrad);
+	    snTest   = sin(lonrad);
+
+
+	    /* If box brackets meridian ... */
+	    /* ---------------------------- */
+	    if (csTest * cs[1] + snTest * sn[1] > dotPrd)
+	      {
+		latitude[*npnts]  = cornerlat[0];
+		longitude[*npnts] = centMerd;
+		(*npnts)++;
+
+		latitude[*npnts]  = cornerlat[1];
+		longitude[*npnts] = centMerd;
+		(*npnts)++;
+	      }
+	  }
+
+
+
+	/* Compute sine and cosine of corner latitudes */
+	/* ------------------------------------------- */
+	for (i = 0; i < 2; i++)
+	  {
+	    latrad = HE5_EHconvAng(cornerlat[i], HE5_HDFE_DEG_RAD);
+	    cs[i]  = cos(latrad);
+	    sn[i]  = sin(latrad);
+	  }
+
+	/* Compute dot product */
+	/* ------------------- */
+	dotPrd = cs[0] * cs[1] + sn[0] * sn[1];
+
+
+	/* Convert origin latitude (DMS to DEG) & compute sin & cos */
+	/* -------------------------------------------------------- */
+	orgLat = HE5_EHconvAng(projparm[5], HE5_HDFE_DMS_DEG);
+	latrad = HE5_EHconvAng(orgLat, HE5_HDFE_DEG_RAD);
+	cs[1]  = cos(latrad);
+	sn[1]  = sin(latrad);
+
+
+	/* If box brackets origin latitude ... */
+	/* ----------------------------------- */
+	if (cs[0] * cs[1] + sn[0] * sn[1] > dotPrd)
+	  {
+	    latitude[*npnts]  = orgLat;
+	    longitude[*npnts] = cornerlon[0];
+	    (*npnts)++;
+
+	    latitude[*npnts] = orgLat;
+	    longitude[*npnts] = cornerlon[1];
+	    (*npnts)++;
+	  }
+      }
+      break;
+
+
+    case HE5_GCTP_HOM:
+      {
+	/* Tangent to y-axis along longitude */
+	/* --------------------------------- */
+	if (projparm[12] == 0)
+	  {
+	    cs[0] = cos(HE5_EHconvAng(projparm[8],  HE5_HDFE_DMS_RAD));
+	    sn[0] = sin(HE5_EHconvAng(projparm[8],  HE5_HDFE_DMS_RAD));
+	    cs[1] = cos(HE5_EHconvAng(projparm[9],  HE5_HDFE_DMS_RAD));
+	    sn[1] = sin(HE5_EHconvAng(projparm[9],  HE5_HDFE_DMS_RAD));
+	    cs[2] = cos(HE5_EHconvAng(projparm[10], HE5_HDFE_DMS_RAD));
+	    sn[2] = sin(HE5_EHconvAng(projparm[10], HE5_HDFE_DMS_RAD));
+	    cs[3] = cos(HE5_EHconvAng(projparm[11], HE5_HDFE_DMS_RAD));
+	    sn[3] = sin(HE5_EHconvAng(projparm[11], HE5_HDFE_DMS_RAD));
+
+	    bisectParm[2] = atan2(
+				  (cs[1] * sn[3] * cs[0] - sn[1] * cs[3] * cs[2]),
+				  (sn[1] * cs[3] * sn[2] - cs[1] * sn[3] * sn[0]));
+	    bisectParm[0] = atan(
+				 (sin(bisectParm[3]) * sn[0] - cos(bisectParm[3]) * cs[0]) /
+				 (sn[1] / cs[1]));
+	    bisectParm[2] = bisectParm[3] + 0.5 * dpi;
+	  }
+	else
+	  {
+	    cs[0] = cos(HE5_EHconvAng(projparm[3], HE5_HDFE_DMS_RAD));
+	    sn[0] = sin(HE5_EHconvAng(projparm[3], HE5_HDFE_DMS_RAD));
+	    cs[1] = cos(HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_RAD));
+	    sn[1] = sin(HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_RAD));
+
+	    bisectParm[0] = asin(cs[1] * sn[0]);
+	    bisectParm[2] = atan2(-cs[0], (-sn[1] * sn[0])) + 0.5 * dpi;
+	  }
+
+	for (i = 0; i < 2; i++)
+	  {
+	    bisectParm[1] = cornerlon[i];
+
+	    if (HE5_EHbisect(HE5_homDyDtheta, bisectParm, 3, cornerlat[0], cornerlat[1],  0.0001, &tanLat) == 0)
+	      {
+		longitude[*npnts] = cornerlon[i];
+		latitude[*npnts] = tanLat;
+		(*npnts)++;
+	      }
+	  }
+
+      }
+      break;
+
+    default:
+      {
+	if(projcode != HE5_GCTP_UTM)
+	  {
+	    status = FAIL;
+	    H5Epush(__FILE__, "HE5_GDtangentpnts", __LINE__, H5E_ARGS, H5E_BADVALUE, "Unknown projection code.");
+	    HE5_EHprint("Error: Unknown projection code, occured", __FILE__, __LINE__);
+	  }
+      }
+      break;
+	  
+    }
+  
+
+  free(errbuf);
+
+ COMPLETION:  
+  return (status);
+}
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefboxregion                                               |
+|                                                                             |
+|  DESCRIPTION: Defines region for subsetting in a grid.                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  regionID       hid_t   None        Region ID                               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               Grid structure ID                       |
+|  cornerlon      double   dec deg    Longitude of opposite corners of box    |
+|  cornerlat      double   dec deg    Latitude of opposite corners of box     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/22/99  A.Muslimov    Changed the type of return value from intn to hid_t.|
+|                         Added error handling after the function calls.      |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t
+HE5_GDdefboxregion(hid_t gridID, double cornerlon[], double cornerlat[])
+{
+
+  hid_t           regionID = FAIL;/* Region ID (return value)                */
+  hid_t           fid      = FAIL;/* HDF-EOS file ID                         */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID                       */
+  hid_t           i;		  /* Loop index                              */
+
+  herr_t          status   = FAIL;/* routine return status variable          */
+
+  int             j;		  /* Loop index                              */
+  int             projcode = FAIL;/* Projection code                         */
+  int             zonecode = FAIL;/* Zone code                               */
+  int             spherecode=FAIL;/* Sphere code                             */
+
+  long            idx      = FAIL;/* Grid index                              */
+  long            xdimsize = 0;	  /* XDim size                               */
+  long            ydimsize = 0;	  /* YDim size                               */
+  long            row[32];	  /* Row array                               */
+  long            col[32];	  /* Column array                            */
+  long            minCol    = 0;  /* Minimun column value                    */
+  long            minRow    = 0;  /* Minimun row value                       */
+  long            maxCol    = 0;  /* Maximun column value                    */
+  long            maxRow    = 0;  /* Maximun row value                       */
+  long            npnts     = 4;  /* No. of boundary (edge & tangent) pnts   */
+
+  double          longitude[32];  /* Longitude array                         */
+  double          latitude[32];	  /* Latitude array                          */
+  double          upleftpt[2]={0.,0.};	/* Upper left pt coordinates         */
+  double          lowrightpt[2]={0.,0.};/* Lower right pt coordinates        */
+  double          projparm[16];	  /* Projection parameters                   */
+  double          xscale    = 0.0;/* X scale                                 */
+  double          yscale    = 0.0;/* Y scale                                 */
+  double          lonrad0   = 0.0;/* Longitude of upper left point (radians) */
+  double          latrad0   = 0.0;/* Latitude of upper left point (radians)  */
+  double          lonrad2   = 0.0;/* Longitude of point (radians)            */
+  double          latrad2   = 0.0;/* Latitude of point (radians)             */
+  double	  lon[2], lat[2];
+  double	  xcor[2], ycor[2];
+  double	  upleftpt_m[2];
+  double          xmtr[2], ymtr[2];
+  int             nlatlon;
+
+  /* Used for SOM projection  */
+  long            blockindexstart = -1;
+  long            blockindexstop = -1;
+  double          offset[180];
+
+  char            *errbuf=(char *)NULL;    /* Buffer for error message */
+ 
+  HE5_LOCK;
+  CHECKPOINTER(cornerlat);
+  CHECKPOINTER(cornerlon);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDdefboxregion", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+	
+  /* Get grid info */
+  /* ------------- */
+  status = HE5_GDgridinfo(gridID, &xdimsize, &ydimsize, upleftpt, lowrightpt);
+  if (status == FAIL)
+    {
+      regionID = FAIL;
+      sprintf(errbuf,  "Failed to get grid information.\n" );
+      H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	    
+      return (regionID);
+    }
+  
+  /* Make sure that xdimsize or ydimsize != 0 */
+  /* ---------------------------------------- */
+  if ( xdimsize == 0 || ydimsize == 0)
+    {
+      regionID = FAIL;
+      sprintf(errbuf,  "Zero values of \"xdimsize\" and \"ydimsize\".\n" );
+      H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	    
+      return (regionID);
+    }
+
+  /* Initialize projparm[] array */
+  /* --------------------------- */
+  for (j = 0; j < 16; j++)
+    projparm[ j ] = 0.;
+
+  /* Get proj info */
+  /* ------------- */
+  status = HE5_GDprojinfo(gridID, &projcode, &zonecode, &spherecode, projparm);
+  /* If no projection code defined then bail */
+  /* --------------------------------------- */
+  if (projcode == FAIL)
+    {
+      regionID = FAIL;
+      sprintf(errbuf,"No projection code is defined.\n" ); 
+      H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return (regionID);
+    }
+	
+
+  /* Get default values for upleft and lowright if necessary */
+  /* ------------------------------------------------------- */
+  if (upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0)
+    {
+      status = HE5_GDgetdefaults(projcode, zonecode, projparm, spherecode, upleftpt, lowrightpt);
+      if (status == FAIL)
+	{
+	  regionID = FAIL;
+	  sprintf(errbuf,"Failed to get default values for uplft and lowrght points.\n" );
+	  H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+			
+	  return (regionID);
+	}
+    }
+
+
+  /* Fill-up longitude and latitude arrays */
+  /* ------------------------------------- */
+  longitude[0] = cornerlon[0];
+  latitude[0]  = cornerlat[0];
+	
+  longitude[1] = cornerlon[0];
+  latitude[1]  = cornerlat[1];
+	
+  longitude[2] = cornerlon[1];
+  latitude[2]  = cornerlat[0];
+
+  longitude[3] = cornerlon[1];
+  latitude[3]  = cornerlat[1];
+
+
+  /* Find additional tangent points from GDtangentpnts */
+  /* ------------------------------------------------- */
+  status = HE5_GDtangentpnts(projcode, projparm, cornerlon, cornerlat, longitude, latitude, &npnts);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Failed to find additional tangent points.\n" );
+      H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	    
+      return(FAIL);
+    }
+	
+	
+  /* Initialize row[]/col[] arrays */
+  /* ----------------------------- */
+  for (j = 0; j < 32; j++)
+    {
+      row[j] = 0;
+      col[j] = 0;
+    }
+
+
+  /* Convert from lon/lat to row/col */
+  /* ------------------------------- */
+  status = HE5_GDll2ij(projcode, zonecode, projparm, spherecode,xdimsize, ydimsize, upleftpt, lowrightpt,npnts, longitude, latitude, row, col, NULL, NULL);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot convert from lon/lat to row/col.\n" );
+      H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	    
+      return(FAIL);
+    }
+	
+
+  /* Find min/max values for row & col */
+  /* --------------------------------- */
+  minCol = col[0];
+  minRow = row[0];
+  maxCol = col[0];
+  maxRow = row[0];
+
+  for (i = 1; i < npnts; i++)
+    {
+      if (col[i] < minCol)
+	{
+	  minCol = col[i];
+	}
+
+      if (col[i] > maxCol)
+	{
+	  maxCol = col[i];
+	}
+		
+      if (row[i] < minRow)
+	{
+	  minRow = row[i];
+	}
+		
+      if (row[i] > maxRow)
+	{
+	  maxRow = row[i];
+	}
+    }
+	
+
+  /* "Clamp" if outside Grid */
+  /* ----------------------- */
+  minCol = (minCol < 0) ? 0 : minCol;
+  minRow = (minRow < 0) ? 0 : minRow;
+	
+  maxCol = (maxCol >= xdimsize) ? xdimsize - 1 : maxCol;
+  maxRow = (maxRow >= ydimsize) ? ydimsize - 1 : maxRow;
+
+	
+  /* Check whether subset region is outside grid region */
+  /* -------------------------------------------------- */
+  if (minCol >= xdimsize || minRow >= ydimsize || maxCol < 0 || maxRow < 0 )
+    {
+      regionID = FAIL;
+      sprintf(errbuf, "Subset Region outside of Grid Region.");
+      H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	    
+      return(regionID);
+    }
+  else
+    {
+      /* Store grid region info */
+      /* ---------------------- */
+      for (i = 0; i < HE5_NGRIDREGN; i++)
+	{
+	  /* Find first empty grid region */
+	  /* ---------------------------- */
+	  if (HE5_GDXRegion[i] == 0)
+	    {
+	      /* Allocate space for grid region entry */
+	      /* ------------------------------------ */
+	      HE5_GDXRegion[i] = (struct HE5_gridRegion *)calloc(1, sizeof(struct HE5_gridRegion));
+	      if(HE5_GDXRegion[i] == NULL)
+		{
+		  regionID = FAIL;
+		  sprintf(errbuf, "Cannot allocate memory.\n");
+		  H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+					
+		  return(regionID);
+		}
+				
+				
+	      /* Store file and grid ID */
+	      /* ---------------------- */
+	      HE5_GDXRegion[i]->fid    = fid;
+	      HE5_GDXRegion[i]->gridID = gridID;
+				
+				
+	      /* Initialize vertical subset entries to FAIL */
+	      /* ------------------------------------------ */
+	      for (j = 0; j < HE5_DTSETRANKMAX; j++)
+		{
+		  HE5_GDXRegion[ i ]->StartVertical[j] = FAIL;
+		  HE5_GDXRegion[ i ]->StopVertical[j]  = FAIL;
+		}
+				
+
+	      /* Store start & count along x & y */
+	      /* ------------------------------- */
+	      HE5_GDXRegion[ i ]->xStart = minCol;
+	      HE5_GDXRegion[ i ]->xCount = maxCol - minCol + 1;
+	      HE5_GDXRegion[ i ]->yStart = minRow;
+	      HE5_GDXRegion[ i ]->yCount = maxRow - minRow + 1;
+				
+	      /* Store upleft and lowright points of subset region */
+	      /* ------------------------------------------------- */
+	      if (projcode == HE5_GCTP_GEO)
+		{
+		  /* GEO projection */
+		  /* -------------- */
+
+		  /* Convert upleft & lowright lon from DMS to radians */
+		  /* ------------------------------------------------- */
+		  lonrad0 = HE5_EHconvAng(upleftpt[0], HE5_HDFE_DMS_RAD);
+		  lonrad2 = HE5_EHconvAng(lowrightpt[0], HE5_HDFE_DMS_RAD);
+					
+		  /* Compute X scale */
+		  /* --------------- */
+		  xscale = (lonrad2 - lonrad0) / xdimsize;
+					
+		  /* Convert upleft & lowright lat from DMS to radians */
+		  /* ------------------------------------------------- */
+		  latrad0 = HE5_EHconvAng(upleftpt[1], HE5_HDFE_DMS_RAD);
+		  latrad2 = HE5_EHconvAng(lowrightpt[1], HE5_HDFE_DMS_RAD);
+					
+		  /* Compute Y scale */
+		  /* --------------- */
+		  yscale = (latrad2 - latrad0) / ydimsize;
+					
+
+		  /* MinCol -> radians -> DMS -> upleftpt[0] */
+		  /* --------------------------------------- */
+		  HE5_GDXRegion[i]->upleftpt[0] = HE5_EHconvAng(lonrad0 + xscale * minCol, HE5_HDFE_RAD_DMS);
+					
+		  /* MinRow -> radians -> DMS -> upleftpt[1] */
+		  /* --------------------------------------- */
+		  HE5_GDXRegion[i]->upleftpt[1] = HE5_EHconvAng(latrad0 + yscale * minRow, HE5_HDFE_RAD_DMS);
+
+					
+		  /* MinCol + 1 -> radians -> DMS -> lowrightpt[0] */
+		  /* --------------------------------------------- */
+		  HE5_GDXRegion[i]->lowrightpt[0] = HE5_EHconvAng(lonrad0 + xscale * (maxCol + 1), HE5_HDFE_RAD_DMS);
+				  
+					
+		  /* MinRow + 1 -> radians -> DMS -> lowrightpt[1] */
+		  /* --------------------------------------------- */
+		  HE5_GDXRegion[i]->lowrightpt[1] = HE5_EHconvAng(latrad0 + yscale * (maxRow + 1), HE5_HDFE_RAD_DMS);
+		}
+	      else if (projcode == HE5_GCTP_BCEA)
+		{
+		  /* BCEA projection */
+		  /* -------------- */
+		  nlatlon = 2;
+		  lon[0] = upleftpt[0];
+		  lon[1] = lowrightpt[0];
+		  lat[0] = upleftpt[1];
+		  lat[1] = lowrightpt[1];
+		  status =
+		    HE5_GDll2mm_cea(projcode,zonecode,spherecode,projparm,
+				    xdimsize, ydimsize,upleftpt, lowrightpt,nlatlon,
+				    lon, lat, xcor, ycor, &xscale, &yscale);
+		  upleftpt_m[0] = xcor[0];
+		  upleftpt_m[1] = ycor[0];
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Error converting .");
+		      H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(errbuf);
+		      return(FAIL);
+		    }
+  
+		  /* MinCol -> meters -> upleftpt[0] */
+		  /* ------------------------------- */
+		  xmtr[0] = upleftpt_m[0] + xscale * minCol;
+  
+		  /* MinRow -> meters -> upleftpt[1] */
+		  /* ------------------------------- */
+		  ymtr[0] = upleftpt_m[1] + yscale * minRow;
+
+		  /* MinCol + 1 -> meters -> lowrightpt[0] */
+		  /* ------------------------------------- */
+		  xmtr[1] = upleftpt_m[0] + xscale * (maxCol + 1);
+  
+		  /* MinRow + 1 -> meters -> lowrightpt[1] */
+		  /* ------------------------------------- */
+		  ymtr[1] = upleftpt_m[1] + yscale * (maxRow + 1);
+ 
+		  /* Convert upleft & lowright lon from DMS to radians */
+		  /* ------------------------------------------------- */
+		  npnts = 2;
+		  status = HE5_GDmm2ll_cea(projcode, zonecode, spherecode,
+					   projparm, xdimsize, ydimsize,
+					   upleftpt, lowrightpt, npnts,
+					   xmtr,  ymtr,
+					   longitude, latitude);
+		  if (status == -1)
+		    {
+		      sprintf(errbuf, "Subsetting failed "); 
+		      H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(errbuf);
+		      return (status);
+		    }
+		  HE5_GDXRegion[i]->upleftpt[0] = longitude[0];
+  
+		  HE5_GDXRegion[i]->upleftpt[1] = latitude[0];
+ 
+		  HE5_GDXRegion[i]->lowrightpt[0] = longitude[1];
+
+		  HE5_GDXRegion[i]->lowrightpt[1] = latitude[1];
+		}
+	      else if (projcode == HE5_GCTP_SOM)
+		{
+		  /* Store start & count along x & y */
+		  /* ------------------------------- */
+		  HE5_GDXRegion[i]->xStart = 0;
+		  HE5_GDXRegion[i]->xCount = xdimsize;
+		  HE5_GDXRegion[i]->yStart = 0;
+		  HE5_GDXRegion[i]->yCount = ydimsize;
+ 
+		  HE5_GDXRegion[i]->somStart = blockindexstart;
+		  HE5_GDXRegion[i]->somCount = blockindexstop - blockindexstart + 1;
+  
+		  /* Store upleft and lowright points of subset region */
+		  /* ------------------------------------------------- */
+		  if (blockindexstart == 0)
+		    {
+		      HE5_GDXRegion[i]->upleftpt[0] = upleftpt[0];
+		      HE5_GDXRegion[i]->upleftpt[1] = upleftpt[1];
+		      HE5_GDXRegion[i]->lowrightpt[0] = lowrightpt[0];
+		      HE5_GDXRegion[i]->lowrightpt[1] = lowrightpt[1];
+		    }
+		  else
+		    {
+		      HE5_GDXRegion[i]->upleftpt[0] =
+			(lowrightpt[0] - upleftpt[0])*
+			(offset[blockindexstart-1]/xdimsize) + upleftpt[0];
+		      HE5_GDXRegion[i]->upleftpt[1] =
+			(lowrightpt[1] - upleftpt[1])*
+			(blockindexstart+1-1) + upleftpt[1];
+
+		      HE5_GDXRegion[i]->lowrightpt[0] =
+			(lowrightpt[0] - upleftpt[0])*
+			(offset[blockindexstart-1]/xdimsize) + lowrightpt[0];
+
+		      HE5_GDXRegion[i]->lowrightpt[1] =
+			(lowrightpt[1] - upleftpt[1])*
+			(blockindexstart+1-1) + lowrightpt[1];
+  
+		    }
+		}
+
+	      else
+		{
+		  /* Non-GEO, Non-BCEA  projections */
+		  /* ------------------------------ */
+
+		  /* Compute X & Y scale */
+		  /* ------------------- */
+		  xscale = (lowrightpt[0] - upleftpt[0]) / xdimsize;
+		  yscale = (lowrightpt[1] - upleftpt[1]) / ydimsize;
+					
+					
+		  /* MinCol -> meters -> upleftpt[0] */
+		  /* ------------------------------- */
+		  HE5_GDXRegion[i]->upleftpt[0] = upleftpt[0] + xscale * minCol;
+
+		  /* MinRow -> meters -> upleftpt[1] */
+		  /* ------------------------------- */
+		  HE5_GDXRegion[i]->upleftpt[1] = upleftpt[1] + yscale * minRow;
+					
+		  /* MinCol + 1 -> meters -> lowrightpt[0] */
+		  /* ------------------------------------- */
+		  HE5_GDXRegion[i]->lowrightpt[0] = upleftpt[0] + xscale * (maxCol + 1);
+					
+		  /* MinRow + 1 -> meters -> lowrightpt[1] */
+		  /* ------------------------------------- */
+		  HE5_GDXRegion[i]->lowrightpt[1] = upleftpt[1] + yscale * (maxRow + 1);
+		}
+				
+	      /* Store region ID */
+	      /* --------------- */
+	      regionID = i;
+	      break;
+	    }
+	}
+    }
+	
+	
+  free(errbuf);
+  errbuf = NULL;
+   
+ COMPLETION:
+  HE5_UNLOCK;
+  return (regionID);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDregioninfo                                                 |
+|                                                                             |
+|  DESCRIPTION: Retrieves size of region in bytes.                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  regionID       hid_t               Region ID                               |
+|  fieldname      char*               Fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               field number types                      |
+|  rank           int                 field rank                              |
+|  dims           hsize_t             dimensions of field region              |
+|  size           long                size in bytes of field region           |
+|  upleftpt       double              Upper left corner coord for region      |
+|  lowrightpt     double              Lower right corner coord for region     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/24/99  A.Muslimov    Changed the return type from intn to int   .        |
+|  9/23/99  A.Muslimov    Changed the type  of gridID, regionID from int32_t  |
+|                         to hid_t.Removed redundant if(status == 0){} blocks.|
+|                         Added error handling after the function calls.      |
+|                         Cleaned up minor things.                            |
+|  5/10/00  A.Muslimov    Changed 'H5T_class_t' type to 'int' data type.      |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Jan 03   S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|  June 04  S.Zhao        Enabled to subset on a one-dimensional field.       |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_GDregioninfo(hid_t gridID, hid_t regionID, const char *fieldname, hid_t *ntype, int *rank, hsize_t dims[], long  *size, double upleftpt[], double lowrightpt[])
+{
+
+  herr_t          status = FAIL;/* routine return status variable */ 
+ 
+  int             j;            /* Loop index                     */
+
+  hid_t           fid    = FAIL;/* HDF-EOS file ID                */
+  hid_t           gid    = FAIL;/* "HDFEOS" group ID              */
+  
+  long            idx    = FAIL;/* Grid index                     */
+  long            index  = FAIL;/* Dimension index                */
+  
+  char            dimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list  */
+  char            *errMesg = "Vertical Dimension Not Found: \"%s\".\n";
+  char            *errM1 = "Both \"XDim\" and \"YDim\" must be present ";
+  char            *errM2 = "in the dimension list for \"%s\".\n";
+  char            *errbuf= (char *)NULL;      /* Error buffer     */
+  
+  CHECKPOINTER(fieldname);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDregioninfo", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      free(errbuf);
+     
+      return(status);
+    }
+  
+  
+  /* Check for valid region ID */
+  /* ------------------------- */
+  if (regionID < 0 || regionID >= HE5_NGRIDREGN)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Invalid Region ID: %d.\n", regionID);
+      H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	    
+      return(status);
+    }
+  
+  
+  
+  /* Check for active region ID */
+  /* -------------------------- */
+  if (HE5_GDXRegion[regionID] == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Inactive Region ID: %d.\n", regionID);
+      H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(status);
+    }
+  
+  
+  
+  
+  /* Check that region defined for this file */
+  /* --------------------------------------- */
+  if (HE5_GDXRegion[regionID]->fid != fid)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Region is not defined for this file.\n");
+      H5Epush(__FILE__, "HE5_GDregioninfo",  __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(status);
+    }
+  
+  
+  
+  /* Check that region defined for this grid */
+  /* --------------------------------------- */
+  if (HE5_GDXRegion[regionID]->gridID != gridID)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Region is not defined for this Grid.\n");
+      H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	    
+      return(status);
+    }
+  
+  
+  
+  /* Check for valid fieldname */
+  /* ------------------------- */
+  status = HE5_GDfieldinfo(gridID, fieldname, rank, dims, ntype, dimlist, NULL);
+  if (status == FAIL)
+    {
+      /* Fieldname not found in grid */
+      /* --------------------------- */
+      sprintf(errbuf, "Fieldname \"%s\" not found.\n", fieldname);
+      H5Epush(__FILE__, "HE5_GDregioninfo",    __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(status);
+    }
+  else if (*rank > 1)
+    {
+      /* "XDim" and/or "YDim" not found */
+      /* ------------------------------ */
+      if ( HE5_EHstrwithin("XDim", dimlist, ',') == FAIL || HE5_EHstrwithin("YDim", dimlist, ',') == FAIL)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "%s%s%s", errM1, errM2, fieldname);
+	  H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	    
+	  return(status);
+	}
+    }
+  
+  
+  
+  /* If no problems ... */
+  /* ------------------ */
+  
+  if (*rank > 1)
+    {
+      /* Load XDim dimension from region entry */
+      /* ------------------------------------- */
+      if (HE5_GDXRegion[regionID]->xCount != 0)
+	{
+	  dims[ HE5_EHstrwithin("XDim", dimlist, ',') ] = (hsize_t)HE5_GDXRegion[regionID]->xCount;
+	}
+      /* Load YDim dimension from region entry */
+      /* ------------------------------------- */
+      if (HE5_GDXRegion[regionID]->yCount != 0)
+	{
+	  dims[ HE5_EHstrwithin("YDim", dimlist, ',') ] = (hsize_t)HE5_GDXRegion[regionID]->yCount;
+	}
+    }
+
+  
+  /* Vertical Subset */
+  /* --------------- */
+  for (j = 0; j < HE5_DTSETRANKMAX; j++)
+    {
+      /* If active vertical subset ... */
+      /* ----------------------------- */
+      if (HE5_GDXRegion[regionID]->StartVertical[j] != FAIL)
+	{
+	  /* Find vertical dimension within dimlist */
+	  /* -------------------------------------- */
+	  index = HE5_EHstrwithin(HE5_GDXRegion[regionID]->DimNamePtr[j], dimlist, ',');
+
+	  /* If dimension found ... */
+	  /* ---------------------- */
+	  if (index != FAIL)
+	    {
+	      /* Compute dimension size */
+	      /* ---------------------- */
+	      dims[ index ] = HE5_GDXRegion[regionID]->StopVertical[j] - HE5_GDXRegion[regionID]->StartVertical[j] + 1;
+	    }
+	  else
+	    {
+	      /* Vertical dimension not found */
+	      /* ---------------------------- */
+	      status = FAIL;
+	      *size  = FAIL;
+	      sprintf( errbuf, errMesg, HE5_GDXRegion[regionID]->DimNamePtr[j]);
+	      H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+		    
+	      return(status);
+	    }
+	}
+    }
+  
+  
+  
+  /* Compute number of total elements */
+  /* -------------------------------- */
+  *size = (long)dims[ 0 ];
+  
+  for (j = 1; j < *rank; j++)
+    *size *= (long)dims[j];
+  
+  /* Multiply by size in bytes of numbertype */
+  /* --------------------------------------- */
+  *size *= (long)HE5_GDfielddatasize(gridID,fieldname);
+  if(*size == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot get the data size of the data field.\n");
+      H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      free(errbuf);
+	     
+      return(status);
+    }
+  
+  
+  /* Return upper left and lower right subset values */
+  /* ----------------------------------------------- */
+  upleftpt[0]   = HE5_GDXRegion[regionID]->upleftpt[0];
+  upleftpt[1]   = HE5_GDXRegion[regionID]->upleftpt[1];
+  lowrightpt[0] = HE5_GDXRegion[regionID]->lowrightpt[0];
+  lowrightpt[1] = HE5_GDXRegion[regionID]->lowrightpt[1];
+  
+  
+  free(errbuf);
+  errbuf = NULL;
+ 
+ COMPLETION:
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetfieldID                                                 |
+|                                                                             |
+|  DESCRIPTION: Return a data field ID                                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/21/99  A.Muslimov    Added error handling after the call to GDchkgdid(). |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t   
+HE5_GDgetfieldID(hid_t gridID, const char *fieldname, hid_t *fieldID)
+{
+  
+  herr_t         status     = FAIL;/* routine return status variable */
+
+  int            i;                /* Loop index                     */
+  
+  hid_t          fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t          gid        = FAIL;/* "HDFEOS" group ID              */
+  
+  long           idx        = FAIL;/* Grid index                     */
+  
+  /*  char           *errbuf=(char *)NULL;*//* error message buffer        */
+					    char           errbuf[HE5_HDFE_ERRBUFSIZE];
+  
+  CHECKPOINTER(fieldname);
+  
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  /*
+    errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+    if(errbuf == NULL)
+    {
+    H5Epush(__FILE__, "HE5_GDgetfieldID", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+    HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+    return(FAIL);
+    }
+  */
+  
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDgetfieldID", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDgetfieldID", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      /*free(errbuf);*/
+		
+      return(FAIL);
+    }
+  
+  /* Loop through all data datasets in grid and get dataset name */
+  /* ----------------------------------------------------------- */
+  for (i = 0; i < HE5_GDXGrid[idx].nDFLD; i++)
+    {
+      if( strcmp(fieldname, HE5_GDXGrid[idx].ddataset[i].name) == 0 ) break;
+    }
+  
+  /* Get field-related dataset  ID */
+  /* ============================= */ 
+  *fieldID = HE5_GDXGrid[idx].ddataset[i].ID;
+  
+  /*free(errbuf);*/
+  
+ COMPLETION:
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDfielddatasize                                              |
+|                                                                             |
+|  DESCRIPTION: Return size in bytes of a data field                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  size           size_t              data type size in bytes                 |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|             H5Dget_type                                                     |
+|             H5Tget_size                                                     |
+|             H5Tclose                                                        |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/28/99  A.Muslimov    Added proper error handlings after the function     |
+|                         calls.                                              |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static size_t 
+HE5_GDfielddatasize(hid_t gridID, const char *fieldname)
+{
+  size_t         size      =  0;  /* return value, data type size in bytes */
+  
+  herr_t         status    = FAIL;/* routine return status variable */
+
+  int            i;				  /* Loop index */
+
+  hid_t          fid       = FAIL;/* HDF-EOS file ID */
+  hid_t          gid       = FAIL;/* "HDFEOS" group ID */
+  hid_t          dtype     = FAIL;/* datatype ID */
+  hid_t          datasetid = FAIL;/* field dataset ID */
+
+  long           idx       = FAIL;/* Grid index */
+
+  char           *errbuf=(char *)NULL;/* error message buffer */
+
+  CHECKPOINTER(fieldname);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      size = 0;
+      H5Epush(__FILE__, "HE5_GDfielddatasize", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(size);
+    }
+	
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDfielddatasize", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      size = 0;
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDfielddatasize", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(size);
+    }
+	
+  /* Loop through all data datasets in grid */
+  /* -------------------------------------- */
+  for (i = 0; i < HE5_GDXGrid[idx].nDFLD; i++)
+    {
+      /* Get dataset name */
+      /* ---------------- */
+      if( strcmp(fieldname, HE5_GDXGrid[idx].ddataset[i].name) == 0 )
+	break;
+    }
+
+  /* Get dataset ID */
+  /* -------------- */
+  datasetid = HE5_GDXGrid[idx].ddataset[i].ID;
+  dtype     = H5Dget_type(datasetid);
+  if ( dtype == FAIL )
+    {
+      size = 0;
+      sprintf(errbuf, "Cannot get data type ID.\n");
+      H5Epush(__FILE__, "HE5_GDfielddatasize", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(size);
+    }
+
+  /* Get data type size (bytes) */
+  /* -------------------------- */   
+  size = H5Tget_size(dtype);
+  if ( size == 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve data size.\n");
+      H5Epush(__FILE__, "HE5_GDfielddatasize", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(size);
+    }
+
+  /* Release the data type ID */
+  /* ------------------------ */
+  status = H5Tclose(dtype);
+  if ( status == FAIL )
+    {
+      size = 0;
+      sprintf(errbuf, "Cannot release datatype ID.\n");
+      H5Epush(__FILE__, "HE5_GDfielddatasize", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+
+  free(errbuf);
+  errbuf = NULL;
+    
+ 
+ COMPLETION:
+  return(size);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDextractregion                                              |
+|                                                                             |
+|  DESCRIPTION: Retrieves data from specified region.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  regionID       hid_t               Region ID                               |
+|  fieldname      char*               Fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  buffer         void                Data buffer containing subsetted region |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/23/99  A.Muslimov    Changed the data type of gridID and regionID from   |
+|                         int32_t to hid_t. Added proper error handling after |
+|                         the function calls. Removed redundant               |
+|                         if(status==0){} brackets.                           |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  June 04  S.Zhao        Enabled to subset on a one-dimensional field.       |
+|  July 04  S.Zhao        Set a default origin if HE5_GDorigininfo fails.     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDextractregion(hid_t gridID, hid_t regionID, const char *fieldname, void *buffer)
+{
+  herr_t          status   = FAIL;               /* routine return status variable */
+
+  int             i, j;			         /* Loop indices                   */
+  int             rank     = FAIL;               /* Field rank                     */
+  int             origincode=FAIL;               /* Pixel origin code              */
+
+  hid_t           *ntype   = (hid_t *)NULL;      /* number types                   */
+
+  hid_t           fid      = FAIL;               /* HDF-EOS file ID                */
+  hid_t           gid      = FAIL;               /* "HDFEOS" group ID              */
+
+  long            idx      = FAIL;               /* Grid index                     */
+  long            index    = FAIL;               /* Dimension index                */
+
+  hssize_t        start[HE5_DTSETRANKMAX];       /* Start array for data to read   */
+  hsize_t         edge[HE5_DTSETRANKMAX];        /* Edge array for data to read    */
+  hsize_t         dims[HE5_DTSETRANKMAX];        /* Dimensions                     */
+
+  char            dimlist[HE5_HDFE_DIMBUFSIZE];	 /* Dimension list                 */
+  char            *errMesg = "Vertical Dimension Not Found: \"%s\".\n";
+  char            *errM1   = "Both \"XDim\" and \"YDim\" must be present ";
+  char            *errM2   = "in the dimension list for \"%s\".\n";
+  char            *errbuf  = (char *)NULL; /* error message buffer */
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);  
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDextractregion", &fid, &gid, &idx);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      
+      return(status);
+    }
+
+
+  /* Check for valid region ID */
+  /* ------------------------- */    
+  if (regionID < 0 || regionID >= HE5_NGRIDREGN)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Invalid Region id: %d.\n", regionID);
+      H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	    
+      return(status);	    
+    }
+
+
+  /* Check for active region ID */
+  /* -------------------------- */
+  if (HE5_GDXRegion[regionID] == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Inactive Region ID: %d.\n", regionID);
+      H5Epush(__FILE__,  "HE5_GDextractregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	    
+      return(status);
+    }
+
+
+
+  /* Check that region defined for this file */
+  /* --------------------------------------- */
+  if (HE5_GDXRegion[regionID]->fid != fid)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Region is not defined for this file.\n");
+      H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	    
+      return(status);
+	    
+    }
+
+
+  /* Check that region defined for this grid */
+  /* --------------------------------------- */
+  if (HE5_GDXRegion[regionID]->gridID != gridID)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Region is not defined for this Grid.\n");
+      H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	    
+      return(status);
+    }
+
+
+
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[ i ] = 0;
+
+
+  /* Check for valid fieldname */
+  /* ------------------------- */
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+
+  status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, ntype, dimlist, NULL);
+  if (status == FAIL)
+    {
+      /* Fieldname not found in grid */
+      /* --------------------------- */
+      sprintf(errbuf, "Fieldname \"%s\" not found.\n", fieldname);
+      H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(ntype);
+	    
+      return(status);
+    }
+  else if (rank > 1)
+    {
+      /* "XDim" and/or "YDim" not found */
+      /* ------------------------------ */
+      if ( HE5_EHstrwithin("XDim", dimlist, ',') == FAIL || HE5_EHstrwithin("YDim", dimlist, ',') == FAIL)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "%s%s%s", errM1, errM2, fieldname);
+	  H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(ntype);
+
+	  return(status);
+	}
+    }
+
+
+  /* Get origin order info */
+  /* --------------------- */
+  status = HE5_GDorigininfo(gridID, &origincode);
+  if (status == FAIL)
+    {
+      /* Set a default origin code */
+      /* ------------------------- */
+      origincode = HE5_HDFE_GD_UL;
+    }
+
+
+  /* Initialize start & edge arrays */
+  /* ------------------------------ */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      start[ i ] = 0;
+      edge[ i ]  = dims[ i ];
+    }
+
+  if (rank > 1)
+    {
+      /* Set start & edge arrays for XDim */
+      /* -------------------------------- */
+      index = HE5_EHstrwithin("XDim", dimlist, ',');
+      if (HE5_GDXRegion[regionID]->xCount != 0)
+	{
+	  edge[index]  = (hsize_t)HE5_GDXRegion[regionID]->xCount;
+	  start[index] = (hssize_t)HE5_GDXRegion[regionID]->xStart;
+	}
+
+      /* Adjust X-dim start if origin on right edge */
+      /* ------------------------------------------ */
+      if ((origincode & 1) == 1)
+	{
+	  start[index] = dims[index] - (start[index] + edge[index]);
+	}
+
+      /* Set start & edge arrays for YDim */
+      /* -------------------------------- */
+      index = HE5_EHstrwithin("YDim", dimlist, ',');
+      if (HE5_GDXRegion[regionID]->yCount != 0)
+	{
+	  start[index] = (hssize_t)HE5_GDXRegion[regionID]->yStart;
+	  edge[index]  = (hsize_t)HE5_GDXRegion[regionID]->yCount;
+	}
+
+      /* Adjust Y-dim start if origin on lower edge */
+      /* ------------------------------------------ */
+      if ((origincode & 2) == 2)
+	{
+	  start[index] = dims[index] - (start[index] + edge[index]);
+	}
+
+    }
+
+
+  /* Vertical Subset */
+  /* --------------- */
+  for (j = 0; j < HE5_DTSETRANKMAX; j++)
+    {
+      /* If active vertical subset ... */
+      /* ----------------------------- */
+      if (HE5_GDXRegion[regionID]->StartVertical[j] != FAIL)
+	{
+
+	  /* Find vertical dimension within dimlist */
+	  /* -------------------------------------- */
+	  index = HE5_EHstrwithin(HE5_GDXRegion[regionID]->DimNamePtr[j], dimlist, ',');
+
+	  /* If dimension found ... */
+	  /* ---------------------- */
+	  if (index != FAIL)
+	    {
+	      /* Compute start and edge for vertical dimension */
+	      /* --------------------------------------------- */
+	      start[index] = (hssize_t)HE5_GDXRegion[regionID]->StartVertical[j];
+	      edge[index]  = (hsize_t)(HE5_GDXRegion[regionID]->StopVertical[j] - HE5_GDXRegion[regionID]->StartVertical[j] + 1);
+	    }
+	  else
+	    {
+	      /* Vertical dimension not found */
+	      /* ---------------------------- */
+	      status = FAIL;
+	      sprintf(errbuf, errMesg, HE5_GDXRegion[regionID]->DimNamePtr[j]);
+	      H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(ntype);
+
+	      return(status);
+		    
+	    }
+	}
+	    
+    }
+	
+
+  /* Read into data buffer */
+  /* --------------------- */
+  status = HE5_GDreadfield(gridID, fieldname, start, NULL, edge, buffer);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot read data for the \"%s\" data field into data buffer.\n", fieldname);
+      H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+
+  free(errbuf);
+  errbuf = NULL;
+  free(ntype);
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdupregion                                                  |
+|                                                                             |
+|  DESCRIPTION: Duplicates a region                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  newRegionID    hid_t               New region ID                           |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  oldRegionID    hid_t               Old region ID                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 98   Abe Taaheri   changed *GDXRegion[i] = *GDXRegion[oldregionID];    |
+|                         to copy elements of structure one by one to avoid   |
+|                         copying pointer for DimNamePtr to another place that|
+|                         causes "Freeing Unallocated Memory" in purify when  |
+|                         using GDdetach                                      |
+|  9/23/99  A.Muslimov    Changed the data type for newregionID(return value) |
+|                         and oldregionID from int32_t to hid_t.              |
+|  4/19/00 A.Muslimov     Changed type of 'slendupregion' from long to size_t.|
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t 
+HE5_GDdupregion(hid_t oldRegionID)
+{
+
+  hid_t           newRegionID = FAIL;/* New region ID (return value)    */
+  hid_t           i, j;              /* Loop indices                    */
+  
+  size_t          slendupregion  = 0;/* length of dimension name string */
+
+  /* Find first empty (inactive) region */
+  /* ---------------------------------- */
+  for (i = 0; i < HE5_NGRIDREGN; i++)
+    {
+      if (HE5_GDXRegion[i] == 0)
+        {
+	  /* Allocate space for new grid region entry */
+	  /* ---------------------------------------- */
+	  HE5_GDXRegion[i] = (struct HE5_gridRegion *)calloc(1, sizeof(struct HE5_gridRegion));
+	  if(HE5_GDXRegion[i] == NULL)
+            {
+	      H5Epush(__FILE__, "HE5_GDdupregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+	      HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+	      return(FAIL);
+            }
+		  
+		  
+	  /* Copy old region structure data to new region */
+	  /* -------------------------------------------- */
+	  HE5_GDXRegion[i]->fid           = HE5_GDXRegion[oldRegionID]->fid;
+	  HE5_GDXRegion[i]->gridID        = HE5_GDXRegion[oldRegionID]->gridID;
+	  HE5_GDXRegion[i]->xStart        = HE5_GDXRegion[oldRegionID]->xStart;
+	  HE5_GDXRegion[i]->xCount        = HE5_GDXRegion[oldRegionID]->xCount;
+	  HE5_GDXRegion[i]->yStart        = HE5_GDXRegion[oldRegionID]->yStart;
+	  HE5_GDXRegion[i]->yCount        = HE5_GDXRegion[oldRegionID]->yCount;
+	  HE5_GDXRegion[i]->upleftpt[0]   = HE5_GDXRegion[oldRegionID]->upleftpt[0];
+	  HE5_GDXRegion[i]->upleftpt[1]   = HE5_GDXRegion[oldRegionID]->upleftpt[1];
+	  HE5_GDXRegion[i]->lowrightpt[0] = HE5_GDXRegion[oldRegionID]->lowrightpt[0];
+	  HE5_GDXRegion[i]->lowrightpt[1] = HE5_GDXRegion[oldRegionID]->lowrightpt[1];
+	  for (j = 0; j < HE5_DTSETRANKMAX; j++)
+            {
+	      HE5_GDXRegion[i]->StartVertical[j] = HE5_GDXRegion[oldRegionID]->StartVertical[j];
+	      HE5_GDXRegion[i]->StopVertical[j]  = HE5_GDXRegion[oldRegionID]->StopVertical[j];
+            }
+		  
+	  for (j = 0; j < HE5_DTSETRANKMAX; j++)
+            {
+	      if(HE5_GDXRegion[oldRegionID]->DimNamePtr[j] != NULL)
+                {
+		  slendupregion = strlen(HE5_GDXRegion[oldRegionID]->DimNamePtr[j]);
+		  HE5_GDXRegion[i]->DimNamePtr[j] = (char *) calloc( (slendupregion + 1), sizeof(char) );
+		  strcpy(HE5_GDXRegion[i]->DimNamePtr[j],HE5_GDXRegion[oldRegionID]->DimNamePtr[j]);
+                }
+            }
+		  
+	  /* Define new region ID */
+	  /* -------------------- */
+	  newRegionID = i;
+		  
+	  break;
+        }
+    }
+  return (newRegionID);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefvrtregion                                               |
+|                                                                             |
+|  DESCRIPTION: Finds elements of a monotonic field within a vertical subset  |
+|               region.                                                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  regionID       hid_t   None        Region ID                               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               Grid structure ID                       |
+|  regionID       hid_t               Region ID                               |
+|  vertObj        char                Vertical object to subset               |
+|  range          double              Vertical subsetting range               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/23/99  A.Muslimov    Changed the data types of return value, gridID, and |
+|                         RegionID from int32_t to hid_t. Added error handling|
+|                         after the function calls.                           |
+|  10/18/99 A.Muslimov    Replace memcpy() by memmove() to avoid a problem    |
+|                         when arguments 1 and 2 overlap in memory.           |
+|  11/10/99 A.Muslimov    In the call to GDreadfield() 3d and 5th arguments   |
+|                         were passed as "NULL"s, which resulted in a core    |
+|                         dump. To fix this bug, replaced them by start and   |
+|                         edge, respectively.                                 |
+|  04/19/00 A.Muslimov    Changed type of 'slen' from long to size_t.         |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  Mar  04  S.Zhao        Modified for supported field type.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+#define HE5_SETGRIDREG							\
+									\
+  status = HE5_GDgridinfo(gridID, &xdimsize, &ydimsize, upleftpt, lowrightpt); \
+  for (k = 0; k < HE5_NGRIDREGN; k++)					\
+    {									\
+      if (HE5_GDXRegion[k] == 0)					\
+	{								\
+	  HE5_GDXRegion[k] = (struct HE5_gridRegion *)calloc(1, sizeof(struct HE5_gridRegion)); \
+	  HE5_GDXRegion[k]->fid           = fid;			\
+	  HE5_GDXRegion[k]->gridID        = gridID;			\
+	  HE5_GDXRegion[k]->xStart        = 0;				\
+	  HE5_GDXRegion[k]->xCount        = xdimsize;			\
+	  HE5_GDXRegion[k]->yStart        = 0;				\
+	  HE5_GDXRegion[k]->yCount        = ydimsize;			\
+	  HE5_GDXRegion[k]->upleftpt[0]   = upleftpt[0];		\
+	  HE5_GDXRegion[k]->upleftpt[1]   = upleftpt[1];		\
+	  HE5_GDXRegion[k]->lowrightpt[0] = lowrightpt[0];		\
+	  HE5_GDXRegion[k]->lowrightpt[1] = lowrightpt[1];		\
+	  regionID = k;							\
+	  for (j = 0; j < HE5_DTSETRANKMAX; j++)			\
+	    {								\
+	      HE5_GDXRegion[k]->StartVertical[j] = FAIL;		\
+	      HE5_GDXRegion[k]->StopVertical[j]  = FAIL;		\
+	    }								\
+	  break;							\
+	}								\
+    }
+
+
+#define HE5_FILLVERTREG							\
+  for (j = 0; j < HE5_DTSETRANKMAX; j++)				\
+    {									\
+      if (HE5_GDXRegion[regionID]->StartVertical[j] == FAIL)		\
+	{								\
+	  HE5_GDXRegion[regionID]->StartVertical[j] = i;		\
+	  HE5_GDXRegion[regionID]->DimNamePtr[j] = (char *) calloc( (slen + 1),sizeof(char) ); \
+	  memmove(HE5_GDXRegion[regionID]->DimNamePtr[j], dimlist, slen + 1); \
+	  break;							\
+	}								\
+    }
+
+hid_t 
+HE5_GDdefvrtregion(hid_t gridID, hid_t regionID, char *vertObj, double range[])
+{
+
+  herr_t          status = FAIL;                /* Return status variable */
+
+  int             tmp    = 999;                 /* Temporary flag         */
+  int             rank   = FAIL;                /* Dataset rank           */ 
+  int             vertINT= 0;
+  int             j;                            /* Loop index             */
+
+  hid_t           *nt    = (hid_t *)NULL;       /* number types           */
+    
+  unsigned char   found  = 0;                   /* "Found" flag           */
+
+  hid_t           k;			        /* loop index             */ 
+  hid_t           fid    = FAIL;                /* HDF-EOS file ID        */
+  hid_t           gid    = FAIL;                /* "HDFEOS" group ID      */
+  hid_t           dtype  = FAIL;                /* Datatype  ID           */
+  hid_t           fieldID= FAIL;                /* Data field dataset ID  */
+
+  size_t          slen   = 0;                   /* String length value    */
+  size_t          size   = 0;                   /* Field datasize (bytes) */
+
+  long            i;			        /* loop index             */
+  long            idx      = FAIL;              /* Grid index             */
+  long            xdimsize =  0;                /* Size of "XDim"         */
+  long            ydimsize =  0;                /* Size of "YDim"         */
+
+  short           vertSHORT= 0;                 /* Temp "short" variable  */
+
+  float           vertFLT  = 0.;                /* Temp "float" variable  */
+
+  double          vertDBL  = 0.;                /* Temp "double" variable */
+  double          upleftpt[2]={0.,0.};	        /* Upper left point       */
+  double          lowrightpt[2]={0.,0.};        /* Lower right point      */
+
+  hsize_t         dims[HE5_DTSETRANKMAX];       /* Dimension sizes array  */
+  hssize_t        start[HE5_DTSETRANKMAX];      /* Start array            */
+  hsize_t         edge[HE5_DTSETRANKMAX];       /* Edge array             */
+
+  char            *vertArr = (char *)NULL;      /* Temp "char" variable   */ 
+  char            dimlist[HE5_HDFE_DIMBUFSIZE]; /* Dimension list         */
+  char	          *errbuf  = (char *)NULL;	    /* Error message buffer   */
+
+  HE5_LOCK;
+  CHECKPOINTER(vertObj);
+  CHECKPOINTER(range);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Initialize arrays */
+  /* ----------------- */
+  for (j = 0; j < HE5_DTSETRANKMAX; j++)
+    {
+      dims[ j ]  = 0;
+      start[ j ] = 0;
+      edge[ j ]  = 0;
+    }
+    
+   
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDdefvrtregion", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      regionID = FAIL;
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return( regionID );
+    }
+ 
+  memmove(dimlist, vertObj, 4);
+  dimlist[4] = 0;
+
+  if (strcmp(dimlist, "DIM:") == 0)
+    {
+      slen = strlen(vertObj) - 4;
+      if (regionID == FAIL)
+	{
+	  HE5_SETGRIDREG;
+	}
+      for (j = 0; j < HE5_DTSETRANKMAX; j++)
+	{
+	  if (HE5_GDXRegion[regionID]->StartVertical[j] == FAIL)
+	    {
+	      HE5_GDXRegion[regionID]->StartVertical[j] = (long)range[0];
+	      HE5_GDXRegion[regionID]->StopVertical[j]  = (long)range[1];
+	      HE5_GDXRegion[regionID]->DimNamePtr[j]    = (char *) calloc( (slen + 1),sizeof(char) );
+
+	      if(HE5_GDXRegion[regionID]->DimNamePtr[j] == NULL)
+		{
+		  sprintf(errbuf,"Cannot allocate memory\n") ;
+		  H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf) ;
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+			
+		  return(FAIL);
+		}
+	      memmove(HE5_GDXRegion[regionID]->DimNamePtr[j],vertObj + 4, slen + 1);
+	      break;
+	    }
+	}
+    }
+  else
+    {
+      nt = (hid_t *)calloc(1, sizeof(hid_t));
+      if (nt == (hid_t *)NULL )
+	{
+	  regionID = FAIL;
+	  sprintf(errbuf, "Cannot allocate memory for data type class ID.\n");
+	  H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+		
+	  return(regionID);
+	}
+
+      status = HE5_GDfieldinfo(gridID, vertObj, &rank, dims, nt, dimlist,NULL);
+      if (status == FAIL)
+	{
+	  regionID = FAIL;
+	  sprintf(errbuf, "Vertical Field: \"%s\" not found.\n", vertObj);
+	  H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(nt);
+		
+	  return(regionID);
+	}
+      else
+	{
+	  if (rank != 1)
+	    {
+	      regionID = FAIL;
+	      sprintf(errbuf, "Vertical Field: \"%s\" must be 1-dim.\n", vertObj);
+	      H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(nt);
+		    
+	      return(regionID);
+	    }
+	  else
+	    {
+	      slen = strlen(dimlist);
+	      size = HE5_GDfielddatasize(gridID, vertObj);
+	      vertArr = (char *)calloc(dims[0], size);
+	      if(vertArr == NULL)
+		{
+		  regionID = FAIL;
+		  sprintf(errbuf,"Cannot allocate memory\n");
+		  H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  free(errbuf);
+		  free(nt);
+					  
+		  return(regionID);
+		}
+
+	      /* ------------------------------------------------  */
+	      /* Generate start[] and edge[] arrays to pass to the */
+	      /*      GDreadfield(). The NULL values are not       */
+	      /*       allowed for the 3d and 5th argument         */
+	      /*           of this function. (A.M)                 */
+	      /* ------------------------------------------------  */
+	      for( k = 0; k < rank; k++ )
+		{
+		  start[k] = 0;
+		  edge[k]  = dims[k];
+		}
+					
+	      status = HE5_GDreadfield(gridID, vertObj, start, NULL, edge, vertArr);
+	      if(status == FAIL)
+		{
+		  regionID = FAIL;
+		  sprintf(errbuf, "Cannot read out data from the data field.\n");
+		  H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  free(errbuf);
+		  free(vertArr);
+		  free(nt);
+						
+		  return(regionID);
+		}
+
+	      /* Get field ID and field data type */
+	      /* ------------------------------- */
+	      status = HE5_GDgetfieldID(gridID, vertObj, &fieldID);
+	      if(status == FAIL)
+		{
+		  regionID = FAIL;
+		  sprintf(errbuf, "Cannot get the data field ID.\n");
+		  H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  free(errbuf);
+		  free(vertArr);
+		  free(nt);
+						
+		  return(regionID);
+		}
+
+	      dtype = H5Dget_type(fieldID);
+	      if(dtype == FAIL)
+		{
+		  regionID = FAIL;
+		  sprintf(errbuf, "Cannot get the data type of the data field.\n");
+		  H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  free(errbuf);
+		  free(vertArr);
+		  free(nt);
+						
+		  return(regionID);
+		}
+					
+
+	      if ( H5Tequal( dtype, H5T_NATIVE_SHORT) ||
+		   H5Tequal( dtype, H5T_STD_I16BE) ||
+		   H5Tequal( dtype, H5T_STD_I16LE) )
+		tmp = 1;
+	      else if ( H5Tequal(dtype, H5T_NATIVE_INT) ||
+			H5Tequal(dtype, H5T_STD_I32BE) ||
+			H5Tequal(dtype, H5T_STD_I32LE) )
+		tmp = 2;
+	      else if ( H5Tequal( dtype, H5T_NATIVE_FLOAT) ||
+			H5Tequal( dtype, H5T_IEEE_F32BE) ||
+			H5Tequal( dtype, H5T_IEEE_F32LE) )
+		tmp = 3;
+	      else if ( H5Tequal(dtype, H5T_NATIVE_DOUBLE) ||
+			H5Tequal(dtype, H5T_IEEE_F64BE) ||
+			H5Tequal(dtype, H5T_IEEE_F64LE) )
+		tmp = 4;
+					
+	      status = H5Tclose(dtype);
+	      if(status == FAIL)
+		{
+		  regionID = FAIL;
+		  sprintf(errbuf, "Cannot release the data type ID.\n");
+		  H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  free(errbuf);
+		  free(vertArr);
+		  free(nt);
+						
+		  return(regionID);
+		}
+					
+ 
+	      switch (tmp )
+		{
+		case  1:
+
+		  for (i = 0; i < dims[0]; i++)
+		    {
+		      memmove(&vertINT, vertArr + i * size, size);
+						  
+		      if (vertINT >= range[0] && vertINT <= range[1])
+			{
+			  found = 1;
+			  if (regionID == FAIL)
+			    {
+			      HE5_SETGRIDREG;
+			    }
+			  HE5_FILLVERTREG;
+								
+			  break;
+			}
+		    }
+						
+		  if (found == 1)
+		    {
+		      for (i = dims[0] - 1; i >= 0; i--)
+			{
+			  memmove(&vertINT, vertArr + i * size, size);
+								
+			  if (vertINT >= range[0] && vertINT <= range[1])
+			    {
+			      HE5_GDXRegion[regionID]->StopVertical[j] = i;
+			      break;
+			    }
+			}
+		    }
+		  else
+		    {
+		      regionID = FAIL;
+		      sprintf(errbuf,"Data field not found.\n");
+		      H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      free(errbuf);
+		      free(vertArr);
+		      free(nt);
+							
+		      return(regionID);
+		    }
+		  break;
+						
+						
+		case 2:
+						
+		  for (i = 0; i < dims[0]; i++)
+		    {
+		      memmove(&vertSHORT, vertArr + i * size, size);
+						  
+		      if (vertSHORT >= range[0] && vertSHORT <= range[1])
+			{
+			  found = 1;
+			  if (regionID == FAIL)
+			    {
+			      HE5_SETGRIDREG;
+			    }
+			  HE5_FILLVERTREG;
+							  
+			  break;
+			}
+		    }
+						
+		  if (found == 1)
+		    {
+		      for (i = dims[0] - 1; i >= 0; i--)
+			{
+			  memmove(&vertSHORT, vertArr + i * size, size);
+
+			  if (vertSHORT >= range[0] && vertSHORT <= range[1])
+			    {
+			      HE5_GDXRegion[regionID]->StopVertical[j] = i;
+			      break;
+			    }
+			}
+		    }
+		  else
+		    {
+		      status = FAIL;
+		    }
+		  break;
+
+						
+		case 3:
+						
+		  for (i = 0; i < dims[0]; i++)
+		    {
+		      memmove(&vertFLT, vertArr + i * size, size);
+							
+		      if (vertFLT >= range[0] && vertFLT <= range[1])
+			{
+			  found = 1;
+			  if (regionID == FAIL)
+			    {
+			      HE5_SETGRIDREG;
+			    }
+			  HE5_FILLVERTREG;
+								
+			  break;
+			}
+		    }
+						
+		  if (found == 1)
+		    {
+		      for (i = dims[0] - 1; i >= 0; i--)
+			{
+			  memmove(&vertFLT, vertArr + i * size, size);
+							  
+			  if (vertFLT >= range[0] && vertFLT <= range[1])
+			    {
+			      HE5_GDXRegion[regionID]->StopVertical[j] = i;
+			      break;
+			    }
+			}
+		    }
+		  else
+		    {
+		      regionID = FAIL;
+		      sprintf(errbuf, "Data field not found.\n");
+		      H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      free(errbuf);
+		      free(vertArr);
+		      free(nt);
+						  
+		      return(regionID);
+
+		    }
+		  break;
+						
+
+		case 4:
+						
+		  for (i = 0; i < dims[0]; i++)
+		    {
+		      memmove(&vertDBL, vertArr + i * size, size);
+							
+		      if (vertDBL >= range[0] && vertDBL <= range[1])
+			{
+			  found = 1;
+			  if (regionID == FAIL)
+			    {
+			      HE5_SETGRIDREG;
+			    }
+			  HE5_FILLVERTREG;
+								
+			  break;
+			}
+		    }
+						
+		  if (found == 1)
+		    {
+		      for (i = dims[0] - 1; i >= 0; i--)
+			{
+			  memmove(&vertDBL, vertArr + i * size, size);
+							  
+			  if (vertDBL >= range[0] &&  vertDBL <= range[1])
+			    {
+			      HE5_GDXRegion[regionID]->StopVertical[j] = i;
+			      break;
+			    }
+			}
+		    }
+		  else
+		    {
+		      regionID = FAIL;
+		      sprintf(errbuf, "Data field not found.\n");
+		      H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      free(errbuf);
+		      free(vertArr);
+		      free(nt);
+							
+		      return(regionID);
+		    }
+		  break;
+				
+
+		default:
+		  {
+		    regionID = FAIL;
+		    sprintf(errbuf, "Unknown Data type.\n");
+		    H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		    free(errbuf);
+		    free(vertArr);
+		    free(nt);
+		  }
+		  break;
+
+		}
+	      if (vertArr != NULL) free(vertArr);
+	    }
+	}
+    }
+	
+	
+  free(errbuf);
+  errbuf = NULL;
+  if (nt != NULL) free(nt);
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (regionID);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdeftimeperiod                                              |
+|                                                                             |
+|  DESCRIPTION: Finds elements of the "Time" field within a given time        |
+|               period.                                                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  periodID       hid_t               Period ID                               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               Grid structure ID                       |
+|  periodID       hid_t               Period ID                               |
+|  starttime      double  TAI sec     Start of time period                    |
+|  stoptime       double  TAI sec     Stop of time period                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/23/99  A.Muslimov    Changed the data type of periodID, gridID from      |
+|                         int32_t| to hid_t.                                  |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t
+HE5_GDdeftimeperiod(hid_t gridID, hid_t periodID, double starttime, double stoptime)
+{
+  double         timerange[2]={0.,0.};/* Range of periods */
+
+  timerange[0] = starttime;
+  timerange[1] = stoptime;
+
+  periodID = HE5_GDdefvrtregion(gridID, periodID, "Time", timerange);
+
+  return (periodID);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetpixels                                                  |
+|                                                                             |
+|  DESCRIPTION: Finds row and columns for specified lon/lat values            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               Grid structure ID                       |
+|  nLonLat        long                Number of lonlat values                 |
+|  lonVal         double   dec deg    Longitude values                        |
+|  latVal         double   dec deg    Latitude values                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  pixRow         long                Pixel rows                              |
+|  pixCol         long                Pixel columns                           |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|                                                                             |
+|    Date     Programmer   Description                                        |
+|  ======   ============  =================================================   |
+|  9/23/99  A.Muslimov    Added proper error handling after function calls.   |
+|                         Removed redundant if(status==0){} brackets.         |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDgetpixels(hid_t gridID, long nLonLat, double lonVal[], double latVal[], long pixRow[], long pixCol[])
+{
+  herr_t          status     = FAIL;/* routine return status variable */
+
+  int             projcode   = FAIL;/* GCTP projection code           */
+  int             zonecode   = FAIL;/* Zone code                      */
+  int             spherecode = FAIL;/* Sphere code                    */
+  int             origincode = FAIL;/* Origin code                    */
+  int             pixregcode = FAIL;/* Pixel registration code        */
+
+  hid_t           fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t           gid        = FAIL;/* "HDFEOS" group ID              */
+
+  long            i;		    /* Loop index                     */
+  long            idx        = FAIL;/* Grid index                     */
+  long            xdimsize   =  0;/* Size of "XDim"                   */
+  long            ydimsize   =  0;/* Size of "YDim"                   */
+
+  double          upleftpt[2]={0.,0.};  /* Upper left point           */
+  double          lowrightpt[2]={0.,0.};/* Lower right point          */
+  double          projparm[16];        /* Projection parameters       */
+  double          *xVal=(double *)NULL;/* Ptr to x location values    */
+  double          *yVal=(double *)NULL;/* Ptr to y location values    */
+
+  char            *errbuf;	    /* buffer for error message           */
+
+  CHECKPOINTER(lonVal);
+  CHECKPOINTER(latVal);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+   
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDgetpixels", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Checking for grid ID failed.\n" );	
+      H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(status);
+    }
+
+	
+  /* Get grid info */
+  /* ------------- */
+  status = HE5_GDgridinfo(gridID, &xdimsize, &ydimsize, upleftpt, lowrightpt);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot get information about Grid.\n");
+      H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	  
+      return(status);
+    }
+
+  /* Initialize projparm[] array */
+  /* --------------------------- */
+  for (i = 0; i < 16; i++)
+    projparm[i] = 0.;
+	
+
+  /* Get projection info */
+  /* ------------------- */
+  status = HE5_GDprojinfo(gridID, &projcode, &zonecode, &spherecode, projparm);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot get projection information.\n");   
+      H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(status);
+    }
+	
+  /* Get explicit upleftpt & lowrightpt if defaults are used */
+  /* ------------------------------------------------------- */
+  status = HE5_GDgetdefaults(projcode, zonecode, projparm, spherecode, upleftpt, lowrightpt);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot get explicit upleftpt and lowrghtpt values.\n");
+      H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(status);
+    }
+	
+  /* Get pixel registration and origin info */
+  /* -------------------------------------- */
+  status = HE5_GDorigininfo(gridID, &origincode);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot get pixel registration information.\n");
+      H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(status);
+    }
+	
+  status = HE5_GDpixreginfo(gridID, &pixregcode);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot get pixel origin information.\n");    
+      H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(status);
+    }
+
+	
+  /* Allocate space for x & y locations */
+  /* ---------------------------------- */	
+  xVal = (double *) calloc(nLonLat, sizeof(double));
+  if(xVal == NULL)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot allocate memory");
+      H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	    
+      return(status);
+    }
+
+  yVal = (double *) calloc(nLonLat, sizeof(double));
+  if(yVal == NULL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot allocate memory");
+      H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(xVal);
+	    
+      return(status);
+    }
+	
+	
+  /* Get pixRow, pixCol, xVal, & yVal */
+  /* -------------------------------- */
+  status = HE5_GDll2ij(projcode, zonecode, projparm, spherecode, xdimsize, ydimsize, upleftpt, lowrightpt, nLonLat, lonVal, latVal, pixRow, pixCol, xVal, yVal);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot get pixRow, pixCol, xVal, and yVal.\n");
+      H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(xVal);
+      free(yVal);
+	
+      return(status);
+    }
+
+	
+  /* Loop through all lon/lat values */
+  /* ------------------------------- */
+  for (i = 0; i < nLonLat; i++)
+    {
+      /* Adjust columns & rows for "corner" registered grids */
+      /* --------------------------------------------------- */
+      if (pixregcode == HE5_HDFE_CORNER)
+	{
+	  if (origincode == HE5_HDFE_GD_UL)
+	    {
+	      if (xVal[i] - pixCol[i] > 0.5)
+		{
+		  ++pixCol[i];
+		}
+				
+	      if (yVal[i] - pixRow[i] > 0.5)
+		{
+		  ++pixRow[i];
+		}
+	    }
+	  else if (origincode == HE5_HDFE_GD_UR)
+	    {
+	      if (xVal[i] - pixCol[i] <= 0.5)
+		{
+		  --pixCol[i];
+		}
+				  
+	      if (yVal[i] - pixRow[i] > 0.5)
+		{
+		  ++pixRow[i];
+		}
+	    }
+	  else if (origincode == HE5_HDFE_GD_LL)
+	    {
+	      if (xVal[i] - pixCol[i] > 0.5)
+		{
+		  ++pixCol[i];
+		}
+				
+	      if (yVal[i] - pixRow[i] <= 0.5)
+		{
+		  --pixRow[i];
+		}
+	    }
+	  else if (origincode == HE5_HDFE_GD_LR)
+	    {
+	      if (xVal[i] - pixCol[i] <= 0.5)
+		{
+		  --pixCol[i];
+		}
+	      if (yVal[i] - pixRow[i] <= 0.5)
+		{
+		  --pixRow[i];
+		}
+	    }
+	}
+		
+
+      /* If outidxe grid boundaries then set to FAIL */
+      /* ------------------------------------------- */
+      if (pixCol[i] < 0 || pixCol[i] >= xdimsize || pixRow[i] < 0 || pixRow[i] >= ydimsize)
+	{
+	  pixCol[i] = FAIL;
+	  pixRow[i] = FAIL;
+	}
+    }
+
+  if (xVal != NULL) free(xVal);
+  if (yVal != NULL) free(yVal);
+  free(errbuf);
+  errbuf = NULL;
+
+   
+ COMPLETION:
+  return (status);
+}
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetpixvalues                                               |
+|                                                                             |
+|  DESCRIPTION: Retrieves data from specified pixels.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  size*nPixels   long      bytes     Size of data buffer                     |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               Grid structure ID                       |
+|  nPixels        long                Number of pixels                        |
+|  pixRow         long                Pixel row numbers                       |
+|  pixCol         long                Pixel column numbers                    |
+|  fieldname      char*               Fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  buffer         void                Data buffer                             |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|              H5Screate_simple                                               |
+|              H5Dget_space                                                   |
+|              H5Dget_type                                                    |
+|              H5Sselect_elements                                             |
+|              H5Dread                                                        |
+|              H5Tclose                                                       |
+|              H5Sclose                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Mar 98   Abe Taaheri   revised to reduce overhead for rechecking           |
+|                         for gridid, fieldname, etc in GDreadfield.          |
+|  June 98  AT            fixed bug with 2-dim field merged in 3-dim field    |
+|                         (for offset and count)                              |
+|  9/23/99  A.Muslimov    Added proper error handling after function calls.   |
+|                         Removed redundant if(status==0){} brackets. Dynami- |
+|                         cally allocated memory for dimlist, ntype, and      |
+|                         errbuf strings.                                     |
+|  12/7/99  A.Muslimov    Modified a block that reads out the pixel values    |
+|                         from the dataset. This fixes a bug resulted in      |
+|                         a failure of getting the pixel values.              |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  7/17/00  A.Muslimov    Added EHdtype2mtype() before the call to H5Dread(). |  
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDgetpixvalues(hid_t gridID, long nPixels, long pixRow[], long pixCol[], const char *fieldname, void *buffer)
+{
+
+  herr_t            status     = FAIL;           /* routine return status variable */
+
+  int               j;                           /* Loop indices                   */
+  int               rank       = FAIL;           /* Field rank                     */
+  int               mrank      =  1;             /* Rank of dataspace in memory    */
+  int               origincode = FAIL;           /* Origin code                    */
+
+  hid_t             *ntype = (hid_t *)NULL;      /* number types                   */
+  
+  hid_t             fid    = FAIL;               /* HDF-EOS file ID                */
+  hid_t             gid    = FAIL;               /* "HDFEOS" group ID              */
+  hid_t             dataID = FAIL;               /* dataset ID                     */           
+  hid_t             dtype  = FAIL;               /* data type ID                   */
+  hid_t             mtype  = FAIL;               /* memory data type ID            */
+  hid_t             fspace = FAIL;               /* file data space ID             */
+  hid_t             mspace = FAIL;               /* memory data space ID           */   
+  
+  long              i;                           /* loop index                     */
+  long              idx    = FAIL;               /* Grid index                     */
+  long              xdim   = FAIL;               /* Location of "XDim" within field list */
+  long              ydim   = FAIL;               /* Location of "YDim" within field list */
+  
+  hssize_t          *coord;                      /* Array of pixel coordinates           */
+  
+  hsize_t           dims[HE5_DTSETRANKMAX];      /* Field dimensions                     */
+  hsize_t           mdims[1] = {0};              /* Dimension of dataspace in memory     */
+  
+  size_t            npoints = 0;                 /* Number of points/pixels to read      */
+  size_t            size    = 0;                 /* Size of data buffer (bytes)          */
+
+  char              *dimlist=(char *)NULL;       /* Dimension list string                */
+  char              *errbuf = (char *)NULL;      /* buffer for error message             */	
+  
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(pixRow);
+  CHECKPOINTER(pixCol);
+
+  
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+    
+  
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for ( j = 0; j < HE5_DTSETRANKMAX; j++)
+    dims[j] = 0;
+  
+  dimlist = (char *)calloc( HE5_HDFE_DIMBUFSIZE, sizeof(char ));
+  if ( dimlist == NULL )
+    {
+      sprintf(errbuf,"Cannot allocate memory for dimension list string.\n");
+      H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return(FAIL);
+    }
+  
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDgetpixvalues", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+		
+      return(FAIL);
+    }
+  
+  
+  /* Get field list */
+  /* -------------- */
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+  if ( ntype == (hid_t *)NULL )
+    {
+      sprintf(errbuf, "Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+
+      return(FAIL);
+    }
+
+  status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, ntype, dimlist, NULL);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Fieldname \"%s\" not found.\n", fieldname);
+      H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      free(ntype);
+
+      return(FAIL);
+    }
+  
+  
+  /* Check for "XDim" & "YDim" in dimension list */
+  /* ------------------------------------------- */
+  xdim = HE5_EHstrwithin("XDim", dimlist, ',');
+  if (xdim == FAIL)
+    {
+      sprintf( errbuf,"\"XDim\" not present in dimlist for field \"%s\".\n",fieldname);
+      H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      free(ntype);
+		
+      return(FAIL);
+    }
+  
+  ydim = HE5_EHstrwithin("YDim", dimlist, ',');	
+  if (ydim == FAIL)
+    {
+      sprintf( errbuf,"\"YDim\" not present in dimlist for field \"%s\".\n",fieldname);
+      H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      free(ntype);
+		
+      return(FAIL);
+    }
+  
+  
+  /* Get origin order info */
+  /* --------------------- */
+  status = HE5_GDorigininfo(gridID, &origincode);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot get origin order information.\n");
+      H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      free(ntype);
+
+      return(FAIL);
+    }
+  
+  /* Compute size of data buffer for each pixel */
+  /* ------------------------------------------ */
+  size = (size_t)dims[ 0 ];	
+  for (j = 1; j < rank; j++)
+    size *= dims[ j ];
+  
+  /* Calculate size of a whole data buffer */
+  /* ------------------------------------- */
+  size *= HE5_GDfielddatasize(gridID,fieldname);
+  if (size == 0)
+    {
+      sprintf(errbuf,"Cannot get the field data size.\n");
+      H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      free(ntype);
+		
+      return(FAIL);
+    }
+  
+  
+  
+  /* If data values are requested ... */
+  /* -------------------------------- */
+  if (buffer != NULL)
+    {
+      status = HE5_GDgetfieldID( gridID, fieldname, &dataID);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get data field ID.\n");
+	  H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+			
+	  return(FAIL);
+	}
+		
+		
+      mdims[0] = (hsize_t)nPixels;
+      npoints  = (size_t)nPixels;
+	
+      /* Create a data space in memory */
+      /* ----------------------------- */ 		
+      mspace = H5Screate_simple(mrank, (const hsize_t *)mdims, NULL);
+      if ( mspace == FAIL )
+	{
+	  sprintf(errbuf,"Cannot create the data space.\n");
+	  H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_DATASPACE, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+			
+	  return(FAIL);
+	}
+		
+      /* Allocate memory for pixel coordinates array */
+      /* ------------------------------------------- */
+      coord = (hssize_t *)calloc((unsigned)(rank * nPixels), sizeof(hssize_t)); 
+      if ( coord == (hssize_t *)NULL )
+	{
+	  sprintf(errbuf,"Cannot allocate memory for pixel coordinates array.\n");
+	  H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+			
+	  return(FAIL);
+	}
+		
+      /* Loop through all pixels */
+      /* ----------------------- */
+      for (i = 0; i < nPixels; i++)
+	{
+			
+	  /* If pixel row & column OK ... */
+	  /* ---------------------------- */
+	  if (pixCol[i] != FAIL && pixRow[i] != FAIL)
+	    {
+	      /* Fill out the array of pixel coordinates */
+	      /* --------------------------------------- */
+	      coord[2 * i]     = (hssize_t)pixRow[i];
+	      coord[2 * i + 1] = (hssize_t)pixCol[i];
+	    }
+	}
+		
+      fspace = H5Dget_space(dataID);
+      if ( fspace == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get the file data space ID.\n");
+	  H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+	  free(coord);
+			  
+	  return(FAIL);
+	}
+		
+		
+      dtype = H5Dget_type(dataID);
+      if ( dtype == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get the datatype ID.\n");
+	  H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+	  free(coord);
+
+	  return(FAIL);
+	}
+
+		
+      /* Select the points/pixels to read */
+      /* -------------------------------- */  
+      status = H5Sselect_elements(fspace, H5S_SELECT_SET, npoints, (const hsize_t *)coord);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot select the pixels to read.\n");
+	  H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+	  free(coord);
+
+	  return(FAIL);
+	}		
+
+      /* Get the memory data type ID */
+      /* --------------------------- */
+      mtype = HE5_EHdtype2mtype(dtype);
+      if ( mtype == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get the memory data type.\n");
+	  H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+	  free(coord);
+			
+	  return(FAIL);
+	}
+
+      /* Read the selected points into the buffer */
+      /* ---------------------------------------  */
+      status = H5Dread(dataID, mtype, mspace, fspace, H5P_DEFAULT, buffer);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot read out the data from the dataset.\n");
+	  H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+	  free(coord);
+			
+	  return(FAIL);
+	}
+		
+		
+      status = H5Tclose(dtype);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the datatype ID.\n");
+	  H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+	  free(coord);
+			
+	  return(FAIL);
+	}
+		
+      status = H5Sclose(mspace);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the memory data space ID.\n");
+	  H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+	  free(coord);
+			
+	  return(FAIL);
+	}
+		
+      status = H5Sclose(fspace);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the file data space ID.\n");
+	  H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+	  free(coord);
+			
+			
+	  return(FAIL);
+	}
+		
+      free(coord);
+		
+		
+    }
+  
+  
+  /* If successful return size of returned data in bytes */
+  /* --------------------------------------------------- */
+  if (dimlist != NULL) free(dimlist);
+  
+  free(errbuf);
+  free(ntype);
+
+ COMPLETION:
+  return( (long)(size * nPixels) );
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinterpolate                                                |
+|                                                                             |
+|  DESCRIPTION: Performs bilinear interpolate on a set of xy values           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nRetn*nValues*  long                Size of data buffer (bytes)            |
+|  sizeof(double)                                                             |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               Grid structure ID                       |
+|  nValues        long                Number of lon/lat points to interpolate |
+|  xyValues       double              XY values of points to interpolate      |
+|  fieldname      char*               Fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  interpVal      double              Interpolated Data Values                |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|             H5Dget_type                                                     |
+|             H5Tequal                                                        |
+|             H5Tclose                                                        |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 98   Abe Taaheri   changed the return value so that the Return Value   |
+|                         is size in bytes for the data buffer which is       |
+|                         float64.                                            |
+|  8/24/99  A.Muslimov    Changed the return type from intn to int   .        |
+|  9/23/99  A.Muslimov    Added proper error handling after function calls.   |
+|                         Removed redundant if(status==0){} brackets.         |
+|  10/18/99 A.Muslimov    Replace memcpy() by memmove() to avoid a problem    |
+|                         when arguments 1 and 2 overlap in memory.           |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Mar  04  S.Zhao        Modified for supported field type.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDinterpolate(hid_t gridID, long nValues, double lonVal[], double latVal[], const char *fieldname, double interpVal[])
+{
+  long              nRetn       =  0;  /* Number of data values returned */
+  long              i, j;              /* loop indices                   */
+  long              idx         = FAIL;/* Grid index                     */
+  long              xdimsize    =  0;  /* XDim size                      */
+  long              ydimsize    =  0;  /* YDim size                      */
+  long              numsize     =  0;  /* Size in bytes of number type   */
+  long              xdim        = FAIL;/* Location of "XDim" in a list   */
+  long              ydim        = FAIL;/* Location of "YDim" in a list   */
+  long              dum         =  0;  /* Dummy variable                 */
+  long              size        =  0;  /* Size of buffer in bytes        */
+  long              pixCol[4];  /* Pixel columns for 4 nearest neighbors */
+  long              pixRow[4];  /* Pixel rows for 4 nearest neighbors    */
+  long              tDen        =  0;/*Interpolation denominator value 1 */
+  long              uDen        =  0;/*Interpolation denominator value 2 */
+  
+  herr_t            status = FAIL;   /* routine return status variable   */
+
+  int               k;               /* Loop indices                     */
+  int               rank = FAIL;     /* Field rank                       */
+  int               iINT[4]={0,0,0,0};/* Working buffer (int)            */
+  int               tmp    = 999;    /* temp variable (for type code)    */
+  int               projcode    = FAIL;/* Projection code                */
+  int               zonecode    = FAIL;/* Zone code                      */
+  int               spherecode  = FAIL;/* Sphere code                    */
+  int               pixregcode  = FAIL;/* Pixel registration code        */
+  int               origincode  = FAIL;/* Origin code                    */
+
+  hid_t             *ntype = (hid_t *)NULL;      /*  number types        */
+
+  hid_t             fid         = FAIL;/* HDF-EOS file ID                */
+  hid_t             gid         = FAIL;/* "HDFEOS" group ID              */
+  hid_t             dataID      = FAIL;/* data field dataset ID          */
+  hid_t             dtype       = FAIL;/* data field datatype ID         */
+  
+  hsize_t           dims[HE5_DTSETRANKMAX];/* Field dimensions           */
+  
+  double            upleftpt[2]={0.,0.};  /* Upper left pt coordinates   */
+  double            lowrightpt[2]={0.,0.};/* Lower right pt coordinates  */
+  double            projparm[16];      /* Projection parameters          */
+  double            xVal        = FAIL;/* "Exact" x location of interpolated point */
+  double            yVal        = FAIL;/* "Exact" y location of interpolated point */
+  double            tNum        =  0.; /* Interpolation numerator value 1          */
+  double            uNum        =  0.; /* Interpolation numerator value 2          */
+  double            fdbl[4]={0.,0.,0.,0.};/* Working buffer (double)               */
+  
+  short             ishort[4]={0,0,0,0};/* Working buffer (short)                  */
+  
+  float             flt[4]={0.,0.,0.,0.};/* Working buffer (float)                 */
+  
+  char              *pixVal  = NULL;    /* Nearest neighbor values                 */
+  char              *dimlist = NULL;    /* Dimension list string                   */
+  char              *errbuf  = NULL;    /* Error message buffer                    */
+    
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(lonVal);
+  CHECKPOINTER(latVal);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDinterpolate", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+  
+  
+  dimlist = (char *)calloc( HE5_HDFE_DIMBUFSIZE, sizeof(char ));
+  if ( dimlist == NULL )
+    {
+      sprintf(errbuf,"Cannot allocate memory for dimension list string.\n");
+      H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  
+  
+  /* Get field information */
+  /* --------------------- */        
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+  if ( ntype == (hid_t *)NULL )
+    {
+      sprintf(errbuf,"Cannot allocate memory for data type class ID.\n");
+      H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+	    
+      return(FAIL);
+    }
+      
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for (k = 0; k < HE5_DTSETRANKMAX; k++)
+    dims[ k ] = 0;
+
+  status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, ntype, dimlist,NULL);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot get information about \"%s\" data field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      free(ntype);
+	    
+      return(FAIL);
+    }
+  
+  
+  /* Check for "XDim" & "YDim" in dimension list */
+  /* ------------------------------------------- */
+  xdim = HE5_EHstrwithin("XDim", dimlist, ',');  
+  if (xdim == FAIL)
+    {
+      sprintf( errbuf, "\"XDim\" not present in dimlist for field: \"%s\".\n", fieldname);
+      H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      free(ntype);
+				
+      return(FAIL);
+				
+    }
+
+  ydim = HE5_EHstrwithin("YDim", dimlist, ',');
+  if (ydim == FAIL)
+    {
+      sprintf( errbuf,"\"YDim\" not present in dimlist for field: \"%s\".\n", fieldname);
+      H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      free(ntype);
+		
+		
+      return(FAIL);
+    }
+  
+  /* If no problems ... */
+  /* ------------------ */
+  
+  /* Compute size of data buffer for each interpolated value */
+  /* ------------------------------------------------------- */
+  dims[xdim] = 1;
+  dims[ydim] = 1;
+  size       = (long)dims[0];
+  
+  for (k = 1; k < rank; k++)
+    size *= (long)dims[ k ];
+  
+  numsize = (long)HE5_GDfielddatasize(gridID, fieldname);
+  if ( numsize == 0 )
+    {
+      sprintf(errbuf,"Cannot get the size of data type.\n");
+      H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      free(ntype);
+
+      return(FAIL);
+    }
+  
+  size *= numsize;
+  
+  nRetn = size / numsize;
+  
+  /* If interpolated values are requested ... */
+  /* ---------------------------------------- */
+  if (interpVal != NULL)
+    {
+      /* Get grid info */
+      /* ------------- */
+      status = HE5_GDgridinfo(gridID, &xdimsize, &ydimsize,upleftpt, lowrightpt);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get information about Grid.\n");
+	  H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+		  
+	  return(FAIL);
+	}
+
+      /* Initialize projparm[] array */
+      /* --------------------------- */
+      for (k = 0; k < 16; k++)
+	projparm[ k ] = 0.;
+		
+      /* Get projection info */
+      /* ------------------- */
+      status = HE5_GDprojinfo(gridID, &projcode, &zonecode,&spherecode, projparm);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get projection information.\n");
+	  H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+			
+	  return(FAIL);
+	}
+		
+      /* Get explicit upleftpt & lowrightpt if defaults are used */
+      /* ------------------------------------------------------- */
+      status = HE5_GDgetdefaults(projcode, zonecode, projparm, spherecode, upleftpt, lowrightpt);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get upleftpt and lowrightpt defaults.\n");
+	  H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+			
+			
+	  return(FAIL);
+	}
+		
+      /* Get pixel registration and origin info */
+      /* -------------------------------------- */
+      status = HE5_GDpixreginfo(gridID, &pixregcode);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get pixel registration information.\n");
+	  H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+			
+	  return(FAIL);
+	}
+		
+      status = HE5_GDorigininfo(gridID, &origincode);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get pixel origin information.\n");
+	  H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(ntype);
+			
+	  return(FAIL);
+	}
+		
+		
+      /* Loop through all interpolated points */
+      /* ------------------------------------ */
+      for (i = 0; i < nValues; i++)
+	{
+	  /* Get row & column of point pixel */
+	  /* ------------------------------- */
+	  status = HE5_GDll2ij(projcode, zonecode, projparm, spherecode,xdimsize, ydimsize, upleftpt, lowrightpt, 1, &lonVal[i], &latVal[i], pixRow, pixCol, &xVal, &yVal);
+	  if ( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot get row and column of point pixel.\n");
+	      H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(dimlist);
+	      free(pixVal);
+	      free(ntype);
+				
+	      return(FAIL);
+	    }
+			
+			
+	  /* Get diff of interp. point from pixel location */
+	  /* --------------------------------------------- */
+	  if (pixregcode == HE5_HDFE_CENTER)
+	    {
+	      tNum = xVal - (pixCol[0] + 0.5);
+	      uNum = yVal - (pixRow[0] + 0.5);
+	    }
+	  else if (origincode == HE5_HDFE_GD_UL)
+	    {
+	      tNum = xVal - pixCol[0];
+	      uNum = yVal - pixRow[0];
+	    }
+	  else if (origincode == HE5_HDFE_GD_UR)
+	    {
+	      tNum = xVal - (pixCol[0] + 1);
+	      uNum = yVal - pixRow[0];
+	    }
+	  else if (origincode == HE5_HDFE_GD_LL)
+	    {
+	      tNum = xVal - pixCol[0];
+	      uNum = yVal - (pixRow[0] + 1);
+	    }
+	  else if (origincode == HE5_HDFE_GD_LR)
+	    {
+	      tNum = xVal - (pixCol[0] + 1);
+	      uNum = yVal - (pixRow[0] + 1);
+	    }
+			
+			
+	  /* Get rows and columns of other nearest neighbor pixels */
+	  /* ----------------------------------------------------- */
+	  pixCol[1] = pixCol[0];
+	  pixRow[3] = pixRow[0];
+			
+	  if (tNum >= 0)
+	    {
+	      pixCol[2] = pixCol[0] + 1;
+	      pixCol[3] = pixCol[0] + 1;
+	    }
+			
+	  if (tNum < 0)
+	    {
+	      pixCol[2] = pixCol[0] - 1;
+	      pixCol[3] = pixCol[0] - 1;
+	    }
+			
+	  if (uNum >= 0)
+	    {
+	      pixRow[2] = pixRow[0] + 1;
+	      pixRow[1] = pixRow[0] + 1;
+	    }
+			
+	  if (uNum < 0)
+	    {
+	      pixRow[2] = pixRow[0] - 1;
+	      pixRow[1] = pixRow[0] - 1;
+	    }
+			
+			
+			
+	  /* Get values of nearest neighbors  */
+	  /* -------------------------------- */
+	  pixVal = (char *)calloc( 4 , size);
+	  if(pixVal == NULL)
+	    {
+	      sprintf(errbuf,"Cannot allocate memory"); 
+	      H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      free(errbuf);
+	      free(dimlist);
+	      free(ntype);
+				
+	      return(FAIL);
+	    }
+			
+	  dum = HE5_GDgetpixvalues(gridID,4,pixRow,pixCol,fieldname,pixVal);
+			
+			
+	  /* Trap interpolation boundary out of range error */
+	  /* ---------------------------------------------- */
+	  if (dum == FAIL)
+	    {
+	      sprintf(errbuf, "Interpolation boundary out of grid.\n");
+	      H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(dimlist);
+	      free(pixVal);
+	      free(ntype);
+				
+	      return(FAIL);
+				
+	    }
+	  else
+	    {
+				
+	      /*
+	       * Algorithm taken for Numerical Recipies in C, 2nd
+	       * edition, Section 3.6
+	       */
+				
+	      /* Perform bilinear interpolation */
+	      /* ------------------------------ */
+	      tDen = pixCol[3] - pixCol[0];
+	      uDen = pixRow[1] - pixRow[0];
+				
+	      status = HE5_GDgetfieldID( gridID, fieldname, &dataID);
+	      if ( status == FAIL )
+		{
+		  sprintf(errbuf,"Cannot get \"%s\" field ID.\n", fieldname);
+		  H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(dimlist);
+		  free(pixVal);
+		  free(ntype);
+					
+		  return(FAIL);
+		}
+				
+	      dtype = H5Dget_type( dataID);
+	      if ( status == FAIL )
+		{
+		  sprintf(errbuf,"Cannot get the dataset datatype.\n");
+		  H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(dimlist);
+		  free(pixVal);
+		  free(ntype);
+					
+		  return(FAIL);
+		}
+				
+				
+	      if ( H5Tequal( dtype, H5T_NATIVE_SHORT) ||
+		   H5Tequal( dtype, H5T_STD_I16BE) ||
+		   H5Tequal( dtype, H5T_STD_I16LE) )
+		tmp = 1;
+	      else if ( H5Tequal(dtype, H5T_NATIVE_INT) ||
+			H5Tequal(dtype, H5T_STD_I32BE) ||
+			H5Tequal(dtype, H5T_STD_I32LE) )
+		tmp = 2;
+	      else if ( H5Tequal(dtype, H5T_NATIVE_FLOAT) ||
+			H5Tequal( dtype, H5T_IEEE_F32BE) ||
+			H5Tequal( dtype, H5T_IEEE_F32LE) )
+		tmp = 3;
+	      else if ( H5Tequal( dtype, H5T_NATIVE_DOUBLE) ||
+			H5Tequal(dtype, H5T_IEEE_F64BE) ||
+			H5Tequal(dtype, H5T_IEEE_F64LE) )
+		tmp = 4;
+				
+	      status = H5Tclose(dtype);
+	      if ( status == FAIL )
+		{
+		  sprintf(errbuf,"Cannot release the datatype ID.\n");
+		  H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(errbuf);
+		  free(dimlist);
+		  free(pixVal);
+		  free(ntype);
+					
+		  return(FAIL);
+		}
+				
+				
+	      switch ( tmp)
+		{
+		case 1:
+					
+					
+		  /* Loop through all returned data values */
+		  /* ------------------------------------- */
+		  for (j = 0; j < nRetn; j++)
+		    {
+		      /* Copy 4 NN values into working array */
+		      /* ----------------------------------- */
+		      for (k = 0; k < 4; k++)
+			{
+			  memmove(&ishort[k],pixVal + j * numsize + k * size, sizeof(short));
+			}
+						
+		      /* Compute interpolated value */
+		      /* -------------------------- */
+		      interpVal[i * nRetn + j] =
+			(1 - tNum / tDen) * (1 - uNum / uDen) *
+			ishort[0] +
+			(tNum / tDen) * (1 - uNum / uDen) *
+			ishort[3] +
+			(tNum / tDen) * (uNum / uDen) *
+			ishort[2] +
+			(1 - tNum / tDen) * (uNum / uDen) *
+			ishort[1];
+		    }
+		  break;
+					
+					
+		case 2:
+					
+		  for (j = 0; j < nRetn; j++)
+		    {
+		      for (k = 0; k < 4; k++)
+			{
+			  memmove(&iINT[k], pixVal + j * numsize + k * size, sizeof(int));
+			}
+						
+		      interpVal[i * nRetn + j] =
+			(1 - tNum / tDen) * (1 - uNum / uDen) *
+			iINT[0] +
+			(tNum / tDen) * (1 - uNum / uDen) *
+			iINT[3] +
+			(tNum / tDen) * (uNum / uDen) *
+			iINT[2] +
+			(1 - tNum / tDen) * (uNum / uDen) *
+			iINT[1];
+		    }
+		  break;
+					
+					
+		case  3:
+					
+		  for (j = 0; j < nRetn; j++)
+		    {
+		      for (k = 0; k < 4; k++)
+			{
+			  memmove(&flt[k], pixVal + j * numsize + k * size, sizeof(float));
+			}
+
+		      interpVal[i * nRetn + j] =
+			(1 - tNum / tDen) * (1 - uNum / uDen) *
+			flt[0] +
+			(tNum / tDen) * (1 - uNum / uDen) *
+			flt[3] +
+			(tNum / tDen) * (uNum / uDen) *
+			flt[2] +
+			(1 - tNum / tDen) * (uNum / uDen) *
+			flt[1];
+		    }
+		  break;
+
+
+		case  4:
+
+		  for (j = 0; j < nRetn; j++)
+		    {
+		      for (k = 0; k < 4; k++)
+			{
+			  memmove(&fdbl[k], pixVal + j * numsize + k * size, sizeof(double));
+			}
+
+		      interpVal[i * nRetn + j] =
+			(1 - tNum / tDen) * (1 - uNum / uDen) *
+			fdbl[0] +
+			(tNum / tDen) * (1 - uNum / uDen) *
+			fdbl[3] +
+			(tNum / tDen) * (uNum / uDen) *
+			fdbl[2] +
+			(1 - tNum / tDen) * (uNum / uDen) *
+			fdbl[1];
+		    }
+		  break;
+
+		default:
+		  {
+		    sprintf(errbuf,"Unknown data type.\n");
+		    H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		    HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    free(errbuf);
+		    free(dimlist);
+		    free(pixVal);
+		    free(ntype);
+					
+		    return(FAIL);
+		  }
+				  
+		}         
+	    }             
+	  free(pixVal);
+	  pixVal  = NULL;
+	}
+                
+    }                    
+  
+  free(dimlist);
+  free(errbuf);
+  errbuf  = NULL;    
+  free(ntype);
+  dimlist = NULL;
+  
+  
+ COMPLETION:
+  /* always return size of double buffer */
+  return ( (long)(nRetn*nValues*sizeof(double)) );	
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDwritelocattr                                               |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with a specified field in |
+|                a grid.                                                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               grid structure ID                       |
+|  fieldname      char*               field name                              |
+|  attrname       char*               attribute name                          |
+|  numtype        hid_t               attribute datatype ID                   |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 00   A.Muslimov    Original development.                               |
+|  Mar 00   A.Muslimov    Changed the ID of field group from gd_id to data_id.|
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_GDwritelocattr(hid_t gridID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t  count[],  void *datbuf)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      fieldID       = FAIL;/* Field-related dataset ID       */
+     
+  long       idx           = FAIL;/* Grid index                     */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+  hid_t      ntype;
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+
+  /* 
+     if numtype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use ntype itself
+  */
+  ntype = HE5_EHconvdatatype(numtype);
+  if(ntype == FAIL)
+    {
+      ntype = numtype;
+    }
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDwritelocattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+		
+      /* Get field ID */
+      /* ------------ */
+      fieldID = H5Dopen(HE5_GDXGrid[idx].data_id, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_GDwritelocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+		
+      /* Call EHattr to perform I/O */
+      /* -------------------------- */
+      status = HE5_EHattr(fieldID, attrname, ntype, count,"w", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write Attribute \"%s\" for the \"%s\" field.\n", attrname, fieldname);
+	  H5Epush(__FILE__, "HE5_GDwritelocattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+		
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_GDwritelocattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDreadlocattr                                                |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with a specified field from a grid.|
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char                field name                              |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 00   A.Muslimov    Original development                                |
+|  Mar 00   A.Muslimov    Changed the ID of field group from gd_id to data_id.|
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDreadlocattr(hid_t gridID, const char *fieldname, const char *attrname, void *datbuf)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+
+  hid_t      ntype         = FAIL;/* hdf5 type data type ID         */
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      fieldID       = FAIL;/* Field-related dataset ID       */
+     
+  long       idx           = FAIL;/* Grid index                     */
+     
+  hsize_t    count[]={0};	   /* array with the number of elements */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer   */
+
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(attrname);
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDreadattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get field ID */
+      /* ------------ */
+      fieldID = H5Dopen(HE5_GDXGrid[idx].data_id, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_GDreadlocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+		
+      /* Call EHattr to perform I/O */
+      /* -------------------------- */
+      status = HE5_EHattr(fieldID, attrname, ntype, count, "r", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" field.\n", attrname,fieldname);
+	  H5Epush(__FILE__, "HE5_GDreadlocattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+        
+      /* Release dataset ID */
+      /* ------------------ */
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_GDreadlocattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+
+		
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDlocattrinfo                                                |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about local attribute (attribute asso-  |
+|                ciated with a specified field) in a grid.                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char*               field name                              |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               attribute data type ID                  |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 00   A.Muslimov    Original Development                                |
+|  Mar 00   A.Muslimov    Changed the ID of field group from gd_id to data_id.|
+|  5/10/00  A.Muslimov    Changed 'H5T_class_t' type to 'int' data type.      |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Feb 03   S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_GDlocattrinfo(hid_t gridID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      fieldID       = FAIL;/* Field-related dataset ID       */
+     
+  long       idx           = FAIL;/* Grid index                     */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(attrname);
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDlocattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get field ID */
+      /* ------------ */
+      fieldID = H5Dopen(HE5_GDXGrid[idx].data_id, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_GDlocattrinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Call EHattrinfo */
+      /* --------------- */
+      status = HE5_EHattrinfo(fieldID, attrname, ntype, count);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" associated with the \"%s\" field.\n", attrname, fieldname);
+	  H5Epush(__FILE__, "HE5_GDlocattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+	  
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_GDlocattrinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+    }
+
+ COMPLETION:
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqdscaleattrs                                             |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list associated with a specified dimension scale   |
+|                in a grid.                                                   |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                number of attributes (-1 if fails)      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char                dimension scale name                    |
+|  attrnames      char                attribute name(s)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                String length of attribute (in bytes)   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  June 10   Abe Taaheri  Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDinqdscaleattrs(hid_t gridID, const char *fieldname, char *attrnames, long *strbufsize)
+{
+  long       nattr         =  0;  /* Number of attributes (return)  */
+  long       idx           = FAIL;/* Grid index                     */    
+  
+  herr_t     status        = FAIL;/* routine return status variable */
+  
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  
+  char       *dtsname      = NULL;/* Buffer for dataset name        */
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];
+  
+  CHECKPOINTER(fieldname);
+  
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDinqdscaleattrs", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Checking for grid ID failed.\n" );
+      H5Epush(__FILE__, "HE5_GDinqdscaleattrs", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtsname = (char *) calloc(HE5_HDFE_NAMBUFSIZE, 1);
+  if( dtsname == NULL)
+    {
+      sprintf(errbuf, "Can not allocate memory.\n");
+      H5Epush(__FILE__, "HE5_GDinqdscaleattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+	
+  strcpy(dtsname,"/HDFEOS/GRIDS/");
+  strcat(dtsname, HE5_GDXGrid[idx].gdname);
+  strcat(dtsname,"/");
+  strcat(dtsname,fieldname);
+
+  nattr = HE5_EHattrcat(fid, dtsname, attrnames, strbufsize);
+	
+  if (dtsname != NULL) free(dtsname);
+    
+ COMPLETION:
+  return(nattr);
+	
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqlocattrs                                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list associated with a specified field in a grid.  |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                number of attributes (-1 if fails)      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char                field name                              |
+|  attrnames      char                attribute name(s)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                String length of attribute (in bytes)   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 00   A.Muslimov    Original development.                               |
+|  Mar 00   A.Muslimov    Changed the field group to "Data Fields".           |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDinqlocattrs(hid_t gridID, const char *fieldname, char *attrnames, long *strbufsize)
+{
+  long       nattr         =  0;  /* Number of attributes (return)  */
+  long       idx           = FAIL;/* Grid index                     */    
+
+  herr_t     status        = FAIL;/* routine return status variable */
+
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+     
+  char       *dtsname      = NULL;/* Buffer for dataset name        */
+  /*  char       *errbuf       = NULL;*//* Buffer for error message       */
+					char       errbuf[HE5_HDFE_ERRBUFSIZE];
+ 
+  CHECKPOINTER(fieldname);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  /*
+    errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+    if(errbuf == NULL)
+    {
+    H5Epush(__FILE__, "HE5_GDinqlocattrs", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+    HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+    return(FAIL);
+    }
+  */
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDinqlocattrs", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Checking for grid ID failed.\n" );
+      H5Epush(__FILE__, "HE5_GDinqlocattrs", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  
+      return(FAIL);
+    }
+
+  dtsname = (char *) calloc(HE5_HDFE_NAMBUFSIZE, 1);
+  if( dtsname == NULL)
+    {
+      sprintf(errbuf, "Can not allocate memory.\n");
+      H5Epush(__FILE__, "HE5_GDinqlocattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  
+      return(FAIL);
+    }
+	
+  strcpy(dtsname,"/HDFEOS/GRIDS/");
+  strcat(dtsname, HE5_GDXGrid[idx].gdname);
+  strcat(dtsname,"/Data Fields/");
+  strcat(dtsname,fieldname);
+
+  nattr = HE5_EHattrcat(fid, dtsname, attrnames, strbufsize);
+	
+  if (dtsname != NULL) free(dtsname);
+    
+ COMPLETION:
+  return(nattr);
+	
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDwritegrpattr                                               |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with "Data Fields" group  |
+|               in a grid.                                                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  attrname       char*               attribute name                          |
+|  numtype        hid_t               attribute data type ID                  |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Mar 00   A.Muslimov    Original development.                               |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDwritegrpattr(hid_t gridID, const char *attrname, hid_t numtype, hsize_t  count[], void *datbuf)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      dataID        = FAIL;/* "Data Fields" group ID         */     
+     
+  long       idx           = FAIL;/* Grid index                     */
+ 	
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/*  Error message buffer   */
+  hid_t      ntype;
+
+  HE5_LOCK;
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+
+  /* 
+     if numtype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use ntype itself
+  */
+  ntype = HE5_EHconvdatatype(numtype);
+  if(ntype == FAIL)
+    {
+      ntype = numtype;
+    }
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDwritegrpattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+	  
+      /* Get "Data Fields" group ID */
+      /* -------------------------- */
+      dataID = H5Gopen(HE5_GDXGrid[idx].gd_id,"Data Fields");
+      if(dataID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data Fields\" group.\n");
+	  H5Epush(__FILE__, "HE5_GDwritegrpattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+		
+      /* Call EHattr to perform I/O */
+      /* -------------------------- */
+      status = HE5_EHattr(dataID, attrname, ntype, count,"w", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write Attribute \"%s\" for the \"Data Fields\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_GDwritegrpattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+	  
+      /* Release group ID */
+      /* ---------------- */
+      status = H5Gclose(dataID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_GDwritegrpattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+	  
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);  
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDreadgrpattr                                                |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with "Data Fields" group in a grid.|
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Mar 00   A.Muslimov    Original development                                |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDreadgrpattr(hid_t gridID, const char *attrname, void *datbuf)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+
+  hid_t      ntype         = FAIL;/* hdf5 type data type ID         */
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      dataID        = FAIL;/* "Data Fields" group ID         */     
+     
+  long       idx           = FAIL;/* Grid index                     */
+     
+  hsize_t    count[]={0};      /* array with the number of elements */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+
+  HE5_LOCK;
+  CHECKPOINTER(attrname);
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDreadgrpattr", &fid, &gid, &idx);	
+  if (status == SUCCEED)
+    {
+      /* Get "Data Fields"  group ID  */
+      /* ---------------------------- */
+      dataID = H5Gopen(HE5_GDXGrid[idx].gd_id, "Data Fields");
+      if(dataID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data Fields\" group.\n");
+	  H5Epush(__FILE__, "HE5_GDreadgrpattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+		
+      /* Call HE5_EHattr to perform I/O */
+      /* ------------------------------ */
+      status = HE5_EHattr(dataID, attrname, ntype, count, "r", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"Data Fields\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_GDreadgrpattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+	  
+      /* Release group ID */
+      /* ---------------- */
+      status = H5Gclose(dataID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_GDreadgrpattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+	  
+		
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgrpattrinfo                                                |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about group attribute (attribute asso-  |
+|                ciated with "Data Fields" group) in a grid.                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               attribute data type ID                  |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Mar 00   A.Muslimov    Original Development                                |
+|  5/10/00  A.Muslimov    Changed 'H5T_class_t' type to 'int' data type.      |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Feb 03   S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_GDgrpattrinfo(hid_t gridID, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      dataID        = FAIL;/* "Data Fields" group ID         */     
+     
+  long       idx           = FAIL;/* Grid index                     */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+
+  CHECKPOINTER(attrname);
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDgrpattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get "Data Fields" group ID */
+      /* -------------------------- */
+      dataID = H5Gopen(HE5_GDXGrid[idx].gd_id, "Data Fields");
+      if(dataID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data Fields\" group.\n");
+	  H5Epush(__FILE__, "HE5_GDgrpattrinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Call HE5_EHattrinfo */
+      /* ------------------- */
+      status = HE5_EHattrinfo(dataID, attrname, ntype, count);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" associated with the \"Data Fields\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_GDgrpattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+	  
+      /* Release group ID */
+      /* ---------------- */
+      status = H5Gclose(dataID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_GDgrpattrinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+	  
+		
+    }
+
+ COMPLETION:
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqgrpattrs                                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list associated with "Data Fields" group in a grid.|
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                number of attributes (-1 if fails)      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  attrnames      char                attribute name(s)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                String length of attribute (in bytes)   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Mar 00   A.Muslimov    Original development.                               |
+|  7/12/00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDinqgrpattrs(hid_t gridID, char *attrnames, long *strbufsize)
+{
+  long       nattr         =  0;  /* Number of attributes (return)  */
+  long       idx           = FAIL;/* Grid index                     */    
+  
+  herr_t     status        = FAIL;/* routine return status variable */
+
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  
+  char       *grpname      = NULL;/* Buffer for group  name         */
+  char       *errbuf       = NULL;/* Buffer for error message       */
+ 
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDinqgrpattrs", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+	
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDinqgrpattrs", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Checking for grid ID failed.\n" );
+      H5Epush(__FILE__, "HE5_GDinqgrpattrs", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	  
+      return(FAIL);
+    }
+  
+  /* Allocate memory for a group name buffer */
+  /* --------------------------------------- */
+  grpname = (char *) calloc(HE5_HDFE_NAMBUFSIZE, 1);
+  if( grpname == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_GDinqgrpattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	  
+      return(FAIL);
+    }
+  
+  /* Construct group pathname string */
+  /* ------------------------------- */
+  strcpy(grpname,"/HDFEOS/GRIDS/");
+  strcat(grpname, HE5_GDXGrid[idx].gdname);
+  strcat(grpname,"/Data Fields");
+  
+  /* search group <grpname> for the number of attributes */
+  /* --------------------------------------------------- */     
+  nattr = HE5_EHattrcat(fid, grpname, attrnames, strbufsize);
+	
+  if (grpname != NULL) free(grpname);
+    
+  
+  free(errbuf);
+  errbuf = NULL;
+  
+  return (nattr);
+	
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDsetextdata                                                 |
+|                                                                             |
+|  DESCRIPTION: Sets external data files.                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               grid  structure ID                      |
+|  filelist       const char*         list of external files                  |
+|  offset         off_t               array of offsets (in bytes) from the    |
+|                                     beginning of the file to the location   |
+|                                     in the file where the data starts       |
+|  size           hsize_t             array of sizes (in bytes) reserved in   |
+|                                     the file for the data.                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 01   A.Muslimov    Original development.                               |
+| 09/13/01  A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_GDsetextdata(hid_t gridID, const char *filelist, off_t offset[], hsize_t size[])
+{
+  herr_t          status       = FAIL;        /* return status variable */
+
+  int             i;                          /* Loop index             */
+
+  hid_t           fid          = FAIL;        /* HDF-EOS file ID        */
+  hid_t           gid          = FAIL;        /* "HDFEOS" group ID      */
+  
+  long            idx          = FAIL;        /* Grid   index           */
+  
+  char            *namebuf     = (char *)NULL;/* File list buffer       */
+  char            *filename    = (char *)NULL;/* File name buffer       */
+  char            *comma       = (char *)NULL;/* Pointer to comma       */
+  char            *errbuf      = (char *)NULL;/* error message buffer   */
+
+  HE5_LOCK;
+  CHECKPOINTER(filelist);
+  CHECKPOINTER(offset);
+  CHECKPOINTER(size);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDsetextdata", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDsetextdata", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDsetextdata", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+		
+      return( status );
+    }
+
+
+  /* Get current dataset creation property list */
+  /* ------------------------------------------ */  
+  if( HE5_GDXGrid[idx].plist == FAIL)
+    HE5_GDXGrid[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+
+
+  /* Allocate space for namebuf, copy dimlist into it, & append comma */
+  /* ---------------------------------------------------------------- */
+  namebuf = (char *)calloc(strlen(filelist) + 64, sizeof(char));
+  if(namebuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDsetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory.");
+      HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /*
+********************************************************************
+*   C H E C K  T H E   C O N T E N T   O F  filelist  S T R I N G  *   
+********************************************************************
+*/
+
+  strcpy(namebuf, filelist);
+  strcat(namebuf, ",");
+
+  /* Find comma */
+  /* ---------- */
+  comma = strchr(namebuf, ',');
+  
+  i = 0;
+  
+  /* Parse the list of file names */
+  /* ---------------------------- */
+  while (comma != NULL)
+    {
+      /* Allocate memory for filename buffer */
+      /* ----------------------------------- */
+      filename = (char *) calloc(comma - namebuf + 1, sizeof(char));
+      if (filename == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for filename. \n") ;
+	  H5Epush(__FILE__, "HE5_GDsetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(namebuf);
+	  return(FAIL);
+	}
+	  
+      /* Copy file list entry to filename */
+      /* -------------------------------- */
+      memmove(filename, namebuf, comma - namebuf);
+      filename[comma-namebuf] = 0;
+	  
+      /* Set the property list */
+      /* --------------------- */
+      status = H5Pset_external(HE5_GDXGrid[idx].plist, filename, offset[i], size[i]);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot set external dataset property list.\n");
+	  H5Epush(__FILE__, "HE5_GDsetextdata", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(namebuf);
+	  free(filename);
+	  return(status);
+	}
+	  
+	  
+      /* Go to next file  entry, find next comma, ... */
+      /* ============================================ */ 
+      memmove(namebuf, comma + 1, strlen(comma + 1) + 1); 
+      comma = strchr(namebuf, ',');
+	  
+      if (filename != NULL) free(filename);
+	  
+      i++;
+    }
+  
+  if (namebuf != NULL) free(namebuf);
+  free(errbuf);
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetextdata                                                 |
+|                                                                             |
+|  DESCRIPTION: Gets external data files information.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfiles         int                 number of external files  SUCCEED,      |
+|                                               (-1) FAIL                     |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               grid structure ID                       |
+|  fieldname      char*               External field name                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  namelength     size_t              Length of each name entry               |
+|  filelist       char*               List of file names                      |
+|  offset         off_t               array of offsets (in bytes) from the    |
+|                                     beginning of the file to the location   |
+|                                     in the file where the data starts       |
+|  size           hsize_t             ARRAY of sizes (in bytes) reserved in   |
+|                                     the file for the data.                  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 01   A.Muslimov    Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_GDgetextdata(hid_t gridID, char *fieldname, size_t namelength, char *filelist, off_t offset[], hsize_t size[])
+{
+  int             nfiles       = FAIL;        /* Number of ext. files   */
+  int             i;                          /* Loop index             */
+  int             found        = 0;	          /* found  flag            */
+
+  size_t          slen         = 0;           /* String length          */
+
+  herr_t          status       = FAIL;        /* return status variable */
+
+  hid_t           fid          = FAIL;        /* HDF-EOS file ID        */
+  hid_t           gid          = FAIL;        /* "HDFEOS" group ID      */
+  hid_t           fieldID      = FAIL;        /* Data field ID          */
+  hid_t           plist        = FAIL;        /* Property list ID       */
+
+  off_t           off          = 0;           /* Offset of data segment */
+ 
+  hsize_t         sz           = 0;           /* Size of data segment   */
+
+  long            idx          = FAIL;        /* Grid index             */
+  
+  char            *filename    = (char *)NULL;/* File name buffer       */
+  char            *errbuf      = (char *)NULL;/*error message buffer    */
+
+  CHECKPOINTER(fieldname);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /*
+**********************************************************
+*  Check for proper grid ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_GDchkgdid(gridID, "HE5_GDgetextdata", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+
+  /* Loop through all data datasets in grid */
+  /* -------------------------------------- */
+  for (i = 0; i < HE5_GDXGrid[ idx ].nDFLD; i++)
+    {
+      /* Get dataset name */
+      /* ---------------- */
+      if( strcmp(fieldname, HE5_GDXGrid[ idx ].ddataset[ i ].name) == 0 )
+	{
+	  found = 1; 
+	  break;
+	} 
+    }
+
+	
+  /* Get dataset ID */
+  /* -------------- */
+  if( found == 1) 
+    {
+      fieldID = HE5_GDXGrid[ idx ].ddataset[ i ].ID; 
+   
+      /* Get the property list ID */
+      /* ------------------------ */
+      plist = H5Dget_create_plist(fieldID);
+      if ( plist == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+	  
+      /* Get the number of external files */
+      /* -------------------------------- */
+      nfiles = H5Pget_external_count(plist);
+      if ( nfiles < 0 )
+	{
+	  sprintf(errbuf, "Cannot get the number of external files.\n");
+	  H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+	  
+
+      /* Allocate memory for file name */
+      /* ----------------------------- */
+      filename = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char));
+      if(filename == NULL)
+	{
+	  H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory.");
+	  HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+	  
+      strcpy(filelist,"");
+	  
+      /* Loop through all external files */
+      /* ------------------------------- */
+      for (i = 0; i < nfiles; i++)
+	{
+	  strcpy(filename,"");
+		  
+	  /* Get the file name, offset, and size */
+	  /* ----------------------------------- */
+	  status = H5Pget_external(plist, i, namelength, filename, &off, &sz);
+	  if( status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot get information about external file.\n");
+	      H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(filename);
+	      return(FAIL);
+	    }
+
+		  
+	  offset[i] = off;
+	  size[i]   = sz;
+		  
+	  strcat(filelist, filename);
+		  
+	  /* Append comma */
+	  /* ------------ */
+	  if (nfiles > 1 && i < nfiles - 1) 
+	    strcat(filelist,",");
+		  
+	}
+	  
+      slen = strlen(filelist);
+	  
+      filelist[slen] = 0;
+	  
+      if (filename != NULL) free(filename);
+	  
+      /* Release property list ID */
+      /* ------------------------ */
+      status = H5Pclose(plist);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot release property list ID.\n");
+	  H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+    }
+  else
+    {
+      nfiles = FAIL;
+      sprintf(errbuf, "Data field \"%s\" not found. \n", fieldname);
+      H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+    
+	
+  free(errbuf);
+
+ COMPLETION:
+  return(nfiles);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDfldnameinfo                                                |
+|                                                                             |
+|  DESCRIPTION: Retrieves actual name of the field                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nameFlag       int     None        return (1) actual name, (0) alias,      |
+|                                                (-1) FAIL                    |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               Grid structure ID                       |
+|  fieldname      char*               name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  actualname     char*               field actual name                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 04    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static int
+HE5_GDfldnameinfo(int gridID, const char *fieldname, char *actualname)
+{
+  int         nameFlag       = FAIL;/* Return value of flag            */
+  int         length         = 0;   /* String length                   */
+  int         fldgroup       = FAIL;/* Field group code                */
+ 
+  hid_t       fid            = FAIL;/* HDF-EOS file ID                 */
+  hid_t       gid            = FAIL;/* "HDFEOS" group ID               */
+  hid_t       groupID        = FAIL;/* data field group ID             */
+ 
+  long        idx            = FAIL;/* grid index                      */
+ 
+  H5G_stat_t  *statbuf = (H5G_stat_t *)NULL;/* buffer for link info    */
+ 
+  herr_t      status         = FAIL;/* routine return status variable  */
+ 
+  char        *namebuf       = NULL;/* Buffer for an actual field name */
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer      */
+  
+  CHECKPOINTER(fieldname);
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and grid index */
+  /* ----------------------------------------------------- */
+  status = HE5_GDchkgdid(gridID, "HE5_GDfldnameinfo", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed.\n");
+      H5Epush(__FILE__, "HE5_GDfldnameinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  statbuf = (H5G_stat_t *)calloc(1, sizeof(H5G_stat_t ));
+ 
+  /* Try to get information about specified field */
+  /* -------------------------------------------- */
+  H5E_BEGIN_TRY {
+    groupID  = HE5_GDXGrid[idx].data_id;
+    fldgroup = HE5_HDFE_DATAGROUP;
+    status   = H5Gget_objinfo(groupID, fieldname, 0, statbuf);
+  }
+  H5E_END_TRY;
+  if (status == FAIL)
+    {
+      nameFlag = FAIL;
+      sprintf(errbuf, "Cannot find \"%s\" field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_GDfldnameinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(statbuf);
+      return(nameFlag);
+    }
+ 
+  /* If the field name is an alias */
+  /* ----------------------------- */
+  if (statbuf->type == H5G_LINK)
+    nameFlag = FALSE;
+  else
+    nameFlag = TRUE;
+ 
+  if (nameFlag == FALSE)
+    {
+      if (actualname != NULL)
+	{
+	  status = HE5_GDaliasinfo(gridID, fldgroup, fieldname, &length, NULL);
+	  if ( status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot get information about alias \"%s\".\n", fieldname);
+	      H5Epush(__FILE__, "HE5_GDfldnameinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+ 
+	  namebuf = (char *)calloc(length, sizeof(char));
+	  if ( namebuf == NULL )
+	    {
+	      sprintf(errbuf, "Cannot allocate memory for namebuf.\n");
+	      H5Epush(__FILE__, "HE5_GDfldnameinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+ 
+	  /* Retrieve information about alias */
+	  /* -------------------------------- */
+	  status = HE5_GDaliasinfo(gridID, fldgroup, fieldname, &length, namebuf);
+	  if ( status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot get information about alias \"%s\".\n", fieldname);
+	      H5Epush(__FILE__, "HE5_GDfldnameinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(namebuf);
+	      return(FAIL);
+	    }
+ 
+	  strcpy(actualname,"");
+	  strcpy(actualname,namebuf);
+	  free(namebuf);
+	}
+    }
+ 
+  if (nameFlag == TRUE)
+    {
+      if (actualname != NULL)
+	{
+	  strcpy(actualname,"");
+	  strcpy(actualname, fieldname);
+	}
+    }
+ 
+  free(statbuf);
+ 
+ COMPLETION: 
+  return(nameFlag);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDsetalias                                                   |
+|                                                                             |
+|  DESCRIPTION:  Defines alias for a specified field name                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    gridID       hid_t                    Grid structure ID                  |
+|    fieldname    char                     Original field name                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    aliaslist    char                     List of aliases for the field name |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Apr 04    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_GDsetalias(hid_t gridID, char *fieldname, const char *aliaslist)
+{
+  herr_t   status     = FAIL;          /* return status variable      */
+ 
+  hid_t    fid        = FAIL;          /* HDF-EOS file ID             */
+  hid_t    gid        = FAIL;          /* "GRIDS"  group ID           */
+  hid_t    groupID    = FAIL;          /* Field group ID              */
+ 
+  long     idx        = FAIL;          /* grid index                  */
+ 
+  char     *buf       = NULL;          /* Pointer to temporary buffer */
+  char     *comma     = NULL;          /* Pointer to comma            */
+  char     *aliasname = NULL;          /* Pointer to the alias name   */
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer        */
+ 
+ 
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(aliaslist);
+ 
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and grid index */
+  /* ----------------------------------------------------- */
+  status = HE5_GDchkgdid(gridID, "HE5_GDsetalias", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed. \n");
+      H5Epush(__FILE__, "HE5_GDsetalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Find out the field group */
+  /* ------------------------ */
+  groupID = HE5_GDXGrid[idx].data_id;
+  if (groupID == FAIL) 
+    {        
+      sprintf(errbuf, "Cannot find \"%s\" field in grid. \n", fieldname);
+      H5Epush(__FILE__, "HE5_GDsetalias", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+ 
+  /* Allocate memory for temporary buffer */
+  /* ------------------------------------ */
+  buf = (char *)calloc(strlen(aliaslist)+64, sizeof(char));
+  if (buf == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for \"buf\". \n");
+      H5Epush(__FILE__, "HE5_GDsetalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+ 
+  /* Make a list like "name1,name2,name3," */
+  /* ------------------------------------- */
+  strcpy(buf,aliaslist);
+  strcat(buf,",");
+ 
+  /* Find first comma and make pointer pointing to it */
+  /* ------------------------------------------------ */
+  comma = strchr(buf, ',');
+  while(comma != NULL)
+    {
+      /* Allocate memory for individual entry */
+      /* ------------------------------------ */
+      aliasname = (char *)calloc(comma-buf+1, sizeof(char));
+      if (aliasname == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for \"aliasname\". \n");
+	  H5Epush(__FILE__, "HE5_GDsetalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (buf != NULL) free(buf);
+	  return(FAIL);
+	}
+         
+      /* Pick up an individual entry and put it to the "aliasname" */
+      /* --------------------------------------------------------- */
+      memmove(aliasname,buf,comma-buf);
+ 
+      /* Create a symbolic link for a specified object */
+      /* --------------------------------------------- */
+      status = H5Glink(groupID, H5G_LINK_SOFT, fieldname, aliasname);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create an alias \"%s\" for \"%s\" field. \n", aliasname, fieldname);
+	  H5Epush(__FILE__, "HE5_GDsetalias", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (aliasname != NULL) free(aliasname);
+	  if (buf != NULL) free(buf);
+	  return(FAIL);
+	}
+ 
+      /* Go to the next name entry */
+      /* ------------------------- */
+       memmove(buf,comma+1,strlen(comma+1)+1); 
+      comma = strchr(buf, ',');
+      if (aliasname != NULL) free(aliasname);
+    }
+ 
+  if (buf != NULL) free(buf);
+         
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+ 
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdropalias                                                  |
+|                                                                             |
+|  DESCRIPTION:  Removes the alias for a specified field name                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    gridID       hid_t                    Grid structure ID                  |
+|    aliasname    char                     Alias name to remove               |
+|    fldgroup     int                      Field group flag                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Apr 04    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_GDdropalias(hid_t gridID, int fldgroup, const char *aliasname)
+{ 
+  herr_t   status     = FAIL;          /* return status variable   */
+ 
+  hid_t    fid        = FAIL;          /* HDF-EOS file ID          */
+  hid_t    gid        = FAIL;          /* "GRIDS"  group ID        */
+  hid_t    groupID    = FAIL;          /* Field group ID           */
+ 
+  long     idx        = FAIL;          /* grid index               */
+ 
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */
+ 
+ 
+  HE5_LOCK;
+  CHECKPOINTER(aliasname);
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and grid index */
+  /* ----------------------------------------------------- */
+  status = HE5_GDchkgdid(gridID, "HE5_GDdropalias", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed. \n");
+      H5Epush(__FILE__, "HE5_GDdropalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get Group ID */
+  /* ------------ */
+  groupID = HE5_GDXGrid[idx].data_id;
+  if (groupID == FAIL)
+    {        
+      sprintf(errbuf, "Invalid input group flag. \n");
+      H5Epush(__FILE__, "HE5_GDdropalias", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Destroy a symbolic link */
+  /* ----------------------- */
+  status = H5Gunlink(groupID, aliasname);
+  if (status == FAIL)
+    {        
+      sprintf(errbuf, "Cannot remove alias named \"%s\". \n", aliasname);
+      H5Epush(__FILE__, "HE5_GDdropalias", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDaliasinfo                                                  |
+|                                                                             |
+|  DESCRIPTION:  Retrieves information about field aliases                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    gridID       hid_t                    Grid structure ID                  |
+|    aliasname    char                     alias name                         |
+|    fldgroup     int                      Field group flag                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    length       int                      Buffer size                        |
+|    buffer       char                     Buffer with original field name    |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Apr 04    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_GDaliasinfo(hid_t gridID, int fldgroup, const char *aliasname, int *length, char *buffer)
+{
+  herr_t        status     = FAIL;               /* return status variable   */
+ 
+  int           type       = FAIL;               /* type-value of an object  */
+ 
+  size_t        size       = 0;                  /* Size of the name buffer  */
+ 
+  hid_t         fid        = FAIL;               /* HDF-EOS file ID          */
+  hid_t         gid        = FAIL;               /* "HDF-EOS"  group ID      */
+  hid_t         groupID    = FAIL;               /* Field group ID           */
+ 
+  long          idx        = FAIL;               /* grid index               */
+ 
+  H5G_stat_t    *statbuf   = (H5G_stat_t *)NULL; /* pointer to a structure   */
+ 
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];     /* Error message buffer     */
+ 
+  CHECKPOINTER(aliasname);
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and grid index */
+  /* ----------------------------------------------------- */
+  status = HE5_GDchkgdid(gridID, "HE5_GDaliasinfo", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for grid ID failed. \n");
+      H5Epush(__FILE__, "HE5_GDaliasinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+ 
+  /* Get the group ID */
+  /* ---------------- */
+  if (fldgroup == HE5_HDFE_DATAGROUP)
+    groupID = HE5_GDXGrid[idx].data_id;
+  else
+    {        
+      sprintf(errbuf, "Invalid input group flag. \n");
+      H5Epush(__FILE__, "HE5_GDaliasinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  if (buffer == NULL)
+    {
+      /* Get the string length of a "real" name  */
+      /* --------------------------------------  */
+      statbuf = (H5G_stat_t *)calloc(1, sizeof(H5G_stat_t));
+      if (statbuf == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for \"statbuf\". \n");
+	  H5Epush(__FILE__, "HE5_GDaliasinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+ 
+      /* Get the Object Info */
+      /* ------------------- */
+      status = H5Gget_objinfo(groupID, aliasname, 0, statbuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get information about \"%s\" alias. \n", aliasname);
+	  H5Epush(__FILE__, "HE5_GDaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+ 
+      /* LINK name length with a null terminator */
+      /* --------------------------------------- */
+      size = statbuf->linklen;
+ 
+      /* Object type (dataset, link, etc) */
+      /* -------------------------------- */
+      type   = statbuf->type;
+ 
+      /* Make sure that the object is a LINK */
+      /* ----------------------------------- */
+      if (type != H5G_LINK)
+	{
+	  sprintf(errbuf,"The object named \"%s\" is not a symbolic link.\n", aliasname);
+	  H5Epush(__FILE__, "HE5_GDaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+         
+      *length = (int)size;
+         
+      if ( statbuf != (H5G_stat_t *)NULL ) free(statbuf);
+         
+    }
+ 
+  if (buffer != NULL)
+    {
+      size = (size_t)*length;
+         
+      /* Get the "real" name by an "alias" */
+      /* --------------------------------- */
+      status = H5Gget_linkval(groupID, aliasname, size, buffer);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get the real name for the alias named \"%s\".\n", aliasname);
+	  H5Epush(__FILE__, "HE5_GDaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+ 
+ COMPLETION:
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqfldalias                                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of fields & aliases and string length of|
+|                fields & aliases list in "Data Fields" group                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfldalias      long                Number of fields & aliases in "Data     |
+|                                     Fields" group.                          |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               Grid structure ID                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fldalias       char*               Fields & aliases names in "Data Fields" |
+|                                     group (Comma-separated list)            |
+|  strbufsize     long*               Fields & aliases name list string length|
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 04    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_GDinqfldalias(hid_t gridID, char *fldalias, long *strbufsize)
+{
+  long            nfldalias   = FAIL;         /* Number of fields & aliases (return)  */
+  long            idx     = FAIL;             /* grid index                     */
+
+  herr_t          status  = FAIL;             /* Return status variable         */
+
+  hid_t           fid     = FAIL;             /* HDF-EOS file ID                */
+  hid_t           gid     = FAIL;             /* "HDF-EOS" group ID             */
+
+  char            *grpname = (char *)NULL;    /* Group name string              */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer           */
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and grid index */
+  /* ----------------------------------------------------- */
+  status = HE5_GDchkgdid(gridID, "HE5_GDinqfldalias", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) );
+      if( grpname == NULL)
+	{
+	  H5Epush(__FILE__, "HE5_GDinqfldalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+	  HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      strcpy(grpname,"/HDFEOS/GRIDS/");
+      strcat(grpname, HE5_GDXGrid[idx].gdname);
+      strcat(grpname,"/Data Fields");
+
+      /* search group with grpname for the number of fields & aliases */
+      /* ------------------------------------------------------------ */
+      nfldalias = HE5_EHdatasetcat(fid,  grpname, fldalias, strbufsize);
+      if ( nfldalias < 0 )
+	{
+	  sprintf(errbuf, "Cannot find the fields & aliases. \n");
+	  H5Epush(__FILE__, "HE5_GDinqfldalias", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	}
+
+      if (grpname != NULL) free(grpname);
+    }
+  else
+    {
+      sprintf(errbuf, "Checking for grid ID failed. \n");
+      H5Epush(__FILE__, "HE5_GDinqfldalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  return (nfldalias);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDll2mm_cea                                                  |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  projcode       int                 GCTP projection code                    |
+|  zonecode       int                 UTM zone code                           |
+|  projparm       long                Projection parameters                   |
+|  spherecode     int                 GCTP spheriod code                      |
+|  xdimsize       long                xdimsize from GDcreate                  |
+|  ydimsize       long                ydimsize from GDcreate                  |
+|  upleftpt       double              upper left corner coordinates  (DMS)    |
+|  lowrightpt     double              lower right corner coordinates (DMS)    |
+|  longitude      long                longitude array (DMS)                   |
+|  latitude       long                latitude array (DMS)                    |
+|  npnts          long                number of lon-lat points                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  x              double              X value array                           |
+|  y              double              Y value array                           |
+|  scaleX         double              X grid size                             |
+|  scaley         double              Y grid size                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer    Description                                        |
+|  ======   ============   =================================================  |
+|  Dec 04   Adura Adekunjo Added support for EASE grid                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_GDll2mm_cea(int projcode,int zonecode, int spherecode,
+		double projparm[],
+		long xdimsize, long ydimsize,
+		double upleftpt[], double lowrightpt[], long npnts,
+		double lon[], double lat[],
+		double x[], double y[], double *scaleX, double *scaleY)
+{
+  herr_t          status = SUCCEED;         /* routine return status variable       */
+#if defined(SGI64) || defined(UNICOS) || defined(LINUX64) || defined(IA64) || defined(MACINTOSH) || defined(MACINTEL) || defined(IBM6000) || defined(CYGWIN) || defined(DEC_ALPHA)
+  int             (*for_trans[100]) (double, double, double *, double *);
+  int            errorcode = 0;         /* GCTP error code                      */
+#else
+  long            (*for_trans[100]) (double, double, double *, double *);
+  long            errorcode = 0;         /* GCTP error code                      */
+#endif
+
+  double       xMtr0, xMtr1, yMtr0, yMtr1;
+  double         lonrad0;    /* Longitude in radians of upleft point */
+  double         latrad0;     /* Latitude in radians of upleft point */
+  double         lonrad;     /* Longitude in radians of point */
+  double         latrad;     /* Latitude in radians of point */
+  
+  char            *errbuf;               /* Buffer for error message             */
+ 
+  /*CHECKPOINTER(upleftpt);
+    CHECKPOINTER(lowrightpt);
+    CHECKPOINTER(longitude);
+    CHECKPOINTER(latitude);*/
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDll2mm_cea", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+ 
+  if(npnts <= 0)
+    {
+      status =  FAIL;
+      sprintf(errbuf,"Improper npnts value\"%li\" must be greater than zero. \n", npnts);
+      H5Epush(__FILE__, "HE5_GDll2mm_cea", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return (status);
+    }
+  if ( projcode == HE5_GCTP_BCEA)
+    {
+      for_init(projcode, zonecode, projparm, spherecode, NULL, NULL,
+	       &errorcode, for_trans);
+      /* Convert upleft and lowright X coords from DMS to radians */
+      /* -------------------------------------------------------- */
+
+      lonrad0 = HE5_EHconvAng(upleftpt[0], HE5_HDFE_DMS_RAD);
+      lonrad = HE5_EHconvAng(lowrightpt[0], HE5_HDFE_DMS_RAD);
+
+      /* Convert upleft and lowright Y coords from DMS to radians */
+      /* -------------------------------------------------------- */
+      latrad0 = HE5_EHconvAng(upleftpt[1], HE5_HDFE_DMS_RAD);
+      latrad = HE5_EHconvAng(lowrightpt[1], HE5_HDFE_DMS_RAD);
+
+      /* Convert from lon/lat to meters(or whatever unit is, i.e unit
+	 of r_major and r_minor) using GCTP */
+      /* ----------------------------------------- */
+      errorcode = for_trans[projcode] (lonrad0, latrad0, &xMtr0, &yMtr0);
+      x[0] = xMtr0;
+      y[0] = yMtr0;
+
+      /* Report error if any */
+      /* ------------------- */
+      if (errorcode != 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDll2mm_cea", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+    
+      /* Convert from lon/lat to meters(or whatever unit is, i.e unit
+	 of r_major and r_minor) using GCTP */
+      /* ----------------------------------------- */
+      errorcode = for_trans[projcode] (lonrad, latrad, &xMtr1, &yMtr1);
+      x[1] = xMtr1;
+      y[1] = yMtr1;
+
+      /* Report error if any */
+      /* ------------------- */
+      if (errorcode != 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+	  H5Epush(__FILE__, "HE5_GDll2mm_cea", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+      /* Compute x scale factor */
+      /* ---------------------- */
+      *scaleX = (xMtr1 - xMtr0) / xdimsize;
+
+      /* Compute y scale factor */
+      /* ---------------------- */
+      *scaleY = (yMtr1 - yMtr0) / ydimsize;
+    }
+  else
+    {
+      status = FAIL;
+      sprintf(errbuf, "Wrong projection code; this function is only for EASE grid \n");
+      H5Epush(__FILE__, "HE5_GDll2mm_cea", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return (status);
+    }
+
+
+  if (errbuf != NULL) free(errbuf);
+ COMPLETION:
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDmm2ll_cea                                                  |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  projcode       int                 GCTP projection code                    |
+|  zonecode       int                 UTM zone code                           |
+|  projparm       double              Projection parameters                   |
+|  spherecode     int                 GCTP spheriod code                      |
+|  xdimsize       long                xdimsize from GDcreate                  |
+|  ydimsize       long                ydimsize from GDcreate                  |
+|  upleftpt       double              upper left corner coordinates (DMS)     |
+|  lowrightpt     double              lower right corner coordinates (DMS)    |
+|  x              double              X value array                           |
+|  y              double              Y value array                           |
+|  npnts          long                number of x-y points                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  longitude      double                longitude array (DMS)                 |
+|  latitude       double                latitude array (DMS)                  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer     Description                                       |
+|  ======   ============    ===============================================   |
+|  Dec 04   Adura Adekunjo  Added support for EASE grid                       |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_GDmm2ll_cea(int projcode,int zonecode, int spherecode, double projparm[],
+		long xdimsize, long ydimsize,
+		double  upleftpt[], double lowrightpt[], long npnts,
+		double x[], double  y[],
+		double longitude[], double latitude[])
+{
+  herr_t          status = FAIL;         /* routine return status variable       */
+      
+  /*
+    #if defined(SGI64) || defined(UNICOS) || defined(LINUX64) || defined(IA64) || defined(MACINTOSH) || defined(MACINTEL) || defined(IBM6000) || defined(CYGWIN) || defined(DEC_ALPHA)
+    int             (*for_trans[100]) (double, double, double *, double *);
+    #else
+    long            (*for_trans[100]) (double, double, double *, double *);
+    #endif
+  */
+
+#if defined(SGI64) || defined(UNICOS) || defined(LINUX64) || defined(IA64) || defined(MACINTOSH) || defined(MACINTEL) || defined(IBM6000) || defined(CYGWIN) || defined(DEC_ALPHA)
+  int             (*inv_trans[100]) (double, double, double*, double*);
+  int              errorcode = 0;      /* GCTP error code */
+#else
+  long            (*inv_trans[100]) (double, double, double*, double*);
+  long             errorcode = 0;      /* GCTP error code */
+#endif
+
+  int            i;
+  char            *errbuf;               /* Buffer for error message             */
+
+  CHECKPOINTER(upleftpt);
+  CHECKPOINTER(lowrightpt);
+  CHECKPOINTER(longitude);
+  CHECKPOINTER(latitude);
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDmm2ll_cea", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  if(npnts <= 0)
+    {
+      status =  FAIL;
+      sprintf(errbuf,"Improper npnts value\"%li\" must be greater than zero. \n", npnts);
+      H5Epush(__FILE__, "HE5_GDmm2ll_cea", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return (status);
+    }
+  
+  if ( projcode == HE5_GCTP_BCEA)
+    {
+      inv_init(projcode, zonecode, projparm, spherecode, NULL, NULL, &errorcode, inv_trans);
+     
+      /* Convert from meters(or whatever unit is, i.e unit
+	 of r_major and r_minor) to lat/lon using GCTP */
+      /* ----------------------------------------- */
+  
+      for(i=0; i<npnts; i++)
+	{
+	  errorcode =
+	    inv_trans[projcode] (x[i], y[i],&longitude[i], &latitude[i]);
+	  /* Report error if any */
+	  /* ------------------- */
+	  if (errorcode != 0)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "GCTP Error: %li\n", errorcode);
+	      H5Epush(__FILE__, "HE5_GDmm2ll_cea", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return (status);
+	    }
+ 
+	  longitude[i] = HE5_EHconvAng(longitude[i], HE5_HDFE_RAD_DMS);
+	  latitude[i] = HE5_EHconvAng(latitude[i], HE5_HDFE_RAD_DMS);
+	}
+    }
+  else
+    {
+      status = FAIL;
+      sprintf(errbuf, "Wrong projection code; this function is only for EASE grid \n");
+      H5Epush(__FILE__, "HE5_GDmm2ll_cea", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return (status);
+    }
+
+
+  if (errbuf != NULL) free(errbuf);
+ COMPLETION:
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetaliaslist                                               |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of aliases and the list of aliases in   |
+|                "Data Fields" group                                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nalias         long                number of aliases in "Data Fields"      |
+|                                     group                                   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t               grid structure ID                       |
+|  fldgroup       int                 field group flag                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  aliaslist      char*               list of aliases in "Data Fields" group  |
+|                                     (comma-separated list)                  |
+|  strbufsize     long*               length of aliases list                  |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 05    S.Zhao       Original development                                |
+|  Mar 06    Abe Taaheri  Added code to get alias strbufsize only when user   |
+|                         passes aliaslist as NULL pointer                    |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_GDgetaliaslist(hid_t gridID, int fldgroup, char *aliaslist, long *strbufsize)
+{
+  long            nalias  = FAIL;             /* Number of aliases (return)  */
+  long            idx     = FAIL;             /* Grid index                  */
+  herr_t          status  = FAIL;             /* Return status variable      */
+  hid_t           fid     = FAIL;             /* HDF-EOS file ID             */
+  hid_t           gid     = FAIL;             /* "HDF-EOS" group ID          */
+  char            *fieldlist = (char *)NULL;  /* List of Data fields         */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer        */
+  long            fldstrbuf = FAIL;           /* Buffer size for Data fields */
+  long            nflds   = FAIL;             /* Number of Data fields       */
+  long            nfldalias = FAIL;           /* Number of fields & aliases  */
+  char            *fldalias = (char *)NULL;   /* List of fields & aliases    */
+  long            fldaliasbuf = FAIL;         /* Buffer size for fields & 
+						 aliases */
+  char            *buff   = (char *)NULL;     /* Pointer to temporary buffer */
+  char            *comma  = (char *)NULL;     /* Pointer to comma            */
+  char            *comma1 = (char *)NULL;     /* Pointer to comma            */
+  char            *nameptr = (char *)NULL;    /* Pointer to each name        */
+  char            *tmpbuf  = (char *)NULL;    /* Pointer to temp buffer      */
+  long            nameflag = FAIL;            /* Name flag                   */
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Grid index */
+  /* ----------------------------------------------------- */
+  status = HE5_GDchkgdid(gridID, "HE5_GDgetaliaslist", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      /* If aliaslist and strbufsize desired */
+      /* ----------------------------------- */
+      if (fldgroup == HE5_HDFE_DATAGROUP)
+	{
+	  /* Call "HE5_GDnentries" routine to get number of fields */
+	  /* ----------------------------------------------------- */
+	  nflds = HE5_GDnentries(gridID, HE5_HDFE_NENTDFLD, &fldstrbuf);
+	  if (nflds == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  
+	  /* Allocate memory for fields list buffer */
+	  /* -------------------------------------- */
+	  fieldlist = (char *) calloc(fldstrbuf+6, sizeof(char));
+	  if(fieldlist == NULL)
+	    {
+	      sprintf(errbuf,"Cannot allocate memory.\n");
+	      H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, 
+		      H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  
+	  /* Call "HE5_GDinqfields" routine to get the list of Data fields */
+	  /* ------------------------------------------------------------- */
+	  nflds = HE5_GDinqfields(gridID, fieldlist, NULL, NULL);
+	  if (nflds == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the list of fields in \"Data Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      return(FAIL);
+	    }
+	  
+	  /* Call "HE5_GDinqfldalias" routine to get number of fields & 
+	     aliases */
+	  /* -------------------------------------------------------- */
+	  nfldalias = HE5_GDinqfldalias(gridID, NULL, &fldaliasbuf);
+	  if (nfldalias == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the number of fields & aliases in \"Data Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      return(FAIL);
+	    }
+	  
+	  /* Allocate memory for fields & aliases list buffer */
+	  /* ------------------------------------------------ */
+	  fldalias = (char *) calloc(fldaliasbuf+6, sizeof(char));
+	  if(fldalias == NULL)
+	    {
+	      sprintf(errbuf,"Cannot allocate memory.\n");
+	      H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, 
+		      H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      return(FAIL);
+	    }
+	  
+	  /* Call "HE5_GDinqfldalias" routine to get the list of fields & 
+	     aliases */
+	  /* ----------------------------------------------------------- */
+	  nfldalias = HE5_GDinqfldalias(gridID, fldalias, &fldaliasbuf);
+	  if (nfldalias == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the list of fields & aliases in \"Data Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      free(fldalias);
+	      return(FAIL);
+	    }
+	  
+	  *strbufsize = strlen(fldalias) - strlen(fieldlist);
+	  if (*strbufsize <= 0)
+	    {
+	      sprintf(errbuf, "Cannot find the aliases.\n");
+	      H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, 
+		      H5E_OHDR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      free(fldalias);
+	      return(FAIL);
+	    }
+	  else
+	    {
+	      nalias = 0;
+	      
+	      /* Allocate memory for temporary buffer */
+	      /* ------------------------------------ */
+	      buff = (char *)calloc(strlen(fldalias)+6, sizeof(char));
+	      if (buff == NULL)
+		{
+		  sprintf(errbuf, "Cannot allocate memory for \"buff\". \n");
+		  H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, 
+			  H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(fieldlist);
+		  free(fldalias);
+		  return(FAIL);
+		}
+	      
+	      /* Allocate memory for aliases */
+	      /* --------------------------- */
+	      tmpbuf = (char *)calloc(*strbufsize+6, sizeof(char));
+	      if (tmpbuf == NULL)
+		{
+		  sprintf(errbuf, "Cannot allocate memory for \"tmpbuf\". \n");
+		  H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, 
+			  H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(fieldlist);
+		  free(fldalias);
+		  free(buff);
+		  return(FAIL);
+		}
+	      
+	      strcpy(buff, fldalias);
+	      strcat(buff, ",");
+	      strcat(fieldlist, ",");
+	      
+	      /* Find first comma and make pointer pointing to it */
+	      /* ------------------------------------------------ */
+	      comma = strchr(buff, ',');
+	      while(comma != NULL)
+		{
+		  /* Allocate memory for individual entry */
+		  /* ------------------------------------ */
+		  nameptr = (char *)calloc(comma-buff+6, sizeof(char));
+		  if (nameptr == NULL)
+		    {
+		      sprintf(errbuf, "Cannot allocate memory for \"nameptr\". \n");
+		      H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, 
+			      H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(fieldlist);
+		      free(fldalias);
+		      free(buff);
+		      free(tmpbuf);
+		      return(FAIL);
+		    }
+		  
+		  /* Pick up an individual entry and put it to the "nameptr" */
+		  /* ------------------------------------------------------- */
+		  memmove(nameptr,buff,comma-buff);
+		  strcat(nameptr, ",");
+		  
+		  nameflag = (strstr(fieldlist,nameptr) == NULL) ? 1 : 0;
+		  if (nameflag == 1)
+		    {
+		      comma1 = strchr(tmpbuf, ',');
+		      if(comma1 == NULL)
+			strcpy(tmpbuf, nameptr);
+		      else
+			strcat(tmpbuf, nameptr);
+		      
+		      nalias++;
+		    }
+		  
+		  memmove(buff,comma+1,strlen(comma+1)+1); 
+		  comma = strchr(buff, ',');
+		  
+		  if (nameptr != NULL) free(nameptr);
+		}
+	    }
+	  
+	  if(aliaslist == NULL)/* just return buffersize 
+				  and number of aliases */
+	    {
+	      if(nalias > 0 )
+		{
+		  if (fieldlist != NULL) free(fieldlist);
+		  if (fldalias != NULL) free(fldalias);
+		  if (buff != NULL) free(buff);
+		  if (tmpbuf != NULL) free(tmpbuf);
+		  return (nalias);
+		}
+	      else
+		{
+		  sprintf(errbuf, "Cannot find the aliases.\n");
+		  H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, 
+			  H5E_OHDR, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if(fieldlist != NULL) free(fieldlist);
+		  if(fldalias != NULL) free(fldalias);
+		  if (buff != NULL) free(buff);
+		  if (tmpbuf != NULL) free(tmpbuf);
+		  return(FAIL);
+		}
+	    }
+	  else
+	    {
+	      if(nalias > 0 )
+		{
+		  strncpy(aliaslist, tmpbuf, *strbufsize-1);
+		  aliaslist[*strbufsize-1] = '\0';
+		}
+	      else
+		{
+		  sprintf(errbuf, "Cannot find the aliases.\n");
+		  H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, 
+			  H5E_OHDR, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if(fieldlist != NULL) free(fieldlist);
+		  if(fldalias != NULL) free(fldalias);
+		  if (buff != NULL) free(buff);
+		  if (tmpbuf != NULL) free(tmpbuf);
+		  return(FAIL);
+		}
+	    }
+	}
+      else
+	{
+	  sprintf(errbuf, "Invalid input field group flag. \n");
+	  H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, H5E_OHDR, 
+		  H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	} 
+    }
+  else
+    {
+      sprintf(errbuf, "Checking for grid ID failed. \n");
+      H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, H5E_FUNC, 
+	      H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  if (fieldlist != NULL) free(fieldlist);
+  if (fldalias != NULL) free(fldalias);
+  if (buff != NULL) free(buff);
+  if (tmpbuf != NULL) free(tmpbuf);
+  
+  return (nalias);
+}
+
+
+
+/* 
+*****************************************************************************
+|                                                                           |
+|          F  O  R  T  R  A  N  7 7     W  R  A  P  P  E  R  S              |
+|                                                                           |
+*****************************************************************************
+*/
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDopenF   (FORTRAN wrapper)                                  |
+|                                                                             |
+|  DESCRIPTION: Opens or creates HDF file in order to create, read, or write  |
+|                a grid.                                                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  FileID         int     None        HDF-EOS file ID                         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  filename       char*   None        Filename                                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/28/00  A. Muslimov                                                       |
+|  3/13/02  A. Muslimov   Added "Flags" options for core metadata.            |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDopenF(char *filename, int Flags)
+{
+  int       FileID  = FAIL;/* Return file ID        */
+
+  hid_t     fid     = FAIL;/* hdf5 type file ID     */ 
+
+  uintn     flags   = 9999;/* HDF5 file access code */
+ 
+  char      *errbuf = NULL;/* Error message buffer  */
+
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDopenF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }  
+  
+  /* Set up the file access flag */
+  /* --------------------------- */
+  if (Flags == HE5F_ACC_RDWR || Flags == HDF5_ACC_RDWR) flags = H5F_ACC_RDWR;
+  else if (Flags == HE5F_ACC_RDONLY || Flags == HDF5_ACC_RDONLY) flags = H5F_ACC_RDONLY;
+  else if (Flags == HE5F_ACC_TRUNC || Flags == HDF5_ACC_CREATE) flags = H5F_ACC_TRUNC;
+  else
+    {
+      sprintf(errbuf, "File access flag is not supported. \n");
+      H5Epush(__FILE__, "HE5_GDopenF", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }  
+
+
+  /* Call HE5_GDopen to perform file access */
+  /* -------------------------------------- */
+  fid = HE5_GDopen(filename,flags);
+  if(fid == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_GDopen() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_GDopenF", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }  
+
+
+  FileID = (int)fid;
+
+  free(errbuf);
+
+  return(FileID);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDcreateF    (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Creates a grid within the file.                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  GridID         int     None        Grid structure ID                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int     None        File ID                                 |
+|  gridname       char    None        Grid structure name                     |
+|  xdimsize       long    None        Number of columns in grid               |
+|  ydimsize       long    None        Number of rows in grid                  |
+|  upleftpt       double  None        Location (m/deg) of upper left corner   |
+|  lowrightpt     double  None        Location (m/deg) of lower right corner  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/28/00  A. Muslimov                                                       |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_GDcreateF(int FileID, char *gridname, long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[])
+{
+  int             GridID    = FAIL;/* grid ID (return value)              */
+
+  hid_t           gridID    = FAIL;/* HDF5 type grid ID                   */
+  hid_t           fid       = FAIL;/* HDF5 type file ID                   */
+
+  char            *errbuf   = (char *)NULL; /* Buffer for error message   */
+
+  errbuf  = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char) );
+  if (errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDcreateF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  fid = (hid_t)FileID;
+
+  gridID = HE5_GDcreate(fid, gridname, xdimsize, ydimsize, upleftpt, lowrightpt);
+  if (gridID == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_GDcreate() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_GDcreateF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  free(errbuf);
+
+  GridID = (int)gridID;
+  return(GridID);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDattachF    (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Attaches to an existing grid within the file.                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  GridID         int     None        HDF-EOS type grid  ID                   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int     None        HDF-EOS file id                         |
+|  gridname       char*   None        grid sructure name                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDattachF(int FileID, char *gridname)
+{
+  int             GridID  = FAIL;	/* Return value of the Grid ID    */
+
+  hid_t           gridID  = FAIL;	/* HDF5 type Grid  ID             */
+  hid_t           fid     = FAIL;	/* HDF5 type file ID              */
+
+  char            *errbuf = (char *)NULL;/* Buffer for error message  */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDattachF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  
+  fid = (hid_t)FileID;
+
+  gridID = HE5_GDattach(fid, gridname);
+  if(gridID == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_GDattach() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__,  "HE5_GDattachF", __LINE__,H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  GridID = (int)gridID;
+  return(GridID);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdetachF    (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Detaches from grid interface and performs file housekeeping.  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        HDF-EOS type grid  ID                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|             H5Dclose                                                        |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_GDdetachF(int GridID)
+{
+  int             ret    = FAIL;/* (int) Return status variable   */
+
+  herr_t          status = FAIL;/* routine return status variable */    
+    
+  hid_t           gridID = FAIL;/* HDF5 type grid ID              */
+
+  char            *errbuf = (char *)NULL;/*Error message buffer   */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdetachF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDdetach(gridID);
+  if(status == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_GDdetach() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_GDdetachF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+	
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDcloseF     (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Closes file.                                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int                 HDF-EOS type file ID                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_GDcloseF(int FileID)
+{
+  int               ret    = FAIL;/* (int) return status variable   */
+
+  hid_t             fid    = FAIL;/* HDF5 type file ID              */
+
+  herr_t            status = FAIL;/* routine return status variable */
+
+  char              *errbuf = (char *)NULL;/*Error message buffer   */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDcloseF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  fid = (hid_t)FileID;
+
+  /* Call HE5_GDclose to perform file close */
+  /* -------------------------------------- */
+  status = HE5_GDclose(fid);
+  if(status == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_GDclose() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_GDcloseF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+	
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefdimF                                                    |
+|                                                                             |
+|  DESCRIPTION: Defines numerical value of dimension (FORTRAN wrapper)        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int      None        return status (0) SUCCEED, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GrdiID         int                 grid structure ID                       |
+|  dim. name      char                dimension name                          |
+|  dim. size      long                dimension size                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 00   D.Wynne       Original Version                                    |
+|  Aug 00   A.Muslimov    Updated to reflect data type changes.               |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDdefdimF(int GridID,  char *dimname, long dim)
+{
+  int          ret     = SUCCEED;
+
+  herr_t       status  = SUCCEED;
+
+  hid_t        gridID  = FAIL;
+
+  hsize_t      tdim    = 0;
+
+  char         *errbuf = (char *)NULL;
+ 
+ 
+  errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+ 
+  tdim = (hsize_t)dim;
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDdefdim(gridID, dimname, tdim);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Error calling HE5_GDdefdim from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_GDdefdimF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+ 
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefprojF    (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Defines projection of grid.                                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units       Description                           |
+|  ============   ======    =========   ===================================== |
+|  ret            int       None        return status (0) SUCCEED, (-1) FAIL  |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int       None        HDF-EOS type grid  ID                 |
+|  projcode       int                   GCTP projection code                  |
+|  zonecode       int                   UTM zone code                         |
+|  spherecode     int                   GCTP spheriod code                    |
+|  projparm       double                Projection parameters                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_GDdefprojF(int GridID, int projcode, int zonecode,  int spherecode, double projparm[])
+{
+  int             ret      = FAIL;      /* routine return status variable */  
+
+  herr_t          status   = FAIL;      /* routine return status variable */  
+
+  hid_t           gridID   = FAIL;      /* HDF5 type grid ID              */
+
+  char            *errbuf = (char *)NULL;/* Buffer for error message      */
+  
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdefprojF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDdefproj(gridID, projcode, zonecode, spherecode, projparm);
+  if(status == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_GDdefproj() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDdefprojF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+
+  
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdeforiginF   (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION: Defines the origin of the grid data.                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        Grid ID                                 |
+|  origincode     int                 origin code                             |
+|                                     HDFE_GD_UL (0)                          |
+|                                     HDFE_GD_UR (1)                          |
+|                                     HDFE_GD_LL (2)                          |
+|                                     HDFE_GD_LR (3)                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_GDdeforiginF(int GridID, int origincode)
+{
+  int             ret     = FAIL;/* routine return status variable   */
+
+  herr_t          status  = FAIL;/* routine return status variable   */
+
+  hid_t           gridID  = FAIL;/* HDF5 type grid ID                */
+
+  char            *errbuf = (char *)NULL;/* Buffer for error message */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdeforigin", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDdeforigin(gridID, origincode);
+  if ( status == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_GDdeforigin() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDdeforiginF", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	  
+      return(FAIL);
+    }
+  
+
+  free(errbuf);
+
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdeffld                                                     |
+|                                                                             |
+|                                                                             |
+|  DESCRIPTION: Defines data field within grid structure (FORTRAN)            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 Grid  structure ID                      |
+|  fieldname      char                fieldname                               |
+|  fortdimlist    char                Dimension list (comma-separated list)   |
+|                                         FORTRAN dimesion order              |
+|  fortmaxdimlist char                Max Dimension list (FORTRAN order)      |
+|  numtype        int                 field type                              |
+|  merge          int                 merge code                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 00   D.Wynne       Modified for HDF5                                   |
+|  Aug 00   A.Muslimov    Updated to reflect data type changes.               |
+|  Nov 00   A.Muslimov    Updated to reverse order of "fortmaxdimlist"entries.|
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDdeffld(int GridID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int numtype, int merge)
+{
+  int          ret    = SUCCEED;/* routine return status variable  */
+
+  herr_t       status = SUCCEED;/* routine return status variable  */
+
+  hid_t        gridID   = FAIL;/* HDF5 type grid ID                */
+  hid_t        numbertype = FAIL;/* HDF5 type data type ID         */
+
+  char         *dimlist = (char *)NULL;/* Dimension list (C order) */
+  char         *maxdimlist = (char *)NULL;/* Max. Dim. list (C)    */
+  char         *errbuf  = (char *)NULL;/* error message buffer     */
+
+   
+ 
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdeffld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+   
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_EHconvdatatype() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDdeffld", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+   
+  if(strcmp(fortmaxdimlist,"") == 0)
+    fortmaxdimlist = NULL;
+
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  dimlist = (char *)calloc(strlen(fortdimlist) + 1, sizeof(char));
+  if(dimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for dimlist.\n");
+      H5Epush(__FILE__, "HE5_GDdeffld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+   
+
+  /* Reverse entries in dimension list (FORTRAN -> C) */
+  /* ------------------------------------------------ */
+  status = HE5_EHrevflds(fortdimlist, dimlist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_EHrevflds() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDdeffld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+
+      return(FAIL);
+    }
+
+   
+  if (fortmaxdimlist != NULL)
+    {
+      /* Allocate space for C order dimension list */
+      /* ----------------------------------------- */
+      maxdimlist = (char *)calloc(strlen(fortmaxdimlist) + 1, sizeof(char));
+      if(maxdimlist == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for maxdimlist.\n");
+	  H5Epush(__FILE__, "HE5_GDdeffld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  return(FAIL);
+	}
+   
+      /* Reverse entries in maximum dimension list (FORTRAN -> C) */
+      /* -------------------------------------------------------- */
+      status = HE5_EHrevflds(fortmaxdimlist, maxdimlist);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Error calling HE5_EHrevflds() from FORTRAN wrapper.\n");
+	  H5Epush(__FILE__, "HE5_GDdeffld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(maxdimlist);
+		   
+	  return(FAIL);
+	}
+    }
+  else 
+    {
+      maxdimlist = NULL;
+    }
+   
+
+  gridID = (hid_t)GridID;
+   
+  /* Call Define Field routine */
+  /* ------------------------- */
+  status = HE5_GDdeffield(gridID, fieldname, dimlist, maxdimlist, numbertype, merge);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_GDdeffld() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDdeffld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      if (maxdimlist !=NULL) 
+	free(maxdimlist);
+
+      return(FAIL);
+    }
+
+   
+   
+  free(dimlist);
+  if (maxdimlist !=NULL) 
+    free(maxdimlist);
+   
+  free(errbuf);
+   
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDsetfill     (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Sets fill value for the specified field.                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 grid structure ID                       |
+|  fieldname      char*               field name                              |
+|  fillval        void*               fill value                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDsetfill(int GridID, char *fieldname, int numtype, void *fillval)
+{
+  int       ret    = FAIL;/* (int) return status variable   */
+
+  herr_t    status = FAIL;/* routine return status variable */
+
+  hid_t     gridID = FAIL;/* HDF5 type grid ID              */
+  hid_t     ntype  = FAIL;/* HDF5 type data type ID         */
+ 
+  char      *errbuf  = (char *)NULL;/* error message buffer */
+
+   
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDsetfill", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+   
+  ntype = HE5_EHconvdatatype(numtype);
+  if(ntype == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_EHconvdatatype() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDsetfill", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+  
+  status = HE5_GDsetfillvalue(gridID, fieldname, ntype, fillval);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_GDsetfillvalue() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDsetfill", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }  
+
+
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdeftileF                                                   |
+|                                                                             |
+|  DESCRIPTION: Defines tiling parameters, FORTRAN wrapper for GDdeftile      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        HDF-EOS type grid  ID                   |
+|  tilecode       int                 tile code                               |
+|  tilerank       int                 number of tiling dimensions             |
+|  tiledims       long                tiling dimensions                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|  None                                                                       |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 00   D.Wynne       Original Version                                    |
+|  Aug 00   A.Muslimov    Updated to reflect data type changes                |
+|  Jan 01   A.Muslimov    Added proper FORTRAN to C dimension order conversion|
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_GDdeftileF(int GridID, int  tilecode, int tilerank, long *tiledims)
+{
+  int		ret     = FAIL;           /* (int) return status  */
+  int		i       = 0;              /* Loop index           */
+
+  hid_t     gridID  = FAIL;           /* HDF5 type grid ID    */
+
+  herr_t	status  = FAIL;           /* return status        */
+
+  hsize_t	*tdims  = (hsize_t *)NULL;/* size variable        */  
+
+  char      *errbuf = (char *)NULL;   /* error message buffer */
+
+
+  errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdeftileF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  
+  tdims = (hsize_t *)calloc(tilerank, sizeof(hsize_t));
+  if(tdims == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tdims.\n");
+      H5Epush(__FILE__, "HE5_GDdeftileF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }  
+  
+  /* Convert from FORTRAN to C dimension order */
+  /* ----------------------------------------- */
+  for(i = 0; i < tilerank; i++)
+    tdims[i] = (hsize_t)tiledims[tilerank - 1 - i];
+
+
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDdeftile(gridID, tilecode, tilerank, tdims);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Error calling HE5_GDdeftile() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_GDdeftileF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(tdims);
+      return(FAIL);
+    }
+ 
+  
+  free(tdims);
+  free(errbuf);
+
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefcompF    (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Defines compression type and parameters                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        HDF-EOS type grid  ID                   |
+|  compcode       int                 compression code                        |
+|  compparm       int                 compression parameters                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:   Before calling this function, storage must be CHUNKED             |
+|                      Values of compression code                             |
+|                         HDFE_COMP_NONE                  0                   |
+|                         HDFE_COMP_RLE                   1                   |
+|                         HDFE_COMP_NBIT                  2                   |
+|                         HDFE_COMP_SKPHUFF               3                   |
+|                         HDFE_COMP_DEFLATE               4                   |
+|                         HDFE_COMP_SZIP_CHIP             5                   |
+|                         HDFE_COMP_SZIP_K13              6                   |
+|                         HDFE_COMP_SZIP_EC               7                   |
+|                         HDFE_COMP_SZIP_NN               8                   |
+|                         HDFE_COMP_SZIP_K13orEC          9                   |
+|                         HDFE_COMP_SZIP_K13orNN          10                  |
+|                         HDFE_COMP_SHUF_DEFLATE          11                  |
+|                         HDFE_COMP_SHUF_SZIP_CHIP        12                  |
+|                         HDFE_COMP_SHUF_SZIP_K13         13                  |
+|                         HDFE_COMP_SHUF_SZIP_EC          14                  |
+|                         HDFE_COMP_SHUF_SZIP_NN          15                  |
+|                         HDFE_COMP_SHUF_SZIP_K13orEC     16                  |
+|                         HDFE_COMP_SHUF_SZIP_K13orNN     17                  |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|  Aug 03   S.Zhao        Added Szip compression methods.                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_GDdefcompF(int GridID, int compcode, int compparm[])
+{
+  int       ret      = FAIL;/* (int) return status variable   */
+
+  herr_t    status   = FAIL;/* routine return status variable */
+
+  hid_t     gridID   = FAIL;/* HDF5 type grid ID              */
+ 
+  char      *errbuf = (char *)NULL;   /* error message buffer */
+
+
+  errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdefcompF", __LINE__, H5E_RESOURCE, H5E_NOSPACE,"Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDdefcomp(gridID, compcode, compparm);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Error calling HE5_GDdefcomp() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_GDdefcompF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefpixregF    (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Defines pixel registration within grid cell.                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        HDF-EOS type grid  ID                   |
+|  pixregcode     int     None        Pixel registration code                 |
+|                                     HDFE_CENTER (0)                         |
+|                                     HDFE_CORNER (1)                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_GDdefpixregF(int GridID, int pixregcode)
+{
+  int             ret     = FAIL;        /* (int) returmn status variable  */
+
+  herr_t          status  = FAIL;        /* routine return status variable */
+  
+  hid_t           gridID  = FAIL;        /* HDF5 type grid ID              */   
+
+  char            *errbuf = (char *)NULL;/* Buffer for error message       */ 
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdefpixregF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDdefpixreg(gridID, pixregcode);
+  if ( status == FAIL)
+    { 
+      sprintf(errbuf, "Error calling HE5_GDdefpixreg() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_GDdefpixregF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+
+  free(errbuf);
+  
+  ret = (int)status;
+  return(ret);
+}
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDwrcharfld                                                  |
+|                                                                             |
+|  DESCRIPTION: Writes data to a character field (FORTRAN wrapper around      |
+|               GDwritefield)                                                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 grid structure ID                       |
+|  fieldname      char                fieldname                               |
+|  elemlen        int                 each element length in array of string  |
+|  numelem        int                 number of elements in declared buffer   |
+|                                     array                                   |
+|  fortstart      long                start array                             |
+|  fortstride     long                stride array                            |
+|  fortedge       long                edge array                              |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04   S.Zhao        For an array of character string dataset.           |
+|  Jun 04   S.Zhao        Added one more argument (numelem).                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDwrcharfld(int GridID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *data)
+ 
+{
+  int         ret      = FAIL;   /* (int) return status variable   */
+  int         i        = 0;      /* Loop index                     */
+  int         rank     = 0;      /* Field rank                     */
+ 
+  hid_t       gridID   = FAIL;   /* HDF5 type grid ID              */
+ 
+  hid_t       ntype[1] = {FAIL}; /* Field number type              */
+ 
+  herr_t      status   = FAIL;   /* return status variable         */
+ 
+  hsize_t     dims[HE5_DTSETRANKMAX];/* Field dimensions           */
+  hsize_t     *stride  = (hsize_t *)NULL;/* Stride array (C order) */
+  hsize_t     *edge    = (hsize_t *)NULL;/* Edge array (C order)   */
+ 
+  hssize_t    *start   = (hssize_t *)NULL;/* Start array (C order) */
+ 
+  char        *errbuf  = (char *)NULL;   /* error message buffer   */
+  char        **strdatabuf = NULL;       /* string data buffer                */
+  int         nelem = 0;                 /* number of elements in array of str*/
+  int         strsize = 0;               /* each str length in array of str   */
+  char        *blankPtr = (char *)NULL;  /* pointer to blank character        */
+  char        *tmpString = (char *)NULL; /* pointer to temp string            */
+  int         attr = 0;                  /* attribute value                   */
+  hsize_t     count[1];                  /* number of attribute elements      */
+ 
+ 
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[i] = 0;
+ 
+ 
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  gridID = (hid_t)GridID;
+ 
+  /* Get field info  */
+  status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, ntype, NULL, NULL);
+  if (status == SUCCEED)
+    {
+      start = (hssize_t *)calloc(rank, sizeof(hssize_t));
+      if(start == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for start.\n");
+	  H5Epush(__FILE__, "HE5_GDwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+        }
+      stride = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(stride == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for stride.\n");
+	  H5Epush(__FILE__, "HE5_GDwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(errbuf);
+	  return(FAIL);
+        }
+      edge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(edge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_GDwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(errbuf);
+	  return(FAIL);
+        }
+      /* Reverse order of dimensions (FORTRAN -> C) */
+      /* ------------------------------------------ */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i]  = (hssize_t)fortstart[rank - 1 - i];
+	  stride[i] = (hsize_t)fortstride[rank - 1 - i];
+	  edge[i]   = (hsize_t)fortedge[rank - 1 - i];
+        }
+         
+      strsize = elemlen;
+      nelem = dims[0];
+
+      tmpString = (char *)calloc(1,strsize+1);
+      if(tmpString == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for tmpString.\n");
+	  H5Epush(__FILE__, "HE5_GDwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      strdatabuf = (char **)malloc(nelem*sizeof(char *));
+      for (i = 0; i<nelem; i++)
+	{
+	  strdatabuf[i] = NULL;
+	  strdatabuf[i] = (char *)malloc((strsize+1)*sizeof(char));
+	  strncpy(strdatabuf[i],(char *)data+(strsize*i), strsize);
+	  strdatabuf[i][strsize] = '\0';
+	  strcpy(tmpString,strdatabuf[i]);
+ 
+	  /* Find the first non blank character from the end */
+	  /* ----------------------------------------------- */
+	  blankPtr = tmpString + strsize -1;
+	  while (*blankPtr == ' ')
+	    {
+	      blankPtr--;
+	    }
+ 
+	  /* Turn it into a C string */
+	  /* ----------------------- */
+	  blankPtr++;
+	  *blankPtr = '\0';
+ 
+	  strcpy(strdatabuf[i], tmpString);
+	}
+ 
+      free(tmpString);
+ 
+      count[0] = 1;
+      attr = strsize;
+      status = HE5_GDwritelocattr(gridID, fieldname, "StringLengthAttribute", H5T_NATIVE_INT, count, &attr);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write attribute to the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_GDwrcharfld", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }
+	  return(FAIL);
+	}
+ 
+      status = HE5_GDwrrdfield(gridID, fieldname, "w", start, stride, edge, strdatabuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_GDwrcharfld", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }
+	  return(FAIL);
+	}
+
+    }
+  else
+    {
+      sprintf(errbuf, "Error calling GDfieldinfo() from FORTRAN wrapper.") ;
+      H5Epush(__FILE__, "HE5_GDwrcharfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+    }
+ 
+ 
+  if (start  != NULL) free(start);
+  if (stride != NULL) free(stride);
+  if (edge   != NULL) free(edge);
+  if (errbuf != NULL) free(errbuf);
+  if (strdatabuf != NULL)
+    {
+      for (i = 0; i<nelem; i++)
+        {
+	  if (strdatabuf[i] != NULL)
+	    {
+	      free (strdatabuf[i]);
+	      strdatabuf[i] = NULL;
+	    }
+        }
+      free (strdatabuf);
+      strdatabuf = NULL;
+    }
+ 
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDwrfld                                                      |
+|                                                                             |
+|  DESCRIPTION: Writes data to field (FORTRAN wrapper around GDwritefield)    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 grid structure ID                       |
+|  fieldname      char                fieldname                               |
+|  fortstart      long                start array                             |
+|  fortstride     long                stride array                            |
+|  fortedge       long                edge array                              |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 99   Abe Taaheri   Modified data types for HDF5                        |
+|  Jun 00   D.Wynne       Updated for native datatypes                        |
+|  Aug 00   A.Muslimov    Updated to reflect data type changes.               |
+|  Feb 05   S.Zhao        Replaced the "myedge" array by the "dims" array if  |
+|                         it was larger than the dimension size.              |
+|  Sep 11   Abe Taaheri   Modified for correcting Unlimited dimension         |
+|                         behavior and extension                              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDwrfld(int GridID, char *fieldname, long fortstart[], long fortstride[], 
+long fortedge[], void *data)
+ 
+{
+  int         ret      = FAIL;   /* (int) return status variable   */
+  int         i        = 0;      /* Loop index                     */
+  int         rank     = 0;      /* Field rank                     */
+
+  hid_t       gridID   = FAIL;   /* HDF5 type grid ID              */
+
+  hid_t       ntype[1] = {FAIL}; /* Field number type              */
+
+  herr_t      status   = FAIL;   /* return status variable         */
+
+  hsize_t     dims[HE5_DTSETRANKMAX];/* Field dimensions           */
+  hsize_t     *stride  = (hsize_t *)NULL;/* Stride array (C order) */
+  hsize_t     *edge    = (hsize_t *)NULL;/* Edge array (C order)   */
+
+  hssize_t    *start   = (hssize_t *)NULL;/* Start array (C order) */
+
+  char        *errbuf  = (char *)NULL;   /* error message buffer   */
+  hsize_t     *myedge = (hsize_t *)NULL;
+  hsize_t      maxdims[HE5_DTSETRANKMAX];/* Field maximum dimensions     */
+  int          append   = FALSE;         /* FLAG (if field is appendible)*/
+  int          unlimdim;
+
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      dims[i] = 0;
+      maxdims[ i ] = 0;
+    }
+ 
+ 
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDwrfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  gridID = (hid_t)GridID;
+
+  /* Get field info  */
+  status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, ntype, NULL, NULL);
+  if (status == SUCCEED)
+    {
+      start = (hssize_t *)calloc(rank, sizeof(hssize_t));
+      if(start == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for start.\n");
+	  H5Epush(__FILE__, "HE5_GDwrfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+        }
+      stride = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(stride == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for stride.\n");
+	  H5Epush(__FILE__, "HE5_GDwrfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(errbuf);
+	  return(FAIL);
+        }
+      edge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(edge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_GDwrfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(errbuf);
+	  return(FAIL);
+        }
+
+      /* Reverse order of dimensions (FORTRAN -> C) */
+      /* ------------------------------------------ */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i]  = (hssize_t)fortstart[rank - 1 - i];
+	  stride[i] = (hsize_t)fortstride[rank - 1 - i];
+	  edge[i]   = (hsize_t)fortedge[rank - 1 - i];
+        }
+
+      myedge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(myedge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_GDwrfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+        }
+      
+      /* get maxdims for the field */
+      status = HE5_GDflddiminfo(gridID, fieldname, &rank, dims, maxdims);
+
+      /* see if we need first to extend data dimensions for unlimited 
+	 dimensions */
+
+      for (i = 0; i < rank; i++)
+        {
+	  if( dims[i] == maxdims[i] )
+	    append = FALSE;
+	  else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED))
+	    {
+	      append = TRUE;
+	      break;
+	    }
+	}
+      unlimdim = i;
+
+      if(append == FALSE)
+	{
+	  for (i = 0; i < rank; i++)
+	    {
+	      if(edge[i] > dims[i])
+		myedge[i] = dims[i];
+	      else
+		myedge[i] = edge[i];
+	    }
+	}
+      else
+	{
+	  for (i = 0; i < rank; i++)
+	    {
+	      myedge[i] = edge[i];
+	    }
+	}
+
+      if((append == TRUE) && (edge[unlimdim] > dims[unlimdim]))
+	{
+	  hssize_t newstart[8];
+	  hsize_t newedge[8];
+
+	  for (i = 0; i < rank; i++)
+	    {
+	      newstart[i]=start[i];
+	      newedge[i] = edge[i];
+	    }
+	  newstart[unlimdim]=edge[unlimdim]-1;
+	  newedge[unlimdim] = 1;
+	  status = HE5_GDwrrdfield(gridID, fieldname, "w", newstart, stride, newedge,data);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ;
+	      H5Epush(__FILE__, "HE5_GDwrfld", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(start);
+	      free(stride);
+	      free(edge);
+	      free(myedge);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	  else
+	    {
+	      for (i = 0; i < rank; i++)
+		{
+		  dims[i]=edge[i];
+		}
+	    }
+	}
+
+      status = HE5_GDwrrdfield(gridID, fieldname, "w", start, stride, myedge,data);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_GDwrfld", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(myedge);
+	  free(errbuf);
+	  return(FAIL);
+	}
+    }
+  else
+    {
+      sprintf(errbuf, "Error calling GDfieldinfo() from FORTRAN wrapper.") ;
+      H5Epush(__FILE__, "HE5_GDwrfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+    }
+  
+
+  if (start  != NULL) free(start);
+  if (stride != NULL) free(stride);
+  if (edge   != NULL) free(edge);
+  if (errbuf != NULL) free(errbuf);
+  if (myedge != NULL) free(myedge);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDrdfld                                                      |
+|                                                                             |
+|  DESCRIPTION: Reads data from field (FORTRAN wrapper around GDreadfield)    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 Grid  structure ID                      |
+|  fieldname      char                fieldname                               |
+|  fortstart      long                start array                             |
+|  fortstride     long                stride array                            |
+|  fortedge       long                edge array                              |
+|  buffer         void                data buffer for read                    |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Nov 99   Abe Taaheri   Modified for HDF5                                   |
+|  Jun 00   D.Wynne       Updated to reflect data type changes                |
+|  Aug 00   A.Muslimov    Updated to reflect data type changes.               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDrdfld(int GridID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *buffer)
+{
+  int         ret      = FAIL;   /* (int) return status variable   */
+  int         i        = 0;      /* Loop index                     */
+  int         rank     = 0;      /* Field rank                     */
+ 
+  hid_t       gridID   = FAIL;   /* HDF5 type grid ID              */
+ 
+  hid_t       ntype[1] = {FAIL}; /* Field number type              */
+ 
+  herr_t      status   = FAIL;   /* return status variable         */
+ 
+  hsize_t     dims[HE5_DTSETRANKMAX];/* Field dimensions           */
+  hsize_t     *stride  = (hsize_t *)NULL;/* Stride array (C order) */
+  hsize_t     *edge    = (hsize_t *)NULL;/* Edge array (C order)   */
+ 
+  hssize_t    *start   = (hssize_t *)NULL;/* Start array (C order) */
+ 
+  char        *errbuf  = (char *)NULL;   /* error message buffer  */
+ 
+ 
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[i] = 0;
+ 
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+ 
+ 
+  gridID = (hid_t)GridID;
+ 
+ 
+  /* Get field info */
+  /* -------------- */
+  status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, ntype, NULL,NULL);
+  if (status != FAIL)
+    {
+      start =  (hssize_t *)calloc(rank, sizeof(hssize_t));
+      if(start == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for start.\n");
+	  H5Epush(__FILE__, "HE5_GDrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      stride = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(stride == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for stride.\n");
+	  H5Epush(__FILE__, "HE5_GDrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      edge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(edge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_GDrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      /* Reverse order of dimensions (FORTRAN -> C) */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i]  = (hssize_t)fortstart[rank - 1 - i];
+	  stride[i] = (hsize_t)fortstride[rank - 1 - i];
+	  edge[i]   = (hsize_t)fortedge[rank - 1 - i];
+        }
+ 
+ 
+      status = HE5_GDwrrdfield(gridID, fieldname, "r", start, stride, edge, buffer);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Error calling HE5_GDwrrdfield() from FORTRAN wrapper.") ;
+	  H5Epush(__FILE__, "HE5_GDrdfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+    }
+  else
+    {
+      sprintf(errbuf, "Error calling HE5_GDfieldinfo() from FORTRAN wrapper.") ;
+      H5Epush(__FILE__, "HE5_GDrdfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+    }
+ 
+  if (start  != NULL) free(start);
+  if (stride != NULL) free(stride);
+  if (edge   != NULL) free(edge);
+  if (errbuf != NULL) free(errbuf);
+ 
+  ret = (int)status;
+  return(ret);
+ 
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDrdcharfld                                                  |
+|                                                                             |
+|  DESCRIPTION: Reads data from a character string field (FORTRAN wrapper     |
+|               around GDreadfield)                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 Grid  structure ID                      |
+|  fieldname      char                fieldname                               |
+|  elemlen        int                 each element length in array of string  |
+|  numelem        int                 number of elements in declared buffer   |
+|                                     array                                   |
+|  fortstart      long                start array                             |
+|  fortstride     long                stride array                            |
+|  fortedge       long                edge array                              |
+|  buffer         void                data buffer for read                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 04   S.Zhao        For an array of character string dataset.           |
+|  Jun 04   S.Zhao        Added two more arguments (elemlen and numelem).     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDrdcharfld(int GridID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *buffer)
+{
+  int         ret      = FAIL;   /* (int) return status variable   */
+  int         i        = 0;      /* Loop index                     */
+  int         rank     = 0;      /* Field rank                     */
+
+  hid_t       gridID   = FAIL;   /* HDF5 type grid ID              */
+
+  hid_t       ntype[1] = {FAIL}; /* Field number type              */
+
+  herr_t      status   = FAIL;   /* return status variable         */
+
+  hsize_t     dims[HE5_DTSETRANKMAX];/* Field dimensions           */
+  hsize_t     *stride  = (hsize_t *)NULL;/* Stride array (C order) */
+  hsize_t     *edge    = (hsize_t *)NULL;/* Edge array (C order)   */
+
+  hssize_t    *start   = (hssize_t *)NULL;/* Start array (C order) */
+
+  char        *errbuf  = (char *)NULL;   /* error message buffer  */
+  char        **strdatabuf = NULL;       /* string data buffer                */
+  int         stlen = 0;                 /* whole string array length         */
+  int         nelem = 0;                 /* number of elements in array of str*/
+  int         strsize = 0;               /* each str length in array of str   */
+  int         attr = 0;                  /* attribute value                   */
+  int         j = 0;                     /* Loop index                        */
+
+  int              num_elem_passed_out;
+  int              numread;
+
+
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[i] = 0;
+ 
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+
+  gridID = (hid_t)GridID;
+  
+
+  /* Get field info */
+  /* -------------- */
+  status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, ntype, NULL,NULL);  
+  if (status != FAIL)
+    {
+      start =  (hssize_t *)calloc(rank, sizeof(hssize_t));
+      if(start == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for start.\n");
+	  H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+        }
+
+      stride = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(stride == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for stride.\n");
+	  H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(errbuf);
+	  return(FAIL);
+        }
+
+      edge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(edge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(errbuf);
+	  return(FAIL);
+        }
+
+      /* Reverse order of dimensions (FORTRAN -> C) */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i]  = (hssize_t)fortstart[rank - 1 - i];
+	  stride[i] = (hsize_t)fortstride[rank - 1 - i];
+	  edge[i]   = (hsize_t)fortedge[rank - 1 - i];
+        }
+ 
+
+      status = HE5_GDreadlocattr(gridID, fieldname, "StringLengthAttribute", &attr);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot read attribute from the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      if(elemlen < attr )
+	{
+	  sprintf(errbuf, "Element length passed in is not correct. Should be same as in declration");
+	  H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      strsize = attr;
+      stlen = dims[0] * strsize;
+      nelem = stlen / strsize;
+      strdatabuf = (char **)malloc(nelem*sizeof(char *));
+      for (i = 0; i<nelem; i++)
+	{
+	  strdatabuf[i] = NULL;
+	  strdatabuf[i] = (char *)malloc((strsize+1)*sizeof(char));
+	}
+ 
+      /* Read data from the field */
+      /* ------------------------ */
+      status = HE5_GDwrrdfield(gridID, fieldname, "r", start, stride, edge, strdatabuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Error calling HE5_GDwrrdfield() from FORTRAN wrapper.") ;
+	  H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }  
+	  return(FAIL);
+	}
+      if(numelem == 0)
+	{
+	  sprintf(errbuf, "Number of elements passed in cannot be zero.") ;
+	  H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }
+	  return(FAIL);
+	}
+ 
+      if(edge != NULL)
+	{
+	  numread = edge[0];
+	}
+      else
+	{
+	  numread = (dims[0] - start[0])/stride[0];
+	}
+ 
+      if(numread <= 0)
+	{
+	  sprintf(errbuf, "Number of elements passed in cannot be zero.") ;
+	  H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }
+	  return(FAIL);
+	}
+      if(numread <=  numelem)
+	{
+	  num_elem_passed_out = numread;
+	}
+      else
+	{
+	  num_elem_passed_out = numelem;
+	}
+ 
+      stlen = strlen(strdatabuf[0]);
+      strcpy((char *)buffer,strdatabuf[0]);
+      for (j = stlen; j < elemlen; j++)
+	{
+	  strcat((char *)buffer," ");
+	}
+      for (i = 1; i < num_elem_passed_out; i++)
+	{
+	  strcat((char *)buffer,strdatabuf[i]);
+	  stlen = strlen(strdatabuf[i]);
+	  for (j = stlen; j < elemlen; j++)
+	    {
+	      strcat(buffer," ");
+	    }
+	}
+ 
+
+    }
+  else
+    {
+      sprintf(errbuf, "Error calling HE5_GDfieldinfo() from FORTRAN wrapper.") ;
+      H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+    }
+  
+  if (start  != NULL) free(start);
+  if (stride != NULL) free(stride);
+  if (edge   != NULL) free(edge);
+  if (errbuf != NULL) free(errbuf);
+  if (strdatabuf != NULL)
+    {
+      for (i = 0; i<nelem; i++)
+        {
+	  if (strdatabuf[i] != NULL)
+	    {
+	      free (strdatabuf[i]);
+	      strdatabuf[i] = NULL;
+	    }
+        }
+      free (strdatabuf);
+      strdatabuf = NULL;
+    }
+
+
+  ret = (int)status;
+  return(ret);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetfill  (FORTRAN wrapper)                                 |
+|                                                                             |
+|  DESCRIPTION: Retrieves fill value for a specified field.                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        HDF-EOS type grid  ID                   |
+|  fieldname      char*               field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fillval        void                fill value                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_GDgetfill(int GridID, char *fieldname, void *fillval)
+{
+  int             ret    = FAIL;/* (int) return status variable   */
+
+  herr_t          status = FAIL;/* routine return status variable */
+
+  hid_t           gridID = FAIL;/* HDF5 type grid ID              */
+
+  char            *errbuf = (char *)NULL;/* error message buffer  */
+    
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDgetfill", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  gridID = (int)GridID;
+  
+  status = HE5_GDgetfillvalue(gridID, fieldname, fillval);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Error calling HE5_GDgetfillvalue() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+	
+  free(errbuf);
+  
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDwrattr                                                     |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper for Writes/updates attribute in a grid.       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 grid structure ID                       |
+|  attrname       char*               attribute name                          |
+|  ntype          int                 attribute HDF numbertype                |
+|  fortcount[]    long                Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 99   Abe Taaheri   Modified data types                                 |
+|  Jun 00   D.Wynne       Updated for native datatypes                        |
+|  Aug 00   A.Muslimov    Updated to reflect data type changes.               |
+|  Mar 04   S.Zhao        Modified for a character string attribute.          |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDwrattr(int GridID, char *attrname, int ntype, long fortcount[], void *datbuf)
+{
+  int         ret    = FAIL;	 /* (int) return status variable   */
+  int         RANK   = 1;	  	 /* Rank of a dataset              */
+  int         i      = 0;        /* Loop index                     */
+
+  herr_t      status = FAIL;	 /* routine return status variable */
+
+  hid_t       gridID = FAIL;     /* HDF5 type grid ID              */
+  hid_t       dtype  = FAIL;     /* HDF5 type  data type ID        */            
+
+  hsize_t    *count  = (hsize_t *)NULL;/* Count array (C order)    */
+
+  char       *errbuf = (char *)NULL;   /* error message buffer     */
+  char       *tempbuf = (char *)NULL;  /* temp buffer */
+
+ 
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtype = HE5_EHconvdatatype(ntype);
+  if(dtype == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_EHconvdatatype() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDwrattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  
+  count = (hsize_t *)calloc(RANK, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_GDwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < RANK; i++)
+    {
+      count[i] = (hsize_t)fortcount[RANK - 1 - i];
+    }
+
+  gridID = (hid_t)GridID;
+ 
+  if ((dtype == HE5T_CHARSTRING) || (dtype == H5T_NATIVE_CHAR) || (dtype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_GDwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n");
+	  H5Epush(__FILE__, "HE5_GDwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+
+      status = HE5_GDwriteattr(gridID, attrname, dtype, count, tempbuf);
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname);
+          H5Epush(__FILE__, "HE5_GDwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(count);
+          free(errbuf);
+          free(tempbuf);
+          return(FAIL);
+	}
+
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    {
+      status = HE5_GDwriteattr(gridID, attrname, dtype, count, datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname);
+	  H5Epush(__FILE__, "HE5_GDwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+    }
+
+  ret = (int)status;
+  return(ret);
+ 
+}
+ 
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDwrgattr                                                    |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper to write/update group attribute in a grid.    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 grid structure ID                       |
+|  attrname       char*               attribute name                          |
+|  ntype          int                 attribute HDF numbertype                |
+|  fortcount[]    long                Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 99   Abe Taaheri   Modified data types                                 |
+|  Jun 00   D.Wynne       Updated for native datatypes                        |
+|  Aug 00   A.Muslimov    Updated to reflect recent datatype changes.         |
+|  Mar 04   S.Zhao        Modified for a character string attribute.          |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDwrgattr(int GridID, char *attrname, int ntype, long fortcount[], void *datbuf)
+{
+  int         ret     = FAIL;	  /* (int) return status variable   */
+  int         RANK    = 1;	  	  /* Rank of a dataset              */
+  int         i       = 0;        /* Loop index                     */
+
+  herr_t      status  = FAIL;	  /* routine return status variable */
+
+  hid_t       gridID  = FAIL;     /* HDF5 type grid ID              */
+  hid_t       dtype   = FAIL;     /* HDF5 type  data type ID        */            
+
+  hsize_t     *count  = (hsize_t *)NULL;/* Count array (C order)    */
+
+  char        *errbuf = (char *)NULL;   /* error message buffer     */
+  char        *tempbuf = (char *)NULL;  /* temp buffer */
+
+ 
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtype = HE5_EHconvdatatype(ntype);
+  if(dtype == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_EHconvdatatype() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDwrgattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  
+  count = (hsize_t *)calloc(RANK, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_GDwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < RANK; i++)
+    {
+      count[i] = (hsize_t)fortcount[RANK - 1 - i];
+    }
+
+  gridID = (hid_t)GridID;
+ 
+  if ((dtype == HE5T_CHARSTRING) || (dtype == H5T_NATIVE_CHAR) || (dtype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of group attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_GDwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n");
+	  H5Epush(__FILE__, "HE5_GDwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+ 
+      status = HE5_GDwritegrpattr(gridID, attrname, dtype, count, tempbuf);
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write group attribute value.\n");
+          H5Epush(__FILE__, "HE5_GDwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(count);
+          free(errbuf);
+          free(tempbuf);
+          return(FAIL);
+	}
+ 
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    {
+      status = HE5_GDwritegrpattr(gridID, attrname, dtype, count, datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write group attribute value.\n");
+	  H5Epush(__FILE__, "HE5_GDwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+    }
+
+  ret = (int)status;
+  return(ret); 
+}
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDwrlattr                                                    |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper to Write/update local attribute in a grid.    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 grid structure ID                       |
+|  fieldname      char*               field with local attribute              |
+|  attrname       char*               local attribute name                    |
+|  ntype          int                 local attribute HDF numbertype          |
+|  fortcount[]    long                Number of local attribute elements      |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 00   D.Wynne       Original Programmer                                 |
+|  Mar 04   S.Zhao        Modified for a character string attribute.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDwrlattr(int GridID, char *fieldname, char *attrname, int ntype, long fortcount[], void *datbuf)
+{
+  int         ret     = FAIL;	  /* (int) return status variable   */
+  int         RANK    = 1;	  	  /* Rank of a dataset              */
+  int         i       = 0;        /* Loop index                     */
+
+  herr_t      status  = FAIL;	  /* routine return status variable */
+
+  hid_t       gridID  = FAIL;     /* HDF5 type grid ID              */
+  hid_t       dtype   = FAIL;     /* HDF5 type  data type ID        */            
+
+  hsize_t     *count  = (hsize_t *)NULL;/* Count array (C order)    */
+
+  char        *errbuf = (char *)NULL;   /* error message buffer     */
+  char        *tempbuf = (char *)NULL;  /* temp buffer */
+
+ 
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDwrlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtype = HE5_EHconvdatatype(ntype);
+  if(dtype == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_EHconvdatatype() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDwrlattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  
+  count = (hsize_t *)calloc(RANK, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_GDwrlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < RANK; i++)
+    {
+      count[i] = (hsize_t)fortcount[RANK - 1 - i];
+    }
+
+
+  gridID = (hid_t)GridID;  
+ 
+  if ((dtype == HE5T_CHARSTRING) || (dtype == H5T_NATIVE_CHAR) || (dtype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of local attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_GDwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n");
+	  H5Epush(__FILE__, "HE5_GDwrlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+ 
+      status = HE5_GDwritelocattr(gridID, fieldname, attrname, dtype, count, tempbuf);
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write local attribute value.\n");
+          H5Epush(__FILE__, "HE5_GDwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(count);
+          free(errbuf);
+          free(tempbuf);
+          return(FAIL);
+	}
+ 
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    {
+      status = HE5_GDwritelocattr(gridID, fieldname, attrname, dtype, count, datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write local attribute value.\n");
+	  H5Epush(__FILE__, "HE5_GDwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+    }
+
+  ret = (int)status;
+  return(ret); 
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDrdattr   (FORTRAN wrapper)                                 |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from a grid.                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        HDF-EOS type grid  ID                   |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_GDrdattr(int GridID, char *attrname, void *datbuf)
+{
+  int         ret        = FAIL;/* (int) return status variable   */
+
+  herr_t      status     = FAIL;/* routine return status variable */
+
+  hid_t       gridID     = FAIL;/* HDF5 type grid ID              */
+ 
+  char        *errbuf    = (char *)NULL;/* error message buffer   */
+
+ 
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDrdattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDreadattr(gridID, attrname, datbuf);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_GDreadattr() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDrdattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret); 
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDrdgattr  (FORTRAN wrapper)                                 |
+|                                                                             |
+|  DESCRIPTION: Reads group attribute from a grid.                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        HDF-EOS type grid  ID                   |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_GDrdgattr(int GridID, char *attrname, void *datbuf)
+{
+  int         ret        = FAIL;/* (int) return status variable   */
+
+  herr_t      status     = FAIL;/* routine return status variable */
+
+  hid_t       gridID     = FAIL;/* HDF5 type grid ID              */
+ 
+  char        *errbuf    = (char *)NULL;/* error message buffer   */
+
+ 
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDrdgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDreadgrpattr(gridID, attrname, datbuf);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_GDreadgrpattr() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDrdgattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret); 
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDrdlattr  (FORTRAN wrapper)                                 |
+|                                                                             |
+|  DESCRIPTION: Reads local attribute from a grid.                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        HDF-EOS type grid  ID                   |
+|  fieldname      char                field name                              |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_GDrdlattr(int GridID, char *fieldname, char *attrname, void *datbuf)
+{
+  int         ret        = FAIL;/* (int) return status variable   */
+
+  herr_t      status     = FAIL;/* routine return status variable */
+
+  hid_t       gridID     = FAIL;/* HDF5 type grid ID              */
+ 
+  char        *errbuf    = (char *)NULL;/* error message buffer   */
+
+ 
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDrdlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDreadlocattr(gridID, fieldname, attrname, datbuf);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_GDreadlocattr() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDrdlattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret); 
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqdimsF                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns dimension names and values defined in grid  structure |
+|               (FORTRAN Wrapper)                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nDim           long                Number of defined dimensions            |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 grid structure ID                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dimnames       char                Dimension names (comma-separated)       |
+|  dims           long                Dimension values                        |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 00   D.Wynne       Original Version                                    |
+|  Aug 00   A.Muslimov    Updated to reflect data type changes.               |
+|                                                                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDinqdimsF(int GridID, char *dimnames, long dims[])
+{
+  long         nDim       = FAIL;           /* Number of dimensions */
+  long         strbufsize = 0;              /* Size of a string     */
+
+  hid_t        gridID     = FAIL;           /* HDF5 type grid ID    */
+
+  int          i = 0;                       /* Loop index           */
+  
+  hsize_t      *tdims     = (hsize_t *)NULL;/* Dimension size array */
+
+  char         *errbuf    = (char *)NULL;   /* error message buffer */
+
+
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDinqdimsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  
+  gridID = (hid_t)GridID;
+  
+  nDim = HE5_GDnentries(gridID, 0, &strbufsize);
+  if(nDim == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_GDnentries() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDinqdimsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+
+  tdims = (hsize_t *)calloc(nDim, sizeof(hsize_t));
+  if(tdims == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tdims.\n");
+      H5Epush(__FILE__, "HE5_GDinqdimsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+ 
+
+  nDim = HE5_GDinqdims(gridID, dimnames, tdims);
+  if(nDim == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_GDinqdims() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDinqdimsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(tdims);
+      return(FAIL);
+    }
+ 
+
+  for(i = 0; i < nDim; i++)
+    dims[i] = (long)tdims[i];
+ 
+
+  free(tdims);
+  free(errbuf);
+
+  return(nDim);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdiminfoF                                                   |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper for GDdiminfo to Retrieve size of specified   |
+|               dimension.                                                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  size           long    None        Size of dimension                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        grid  structure id                      |
+|  dimname        char*   None        Dimension name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/21/99  A.Muslimov    In the call to EHmetagroup() replaced the argument  |
+|                         gid by fid.                                         |
+|  Oct 99   Abe Taaheri   Added to convert hsize_t to integer                 |
+|  Jun 00   D.Wynne       Modified to update datatype changes                 |
+|  Aug 00   A.Muslimov    Modified to reflect data type changes               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_GDdiminfoF(int GridID, char *dimname)
+{
+  long        size    = FAIL;        /* dimension size (return) */
+  
+  hid_t       gridID  = FAIL;        /* HDF5 type grid ID       */
+
+  hsize_t     tsize   = 0;
+  
+  char        *errbuf = (char *)NULL;/* error message buffer    */
+
+
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdiminfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+   
+  tsize = HE5_GDdiminfo(gridID, dimname);
+  if(tsize == 0)
+    {
+      sprintf(errbuf,"Error calling HE5_GDdiminfo() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDdiminfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+
+  size = (long)tsize;
+  
+  free(errbuf);
+
+  return(size);
+}
+
+
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDfldinfo                                                    |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper arount GDfieldinfo                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 grid structure id                       |
+|  fieldname      char                name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  rank           long                rank of field (# of dims)               |
+|  dims           long                field dimensions                        |
+|  ntype          int                 field number type                       |
+|  fortdimlist    char                field dimension list (FORTRAN order)    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Nov 99   Abe Taaheri   Modified for HDF5                                   |
+|  Jun 00   D.Wynne       Updated to reflect datatypes changes                |
+|  Aug 00   A.Muslimov    Updated to reflect data type changes                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDfldinfo(int GridID, char *fieldname, int *rank, long dims[], int *ntype, char *fortdimlist, char *fortmaxdimlist)
+{
+  int          ret      = SUCCEED;/* (int) return status variable   */
+  int          j        = 0;      /* Loop Index                     */
+
+  hid_t        gridID   = FAIL;   /* HDF5 type grid ID              */
+
+  hid_t        dtype[1] = {FAIL};/* number types                    */
+
+  herr_t       status   = SUCCEED;/* routine return status variable */
+  
+  hsize_t      swap     = 0;      /* Temporary variable             */
+  hsize_t      tempdims[HE5_DTSETRANKMAX];
+  
+  /* Dimension list in C order */
+  char         *dimlist    = (char *)NULL;
+  char         *maxdimlist = (char *)NULL;
+  char         *errbuf     = (char *)NULL;/* error message buffer  */
+  
+  
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDfldinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  dimlist    = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(dimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for dimlist.\n");
+      H5Epush(__FILE__, "HE5_GDfldinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+
+  /* Allocate space for C order max dimension list */
+  /* --------------------------------------------- */
+  maxdimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(maxdimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for maxdimlist.\n");
+      H5Epush(__FILE__, "HE5_GDfldinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      return(FAIL);
+    }
+
+  /* Initialize tempdims[] array */
+  /* --------------------------- */
+  for (j = 0; j < HE5_DTSETRANKMAX; j++)
+    tempdims[j] = 0;
+
+
+  /* Get field info */
+  /* -------------- */
+  gridID = (hid_t)GridID;
+  status = HE5_GDfieldinfo(gridID, fieldname, rank, tempdims, dtype, dimlist, maxdimlist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_GDfieldinfo() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDfldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      free(maxdimlist);
+      return(FAIL);
+    }
+  
+
+  *ntype = (int)dtype[0];
+
+  /* If no error then reverse order of dimension sizes */
+  /* ------------------------------------------------- */
+  if (status == SUCCEED)
+    {
+      for (j = 0; j < *rank / 2; j++)
+        {
+	  swap = tempdims[*rank - 1 - j];
+	  tempdims[*rank - 1 - j] = tempdims[j];
+	  tempdims[j] = swap;
+        }
+      /*change the datatype */
+      for (j = 0; j < *rank; j++)
+        {
+	  dims[j] = (long)tempdims[j];
+        }
+ 
+      /* Reverse order of dimensions entries in dimension list */
+      /* ----------------------------------------------------- */
+      if(fortdimlist != (char *)NULL)
+	{
+	  status = HE5_EHrevflds(dimlist, fortdimlist);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf,"Error calling HE5_EHrevflds() from FORTRAN wrapper.\n");
+	      H5Epush(__FILE__, "HE5_GDfldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+	}
+      if(fortmaxdimlist != (char *)NULL)
+	{
+	  status = HE5_EHrevflds(maxdimlist, fortmaxdimlist);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf,"Error calling HE5_EHrevflds() from FORTRAN wrapper.\n");
+	      H5Epush(__FILE__, "HE5_GDfldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+	}
+	   
+    }
+
+  if (maxdimlist != NULL) free(maxdimlist);
+  if (dimlist    != NULL) free(dimlist);
+  if (errbuf     != NULL) free(errbuf);
+
+
+  ret = (int)status;
+  return(ret); 
+}
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDtileinfoF                                                  |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper for GDtileinfo                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 grid structure ID                       |
+|  fieldname      char*               name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  tilecode       int*                tile code                               |
+|  tilerank       int*                rank of a dataset                       |
+|  tiledims       long                the array containing sizes              |
+|                                     of each dimension of a tile             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date         Programmer    Description                                    |
+|   =========    ============  ============================================   |
+|   Dec 03       S.Zhao        Original development                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDtileinfoF(int GridID, char *fieldname, int *tilecode, int *tilerank, long tiledims[])
+{
+  int           ret       = FAIL;           /* return status        */
+  int           j         = 0;              /* Loop index           */
+ 
+  herr_t        status    = FAIL;           /* return status        */
+ 
+  hid_t         gridID   = FAIL;            /* HDF5 type grid ID    */
+ 
+  hsize_t       tempdims[HE5_DTSETRANKMAX]; /* Temporary dimension sizes array */
+  hsize_t       swap      = 0;              /* Temporary dimension size   */
+ 
+  char          *errbuf   = (char *)NULL;   /* error message buffer */
+ 
+  /* Allocate memory for error message buffer */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDtileinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Initialize tempdims[] array */
+  /* --------------------------- */
+  for ( j = 0; j < HE5_DTSETRANKMAX; j++)
+    tempdims[ j ] = 0;
+ 
+  gridID = (hid_t)GridID;
+ 
+  status = HE5_GDtileinfo(gridID, fieldname, tilecode, tilerank, tempdims);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling GDtileinfo() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDtileinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+ 
+  for (j = 0; j < *tilerank / 2; j++)
+    {
+      swap = tempdims[*tilerank - 1 - j];
+      tempdims[*tilerank - 1 - j] = tempdims[j];
+      tempdims[j] = swap;
+    }
+ 
+  for (j = 0; j < *tilerank; j++)
+    tiledims[j] = (long)tempdims[j];
+ 
+  free(errbuf);
+ 
+  ret = (int)status;
+  return(ret);
+ 
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqdatatypeF                                               |
+|                                                                             |
+|  DESCRIPTION: Inquires about data fields in grid  (FORTRAN Wrapper)         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                  return status (0) SUCCEED, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID          int     None        HDF-EOS type grid  ID                  |
+|  fieldname       char *                                                     |
+|  attrname        char *                                                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  type            int     None        HDF-EOS data type ID                   |
+|  TypeClass       int                                                        |
+|  TypeOrder       int                                                        |
+|  TypeSize        long                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 99   D.Wynne       Original Programmer                                 |
+|  Dec 99   A.Muslimov    Changed the status return data type from hid_t to   |
+|                         int   .                                             |
+|  Feb 00   A.Muslimov    Added error checkings.                              |
+|  Mar 00   A.Muslimov    Changed the ID of field group from gd_id to data_id.|
+|  Mar 00   A.Muslimov    Updated to include Group/Local attributes.          |
+|  5/10/00  A.Muslimov    Changed 'H5T_class_t' type to 'int' data type.      |
+|  Aug 00   A.Muslimov    Updated to reflect data type changes.               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDinqdatatypeF(int GridID, char *fieldname, char *attrname, int fieldgroup, int *type, int *TypeClass, int *TypeOrder, long *TypeSize)
+{
+  int		   ret       = FAIL;      /* (int) return status variable  */
+
+  herr_t	   status    = FAIL;      /* return status variable        */
+
+  hid_t        *typeID   = NULL;      /* HDF5 type data type ID        */
+  hid_t        gridID    = FAIL;      /* HDF5 type grid ID             */
+
+  H5T_class_t  *classID  = (H5T_class_t *)NULL;/* Data type class ID   */
+  H5T_order_t  *Order    = (H5T_order_t *)NULL;/* Data type byte order */
+
+  size_t	   *tempsize = (size_t *)NULL;/* Temporary variable        */
+  
+  char         *errbuf   = (char *)NULL;  /* error message buffer      */
+  
+  
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  typeID = (hid_t *)calloc(1, sizeof(hid_t));
+  if(typeID == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for typeID.\n");
+      H5Epush(__FILE__, "HE5_GDinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  classID = (H5T_class_t *)calloc(1, sizeof(H5T_class_t));
+  if(classID == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for classID.\n");
+      H5Epush(__FILE__, "HE5_GDinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      return(FAIL);
+    }
+
+
+  Order = (H5T_order_t *)calloc(1, sizeof(H5T_order_t));
+  if(Order == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for Order.\n");
+      H5Epush(__FILE__, "HE5_GDinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      free(classID);
+      return(FAIL);
+    }
+
+ 
+  tempsize = (size_t *)calloc(1, sizeof(size_t));
+  if(tempsize == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tempsize.\n");
+      H5Epush(__FILE__, "HE5_GDinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      free(classID);
+      free(Order);
+      return(FAIL);
+    }
+  
+
+  gridID = (hid_t)GridID;
+  status = HE5_GDinqdatatype(gridID, fieldname, attrname, fieldgroup, typeID,classID, Order, tempsize);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_GDinqdatatype() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDinqdatatypeF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      free(classID);
+      free(Order);
+      free(tempsize);
+      return(FAIL);
+    }
+  
+
+  *type      = (int)typeID[0];
+  *TypeSize  = (long)tempsize[0];
+  *TypeClass = (int)classID[0];
+  *TypeOrder = (int)Order[0]; 	
+
+
+  free(errbuf);
+  free(typeID);
+  free(classID);
+  free(Order);  
+  free(tempsize);
+  
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqgridF   (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Returns number and names of grid structures in file           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nGrid          long                Number of grid structures in file       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  filename       char                HDF-EOS filename                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  gridlist       char                List of grid names (comma-separated)    |
+|  strbufsize     long                Length of gridlist                      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer    Description                                        |
+|  =======   ============  ================================================   |
+|  9/11/00   A.Muslimov                                                       |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDinqgridF(char *filename, char *gridlist, long *strbufsize)
+{
+  long           nGrid   = FAIL;	    /* Number of grid structures in file */
+ 
+  char           *errbuf = (char *)NULL;/* error message buffer              */
+  
+  
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDinqgridF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Call "HE5_GDinqgrid" routine */
+  /* ------------------------ */
+  nGrid = HE5_GDinqgrid(filename, gridlist, strbufsize);
+  if(nGrid == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_GDinqgrid() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDinqgridF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  free(errbuf);
+  return(nGrid);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgridinfoF      (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION: Returns xdim, ydim and location of upper left and lower       |
+|                right corners, in meters.                                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        Grid  ID                                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  xdimsize       long                Number of columns in grid               |
+|  ydimsize       long                Number of rows in grid                  |
+|  upleftpt       double              Location (m/deg) of upper left corner   |
+|  lowrightpt     double              Location (m/deg) of lower right corner  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  9/11/00  A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_GDgridinfoF(int GridID, long *xdimsize, long *ydimsize, double upleftpt[], double lowrightpt[])
+{
+  int             ret      = FAIL;          /* (int) return status variable            */
+
+  herr_t          status   = FAIL;          /* routine return status variable          */
+
+  hid_t           gridID   = FAIL;          /* "HDFEOS" group ID                       */
+
+  char            *errbuf = (char *)NULL;   /* buffer for error message                */
+  
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDgridinfoF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+
+
+  status = HE5_GDgridinfo(gridID, xdimsize, ydimsize, upleftpt, lowrightpt);
+  if(status == FAIL)
+    {
+      sprintf( errbuf,"Error calling \"HE5_GDgridinfo()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDgridinfoF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  free(errbuf);
+  
+  ret = (int)status;
+  
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------r
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqflds  (FORTRAN wrapper)                                 |
+|                                                                             |
+|  DESCRIPTION: Retrieve information about all data fields defined in a grid. |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nFld           int                 Number of fields in grid                |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        Grid  ID                                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fieldlist      char*               Field names (comma-separated)           |
+|  rank           int                 Array of ranks                          |
+|  ntype          int                 Array of field data type class IDs      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer    Description                                        |
+|  =======   ============  =================================================  |
+|  9/11/00   A.Muslimov                                                       |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_GDinqflds(int GridID, char *fieldlist, int rank[], int ntype[])
+{
+  int           nFld       =  0;  /* Number of fields (return)         */
+  int           i;                /* Loop index                        */
+
+  hid_t         gridID     = FAIL;/* Grid ID                           */
+
+  hid_t         *dtype     = (hid_t *)NULL;/* number types             */
+
+  char          *errbuf    = (char *)NULL; /* error message buffer     */
+  
+
+  
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDinqflds", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+
+
+  /* Call "HE5_GDinqfields" routine to get number of fields */
+  /* -------------------------------------------------- */
+  nFld = HE5_GDinqfields(gridID, fieldlist, NULL, NULL);
+  if (nFld == FAIL)
+    {
+      sprintf(errbuf, "Error calling \"HE5_GDinqfields()\" from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_GDinqflds", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+ 
+  if (nFld > 0)
+    {
+      dtype = (hid_t *)calloc(nFld, sizeof(hid_t));
+      if (dtype == NULL)
+        {
+          sprintf(errbuf, "Cannot allocate memory. \n");
+          H5Epush(__FILE__, "HE5_GDinqflds", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+          return(FAIL);
+        }
+	  
+      nFld = HE5_GDinqfields(gridID, fieldlist, rank, dtype);
+      if (nFld == FAIL)
+	{
+	  sprintf(errbuf, "Error calling \"HE5_GDinqfields()\" from FORTRAN wrapper. \n");
+	  H5Epush(__FILE__, "HE5_GDinqflds", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dtype);
+	  return(FAIL);
+	}
+
+      for (i = 0; i < nFld; i++)
+        ntype[ i ] = (int)dtype[i];
+
+      free(dtype);
+    } 
+
+
+  free(errbuf);
+
+  return(nFld);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDprojinfoF   (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Returns GCTP projection code, zone code, spheroid code        |
+|                and projection parameters.                                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        Grif ID                                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  projcode       int                 GCTP projection code                    |
+|  zonecode       int                 UTM zone code                           |
+|  spherecode     int                 GCTP spheriod code                      |
+|  projparm       double              Projection parameters                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/11/00  A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_GDprojinfoF(int GridID, int *projcode,  int *zonecode, int *spherecode, double projparm[])
+{
+  int             ret     = FAIL;        /* routine return status variable */
+
+  herr_t          status  = FAIL;        /* routine return status variable */
+
+  hid_t           gridID  = FAIL;        /* HDF-EOS file ID                */
+
+  char            *errbuf = (char *)NULL;/* Buffer for error message       */ 
+  
+  
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDprojinfoF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDprojinfo(gridID,projcode,zonecode,spherecode,projparm);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Error calling \"HE5_GDprojinfo()\" from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_GDprojinfoF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  free(errbuf);
+  ret = (int)status;
+  return(ret);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefboxregionF   (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION: Defines region for subsetting in a grid.                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  RegionID       int     None        Region ID                               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 Grid structure ID                       |
+|  cornerlon      double   dec deg    Longitude of opposite corners of box    |
+|  cornerlat      double   dec deg    Latitude of opposite corners of box     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/12/00  A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDdefboxregionF(int GridID, double cornerlon[], double cornerlat[])
+{
+  int             RegionID = FAIL;/* Region ID (return value)                */
+
+  hid_t           regionID = FAIL;/* Region ID                               */
+  hid_t           gridID   = FAIL;/* Grid structure ID                       */
+
+  char            *errbuf=(char *)NULL;/* Buffer for error message           */
+ 
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdefboxregionF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  gridID = (hid_t)GridID;
+
+  regionID = HE5_GDdefboxregion(gridID, cornerlon, cornerlat);
+  if (regionID == FAIL)
+    {
+      sprintf(errbuf, "Error calling \"HE5_GDdefboxregion()\" from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_GDdefboxregionF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  free(errbuf);
+  RegionID = (int)regionID;
+  return(RegionID);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDreginfo                                                    |
+|                                                                             |
+|  DESCRIPTION: Retrieves size of region in bytes. FORTRAN Wrapper            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        HDF-EOS type grid  ID                   |
+|  RegionID       int                 Region ID                               |
+|  fieldname      char*               Fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          int                 field data type class ID                |
+|  rank           int                 field rank                              |
+|  dims           long                dimensions of field region              |
+|  size           long                size in bytes of field region           |
+|  upleftpt       double              Upper left corner coord for region      |
+|  lowrightpt     double              Lower right corner coord for region     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Nov 99   Abe Taaheri   Added for HDF5                                      |
+|  Jun 00   D.Wynne       Modified to reflect datatype changes                |
+|  Sep 00   A.Muslimov    Updated to reflect data type changes.               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDreginfo(int GridID, int RegionID, char *fieldname, int *ntype, int *rank, long dims[], long *size, double upleftpt[], double lowrightpt[])
+{
+  int             ret      = FAIL;       /* (int) return status variable   */  
+  int		      j;                     /* Loop index                     */
+
+  hid_t           gridID   = FAIL;       /* Grid ID                        */
+  hid_t           regionID = FAIL;       /* Region ID                      */
+
+  herr_t          status   = FAIL;       /* routine return status variable */
+  
+  hid_t           *dtype = (hid_t *)NULL;/* number type                    */
+
+  hsize_t         swap   = 0;            /* Temporary swap variable        */
+  hsize_t         tempdims[HE5_DTSETRANKMAX];/* Temporary dimensions array */
+  
+  char            *errbuf = (char *)NULL;/* Buffer for error message       */
+ 
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDreginfoF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+
+  gridID   = (hid_t)GridID; 
+  regionID = (hid_t)RegionID;
+
+  dtype = (hid_t *)calloc(1, sizeof(hid_t));
+  if (dtype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for dtype.\n");
+      H5Epush(__FILE__, "HE5_GDreginfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+
+  /* Initialize tempdims[] array */
+  /* --------------------------- */
+  for (j = 0; j <HE5_DTSETRANKMAX; j++)
+    tempdims[j] = 0;
+  
+
+  /* Call GDregioninfo */
+  /* ----------------- */
+  status = HE5_GDregioninfo(gridID, regionID, fieldname, dtype, rank,tempdims, size,upleftpt,lowrightpt);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDregioninfo()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDreginfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dtype);
+      return(FAIL);
+    } 
+  
+  /* Change dimensions to FORTRAN order */
+  /* ---------------------------------- */
+  for (j = 0; j < *rank / 2; j++)
+    {
+      swap = tempdims[*rank - 1 - j];
+      tempdims[*rank - 1 - j] = tempdims[j];
+      tempdims[j] = swap;
+    }
+
+  /* change the dimension datatype */
+  /* ----------------------------- */
+  for (j = 0; j < *rank; j++)
+    {
+      dims[j] = (long)tempdims[j];
+    }
+
+
+  *ntype = (int)(*dtype);
+
+
+  free(errbuf);
+  free(dtype);
+
+  ret = (int)status;  
+  return(ret);
+}
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDextractregionF    (FORTRAN wrapper)                        |
+|                                                                             |
+|  DESCRIPTION: Retrieves data from specified region.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        Grid ID                                 |
+|  RegionID       int                 Region ID                               |
+|  fieldname      char*               Fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  buffer         void                Data buffer containing subsetted region |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/12/00  A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_GDextractregionF(int GridID, int RegionID, char *fieldname, void *buffer)
+{
+  int             ret      = FAIL;/* routine return status variable */
+
+  herr_t          status   = FAIL;/* routine return status variable */
+
+  hid_t           gridID   = FAIL;/* HDF5 type grid ID              */
+  hid_t           regionID = FAIL;/* HDF5 type region ID            */
+
+  char            *errbuf  = (char *)NULL;/* error message buffer   */
+
+  
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDextractregionF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID   = (hid_t)GridID;
+  regionID = (hid_t)RegionID;
+
+  status = HE5_GDextractregion(gridID, regionID, fieldname, buffer);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDextractregion()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDextractregionF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+
+  free(errbuf);
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDatinfo                                                     |
+|                                                                             |
+|  DESCRIPTION:  FORTRAN wrapper for GDattrinfo                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 grid structure ID                       |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          int                 attribute datatype ID                   |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/28/99  A.Muslimov    Changed the type of return value from intn          |
+|                         to herr_t.                                          |
+|  Oct 99   Abe Taaheri   Added for HDF5                                      |
+|  Jun 00   D.Wynne       Updated to reflect datatype changes                 |
+|  Sep 00   A.Muslimov    Updated to reflect most recent datatype changes.    |
+|                                                                             |
+|  END_PROLOG                                                                 |
+|                                                                             |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDatinfo(int GridID, char *attrname, int *ntype, long *fortcount)
+{
+  int          ret     = FAIL;    /* routine return status variable */
+
+  hid_t        gridID  = FAIL;    /* Grid ID                        */
+
+  hid_t        *dtype  = (hid_t *)NULL;/* Data type class ID  */
+
+  herr_t       status  = FAIL;    /* routine return status variable */
+  
+  hsize_t      *count  = (hsize_t *)NULL;/* C-order count array     */
+  
+  char         *errbuf = (char *)NULL;   /* error message buffer    */
+  
+  
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf  = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtype = (hid_t *)calloc(1, sizeof(hid_t));
+  if(dtype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for \"dtype\".\n");
+      H5Epush(__FILE__, "HE5_GDatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if(count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for \"count\".\n");
+      H5Epush(__FILE__, "HE5_GDatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dtype);
+      return(FAIL);
+    }
+  
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDattrinfo(gridID, attrname, dtype, count);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDattrinfo()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDatinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      free(dtype);
+      return(FAIL);
+    } 
+  
+  *fortcount = (long)(*count);
+  *ntype     = (int)(*dtype);
+  
+
+  free(errbuf);
+  free(dtype);
+  free(count);
+  
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgatinfo                                                    |
+|                                                                             |
+|  DESCRIPTION:  FORTRAN wrapper for GDgrpattrinfo                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 grid structure ID                       |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          int                 attribute datatype class ID             |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/28/99  A.Muslimov    Changed the type of return value from intn          |
+|                         to herr_t.                                          |
+|  Oct 99   Abe Taaheri   Added for HDF5                                      |
+|  Jun 00   D.Wynne       Updated to reflect datatype changes                 |
+|  Sep 00   A.Muslimov    Updated to include most recent datatype changes.    |
+|                                                                             |
+|  END_PROLOG                                                                 |
+|                                                                             |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDgatinfo(int GridID, char *attrname, int *ntype, long *fortcount)
+{
+  int          ret     = FAIL;    /* routine return status variable */
+
+  hid_t        gridID  = FAIL;    /* Grid ID                        */
+
+  hid_t        *dtype  = (hid_t *)NULL;/* Data type class ID  */
+
+  herr_t       status  = FAIL;    /* routine return status variable */
+  
+  hsize_t      *count  = (hsize_t *)NULL;/* C-order count array     */
+  
+  char         *errbuf = (char *)NULL;   /* error message buffer    */
+  
+  
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf  = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtype = (hid_t *)calloc(1, sizeof(hid_t));
+  if(dtype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for \"dtype\".\n");
+      H5Epush(__FILE__, "HE5_GDgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if(count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for \"count\".\n");
+      H5Epush(__FILE__, "HE5_GDgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dtype);
+      return(FAIL);
+    }
+  
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDgrpattrinfo(gridID, attrname, dtype, count);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDgrpattrinfo()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDgatinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      free(dtype);
+      return(FAIL);
+    } 
+  
+  
+  *fortcount = (long)(*count);
+  *ntype     = (int)(*dtype);
+  
+
+  free(errbuf);
+  free(count);
+  free(dtype);
+
+  ret = (int)status;
+  return(ret);  
+}
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDlatinfo                                                    |
+|                                                                             |
+|  DESCRIPTION:  FORTRAN wrapper for GDlocattrinfo                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 grid structure ID                       |
+|  fieldname      char*               attribute name                          |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          int                 attribute data type class ID            |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/28/99  A.Muslimov    Changed the type of return value from intn          |
+|                         to herr_t.                                          |
+|  Oct 99   Abe Taaheri   Added for HDF5                                      |
+|  Jun 00   D.Wynne       Updated to reflect datatype changes                 |
+|  Sep 00   A.Muslimov    Updated to reflect most recent datatype changes.    |
+|                                                                             |
+|  END_PROLOG                                                                 |
+|                                                                             |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDlatinfo(int GridID, char *fieldname, char *attrname, int *ntype, long *fortcount)
+{
+  int          ret     = FAIL;    /* routine return status variable */
+
+  hid_t        gridID  = FAIL;    /* Grid ID                        */
+
+  hid_t        *dtype  = (hid_t *)NULL;/* Data type class ID  */
+
+  herr_t       status  = FAIL;    /* routine return status variable */
+  
+  hsize_t      *count  = (hsize_t *)NULL;/* C-order count array     */
+  
+  char         *errbuf = (char *)NULL;   /* error message buffer    */
+  
+  
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf  = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtype = (hid_t *)calloc(1, sizeof(hid_t));
+  if(dtype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for \"dtype\".\n");
+      H5Epush(__FILE__, "HE5_GDlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if(count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for \"count\".\n");
+      H5Epush(__FILE__, "HE5_GDlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dtype);
+      return(FAIL);
+    }
+  
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDlocattrinfo(gridID, fieldname, attrname, dtype, count);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDlocattrinfo()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDlatinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      free(dtype);
+      return(FAIL);
+    } 
+  
+  
+  *fortcount = (long)(*count);
+  *ntype     = (int)(*dtype);
+  
+  free(errbuf);
+  free(count);
+  free(dtype);
+
+  ret = (int)status;
+  return(ret);  
+}
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDorigininfoF   (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Returns origin code                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        Grid ID                                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  origincode     int                 Grid origin code                        |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/11/00  A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_GDorigininfoF(int GridID, int *origincode)
+{
+  int             ret      = FAIL;     /* routine return status variable */
+
+  herr_t          status   = FAIL;     /* routine return return status   */  
+  
+  hid_t           gridID   = FAIL;     /* HDF5 type grid ID              */
+
+  char            *errbuf  = (char *)NULL;/* Buffer for error message    */ 
+  
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDorigininfoF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDorigininfo(gridID,origincode);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDorigininfo()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDorigininfoF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+  
+
+  free(errbuf);
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDpixreginfoF   (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        HDF-EOS type grid  ID                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  pixregcode     int       None      Pixel registration code                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/12/00  A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_GDpixreginfoF(int GridID, int *pixregcode)
+{
+  int             ret      = FAIL;      /* routine return status variable */
+
+  herr_t          status   = FAIL;      /* routine return status variable */
+
+  hid_t           gridID   = FAIL;      /* HDF5 type grid ID              */
+
+  char            *errbuf  = (char *)NULL;/* Buffer for error message     */ 
+ 
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDpixreginfoF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+  
+  status = HE5_GDpixreginfo(gridID, pixregcode);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDpixreginfo()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDpixreginfoF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+  
+
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDcompinfoF    (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        Grid ID                                 |
+|  fieldname      char*   None                                                |
+|  compcode       int*    None                                                |
+|  compparm       int     none                                                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/12/00  A.Muslimov                                                        |
+|  June 03  S.Zhao        Changed the type of compcode from *char to *int.    |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int      
+HE5_GDcompinfoF(int GridID, char *fieldname, int *compcode, int compparm[])
+{
+  int             ret      = FAIL;         /* routine return status variable */
+
+  herr_t          status   = FAIL;         /* routine return status variable */
+
+  hid_t           gridID   = FAIL;         /* HDF-EOS file ID                */
+
+  char            *errbuf  = (char *)NULL; /* buffer for error message       */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDcompinfoF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDcompinfo(gridID, fieldname, compcode, compparm);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDcompinfo()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDcompinfoF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+  
+
+  free(errbuf);
+  ret = (int)status;
+  return(ret);
+}
+  
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDnentriesF   (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Returns number of entries and descriptive string buffer       |
+|                size for a specified entity.                                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nEntr          long                Number of entries                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        Grid ID                                 |
+|  entrycode      int     None        Entry code                              |
+|                                     HDFE_NENTDIM  (0)                       |
+|                                     HDFE_NENTDFLD (4)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                Length of comma-separated list          |
+|                                     (Does not include null-terminator)      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/12/00  A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDnentriesF(int GridID, int entrycode, long *strbufsize)
+{
+  long            nEntr    = FAIL;/* Return number of entries        */  
+
+  hid_t           gridID   = FAIL;/* HDF5 type grid ID               */
+
+  char            *errbuf  =  (char *)NULL;/*  error message buffer  */
+     
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDnentriesF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+
+  nEntr = HE5_GDnentries(gridID, entrycode, strbufsize);
+  if (nEntr == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDnentries()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDnentriesF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+
+  free(errbuf);
+
+  return(nEntr);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqattrsF   (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                number of attributes (-1 if fails)      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        HDF-EOS type grid  ID                   |
+|  attrnames      char                attribute name(s)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                String length of attribute (in bytes)   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/12/00  A.Muslimov                                                        |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDinqattrsF(int GridID, char *attrnames, long *strbufsize)
+{  
+  long            nattr    = FAIL;/* Number of attributes            */
+
+  hid_t           gridID   = FAIL;/* HDF5 type grid ID               */
+ 
+  char            *errbuf  = (char *)NULL;/* error message buffer    */
+  
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDinqattrsF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+
+  nattr = HE5_GDinqattrs(gridID, attrnames, strbufsize);
+  if (nattr == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDinqattrs()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDinqattrsF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+
+  free(errbuf);
+  return(nattr);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqgrpattrsF   (FORTRAN wrappers)                          |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list associated with "Data Fields" group in a grid.|
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                number of attributes (-1 if fails)      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        Grid ID                                 |
+|  attrnames      char                attribute name(s)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                String length of attribute (in bytes)   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/12/00  A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDinqgrpattrsF(int GridID, char *attrnames, long *strbufsize)
+{
+  long       nattr         = FAIL;/* Number of attributes (return)  */
+
+  hid_t      gridID        = FAIL;/* HDF5 type Grid ID              */
+
+  char       *errbuf;             /* Buffer for error message       */
+ 
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDinqgrpattrsF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  gridID = (hid_t)GridID;
+  
+  nattr = HE5_GDinqgrpattrs(gridID, attrnames, strbufsize);
+  if (nattr == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDinqgrpattrs()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDinqgrpattrsF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+
+
+  free(errbuf);
+  return(nattr);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqlocattrsF     (FORTRAN wrapper)                         |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list associated with a specified field in a grid.  |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                number of attributes (-1 if fails)      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        Grid ID                                 |
+|  fieldname      char                field name                              |
+|  attrnames      char                attribute name(s)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                String length of attribute (in bytes)   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/12/00  A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDinqlocattrsF(int GridID, char *fieldname, char *attrnames, long *strbufsize)
+{
+  long       nattr         = FAIL;/* Number of attributes (return)  */
+
+  hid_t      gridID        = FAIL;/* HDF5 type grid ID              */
+
+  char       *errbuf;		      /* Buffer for error message       */
+
+ 
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDinqlocattrsF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  gridID = (hid_t)GridID;
+
+  nattr = HE5_GDinqlocattrs(gridID, fieldname, attrnames, strbufsize);
+  if (nattr == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDinqlocattrs()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDinqlocattrsF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+
+
+  free(errbuf);
+  return(nattr);  
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdeftimeperiodF     (FORTRAN wrapper)                       |
+|                                                                             |
+|  DESCRIPTION: Finds elements of the "Time" field within a given time        |
+|               period.                                                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  PeriodID       int                 Period ID                               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 Grid structure ID                       |
+|  PeriodID       int                 Period ID                               |
+|  starttime      double  TAI sec     Start of time period                    |
+|  stoptime       double  TAI sec     Stop of time period                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/12/00  A.Muslimov                                                        |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDdeftimeperiodF(int GridID, int PeriodID, double starttime, double stoptime)
+{
+  hid_t      gridID   = FAIL;/* HDF5 type Grid ID    */
+  hid_t      periodID = FAIL;/* HDF5 type period ID  */
+
+  char       *errbuf = NULL; /* Error message buffer */
+
+  
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdeftimeperiodF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+
+  periodID = HE5_GDdeftimeperiod(gridID, periodID, starttime, stoptime);
+  if (periodID == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDdeftimeperiod()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDdeftimeperiodF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+  PeriodID = (int)periodID;
+
+
+  free(errbuf);
+  return(PeriodID);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefvrtregionF    (FORTRAN wrapper)                         |
+|                                                                             |
+|  DESCRIPTION: Finds elements of a monotonic field within a vertical subset  |
+|               region.                                                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  RegionID       int     None        Region ID                               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 Grid structure ID                       |
+|  RegionID       int                 Region ID                               |
+|  vertObj        char                Vertical object to subset               |
+|  range          double              Vertical subsetting range               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/12/00  A.Muslimov                                                        |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_GDdefvrtregionF(int GridID, int RegionID, char *vertObj, double range[])
+{
+  hid_t           regionID = FAIL;        /* Region ID                */
+  hid_t           gridID   = FAIL;        /* HDF5 type Grid ID        */
+  
+  char	          *errbuf  = (char *)NULL;/* buffer for error message */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdefvrtregionF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+
+  regionID = HE5_GDdefvrtregion(gridID, regionID, vertObj, range);
+  if (regionID == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDdefvrtregion()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDdefvrtregionF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+  
+  RegionID = (int)regionID;
+  return(RegionID);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdupregionF    (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Duplicates a region                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  newRegionID    int                 New region ID                           |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  oldRegionID    int                 Old region ID                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/12/00  A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_GDdupregionF(int oldRegionID)
+{
+  int             newRegionID = FAIL;   /* (int) New Region ID  */
+
+  hid_t           newregionID = FAIL;   /* New region ID        */
+  hid_t           oldregionID = FAIL;   /* Old region ID        */
+  
+  char	          *errbuf  = (char *)NULL;/* error message buff */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdupregionF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  oldregionID = (hid_t)oldRegionID;
+
+  newregionID = HE5_GDdupregion(oldregionID);
+  if (newregionID == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDdupregion()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDdupregionF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+
+  free(errbuf);
+
+  newRegionID = (int)newregionID;
+  return(newRegionID);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetpixelsF     (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION: Finds row and columns for specified lon/lat values            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 Grid structure ID                       |
+|  nLonLat        long                Number of lonlat values                 |
+|  lonVal         double   dec deg    Longitude values                        |
+|  latVal         double   dec deg    Latitude values                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  pixRow         long                Pixel rows                              |
+|  pixCol         long                Pixel columns                           |
+|                                                                             |
+|    Date     Programmer   Description                                        |
+|  ======   ============  =================================================   |
+|  9/12/00  A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_GDgetpixelsF(int GridID, long nLonLat, double lonVal[], double latVal[], long pixRow[], long pixCol[])
+{
+  int             ret        = FAIL;/* routine return status variable */
+
+  herr_t          status     = FAIL;/* routine return status variable */
+
+  hid_t           gridID     = FAIL;/* HDF5 type grid ID              */
+
+  char            *errbuf    = NULL;/* buffer for error message       */
+
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDgetpixelsF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  gridID = (hid_t)GridID;
+
+  status = HE5_GDgetpixels(gridID, nLonLat, lonVal, latVal, pixRow, pixCol);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDgetpixels()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDgetpixelsF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+
+
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetpixvaluesF   (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION: Retrieves data from specified pixels.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  BufSize        long      bytes     Size of data buffer                     |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 Grid structure ID                       |
+|  nPixels        long                Number of pixels                        |
+|  pixRow         long                Pixel row numbers                       |
+|  pixCol         long                Pixel column numbers                    |
+|  fieldname      char*               Fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  buffer         void                Data buffer                             |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/12/00  A.Muslimov                                                        |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDgetpixvaluesF(int GridID, long nPixels, long pixRow[], long pixCol[], char *fieldname, void *buffer)
+{
+  long              BufSize = FAIL;/* Return value of a buffer size    */
+
+  hid_t             gridID  = FAIL;/* HDF5 type grid ID                */
+  
+  char              *errbuf = (char *)NULL;/* buffer for error message */	
+  
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDgetpixvaluesF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+  
+  BufSize = HE5_GDgetpixvalues(gridID, nPixels, pixRow, pixCol, fieldname, buffer);  
+  if (BufSize == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDgetpixvalues()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDgetpixvaluesF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+
+  free(errbuf);
+  return(BufSize);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinterpolateF   (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION: Performs bilinear interpolate on a set of xy values           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  BufSize         long                Size of data buffer (bytes)            |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 Grid structure ID                       |
+|  nValues        long                Number of lon/lat points to interpolate |
+|  xyValues       double              XY values of points to interpolate      |
+|  fieldname      char*               Fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  interpVal      double              Interpolated Data Values                |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/12/00  A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDinterpolateF(int GridID, long nValues, double lonVal[], double latVal[], char *fieldname, double interpVal[])
+{
+  long              BufSize  = FAIL;/* Number of data values returned */
+
+  hid_t             gridID   = FAIL;/* HDF5 type grid ID              */
+
+  char              *errbuf  = NULL;/* Error message buffer           */
+    
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDinterpolateF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  gridID = (hid_t)GridID;
+
+  BufSize = HE5_GDinterpolate(gridID, nValues, lonVal, latVal, fieldname, interpVal);
+  if (BufSize == FAIL)
+    {
+      sprintf(errbuf,"Error calling \"HE5_GDinterpolate()\" from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDinterpolateF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    } 
+
+
+  free(errbuf);
+  return(BufSize);
+}  
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefcomtileF    (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION: Defines compression type and parameters and sets tiling/      |
+|                                                       chunking              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int     None        HDF-EOS type grid  ID                   |
+|  compcode       int                 compression code                        |
+|  compparm[]     int                 compression parameters                  |
+|  tilerank       int                 number of tiling dimensions             |
+|  tiledims       long                tiling dimensions                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer    Description                                        |
+|  ========  ============  =================================================  |
+|  10/25/00  A.Muslimov    Original development.                              |
+|  01/16/01  A.Muslimov    Added FORTRAN to C dimension order conversion.     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_GDdefcomtileF(int GridID, int compcode, int compparm[], int tilerank, long *tiledims )
+{
+  int		ret     = FAIL;           /* (int) return status  */
+  int		i = 0;                    /* Loop index           */
+
+  hid_t     gridID  = FAIL;           /* HDF5 type grid ID    */
+
+  herr_t	status  = FAIL;           /* return status        */
+
+  hsize_t	*tdims  = (hsize_t *)NULL;/* size variable        */  
+
+  char      *errbuf = (char *)NULL;   /* error message buffer */
+
+
+  errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDdefcomtileF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  
+  tdims = (hsize_t *)calloc(tilerank, sizeof(hsize_t));
+  if(tdims == (hsize_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tdims.\n");
+      H5Epush(__FILE__, "HE5_GDdefcomtileF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }  
+  
+  /* Convert from FORTRAN to C dimension order */
+  /* ----------------------------------------- */
+  for(i = 0; i < tilerank; i++)
+    tdims[i] = (hsize_t)tiledims[tilerank - 1 - i];
+  
+
+  gridID = (hid_t)GridID;
+
+  /* call HE5_GDdefcomtile() */
+  /* ----------------------- */
+  status = HE5_GDdefcomtile(gridID, compcode, compparm, tilerank, tdims);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Error calling HE5_GDdefcomtile() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_GDdefcomtileF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(tdims);
+      return(FAIL);
+    }
+ 
+  
+  free(tdims);
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDsetextdataF      (FORTRAN wrapper)                         |
+|                                                                             |
+|  DESCRIPTION: Sets external data files.                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         int                 grid  structure ID                      |
+|  fortfilelist   char*               list of external files (FORTRAN order)  |
+|  offset         long                array of offsets (in bytes) from the    |
+|                                     beginning of the file to the location   |
+|                                     in the file where the data starts       |
+|  size           long                array of sizes (in bytes) reserved in   |
+|                                     the file for the data.                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 01   A.Muslimov    Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_GDsetextdataF(int GridID, char *fortfilelist, long offset[], long size[])
+{
+  int             ret          = FAIL;           /* return status variable */
+
+  herr_t          status       = FAIL;           /* Return status variable */
+  hid_t           gridID       = FAIL;           /* Grid  HDF5 type ID     */
+  
+  off_t           *off         = (off_t *)NULL;  /* Array of data offsets  */
+  
+  long            nentries     = 0;              /* Number of list entries */
+  long            i;                             /* Loop index             */
+  
+  hsize_t         *sz          = (hsize_t *)NULL;/* Array of data sizes    */
+
+  char            *filelist    = (char *)NULL;   /* Files list (C order)   */
+  char            *errbuf      = (char *)NULL;   /* error message buffer   */
+
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+    
+  
+
+  /* Allocate space for C order file list */
+  /* ------------------------------------ */
+  filelist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(filelist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input list.\n");
+      H5Epush(__FILE__, "HE5_GDsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Reverse entries in input list */
+  /* ----------------------------- */
+  status = HE5_EHrevflds(fortfilelist, filelist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in file list.\n");
+      H5Epush(__FILE__, "HE5_GDsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(filelist);
+      return(FAIL);
+    }
+
+
+  /* Parse the list of entries to get number of files */
+  /* ------------------------------------------------ */
+  nentries = HE5_EHparsestr(filelist, ',', NULL, NULL);
+  if(nentries <= 0)
+    {
+      sprintf(errbuf,"Cannot parse the input list/input list is empty.\n");
+      H5Epush(__FILE__, "HE5_GDsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(filelist);
+      return(FAIL);
+    }
+  
+
+  /* Allocate space for offset array */
+  /* ------------------------------- */
+  off = (off_t *)calloc(nentries, sizeof(off_t));
+  if(off == (off_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input offset array.\n");
+      H5Epush(__FILE__, "HE5_GDsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(filelist);
+      return(FAIL);
+    }
+
+  /* Allocate space for size array */
+  /* ----------------------------- */
+  sz = (hsize_t *)calloc(nentries, sizeof(hsize_t));
+  if(sz == (hsize_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input size array.\n");
+      H5Epush(__FILE__, "HE5_GDsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(filelist);
+      free(off);
+      return(FAIL);
+    }
+
+  /* Copy the elements of input arrays */
+  /* --------------------------------- */
+  for (i = 0; i < nentries; i++)
+    {
+      off[ i ] = (off_t)offset[ i ]; 
+      sz[ i ]  = (hsize_t)size[ i ];
+    }
+
+
+  gridID = (hid_t)GridID;
+
+  /* Call the C function */
+  /* ------------------- */
+  status = HE5_GDsetextdata(gridID, filelist, off, sz);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_GDsetextdata from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(filelist);
+      free(off);
+      free(sz);
+      return(FAIL);
+    }
+
+  if (filelist != NULL) free(filelist);
+  if (off != NULL) free(off);
+  if (sz != NULL) free(sz);
+
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetextdataF       (FORTRAN wrapper)                        |
+|                                                                             |
+|  DESCRIPTION: Gets external data files information.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfiles         int                 number of external files  SUCCEED,      |
+|                                               (-1) FAIL                     |
+|  INPUTS:                                                                    |
+|  GridID         int                 Grid  structure ID                      |
+|  fieldname      char*               External field name                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  namelength     long                Length of each name entry               |
+|  fortfilelist   char*               List of file names (FORTRAN order)      |
+|  offset         long                array of offsets (in bytes) from the    |
+|                                     beginning of the file to the location   |
+|                                     in the file where the data starts       |
+|  size           long                array of sizes (in bytes) reserved in   |
+|                                     the file for the data.                  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 01   A.Muslimov    Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_GDgetextdataF(int GridID, char *fieldname, long namelength, char *fortfilelist, long offset[], long size[])
+{
+  int             nfiles       = FAIL;           /* number of files (return) */
+  int             i;                             /* Loop index               */
+
+  herr_t          status       = FAIL;           /* Return status variable   */
+  hid_t           gridID       = FAIL;           /* Grid HDF5 type ID        */
+  
+  off_t           *off         = (off_t *)NULL;  /* Array of data offsets    */
+
+  hsize_t         *sz          = (hsize_t *)NULL;/* Array of sizes           */
+
+  size_t          nmlen        = 0;              /* Each entry string length */ 
+
+  char            *filelist    = (char *)NULL;   /* Files list (C order)     */
+  char            *errbuf      = (char *)NULL;   /* error message buffer     */
+
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Allocate space for C order output file list */
+  /* ------------------------------------------- */
+  filelist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(filelist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for output list.\n");
+      H5Epush(__FILE__, "HE5_GDgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+
+  /* Allocate space for offset array */
+  /* ------------------------------- */
+  off = (off_t *)calloc(HE5_FLDNUMBERMAX , sizeof(off_t));
+  if(off == (off_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input offset array.\n");
+      H5Epush(__FILE__, "HE5_GDgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(filelist);
+      return(FAIL);
+    }
+
+  /* Allocate space for size array */
+  /* ----------------------------- */
+  sz = (hsize_t *)calloc(HE5_FLDNUMBERMAX, sizeof(hsize_t));
+  if(sz == (hsize_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input size array.\n");
+      H5Epush(__FILE__, "HE5_GDgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(filelist);
+      free(off);
+      return(FAIL);
+    }
+  
+  gridID = (hid_t)GridID;
+
+  nmlen = (size_t)namelength;
+  
+  /* Call the C function */
+  /* ------------------- */
+  nfiles = HE5_GDgetextdata(gridID, fieldname, nmlen, filelist, off, sz);
+  if (nfiles == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_GDgetextdata from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDgetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(filelist);
+      free(off);
+      free(sz);
+      return(FAIL);
+    }
+
+  /* Reverse entries in output list */
+  /* ----------------------------- */
+  status = HE5_EHrevflds(filelist, fortfilelist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in output file list.\n");
+      H5Epush(__FILE__, "HE5_GDgetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(filelist);
+      free(off);
+      free(sz);
+      return(FAIL);
+    }
+  
+  /* Populate the output arrays */
+  /* -------------------------- */
+  for (i = 0; i < nfiles; i++)
+    {
+      offset[ nfiles - 1 - i ] = (long)off[ i ];
+      size[ nfiles - 1 - i ]   = (long)sz[ i ];
+    }
+
+  if (filelist != NULL) free(filelist);
+  if (off != NULL) free(off);
+  if (sz != NULL) free(sz);
+
+  
+  free(errbuf);
+  
+  return(nfiles);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDsetaliasF    (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION:  Defines alias for a specified field name                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|   GridID        int                      Grid structure ID                  |
+|   fieldname     char                     Original field name                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|   fortaliaslist char                     Comma separated list of aliases    |
+|                                          for the field name                 |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Apr 04    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_GDsetaliasF(int GridID, char *fieldname, char *fortaliaslist)
+{
+  int      ret        = FAIL;/* (int)Return status variable */
+ 
+  herr_t   status     = FAIL;/* return status variable      */
+ 
+  hid_t    gridID     = FAIL;/* HDF5 type grid ID           */
+ 
+  char     *aliaslist = NULL;/* C-order list of aliases     */
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+ 
+  gridID = (hid_t)GridID;
+ 
+  /* Allocate space for C order alias list */
+  /* ------------------------------------- */
+  aliaslist = (char *)calloc(strlen(fortaliaslist) + 1, sizeof(char));
+  if(aliaslist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for aliaslist.\n");
+      H5Epush(__FILE__, "HE5_GDsetaliasF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Reverse entries in alias list (FORTRAN -> C) */
+  /* -------------------------------------------- */
+  status = HE5_EHrevflds(fortaliaslist, aliaslist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in alias list.\n");
+      H5Epush(__FILE__, "HE5_GDsetaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(aliaslist);
+      return(FAIL);
+    }
+ 
+ 
+ 
+  /* Call GDsetalias() */
+  /* ----------------- */
+  status = HE5_GDsetalias(gridID, fieldname, aliaslist);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Error calling GDsetalias() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_GDsetaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(aliaslist);
+      return(FAIL);
+    }
+ 
+  free(aliaslist);
+ 
+  ret = (int)status;
+  return(ret);
+}
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdropaliasF    (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:  Removes the alias for a specified field name                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    GridID       int                      Grid structure ID                  |
+|    aliasname    char                     Alias name to remove               |
+|    fldgroup     int                      Field group flag                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Apr 04    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_GDdropaliasF(int GridID, int fldgroup, char *aliasname)
+{ 
+  int      ret        = FAIL;/* (int)Return status variable */
+ 
+  herr_t   status     = FAIL;/* return status variable      */
+ 
+  hid_t    gridID     = FAIL;/* HDF5 type grid ID           */
+ 
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+ 
+  gridID = (hid_t)GridID;
+ 
+  status = HE5_GDdropalias(gridID, fldgroup, aliasname);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling GDdropalias() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDdropaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  ret = (int)status;
+ 
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDaliasinfoF    (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:  Retrieves information about field aliases                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    GridID       int                      Grid structure ID                  |
+|    aliasname    char                     alias name                         |
+|    fldgroup     int                      Field group flag                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    length       int                      Buffer size                        |
+|    buffer       char                     Buffer with original field name    |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Apr 04    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_GDaliasinfoF(int GridID, int fldgroup, char *aliasname, int *length, char *buffer)
+{
+  int           ret        = FAIL;/* (int) return status variable          */
+ 
+  herr_t        status     = FAIL;/* return status variable                */
+ 
+  hid_t         gridID     = FAIL;/* HDF5 type grid ID                     */
+ 
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer        */
+ 
+  gridID = (hid_t)GridID;
+ 
+  status = HE5_GDaliasinfo(gridID, fldgroup, aliasname, length, buffer);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling GDaliasinfo() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_GDaliasinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  ret = (int)status;
+ 
+  return(ret); 
+ 
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqfldaliasF (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of fields & aliases and string length of|
+|                fields & aliases list in "Data Fields" group                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfldalias      long                Number of fields & aliases in "Data     |
+|                                     Fields"  group.                         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 Grid structure ID                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fldalias       char*               Fields & aliases names in "Data Fields" |
+|                                     group (Comma-separated list)            |
+|  strbufsize     long*               Fields & aliases name list string length|
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 04    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_GDinqfldaliasF(int GridID, char *fldalias, long *strbufsize)
+{
+  long            nfldalias   = FAIL;     /* Number of fields & aliases (return)  */
+
+  hid_t           gridID = FAIL;          /* HDF5 type grid ID                */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+
+  gridID = (hid_t)GridID;
+
+  nfldalias = HE5_GDinqfldalias(gridID, fldalias, strbufsize);
+  if ( nfldalias < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the fields & aliases. \n");
+      H5Epush(__FILE__, "HE5_GDinqfldaliasF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return(nfldalias);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDwrmeta                                                     |
+|                                                                             |
+|  DESCRIPTION: Defines structural metadata for pre-existing field            |
+|               within grid structure (FORTRAN)                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 grid structure ID                       |
+|  fieldname      char                fieldname                               |
+|  fortdimlist    char                Dimension list (comma-separated list)   |
+|                                         FORTRAN dimesion order              |
+|  ntype          int                 field type                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 05    S. Zhao      Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDwrmeta(int GridID, char *fieldname, char *fortdimlist, int ntype)
+{
+  int       ret        = FAIL;   /* (int) return status variable   */
+  herr_t    status     = FAIL;   /* routine return status variable */
+
+  hid_t     gridID     = FAIL;   /* HDF5 type grid ID              */
+  hid_t     numbertype = FAIL;   /* HDF5 type data type ID         */
+
+  char      *dimlist = (char *)NULL;   /* Dimension list (C order) */
+  char      *errbuf  = (char *)NULL;   /* error message buffer     */
+
+
+  gridID = (hid_t)GridID;
+
+  numbertype = HE5_EHconvdatatype(ntype);
+  if(numbertype == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_GDwrmeta", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Cannot convert datatype for FORTRAN wrapper.");
+      HE5_EHprint("Error: Cannot convert datatype for FORTRAN wrapper, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDwrmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  dimlist = (char *) calloc(strlen(fortdimlist) + 1, sizeof(char));
+  if(dimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for dimlist.\n");
+      H5Epush(__FILE__, "HE5_GDwrmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Reverse entries in dimension list (FORTRAN -> C) */
+  /* ------------------------------------------------ */
+  status = HE5_EHrevflds(fortdimlist, dimlist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in dimension list.\n");
+      H5Epush(__FILE__, "HE5_GDwrmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      return(FAIL);
+    }
+
+  /* Call Write Metadata routine */
+  /* --------------------------- */
+  status = HE5_GDwritefieldmeta(gridID, fieldname, dimlist, numbertype);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot write \"%s\" field metadata.\n", fieldname);
+      H5Epush(__FILE__, "HE5_GDwrmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      return(FAIL);
+    }
+
+  free(dimlist);
+  free(errbuf);
+
+  ret = (int)status;
+  return (ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetaliaslistF (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of aliases and aliases list in "Data    |
+|                Fields" group                                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nalias         long                number of aliases in "Data Fields"      |
+|                                     group                                   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  GridID         int                 grid structure ID                       |
+|  fldgroup       int                 field group flag                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  aliaslist      char*               list of aliases  in "Data Fields" group |
+|                                     (comma-separated list)                  |
+|  strbufsize     long*               length of aliases list                  |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 05    S.Zhao       Original development                                |
+|  Dec 05    T.Roegner    NCR 44092 - Added CYGWIN capability                 |
+|                                                                             |
+|   END_PROLOG                                                                |
+-----------------------------------------------------------------------------*/
+long
+HE5_GDgetaliaslistF(int GridID, int fldgroup, char *aliaslist, long *strbufsize)
+{
+  long            nalias  = FAIL;         /* Number of aliases (return)     */
+  hid_t           gridID  = FAIL;         /* HDF5 type grid ID              */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+
+
+  gridID = (hid_t)GridID;
+
+  nalias = HE5_GDgetaliaslist(gridID, fldgroup, aliaslist, strbufsize);
+  if (nalias < 0)
+    {
+      sprintf(errbuf, "Cannot retrieve the aliases. \n");
+      H5Epush(__FILE__, "HE5_GDgetaliaslistF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return(nalias);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDsetdimscaleF (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION: Defines a dimension scale for a fields dimension in a GRID    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gdID           int                 GRID structure ID                       |
+|  fieldname      char                field name                              |
+|  dimname        char                dim name                                |
+|  dim            long                Dimemsion value                         |
+|  numbertype_in  int                 dim scale data type such as DFNT_INT32, |
+|                                     DFNT_FLOAT64, DFNT_FLOAT32, etc.        |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                None                                                         |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDsetdimscaleF(int GridID, char *fieldname, char *dimname,
+		  long dim, int numbertype_in, void * data)
+{
+  herr_t          status;
+  hid_t           gdID;
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+
+
+  gdID = (hid_t)GridID;
+
+  status = HE5_GDsetdimscale(gdID, fieldname, dimname,
+			     (hsize_t) dim, (hid_t) numbertype_in, data);
+
+  if (status < 0)
+    {
+      sprintf(errbuf, "Cannot set dimension scale %s for field %s. \n", dimname, fieldname);
+      H5Epush(__FILE__, "HE5_GDsetdimscaleF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return((int)status);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdefdimscaleF (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION: Defines dimension scale for a dimension for all fields in a   |
+|               GRID                                                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gdID           int                 GRID structure ID                       |
+|  dimname        char                dim name                                |
+|  dim            long                Dimemsion value                         |
+|  numbertype_in  int                 dim scale data type such as DFNT_INT32, |
+|                                     DFNT_FLOAT64, DFNT_FLOAT32, etc.        |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                None                                                         |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jan 14    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDdefdimscaleF(int GridID, char *dimname,
+		  long dim, int numbertype_in, void * data)
+{
+  herr_t          status;
+  hid_t           gdID;
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+
+
+  gdID = (hid_t)GridID;
+
+  status = HE5_GDdefdimscale(gdID, dimname,
+			     (hsize_t) dim, (hid_t) numbertype_in, data);
+
+  if (status < 0)
+    {
+      sprintf(errbuf, "Cannot set dimension scale %s for all grid fields. \n", dimname);
+      H5Epush(__FILE__, "HE5_GDdefdimscaleF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return((int)status);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetdimscaleF  (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Get dimension scale for a dimension of a field in a GRID      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return databuffsize  SUCCEED, (-1) FAIL |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gdID           int                 GRID structure ID                       |
+|  fieldname      char                field name                              |
+|  dimname        char                dim name                                |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dimsize        long                dimension size                          |
+|  ntype          int                 number type                             |
+|  databuff       void                data buffer for read                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_GDgetdimscaleF(int GridID, char *fieldname, char *dimname, long *dimsize,
+		   int *ntype, void * databuff)
+{
+  hsize_t         databuffsize = (hsize_t)FAIL;/* Size of buffer            */
+  hid_t           gdID         = FAIL;         /* HDF5 type grid ID         */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  hsize_t         ds;
+  hid_t           numtype;
+
+  gdID = (hid_t)GridID;
+
+  databuffsize = HE5_GDgetdimscale(gdID, fieldname, dimname, &ds, &numtype,
+				   databuff);
+  *dimsize = (long) ds;
+  *ntype = (int) numtype;
+
+  if ( databuffsize < 0 )
+    {
+      sprintf(errbuf,"Cannot get dimension scale %s for field %s. \n", dimname, fieldname);
+      H5Epush(__FILE__, "HE5_GDgetdimscaleF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+						 
+  return((long)databuffsize);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDreaddscaleattrF (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with a dimension scale field       |
+|               from a GD.                                                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gdID           int     None        HDF-EOS type GRID  ID                   |
+|  fieldname      char                field name                              |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 10   Abe Taaheri   Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_GDreaddscaleattrF(int GridID, char *fieldname, char *attrname, void *datbuf)
+{
+  herr_t          status         = FAIL;       /* return status             */
+  hid_t           gdID           = FAIL;       /* HDF5 type grid ID         */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  
+
+  gdID = (hid_t)GridID;
+
+  status = HE5_GDreaddscaleattr(gdID, fieldname, attrname, datbuf);
+  if ( status < 0 )
+    {
+      sprintf(errbuf,"Cannot read attribute %s for dimension scale %s. \n", attrname, fieldname);
+      H5Epush(__FILE__, "HE5_GDreaddscaleattrF", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+						 
+  return((int)status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:  HE5_GDwritedscaleattrF (FORTRAN wrapper)                        |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with a dimension scale    |
+|               field in a GD.                                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gdID           int                 GRID structure ID                       |
+|  fieldname      char*               dimension scale SDS name                |
+|  attrname       char*               attribute name                          |
+|  numtype        int                 attribute datatype ID                   |
+|  count[]        long                Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10   Abe Taaheri   Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_GDwritedscaleattrF(int GridID, char *fieldname, char *attrname, int numtype, long count[], void *datbuf)
+{
+  herr_t          status         = FAIL;       /* return status             */
+  hid_t           gdID           = FAIL;       /* HDF5 type grid ID         */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  hsize_t         fort_count[HE5_FLDNUMBERMAX];
+
+  gdID = (hid_t)GridID;
+
+  fort_count[0] = (hsize_t)count[0];
+  status = HE5_GDwritedscaleattr(gdID, fieldname, attrname, (hid_t)numtype, fort_count, datbuf);
+
+  if ( status < 0 )
+    {
+      sprintf(errbuf,"Cannot write attribute %s for dimension scale %s. \n", attrname, fieldname);
+      H5Epush(__FILE__, "HE5_GDwritedscaleattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+						 
+  return((int)status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDdscaleattrinfoF (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about dimension scale attribute         |
+|               (attribute associated with a specified dimension scale field) |
+|                in a GD.                                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gdID           int       None      HDF-EOS type GRID  ID                   |
+|  fieldname      char*               field name                              |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          int                 attribute data type ID                  |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10   Abe Taaheri   Original Development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_GDdscaleattrinfoF(int GridID, char *fieldname, char *attrname, int *ntype, long *fortcount)
+{
+  herr_t          status         = FAIL;       /* return status             */
+  hid_t           gdID           = FAIL;       /* HDF5 type grid ID         */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  hsize_t         *count = (hsize_t *)NULL;    /* C-order count array       */
+  hid_t           *dtype  = (hid_t *)NULL;     /* Data type class ID        */
+
+  gdID = (hid_t)GridID;
+
+  dtype = (hid_t *)calloc(1, sizeof(hid_t));
+  if(dtype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for \"dtype\".\n");
+      H5Epush(__FILE__, "HE5_GDdscaleattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if(count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for \"count\".\n");
+      H5Epush(__FILE__, "HE5_GDdscaleattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(dtype);
+      return(FAIL);
+    }
+
+  count[0] = 0;
+
+  status = HE5_GDdscaleattrinfo(gdID, fieldname, attrname, dtype, count);
+
+  if ( status == FAIL)
+    {
+      sprintf(errbuf, "Cannot retrieve attribute info for the %s dimension scale. \n", fieldname);
+      H5Epush(__FILE__, "HE5_GDdscaleattrinfoF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(count);
+      free(dtype);
+      return(FAIL);
+    }
+
+  *fortcount = (long)(*count);
+  *ntype     = (int)(*dtype);
+
+  free(count);
+  free(dtype);
+  return((int)status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDinqdscaleattrsF (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list associated with a specified dimension scale   |
+|                in a GD.                                                     |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                number of attributes (-1 if fails)      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gdID           int     None        HDF-EOS type GRID  ID                   |
+|  fieldname      char                dimension scale name                    |
+|  attrnames      char                attribute name(s)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                String length of attribute (in bytes)   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  June 10   Abe Taaheri  Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_GDinqdscaleattrsF(int GridID, char *fieldname, char *attrnames, long *strbufsize)
+{
+  long            status         = FAIL;       /* return status             */
+  hid_t           gdID           = FAIL;       /* HDF5 type grid ID         */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  
+
+  gdID = (hid_t)GridID;
+
+  status = HE5_GDinqdscaleattrs(gdID, fieldname, attrnames, strbufsize);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot find the attribute %s for dimension scale %s. \n",attrnames,fieldname);
+      H5Epush(__FILE__, "HE5_GDinqdscaleattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDgetEastAndNorthFiles                                       |
+|                                                                             |
+|  DESCRIPTION:  With user provided STPDATADIR environment variable this      |
+|                functions returns the files needed for STP projection.       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  None           void                                                        |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  eastFile       char                 nad27 file provides in gctp            |
+|  northFile      char                 nad83 file provides in gctp            |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 11   Abe Taaheri   Added support for State Plane Projection grid       |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+void HE5_GDgetEastAndNorthFiles(char *eastFile, char *northFile)
+{
+    char *ptr = NULL;
+    char lastables[256];
+
+    ptr = (char *)getenv("STPDATADIR");
+
+#if defined(HDFVIEWPLUGIN)
+    if(ptr == NULL)
+      {
+	ptr = (char *)getenv("PWD");
+	strcpy(lastables, "STPDATADIR=");
+	strcat(lastables,ptr);
+	strcat(lastables,"/lib/ext/eosdata");
+	putenv(lastables);
+      }
+
+    ptr = (char *)getenv("STPDATADIR");
+
+#endif
+
+    if (ptr == NULL)
+    {
+      eastFile = (char *) NULL;
+      northFile = (char *) NULL;
+    }
+    else
+    {
+        strcpy(lastables, ptr);
+
+#if defined(CYGWIN)
+        sprintf( eastFile,  "%s/nad27sp_le", lastables );    /* use littlt endian binary files */
+        sprintf( northFile, "%s/nad83sp_le", lastables );
+#else
+        sprintf( eastFile,  "%s/nad27sp_be", lastables );    /* use big endian binary files */
+        sprintf( northFile, "%s/nad83sp_be", lastables );
+#endif
+
+
+    }
+
+    return;
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_GDflddiminfo                                                 |
+|                                                                             |
+|  DESCRIPTION:  This functions returns dims and maxdims                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  gridID         hid_t   None        HDF-EOS type grid  ID                   |
+|  fieldname      char*               fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  rank           int                 field rank                              |
+|  dims           hsize_t             dimensions of field                     |
+|  maxdims        hsize_t             max dimensions of field                 |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Sep 11   Abe Taaheri   Added support for unlimited dimension adjustment    |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_GDflddiminfo(int GridID, char *fieldname, int *rank,  hsize_t dims[], hsize_t maxdims[])
+{
+  herr_t      status         = FAIL;      /* return status             */
+  hid_t       gdID           = FAIL;      /* HDF5 type grid ID         */
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Buffer for error message  */
+  hid_t       ntype[1] = {FAIL};          /* Field numbertypes         */
+  char	      *dimlist    = (char *)NULL; /* Dimension list in C order */
+  char	      *maxdimlist = (char *)NULL; /* max Dimension list in C order */
+  char        *dimbuf   = (char *)NULL;   /* Dimension buffer          */
+  char        *comma    = (char *)NULL;   /* Pointer to comma          */
+  char        *dimcheck = (char *)NULL;   /* Dimension check buffer    */
+  hsize_t     dimsize   = 0;              /* Dimension size            */
+  int         maxrank     = 0;            /* max dim  rank             */
+  int         i           = 0;            /* Loop index                */
+  int         foundAllDim = 1;            /* found all dimensions flag */
+  int         first       = 1;            /* first entry flag          */
+  char        utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer            */
+  long        xdim  = 0;                  /* X dim size                */
+  long        ydim  = 0;                  /* Y dim size                */
+
+  gdID = (hid_t)GridID;
+
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  maxdimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  dimlist    = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(dimlist == NULL || maxdimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input list.\n");
+      H5Epush(__FILE__, "HE5_GDflddiminfo", __LINE__, H5E_RESOURCE, 
+	      H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get field info  */
+  /* --------------- */
+  status = HE5_GDfieldinfo(gdID, fieldname, rank, dims, ntype, 
+			   dimlist, maxdimlist);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Error calling HE5_GDfieldinfo. \n") ;
+      H5Epush(__FILE__, "HE5_GDflddiminfo", __LINE__, H5E_ARGS, 
+	      H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate space for dimbuf, copy maxdimlist into it, & append comma */
+  /* ------------------------------------------------------------------ */
+  if(maxdimlist != NULL)
+    {
+      dimbuf = (char *) calloc(strlen(maxdimlist) + 64, sizeof(char));
+      if(dimbuf == NULL)
+	{
+	  H5Epush(__FILE__, "HE5_GDflddiminfo", __LINE__, H5E_RESOURCE, 
+		  H5E_NOSPACE, "Cannot allocate memory. \n");
+	  HE5_EHprint("Error: Can not allocate memory, occured", 
+		      __FILE__, __LINE__);
+	  return(FAIL);
+
+	}
+	  
+      /* Copy "maxdimlist" to "dimbuf", & append comma */
+      /* --------------------------------------------- */
+      strcpy(dimbuf, maxdimlist);
+      strcat(dimbuf, ",");
+
+      /* Find comma */
+      /* ---------- */
+      comma = strchr(dimbuf, ',');
+
+      /*
+       * Loop through entries in dimension list to make sure they are
+       *                     defined in grid
+       */
+      while (comma != NULL)
+	{
+	  /* Copy dimension list entry to dimcheck */
+	  /* ------------------------------------- */
+	  dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char));
+	  if(dimcheck == NULL)
+	    {
+	      H5Epush(__FILE__, "HE5_GDflddiminfo", __LINE__, H5E_RESOURCE, 
+		      H5E_NOSPACE, "Cannot allocate memory. \n");
+	      HE5_EHprint("Error: Can not allocate memory, occured", 
+			  __FILE__, __LINE__);
+	      free(dimbuf);
+	      free(dimlist);
+	      free(maxdimlist);
+	      return(FAIL);
+	    }
+	  memmove(dimcheck, dimbuf, comma - dimbuf);
+
+	  /* Get dimension size */
+	  /* ------------------ */
+	  if ((strcmp(dimcheck, "XDim") == 0) || (strcmp(dimcheck, "YDim") == 0))
+	    {
+	      status = HE5_GDgridinfo(gdID, &xdim, &ydim, NULL, NULL);
+	      if(status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot get information about Grid.\n");
+		  H5Epush(__FILE__, "HE5_GDflddiminfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(dimbuf);
+		  free(dimlist);
+		  free(maxdimlist);
+		  return(FAIL);
+		}
+
+	      if(strcmp(dimcheck, "XDim") == 0)
+		{
+		  dimsize =  (hsize_t)xdim;
+		}
+	      else if(strcmp(dimcheck, "YDim") == 0)
+		{
+		  dimsize = (hsize_t)ydim;
+		}
+	    }
+	  else
+	    {
+	      dimsize = HE5_GDdiminfo(gdID, dimcheck);
+	    }
+
+	  if ( (dimsize > 0) || (dimsize == H5S_UNLIMITED) )
+	    {
+	      maxdims[maxrank] = dimsize;
+	      maxrank++;
+	    }
+	  else
+	    {
+	      /*
+	       * If dimension list entry not found - set error return
+	       * status, append name to utility buffer for error report
+	       */
+	      status = FAIL;
+	      foundAllDim = 0;
+	      if (first == 1)
+		strcpy(utlbuf, dimcheck);
+	      else
+		{
+		  strcat(utlbuf, ",");
+		  strcat(utlbuf, dimcheck);
+		}
+	      first = 0;
+	    }
+
+	  /*
+	   * Go to next dimension entry, find next comma, & free up
+	   * dimcheck buffer
+	   */
+
+	  memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); 
+	  comma = strchr(dimbuf, ',');
+	  free(dimcheck);
+	}
+
+      free(dimbuf);
+      free(dimlist);
+      free(maxdimlist);
+
+      /* If no dimensions found, report error */
+      /* ------------------------------------ */
+      if (foundAllDim == 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" field. \n",
+		  utlbuf, fieldname);
+	  H5Epush(__FILE__, "HE5_GDflddiminfo", __LINE__, H5E_BTREE, 
+		  H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+
+      /* If maxrank !=rank  then report error */
+      /* ------------------------------------ */
+      if ( maxrank != *rank )
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Dimension rank doesn't match Max dimension rank.\n");
+	  H5Epush(__FILE__, "HE5_GDflddiminfo", __LINE__, H5E_ARGS,
+		  H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+    } 
+  /* "maxlist == NULL"  ==> maxdims[]= dims[] */
+  /* ---------------------------------------- */
+  else
+    {
+      for(i = 0; i < *rank; i++ )
+	maxdims[ i ] = dims[ i ];
+    }
+
+  return (status);
+}
+
+
+
+
+#ifndef  __cplusplus
+
+/* HDF types used in FORTRAN bindings */
+ 
+#if defined(DEC_ALPHA) || defined(IRIX) || defined(UNICOS) || defined(LINUX64) || defined(IA64) || defined(MACINTOSH) || defined(MACINTEL) || defined(IBM6000) || defined(CYGWIN)
+ 
+#define INT32  INT
+#define INT32V INTV
+#define PINT32 PINT
+ 
+#else
+ 
+#define INT32  LONG
+#define INT32V LONGV
+#define PINT32 PLONG
+ 
+#endif
+
+
+/* File/Grid access routines */
+ 
+FCALLSCFUN2(INT, HE5_GDopenF, HE5_GDOPEN, he5_gdopen, STRING, INT)
+FCALLSCFUN6(INT, HE5_GDcreateF, HE5_GDCREATE, he5_gdcreate, INT, STRING, LONG, LONG, DOUBLEV, DOUBLEV)
+FCALLSCFUN2(INT, HE5_GDattachF, HE5_GDATTACH, he5_gdattach, INT, STRING)
+FCALLSCFUN1(INT, HE5_GDdetachF, HE5_GDDETACH, he5_gddetach, INT)
+FCALLSCFUN1(INT, HE5_GDcloseF, HE5_GDCLOSE, he5_gdclose, INT)
+
+
+/* Definition routines */
+
+FCALLSCFUN3(INT, HE5_GDdefdimF, HE5_GDDEFDIM, he5_gddefdim, INT, STRING, LONG)
+FCALLSCFUN5(INT, HE5_GDdefprojF, HE5_GDDEFPROJ, he5_gddefproj, INT, INT, INT, INT, DOUBLEV)
+FCALLSCFUN2(INT, HE5_GDdeforiginF, HE5_GDDEFORIGIN, he5_gddeforigin, INT, INT)
+FCALLSCFUN6(INT, HE5_GDdeffld, HE5_GDDEFFLD, he5_gddeffld, INT, STRING, STRING, STRING, INT, INT)
+FCALLSCFUN4(INT, HE5_GDsetfill, HE5_GDSETFILL, he5_gdsetfill, INT, STRING, INT, PVOID)
+FCALLSCFUN3(INT, HE5_GDdefcompF, HE5_GDDEFCOMP, he5_gddefcomp, INT, INT, INTV)
+FCALLSCFUN4(INT, HE5_GDdeftileF, HE5_GDDEFTLE, he5_gddeftle, INT, INT, INT, PLONG)
+FCALLSCFUN5(INT, HE5_GDdefcomtileF, HE5_GDDEFCOMTLE, he5_gddefcomtle, INT, INT, PINT, INT, PLONG)
+FCALLSCFUN2(INT, HE5_GDdefpixregF, HE5_GDDEFPREG, he5_gddefpreg, INT, INT)
+FCALLSCFUN3(INT, HE5_GDsetaliasF, HE5_GDSETALIAS, he5_gdsetalias, INT, STRING, STRING)
+FCALLSCFUN3(INT, HE5_GDdropaliasF, HE5_GDDRPALIAS, he5_gddrpalias, INT, INT, STRING)
+
+
+/* I/O routines */
+
+FCALLSCFUN6(INT, HE5_GDwrfld, HE5_GDWRFLD, he5_gdwrfld, INT, STRING, LONGV, LONGV, LONGV, PVOID)
+FCALLSCFUN8(INT, HE5_GDwrcharfld, HE5_GDWRCHARFLD, he5_gdwrcharfld, INT, STRING, INT, INT, LONGV, LONGV, LONGV, PVOID)
+FCALLSCFUN6(INT, HE5_GDrdfld, HE5_GDRDFLD, he5_gdrdfld, INT, STRING, LONGV, LONGV, LONGV, PVOID)
+FCALLSCFUN8(INT, HE5_GDrdcharfld, HE5_GDRDCHARFLD, he5_gdrdcharfld, INT, STRING, INT, INT, LONGV, LONGV, LONGV, PVOID)
+FCALLSCFUN3(INT, HE5_GDgetfill, HE5_GDGETFILL, he5_gdgetfill, INT, STRING, PVOID)
+FCALLSCFUN5(INT, HE5_GDwrattr, HE5_GDWRATTR, he5_gdwrattr, INT, STRING, INT, LONGV, PVOID)
+FCALLSCFUN5(INT, HE5_GDwrgattr, HE5_GDWRATTR, he5_gdwrgattr, INT, STRING, INT, LONGV, PVOID)
+FCALLSCFUN6(INT, HE5_GDwrlattr, HE5_GDWRLATTR, he5_gdwrlattr, INT, STRING, STRING, INT, LONGV, PVOID)
+FCALLSCFUN3(INT, HE5_GDrdattr, HE5_GDRDATTR, he5_gdrdattr, INT, STRING, PVOID)
+FCALLSCFUN3(INT, HE5_GDrdgattr, HE5_GDRDGATTR, he5_gdrdgattr, INT, STRING, PVOID)
+FCALLSCFUN4(INT, HE5_GDrdlattr, HE5_GDRDLATTR, he5_gdrdlattr, INT, STRING, STRING, PVOID)
+FCALLSCFUN4(INT, HE5_GDwrmeta, HE5_GDWRMETA, he5_gdwrmeta, INT, STRING, STRING, INT)
+
+
+/* Inquiry routines */
+
+FCALLSCFUN3(LONG, HE5_GDinqdimsF, HE5_GDINQDIMS, he5_gdinqdims, INT, PSTRING, LONGV)
+FCALLSCFUN2(LONG, HE5_GDdiminfoF, HE5_GDDIMINFO, he5_gddiminfo, INT, STRING)
+FCALLSCFUN4(INT, HE5_GDinqflds, HE5_GDINQFLDS, he5_gdinqflds, INT, PSTRING, INTV, INTV)
+FCALLSCFUN7(INT, HE5_GDfldinfo, HE5_GDFLDINFO, he5_gdfldinfo, INT, STRING, PINT, LONGV, INTV, PSTRING, PSTRING)
+FCALLSCFUN8(INT, HE5_GDinqdatatypeF, HE5_GDINQDATATYPE, he5_gdinqdatatype, INT, STRING, STRING, INT, PINT, PINT, PINT, PLONG)
+FCALLSCFUN3(LONG, HE5_GDinqgridF, HE5_GDINQGRID, he5_gdinqgrid, STRING, PSTRING, PLONG)
+FCALLSCFUN5(INT, HE5_GDgridinfoF, HE5_GDGRIDINFO, he5_gdgridinfo, INT, PLONG, PLONG, DOUBLEV, DOUBLEV)
+FCALLSCFUN5(INT, HE5_GDprojinfoF, HE5_GDPROJINFO, he5_gdprojinfo, INT, PINT, PINT, PINT, DOUBLEV)
+FCALLSCFUN9(INT, HE5_GDreginfo, HE5_GDREGINFO, he5_gdreginfo, INT, INT, STRING, PINT, PINT, LONGV, PLONG, DOUBLEV, DOUBLEV)
+FCALLSCFUN4(INT, HE5_GDatinfo, HE5_GDATINFO, he5_gdattrinfo, INT, STRING, PINT, PLONG)
+FCALLSCFUN4(INT, HE5_GDgatinfo, HE5_GDGATINFO, he5_gdgatinfo, INT, STRING, PINT, PLONG)
+FCALLSCFUN5(INT, HE5_GDlatinfo, HE5_GDLATINFO, he5_gdlatinfo, INT, STRING, STRING, PINT, PLONG)
+FCALLSCFUN2(INT, HE5_GDorigininfoF, HE5_GDORGINFO, he5_gdorginfo, INT, PINT)
+FCALLSCFUN2(INT, HE5_GDpixreginfoF, HE5_GDPREGINFO, he5_gdpreginfo, INT, PINT)
+FCALLSCFUN4(INT, HE5_GDcompinfoF, HE5_GDCOMPINFO, he5_gdcompinfo, INT, STRING, PINT, INTV)
+FCALLSCFUN3(LONG, HE5_GDnentriesF, HE5_GDNENTRIES, he5_gdnentries, INT, INT, PLONG)
+FCALLSCFUN3(LONG, HE5_GDinqattrsF, HE5_GDINQATTRS, he5_gdinqattrs, INT, PSTRING, PLONG)
+FCALLSCFUN3(LONG, HE5_GDinqgrpattrsF, HE5_GDINQGATTRS, he5_gdinqgattrs, INT, PSTRING, PLONG)
+FCALLSCFUN4(LONG, HE5_GDinqlocattrsF, HE5_GDINQLATTRS, he5_gdinqlattrs, INT, STRING, PSTRING, PLONG)
+FCALLSCFUN5(INT, HE5_GDtileinfoF, HE5_GDTILEINFO, he5_gdtileinfo,INT,STRING,PINT,PINT,LONGV)
+FCALLSCFUN5(INT, HE5_GDaliasinfoF, HE5_GDALIASINFO, he5_gdaliasinfo, INT, INT, STRING, PINT, STRING)
+FCALLSCFUN3(LONG, HE5_GDinqfldaliasF, HE5_GDINQFLDALIAS, he5_gdinqfldalias,INT,PSTRING,PLONG)
+FCALLSCFUN4(LONG, HE5_GDgetaliaslistF, HE5_GDGETALIASLIST, he5_gdgetaliaslist,INT,INT,PSTRING,PLONG)
+
+
+
+/* Subsetting/Retrieving routines */
+
+FCALLSCFUN3(INT, HE5_GDdefboxregionF, HE5_GDDEFBOXREG, he5_gddefboxreg, INT, DOUBLEV, DOUBLEV)
+FCALLSCFUN4(INT, HE5_GDextractregionF, HE5_GDEXTREG, he5_gdextreg, INT, INT, STRING, PVOID)
+FCALLSCFUN4(INT, HE5_GDdeftimeperiodF, HE5_GDDEFTMEPER, he5_gddeftmeper, INT, INT, DOUBLE, DOUBLE)
+FCALLSCFUN4(INT, HE5_GDdefvrtregionF, HE5_GDDEFVRTREG, he5_gddefvrtreg, INT, INT, STRING, DOUBLEV)
+FCALLSCFUN1(INT, HE5_GDdupregionF, HE5_GDDUPREG, he5_gddupreg, INT)
+FCALLSCFUN6(INT, HE5_GDgetpixelsF, HE5_GDGETPIX, he5_gdgetpix, INT, LONG, DOUBLEV, DOUBLEV, LONGV, LONGV)
+FCALLSCFUN6(LONG, HE5_GDgetpixvaluesF, HE5_GDGETPIXVAL, he5_gdgetpixval, INT, LONG, LONGV, LONGV, STRING, PVOID)
+FCALLSCFUN6(LONG, HE5_GDinterpolateF, HE5_GDINTERPOLATE, he5_gdinterpolate, INT, LONG, DOUBLEV, DOUBLEV, STRING, DOUBLEV)
+
+/* EXTERNAL DATA FILE INTERFACE */
+
+FCALLSCFUN4(INT, HE5_GDsetextdataF, HE5_GDSETXDAT, he5_gdsetxdat,INT,STRING,LONGV,LONGV)
+FCALLSCFUN6(INT, HE5_GDgetextdataF, HE5_GDGETXDAT, he5_gdgetxdat,INT,STRING,LONG,STRING,LONGV,LONGV)
+
+
+/* Utility routine */
+
+
+FCALLSCFUN15(INT,HE5_GDij2ll, HE5_GDIJ2LL, he5_gdij2ll, INT, INT, DOUBLEV, INT, LONG, LONG, DOUBLEV, DOUBLEV, LONG, LONGV, LONGV, DOUBLEV, DOUBLEV, INT, INT)
+FCALLSCFUN15(INT,HE5_GDll2ij, HE5_GDLL2IJ, he5_gdll2ij, INT, INT, DOUBLEV, INT, LONG, LONG, DOUBLEV, DOUBLEV, LONG, DOUBLEV, DOUBLEV, LONGV, LONGV, DOUBLEV, DOUBLEV)
+FCALLSCFUN13(INT, HE5_GDrs2ll, HE5_GDRS2LL, he5_gdrs2ll, INT, DOUBLEV, LONG, LONG, DOUBLEV, DOUBLEV, INT, DOUBLEV, DOUBLEV, DOUBLEV, DOUBLEV, INT, INT) 
+
+FCALLSCFUN5(INT, HE5_GDdefdimscaleF, HE5_GDDEFDIMSCALE, he5_gddefdimscale,INT,STRING,LONG,INT,PVOID)
+FCALLSCFUN6(INT, HE5_GDsetdimscaleF, HE5_GDSETDIMSCALE, he5_gdsetdimscale,INT,STRING,STRING,LONG,INT,PVOID)
+FCALLSCFUN6(LONG, HE5_GDgetdimscaleF, HE5_GDGETDIMSCALE, he5_gdgetdimscale,INT,STRING,STRING,PLONG,PINT,PVOID)
+FCALLSCFUN4(INT, HE5_GDreaddscaleattrF,HE5_GDREADDSCALEATTR, he5_gdreaddscaleattr,INT,STRING,STRING,PVOID)
+FCALLSCFUN6(INT, HE5_GDwritedscaleattrF, HE5_GDWRITEDSCALEATTR, he5_gdwritedscaleattr,INT,STRING,STRING,INT,LONGV,PVOID)
+FCALLSCFUN5(INT, HE5_GDdscaleattrinfoF, HE5_GDDSCALEATTRINFO, he5_gddscaleattrinfo,INT,STRING,STRING,PINT,PLONG)
+FCALLSCFUN4(INT, HE5_GDinqdscaleattrsF, HE5_GDINQDSCALATTRS, he5_gdinqdscaleattrs,INT,STRING,STRING,PLONG)
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Makefile b/src/Makefile
new file mode 100755
index 0000000..74b900f
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,92 @@
+# Copyright (C) 1996 Hughes and Applied Research Corporation
+#
+# Permission to use, modify, and distribute this software and its
+# documentation for any purpose without fee is hereby granted, provided that
+# the above copyright notice appear in all copies and that both that copyright
+# notice and this permission notice appear in supporting documentation.
+#
+# Makefile
+# 
+# Makefile for field build of HDFEOS
+#
+# The following environment variables must be defined:
+#
+#   Flags:
+#     AR           library archiving program and flags (e.g.: ar -r)
+#     CC           C language compiler (e.g.: cc)
+#     CFHFLAGS     C compiler flags and cfortran.h switches
+#                  (e.g.: -Xa -O -DsunFortan)
+#     RANLIB       ranlib program (e.g. ranlib)
+#
+#   Directories:
+#     HDFEOS5_INC   HDF-EOS include directory ($HDFEOS5_HOME/include)
+#     HDFEOS5_LIB   HDF-EOS library directory ($HDFEOS5_HOME/lib/$BRAND)
+#     HDFEOS5_OBJ   HDF-EOS object directory ($HDFEOS5_HOME/obj/$BRAND)
+
+# force make program to use bourne shell
+SHELL=/bin/sh
+
+# define remove utility
+RM = rm -f 
+
+AR = ar -r
+
+# define C preprocessor symbols 
+DFLAGS = -D$(HDFSYS) -DHDFVIEWPLUGIN
+
+# location of include files need to compile source code
+IFLAGS = -I. -I$(HDFEOS5_INC) -I$(HDF5INC)
+
+# object files needed to build library
+LIBOFILES = \
+	$(HDFEOS5_OBJ)/EHapi.o \
+	$(HDFEOS5_OBJ)/TSapi.o \
+	$(HDFEOS5_OBJ)/PTapi.o \
+	$(HDFEOS5_OBJ)/GDapi.o \
+	$(HDFEOS5_OBJ)/SWapi.o \
+	$(HDFEOS5_OBJ)/ZAapi.o
+
+# default target, this just builds the hdfeos5 library
+all:
+	@if [ "$(BRAND)" = "sun4" ] ; then				\
+		$(MAKE) $(MFLAGS) $(HDFEOS5_LIB)/libhe5_hdfeos.a ranlib;	\
+	else								\
+		$(MAKE) $(MFLAGS) $(HDFEOS5_LIB)/libhe5_hdfeos.a;		\
+	fi
+
+$(HDFEOS5_LIB)/libhe5_hdfeos.a: $(LIBOFILES)
+	$(AR) $@ $?
+
+ranlib:
+	$(RANLIB) $(HDFEOS5_LIB)/libhe5_hdfeos.a
+
+install: 
+	@echo "no binaries to move"
+	@echo "don't worry"
+
+clean:
+	$(RM) *.o $(HDFEOS5_OBJ)/*.o
+
+
+$(HDFEOS5_OBJ)/EHapi.o : EHapi.c 
+	$(CC) $(CFHFLAGS) $(DFLAGS) $(IFLAGS) -c $? -o $@
+
+$(HDFEOS5_OBJ)/TSapi.o : TSapi.c
+	$(CC) $(CFHFLAGS) $(DFLAGS) $(IFLAGS) -c $? -o $@
+
+$(HDFEOS5_OBJ)/PTapi.o : PTapi.c
+	$(CC) $(CFHFLAGS) $(DFLAGS) $(IFLAGS) -c $? -o $@
+
+$(HDFEOS5_OBJ)/SWapi.o : SWapi.c
+	$(CC) $(CFHFLAGS) $(DFLAGS) $(IFLAGS) -c $? -o $@
+
+$(HDFEOS5_OBJ)/GDapi.o : GDapi.c
+	$(CC) $(CFHFLAGS) $(DFLAGS) $(IFLAGS) -c $? -o $@
+
+$(HDFEOS5_OBJ)/ZAapi.o : ZAapi.c
+	$(CC) $(CFHFLAGS) $(DFLAGS) $(IFLAGS) -c $? -o $@
+
+.c.o:
+	$(MAKE) $(MFLAGS) $(HDFEOS5_OBJ)/$@
+
+
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..76b1d4c
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,19 @@
+# HDF-EOS5 src Makefile.am
+
+# Boilerplate definitions
+include $(top_srcdir)/config/include.am
+
+## Note that gctp/include contains several header files with the same names
+## as files in $(top_srcdir)/include.  This doesn't currently cause problems
+## in this directory, but may if Automake changes.
+INCLUDES=-I$(top_srcdir)/include/
+
+# Set LDFLAGS to allow the HDF-EOS library to use extern variables from
+# HDF5
+LDFLAGS=-Wl,-single_module
+
+# Build HDF-EOS5
+lib_LTLIBRARIES=libhe5_hdfeos.la
+
+# Source files for library
+libhe5_hdfeos_la_SOURCES=EHapi.c GDapi.c PTapi.c SWapi.c TSapi.c ZAapi.c
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..86880e5
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,497 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+# HDF-EOS5 src Makefile.am
+
+SOURCES = $(libhe5_hdfeos_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/config/include.am
+subdir = src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/HE5_config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libhe5_hdfeos_la_LIBADD =
+am_libhe5_hdfeos_la_OBJECTS = EHapi.lo GDapi.lo PTapi.lo SWapi.lo \
+	TSapi.lo ZAapi.lo
+libhe5_hdfeos_la_OBJECTS = $(am_libhe5_hdfeos_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -DH5_USE_16_API
+LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS) -DH5_USE_16_API
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libhe5_hdfeos_la_SOURCES)
+DIST_SOURCES = $(libhe5_hdfeos_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F2CFORTRAN_32PTR_CONDITIONAL_FALSE = @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@
+F2CFORTRAN_32PTR_CONDITIONAL_TRUE = @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@
+F2CFORTRAN_90_CONDITIONAL_FALSE = @F2CFORTRAN_90_CONDITIONAL_FALSE@
+F2CFORTRAN_90_CONDITIONAL_TRUE = @F2CFORTRAN_90_CONDITIONAL_TRUE@
+F2CFORTRAN_CONDITIONAL_FALSE = @F2CFORTRAN_CONDITIONAL_FALSE@
+F2CFORTRAN_CONDITIONAL_TRUE = @F2CFORTRAN_CONDITIONAL_TRUE@
+F77 = @F77@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_INCLUDE_CONDITIONAL_FALSE = @INSTALL_INCLUDE_CONDITIONAL_FALSE@
+INSTALL_INCLUDE_CONDITIONAL_TRUE = @INSTALL_INCLUDE_CONDITIONAL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+
+# Set LDFLAGS to allow the HDF-EOS library to use extern variables from
+# HDF5
+LDFLAGS = -Wl,-single_module
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SZIP_ENCODER_CONDITIONAL_FALSE = @SZIP_ENCODER_CONDITIONAL_FALSE@
+SZIP_ENCODER_CONDITIONAL_TRUE = @SZIP_ENCODER_CONDITIONAL_TRUE@
+TESTDRIVERS_CONDITIONAL_FALSE = @TESTDRIVERS_CONDITIONAL_FALSE@
+TESTDRIVERS_CONDITIONAL_TRUE = @TESTDRIVERS_CONDITIONAL_TRUE@
+THREADSAFE_CONDITIONAL_FALSE = @THREADSAFE_CONDITIONAL_FALSE@
+THREADSAFE_CONDITIONAL_TRUE = @THREADSAFE_CONDITIONAL_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la
+LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
+
+# Boilerplate definitions
+INCLUDES = -I$(top_srcdir)/include/
+
+# Build HDF-EOS5
+lib_LTLIBRARIES = libhe5_hdfeos.la
+
+# Source files for library
+libhe5_hdfeos_la_SOURCES = EHapi.c GDapi.c PTapi.c SWapi.c TSapi.c ZAapi.c
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libhe5_hdfeos.la: $(libhe5_hdfeos_la_OBJECTS) $(libhe5_hdfeos_la_DEPENDENCIES) 
+	$(LINK) -rpath $(libdir) $(libhe5_hdfeos_la_LDFLAGS) $(libhe5_hdfeos_la_OBJECTS) $(libhe5_hdfeos_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/EHapi.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/GDapi.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/PTapi.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/SWapi.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TSapi.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ZAapi.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(mkdir_p) $(distdir)/../config
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(libdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libLTLIBRARIES clean-libtool ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am \
+	install-libLTLIBRARIES install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-libLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/Makefile_CM b/src/Makefile_CM
new file mode 100755
index 0000000..25a62f2
--- /dev/null
+++ b/src/Makefile_CM
@@ -0,0 +1,79 @@
+
+# Copyright (C) 1996 Hughes and Applied Research Corporation
+#
+# Permission to use, modify, and distribute this software and its documentation 
+# for any purpose without fee is hereby granted, provided that the above 
+# copyright notice appear in all copies and that both that copyright notice and 
+# this permission notice appear in supporting documentation.
+#
+## Template Makefile. See instructions in Makefile.instr ##
+ 
+CSCI    =   hdfeos5
+ 
+include $(SUBSYSTOP)/make/make.options
+ 
+ 
+##############CUSTOM DEFINITIONS ########################################
+ 
+ 
+##############END OF CUSTOM DEFINITIONS##################################
+ 
+CXXSRCFILES     =
+ 
+CSRCFILES       = EHapi.c PTapi.c TSapi.c SWapi.c GDapi.c ZAapi.c
+ 
+HFILES          = HE5_HdfEosDef.h cfortHdf.h
+ 
+OBJFILES        = EHapi.o PTapi.o TSapi.o SWapi.o GDapi.o ZAapi.o
+ 
+LIBFILES        = $(LIBDIR)/libhe5_hdfeos.a
+ 
+BINFILES        =
+ 
+ 
+all: libhe5_hdfeos.a
+
+libhe5_hdfeos.a:	EHapi.o TSapi.o PTapi.o SWapi.o GDapi.o ZAapi.o
+	${AR} $@ $?
+
+EHapi.o	: EHapi.c
+	${CC} ${INCLUDE} -c Ehapi.c -o EHapi.o
+
+TSapi.o	: TSapi.c
+	${CC} ${INCLUDE} -c TSapi.c -o TSapi.o
+
+PTapi.o	: PTapi.c
+	${CC} ${INCLUDE} -c PTapi.c -o PTapi.o
+
+SWapi.o	: SWapi.c
+	${CC} ${INCLUDE} -c SWapi.c -o SWapi.o
+
+GDapi.o	: GDapi.c
+	${CC} ${INCLUDE} -c GDapi.c -o GDapi.o
+
+ZAapi.o : ZAapi.c
+        ${CC} ${INCLUDE} -c ZAapi.c -o ZAapi.o
+
+ 
+ 
+ 
+##############End of build target definitions############################
+ 
+ 
+CLEANFILES      = $(OBJFILES) $(LIBFILES) $(BINFILES)
+ 
+INSHFILES       = $(HFILES)
+ 
+INSLIBFILES     = $(LIBFILES)
+ 
+INSBINFILES     =
+ 
+LABELFILES      = $(LIBFILES)
+ 
+TESTSUBDIRS     = test
+ 
+include $(SUBSYSTOP)/make/make.targets
+
+
+
+
diff --git a/src/Makefile_alt b/src/Makefile_alt
new file mode 100755
index 0000000..c7de1d0
--- /dev/null
+++ b/src/Makefile_alt
@@ -0,0 +1,97 @@
+#
+#
+# Copyright (C) 1996 Hughes and Applied Research Corporation
+#
+# Permission to use, modify, and distribute this software and its documentation 
+# for any purpose without fee is hereby granted, provided that the above 
+# copyright notice appear in all copies and that both that copyright notice and 
+# this permission notice appear in supporting documentation.
+#
+# Makefile
+# 
+# Makefile for field build of HDFEOS5
+#
+# The following environment variables must be defined:
+#
+#   Flags:
+#     AR
+#     CC
+#     F77
+#     MACHINE
+#     NSL_FLAG 		(Set to -lnsl on Sun, blank on all others)
+#     RANLIB
+# 
+#   Directories:
+#     HDFEOS5_BIN
+#     HDFEOS5_INC
+#     HDFEOS5_LIB
+#     HDFEOS5_OBJ
+#     HDFEOS5_SRC
+
+
+SHELL=/bin/sh
+
+INCLUDE = -I. -I$(HDFEOS5_INC) -I$(HDF5INC)
+LIBRARY = -L. -L$(HDFEOS5_LIB) -L$(HDF5LIB)
+GCTP = -lGctp
+
+LDFLAGS = -lhe5_hdfeos $(GCTP) -lhdf5 $(NSL_FLAG) -lz -lm
+
+RM = rm -f 
+
+.SUFFIXES :
+.SUFFIXES : .o .c .f
+
+.c.o:
+	$(CC) $(INCLUDE) -c $<
+
+.f.o:
+	$(F77) -c $<
+
+
+all: libhe5_hdfeos.a
+
+hdfeos5: libhe5_hdfeos.a
+
+
+libhe5_hdfeos.a : EHapi.o TSapi.o PTapi.o SWapi.o GDapi.o ZAapi.o
+	@if [ -f $(HDFEOS5_LIB)/$@ ] ; then \
+	    echo "Removing old library." ; \
+	    $(RM) $(HDFEOS5_LIB)/$@  ; \
+	fi
+	$(AR) $(HDFEOS5_LIB)/$@ $?
+	$(RANLIB) $(HDFEOS5_LIB)/$@
+
+EHapi.o : EHapi.c 
+	$(CC) $(INCLUDE) -c EHapi.c -o $@
+
+TSapi.o : TSapi.c
+	$(CC) $(INCLUDE) -c TSapi.c -o $@
+
+PTapi.o : PTapi.c
+	$(CC) $(INCLUDE) -c PTapi.c -o $@
+
+SWapi.o : SWapi.c
+	$(CC) $(INCLUDE) -c SWapi.c -o $@
+
+GDapi.o : GDapi.c
+	$(CC) $(INCLUDE) -c GDapi.c -o $@
+
+ZAapi.o : ZAapi.c
+        $(CC) $(INCLUDE) -c ZAapi.c -o $@
+
+
+install: 
+	echo "No files to move"
+
+clean:
+	$(RM) *.o $(HDFEOS5_OBJ)/*.o
+
+
+
+
+
+
+
+
+
diff --git a/src/PTapi.c b/src/PTapi.c
new file mode 100755
index 0000000..f2e86d4
--- /dev/null
+++ b/src/PTapi.c
@@ -0,0 +1,13307 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ |                                                                          |
+ |  Permission to use, modify, and distribute this software and its         |
+ |  documentation for any purpose without fee is hereby granted, provided   |
+ |  that the above copyright notice appear in all copies and that both that |
+ |  copyright notice and this permission notice appear in supporting        |
+ |                          documentation.                                  |
+ ----------------------------------------------------------------------------
+ */
+
+#include <HE5_HdfEosDef.h>
+
+/*#define	HE5_PTIDOFFSET 1342177282*/   /*  (2**27)*10+2  */
+/*modified HE5_PTIDOFFSET to the same value as HE5_GRIDOFFSET,
+  HE5_SWIDOFFSET,  HE5_ZAIDOFFSET, i.e. 671088642, for HDF-EOS5 version 2.11 */
+
+#define	HE5_PTIDOFFSET 671088642    /* (2**26)*10 + 2  */
+#define HE5_NPOINT             64
+#define HE5_NPOINTREGN        256
+#define HE5_NRECS               1
+
+struct HE5_pointStructure
+{
+  int          active;		  	  /* Flag: if file is active or not */
+
+  hid_t        fid;     	    	  /* HDF-EOS file ID                */
+  hid_t        pt_id;			  /* Specified Point group ID       */
+  hid_t        data_id;			  /* "Data" group ID                */
+  hid_t        link_id;			  /* "Linkage" group ID             */
+
+  HE5_DTSinfo  level[HE5_DTSETRANKMAX];   /* Level ID and name              */
+
+  char         ptname[HE5_OBJNAMELENMAX]; /* Point name                     */
+};
+
+struct HE5_pointStructure HE5_PTXPoint[HE5_NPOINT];
+
+typedef struct 
+{
+  HE5_DTSinfo  level[HE5_DTSETRANKMAX];
+  int      nlevels;
+} pack;
+
+
+typedef struct
+{
+  LONGLONG    back;
+} bckptr;
+
+
+typedef struct
+{
+  LONGLONG    begin;
+  LONGLONG    extent;
+} fwdptr;
+
+
+struct HE5_pointRegion 
+{
+  hid_t     fid;
+  hid_t     pointID;
+
+  hsize_t   nrec[HE5_DTSETRANKMAX];
+  hssize_t  *recPtr[HE5_DTSETRANKMAX];
+};
+
+struct HE5_pointRegion *HE5_PTXRegion[HE5_NPOINTREGN];
+
+
+/* Point Prototypes (internal routines) */
+
+static herr_t       
+HE5_PTchkptid(hid_t pointID, const char *routname, hid_t *fid, hid_t *gid,  long *idx);
+static herr_t      
+HE5_PTfexist(hid_t  dataID, const char *fldname, size_t *size,  int *rank, size_t dims[], hid_t *dtype );
+herr_t       
+HE5_PTlinkinfo(hid_t, hid_t, int level, char *mode, char *linkfield);
+static herr_t       
+HE5_PTwrbckptr(hid_t pointID, int level);
+static herr_t      
+HE5_PTrdbckptr(hid_t pointID, int level, void *buffer) ;
+static herr_t       
+HE5_PTwrfwdptr(hid_t pointID, int level);
+static herr_t       
+HE5_PTrdfwdptr(hid_t pointID, int level, void *buffer);
+static herr_t       
+HE5_PTwritesetup(hid_t pointID,  int level, hssize_t *nrec);
+static hid_t     
+HE5_PTrecnum(hid_t pointID, int level, int minlevel, int maxlevel, hsize_t nrec, hssize_t recs[]);
+hid_t        
+HE5_PTopenlevel(hid_t loc_id, const char *name, void *opdata);
+int 
+HE5_PTgetdtypesize(hid_t levelID, int i);
+herr_t  
+HE5_PTgetlevelname_fromSM(hid_t pointID, int level, char *LevelName); 
+
+/* FORTRAN wrappers */
+/* ================ */
+
+/* File/Point access routine */
+
+int
+HE5_PTopenF(char *filename, uintn Flags);
+int 
+HE5_PTcreateF(int FileID, char *pointname);
+int
+HE5_PTattachF(int FileID, char *pointname);
+int
+HE5_PTdetachF(int pointID);
+int 
+HE5_PTcloseF(int FileID);
+
+/* Definition routines */
+
+int
+HE5_PTdeflevelF(int  pointID, const char *levelname, int rank[], char *fieldlist, long *dim_sizes, int dtype[], int array[]);
+int  
+HE5_PTdeflinkageF(int pointID, char *parent, char *child, char *linkfield);
+
+/* I/O routines */
+
+int 
+HE5_PTreadlevelF(int pointID, int level, char *fieldname, int ntype, void *datbuf);
+int
+HE5_PTupdatelevelF(int pointID, int level, char *fieldlist, long nrec,  long recs[], int ntype, void *data);
+int
+HE5_PTwritelevelF(int pointID, int level, long count[], char *fieldname, int ntype, void *data);
+int
+HE5_PTwriteattrF(int pointID, const char *attrname, int ntype, long fortcount[], void *datbuf);
+int
+HE5_PTwritegrpattrF(int pointID, const char *attrname, int ntype, long fortcount[], void * datbuf);
+int 
+HE5_PTwritelocattrF(int pointID, const char *levelname, const char *attrname, int ntype, long count[],void * datbuf);
+int 
+HE5_PTreadattrF(int pointID, const char *attrname, void *datbuf);
+int  
+HE5_PTreadgrpattrF(int pointID, const char *attrname, void *datbuf);
+int  
+HE5_PTreadlocattrF(int pointID, const char *levelname, const char *attrname, void *datbuf);
+int       
+HE5_PTwrbckptrF(int pointID, int level);
+int       
+HE5_PTwrfwdptrF(int pointID, int level);
+
+/* Inquiry routines */
+
+int 
+HE5_PTnrecsF(int pointID, int level);
+int
+HE5_PTnlevelsF(hid_t pointID);
+int 
+HE5_PTnfieldsF(int pointID, int level, char *fieldlist, long *strbufsize);
+int  
+HE5_PTlevelindxF(int pointID, const char *levelname);
+int 
+HE5_PTgetlevelnameF(int pointID, int  level, char *levelname, long *strbufsize);
+int 
+HE5_PTbcklinkinfoF(int pointID, int level, char *linkfield);
+int   
+HE5_PTfwdlinkinfoF(int pointID, int level, char *linkfield);
+int  
+HE5_PTlevelinfoF(int pointID, int level, char *levelname, int rank[], char *fieldlist, long *dim_sizes, long *datasize, long offset[], int dtype[]);
+int   
+HE5_PTinqdatatypeF(int pointID, char *fieldname, char *attrname, int fieldgroup, int *Type, int *Class, int *Order, long *size);
+int  
+HE5_PTinqpointF(const char *filename, char *pointlist, long *strbufsize);
+int 
+HE5_PTattrinfoF(int pointID, const char *attrname, int *numbertype, long *fortcount);
+int
+HE5_PTgrpattrinfoF(int pointID, const char *attrname, int *numbertype, long *fortcount);
+int   
+HE5_PTlocattrinfoF(int pointID, const char *levelname, const char *attrname, int *numbertype, long *fortcount);
+long 
+HE5_PTinqattrsF(int pointID, char *attrnames, long *strbufsize);
+long 
+HE5_PTinqgrpattrsF(int pointID, char *attrnames, long *strbufsize);
+long 
+HE5_PTinqlocattrsF(int pointID, const char *levelname, char *attrnames, long *strbufsize);
+int
+HE5_PTnumtypeinfoF(int pointID, int level, int numtype[]);
+
+
+/* Fortran Wrapper Utility Routines  */
+
+static int
+HE5_PTfort2c(long dims[], int rank, int datatype, void *inputfortbuf, void *outputfortbuf);
+static int
+HE5_PTc2fort(long dims[], int rank, int datatype, void *inputfortbuf, void *outputfortbuf);
+
+/* Fortran Wrappers (internal routines) */
+
+static int 
+HE5_PTgetfort_order(long *dims, int dim_index, long *c_index, int rank, long *P, long *coeffs, long *n);
+static herr_t   
+HE5_PTreadlevel_f(hid_t pointID, int level, char *fieldname, hid_t dtype, void *datbuf);  
+static herr_t 
+HE5_PTwritelevel_f(hid_t pointID, int level, hsize_t count[], char *fieldname, int ntype, hid_t dtype, void *data);
+static herr_t  
+HE5_PTupdatelevel_f(hid_t pointID, int level, char *fieldlist, hsize_t nrec,  hssize_t recs[], int ntype, hid_t dtype, void *data);
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTopen                                                       |
+|                                                                             |
+|  DESCRIPTION: Opens an HDF file and returns file ID.                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  fid            hid_t               HDF-EOS file ID                         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  filename       char                Point Filename                          |
+|  flags          uintn               Access Code                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7.20.99  A. Muslimov                                                       |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t 
+HE5_PTopen(const char *filename, uintn flags)
+{
+  hid_t       fid    = FAIL;/* HDF-EOS file ID */
+
+  /* Call HE5_EHopen to open file */
+  /* ---------------------------- */
+  fid = HE5_EHopen(filename,flags, H5P_DEFAULT );
+
+  return (fid);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTcreate                                                     |
+|                                                                             |
+|  DESCRIPTION: Creates a new point structure and returns point ID.           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  pointID        hid_t               Point structure ID                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               HDF-EOS File ID                         |
+|  pointname      char                Point structure name                    |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date         Programmer     Description                                   |
+|  ===========   ============  ============================================   |
+|  7.18.99       A.Muslimov    Unmasked hdf5 data types.                      |
+|  12/13/99      A.Muslimov    Added proper error handlings after the function|
+|                              calls. Replace a call EHattrcat() by           |
+|                              EHdatasetcat().                                |
+|  09/13/01      A.Muslimov    Added mutex "lock"/"unlock" calls.             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t 
+HE5_PTcreate(hid_t fid, const char *pointname)
+{
+  hid_t           pointID    = FAIL;/* HDF-EOS point ID (return value) */
+
+  herr_t          status     = FAIL;/* routine return status variable  */
+
+  int             i, j;			    /* Loop indices                    */
+  int             npointopen = 0;   /* # of point structures open      */
+  int             rank       = 1;   /* rank of a data space            */
+
+  uintn           access     = 99;  /* Read/Write file access code     */
+
+  unsigned int    zerobuf[HE5_DTSETRANKMAX];/* "Level Written" buffer  */
+
+  hid_t           HDFfid    = FAIL;/* HDF file ID                      */
+  hid_t           gid       = FAIL;/* HDFEOS group ID                  */
+  hid_t           pt_id     = FAIL;/* HDF5 object point ID             */      
+  hid_t           data_id   = FAIL;/* Data group ID                    */
+  hid_t           link_id   = FAIL;/* Linkage group ID                 */
+  hid_t           lvwr_id   = FAIL;/* "LevelWritten" ID                */
+  hid_t           sid       = FAIL;/* Data space ID                    */
+  hid_t           POINTS_ID = FAIL;/* "POINTS" group ID                */
+ 
+  long            nPoint    =  0;  /* Point counter                    */
+
+  hsize_t         count     = HE5_DTSETRANKMAX;
+    
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* error message buffer */
+  char            utlbuf[HE5_HDFE_UTLBUFSIZE]; /* Utility buffer       */
+  char            utlbuf2[HE5_HDFE_UTLBUFSIZE];/* Utility buffer 2     */
+
+
+  HE5_LOCK;
+  CHECKNAME(pointname);
+
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    zerobuf[ i ] = 0;
+    
+  /* Check HDF-EOS file ID  */
+  /* ---------------------  */
+  status = HE5_EHchkfid(fid, pointname, &HDFfid, &gid, &access);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Checking file ID failed.\n");
+      H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+    
+  /* Check pointname for length */
+  /* -------------------------- */
+  if ( strlen(pointname) > HE5_OBJNAMELENMAX)
+    {
+      sprintf(errbuf, "Pointname \"%s\" must be less than %d characters.\n",  pointname, HE5_OBJNAMELENMAX);
+      H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+   
+  /* Determine number of points currently opened */
+  /* ------------------------------------------- */
+  for (i = 0; i < HE5_NPOINT; i++)
+    npointopen += HE5_PTXPoint[i].active;
+
+  if(npointopen <  HE5_NPOINT)
+    {
+      /* Probe , check if "POINTS" group exist*/
+      H5E_BEGIN_TRY {
+	POINTS_ID = H5Gopen(gid, "POINTS");
+      }
+      H5E_END_TRY;
+
+      /* Group "POINTS" not exist*/
+      if(POINTS_ID == FAIL)
+	{
+	  nPoint = 0;
+
+	  /* create the POINTS group*/
+	  POINTS_ID = H5Gcreate(gid,"POINTS",0);
+	  if (POINTS_ID == FAIL)
+	    {
+              sprintf(errbuf, "Cannot create \"POINTS\" group.\n");
+              H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+              HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	     
+	}
+      /* Group "POINTS" exist */
+      else
+	{
+	  /* Probe , check if pointname group exist*/
+	  H5E_BEGIN_TRY{
+	    pt_id = H5Gopen(POINTS_ID, pointname);
+	  }
+	  H5E_END_TRY;
+
+	  if( pt_id == FAIL)
+	    {
+	      /* Get the number of points in "POINTS" group*/
+	      nPoint= HE5_EHdatasetcat(fid, "/HDFEOS/POINTS", NULL,NULL);
+	      if (nPoint == FAIL)
+		{
+		  sprintf(errbuf,"Cannot retrieve the number of points.");
+		  H5Epush(__FILE__, "HE5_PTcreate",__LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  status = H5Gclose(POINTS_ID);
+		  return(FAIL);
+		}
+	    }
+	  else
+	    {
+	      sprintf(errbuf, "Point \"%s\" already exists.", pointname);
+	      H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_BTREE, H5E_EXISTS, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      status = H5Gclose(POINTS_ID);
+	      return(FAIL);
+	    }
+	}
+
+      /* pointname not exist, will create it! */
+      /* Create pointname group under "POINTS"*/
+      pt_id = H5Gcreate( POINTS_ID, pointname , 0);
+      if (pt_id == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create \"%s\" group.\n", pointname);
+	  H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Create LevelWritten attribute */
+      sid = H5Screate_simple(rank, &count, 0);
+      if (sid == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create data space ID.\n");
+	  H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      lvwr_id = H5Acreate(pt_id, "_LevelWritten", H5T_NATIVE_UINT, sid, H5P_DEFAULT);
+      if (lvwr_id == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create \"_LevelWritten\" attribute.\n");
+	  H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Write "LevelWriten" attribute*/
+      status = H5Awrite(lvwr_id, H5T_NATIVE_UINT, zerobuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot wtrite data to the  \"_LevelWritten\" attribute.\n");
+	  H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      status = H5Sclose(sid);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      status = H5Aclose(lvwr_id);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the \"_LevelWritten\" attribute ID.\n");
+	  H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ATTR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Create Data Records group */
+      data_id = H5Gcreate( pt_id, "Data", 0);
+      if (data_id == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create \"Data\" group.\n");
+	  H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Create Linkage Records group */
+      link_id = H5Gcreate( pt_id, "Linkage", 0);
+      if (link_id == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create \"Linkage\" group.\n");
+	  H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Establish Point in Structural MetaData Block */
+      sprintf(utlbuf, "%s%li%s%s%s","\tGROUP=POINT_", nPoint + 1,"\n\t\tPointName=\"", pointname, "\"\n");
+
+      strcat(utlbuf, "\t\tGROUP=Level\n");
+      strcat(utlbuf, "\t\tEND_GROUP=Level\n");
+      strcat(utlbuf, "\t\tGROUP=LevelLink\n");
+      strcat(utlbuf, "\t\tEND_GROUP=LevelLink\n");
+      sprintf(utlbuf2, "%s%li%s","\tEND_GROUP=POINT_", nPoint + 1, "\n");
+      strcat(utlbuf, utlbuf2);
+
+      status = HE5_EHinsertmeta(fid, pointname, "p", 1003L, utlbuf, NULL);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot insert metadata for the \"%s\" point.\n", pointname);
+	  H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      status = H5Gclose(POINTS_ID);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the \"POINTS\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+
+      /* Assign pointID # & Load point and PTXPoint table entries */
+      for (i = 0; i < HE5_NPOINT; i++)
+	{
+	  if (HE5_PTXPoint[ i ].active == 0)
+	    {
+	      pointID                      = i + HE5_PTIDOFFSET;
+	      HE5_PTXPoint[i].active       = 1;
+	      HE5_PTXPoint[i].fid          = fid;
+	      HE5_PTXPoint[i].pt_id        = pt_id;
+	      HE5_PTXPoint[i].link_id      = link_id;
+	      HE5_PTXPoint[i].data_id      = data_id;
+	      strcpy(HE5_PTXPoint[ i ].ptname, pointname);
+	      for(j = 0; j < HE5_DTSETRANKMAX; j++)
+		{
+		  HE5_PTXPoint[ i ].level[j].ID   = FAIL;
+		  HE5_PTXPoint[ i ].level[j].name = NULL;
+		}
+
+	      break;
+	    }
+	}
+ 
+    }
+  else
+    {
+      /* Too many files opened */
+      pointID = FAIL;
+      sprintf(errbuf, "\nNo more than %d points may be open simutaneously", HE5_NPOINT);
+      H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (pointID);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTchkptid                                                    |
+|                                                                             |
+|  DESCRIPTION: Checks for valid pointID and returns file ID, group ID,       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  routname       char                Name of routine calling PTchkptid       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fid            hid_t               File ID                                 |
+|  gid            hid_t               group ID                                |
+|  idx            long                Point index                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t  
+HE5_PTchkptid(hid_t pointID, const char *routname, hid_t *fid, hid_t *gid, long *idx)
+{
+  herr_t          status   = SUCCEED;/* routine return status variable */
+
+  hid_t           HDFfid   = FAIL;   /* HDF-EOS file ID                */
+  hid_t           idOffset = HE5_PTIDOFFSET;/* Point ID offset         */
+
+  uintn           access   = 77;     /* Read/Write access code         */
+
+  char            message1[] = "Invalid point ID: %d in routine \"%s\".  ID must be >= %li and < %li.\n";
+  char            message2[] = "Point ID %d in routine \"%s\" not active.\n";
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer   */
+
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  if (pointID < idOffset || pointID >= (HE5_NPOINT + idOffset) )
+    {
+      status = FAIL;
+      sprintf(errbuf, message1, pointID, routname, idOffset, (long)(HE5_NPOINT + idOffset) );
+      H5Epush(__FILE__, "HE5_PTchkptid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  else
+    {
+      /* Check for active point ID */
+      /* ------------------------- */
+      if (HE5_PTXPoint[pointID % idOffset].active == 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf,  message2, pointID, routname);
+	  H5Epush(__FILE__, "HE5_PTchkptid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+      else
+	{
+	  /* Get file and Point key  */
+	  /* ----------------------- */
+	  *idx = (long)(pointID % idOffset);
+
+	  /* Get HDF-EOS file &  "HDFEOS" group IDs */
+	  /* -------------------------------------- */
+	  *fid   = HE5_PTXPoint[*idx].fid;
+	  status = HE5_EHchkfid(*fid,"", &HDFfid, gid, &access);
+        }
+    }
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTattach                                                     |
+|                                                                             |
+|  DESCRIPTION: Attaches to an existing point data set.                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  pointID        hid_t               point structure ID                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               HDF-EOS file ID                         |
+|  pointname      char                point structure name                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  2/24/00  A.Muslimov    Added error checkings and made cleanings.           |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  09/13/01 A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  02/01/06 Abe Taaheri   Added getting level names from Structure Metadata   |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t
+HE5_PTattach(hid_t fid, const char *pointname)
+{
+  hid_t           pointID    = FAIL;      /* Point ID (return value)   */
+  hid_t           idOffset   = HE5_PTIDOFFSET;/* Point ID offset       */
+  hid_t           HDFfid     = FAIL;	  /* HDF file ID               */
+  hid_t           gid        = FAIL;	  /* "POINTS" group ID         */
+  hid_t           data_id    = FAIL;      /* "Data" group ID           */
+  hid_t           link_id    = FAIL;	  /* "Linkage" group ID        */
+  hid_t           pt_id      = FAIL;	  /* Point group ID            */
+  hid_t           i,j;			  /* Loop index                */
+  hid_t           emptyslot  = FAIL;	  /* Spare Point index         */
+
+  int             npointopen =  0;  /* # of point structures opened    */
+  int             nlevels    =  0;  /* Number of levels in point       */
+  int             idx        = FAIL;/* Return iteration index          */
+
+  herr_t          status     = FAIL;/* routine return status variable  */
+
+  uintn           acs        = 77;  /* Access code                     */
+
+  pack            tmpdata;	    /* Temporary pack structure        */
+
+  char            *grpname = (char *)NULL;/* group name                */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+  char            LevelName[HE5_HDFE_UTLBUFSIZE];
+  char            tempname[HE5_HDFE_UTLBUFSIZE];
+  hid_t           tempid;
+
+  HE5_LOCK;
+  CHECKPOINTER(pointname);
+
+  /* Check HDF-EOS file ID, get back HDF file ID and access code */
+  /* ----------------------------------------------------------- */
+  status = HE5_EHchkfid(fid, pointname, &HDFfid, &gid, &acs);
+  if (status == SUCCEED)
+    {
+      /* Determine number of points currently opened */
+      /* ------------------------------------------- */
+      for (i = 0; i < HE5_NPOINT; i++)
+	npointopen += HE5_PTXPoint[i].active;
+
+    
+      if (npointopen < HE5_NPOINT)
+        {
+	  grpname = (char *)calloc( (strlen(pointname)+40), sizeof(char));
+	  if( grpname == NULL )
+	    {
+	      sprintf(errbuf, "Cannot allocate memory.\n");
+	      H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+
+	  strcpy( grpname, "/HDFEOS/POINTS/");
+	  strcat( grpname, pointname);
+
+	  /* Try to open the Point group */
+	  /* =========================== */
+	  H5E_BEGIN_TRY{
+	    pt_id = H5Gopen( HDFfid, grpname );
+	  }
+	  H5E_END_TRY;
+
+	  if( pt_id == FAIL )
+	    {
+	      sprintf(errbuf, "Point:\"%s\" does not exist within HDF-EOS file.\n",pointname) ;
+	      H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(grpname);
+	      return(FAIL);
+	    }
+
+	  /* Attach to "Data" group */
+	  /* ---------------------- */
+	  data_id = H5Gopen( pt_id, "Data");
+	  if( data_id == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot open the \"Data\" group in \"%s\" Point", pointname) ;
+	      H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(grpname);
+	      return(FAIL);
+	    }
+
+	  /* Attach to "Linkage" group */
+	  /* ------------------------- */
+	  link_id = H5Gopen( pt_id, "Linkage");
+	  if( link_id == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot open the \"Linkage\" group in \"%s\" Point", pointname) ;
+	      H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(grpname);
+	      return(FAIL);
+	    }
+
+
+	  /* Setup External Arrays  */
+	  /* ---------------------- */
+	  for (i = 0; i < HE5_NPOINT; i++)
+	    {
+	      /* Find empty entry in array */
+	      /* ------------------------- */
+	      if (HE5_PTXPoint[i].active == 0)
+		{
+		  pointID                    = i + idOffset;
+		  HE5_PTXPoint[ i ].active   = 1;
+		  HE5_PTXPoint[ i ].fid      = fid;
+		  HE5_PTXPoint[ i ].pt_id    = pt_id;
+		  HE5_PTXPoint[ i ].data_id  = data_id;
+		  HE5_PTXPoint[ i ].link_id  = link_id;
+		  strcpy(HE5_PTXPoint[ i ].ptname, pointname);
+
+		  break;
+		}
+	    }
+
+	  emptyslot = i;
+
+	  /* Initialize the members of external arrays */
+	  /* ========================================= */ 
+	  for( i = 0; i < HE5_DTSETRANKMAX; i++ )
+	    {
+	      HE5_PTXPoint[ emptyslot ].level[ i ].ID   = FAIL;
+	      HE5_PTXPoint[ emptyslot ].level[ i ].name = NULL;
+
+	      tmpdata.level[ i ].name = NULL;
+	      tmpdata.level[ i ].ID   = FAIL;
+	    }
+	  tmpdata.nlevels = 0;
+
+	  /* ---------------------------------------------------- */
+	  /* Loop throuhgh the group "/HDFEOS/POINTS/../Data" to  */
+	  /*   get the number of levels and level name list       */
+	  /* ---------------------------------------------------- */
+
+	  strcat(grpname,"/Data");
+
+	  idx = H5Giterate(data_id, grpname , NULL, HE5_PTopenlevel, &tmpdata);
+	  if ( idx == FAIL )
+	    {
+	      sprintf(errbuf, "Iteration of \"HE5_EHobj_info()\" operation failed.") ;
+	      H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(grpname);
+ 
+	      return(FAIL);
+	    }
+
+	  free( grpname );
+
+	  nlevels = tmpdata.nlevels;
+
+	  /* sort levels using structure metadata to 
+	     set from 0 to nlevels */
+	  /* ==================================== */
+	  for(i=0; i < nlevels; i++ )
+	    {
+	      status = HE5_PTgetlevelname_fromSM(pointID, i, LevelName);
+	      if ( status == FAIL )
+		{
+		  sprintf(errbuf, "Failed to get LevelName for the Level_%d.",i) ;
+		  H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  
+		  return(FAIL);
+		}
+
+	      /* Remove double quotes */
+	      /* -------------------- */
+	      memmove(LevelName, LevelName + 1, strlen(LevelName) - 2);
+	      LevelName[strlen(LevelName) - 2] = 0;
+
+	      /* replace if needed for sorting */
+	      /* ------------------------------*/
+	      for(j=i; j < nlevels; j++)
+		{
+		  if(strcmp(tmpdata.level[j].name,LevelName) == 0)
+		    { 
+		      strcpy(tempname, tmpdata.level[i].name);
+		      tempid = tmpdata.level[ i ].ID;
+		      /*strcpy(tmpdata.level[i].name, tmpdata.level[j].name);*/
+		      memmove(tmpdata.level[i].name, tmpdata.level[j].name,
+			      strlen(tmpdata.level[j].name) + 1);
+
+		      tmpdata.level[ i ].ID = tmpdata.level[ j ].ID;
+		      strcpy(tmpdata.level[j].name, tempname);
+		      tmpdata.level[ j ].ID = tempid;
+		      break;
+		    }
+		}
+	    }
+
+	  /* Set the data  for the PTXPoint array */
+	  /* ==================================== */
+	  for( i = 0; i < nlevels; i++ )
+	    {
+	      HE5_PTXPoint[ emptyslot ].level[ i ].name =  
+		(char *)calloc( (strlen(tmpdata.level[i].name)+1), sizeof(char));
+	      if ( HE5_PTXPoint[ emptyslot ].level[ i ].name == NULL )
+		{
+		  sprintf(errbuf, "Cannot allocate memory for the name.") ;
+		  H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if ( tmpdata.level[ i ].name != NULL ) 
+		    free(tmpdata.level[ i ].name);
+ 
+		  return(FAIL);                  
+		}
+		  
+	      strcpy(HE5_PTXPoint[ emptyslot ].level[ i ].name, tmpdata.level[ i ].name);
+	      if ( tmpdata.level[ i ].name != NULL ) 
+		free(tmpdata.level[ i ].name);
+
+	      HE5_PTXPoint[ emptyslot ].level[ i ].ID = tmpdata.level[ i ].ID;
+
+	    }
+
+        }
+      else
+        {
+	  /* Too many Points opened */
+	  /* --------------------- */
+	  pointID = FAIL;
+	  sprintf(errbuf,"No more than %d points may be open simutaneously", HE5_NPOINT);
+	  H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(pointID);
+
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTdetach                                                     |
+|                                                                             |
+|  DESCRIPTION: Releases a point data set and frees memory.                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t   None        point structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/26/99  A. Muslimov   Changed the type of fid from int32_t to hid_t.      |
+|  Feb,2000 A.Muslimov    Fixed bug-prone release of IDs.                     |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  09/13/01 A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_PTdetach(hid_t  pointID)
+{
+  herr_t          status  = FAIL;/* routine return status variable */
+
+  int             j, k;			 /* Loop indices                   */
+  int             nlevels = 0;	 /* Number of levels in point      */
+
+  hid_t           fid     = FAIL;/* HDF-EOS file ID                */
+  hid_t           gid     = FAIL;/* HDFEOS group ID                */
+
+  long            idx     = FAIL;/* Point index                    */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer  */
+
+
+  HE5_LOCK;
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTdetach", &fid, &gid, &idx);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Checking for point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTdetach", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get number of levels */
+  /* -------------------- */
+  nlevels = HE5_PTnlevels(pointID);
+  if(nlevels == FAIL)
+    {
+      sprintf(errbuf, "Cannot retrieve the number of levels. \n");
+      H5Epush(__FILE__, "HE5_PTdetach", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* close Point level datasets */
+  /* -------------------------- */
+  for (j = 0; j < nlevels; j++)
+    {
+      if ( HE5_PTXPoint[ idx ].level[ j ].ID > 0 )
+	{
+	  status = H5Dclose(HE5_PTXPoint[ idx ].level[ j ].ID);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the level dataset ID\n");
+	      H5Epush(__FILE__, "HE5_PTdetach", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+
+	}
+	 
+    }
+    
+
+  /* close Point "Data" group   */
+  /* -------------------------- */
+  if ( HE5_PTXPoint[ idx ].data_id > 0 )
+    {
+      status = H5Gclose(HE5_PTXPoint[ idx ].data_id);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the group \"Data\" group ID \n");
+	  H5Epush(__FILE__, "HE5_PTdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+    
+  /* close Point "Linkage" group */
+  /* --------------------------- */ 
+  if ( HE5_PTXPoint[idx].link_id > 0 )
+    {
+      status = H5Gclose(HE5_PTXPoint[ idx ].link_id);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the group \"Linkage\" group ID\n");
+	  H5Epush(__FILE__, "HE5_PTdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+    }
+    
+  /* close the Point group */
+  /* --------------------- */ 
+  if ( HE5_PTXPoint[ idx ].pt_id > 0 )
+    {
+      status = H5Gclose(HE5_PTXPoint[ idx ].pt_id);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the Point group ID\n");
+	  H5Epush(__FILE__, "HE5_PTdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+	    
+    }
+    
+
+  /* Clear entries from external arrays */
+  /* ---------------------------------- */
+  HE5_PTXPoint[ idx ].active       =  0;
+  HE5_PTXPoint[ idx ].fid          =  FAIL;
+  HE5_PTXPoint[ idx ].data_id      =  FAIL;
+  HE5_PTXPoint[ idx ].link_id      =  FAIL;
+  HE5_PTXPoint[ idx ].pt_id        =  FAIL;
+
+  for (j = 0; j < nlevels; j++)
+    {
+      HE5_PTXPoint[ idx ].level[ j ].ID   = FAIL;
+      if ( HE5_PTXPoint[ idx ].level[ j ].name != NULL )
+	free(HE5_PTXPoint[ idx ].level[ j ].name);
+    }
+
+
+  /* Free Region Pointers */
+  /* -------------------- */
+  for (k = 0; k < HE5_NPOINTREGN; k++)
+    {
+      if (HE5_PTXRegion[ k ] != NULL && HE5_PTXRegion[ k ]->pointID == pointID)
+	{
+	  for (j = 0; j < HE5_DTSETRANKMAX; j++)
+	    {
+	      if (HE5_PTXRegion[ k ]->recPtr[ j ] != NULL)
+		{
+		  free(HE5_PTXRegion[ k ]->recPtr[ j ]);
+		}
+	    }
+
+	  free(HE5_PTXRegion[ k ]);
+	  HE5_PTXRegion[ k ] = NULL;
+	}
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTclose                                                      |
+|                                                                             |
+|  DESCRIPTION: Closes HDF-EOS file                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t   None        File ID                                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7/20/99  A.Muslimov                                                        |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_PTclose(hid_t fid)
+{
+  herr_t  status = FAIL;/* routine return status variable */
+
+  /* Call HE5_EHclose to perform file close */
+  /* -------------------------------------- */
+  status = HE5_EHclose(fid);
+
+  return (status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTnrecs                                                      |
+|                                                                             |
+|  DESCRIPTION: Returns the number of records in a level.                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nrec           hsize_t             Number of records in level              |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/13/99      A.Muslimov    Added proper error handlings after the function|
+|                              calls.                                         |
+|  7.18.99       A.Muslimov    Unmasked hdf5 data types.                      |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hsize_t 
+HE5_PTnrecs(hid_t pointID, int level)
+{
+  hsize_t         nrec = 1;		/* Number of records in level (return value) */
+
+  herr_t          status = FAIL;/* routine return status variable            */   
+
+  int             i;			/* loop index                                */
+  int             nlevels = 0;  /* Number of levels in point                 */
+
+  hid_t           fid   = FAIL;	/* HDF-EOS file ID                           */
+  hid_t           gid   = FAIL;	/* "POINTS" group ID                         */
+  hid_t	          space = FAIL; /* data space ID                             */
+  hid_t           ID    = FAIL;	/* Level dataset ID                          */
+
+  long            idx   = FAIL; /* Point Index                               */
+
+  unsigned int    zerobuf[HE5_DTSETRANKMAX];
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* error message buffer       */
+
+
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    zerobuf[ i ] = 0;
+    
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTnrecs", &fid, &gid, &idx);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Checking for point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTnrecs", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(0);
+    }
+
+  /* Get number of levels */
+  /* -------------------- */
+  nlevels = HE5_PTnlevels(pointID);
+  if (nlevels == 0)
+    {
+      sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID);
+      H5Epush(__FILE__, "HE5_PTnrecs", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(0);
+    }
+  else if (nlevels <= level)
+    {
+      /* Report error if level # to large */
+      /* -------------------------------- */
+      sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID);
+      H5Epush(__FILE__, "HE5_PTnrecs", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(0);
+    }
+
+  /* Get level dataset ID and number of records */
+  /* ------------------------------------------ */
+  ID = HE5_PTXPoint[idx].level[level].ID;
+
+  space = H5Dget_space(ID);
+  if (space == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the data space ID.\n");
+      H5Epush(__FILE__, "HE5_PTnrecs", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(0);
+    }
+
+
+  nrec = H5Sget_simple_extent_npoints(space);
+  if (nrec == 0)
+    {
+      sprintf(errbuf, "Cannot get the number of records.\n");
+      H5Epush(__FILE__, "HE5_PTnrecs", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(0);
+    }
+
+  status = H5Sclose(space);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the data space ID.\n");
+      H5Epush(__FILE__, "HE5_PTnrecs", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(0);
+    }
+
+
+  /* If nrec = 1 check whether actual data has been written */
+  /* ------------------------------------------------------ */
+  if (nrec == 1)
+    {
+      /* read  "_LevelWritten" Attribute */
+      /* ------------------------------- */
+      status = HE5_PTreadattr(pointID,"_LevelWritten", zerobuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot read the \"_LevelWritten\" attribute.\n");
+	  H5Epush(__FILE__, "HE5_PTnrecs", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(0);
+	}
+
+      /* If level not yet written then reset nrec to 0 */
+      /* --------------------------------------------- */
+      if ( zerobuf[level] == 0)
+	nrec = 0;
+		
+    }
+ 
+  return(nrec);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTnlevels                                                    |
+|                                                                             |
+|  DESCRIPTION: Returns the number of levels in a point data set.             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nlevels        int                 Number of levels in point structure     |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t      	      point structure ID                      |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_PTnlevels(hid_t pointID)
+{
+  int             nlevels = FAIL;	/* Number of levels in point (return value) */
+
+  herr_t          status  = SUCCEED;/* routine return status variable           */
+
+  hid_t           fid     = FAIL;	/* HDF-EOS file ID                          */
+  hid_t           gid     = FAIL;	/* "POINTS" group ID                        */
+
+  long            idx     = FAIL;   /* Point index                              */
+
+  char            *grpname = (char *)NULL;/* Group name string buffer           */
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTnlevels", &fid, &gid, &idx);
+
+  if(status == SUCCEED )
+    {
+      grpname = (char *) calloc( (strlen(HE5_PTXPoint[idx].ptname)+40),sizeof(char));
+      if( grpname == NULL)
+    	{
+	  H5Epush(__FILE__, "HE5_PTnlevels", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Can not allocate memory");
+	  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	  return(FAIL);
+    	}
+
+      /* Build the  "grpname" string */
+      /* --------------------------- */
+      strcpy(grpname,"/HDFEOS/POINTS/");
+      strcat(grpname, HE5_PTXPoint[idx].ptname);
+      strcat(grpname,"/Data");   
+
+      /* Get number of levels (Number of entries) in Data group */
+      /* ------------------------------------------------------ */
+      nlevels = (int)HE5_EHdatasetcat(HE5_PTXPoint[idx].fid, grpname, NULL, NULL);
+
+      free(grpname);
+    }
+
+  return(nlevels);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTfexist                                                     |
+|                                                                             |
+|  DESCRIPTION:  Verify if field exist in a compound datatype and return      |
+  |		 the member data information                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|   dataID        hid_t               Level dataset ID                        |
+|   fldname       char                Field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|   size          size_t              Field data size (bytes)                 |
+|   rank          int                 Field rank                              |
+|   dims[]        size_t              Array of field dimension sizes          |
+|   dtype         hid_t               Field data type ID                      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Oct 00   A.Muslimov    Changed the interface.                              |
+|  Mar 01   A.Muslimov    Updated to reflect introduction of ARRAY class.     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static int
+HE5_PTfexist(hid_t  dataID, const char *fldname, size_t *size, int *rank, size_t dims[], hid_t *dtype )
+{
+  int            exist  = FAIL;	 /* return flag value                */  
+  int            i, j;			 /* loop indices                     */
+
+  herr_t         status = FAIL;  /* Return status variable           */
+
+  hid_t	         typeID = FAIL;  /* data type ID                     */
+
+  hsize_t        dim_size[HE5_DTSETRANKMAX];/* array of dime. sizes  */
+
+  HE5_CmpDTSinfo *info;          /* Compound dataset info structure  */
+
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */
+
+  CHECKPOINTER(fldname);
+
+  /* Allocate memory for info structure */
+  /* ---------------------------------- */
+  info = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo));
+  if (info == (HE5_CmpDTSinfo *)NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for info structure.\n");
+      H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get level dataset type  ID */
+  /* -------------------------- */
+  typeID = H5Dget_type(dataID);
+  if (typeID == FAIL)
+    {
+      sprintf(errbuf, "Cannot get data type.\n");
+      H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(info);
+      return(FAIL);
+    }
+
+  /* Initialize dim_size[] array */
+  /* --------------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    dim_size[i] = 0;
+  
+  /* Reset the flag */
+  /* -------------- */ 
+  exist = 0;
+
+  /* get the number of members in compound datatype */
+  /* ---------------------------------------------- */
+  info->nfields = H5Tget_nmembers( typeID );	
+  for( i = 0; i < info->nfields; i++ )
+    {
+      /* Get member name */
+      /* --------------- */
+      info->fieldname[i] = H5Tget_member_name(typeID, i);
+      if (info->fieldname[i] == NULL)
+	{
+	  sprintf(errbuf, "Cannot get the field name.\n");
+	  H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (info != NULL) free(info);
+	  return(FAIL);
+	}
+	  
+      /* Loop through all fields */
+      /* ----------------------- */
+      if( strncmp(info->fieldname[i], fldname, strlen(fldname)) == 0 )
+	{
+	  exist = 1;
+
+	  /* Get field disk data type */
+	  /* ------------------------ */
+	  info->dtype[i] = H5Tget_member_type(typeID, i);
+	  if (info->dtype[i] == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the field data type.\n");
+	      H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (info->fieldname[i] != NULL) 
+		free(info->fieldname[i]); 
+	      if (info != NULL) free(info);
+	      return(FAIL);
+	    }
+			 
+
+	  /* Get field data type */
+	  /* ------------------- */
+	  if (dtype != NULL)
+	    *dtype = info->dtype[i];
+
+		  
+	  /* Get field data size */
+	  /* ------------------- */
+	  if (size != NULL)
+	    {
+	      /* Get the field disk data size (in bytes) */
+	      /* --------------------------------------- */
+	      *size = H5Tget_size(info->dtype[i]);
+	      if (*size == 0)
+		{
+		  sprintf(errbuf, "Cannot get the field size.\n");
+		  H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (info->fieldname[i] != NULL) 
+		    free(info->fieldname[i]);
+		  if (info != NULL) free(info);
+		  return(FAIL);
+		}
+	    }
+		  
+	  /* Get the field rank and dimension sizes */
+	  /* -------------------------------------- */
+	  if (rank != NULL && dims != NULL)
+	    {
+	      /* Get field data class */
+	      /* -------------------- */
+	      info->dclass[i] = H5Tget_class(info->dtype[i]);
+	      if (info->dclass[i] == H5T_NO_CLASS)
+		{
+		  sprintf(errbuf, "Cannot get the field class.\n");
+		  H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (info->fieldname[i] != NULL) 
+		    free(info->fieldname[i]); 
+		  if (info != NULL) free(info);
+		  return(FAIL);
+		}	  
+
+	      /* Get the rank and "array" flag */
+	      /* ----------------------------- */
+	      if (info->dclass[i] == H5T_ARRAY)
+		{
+		  /* Get the field rank */
+		  /* ------------------ */
+		  *rank  = H5Tget_array_ndims(info->dtype[i]);
+		  if (*rank == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot get the field rank.\n");
+		      H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      if (info->fieldname[i] != NULL) 
+			free(info->fieldname[i]); 
+		      if (info != NULL) free(info);
+		      return(FAIL);
+		    }	  
+
+		  /* Get the field dimension sizes */
+		  /* ----------------------------- */
+		  status = H5Tget_array_dims(info->dtype[i],dim_size, NULL);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot get the field dimension sizes.\n");
+		      H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      if (info->fieldname[i] != NULL) 
+			free(info->fieldname[i]); 
+		      if (info != NULL) free(info);
+		      return(FAIL);
+		    }	  
+
+		  for (j = 0; j < *rank; j++)
+		    dims[j] = dim_size[j];
+		}
+	      else /* scalar */
+		{
+		  *rank   = 1;
+		  dims[0] = 1;
+		}
+
+	    }
+
+	  /* Release field type ID */
+	  /* --------------------- */
+	  status = H5Tclose(info->dtype[i]);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release data type ID.\n");
+	      H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (info->fieldname[i] != NULL) 
+		free(info->fieldname[i]); 
+	      if (info != NULL) free(info);
+	      return(FAIL);
+	    }
+		  
+	}
+
+      /* Release pointers to the name buffers */
+      /* ------------------------------------ */
+      if (info->fieldname[i] != NULL) 
+	free(info->fieldname[i]);
+    }
+
+  if (info != NULL) free(info);
+ 
+  /* Release ID */
+  /* ---------- */
+  status = H5Tclose(typeID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release data type ID.\n");
+      H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+ COMPLETION:
+  return(exist);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTnfields                                                    |
+|                                                                             |
+|  DESCRIPTION: Returns number of fields defined in a level.                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nflds          int                 Number of fields in a level             |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                String length of fieldlist              |
+|  fieldlist      char                Coma separated list of fields           |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date       Programmer   Description                                       |
+|  ========   ============  ================================================= |
+|  12/16/99   A.Muslimov    Added appropriate error handlings after the       |
+|                           function calls.                                   |
+|  7.18.99    A.Muslimov    Unmasked hdf5 data types.                         |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_PTnfields(hid_t pointID, int level, char *fieldlist, long *strbufsize)
+{
+  int             nflds   = FAIL;/* Number of fields in a list (return) */
+  int             nlevels = 0;   /* Number of levels in point           */
+  int             i;             /* Loop index                          */
+
+  herr_t          status  = FAIL;/* routine return status variable      */
+
+  hid_t           fid     = FAIL;/* HDF-EOS file ID                     */
+  hid_t           gid     = FAIL;/* POINTS group ID                     */
+  hid_t           levelID = FAIL;/* Level dataset ID                    */        
+  hid_t           tid     = FAIL;/* Data type ID                        */
+
+  long            idx     = FAIL;/* Point index                         */
+ 
+  size_t          strsize = 0;   /* String length                       */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer   */
+  char            *fldname = (char *)NULL;    /* pointer to field name  */
+  char            *fldlist = (char *)NULL;    /* pointer to field list  */
+
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTnfields", &fid, &gid, &idx);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Checking for point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get number of levels */
+  /* -------------------- */
+  nlevels = HE5_PTnlevels(pointID);
+  if (nlevels == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID);
+      H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  else if (nlevels <= level)
+    {
+      /* Report error if level # too large */
+      /* --------------------------------- */
+      status = FAIL;
+      sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID);
+      H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get level dataset  ID */
+  /* --------------------- */
+  levelID = HE5_PTXPoint[idx].level[level].ID;
+
+  /* Get Compound dataset datatype ID */
+  /* -------------------------------- */
+  tid = H5Dget_type(levelID);
+  if (tid == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the compound data type ID. \n");
+      H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get number of fields( or number of members of compound type) */
+  /* ------------------------------------------------------------ */
+  nflds = H5Tget_nmembers(tid);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number of fields in compound data type. \n");
+      H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate memory */
+  /* --------------- */
+  fldname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char));
+  if( fldname == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory.");
+      HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+    
+
+  /* Get field list, field list size */
+  /* ------------------------------- */
+  for( i = 0; i < nflds; i++ )
+    {
+      fldname = H5Tget_member_name(tid, i);
+      if (fldname == NULL )
+	{
+	  sprintf(errbuf, "Cannot get the compound data field name. \n");
+	  H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      strsize = strsize + strlen(fldname) + 1 ;
+
+      if( i == 0  )
+	{
+	  fldlist = (char *) calloc( strsize, sizeof(char));
+	  if( fldlist == NULL)
+	    {
+	      H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+	      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	      nflds = FAIL; 
+	      free(fldname);
+	      break;
+   
+	    }  
+	  strcpy(fldlist,fldname);
+        
+	}
+      else
+	{ 
+	  fldlist= (char *)realloc(fldlist, sizeof(char)* strsize);
+	  if( fldlist==NULL)
+	    {
+	      H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+	      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	      free(fldname);
+	      nflds = FAIL;  
+	      break;
+	    }
+
+	  strcat(fldlist,",");
+	  strcat(fldlist,fldname);
+	}
+
+      if (fldname != NULL) free(fldname);
+    }
+
+  /* Release data type ID */
+  /* -------------------- */
+  status = H5Tclose(tid);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release the compound data type ID. \n");
+      H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(fldlist);
+		
+      return(status);
+    }
+
+  /* Return fieldlist string size */
+  /* ---------------------------- */
+  if ( strbufsize != NULL )
+    {
+      *strbufsize = (long)strlen(fldlist);
+    }
+    
+  /* Also return a coma separated list of fields */
+  /* ------------------------------------------- */
+  if(fieldlist != NULL)
+    strcpy(fieldlist, fldlist);
+
+  free(fldlist);
+
+  return(nflds);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTgetlevelname                                               |
+|                                                                             |
+|  DESCRIPTION: Returns level name                                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  levelname      char                Level name                              |
+|  strbufsize     long                String length of fieldlist              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_PTgetlevelname(hid_t pointID, int  level, char *levelname, long *strbufsize)
+{
+  herr_t          status  = FAIL;/* routine return status variable  */
+
+  int             nlevels =  0;	 /* Number of levels in point       */
+
+  hid_t           fid     = FAIL;/* HDF-EOS file id                 */
+  hid_t           gid     = FAIL;/* "POINTS" group ID               */
+
+  long            idx     = FAIL;/* Point index                     */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTgetlevelname", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get number of levels */
+      /* -------------------- */
+      nlevels = HE5_PTnlevels(pointID);
+      if (nlevels == 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID);
+	  H5Epush(__FILE__, "HE5_PTgetlevelname", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+            
+	}
+      else if (nlevels <= level)
+	{
+	  /* Report error if level # to large */
+	  /* -------------------------------- */
+	  status = FAIL;
+	  sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID);
+	  H5Epush(__FILE__, "HE5_PTgetlevelname", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+
+      if (status == SUCCEED)
+	{
+	  /* Get level name */
+	  /* -------------- */
+	  *strbufsize = (long)strlen(HE5_PTXPoint[ idx ].level[ level ].name);
+
+	  /* Return levelname if requested */
+	  /* ----------------------------- */
+	  if (levelname != NULL)
+	    strcpy(levelname,HE5_PTXPoint[ idx ].level[ level ].name)  ;
+	}
+    }
+
+  return (status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTopenlevel                                                  |
+|                                                                             |
+|  DESCRIPTION: Returns level ID and name                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|   =======  ==========   ==============                                      |
+|   7.18.99  A.Muslimov    Unmasked hdf5 data types.                          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_PTopenlevel(hid_t loc_id, const char *name, void *opdata)
+{
+  int      i = 0;
+
+  pack     *ptr;
+
+  ptr = (pack *)opdata;
+    
+  if( name != NULL )
+    {
+      i = ptr->nlevels;
+      if( ptr->level[i].name == NULL && ptr->level[i].ID == FAIL )
+	{
+	  ptr->level[i].name = (char *)calloc((strlen(name) + 1), sizeof(char)); 
+	  strcpy( ptr->level[i].name, name );
+	  ptr->level[i].ID = H5Dopen( loc_id, name );
+	}
+      ptr->nlevels ++ ;
+    }
+
+  return 0;
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTdeflevel                                                   |
+|                                                                             |
+|  DESCRIPTION: Defines a level within the point data set.                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t               return status (0) SUCCEED, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  levelname      char                name of level                           |
+|  levelinfo      HE5_CmpDTSinfo      Pointer to the structure containing     |
+|                                      information about level dataset        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:     Metadata block needs to be developed                            |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 00   A.Muslimov    Revised and recoded.                                |
+|  Mar 00   A.Muslimov    Modified to reflect changes in HDF5 library:        |
+|                         H5Tinsert_array should be replaced by two calls     |
+|                         H5Tarray_create() and H5Tinsert().                  |
+|  09/13/01 A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  May 05   S.Zhao        Added HE5_EHdtype2numtype() and HE5_EHhid2hsize()   |
+|                         functions calls.                                    |
+|  Feb 06   Abe Taaheri   Added support for H5T_STRING                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_PTdeflevel(hid_t  pointID, const char *levelname, HE5_CmpDTSinfo *levelinfo)
+{
+  herr_t          status  = FAIL;/* routine return status variable     */
+
+  int             i, j;		 /* Loop indices                       */
+  int             nlevels = FAIL;/* Number of levels in point          */
+  int             rank    = 1;   /* Dataset rank                       */
+
+  hid_t           fid     = FAIL;/* HDF-EOS file ID                    */
+  hid_t           gid     = FAIL;/* HDFEOS group ID                    */
+  hid_t           dtsID   = FAIL;/* Dataset ID                         */
+  hid_t           space   = FAIL;/* dataspace ID                       */
+  hid_t           tid     = FAIL;/* compound datatype ID               */
+  hid_t           fwdtid  = FAIL;/* compound datatype ID               */
+  hid_t           bcktid  = FAIL;/* compound datatype ID               */
+  hid_t           plist   = FAIL;/* property list ID                   */
+  hid_t           tempid  = FAIL;/* temporary ID                       */
+  hid_t           xfrlist = FAIL;/* Xfer property list ID              */
+  hid_t           arr_id  = FAIL;/* Array datatype ID                  */
+
+  long            idx     = FAIL;/* Point index                        */
+
+  hsize_t         dim         = 1;/* Dimension size                    */    
+  hsize_t         dims[HE5_DTSETRANKMAX];/* Array of dimension sizes   */
+  hsize_t         chunkdim[1] = {HE5_NRECS};/* Record chunk size       */ 
+  hsize_t         maxdim      = H5S_UNLIMITED;/* Max. dimension size   */
+  hsize_t         dum         = 0;/* dummy variable                    */
+  hsize_t         metadata[2]={0,0};/* Metadata input array            */
+  hid_t           ntype   = FAIL;   /* number type ID                  */
+
+  fwdptr          ForwardData;/* Structure for forward pointer dataset */
+
+  char            utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer        */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+  int             order;
+
+  HE5_LOCK;
+  CHECKNAME(levelname);
+  CHECKPOINTER(levelinfo);
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTdeflevel", &fid, &gid, &idx);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Checking for point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Check levelname for length */
+  /* -------------------------- */
+  if ( strlen(levelname) > HE5_OBJNAMELENMAX)
+    {
+      sprintf(errbuf, "Levelname \"%s\" more than %d characters.\n", levelname, HE5_OBJNAMELENMAX);
+      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  
+  /* Initialize Forward Pointer buffer */
+  /* --------------------------------- */
+  ForwardData.begin  = FAIL;
+  ForwardData.extent = FAIL;
+
+  /* Get number of levels in points */
+  /* ------------------------------ */
+  nlevels = HE5_PTnlevels(pointID);
+  if(nlevels == FAIL)
+    {
+      sprintf(errbuf, "Cannot retrieve the number of levels\n");
+      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Create dataspace with rank=1, dim=1(1 record), unlimited */
+  /* -------------------------------------------------------- */
+  space = H5Screate_simple(rank, &dim, &maxdim);
+  if (space == FAIL)
+    {
+      sprintf(errbuf, "Cannot create the data space. \n");
+      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Create and modify dataset property, enable chunking */
+  /* --------------------------------------------------- */
+  plist = H5Pcreate(H5P_DATASET_CREATE);
+  if (plist == FAIL)
+    {
+      sprintf(errbuf, "Cannot create a property list ID. \n");
+      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Enable chunking */
+  /* --------------- */
+  status = H5Pset_chunk(plist, rank, chunkdim);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot set chunking. \n");
+      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+  
+  /* Create the memory compound data type */
+  /* ------------------------------------ */
+  tid = H5Tcreate(H5T_COMPOUND, levelinfo->datasize);
+  if (tid == FAIL)
+    {
+      sprintf(errbuf, "Cannot create the data type ID. \n");
+      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Add members to the compound data type */
+  /* ------------------------------------- */
+  for (i = 0; i < levelinfo->nfields; i++)
+    {  
+      /* Check if the field is an array */
+      /* ------------------------------ */
+      if (levelinfo->array[i] == TRUE)
+	{
+	  for (j = 0; j < levelinfo->rank[i]; j++)
+	    dims[j] = (hsize_t)levelinfo->dims[i][j];
+		  
+	  /* Create array datatypes */
+	  /* ---------------------- */
+	  arr_id = H5Tarray_create(levelinfo->dtype[i], levelinfo->rank[i], (const hsize_t *)dims, NULL);
+	  if (arr_id == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot create \"array\" datatype. \n");
+	      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  /* Add array field */
+	  /* --------------- */
+	  status = H5Tinsert(tid,levelinfo->fieldname[i], levelinfo->offset[i], arr_id);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot insert \"array\" element. \n");
+	      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  /* Release the data type ID */
+	  /* ------------------------ */
+	  status = H5Tclose(arr_id);
+	  if (status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot release data type ID. \n");
+	      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    } 
+
+	}
+      else 
+	{
+	  /* Add atomic field */
+	  /* ---------------- */
+	  status = H5Tinsert(tid,levelinfo->fieldname[i], levelinfo->offset[i],levelinfo->dtype[i]);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot insert \"array\" element. \n");
+	      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	}
+	  
+
+    }
+   
+
+  /* Create (appendible) dataset for the level */
+  /* ----------------------------------------- */
+  dtsID = H5Dcreate(HE5_PTXPoint[idx].data_id, levelname, tid, space, plist);
+  if (dtsID == FAIL)
+    {
+      sprintf(errbuf, "Cannot create the dataset. \n");
+      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Extend the dataset */
+  /* ------------------ */
+  status = H5Dextend(dtsID, &dim);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot extend the dataset. \n");
+      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+
+  /* Release the data type ID */
+  /* ------------------------ */
+  status = H5Tclose(tid);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release data type ID. \n");
+      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Release the data space ID */
+  /* ------------------------- */
+  status = H5Sclose(space);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release data space ID. \n");
+      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+	
+  /* Release the property list ID */
+  /* ---------------------------- */
+  status = H5Pclose(plist);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release a property list ID. \n");
+      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+
+  /* Store dataset ID and name in external array */
+  /* ------------------------------------------- */
+  HE5_PTXPoint[idx].level[nlevels].ID  = dtsID;
+  HE5_PTXPoint[idx].level[nlevels].name = (char *)calloc((strlen(levelname)+1), sizeof(char));
+  strcpy(HE5_PTXPoint[idx].level[nlevels].name, levelname);
+
+  /* If previous levels exist ... */
+  /* ---------------------------- */
+  if (nlevels > 0)
+    {
+      /* Create dataspace with rank=1, dim=1(1 record), unlimited */
+      space = H5Screate_simple(rank, &dim, &maxdim);
+      if (space == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create the  data space. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Create property list */
+      /* -------------------- */
+      plist = H5Pcreate(H5P_DATASET_CREATE);
+      if (plist == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create a property list ID. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Enable chunking */
+      /* --------------- */
+      status = H5Pset_chunk(plist,rank, chunkdim);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot set chunking. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Create compound data type */
+      /* ------------------------- */
+      bcktid = H5Tcreate(H5T_COMPOUND, sizeof(bckptr));
+      if (bcktid == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create a compound datatype. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+	  
+      /* Add back pointer data member */
+      /* ---------------------------- */
+      status = H5Tinsert(bcktid,"BCKPOINTER", HOFFSET(bckptr, back), H5T_NATIVE_LLONG);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot add a new member named \"BCKPOINTER\"to a compound datatype. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+
+      /* Set name of BCKPOINTER dataset */
+      /* ------------------------------ */
+      sprintf(utlbuf, "%s%d%s%d", "BCKPOINTER:", nlevels, "->", nlevels - 1);
+
+
+      /* Create (appendible) compound dataset */
+      /* ------------------------------------ */
+      tempid = H5Dcreate(HE5_PTXPoint[idx].link_id, utlbuf, bcktid, space, plist);
+      if (tempid == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create the  dataset. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+  
+      /* Extend the dataset */
+      /* ------------------ */
+      status = H5Dextend(tempid, &dim);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot extend the  dataset. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return status;
+	}
+
+      /* Release the data type ID */
+      /* ------------------------ */
+      status = H5Tclose(bcktid);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the  data type ID. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return status;
+	}
+
+      /* Release the data space ID */
+      /* ------------------------- */
+      status = H5Sclose(space);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot release the  data space ID. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return status;
+	}
+
+      /* Release the dataset ID */
+      /* ---------------------- */
+      status = H5Dclose(tempid);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot release the  dataset ID. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return status;
+	}
+
+
+      /* Setup Forward Pointer dataset */
+      /* ----------------------------- */
+	  
+      /* Set name of FWDPOINTER dataset */
+      /* ------------------------------ */
+      sprintf(utlbuf, "%s%d%s%d", "FWDPOINTER:", nlevels - 1,"->", nlevels);
+	  
+      /* Create dataspace with rank=1, dim=1(1 record), unlimited */
+      /* -------------------------------------------------------- */
+      space = H5Screate_simple(rank, &dim, &maxdim);
+      if (space == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create the data space ID. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Create the memory data type */
+      /* --------------------------- */
+      fwdtid = H5Tcreate(H5T_COMPOUND, sizeof(fwdptr));
+      if (fwdtid == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create  a compound datatype. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Insert "BEGIN" data member to the dataset */
+      /* ----------------------------------------- */
+      status = H5Tinsert(fwdtid,"BEGIN", HOFFSET(fwdptr, begin), H5T_NATIVE_LLONG);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot add a new member named \"BEGIN\"to a compound datatype. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Insert "EXTENT" data member to the dataset */
+      /* ------------------------------------------ */
+      status = H5Tinsert(fwdtid,"EXTENT", HOFFSET(fwdptr, extent), H5T_NATIVE_LLONG);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot add a new member named \"EXTENT\"to a compound datatype. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+	  
+      /* Create (appendible) dataset */
+      /* --------------------------- */
+      tempid = H5Dcreate(HE5_PTXPoint[idx].link_id, utlbuf, fwdtid, space, plist);
+      if (tempid == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create the dataset. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Extend the dataset */
+      /* ------------------ */
+      status = H5Dextend(tempid, &dim);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot extend the dataset. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return status;
+	}
+	  
+  
+      /* Create X-fer property list */
+      /* -------------------------- */
+      xfrlist = H5Pcreate(H5P_DATASET_XFER);
+      if (xfrlist == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create x-fer property list ID. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Set type conversion and background buffer */
+      /* ----------------------------------------- */
+      status = H5Pset_buffer(xfrlist,sizeof(fwdptr), NULL, NULL);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the buffer. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Write out buffer (with -1 fill value) to establish dataset */
+      /* --------------------------------------------------------- */
+      status = H5Dwrite(tempid, fwdtid, H5S_ALL, H5S_ALL, xfrlist, &ForwardData);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write data to the dataset. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return status;
+	}
+	  
+	  
+
+      /* Release the data type ID */
+      /* ------------------------ */
+      status = H5Tclose(fwdtid);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the data type ID. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return status;		
+	}
+
+	
+      /* Release the data space ID */
+      /* ------------------------- */  
+      status = H5Sclose(space);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the data space ID. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return status;
+	}
+
+
+      /* Release the property list ID */
+      /* ---------------------------- */
+      status = H5Pclose(plist);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot release the property list ID. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return status;
+	}
+
+      /* Release the x-ferproperty list ID */
+      /* --------------------------------- */
+      status = H5Pclose(xfrlist);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot release the property list ID. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return status;
+	}
+	  
+
+      /* Release the dataset ID */
+      /* ---------------------- */
+      status = H5Dclose(tempid);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the dataset ID. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return status;
+	}
+	  
+    }
+  
+
+  /*
+**************************************************************
+*             M E T A D A T A   S E C T I O N                *
+**************************************************************
+*/  
+  
+  /* Insert Point Level metadata */
+  /* --------------------------- */
+  status = HE5_EHinsertmeta(fid , HE5_PTXPoint[idx].ptname, "p", 10L, (char *)levelname, &dum);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot insert Point Level metadata \n");
+      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return status;
+    }
+	    
+  for (i = 0; i < levelinfo->nfields; i++)
+    {
+      /* Concatenate fieldname with level name */
+      /* ------------------------------------- */
+      memmove(utlbuf, levelinfo->fieldname[i], strlen(levelinfo->fieldname[i]));
+      utlbuf[strlen(levelinfo->fieldname[i])] = 0;
+      strcat(utlbuf, ":");
+      strcat(utlbuf, levelname);
+	  
+	  
+      /* Load ntype and field order into metadata input array */
+      /* ---------------------------------------------------- */
+      levelinfo->dclass[i] = H5Tget_class(levelinfo->dtype[i]);
+      /* If datatype class is H5T_STRING, then the field is
+	 string type */
+      if (levelinfo->dclass[i] == H5T_STRING)
+	{
+	  ntype = HE5T_CHARSTRING;
+	}
+      else
+	{ 
+	  ntype = HE5_EHdtype2numtype(levelinfo->dtype[ i ]);
+	}
+
+      if (ntype == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the number type ID. \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      else if (ntype == 0)
+	{
+	  metadata[0] = 0;
+	}
+      else
+	{
+	  metadata[0] = HE5_EHhid2hsize(ntype);
+	  if (metadata[0] == 0)
+	    {
+	      sprintf(errbuf, "Cannot convert \"hid_t\" to \"hsize_t\" data type. \n");
+	      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	}
+
+      if (levelinfo->array[i] == TRUE)
+	{
+	  order = levelinfo->rank[i];
+	  metadata[1] = order;
+	}
+      else
+	{
+	  metadata[1] = 1;
+	}
+
+      /* Set field order (change order = 0 to order = 1) for scalars*/
+      /* ---------------------------------------------------------- */
+	  
+      if (metadata[1] == 0)
+	{
+	  metadata[1] = 1;
+	}
+	  
+      /* Insert point field metadata */
+      /* --------------------------- */
+      status = HE5_EHinsertmeta(fid, HE5_PTXPoint[idx].ptname, "p", 11L, utlbuf, metadata);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot insert Point Field metadata \n");
+	  H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return status;
+	}
+    }
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTdeflinkage                                                 |
+|                                                                             |
+|  DESCRIPTION: Defines link field between two (adjacent) levels.             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  parent         char                parent level name                       |
+|  child          char                child level name                        |
+|  linkfield      char                linkage field name                      |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date        Programmer   Description                                      |
+|  =========   ============  ==============================================   |
+|  12/13/99    A.Muslimov    Added proper error handlings after the function  |
+|                            calls. In the call EHinsertmeta() replaced gid   |
+|                            by fid.                                          |
+|  1/06/00     A.Muslimov    Changed datatype of "dum" from int32_t to hsize_t|
+|                            to make a call to EHinsertmeta() successfull.    |
+|  7.18.99     A.Muslimov    Unmasked hdf5 data types.                        |
+|  Oct 00      A.Muslimov    Modified to reflect changes in HE5_PTfexist().   |
+|  09/13/01 A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_PTdeflinkage(hid_t pointID, char *parent, char *child, char *linkfield)
+{
+  herr_t          status      = FAIL;/* routine return status variable */
+
+  int             i;			     /* Loop index                     */
+  int             nlevels     = FAIL;/* Number of levels in point      */
+  int             foundParent = FAIL;/* Found parent level flag        */
+  int             foundChild  = FAIL;/* Found child level flag         */
+
+  hid_t           fid         = FAIL;/* HDF-EOS file ID                */
+  hid_t           gid         = FAIL;/* POINTS group ID                */
+  hid_t           dtsid       = FAIL;/* Dataset ID                     */
+
+  long            idx         = FAIL;/* Point index                    */
+
+  hsize_t         dum         =  0;/* dammy variable */
+
+  char            utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer        */
+  char            *mess  = "Linkage Field \"%s\" not found in Parent Level: \"%s\".\n";
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer  */
+
+  HE5_LOCK;
+  CHECKPOINTER(parent);
+  CHECKPOINTER(child);
+  CHECKPOINTER(linkfield);
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTdeflinkage", &fid, &gid, &idx);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Checking for point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  /* Get number of levels in point */
+  /* ----------------------------- */
+  nlevels = HE5_PTnlevels(pointID);
+  if(nlevels == FAIL)
+    {
+      sprintf(errbuf, "Cannot retrieve the number of levels\n");
+      H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* For all levels ... */
+  /* ------------------ */
+  for (i = 0; i < nlevels; i++)
+    {
+      /* Get level data ID and name */
+      /* -------------------------- */
+      dtsid = HE5_PTXPoint[idx].level[i].ID;
+      strcpy(utlbuf, HE5_PTXPoint[idx].level[i].name);
+
+      /* If equal to parent level name ... */
+      /* --------------------------------- */
+      if (strcmp(utlbuf, parent) == 0)
+	{
+	  /* Set found parent flag */
+	  /* --------------------- */
+	  foundParent = i;
+
+	  /* Check if linkfield exists in parent level */
+	  if (HE5_PTfexist(dtsid,linkfield,NULL,NULL,NULL,NULL) == 1 )
+	    {
+	      break;
+	    }
+	  else
+	    {
+	      /* ... else report error */
+	      /* --------------------- */
+	      status = FAIL;
+	      sprintf(errbuf, mess, linkfield, parent);
+	      H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      break;
+
+	    }
+
+	}
+	    
+    }
+    
+  /* For all levels ... */
+  /* ------------------ */
+  for (i = 0; i < nlevels; i++)
+    {
+      /* Get level  ID and name */
+      /* -------------------------- */
+      dtsid = HE5_PTXPoint[idx].level[i].ID;
+      strcpy(utlbuf, HE5_PTXPoint[idx].level[i].name);
+
+      /* If equal to child level name ... */
+      /* -------------------------------- */
+      if (strcmp(utlbuf, child) == 0)
+	{
+	  /* Set found child flag */
+	  /* -------------------- */
+	  foundChild = i;
+
+	  /* Check if linkfield exists in patent level */
+	  if (HE5_PTfexist(dtsid,linkfield,NULL,NULL,NULL,NULL) == 1 )
+	    {
+	      break;
+	    }
+	  else
+	    {
+	      /* ... else report error */
+	      /* --------------------- */
+	      status = FAIL;
+	      sprintf(errbuf, mess, linkfield, parent);
+	      H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      break;
+
+	    }
+
+
+	}
+    }
+
+
+  /* Report parent level not found if relevant */
+  /* ----------------------------------------- */
+  if (foundParent == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Parent Level: \"%s\" not found.\n", parent);
+      H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf );
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  /* Report child level not found if relevant */
+  /* ---------------------------------------- */
+  if (foundChild == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Child Level: \"%s\" not found.\n", child);
+      H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf );
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Check that parent and child levels are adjacent */
+  /* ----------------------------------------------- */
+  if (foundParent != FAIL && foundChild != FAIL && foundChild - foundParent != 1)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Parent/Child Levels not adjacent \"%s/%s\".\n",  parent, child);
+      H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_BTREE, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  /* Insert linkage info in structural metadata */
+  /* ------------------------------------------ */
+  sprintf(utlbuf, "%s%s%s%s%s", parent, "/", child, ":", linkfield);
+  status = HE5_EHinsertmeta(fid, HE5_PTXPoint[idx].ptname, "p", 12L, utlbuf, &dum);
+  if(status == FAIL)
+    {
+      sprintf(errbuf, "Cannot insert metadata for the \"%s\" point\n", HE5_PTXPoint[idx].ptname);
+      H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTwritesetup                                                 |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               HDFEOS point ID                         |
+|  level          int                 level number (0 - based)                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  nrec           hssize_t            Number of current records               |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/26/99  A.Muslimov    Added a new variable count to pass as a 4th argument|
+|                         to PTwriteattr().                                   |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Oct 00   A.Muslimov    Modified to reflect chages in other interfaces.     |
+|  09/13/01 A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t  
+HE5_PTwritesetup(hid_t pointID,  int level, hssize_t *nrec)
+{
+  herr_t          status  = FAIL;/* routine return status variable   */
+
+  int             i;			 /* loop index                       */
+
+  hid_t           fid     = FAIL;/* HDF-EOS file ID                  */
+  hid_t           gid     = FAIL;/* POINTS group ID                  */
+
+  long            idx     = FAIL;/* Point index                      */
+
+  unsigned int    zerobuf[HE5_DTSETRANKMAX];     
+
+  hsize_t         count[HE5_DTSETRANKMAX];/* # of attribute elements */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* error messge buffer */
+
+  HE5_LOCK;
+
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      zerobuf[ i ] = 0;
+      count[ i ]   = 0;
+    }
+        
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTwritesetup", &fid, &gid, &idx);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Checking for point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTwritesetup", __LINE__, H5E_FUNC, H5E_CANTINIT,  errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get current number of records */
+  /* ----------------------------- */
+  *nrec = (hssize_t)HE5_PTnrecs(pointID, level);
+  if (*nrec == 0)
+    {
+      /* Read  "_LevelWritten" Attribute */
+      /* ------------------------------- */
+      status = HE5_PTreadattr(pointID,"_LevelWritten", zerobuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot read the attribute \"_LevelWritten\". \n");
+	  H5Epush(__FILE__, "HE5_PTwritesetup", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      /* If level not yet written then write it */
+      /* -------------------------------------- */
+      if ( zerobuf[level] == 0)
+        {
+	  zerobuf[ level ] = 1;
+	  count[ level ]   = 1;
+
+	  /* Write "1" to "_LevelWritten" record for this level */
+	  /* -------------------------------------------------- */		  
+	  status = HE5_PTwriteattr(pointID, "_LevelWritten", H5T_NATIVE_UINT, count, zerobuf);
+	  if (status == FAIL)
+	    {
+              sprintf(errbuf, "Cannot write record to the attribute \"_LevelWritten\". \n");
+              H5Epush(__FILE__, "HE5_PTwritesetup", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+              HE5_EHprint(errbuf, __FILE__, __LINE__);
+              return(status);
+	    }
+           
+        }
+    }
+	  
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:  HE5_PTwritelevel                                                |
+|                                                                             |
+|  DESCRIPTION: Writes full records to a level.                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|  count[]        hsize_t             Number of records to write              |
+|  size           size_t              Data size (bytes) to write              |
+|  data           void                data buffer                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|      None                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date        Programmer    Description                                     |
+|  ==========   ============  =============================================   |
+|  12/13/99     A.Muslimov    Added proper error handlings after the function |
+|                              calls.                                         |
+|  7.18.99      A.Muslimov    Unmasked hdf5 data types.                       |
+|  Oct 00       A.Muslimov    Changed the interface to make it consistent with|
+|                             writing data to compound dataset.               |
+|  09/13/01     A.Muslimov    Added mutex "lock"/"unlock" calls.              |
+|  02/01/06     Abe Taaheri   use the same pointID for both  HE5_PTwrbckptr & |
+|                             HE5_PTwrfwdptr calls                            |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_PTwritelevel(hid_t pointID, int level, hsize_t count[], size_t *size, void *data)
+{
+  herr_t         status    = FAIL;/* routine return status variable   */
+
+  int            nlevels   = FAIL;/* Number of levels in point        */
+
+  hid_t          fid       = FAIL;/* HDF-EOS file ID                  */
+  hid_t          gid       = FAIL;/* POINTS group ID                  */
+  hid_t          dataID    = FAIL;/* dataset ID                       */
+  hid_t          typeID    = FAIL;/* data type ID                     */
+  hid_t          xfer_list = FAIL;/* Property list  ID                */ 
+
+  long           idx       = FAIL;/* Point index                      */
+
+  hssize_t       nrec      = FAIL;/* Current number of records        */
+
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+  hid_t          savePointID;
+
+  size_t         datasize = 0;       /* datatype size for data in level records */
+  HE5_CmpDTSinfo inStruct;
+  herr_t         readstatus;
+  unsigned char *newdatabuff = NULL; /* buffer for old + new records in level   */
+  unsigned char *val = NULL;         /* buffer for reading old records in level */
+  hsize_t        tcount[1];
+
+  HE5_LOCK;
+  CHECKPOINTER(count);
+  CHECKPOINTER(size);
+  CHECKPOINTER(data);
+
+  tcount[0] = count[0];
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTwritelevel", &fid, &gid, &idx);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Checking for file ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  /* Get the current number of records */
+  /* --------------------------------- */
+  status = HE5_PTwritesetup(pointID, level, &nrec);
+  if(status == FAIL)
+    {
+      sprintf(errbuf, "Cannot retrieve the current number of records\n");
+      H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+   /* Get number of levels */
+  /* -------------------- */
+  nlevels = HE5_PTnlevels(pointID);
+  if(nlevels == FAIL)
+    {
+      sprintf(errbuf, "Cannot retrieve the number of levels\n");
+      H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Report error if no levels (dataset) defined */
+  /* ------------------------------------------- */
+  if (nlevels == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID);
+      H5Epush(__FILE__, "HE5_PTwritelevel",   __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  else if (nlevels < level)
+    {
+      /* Report error if level # to large */
+      /* -------------------------------- */
+      status = FAIL;
+      sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID);
+      H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* If level already has records, append to it */
+  if(nrec > 0)
+    {
+      /* read nrec records and append data to it */
+      readstatus = HE5_PTreadlevel(pointID, level, &inStruct, &datasize, NULL);
+      if (readstatus == FAIL )
+	{
+	  sprintf(errbuf, "Checking for datasize of records in level failed. \n");
+	  H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(readstatus);
+	}
+
+      readstatus = HE5_PTlevelinfo(pointID, level, &inStruct);
+      if (readstatus == FAIL )
+	{
+	  sprintf(errbuf, "Checking for info on level failed. \n");
+	  H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(readstatus);
+	}
+
+      val = calloc(nrec, datasize);
+      if(val == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for the buffer for reading existing records.\n");
+	  H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      readstatus = HE5_PTreadlevel(pointID, level, &inStruct, &datasize, (void *)val);
+      if (readstatus == FAIL )
+	{
+	  sprintf(errbuf, "Reading existing records in level failed. \n");
+	  H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(readstatus);
+	}
+
+      /* allocate memory for the buffer to hold all existing and new records */
+      newdatabuff = calloc((nrec+tcount[0]), datasize);
+
+      /* copy existing records to newdatabuff */
+      memcpy(newdatabuff, val, nrec * datasize);
+      if( val != NULL)
+	{
+	  free(val);
+	  val = NULL;
+	}
+      /* add new records to newdatabuff */
+      memcpy(newdatabuff+(nrec * datasize), data, tcount[0]*datasize);
+      tcount[0] = tcount[0]+nrec;
+    }
+  /* Get the level dataset ID  */
+  /* ------------------------- */
+  dataID = HE5_PTXPoint[idx].level[level].ID;
+
+  /* Extend the dataset size */
+  /* ----------------------- */
+  status = H5Dextend(dataID, tcount);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot extend the  dataset. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get the datatype ID */
+  /* ------------------- */
+  H5Eset_auto(NULL, NULL);
+  typeID = H5Dget_type(dataID);
+  if (typeID == FAIL)
+    {
+      sprintf(errbuf, "Cannot get data type ID. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Create the property list */
+  /* ------------------------ */
+  xfer_list = H5Pcreate(H5P_DATASET_XFER);
+  if (xfer_list == FAIL)
+    {
+      sprintf(errbuf, "Cannot create the property list ID. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Set type conversion and background buffer */
+  /* ----------------------------------------- */
+  status = H5Pset_buffer(xfer_list, *size, NULL, NULL);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot set type conversion and background buffer. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Write data to the dataset */
+  /* ------------------------- */
+  if(nrec > 0)
+    {
+      status = H5Dwrite(dataID, typeID, H5S_ALL, H5S_ALL, xfer_list, (void *)newdatabuff);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write data to the dataset. \n");
+	  H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      
+      if(newdatabuff != NULL)
+	{
+	  free(newdatabuff);
+	  newdatabuff = NULL;
+	}
+    }
+  else
+    {
+      status = H5Dwrite(dataID, typeID, H5S_ALL, H5S_ALL, xfer_list, (void *)data);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write data to the dataset. \n");
+	  H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+
+  /* Release data type ID */
+  /* -------------------- */
+  status = H5Tclose(typeID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the data type ID. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Release property list ID */
+  /* ------------------------ */
+  status = H5Pclose(xfer_list);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the property list ID. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  if (level > 0)
+    { 
+      savePointID = pointID;
+
+      /* Write BackPointers */
+      /* ------------------ */
+      status = HE5_PTwrbckptr(pointID, level);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write back pointer records. \n");
+	  H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      /* Write FwdPointers */
+      /* ----------------- */
+      status = HE5_PTwrfwdptr(savePointID, level - 1); 
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write forward pointer records. \n");
+	  H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTwriteattr                                                  |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  attrname       char                attribute name                          |
+|  numtype        hid_t               attribute HDF numbertype                |
+|  count          hsize_t             Number of attribute elements            |
+|  wrcode         char                Read/Write Code "w/r"                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf                                                                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  09/13/01 A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_PTwriteattr(hid_t pointID, const char *attrname, hid_t numtype, hsize_t count[],void * datbuf)
+{
+  herr_t     status     = FAIL;/* routine return status variable */
+
+  hid_t      fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid        = FAIL;/* HDFEOS group ID                */
+
+  long       idx        = FAIL;/* Point index                    */
+  hid_t      ntype;
+
+  HE5_LOCK;
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+
+  /* 
+     if numtype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use numtype itself
+  */
+  ntype = HE5_EHconvdatatype(numtype);
+  if(ntype == FAIL)
+    {
+      ntype = numtype;
+    }
+
+  /* Check Point ID */
+  /* -------------- */
+  status = HE5_PTchkptid(pointID, "HE5_PTwriteattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Perform Attribute I/O */
+      /* --------------------- */
+      status = HE5_EHattr(HE5_PTXPoint[idx].pt_id, attrname, ntype, count,"w", datbuf);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTreadattr                                                   |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from a point.                                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  09/13/01 A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_PTreadattr(hid_t pointID, const char *attrname, void *datbuf)
+{
+  herr_t      status  = FAIL;/* routine return status variable */
+
+  hid_t       fid     = FAIL;/* HDF-EOS file ID                */
+  hid_t       tid     = FAIL;/* Data type ID                   */
+  hid_t       gid     = FAIL;/* POINTS group ID                */
+
+  hsize_t     count[] = {0}; /* Number of elements             */
+
+  long        idx     = FAIL;/* Point index                    */
+
+  HE5_LOCK;
+  CHECKPOINTER(attrname);
+
+  /* Check Point ID */
+  /* -------------- */
+  status = HE5_PTchkptid(pointID, "HE5_PTreadattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get attribute group ID and call EHattr to perform I/O  */
+      /* ------------------------------------------------------ */
+      status = HE5_EHattr(HE5_PTXPoint[idx].pt_id, attrname, tid, count, "r", datbuf);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTlevelinfo                                                  |
+|                                                                             |
+|  DESCRIPTION: Returns information about a given level.                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  info           HE5_CmpDTSinfo      Structure containing information about  |
+|                                      specified level.                       |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Oct  00  A.Muslimov    Changed the interface.                              |
+|  Aug  04  S.Zhao        Added the number type for a field in a point level. |
+|  Feb  06  Abe Taaheri   Added support for STRING fields and size of         ||                          structure                                          |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_PTlevelinfo(hid_t pointID, int level, HE5_CmpDTSinfo *info)
+{
+  herr_t          status     = SUCCEED;	/* routine return status variable */
+
+  int             nlevels    =  0;	/* Number of levels in point      */
+  int             i, j;			/* Loop indices                   */
+
+  hid_t           fid        = FAIL;    /* HDF-EOS file ID                */
+  hid_t           levelID    = FAIL;    /* data ID                        */
+  hid_t      	  gid        = FAIL;    /* "POINTS" group ID              */
+  hid_t           typeID     = FAIL;    /* Data type ID                   */
+  hid_t           btypeID    = FAIL;    /* Base Data type ID              */
+  hid_t           mdt[HE5_FLDNUMBERMAX]       = {FAIL};    /* Member data type ID            */
+
+  hsize_t         dims[HE5_DTSETRANKMAX];/* Array of dimension sizes      */
+
+  long            idx        = FAIL;	/* Point index                    */
+
+  size_t          *size      = (size_t *)NULL;/* data size (bytes)        */
+  size_t          *order     = (size_t *)NULL;/* data byte order          */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTlevelinfo", &fid, &gid, &idx);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Checking for Point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Initialize the members of a structure */
+  /* ------------------------------------- */
+  info->nfields  = FAIL;
+  info->datasize = 0;
+  for (i = 0; i < HE5_FLDNUMBERMAX; i++)
+    {
+      info->rank[i]    = FAIL;
+      info->array[i]   = FALSE;
+      info->offset[i]  = FAIL;
+      info->dtype[i]   = FAIL;
+      info->numtype[i] = FAIL;
+      info->dclass[i]  = H5T_NO_CLASS;
+      for (j = 0; j < HE5_DTSETRANKMAX; j++)
+	info->dims[i][j] = 0;
+
+    }
+
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[ i ] = 0;
+  
+
+  /* Get number of levels */
+  /* -------------------- */
+  nlevels = HE5_PTnlevels(pointID);
+  if (nlevels == 0)
+    {
+      sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID);
+      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else if (nlevels < level)
+    {
+      /* Report error if level # to large */
+      /* -------------------------------- */
+      sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID);
+      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Get data ID of point level */
+  /* -------------------------- */
+  levelID = HE5_PTXPoint[idx].level[level].ID;
+
+  /* Get compound datatype id */
+  /* ------------------------ */
+  typeID = H5Dget_type(levelID);
+  if (typeID == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the datatype ID for a level.\n");
+      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Get number of fields */
+  /* -------------------- */
+  info->nfields = H5Tget_nmembers(typeID);
+  if (info->nfields == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number of fields for a level.\n");
+      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate memory for "size" variable */
+  /* ----------------------------------- */
+  size = (size_t *)calloc(info->nfields, sizeof(size_t));
+  if (size == (size_t *)NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for the size variable.\n");
+      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate memory for "order" variable */
+  /* ----------------------------------- */
+  order = (size_t *)calloc(info->nfields, sizeof(size_t));
+  if (order == (size_t *)NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for the order variable.\n");
+      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(size);
+      return(FAIL);
+    }
+
+  /* Loop through all data members */
+  /* ----------------------------- */
+  for( i = 0; i < info->nfields; i++)
+    {	  
+      size[i] = 0;
+
+      /* Get member name */
+      /* --------------- */
+      info->fieldname[i] = H5Tget_member_name(typeID, i);
+      if (info->fieldname[i] == NULL)
+	{
+	  sprintf(errbuf, "Cannot get the field name.\n");
+	  H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (size != NULL) free(size);
+	  if (order != NULL) free(order);
+	  return(FAIL);
+	}
+	  
+      /* Get member type */
+      /*---------------- */
+      mdt[i] = H5Tget_member_type(typeID, i);
+      if (mdt[i] == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the field type.\n");
+	  H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (size != NULL) free(size);
+	  if (order != NULL) free(order);
+	  return(FAIL);
+	}
+	  
+      /* Get field data class */
+      /* -------------------- */
+      info->dclass[i] = H5Tget_class(mdt[i]);
+      if (info->dclass[i] == H5T_NO_CLASS)
+	{
+	  sprintf(errbuf, "Cannot get the field class.\n");
+	  H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (size != NULL) free(size);
+	  if (order != NULL) free(order);
+	  return(FAIL);
+	}	  
+	  	  
+      /* Get the rank and "array" flag */
+      /* ----------------------------- */
+      if (info->dclass[i] == H5T_ARRAY)
+	{
+	  /* Get the field rank */
+	  /* ------------------ */
+	  info->rank[i]  = H5Tget_array_ndims(mdt[i]);
+	  if (info->rank[i] == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the field rank.\n");
+	      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (size != NULL) free(size);
+	      if (order != NULL) free(order);
+	      return(FAIL);
+	    }	  
+
+	  /* The field is an array */
+	  /* --------------------- */
+	  info->array[i] = TRUE;
+
+	  /* Get the field dimension sizes */
+	  /* ----------------------------- */
+	  status = H5Tget_array_dims(mdt[i], dims, NULL);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the field dimension sizes.\n");
+	      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (size != NULL) free(size);
+	      if (order != NULL) free(order);
+	      return(FAIL);
+	    }	  
+
+	  /* Set the field dimension sizes */
+	  /* ----------------------------- */
+	  for (j = 0; j < info->rank[i]; j++)
+	    info->dims[i][j] = dims[j];
+
+	  /* Get the field base data type ID */
+	  /* ------------------------------- */
+	  btypeID = H5Tget_super(mdt[i]);
+	  if (btypeID == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the field base data type ID.\n");
+	      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (size != NULL) free(size);
+	      if (order != NULL) free(order);
+	      return(FAIL);
+	    }	  
+
+
+	  /* Set the field data type */
+	  /* ----------------------- */
+	  info->dtype[i] = btypeID;
+
+	  /* Set the field number type */
+	  /* ------------------------- */
+	  info->numtype[i] = HE5_EHdtype2numtype(info->dtype[i]);
+
+	  if (info->numtype[i] == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the number type ID.\n");
+	      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (size != NULL) free(size);
+	      if (order != NULL) free(order);
+	      return(FAIL);
+	    }
+
+	  /* Get the field data size */
+	  /* ----------------------- */
+	  size[i] = H5Tget_size(btypeID);
+	  if (size[i] == 0)
+	    {
+	      sprintf(errbuf, "Cannot get the field data size.\n");
+	      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (size != NULL) free(size);
+	      if (order != NULL) free(order);
+	      return(FAIL);
+	    }	  
+
+	  /* Release the data type ID */
+	  /* ------------------------ */
+	  status = H5Tclose(btypeID);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the field data type ID.\n");
+	      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (size != NULL) free(size);
+	      if (order != NULL) free(order);
+	      return(FAIL);
+	    }	  
+	}
+      else
+	{
+	  /* Set the scalar field parameters */
+	  /* ------------------------------- */
+	  info->rank[i]    = 1;
+	  info->array[i]   = FALSE;
+	  info->dims[i][0] = 1;
+	  info->dtype[i]   = mdt[i];
+
+	  if (info->dclass[i] == H5T_STRING)
+	    {
+	      info->numtype[i] = HE5T_CHARSTRING;
+	    }
+	  else
+	    {
+	      info->numtype[i] = HE5_EHdtype2numtype(info->dtype[i]);
+	    }
+
+	  if (info->numtype[i] == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the number type ID.\n");
+	      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (size != NULL) free(size);
+	      if (order != NULL) free(order);
+	      return(FAIL);
+	    }
+
+	  /* Get the scalar field data size */
+	  /* ------------------------------ */
+	  size[i] = H5Tget_size(mdt[i]);
+	  if (size[i] == 0)
+	    {
+	      sprintf(errbuf, "Cannot release the field data size.\n");
+	      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (size != NULL) free(size);
+	      if (order != NULL) free(order);
+	      return(FAIL);
+	    }
+	}
+
+      /* Calculate the field order */
+      /* ------------------------- */
+      order[i] = 1;
+      for (j = 0; j < info->rank[i]; j++)
+	order[i] *= info->dims[i][j];
+
+      /* Calculate the data size in memory */
+      /* --------------------------------- */
+      /* Note: info->datasize += size[i]*order[i]; calculates 
+	 structure size exactly, but it causes problem with 
+	 PTreadlevel, where padded size of structure may be 
+	 needed. For example the following structure for
+	 Sensor level
+
+	 typedef struct {
+	 char     name[32];
+	 float    lat;
+	 float    lon;
+	 float    alt;
+	 unsigned short int      id;
+	 } Sensor;
+	     
+	 has exact size of 46 bytes, but padded size is 48, 
+	 which is needed for 
+	 " datasize = (hsize_t)(dtsinfo.datasize);" 
+	 in the PTreadlevel routine. So instead of 
+	 info->datasize += size[i]*order[i] we will 
+	 use H5Tget_size(typeID) which gets padded 
+	 size of level structue */
+
+      /*info->datasize += size[i]*order[i];*/
+      info->datasize = H5Tget_size(typeID);
+    }
+
+  /* Calculate field unalligned offsets */
+  /* ---------------------------------- */
+  info->offset[0] = 0;
+  for (i = 1; i < info->nfields; i++)
+    info->offset[i] = info->offset[i-1]+(off_t)(size[i-1]*order[i-1]);
+
+  if (size != NULL) free(size);
+  if (order != NULL) free(order);
+
+
+  /* Release the field data type ID */
+  /* ------------------------------ */
+  for( i = 0; i < info->nfields; i++)
+    {
+      status = H5Tclose(mdt[i]);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the field data type ID.\n");
+	  H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (size != NULL) free(size);
+	  if (order != NULL) free(order);
+	  return(FAIL);
+	}
+    }
+
+  /* Release the datatype ID */
+  /* ----------------------- */
+  status = H5Tclose(typeID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the datatype ID.\n");
+      H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }	  
+
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTreadlevel                                                  |
+|                                                                             |
+|  DESCRIPTION: Reads data from the specified fields and records of a level.  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|  inStruct       HE5_CmpDTSinfo      Input data structure containing infor-  |
+|                                      mation about compound dataset to read. |
+|  size           size_t              Memory size (bytes) of data structure to|
+|                                      read data into.                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf                             Data buffer                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 00   A.Muslimov    Changed type of 'slen' from long to size_t.         |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Oct 00   A.Muslimov    Changed the interface.                              |
+|  Mar 00   A.Muslimov    Modified to reflect changes in HDF5 library:        |
+|                         H5Tinsert_array should be replaced by two calls     |
+|                         H5Tarray_create() and H5Tinsert().                  |
+|  09/13/01 A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  Feb 06   Abe Taaheri   Modified for getting datasize only,                 |
+|                         Correction for setting datasize in xfer_list,       |
+|                         Support for STRING fields,                          |
+|                         and using correct datatypes                         |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_PTreadlevel(hid_t pointID, int level, HE5_CmpDTSinfo *inStruct, size_t *size, void *datbuf)
+{
+  herr_t          status    = FAIL;/* routine return status variable  */
+
+  int             nlevels   =  0;  /* Number of levels in point       */
+  int             i, j;            /* Loop indices                    */
+
+  hid_t           fid       = FAIL;/* HDF-EOS file ID                 */
+  hid_t           gid       = FAIL;/* POINTS group ID                 */
+  hid_t           dataID    = FAIL;/* dataset ID                      */
+  hid_t           xfer_list = FAIL;/* Property list ID                */
+  hid_t           typeID    = FAIL;/* compound datatype ID            */
+  hid_t           arr_id    = FAIL;/* Array datatype ID               */
+
+  hsize_t         dims[HE5_DTSETRANKMAX];/* Array of dimension sizes  */
+
+  hsize_t         datasize  = 0;/* Size (bytes) of a dataset to read  */
+
+  long            idx       = FAIL;/* Point index                     */
+
+  HE5_CmpDTSinfo dtsinfo;/* Structure to read information about level */    
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+  hid_t           cdatatype = FAIL;           /* return data type ID  */
+  int             dtypesize = FAIL;
+  hid_t           mytypeID  = FAIL;           /* compound datatype ID */
+  hid_t           mdt       = FAIL;           /* Member data type ID  */
+  int             jjj       = 0;
+  int             jj        = 0;
+  int             result    = 99;
+
+
+  HE5_LOCK;
+  CHECKPOINTER(inStruct);
+  CHECKPOINTER(size);
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTreadlevel", &fid, &gid, &idx);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Checking for the point  ID failed.\n");
+      H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[ i ] = 0;
+
+  /* Get number of levels in point */
+  /* ----------------------------- */
+  nlevels = HE5_PTnlevels(pointID);
+  if (nlevels == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID);
+      H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  else if (nlevels < level)
+    {
+      /* Report error if level # to large */
+      /* -------------------------------- */
+      status = FAIL;
+      sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID);
+      H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_FILE, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get level dataset ID */
+  /* ------------------ */
+  dataID = HE5_PTXPoint[idx].level[level].ID;
+
+  /* Create property list */
+  /* -------------------- */
+  xfer_list = H5Pcreate(H5P_DATASET_XFER);
+  if (xfer_list == FAIL)
+    {
+      sprintf(errbuf, "Cannot create the property list. \n");
+      H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Call HE5_PTlevelinfo() */
+  /* ---------------------- */
+  status = HE5_PTlevelinfo(pointID, level, &dtsinfo);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the level information. \n");
+      H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Get the dataset size */
+  /* -------------------- */
+  datasize = (hsize_t)(dtsinfo.datasize);
+
+  /* If user only wants to get the size of datbuf
+     so that he/she can allocate enough memory for 
+     datbuf, user will pass datbuf as NULL. In this 
+     case return here with the required size. */ 
+  if(datbuf == NULL)
+    {
+      *size = datasize;
+      return(SUCCEED);
+    }
+
+  /* Set the buffer */
+  /* -------------- */
+  status = H5Pset_buffer(xfer_list, dtsinfo.datasize, NULL, NULL);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot set the read buffer. \n");
+      H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Create Compound datatype */
+  /* ------------------------ */
+  typeID = H5Tcreate(H5T_COMPOUND, *size);
+  if (typeID == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot create the compound data type.\n");
+      H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+   
+  /* Add members of a compound datatype to read */
+  /* ------------------------------------------ */
+  for ( i = 0; i < inStruct->nfields; i++)
+    {
+      for( jj = 0; jj <dtsinfo.nfields ; jj++ )
+	{
+	  result  = strcmp(inStruct->fieldname[i],dtsinfo.fieldname[jj]);
+	  if( result == 0 ) 
+	    {
+	      jjj = jj;
+	      result = 99;
+	    }    
+	} 
+      jj = jjj;
+      inStruct->numtype[i]=dtsinfo.numtype[jj];
+      /* Check if the member is an array */
+      /* ------------------------------- */
+      if ( inStruct->array[i] == TRUE)
+	{
+		  
+	  for (j = 0; j < inStruct->rank[i]; j++)
+	    dims[j] = (hsize_t)(inStruct->dims[i][j]);
+
+	  /* Create array datatype */
+	  /* --------------------- */
+	  /*arr_id = H5Tarray_create(inStruct->dtype[i], inStruct->rank[i], (const hsize_t *)dims, NULL);*/
+	  cdatatype = HE5_EHconvdatatype(inStruct->numtype[i]);
+	  /* 
+	    if numtype is HE5 numbertype, rather than H5 numbertype, 
+	    then convert it, otherwise use numtype itself
+	  */
+	  if(cdatatype == FAIL)
+	    {
+	      cdatatype = inStruct->numtype[i];
+	    }
+
+	  arr_id = H5Tarray_create(cdatatype, inStruct->rank[i], (const hsize_t *)dims, NULL);
+		  
+	  if (arr_id == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot create \"array\" datatype. \n");
+	      H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  /* Add array field */
+	  /* --------------- */
+	  status = H5Tinsert(typeID, inStruct->fieldname[i], inStruct->offset[i], arr_id);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot insert \"array\" element. \n");
+	      H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  /* Release the data type ID */
+	  /* ------------------------ */
+	  status = H5Tclose(arr_id);
+	  if (status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot release data type ID. \n");
+	      H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	}
+      else 
+	{
+	  /* Add atomic field */
+	  /* ---------------- */
+
+	  if(inStruct->dclass[i] == H5T_STRING)
+	    {
+	      /* Get compound datatype id */
+	      /* ------------------------ */
+	      mytypeID = H5Dget_type(dataID);
+	      mdt = H5Tget_member_type(mytypeID, i);
+	      dtypesize = H5Tget_size(mdt);
+		      
+	      status = H5Tclose(mdt);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot release the field data type ID.\n");
+		  H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+		      
+	      arr_id = H5Tcopy(H5T_C_S1);
+	      H5Tset_size(arr_id,dtypesize);
+	      H5Tset_strpad(arr_id, H5T_STR_NULLPAD);
+	      status = H5Tinsert(typeID, inStruct->fieldname[i], 
+				 inStruct->offset[i],arr_id);
+		    
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot insert atomic data element. \n");
+		  H5Epush(__FILE__, "HE5_PTreadlevel", 
+			  __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+
+	      status = H5Tclose(arr_id);
+	      if (status == FAIL )
+		{
+		  sprintf(errbuf, "Cannot release data type ID. \n");
+		  H5Epush(__FILE__, "HE5_PTreadlevel", 
+			  __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    }
+	  else
+	    {
+	      cdatatype = HE5_EHconvdatatype(inStruct->numtype[i]);
+	      /* 
+		 if numtype is HE5 numbertype, rather than H5 numbertype, 
+		 then convert it, otherwise use numtype itself
+	      */
+	      if(cdatatype == FAIL)
+		{
+		  cdatatype = inStruct->numtype[i];
+		}
+	      if(inStruct->nfields == 1)
+		{
+		  status = H5Tinsert(typeID, inStruct->fieldname[i], 
+				     0,cdatatype );
+		}
+	      else
+		{
+		  status = H5Tinsert(typeID, inStruct->fieldname[i],
+				     inStruct->offset[i],cdatatype );
+		}
+		      
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot insert atomic data element.\n");
+		  H5Epush(__FILE__, "HE5_PTreadlevel", 
+			  __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+	    }
+	}
+    }
+
+  /* Release pointers to the name buffers */
+  /* ------------------------------------ */
+  for (i = 0; i < dtsinfo.nfields; i++)
+    {
+      if (dtsinfo.fieldname[i] != NULL) 
+	free(dtsinfo.fieldname[i]);
+    }
+
+  /* Read out the level fields */
+  /* ------------------------- */
+  status = H5Dread(dataID, typeID, H5S_ALL, H5S_ALL, xfer_list, datbuf);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot read the level dataset. \n");
+      H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+  /* Release the property list ID */
+  /* ---------------------------- */
+  status = H5Pclose(xfer_list);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the property list ID. \n");
+      H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Release the datatype ID */
+  /* ----------------------- */
+  status = H5Tclose(typeID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the data type ID.\n");
+      H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTinqdatatype                                                |
+|                                                                             |
+|  DESCRIPTION: Inquires about datasets in Point                              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t               return status (0) SUCCEED, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID         hid_t                                                      |
+|  fieldname       char *                                                     |
+|  attrname        char *                                                     |
+|  fieldgroup      int                                                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dtype           hid_t                                                      |
+|  classID         H5T_class_t                                                |
+|  Order           H5T_order_t                                                |
+|  size            size_t                                                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 99   D.Wynne       Original Programmer                                 |
+|  Dec 99   A.Muslimov    Modified for Point interface.                       |
+|  May 00   A.Muslimov    Changed 'H5T_class_t' type to 'int' data type.      |
+|  Jun 00   A.Muslimov    Updated to include Group/Local Attributes options.  |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Oct  00  A.Muslimov    Added missing H5Tclose() calls and error handlings. |    
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_PTinqdatatype(hid_t pointID, const char *fieldname, const char *attrname, int fieldgroup, hid_t *dtype, H5T_class_t *classID, H5T_order_t *Order, size_t *size)
+{
+ 
+  herr_t      status    = FAIL;       /* return status variable */
+
+  hid_t       datasetid = FAIL;       /* dataset ID             */
+  hid_t       fid       = FAIL;       /* HDF-EOS file ID        */
+  hid_t       gid       = FAIL;       /* "POINTS" group ID      */
+  hid_t       attr      = FAIL;       /* attribute ID           */
+  hid_t       fldgroup  = FAIL;       /* "field group" flag     */
+
+  long        idx       = FAIL;       /* Point index            */
+
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+
+  /* Check for valid point id */
+  /* ======================== */
+  status = HE5_PTchkptid(pointID, "HE5_PTinqdatatype", &fid, &gid, &idx);
+  if(status == SUCCEED)
+    {
+      if(fieldgroup == HE5_HDFE_DATAGROUP)
+	fldgroup = HE5_PTXPoint[idx].data_id;
+      else if(fieldgroup == HE5_HDFE_ATTRGROUP)
+	fldgroup = HE5_PTXPoint[idx].pt_id;
+      else if(fieldgroup == HE5_HDFE_GRPATTRGROUP)
+	fldgroup = HE5_PTXPoint[idx].data_id;
+      else if(fieldgroup == HE5_HDFE_LOCATTRGROUP)
+	fldgroup = HE5_PTXPoint[idx].data_id;
+      else
+	{
+	  sprintf(errbuf, "Group \"%d\" unknown.\n", fieldgroup);
+	  H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_FUNC, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Call HDF 5 routines */
+      /* =================== */
+      if(fieldgroup == HE5_HDFE_DATAGROUP)
+	{
+	  datasetid = H5Dopen(fldgroup, fieldname);
+	  if(datasetid == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the dataset \"%s\".\n", fieldname);
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  *dtype    = H5Dget_type(datasetid);
+	  if(*dtype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the datatype ID for \"%s\".\n", fieldname);
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  *classID  = H5Tget_class(*dtype);
+	  if(*classID == H5T_NO_CLASS)
+	    {
+	      sprintf(errbuf, "Cannot get the data type class ID for \"%s\".\n", fieldname);
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  if (*classID != H5T_COMPOUND)
+	    {
+	      *Order    = H5Tget_order(*dtype);
+	      if(*Order == H5T_ORDER_ERROR)
+		{
+		  sprintf(errbuf, "Cannot get the datatype byte order for \"%s\".\n", fieldname);
+		  H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+	    }
+		  
+	  if (*classID == H5T_STRING)
+	    {
+	      *size = 1;
+	    }
+	  else
+	    {
+	      *size     = H5Tget_size(*dtype);
+	      if(*size == 0)
+		{
+		  sprintf(errbuf, "Cannot get the datatype size for \"%s\".\n", fieldname);
+		  H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+	    }
+
+	  status    = H5Tclose(*dtype);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the datatype ID.\n");
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  status    = H5Dclose(datasetid);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID.\n");
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	}
+      else if(fieldgroup == HE5_HDFE_ATTRGROUP || fieldgroup == HE5_HDFE_GRPATTRGROUP)
+	{
+	  attr      = H5Aopen_name(fldgroup, attrname);
+	  if(attr == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the attribute \"%s\".\n", attrname);
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  *dtype    = H5Aget_type(attr);
+	  if(*dtype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the datatype ID for \"%s\".\n", attrname);
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  *classID  = H5Tget_class(*dtype);
+	  if(*classID == H5T_NO_CLASS)
+	    {
+	      sprintf(errbuf, "Cannot get the data type class ID for \"%s\".\n", attrname);
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  if (*classID != H5T_COMPOUND)
+	    {
+	      *Order    = H5Tget_order(*dtype);
+	      if(*Order == H5T_ORDER_ERROR)
+		{
+		  sprintf(errbuf, "Cannot get the datatype byte order for \"%s\".\n", attrname);
+		  H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+	    }
+
+	  if (*classID == H5T_STRING)
+	    {
+	      *size = 1;
+	    }
+	  else
+	    { 
+	      *size     = H5Tget_size(*dtype);
+	      if(*size == 0)
+		{
+		  sprintf(errbuf, "Cannot get the datatype size for \"%s\".\n", attrname);
+		  H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+	    }
+
+	  status    = H5Tclose(*dtype);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the datatype ID.\n");
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  status    = H5Aclose(attr);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the attribute dataset ID.\n");
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	}
+      else if(fieldgroup == HE5_HDFE_LOCATTRGROUP)
+	{
+	  datasetid = H5Dopen(fldgroup, fieldname);
+	  if(datasetid == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the dataset \"%s\".\n", fieldname);
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  attr      = H5Aopen_name(datasetid, attrname);
+	  if(attr == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the attribute \"%s\".\n", attrname);
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  *dtype    = H5Aget_type(attr);
+	  if(*dtype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the datatype ID for \"%s\".\n", attrname);
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  *classID  = H5Tget_class(*dtype);
+	  if(*classID == H5T_NO_CLASS)
+	    {
+	      sprintf(errbuf, "Cannot get the data type class ID for \"%s\".\n", attrname);
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  if (*classID != H5T_COMPOUND)
+	    {
+	      *Order    = H5Tget_order(*dtype);
+	      if(*Order == H5T_ORDER_ERROR)
+		{
+		  sprintf(errbuf, "Cannot get the datatype byte order for \"%s\".\n", attrname);
+		  H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+	    }
+		  
+	  if (*classID == H5T_STRING)
+	    {
+	      *size = 1;
+	    }
+	  else
+	    {
+	      *size     = H5Tget_size(*dtype);
+	      if(*size == 0)
+		{
+		  sprintf(errbuf, "Cannot get the datatype size for \"%s\".\n", attrname);
+		  H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+	    }
+
+	  status    = H5Tclose(*dtype);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the datatype ID.\n");
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  status    = H5Aclose(attr);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the attribute dataset ID.\n");
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  status    = H5Dclose(datasetid);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID.\n");
+	      H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	}
+    }
+
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTinqpoint                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns number and names of point structures in file          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nPoint         int                 Number of point structures in file      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  filename       char                HDF-EOS filename                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  pointlist      char                List of point names (comma-separated)   |
+|  strbufsize     long                Length of pointlist                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_PTinqpoint(const char *filename, char *pointlist, long *strbufsize)
+{
+  int           nPoint = FAIL;/* Number of point structures in file */
+
+  herr_t        status = FAIL;/* status variable                    */
+
+  CHECKPOINTER(filename);
+
+  /* Call EHinquire */
+  /* -------------- */
+  nPoint = (int)HE5_EHinquire(filename, "/HDFEOS/POINTS", pointlist, strbufsize);
+
+ COMPLETION:  
+  return (nPoint);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTattrinfo                                                   |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               attribute data type ID                  |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer    Description                                        |
+|  =======   ============  =================================================  |
+|  5/11/00   A.Muslimov    Changed 'H5T_class_t' type to 'int' data type.     |
+|  7.18.99   A.Muslimov    Unmasked hdf5 data types.                          |
+|  Feb 03    S.Zhao        Changed the type of 'ntype' from an H5T_class_t to |
+|                          an hid_t.                                          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_PTattrinfo(hid_t pointID, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t        status     = FAIL;/* routine return status variable */
+
+  hid_t         fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t         gid        = FAIL;/* POINTS group ID                */
+
+  long          idx        = FAIL;/* Point index                    */
+
+  CHECKPOINTER(attrname);
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get attribute group ID and call EHattrinfo */
+      status = HE5_EHattrinfo( HE5_PTXPoint[idx].pt_id, attrname, ntype, count);
+    }
+
+ COMPLETION:
+  return (status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTinqattrs                                                   |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in point struct    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  point ID       hid_t               point structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in point struct         |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_PTinqattrs(hid_t pointID, char *attrnames, long *strbufsize)
+{
+  long            nattr    = FAIL;/* Number of attributes (return)  */
+  long            idx      = FAIL;/* Point index                    */
+
+  herr_t          status   = FAIL;/* routine return status variable */
+
+  hid_t           gid      = FAIL;/* "POINTS" group ID              */
+  hid_t           fid      = FAIL;/* HDF-EOS file ID                */
+
+  char            *grpname = NULL;/* Group name string buffer       */
+
+  status = HE5_PTchkptid(pointID, "HE5_PTinqattrs", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      grpname = (char *) calloc( (strlen(HE5_PTXPoint[idx].ptname)+40), sizeof(char));
+      if( grpname == NULL)
+        {
+          H5Epush(__FILE__, "HE5_PTinqattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+          HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      strcpy(grpname,"/HDFEOS/POINTS/");
+      strcat(grpname, HE5_PTXPoint[idx].ptname);
+
+      /* search group with grpname for the number of attrs */
+      nattr = HE5_EHattrcat(fid,  grpname, attrnames, strbufsize);
+
+      free(grpname);
+    }
+
+  return (nattr);
+   
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTwritegrpattr                                               |
+|                                                                             |
+|  DESCRIPTION:   Writes/updates attribute associated with the "Data"  group  |
+|                     in a point.                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  attrname       char                attribute name                          |
+|  numtype        hid_t               attribute data type ID                  |
+|  count          hsize_t             Number of attribute elements            |
+|  wrcode         char                Read/Write Code "w/r"                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf                                                                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 00   A.Muslimov                                                        |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  09/13/01 A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_PTwritegrpattr(hid_t pointID, const char *attrname, hid_t numtype, hsize_t count[],void *datbuf)
+{
+  herr_t     status     = FAIL;/* routine return status variable */
+
+  hid_t      fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid        = FAIL;/* HDFEOS group ID                */
+  hid_t      DataGrpID  = FAIL;/* "Data" group ID                */
+
+  long       idx        = FAIL;/* Point index                    */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+  hid_t      ntype;
+
+  HE5_LOCK;
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+
+  /* 
+     if numtype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use numtype itself
+  */
+  ntype = HE5_EHconvdatatype(numtype);
+  if(ntype == FAIL)
+    {
+      ntype = numtype;
+    }
+
+  /* Check Point ID */
+  /* -------------- */
+  status = HE5_PTchkptid(pointID, "HE5_PTwritegrpattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      DataGrpID = H5Gopen(HE5_PTXPoint[idx].pt_id, "Data");
+      if(DataGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PTwritegrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+        }
+
+      /* Perform Attribute I/O */
+      /* --------------------- */
+      status = HE5_EHattr(DataGrpID, attrname, ntype, count,"w", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write Attribute \"%s\"to the \"Data\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_PTwritegrpattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }
+
+      status = H5Gclose(DataGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PTwritegrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }	
+
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTreadgrpattr                                                |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with the "Data" group from a point.|
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 00   A.Muslimov                                                        |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  09/13/01 A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_PTreadgrpattr(hid_t pointID, const char *attrname, void *datbuf)
+{
+  herr_t      status    = FAIL;/* routine return status variable */
+
+  hid_t       fid       = FAIL;/* HDF-EOS file ID                */
+  hid_t       ntype     = FAIL;/* Data type ID                   */
+  hid_t       gid       = FAIL;/* POINTS group ID                */
+  hid_t       DataGrpID = FAIL;/* "Data" group ID                */
+
+  hsize_t     count[]   = {0}; /* Number of attribute elements   */
+
+  long        idx       = FAIL;/* Point index                    */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  HE5_LOCK;
+  CHECKPOINTER(attrname);
+
+  /* Check Point ID */
+  /* -------------- */
+  status = HE5_PTchkptid(pointID, "HE5_PTreadgrpattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get "Data"  group ID */
+      /* -------------------- */
+      DataGrpID = H5Gopen(HE5_PTXPoint[idx].pt_id, "Data");
+      if(DataGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PTreadgrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+        }
+
+      /* Call EHattr to perform I/O  */
+      /* --------------------------- */
+      status = HE5_EHattr(DataGrpID, attrname, ntype, count, "r", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot read Attribute \"%s\" from the \"Data\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_PTreadgrpattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }
+
+      status = H5Gclose(DataGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PTreadgrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTgrpattrinfo                                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves information about attributes in "Data" group.      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               attribute data type ID                  |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 00   A.Muslimov                                                        |
+|  May 00   A.Muslimov    Changed 'H5T_class_t' type to 'int' data type.      |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Feb 03   S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_PTgrpattrinfo(hid_t pointID, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t     status     = FAIL;/* routine return status variable */
+
+  hid_t      fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid        = FAIL;/* HDFEOS group ID                */
+  hid_t      DataGrpID  = FAIL;/* "Data" group ID                */
+
+  long       idx        = FAIL;/* Point index                    */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  CHECKPOINTER(attrname);
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTgrpattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get "Data"  group ID  */
+      /* --------------------- */
+      DataGrpID = H5Gopen(HE5_PTXPoint[idx].pt_id, "Data");
+      if(DataGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PTgrpattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Call HE5_EHattrinfo */
+      /* ------------------- */
+      status = HE5_EHattrinfo(DataGrpID, attrname, ntype, count);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"Data\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_PTgrpattrinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      status = H5Gclose(DataGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PTgrpattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+
+
+    }
+
+ COMPLETION:
+  return (status);
+
+}
+
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTinqgrpattrs                                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list in "Data" group                               |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in point struct    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  point ID       hid_t               point structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in point struct         |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 00   A.Muslimov                                                        |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_PTinqgrpattrs(hid_t pointID, char *attrnames, long *strbufsize)
+{
+  long       nattr      = FAIL;/* Number of attributes (return)  */
+  long       idx        = FAIL;/* Point index                    */
+
+  herr_t     status     = FAIL;/* routine return status variable */
+
+  hid_t      fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid        = FAIL;/* HDFEOS group ID                */
+
+  char       *grpname   = NULL;/* Buffer for a group name        */
+
+  status = HE5_PTchkptid(pointID, "HE5_PTinqgrpattrs", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      grpname = (char *) calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char));
+      if( grpname == NULL)
+        {
+          H5Epush(__FILE__, "HE5_PTinqgrpattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+          HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      strcpy(grpname,"/HDFEOS/POINTS/");
+      strcat(grpname, HE5_PTXPoint[idx].ptname);
+      strcat(grpname,"/Data");
+	
+
+      /* search group with grpname for the number of attrs */
+      /* ------------------------------------------------- */
+      nattr = HE5_EHattrcat(fid,  grpname, attrnames, strbufsize);
+
+      free(grpname);
+    }
+
+  return (nattr);
+   
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTwritelocattr                                               |
+|                                                                             |
+|  DESCRIPTION:   Writes/updates attribute associated with the a specified    |
+|                   level in a point.                                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  levelname      char                level name                              |
+|  attrname       char                attribute name                          |
+|  numtype        hid_t               attribute data type ID                  |
+|  count          hsize_t             Number of attribute elements            |
+|  wrcode         char                Read/Write Code "w/r"                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf                                                                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 00   A.Muslimov                                                        |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  09/13/01 A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_PTwritelocattr(hid_t pointID, const char *levelname, const char *attrname, hid_t numtype, hsize_t count[],void *datbuf)
+{
+  herr_t     status     = FAIL;/* routine return status variable */
+
+  hid_t      fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid        = FAIL;/* HDFEOS group ID                */
+  hid_t      DataGrpID  = FAIL;/* "Data" group ID                */
+  hid_t      levelID    = FAIL;/* Level-related dataset ID       */
+
+  long       idx        = FAIL;/* Point index                    */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+  hid_t      ntype;
+
+  HE5_LOCK;
+  CHECKPOINTER(levelname);
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+
+  /* 
+     if numtype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use ntype itself
+  */
+  ntype = HE5_EHconvdatatype(numtype);
+  if(ntype == FAIL)
+    {
+      ntype = numtype;
+    }
+
+  /* Check Point ID */
+  /* -------------- */
+  status = HE5_PTchkptid(pointID, "HE5_PTwritelocattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      DataGrpID = H5Gopen(HE5_PTXPoint[idx].pt_id, "Data");
+      if(DataGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PTwritelocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+        }
+
+      /* Get level ID  */
+      /* ------------- */
+      levelID = H5Dopen(DataGrpID, levelname);
+      if(levelID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" level dataset ID.\n", levelname);
+	  H5Epush(__FILE__, "HE5_PTwritelocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+        }
+	
+
+      /* Perform Attribute I/O */
+      /* --------------------- */
+      status = HE5_EHattr(levelID, attrname, ntype, count,"w", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write Attribute \"%s\"to the \"%s\" level.\n", attrname,levelname);
+	  H5Epush(__FILE__, "HE5_PTwritelocattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }
+
+      status = H5Dclose(levelID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" level dataset ID.\n", levelname);
+	  H5Epush(__FILE__, "HE5_PTwritelocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }
+
+      status = H5Gclose(DataGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PTwritelocattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }	
+
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTreadlocattr                                                |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with a specified level in a point. |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  levelname      char                level name                              |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 00   A.Muslimov                                                        |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  09/13/01 A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_PTreadlocattr(hid_t pointID, const char *levelname, const char *attrname, void *datbuf)
+{
+  herr_t     status     = FAIL;/* routine return status variable */
+
+  hid_t      fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t      ntype      = FAIL;/* Data type ID                   */
+  hid_t      gid        = FAIL;/* POINTS group ID                */
+  hid_t      DataGrpID  = FAIL;/* "Data" group ID                */
+  hid_t      levelID    = FAIL;/* Level-related dataset ID       */
+
+  hsize_t     count[]   = {0}; /* Number of attribute elements   */
+
+  long        idx       = FAIL;/* Point index                    */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  HE5_LOCK;
+  CHECKPOINTER(levelname);
+  CHECKPOINTER(attrname);
+
+  /* Check Point ID */
+  /* -------------- */
+  status = HE5_PTchkptid(pointID, "HE5_PTreadlocattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get "Data"  group ID */
+      /* -------------------- */
+      DataGrpID = H5Gopen(HE5_PTXPoint[idx].pt_id, "Data");
+      if(DataGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PTreadlocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+        }
+
+      /* Get level ID  */
+      /* ------------- */
+      levelID = H5Dopen(DataGrpID, levelname);
+      if(levelID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" level dataset ID.\n", levelname);
+	  H5Epush(__FILE__, "HE5_PTreadlocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Call EHattr to perform I/O  */
+      /* --------------------------- */
+      status = HE5_EHattr(levelID, attrname, ntype, count, "r", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot read Attribute \"%s\" from the \"%s\" level.\n", attrname, levelname);
+	  H5Epush(__FILE__, "HE5_PTreadlocattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }
+
+      status = H5Dclose(levelID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" level dataset ID.\n", levelname);
+	  H5Epush(__FILE__, "HE5_PTreadlocattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }	
+
+      status = H5Gclose(DataGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PTreadlocattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTlocattrinfo                                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves information about attributes in associated with a  |
+|                 specified level in a point.                                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  levelname      char                level name                              |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               attribute data type ID                  |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 00   A.Muslimov                                                        |
+|  May 00   A.Muslimov    Changed 'H5T_class_t' type to 'int' data type.      |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Feb 03   S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_PTlocattrinfo(hid_t pointID, const char *levelname, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t     status     = FAIL;/* routine return status variable */
+
+  hid_t      fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid        = FAIL;/* HDFEOS group ID                */
+  hid_t      DataGrpID  = FAIL;/* "Data" group ID                */
+  hid_t      levelID    = FAIL;/* Level-related dataset ID       */
+
+  long       idx        = FAIL;/* Point index                    */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  CHECKPOINTER(levelname);
+  CHECKPOINTER(attrname);
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTlocattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get "Data"  group ID  */
+      /* --------------------- */
+      DataGrpID = H5Gopen(HE5_PTXPoint[idx].pt_id, "Data");
+      if(DataGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PTlocattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      /* Get level ID  */
+      /* ------------- */
+      levelID = H5Dopen(DataGrpID, levelname);
+      if(levelID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" level dataset ID.\n", levelname);
+	  H5Epush(__FILE__, "HE5_PTlocattrinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Call EHattrinfo */
+      /* --------------- */
+      status = HE5_EHattrinfo(levelID, attrname, ntype, count);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"%s\" level.\n", attrname,levelname);
+	  H5Epush(__FILE__, "HE5_PTlocattrinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      status = H5Dclose(levelID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" level dataset ID.\n", levelname);
+	  H5Epush(__FILE__, "HE5_PTlocattrinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }	
+
+      status = H5Gclose(DataGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PTlocattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+    }
+
+ COMPLETION:
+  return (status); 
+}
+
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTinqlocattrs                                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list from a specified level in a point.            |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in a level         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  point ID       hid_t               point structure ID                      |
+|  levelname      char                level name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in a level              |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 00   A.Muslimov                                                        |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_PTinqlocattrs(hid_t pointID, const char *levelname, char *attrnames, long *strbufsize)
+{
+  long       nattr      = FAIL;/* Number of attributes (return)  */
+  long       idx        = FAIL;/* Point index                    */
+
+  herr_t     status     = FAIL;/* routine return status variable */
+
+  hid_t      fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid        = FAIL;/* HDFEOS group ID                */
+
+  char       *dtsname   = NULL;/* Buffer for a dataset name      */
+
+  CHECKPOINTER(levelname);
+
+  status = HE5_PTchkptid(pointID, "HE5_PTinqlocattrs", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      dtsname = (char *) calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char));
+      if( dtsname == NULL)
+        {
+          H5Epush(__FILE__, "HE5_PTinqlocattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+          HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      strcpy(dtsname,"/HDFEOS/POINTS/");
+      strcat(dtsname, HE5_PTXPoint[idx].ptname);
+      strcat(dtsname,"/Data/");
+      strcat(dtsname,levelname);
+	
+
+      /* search group with grpname for the number of attrs */
+      /* ------------------------------------------------- */
+      nattr = HE5_EHattrcat(fid, dtsname, attrnames, strbufsize);
+
+      free(dtsname);
+    }
+
+ COMPLETION:
+  return (nattr);
+   
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTlinkinfo                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns ("bck/fwd") linkage info                              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|  mode           char                mode ("+/-")                            |
+|  linkfield      char                linkage field                           |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/26/99  A.Muslimov    Changed the return type from intn to int   .        |
+|  12/13/99 A.Muslimov    Added proper error handlings after the function     |
+|                         calls. Added a call to PTchkptid(), and replaced    |
+|                         the parameter "gid" by "fid" in the call to         |
+|                         EHmetagroup().                                      |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_PTlinkinfo(hid_t pointID, hid_t gid,  int level, char *mode, char *linkfield)
+{
+  herr_t          status   = FAIL;            /* Return status variable   */
+
+  hid_t           fid      = FAIL;            /* HDF-EOS file ID          */
+  hid_t           pID      = FAIL;            /* Point ID - offset        */
+  hid_t           idOffset = HE5_PTIDOFFSET;  /* Point ID offset          */
+
+  long 	          idx      = FAIL;            /* Point index              */
+ 
+  char            *metabuf = NULL;	      /* Pointer to SM            */
+  char            *metaptrs[2]={NULL,NULL};   /* Ptrs to begin/end of SM  */
+  char            name1[HE5_HDFE_NAMBUFSIZE]; /* Name string 1            */
+  char            name2[HE5_HDFE_NAMBUFSIZE]; /* Name string 2            */
+  char            utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer           */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error messg buffer       */
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTfwdlinkinfo", &fid, &gid, &idx);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Checking for point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTfwdlinkinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  /* Compute "reduced" point ID */
+  /* -------------------------- */
+  pID = pointID % idOffset;
+
+  /* Get level link structural metadata */
+  /* ---------------------------------- */
+  metabuf = (char *)HE5_EHmetagroup(fid, HE5_PTXPoint[pID].ptname, "p","LevelLink", metaptrs);
+  if (metabuf == NULL )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot get pointer to metadata buffer for the \"%s\" point. \n", HE5_PTXPoint[pID].ptname);
+      H5Epush(__FILE__, "HE5_PTfwdlinkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  if (strcmp(mode, "-") == 0)
+    {
+      /* If back link get names of previous & current levels */
+      /* --------------------------------------------------- */
+      strcpy(name1, HE5_PTXPoint[pID].level[level - 1].name);
+      strcpy(name2, HE5_PTXPoint[pID].level[level].name);
+    }
+  else
+    {
+      /* If fwd link get names of current & following levels */
+      /* --------------------------------------------------- */
+      strcpy(name1, HE5_PTXPoint[pID].level[level].name);
+      strcpy(name2, HE5_PTXPoint[pID].level[level+1].name);
+    }
+
+
+  /* Search for parent name entry */
+  /* ---------------------------- */
+  sprintf(utlbuf, "%s%s", "\t\t\t\tParent=\"", name1);
+  metaptrs[0] = strstr(metaptrs[0], utlbuf);
+
+
+  /* If name found within linkage metadata ... */
+  /* ----------------------------------------- */
+  if (metaptrs[0] < metaptrs[1] || metaptrs[0] == NULL)
+    {
+      /* Get Linkage Field */
+      /* ----------------- */
+      status = HE5_EHgetmetavalue(metaptrs, "LinkField", linkfield);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get \"LinkField\" metavalue for the \"%s\" point. \n", HE5_PTXPoint[pID].ptname);
+	  H5Epush(__FILE__, "HE5_PTfwdlinkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(metabuf);
+	  return(status);
+	}
+
+      /* Remove double quotes */
+      /* -------------------- */
+      memmove(linkfield, linkfield + 1, strlen(linkfield) - 2);
+      linkfield[strlen(linkfield) - 2] = 0;
+    }
+  else
+    {
+      /* If not found return error status */
+      /* -------------------------------- */
+      status = FAIL;
+    }
+
+
+  free(metabuf);
+
+  return(status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTbcklinkinfo                                                |
+|                                                                             |
+|  DESCRIPTION: Returns link field to previous level.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|  linkfield      char                linkage field                           |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_PTbcklinkinfo(hid_t pointID, int level, char *linkfield)
+{
+  herr_t        status  = SUCCEED;/* routine return status variable */
+
+  hid_t         fid     = FAIL;   /* HDF-EOS file ID                */
+  hid_t   	    gid     = FAIL;   /* "POINTS" group ID              */
+
+  long    	    idx     = FAIL;   /* Point index                    */
+
+  char          *mess = "No Back Linkage Defined between levels: %d and %d.\n";
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */
+
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTfwdlinkinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Check that level is within bounds for backlink info */
+      if (level > 0 && level < HE5_PTnlevels(pointID))
+	{
+	  status = HE5_PTlinkinfo(pointID, gid, level, "-", linkfield);
+	  if (status == FAIL)
+	    {
+	      sprintf( errbuf, mess, level, level - 1);
+	      H5Epush(__FILE__, "HE5_PTbcklinkinfo", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+	}
+      else
+	{
+	  status = FAIL;
+	  sprintf( errbuf, mess, level, level - 1);
+	  H5Epush(__FILE__, "HE5_PTbcklinkinfo", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+        
+    }
+
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTfwdlinkinfo                                                |
+|                                                                             |
+|  DESCRIPTION: Returns link field to following level.                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|  linkfield      char                linkage field                           |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_PTfwdlinkinfo(hid_t pointID, int level, char *linkfield)
+{
+  herr_t         status  = SUCCEED;/* routine return status variable  */
+  
+  hid_t          fid     = FAIL;   /* HDF-EOS file id                 */
+  hid_t          gid     = FAIL;   /* "POINTS" group ID               */
+  
+  long           idx     = FAIL;   /* Point index                     */
+  
+  char           *mess = "No Forward Linkage Defined between levels: %d and %d.\n";
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer  */
+  
+  
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTfwdlinkinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Check that level is within bounds for fwdlink info */
+      if (level >= 0 && level < HE5_PTnlevels(pointID) - 1)
+	{
+	  status = HE5_PTlinkinfo(pointID, gid, level, "+", linkfield);
+	  if (status == FAIL)
+	    {
+	      sprintf( errbuf, mess, level, level + 1);
+	      H5Epush(__FILE__, "HE5_PTfwdlinkinfo", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);			  
+	    }
+	}
+      else
+	{
+	  status = FAIL;
+	  sprintf( errbuf, mess, level, level + 1);
+	  H5Epush(__FILE__, "HE5_PTfwdlinkinfo", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+  
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTlevelindx                                                  |
+|                                                                             |
+|  DESCRIPTION: Returns index number for a named level.                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  n              int                 Level number (0 - based)                |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  levelname      char                point level name                        |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_PTlevelindx(hid_t pointID, const char *levelname)
+{
+  int             level   = FAIL;/* Level corresponding to levelname (RETURN) */
+  int             nlevels = FAIL;/* Number of levels in point                 */
+
+  herr_t          status  = FAIL;/* routine return status variable            */
+
+  hid_t           fid     = FAIL;/* HDF-EOS file ID                           */
+  hid_t    	      gid     = FAIL;/* "POINTS" group ID                         */
+
+  long     	      idx     = FAIL;/* Point index                               */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer         */ 
+
+  CHECKPOINTER(levelname);
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTlevelindx", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get number of levels */
+      /* -------------------- */
+      nlevels = HE5_PTnlevels(pointID);
+      if(nlevels == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the number of levels in point.\n");
+	  H5Epush(__FILE__, "HE5_PTlevelindx", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      else if(nlevels == 0)
+	{
+	  sprintf(errbuf, "There are no levels in point.\n");
+	  H5Epush(__FILE__, "HE5_PTlevelindx", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      else 
+	{
+
+	  /* Loop through all levels in point */
+	  /* -------------------------------- */
+	  for (level = 0; level < nlevels; level++)
+	    {
+	      /* If it matches input levelname then exit loop */
+	      /* -------------------------------------------- */
+	      if (strcmp(HE5_PTXPoint[ idx ].level[ level ].name, levelname) == 0)
+		break;
+	    }
+	}
+	  
+    }
+  
+  /* Levelname not found so set error status */
+  /* --------------------------------------- */
+  if (level == nlevels)
+    level = FAIL;
+
+ COMPLETION:
+  return(level);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTwrbckptr                                                   |
+|                                                                             |
+|  DESCRIPTION: Writes back pointer records                                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level index (0 - based)                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Nov 00   A.Muslimov    Changed the interface.                              |
+|  Mar 00   A.Muslimov    Modified to reflect changes in HDF5 library:        |
+|                         H5Tinsert_array should be replaced by two calls     |
+|                         H5Tarray_create() and H5Tinsert().                  |
+|  Sep 04   S.Zhao        Changed "long long" to "LONGLONG" for Windows.      |
+|  Feb 06   Abe Taaheri   Support for STRING fields,                          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+  ----------------------------------------------------------------------------*/
+static herr_t   
+HE5_PTwrbckptr(hid_t pointID, int level)
+{
+  herr_t          status   = FAIL;/* routine return status variable           */
+
+  int             TypeFlag = FAIL;/* Data type Flag                           */
+  int             k;              /* Loop index                               */
+
+  hid_t           fid      = FAIL;/* HDF-EOS file ID                          */
+  hid_t           gid      = FAIL;/* "POINTS" group ID                        */
+  hid_t           link_id  = FAIL;/* "Linkage" group ID                       */
+  hid_t           bckid    = FAIL;/* "BACKPOINTER" dataset ID                 */
+  hid_t           typeID   = FAIL;/* Data type ID                             */
+  hid_t           tid      = FAIL;/* Data type ID                             */
+  hid_t           fldtype  = FAIL;/* Field data type ID                       */
+  hid_t           xfer_list= FAIL;/* Property list  ID                        */
+  hid_t           dataID_curr = FAIL;/* current level dataset ID              */
+  hid_t           dataID_prev = FAIL;/* previous level dataset ID             */
+  hid_t           arr_id      = FAIL;/* Array datatype ID                     */ 
+
+  size_t          datasize = 0;   /* Input data size parameter                */
+
+  long            idx      = FAIL;/* Point index                              */
+  LONGLONG        j;		  /* Loop indices                             */
+
+  hsize_t         count[1] = {0}; /* Number of elements to write              */
+  hsize_t         nrecPrev = 0;   /* Number of records in previous level      */
+  hsize_t         nrecCurr = 0;	  /* Number of records in current level       */
+  hsize_t         dims[HE5_DTSETRANKMAX];/* Data member dimension             */
+
+  char            utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer               */
+  char            *mess = "No Linkage Defined between levels: %d and %d.\n";
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* buffer for error message     */
+
+  bckptr          *bck = (bckptr *)NULL;/* struct to write bckpointer data to */
+
+  HE5_CmpDTSinfo  currLevel;      /* structure for current level information  */
+
+  /*         Data buffers      */
+  /* ------------------------- */
+
+  int             *intFldCurr;
+  int             *intFldPrev;
+
+  float           *fltFldCurr;
+  float           *fltFldPrev;
+
+  double          *dblFldCurr;
+  double          *dblFldPrev;
+
+  long            *lngFldCurr;
+  long            *lngFldPrev;
+
+  char            *chrFldCurr;
+  char            *chrFldPrev;
+  int              string_size;
+  hid_t            cdatatype = FAIL;   
+  hid_t            fldnumtype;
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTwrbckptr", &fid, &gid, &idx);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Checking for point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  /* Check the level number */
+  /* ---------------------- */
+  if (level <= 0)
+    {
+      sprintf(errbuf, "Passed wrong level number. Level should be > 0. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get Back-Linkage Field (copy into utlbuf) */
+  /* ----------------------------------------- */
+  status = HE5_PTbcklinkinfo(pointID, level, utlbuf);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, mess, level, level - 1);
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  /* Get number of fields in Current level */
+  /* ------------------------------------- */
+  status = HE5_PTlevelinfo(pointID, level, &currLevel);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot get information about current level. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for (k = 0; k < HE5_DTSETRANKMAX; k++)
+    dims[ k ] = 0;
+
+
+  /* Get current level dataset ID */
+  /* ---------------------------- */
+  dataID_curr = HE5_PTXPoint[idx].level[level].ID;
+
+  /* Get the field data type and number of elements (for char ) */
+  /* ---------------------------------------------------------- */
+  for (k = 0; k < currLevel.nfields; k++)
+    {
+      if (memcmp(currLevel.fieldname[k], utlbuf, strlen(utlbuf)) == 0)
+	{
+	  fldtype = currLevel.dtype[k];
+	  fldnumtype = currLevel.numtype[k];
+	  dims[0] = (hsize_t)(currLevel.dims[k][0]);
+
+	  if(currLevel.dclass[k] == H5T_STRING)
+	    {
+	      TypeFlag = 5;
+	      string_size = HE5_PTgetdtypesize(dataID_curr, k);
+	      if (string_size == FAIL)
+		{
+		  sprintf(errbuf,"Cannot get member datatype size.\n");
+		  H5Epush(__FILE__, "HE5_PTwrbckptr", 
+			  __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+	    }
+	  else
+	    {
+	      cdatatype = HE5_EHconvdatatype(currLevel.numtype[k]);
+	      /* 
+		 if numtype is HE5 numbertype, rather than H5 numbertype, 
+		 then convert it, otherwise use numtype itself
+	      */
+	      if(cdatatype == FAIL)
+		{
+		  cdatatype = currLevel.numtype[k];
+		}
+	      if(H5Tequal(cdatatype, H5T_NATIVE_INT))
+		TypeFlag = 1;
+	      else if(H5Tequal(cdatatype, H5T_NATIVE_LONG))
+		TypeFlag = 2;
+	      else if(H5Tequal(cdatatype, H5T_NATIVE_FLOAT))
+		TypeFlag = 3;
+	      else if(H5Tequal(cdatatype, H5T_NATIVE_DOUBLE))
+		TypeFlag = 4;
+	      else if(H5Tequal(cdatatype, H5T_NATIVE_CHAR))
+		TypeFlag = 0;
+	    }
+	}
+
+      /* Deallocate memory */
+      /* ----------------- */
+      if (currLevel.fieldname[k] != NULL) 
+	free(currLevel.fieldname[k]);
+    }
+
+  
+  /* Get number of records in current level */
+  /* -------------------------------------- */
+  nrecCurr = HE5_PTnrecs(pointID,level);
+  if (nrecCurr == 0)
+    {
+      sprintf(errbuf, "No records in current level. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get number of records in previous level */
+  /* --------------------------------------- */
+  nrecPrev = HE5_PTnrecs(pointID,level-1);
+  if (nrecPrev == 0)
+    {
+      sprintf(errbuf, "No records in previous level. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate memory for bckpointer dataset */
+  /* -------------------------------------- */
+  bck = (bckptr *)calloc(nrecCurr, sizeof(bckptr));
+  if (bck == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Get previous level dataset ID */
+  /* ----------------------------- */
+  dataID_prev = HE5_PTXPoint[idx].level[level-1].ID;
+
+
+  /* Get ID of Linkage group  */
+  /* ------------------------ */
+  link_id = HE5_PTXPoint[idx].link_id;
+
+  /* Get data buffer containing link field records in current level */
+  /* -------------------------------------------------------------- */  
+  switch (TypeFlag)
+    {
+
+    case 5: /* string type field */
+      {
+	datasize = (size_t)(dims[0] * sizeof(char));
+	chrFldCurr = (char *)calloc(nrecCurr, string_size);
+	if (chrFldCurr == NULL)
+	  {
+	    sprintf(errbuf, "Cannot allocate memory. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    return(FAIL);
+	  }
+
+	chrFldPrev = (char *)calloc(nrecPrev, string_size);
+	if (chrFldPrev == NULL)
+	  {
+	    sprintf(errbuf, "Cannot allocate memory. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(chrFldCurr);
+	    free(bck);
+	    return(FAIL);
+	  }
+
+	/* Create Compound datatype */
+	/* ------------------------ */
+	tid    = H5Tcreate(H5T_COMPOUND, string_size);
+	if (tid == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot create Compound datatype. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(chrFldCurr);
+	    free(chrFldPrev);
+	    free(bck);
+	    return(FAIL);
+	  }
+
+	/* Create array datatype */
+	/* --------------------- */
+	arr_id = H5Tcopy(H5T_C_S1);
+	if (arr_id == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot create array data type. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(chrFldCurr);
+	    free(chrFldPrev);
+	    return(FAIL);
+	  }
+
+	H5Tset_size(arr_id,string_size);
+	H5Tset_strpad(arr_id, H5T_STR_NULLPAD);
+
+	/* Add array field */
+	/* --------------- */
+	status = H5Tinsert(tid, utlbuf, 0, arr_id);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot add array data field. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(chrFldCurr);
+	    free(chrFldPrev);
+	    return(FAIL);
+	  }
+		  
+	/* Read the link field data from Current level */
+	/* ------------------------------------------- */
+	status = H5Dread(dataID_curr, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, chrFldCurr);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot read link field from current level. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(chrFldCurr);
+	    free(chrFldPrev);
+	    return(FAIL);
+	  }
+		
+	/* Read the link field data from Previous level */
+	/* -------------------------------------------- */
+	status = H5Dread(dataID_prev, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, chrFldPrev);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot read link field from previous level. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(chrFldCurr);
+	    free(chrFldPrev);
+	    return(FAIL);
+	  }
+
+	/* Release datatype ID  */
+	/* -------------------- */
+	status = H5Tclose(arr_id);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot release the array datatype ID. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(chrFldCurr);
+	    free(chrFldPrev);
+	    return(FAIL);
+	  }
+		
+		
+	/* Loop through input records */
+	/* -------------------------- */
+	for (k = 0; k < nrecCurr; k++){
+	  for (j = 0; j < nrecPrev; j++){
+	    if (strcmp((chrFldCurr + (k*string_size)), 
+		       (chrFldPrev + (j*string_size))) == 0)
+	      {
+		bck[k].back = j;
+		break;
+	      }
+	  }
+	}
+
+	free(chrFldCurr);
+	free(chrFldPrev);
+      }
+
+      break;
+
+    case 0:
+      {
+	datasize = (size_t)(dims[0] * sizeof(char));
+
+	chrFldCurr = (char *)calloc(nrecCurr, datasize);
+	if (chrFldCurr == NULL)
+	  {
+	    sprintf(errbuf, "Cannot allocate memory. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    return(FAIL);
+	  }
+
+	chrFldPrev = (char *)calloc(nrecPrev, datasize);
+	if (chrFldPrev == NULL)
+	  {
+	    sprintf(errbuf, "Cannot allocate memory. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(chrFldCurr);
+	    free(bck);
+	    return(FAIL);
+	  }
+
+	/* Create Compound datatype */
+	/* ------------------------ */
+	tid    = H5Tcreate(H5T_COMPOUND, datasize);
+	if (tid == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot create Compound datatype. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(chrFldCurr);
+	    free(chrFldPrev);
+	    free(bck);
+	    return(FAIL);
+	  }
+
+	/* Create array datatype */
+	/* --------------------- */
+	/*arr_id = H5Tarray_create(HE5_EHdtype2mtype(fldtype), 1, dims, NULL);*/
+	cdatatype = HE5_EHconvdatatype(fldnumtype);
+	/* 
+	   if fldnumtype is HE5 numbertype, rather than H5 numbertype, 
+	   then convert it, otherwise use fldnumtype itself
+	*/
+	if(cdatatype == FAIL)
+	  {
+	    cdatatype = fldnumtype;
+	  }
+	arr_id = H5Tarray_create(cdatatype, 1, dims, NULL);
+		
+	if (arr_id == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot create array data type. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(chrFldCurr);
+	    free(chrFldPrev);
+	    return(FAIL);
+	  }
+
+	/* Add array field */
+	/* --------------- */
+	status = H5Tinsert(tid, utlbuf, 0, arr_id);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot add array data field. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(chrFldCurr);
+	    free(chrFldPrev);
+	    return(FAIL);
+	  }
+		  
+	/* Read the link field data from Current level */
+	/* ------------------------------------------- */
+	status = H5Dread(dataID_curr, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, chrFldCurr);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot read link field from current level. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(chrFldCurr);
+	    free(chrFldPrev);
+	    return(FAIL);
+	  }
+		
+	/* Read the link field data from Previous level */
+	/* -------------------------------------------- */
+	status = H5Dread(dataID_prev, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, chrFldPrev);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot read link field from previous level. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(chrFldCurr);
+	    free(chrFldPrev);
+	    return(FAIL);
+	  }
+
+	/* Release datatype ID  */
+	/* -------------------- */
+	status = H5Tclose(arr_id);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot release the array datatype ID. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(chrFldCurr);
+	    free(chrFldPrev);
+	    return(FAIL);
+	  }
+		
+		
+	/* Loop through input records */
+	/* -------------------------- */
+	for (k = 0; k < nrecCurr; k++){
+	  for (j = 0; j < nrecPrev; j++){
+	    if (memcmp(chrFldCurr+k*datasize, chrFldPrev+j*datasize, dims[0]) == 0)
+	      {
+		bck[k].back = j;
+		break;
+	      }
+	  }
+	}
+		
+	free(chrFldCurr);
+	free(chrFldPrev);
+      }
+
+      break;
+
+    case 1:
+
+      {
+	intFldCurr = (int *)calloc(nrecCurr, sizeof(int));
+	intFldPrev = (int *)calloc(nrecPrev, sizeof(int));
+	  
+	/* Create Compound datatype */
+	/* ------------------------ */
+	tid    = H5Tcreate(H5T_COMPOUND, sizeof(int));
+	if (tid == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot create Compound datatype. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(intFldCurr);
+	    free(intFldPrev);
+	    free(bck);
+	    return(FAIL);
+	  }
+
+	/* Insert data member */
+	/* ------------------ */
+	status = H5Tinsert(tid, utlbuf, 0, HE5_EHdtype2mtype(fldtype));
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot insert data member. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(intFldCurr);
+	    free(intFldPrev);
+	    return(FAIL);
+	  }
+		  
+	/* Read the link field data from Current level */
+	/* ------------------------------------------- */
+	status = H5Dread(dataID_curr, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, intFldCurr);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot read link field from current level. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(intFldCurr);
+	    free(intFldPrev);
+	    return(FAIL);
+	  }
+		
+	/* Read the link field data from Previous level */
+	/* -------------------------------------------- */
+	status = H5Dread(dataID_prev, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, intFldPrev);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot read link field from previous level. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(intFldCurr);
+	    free(intFldPrev);
+	    return(FAIL);
+	  }
+
+		
+	/* Loop through input records */
+	/* -------------------------- */
+	for (k = 0; k < nrecCurr; k++){
+	  for (j = 0; j < nrecPrev; j++){
+	    if (intFldCurr[k] == intFldPrev[j])
+	      {
+		bck[k].back = j;
+		break;
+	      }
+	  }
+	}  
+	free(intFldCurr);
+	free(intFldPrev);	  
+      }  
+
+      break;
+
+    case 2:
+
+      {
+	lngFldCurr = (long *)calloc(nrecCurr, sizeof(long));
+	lngFldPrev = (long *)calloc(nrecPrev, sizeof(long));
+
+	/* Create Compound datatype */
+	/* ------------------------ */
+	tid    = H5Tcreate(H5T_COMPOUND, sizeof(long));
+	if (tid == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot create Compound datatype. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(lngFldCurr);
+	    free(lngFldPrev);
+	    free(bck);
+	    return(FAIL);
+	  }
+
+	/* Insert data member */
+	/* ------------------ */
+	status = H5Tinsert(tid, utlbuf, 0, HE5_EHdtype2mtype(fldtype));
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot insert data member. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(lngFldCurr);
+	    free(lngFldPrev);
+	    return(FAIL);
+	  }
+		  
+	/* Read the link field data from Current level */
+	/* ------------------------------------------- */
+	status = H5Dread(dataID_curr, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, lngFldCurr);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot read link field from current level. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(lngFldCurr);
+	    free(lngFldPrev);
+	    return(FAIL);
+	  }
+		
+	/* Read the link field data from Previous level */
+	/* -------------------------------------------- */
+	status = H5Dread(dataID_prev, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, lngFldPrev);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot read link field from previous level. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(lngFldCurr);
+	    free(lngFldPrev);
+	    return(FAIL);
+	  }
+	  
+	  
+	/* Loop through input records */
+	/* -------------------------- */
+	for (k = 0; k < nrecCurr; k++){
+	  for (j = 0; j < nrecPrev; j++){
+	    if (lngFldCurr[k] == lngFldPrev[j])
+	      {
+		bck[k].back = j;
+		break;
+	      }
+	  }
+	}  
+	free(lngFldCurr);
+	free(lngFldPrev);	  
+      }  
+
+      break;
+
+    case 3:
+	  
+      {
+	fltFldCurr = (float *)calloc(nrecCurr, sizeof(float));
+	fltFldPrev = (float *)calloc(nrecPrev, sizeof(float));
+
+	/* Create Compound datatype */
+	/* ------------------------ */
+	tid    = H5Tcreate(H5T_COMPOUND, sizeof(float));
+	if (tid == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot create Compound datatype. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(fltFldCurr);
+	    free(fltFldPrev);
+	    free(bck);
+	    return(FAIL);
+	  }
+
+	/* Insert data member */
+	/* ------------------ */
+	status = H5Tinsert(tid, utlbuf, 0, HE5_EHdtype2mtype(fldtype));
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot insert data member. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(fltFldCurr);
+	    free(fltFldPrev);
+	    return(FAIL);
+	  }
+		  
+	/* Read the link field data from Current level */
+	/* ------------------------------------------- */
+	status = H5Dread(dataID_curr, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, fltFldCurr);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot read link field from current level. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(fltFldCurr);
+	    free(fltFldPrev);
+	    return(FAIL);
+	  }
+		
+	/* Read the link field data from Previous level */
+	/* -------------------------------------------- */
+	status = H5Dread(dataID_prev, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, fltFldPrev);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot read link field from previous level. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(fltFldCurr);
+	    free(fltFldPrev);
+	    return(FAIL);
+	  }	  
+	  
+	/* Loop through input records */
+	/* -------------------------- */
+	for (k = 0; k < nrecCurr; k++){
+	  for (j = 0; j < nrecPrev; j++){
+	    if (fltFldCurr[k] == fltFldPrev[j])
+	      {
+		bck[k].back = j;
+		break;
+	      }
+	  }
+	}  
+	free(fltFldCurr);
+	free(fltFldPrev);	  
+      }  
+
+      break;
+
+    case 4:
+	  
+      {
+	dblFldCurr = (double *)calloc(nrecCurr, sizeof(double));
+	dblFldPrev = (double *)calloc(nrecPrev, sizeof(double));
+
+	/* Create Compound datatype */
+	/* ------------------------ */
+	tid    = H5Tcreate(H5T_COMPOUND, sizeof(double));
+	if (tid == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot create Compound datatype. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(dblFldCurr);
+	    free(dblFldPrev);
+	    free(bck);
+	    return(FAIL);
+	  }
+
+	/* Insert data member */
+	/* ------------------ */
+	status = H5Tinsert(tid, utlbuf, 0, HE5_EHdtype2mtype(fldtype));
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot insert data member. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(dblFldCurr);
+	    free(dblFldPrev);
+	    return(FAIL);
+	  }
+		  
+	/* Read the link field data from Current level */
+	/* ------------------------------------------- */
+	status = H5Dread(dataID_curr, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dblFldCurr);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot read link field from current level. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(dblFldCurr);
+	    free(dblFldPrev);
+	    return(FAIL);
+	  }
+		
+	/* Read the link field data from Previous level */
+	/* -------------------------------------------- */
+	status = H5Dread(dataID_prev, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dblFldPrev);
+	if (status == FAIL)
+	  {
+	    sprintf(errbuf, "Cannot read link field from previous level. \n");
+	    H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(bck);
+	    free(dblFldCurr);
+	    free(dblFldPrev);
+	    return(FAIL);
+	  }
+	  
+	/* Loop through input records */
+	/* -------------------------- */
+	for (k = 0; k < nrecCurr; k++){
+	  for (j = 0; j < nrecPrev; j++){
+	    if (dblFldCurr[k] == dblFldPrev[j])
+	      {
+		bck[k].back = j;
+		break;
+	      }
+	  }
+	}  
+	free(dblFldCurr);
+	free(dblFldPrev);	  
+      }  
+
+      break;
+
+    default:
+
+      {
+	sprintf(errbuf, "Link record datatype is not supported. \n");
+	H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	HE5_EHprint(errbuf, __FILE__, __LINE__);
+	free(bck);
+	return(FAIL);
+      }
+	  
+    }
+
+  /* Release datatype ID  */
+  /* -------------------- */
+  status = H5Tclose(tid);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the datatype ID. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(bck);
+      return(FAIL);
+    }
+
+
+  /* Get ID of BCKPOINTER data  */
+  /* -------------------------- */
+  sprintf(utlbuf, "%s%d%s%d", "BCKPOINTER:", level, "->", level - 1);
+  
+  /* Open "BCKPOINTER" dataset */
+  /* ------------------------- */
+  bckid = H5Dopen(link_id, utlbuf);
+  if (bckid == FAIL)
+    {
+      sprintf(errbuf, "Cannot open the \"BCKPOINTER\" dataset. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(bck);
+      return(FAIL);
+    }
+  
+  datasize = (size_t)sizeof(bckptr);
+  count[0] = (hsize_t)nrecCurr;
+
+  /* Extend BCKPOINTER dataset  */
+  /* -------------------------- */
+  status = H5Dextend(bckid, count);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot extend the \"BCKPOINTER\" dataset. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(bck);
+      return(FAIL);
+    }
+ 
+  /* Get datatype ID of BCKPOINTER data  */
+  /* ----------------------------------- */
+  typeID = H5Dget_type(bckid);
+  if (typeID == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the datatype of \"BCKPOINTER\" dataset. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(bck);
+      return(FAIL);
+    }
+
+  /* Create the property list   */
+  /* -------------------------- */
+  xfer_list = H5Pcreate(H5P_DATASET_XFER);
+  if (xfer_list == FAIL)
+    {
+      sprintf(errbuf, "Cannot create the property list. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(bck);
+      return(FAIL);
+    }
+  
+  /* Set buffer  */
+  /* ----------- */
+  status = H5Pset_buffer(xfer_list, datasize, NULL, NULL);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot set the buffer. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(bck);
+      return(FAIL);
+    }
+  
+	  
+  /* Write back pointer values to "BCKPOINTER" dataset */
+  /* ------------------------------------------------- */
+  status = H5Dwrite(bckid, typeID, H5S_ALL,H5S_ALL, xfer_list, bck);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot write data to the \"BCKPOINTER\" dataset. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(bck);
+      return(FAIL);
+    }
+  
+  /* Release dataset ID  */
+  /* ------------------- */
+  status = H5Dclose(bckid);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the dataset ID. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(bck);
+      return(FAIL);
+    }
+  
+  /* Release datatype ID  */
+  /* -------------------- */
+  status = H5Tclose(typeID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the datatype ID. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(bck);
+      return(FAIL);
+    }
+
+  /* Release property list ID  */
+  /* ------------------------- */
+  status = H5Pclose(xfer_list);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the property list ID. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(bck);
+      return(FAIL);
+    }
+
+
+  free(bck);
+
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTrdbckptr                                                   |
+|                                                                             |
+|  DESCRIPTION: Reads back pointers                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level index (0 - based)                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  buffer         void                Data buffer                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  Date      Programmer    Description                                        |
+|  ========  ============  =================================================  |
+|  12/20/99  A. Muslimov   Added proper error handlings after the function    |
+|                           calls. Made some minor (mostly cosmetic) changes. |
+|  7.18.99   A.Muslimov    Unmasked hdf5 data types.                          |
+|  Nov  00   A.Muslimov    Changed the interface.                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t  
+HE5_PTrdbckptr(hid_t pointID, int level, void *buffer)
+{
+  herr_t         status  = FAIL;/* routine return status variable */
+
+  hid_t          fid     = FAIL;/* HDF-EOS file ID                */
+  hid_t          gid     = FAIL;/* POINTS group ID                */
+  hid_t          bckid   = FAIL;/* "BACKPOINTER" dataset ID       */
+  hid_t          typeID  = FAIL;/* Data type ID                   */
+  hid_t          link_id = FAIL;/* "Linkage" group ID             */
+
+  long           idx     = FAIL;/* Point index                    */
+
+  char           utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer    */
+  char           *mess = "No Linkage Defined between levels: %d and %d.\n";
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */
+
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTrdbckptr", &fid, &gid, &idx);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Checking for point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  /* Check the level number */
+  /* ---------------------- */
+  if (level <= 0)
+    {
+      sprintf(errbuf, "Passed wrong level number. Level should be > 0. \n");
+      H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get Back-Linkage Field */
+  /* ---------------------- */
+  status = HE5_PTbcklinkinfo(pointID, level, utlbuf);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, mess, level, level - 1);
+      H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+  /* Get ID of "Linkage" group */
+  /* ------------------------ */
+  link_id = HE5_PTXPoint[idx].link_id;
+  
+  /* Get ID of BCKPOINTER data */
+  /* -------------------------- */
+  sprintf(utlbuf, "%s%d%s%d","BCKPOINTER:", level, "->", level - 1);
+
+  
+  /* READ THE "BCKPOINTER" DATASET */
+  /* ----------------------------- */
+
+
+  /* Open the "BCKPOINTER" dataset */
+  /* ----------------------------- */
+  bckid = H5Dopen(link_id, utlbuf); 
+  if (bckid == FAIL)
+    {
+      sprintf(errbuf,"Cannot open the \"BCKPOINTER\" dataset. \n");
+      H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+    
+  /* Create Compound datatype */
+  /* ------------------------ */
+  typeID = H5Tcreate(H5T_COMPOUND, sizeof(bckptr));
+  if (typeID == FAIL)
+    {
+      sprintf(errbuf,"Cannot create the Compound datatype. \n");
+      H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Insert data member */
+  /* ------------------ */
+  status = H5Tinsert(typeID,"BCKPOINTER",HOFFSET(bckptr, back),H5T_NATIVE_LLONG); 
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot insert data member to  \"BCKPOINTER\" dataset. \n");
+      H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Read the data from the dataset */
+  /* ------------------------------ */
+  status = H5Dread(bckid, typeID, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot read data from  the \"BCKPOINTER\" dataset. \n");
+      H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* release dataset ID */
+  /* ------------------ */
+  status = H5Dclose(bckid);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release the dataset ID. \n");
+      H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* release datatype ID */
+  /* ------------------- */
+  status = H5Tclose(typeID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release the datatype ID. \n");
+      H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  return (status);
+}
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTwrfwdptr                                                   |
+|                                                                             |
+|  DESCRIPTION: Write forward pointer records                                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level index (0 - based)                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/20/99 A. Muslimov   Added proper error handlings after the function     |
+|                           calls. Corrected memory management stuff. Made    |
+|                           some minor (mostly cosmetic) changes.             |
+|  7.18.99  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Nov  00  A.Muslimov    Changed the interface.                              |
+|  Sept 04  S.Zhao        Changed "long long" to "LONGLONG" for Windows.      |
+|  Feb  06  Abe Taaheri   Support for STRING fields and setting pointers to -1|
+|                         values when the records in child level is not       |
+|                         monotonic                                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t   
+HE5_PTwrfwdptr(hid_t pointID, int level)
+{
+  herr_t          status  = FAIL; /* routine return status variable         */
+
+  int             FORWARD = TRUE; /* Forward pointer flag                   */
+  int             nlevels = 0;	  /* Number of levels in point              */
+
+  hid_t           fid     = FAIL; /* HDF-EOS file ID                        */
+  hid_t           gid     = FAIL; /* POINTS group ID                        */
+  hid_t           fwdID   = FAIL; /* "FORWARD" pointer data set ID          */
+  hid_t           typeID  = FAIL; /* Data type ID                           */
+  hid_t           link_id = FAIL; /* "Linkage" group ID                     */
+
+  long            idx     = FAIL; /* Point index                            */
+
+  LONGLONG        max     = 0;	  /* Maximun back pointer value             */
+  LONGLONG        i, j, k;        /* Loop indices                           */
+  LONGLONG        start   = 0;    /* Loop index                             */
+  LONGLONG        nrec    = 0;	  /* # of records in FWDPOINTER dataset     */
+  /* hsize_t         nrec    = 0;*/ /* # of records in FWDPOINTER dataset   */
+
+  hsize_t         count   = 0;    /* Size of the fwdpointer dataset         */
+
+  bckptr          *bck = (bckptr *)NULL;/* Struct for bckpointer dataset    */
+  fwdptr          *fwd = (fwdptr *)NULL;/* Struct for fwdpointer dataset    */
+
+  char            utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer             */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer       */
+
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTwrfwdptr", &fid, &gid, &idx);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Checking for point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get number of levels in point */
+  /* ----------------------------- */
+  nlevels = HE5_PTnlevels(pointID);
+
+  /* Get number of records in following level */
+  /* ---------------------------------------- */
+  nrec = (level < nlevels - 1) ? (LONGLONG)HE5_PTnrecs(pointID, level + 1) : 0;
+
+  /* If records exist in current and following level... */
+  /* -------------------------------------------------- */
+  if ((int)HE5_PTnrecs(pointID, level) > 0 && (int)nrec > 0)
+	
+    {
+      /* Allocate memory */
+      /* --------------- */
+      bck = (bckptr *)calloc((int)nrec, sizeof(bckptr));
+	 
+      if (bck == (bckptr *)NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory. \n");
+	  H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      status = HE5_PTrdbckptr(pointID, level + 1, bck);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot read the back pointer. \n");
+	  H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(bck);
+	  return(FAIL);
+	}
+
+
+      /* Find Max BackPointer value */
+      /* -------------------------- */
+      max = bck[0].back;
+      for (i = 1; i < nrec; i++)
+	{
+	  if (bck[i].back > max)
+	    {
+	      max = bck[i].back;
+	    }
+	}
+	  
+
+      /* Allocate memory for fwdpointer struct */
+      /* ------------------------------------- */
+      fwd = (fwdptr *)calloc((int)max + 1, sizeof(fwdptr));
+	 
+      if(fwd == (fwdptr *)NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory. \n");
+	  H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(bck);
+
+	  return(FAIL);
+	}
+
+
+      /* Get ID of "Linkage" group */
+      /* ------------------------- */
+      link_id = HE5_PTXPoint[idx].link_id;
+
+      /* Get ID of FWDPOINTER dataset */
+      /* ---------------------------- */
+      sprintf(utlbuf, "%s%d%s%d", "FWDPOINTER:", level, "->", level+1);
+
+      /* Open FWDPOINTER dataset */
+      /* ----------------------- */
+      fwdID = H5Dopen(link_id, utlbuf);
+      if (fwdID == FAIL)
+	{
+	  sprintf(errbuf, "Cannot open the dataset. \n");
+	  H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(fwd);
+	  free(bck);
+	  return(FAIL);
+	}
+
+      count = (hsize_t)max + 1;
+
+      /* Extend the dataset size */
+      /* ----------------------- */
+      status = H5Dextend(fwdID, &count);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot extend the dataset.\n");
+	  H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(fwd);
+	  free(bck);
+	  return(FAIL);
+	}
+
+
+      /* Get dataset FWDPOINT:?->? datatype */
+      /* ---------------------------------- */ 
+      typeID = H5Dget_type(fwdID);
+      if (typeID == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the data type ID. \n");
+	  H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(fwd);
+	  free(bck);
+	  return(FAIL);
+	}
+	  
+      /* Set the values for the forward pointers */
+      /* --------------------------------------- */
+
+
+      /* Fill Fwd Ptr buffers with -1 */
+      /* ---------------------------- */
+      for ( k = 0; k <= max; k++)
+	{
+	  fwd[k].begin  = (LONGLONG)FAIL;
+	  fwd[k].extent = (LONGLONG)FAIL;
+	}
+	  
+      /* Set forward pointer flag to 1 (TRUE) */
+      /* ----------------------------- */
+      FORWARD = TRUE;
+	  
+      /* Loop through all records */
+      /* ------------------------ */
+      for (j = 0; j < nrec; j++)
+	{
+	  /* If fwd extent entry not yet written for rec[j] ... */
+	  /* ----------------------------------------------- */
+	  if (fwd[bck[j].back].extent == (LONGLONG)FAIL)
+	    {
+	      /* Set fwd begin to (possible) beginning of sequence */
+	      /* -------------------------------------------- */
+	      fwd[bck[j].back].begin  =  (LONGLONG)j;
+		  
+	      /* Set fwd extent to initial value of sequence */
+	      /* ------------------------------------- */
+	      fwd[bck[j].back].extent = (LONGLONG)j;
+	    }
+	  else
+	    {
+	      /* If numbers in sequence ... */
+	      /* -------------------------- */
+	      if ((LONGLONG)j - fwd[bck[j].back].extent == 1)
+		{
+		  /* Set Buf1 to current value of sequence */
+		  /* ------------------------------------- */
+		  fwd[bck[j].back].extent = (LONGLONG)j;
+		}
+	      else
+		{
+		  /* Back pointers in following level 
+		     not monotonic */
+		  /* ---------------------------------*/
+		      
+		      
+		  /* Set begin begin and extent for first record 
+		     in Forward pointer to Fail
+		  */
+		  /* -------------------------------------- */
+		  fwd[0].begin = (LONGLONG)FAIL;
+		  fwd[0].extent = (LONGLONG)FAIL;
+
+		  /* also set to fail other elemets */
+		  fwd[bck[j].back].begin  = (LONGLONG)FAIL;
+		  fwd[bck[j].back].extent = (LONGLONG)FAIL;
+		      
+		  /* Set forward pointer flag to 0 */
+		  /* ----------------------------- */
+		  FORWARD = FALSE;
+		  break;
+		}
+	    }
+	}
+
+      /* Although setting to (-1,-1) of first forward pointer 
+	 record for non-monotonic backward pointers is good enough
+	 for knowing this fact, let's put -1 in rest of the records
+	 for making output in hdf file less confusing */
+
+      if((fwd[0].begin == (LONGLONG)FAIL) &&
+	 (fwd[0].extent == (LONGLONG)FAIL))
+	{
+	  for ( k = 1; k <= max; k++)
+	    {
+	      fwd[k].begin  = (LONGLONG)FAIL;
+	      fwd[k].extent = (LONGLONG)FAIL;
+	    }
+	}
+
+      /* Back pointers in following level are monotonic */
+      /* ---------------------------------------------- */
+	  
+      if (FORWARD == TRUE)
+	{
+	  for (k = 0; k <= max; k++)
+	    {
+	      fwd[k].begin = fwd[k].begin;
+	      fwd[k].extent = fwd[k].extent - fwd[k].begin	+ 1;
+	    }
+	}
+	  
+      /* Write data to the "FWDPOINTER" */
+      /* ------------------------------ */
+      status = H5Dwrite(fwdID, typeID, H5S_ALL, H5S_ALL, H5P_DEFAULT, fwd);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot write data to the dataset. \n");
+	  H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (fwd != NULL) free(fwd);
+	  if (bck != NULL) free(bck);
+	  return(FAIL);
+	}
+	  
+
+      if (bck != NULL) free(bck);
+      if (fwd != NULL) free(fwd);
+	  
+      /* Release the dataset ID */
+      /* ---------------------- */
+      status = H5Dclose(fwdID);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot release the dataset ID. \n");
+	  H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Release the datatype ID */
+      /* ----------------------- */
+      status = H5Tclose(typeID);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot release the data type ID. \n");
+	  H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+
+  return(status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTrdfwdptr                                                   |
+|                                                                             |
+|  DESCRIPTION: Read forward pointer records                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t                 point structure ID                    |
+|  level          int                   level index (0 - based)               |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  buffer         void                  Data buffer                           |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer    Description                                        |
+|  ========  ============  =================================================  |
+|  12/20/99  A. Muslimov   Added proper error handlings after the function    |
+|                          calls. Made some minor (mostly cosmetic) changes.  |
+|  7.18.99   A.Muslimov    Unmasked hdf5 data types.                          |
+|  Nov 00    A.Muslimov    Changed the interface.                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t   
+HE5_PTrdfwdptr(hid_t pointID, int level, void *buffer)
+{
+  herr_t          status    = FAIL;/* routine return status variable  */
+
+  hid_t           fid       = FAIL;/* HDF-EOS file ID                 */
+  hid_t           gid       = FAIL;/* POINTS group ID                 */
+  hid_t           link_id   = FAIL;/* Linkage group ID                */
+  hid_t           fwdID     = FAIL;/* FWDPOINTER dataset ID           */
+  hid_t           typeID    = FAIL;/* FWDPOINTER dataset datatype ID  */
+
+  long            idx       = FAIL;/* Point index                     */
+
+  char            utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer       */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */
+
+  fwdptr          fwd;             /* Tmp FWDPOINTER struct dataset   */  
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTrdfwdptr", &fid, &gid, &idx);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Checking for point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get ID of Linkage  group */
+  /* ------------------------ */
+  link_id = HE5_PTXPoint[idx].link_id;
+
+  /* Get name string of FWDPOINTER dataset */
+  /* ------------------------------------- */
+  sprintf(utlbuf, "%s%d%s%d", "FWDPOINTER:", level, "->", level + 1);
+
+
+  /* Open the "FWDPOINTER" dataset */
+  /* ----------------------------- */
+  fwdID = H5Dopen(link_id, utlbuf);
+  if (fwdID == FAIL)
+    {
+      sprintf(errbuf, "Cannot open the dataset \"%s\". \n", utlbuf);
+      H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get the (Compound) dataset type ID */
+  /* ---------------------------------- */
+  typeID = H5Dget_type(fwdID);
+  if (typeID == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the data type ID. \n");
+      H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Create (Compound) datatype */
+  /* -------------------------- */
+  typeID = H5Tcreate(H5T_COMPOUND, sizeof(fwdptr));
+  if (typeID == FAIL)
+    {
+      sprintf(errbuf, "Cannot create compound datatype. \n");
+      H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Insert "BEGIN" data member */
+  /* -------------------------- */
+  status = H5Tinsert(typeID, "BEGIN", HOFFSET(fwdptr, begin), H5T_NATIVE_LLONG);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot insert \"BEGIN\" data member. \n");
+      H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Insert "EXTENT" data member */
+  /* --------------------------- */
+  status = H5Tinsert(typeID, "EXTENT", HOFFSET(fwdptr, extent), H5T_NATIVE_LLONG);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot insert \"EXTENT\" data member. \n");
+      H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Read BEGIN & EXTENT fields in first record */
+  /* ------------------------------------------ */
+  status = H5Dread(fwdID, typeID, H5S_ALL, H5S_ALL, H5P_DEFAULT, &fwd);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot read \"FWDPOINTER\" dataset. \n");
+      H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Check if first record is not a garbage */
+  /* -------------------------------------- */
+  if (fwd.begin == FAIL || fwd.extent == FAIL)
+    {
+      /* Release the dataset ID */
+      /* ---------------------- */
+      status = H5Dclose(fwdID);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release dataset ID. \n");
+	  H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+      /* Release the data type ID */
+      /* ------------------------ */
+      status = H5Tclose(typeID);  
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release datatype ID. \n");
+	  H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+      return(FAIL);
+    }
+
+
+  /* Read BEGIN & EXTENT fields for all records */
+  /* ------------------------------------------ */
+  status = H5Dread(fwdID, typeID, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot read \"FWDPOINTER\" dataset. \n");
+      H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Release the dataset ID */
+  /* ---------------------- */
+  status = H5Dclose(fwdID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release dataset ID. \n");
+      H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  /* Release the data type ID */
+  /* ------------------------ */
+  status = H5Tclose(typeID);  
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release datatype ID. \n");
+      H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTupdatelevel                                                |
+|                                                                             |
+|  DESCRIPTION: Updates the specified fields and records of a level.          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|  fieldlist      char                fieldlist to read (comma-separated)     |
+|  nrec           hsize_t             Number of records to read               |
+|  recs           hssize_t            array of record numbers to read         |
+|  data           void                data buffer                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  Date     Programmer    Description                                         |
+|  ======   ============  =================================================   |
+|  Nov 00   A.Muslimov    Changed the interface.                              |
+|  Mar 01   A.Muslimov    Updated to reflect changes in the HDF5 library.     |
+|  09/13/01 A.Muslimov    Added mutex "lock"/"unlock" calls.                  |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_PTupdatelevel(hid_t pointID, int level, char *fieldlist, hsize_t nrec,  hssize_t recs[], void *data)
+{
+  herr_t            status   = FAIL;/* routine return status variable    */
+
+  int               nlevels  =  0;  /* Number of levels in point         */
+  int               rank     =  1;  /* Rank of compound dataset          */
+  int               j;              /* Loop index                        */
+
+  long              idx      = FAIL;/* Point index                       */
+  long              nfields  =  0;  /* Number of fields in fieldlist     */
+  long              i;  		    /* Loop inde  x                      */
+  long              dum      = FAIL;/* Dummy variable                    */
+
+  hid_t             fid      = FAIL;/* HDF-EOS file ID                   */
+  hid_t             gid      = FAIL;/* "POINTS" group ID                 */
+  hid_t             dataID   = FAIL;/* Dataset ID                        */
+  hid_t             dspace   = FAIL;/* Disk data space ID                */
+  hid_t             mspace   = FAIL;/* Memory data space ID              */
+  hid_t             typeID   = FAIL;/* Data type ID                      */
+
+  hsize_t           nallrec  = 0;   /* Number of records in  Point       */
+  hsize_t           dims[1]  = {0}; /* member dimensions in  dataset     */
+  hsize_t           *coord   = NULL;/* Coordinates of elemnts to update  */
+  
+  size_t            datasize = 0;   /* Data size (bytes) of each record  */
+  size_t            slen[HE5_HDFE_DIMBUFSIZE];  /* String length array   */
+
+  char              utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer        */
+  char              *pntr[HE5_HDFE_DIMBUFSIZE];	/* String pointer array  */
+  char              errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  HE5_CmpDTSinfo    info;      /* Structure with the dataset information */
+
+  HE5_LOCK;
+  CHECKPOINTER(data);
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTupdatelevel", &fid, &gid, &idx);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Checking for point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  /* Get number of levels */
+  /* -------------------- */
+  nlevels = HE5_PTnlevels(pointID);
+  if (nlevels == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "No Levels Defined for point.\n");
+      H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  else if (nlevels < level)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Only %d levels defined for the point. \n", nlevels);
+      H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+	
+  /* Get dataset ID */
+  /* -------------- */
+  dataID = HE5_PTXPoint[idx].level[level].ID;
+
+
+  /* Initialize slen[] array */
+  /* ----------------------- */
+  for (j = 0; j < HE5_HDFE_DIMBUFSIZE; j++)
+    slen[ j ] = 0;
+
+  /* Parse field list */
+  /* ---------------- */
+  nfields = HE5_EHparsestr(fieldlist, ',', pntr, slen);
+	
+  /* Check that all fields in list exist in level */
+  /* -------------------------------------------- */
+  for (i = 0; i < nfields; i++)
+    {
+      memmove(utlbuf, pntr[i], slen[i]);
+      utlbuf[slen[i]] = 0;
+      if (HE5_PTfexist(dataID, utlbuf, NULL, NULL, NULL, NULL) != 1)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Field: \"%s\" does not exist.\n",  utlbuf);
+	  H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf );
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  
+  /* Check input records to update */
+  /* ----------------------------- */
+  if( nrec == 0 || recs == NULL )
+    {
+      /* Get neumber of records in level */
+      /* ------------------------------- */
+      nallrec = HE5_PTnrecs(pointID, level);
+      if (nallrec == 0)
+	{
+	  sprintf(errbuf, "Cannot retrieve number of records in Point. \n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Call HE5_PTlevelinfo() */
+      /* ---------------------- */
+      status = HE5_PTlevelinfo(pointID, level, &info);
+      if (status == FAIL)
+        {
+          sprintf(errbuf, "Cannot get the level information. \n");
+          H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(FAIL);
+        }
+      /* Get the dataset size */
+      /* -------------------- */
+      datasize = info.datasize;
+	  
+      /* Release pointers to the name buffers */
+      /* ------------------------------------ */
+      for (j = 0; j < info.nfields; j++)
+	{
+	  if (info.fieldname[j] != NULL) 
+	    free(info.fieldname[j]);
+	}
+	  
+
+      /* Update all records in level */
+      /* --------------------------- */
+      status = HE5_PTwritelevel(pointID, level, &nallrec, &datasize, data);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write updated data to the level. \n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+    }
+  else if( nrec > 0 && recs != NULL )
+    {
+      /* Get dataset space and datatype */
+      /* ------------------------------ */
+      dspace = H5Dget_space(dataID);
+      if (dspace == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+
+      /* Get data type ID */
+      /* ---------------- */
+      typeID = H5Dget_type(dataID);
+      if (typeID == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the data type ID.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);  
+	  return(FAIL);
+	}
+	  
+      dims[0] = nrec;
+	  
+      /* Create the memory data space */
+      /* ---------------------------- */
+      mspace = H5Screate_simple(rank, dims, NULL);
+      if (mspace == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create the data space.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  
+	  return(FAIL);
+	}
+	  
+      /* Allocate memory */
+      /* --------------- */
+      coord = (hsize_t *)calloc(nrec, sizeof(hsize_t));
+      if (coord == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory. \n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	   
+      /* Loop through all records to update */
+      /* ---------------------------------- */
+      for (i = 0; i < nrec; i++)
+	coord[i] = (hsize_t)recs[i];
+
+      /* Select elements to update */
+      /* ------------------------- */
+      status = H5Sselect_elements(dspace, H5S_SELECT_SET, nrec, (const hsize_t *)coord);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot select elements.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(coord);
+	  return(FAIL);
+	}
+
+      /* Update selected records */
+      /* ----------------------- */
+      status = H5Dwrite(dataID, typeID, mspace, dspace, H5P_DEFAULT, data);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write data to the dataset.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(coord);
+	  return(FAIL);
+	}
+
+      /* Release memory */
+      /* -------------- */
+      free(coord);
+
+      /* Release data space ID */
+      /* --------------------- */
+      status = H5Sclose(mspace);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Release data  type ID */
+      /* --------------------- */
+      status = H5Tclose(typeID);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the data type ID.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Release data space ID */
+      /* --------------------- */
+      status = H5Sclose(dspace);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+
+
+  /* Update Pointers to Previous Level */
+  /* -------------------------------- */
+  if (level > 0)
+    {
+      /* Store back linkage field in utlbuf */
+      /* ---------------------------------- */
+      status = HE5_PTbcklinkinfo(pointID, level, utlbuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get backward linkage information.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Check whether back linkage field is in fieldlist */
+      /* ------------------------------------------------ */
+      dum = HE5_EHstrwithin(utlbuf, fieldlist, ',');
+      if (dum != FAIL)
+	{
+	  /* Back pointers to previous level */
+	  /* ------------------------------- */
+	  status = HE5_PTwrbckptr(pointID, level);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot write backward pointer.\n");
+	      H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  /* Forward pointers from previous level */
+	  /* ------------------------------------ */
+	  status = HE5_PTwrfwdptr(pointID, level - 1);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot write forward pointer.\n");
+	      H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	}
+	  
+    }
+  
+  
+  /* Update Pointers to Next Level */
+  /* ---------------------------- */
+  if (level < HE5_PTnlevels(pointID) - 1 && dum != FAIL)
+    {
+      /* Store forward linkage field in utlbuf */
+      /* ------------------------------------- */
+      status = HE5_PTfwdlinkinfo(pointID, level, utlbuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get forward linkage information.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Check whether forward linkage field is in fieldlist */
+      /* --------------------------------------------------- */
+      dum = HE5_EHstrwithin(utlbuf, fieldlist, ',');
+      if (dum != FAIL)
+	{
+	  /* Back pointers from next level */
+	  /* ----------------------------- */
+	  status = HE5_PTwrbckptr(pointID, level + 1);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot write backward pointer.\n");
+	      H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+		  
+	  /* Forward pointers to next level */
+	  /* ------------------------------ */
+	  status = HE5_PTwrfwdptr(pointID, level);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot write forward pointer.\n");
+	      H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	}
+	  
+    }
+	
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+/* 
+*****************************************************************************
+|                                                                           |
+|          F  O  R  T  R  A  N  7 7     W  R  A  P  P  E  R  S              |
+|                                                                           |
+*****************************************************************************
+*/
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTopenF   (FORTRAN wrapper)                                  |
+|                                                                             |
+|  DESCRIPTION: Opens or creates HDF file in order to create, read, or write  |
+|                a grid.                                                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  FileID         int     None        HDF-EOS file ID                         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|  filename       char*   None        Filename                                |
+|  Flags          uintn               Access Code                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  HDF5 Library Functions Called:                                             |
+|                                                                             |
+|             None                                                            |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|  3/12/02    A.Muslimov   Added more "Flags" options for core metadata.      |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_PTopenF(char *filename, uintn Flags)
+{
+  hid_t     fid     = FAIL;/* hdf5 type file ID     */ 
+
+  int       FileID  = FAIL;/* Return file ID        */
+
+  uintn     flags   = 9999;/* HDF5 file access code */
+  
+  char      *errbuf = NULL;/* Error message buffer  */
+  
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTopenF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }  
+  
+
+  /* Set up the file access flag */
+  /* --------------------------- */
+  if (Flags == HE5F_ACC_RDWR || Flags == HDF5_ACC_RDWR) flags = H5F_ACC_RDWR;
+  else if (Flags == HE5F_ACC_RDONLY || Flags == HDF5_ACC_RDONLY) flags = H5F_ACC_RDONLY;
+  else if (Flags == HE5F_ACC_TRUNC || Flags == HDF5_ACC_CREATE) flags = H5F_ACC_TRUNC;
+  else
+    {
+      sprintf(errbuf, "File access flag is not supported. \n");
+      H5Epush(__FILE__, "HE5_PTopenF", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }  
+
+  /* Call HE5_PTopen to perform file access */
+  /* -------------------------------------- */
+  fid = HE5_PTopen(filename,flags);
+  if(fid == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_PTopen() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_PTopenF", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }  
+
+
+  FileID = (int)fid;
+
+  free(errbuf);
+
+  return(FileID);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTcreateF    (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Creates a new point structure and returns point ID.           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  pointID        int                 Point structure ID                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int     None        HDF-EOS file id                         |
+|  pointname      char                Point structure name                    |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_PTcreateF(int FileID, char *pointname)
+{
+  int             PointID   = FAIL;/* point ID (return value)             */
+
+  hid_t           pointID   = FAIL;/* HDF5 type point ID                  */
+  hid_t           fid       = FAIL;/* HDF5 type file ID                   */
+
+  char            *errbuf   = (char *)NULL; /* Buffer for error message   */
+
+
+
+  errbuf  = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char) );
+  if (errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTcreateF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  fid = (hid_t)FileID;
+
+  pointID = HE5_PTcreate(fid, pointname);
+  if (pointID == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_PTcreate() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_PTcreateF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  free(errbuf);
+
+  PointID = (int)pointID;
+  return(PointID);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTattachF    (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Attaches to an existing grid within the file.                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  pointID        int                 point structure ID                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int                 HDF-EOS file ID                         |
+|  pointname      char                point structure name                    |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_PTattachF(int FileID, char *pointname)
+{
+  int             PointID  = FAIL;	/* Return value of the Point ID    */
+
+  hid_t           pointID  = FAIL;	/* HDF5 type Point  ID             */
+  hid_t           fid      = FAIL;	/* HDF5 type file ID               */
+
+  char            *errbuf = (char *)NULL;/* Buffer for error message  */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTattachF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  
+  fid = (hid_t)FileID;
+
+  pointID = HE5_PTattach(fid, pointname);
+  if(pointID == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_PTattach() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_PTattachF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  free(errbuf);
+  
+  PointID = (int)pointID;
+  return(PointID);
+
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTdetachF    (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Detaches from grid interface and performs file housekeeping.  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  PointID        int     None        point structure ID                      |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_PTdetachF(int  PointID)   
+{
+  int             ret    = FAIL;/* (int) Return status variable   */
+
+  herr_t          status = FAIL;/* routine return status variable */    
+   
+  hid_t           pointID = FAIL;/* HDF5 type point ID            */
+
+  char            *errbuf = (char *)NULL;/*Error message buffer   */
+
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTdetachF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  pointID = (hid_t)PointID;
+
+  status = HE5_PTdetach(pointID);
+  if(status == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_PTdetach() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_PTdetachF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+	
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTcloseF     (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Closes file.                                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|  FileID         int                 HDF-EOS type file ID                    |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_PTcloseF(int FileID)
+{
+  int               ret    = FAIL;/* (int) return status variable   */
+
+  hid_t             fid    = FAIL;/* HDF5 type file ID              */
+
+  herr_t            status = FAIL;/* routine return status variable */
+
+  char              *errbuf = (char *)NULL;/*Error message buffer   */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTcloseF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  fid = (hid_t)FileID;
+
+  /* Call HE5_PTclose to perform file close */
+  /* -------------------------------------- */
+  status = HE5_PTclose(fid);
+  if(status == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_PTclose() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_PTcloseF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+	
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+/* Definition routines */
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTdeflevelF           (FORTRAN wrapper)                      |
+|                                                                             |
+|  DESCRIPTION: Defines a level within the point data set.                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  levelname      char                name of level                           |
+|  rank           int                 Rank of Fields                          |
+|  fieldlist      char                Fieldlist to read (comma-separated)     |
+|  dim_sizes      void                Sizes of field dimensions               |
+|  datasize       long                Datasize of compound structure          |
+|  offset         long                Offsets of each of the fields           |
+|  dtype          int                 Datatypes of each of the fields         |
+|  array          int                 array flag identifier                   |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:     Metadata block needs to be developed                            |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_PTdeflevelF(int  pointID, const char *levelname, int rank[], char *fieldlist, long *dim_sizes, int dtype[], int array[])
+{
+  herr_t            status    = FAIL;/* routine return status variable */    
+
+  int               ret       = FAIL;/* (int) Return status variable   */
+  int               i, j, k   = 0;
+ 
+  hid_t             PointID   = FAIL;
+
+  HE5_CmpDTSinfo    dtsinfo;
+
+  long              nfields         = FAIL;
+  long              max_rank        = 0;
+  long              nelements_field = 0;
+  long              *datatype_size  = (long *)NULL;
+  long              *datasize_field = (long *)NULL;
+  long              *offset         = (long *)NULL;
+  long              datasize        = 0;
+
+  size_t            slen[HE5_HDFE_DIMBUFSIZE];
+
+  char              *errbuf = (char *)NULL;     /* Error message buffer   */
+  char              utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer         */
+  char              *pntr[HE5_HDFE_DIMBUFSIZE];
+ 
+     
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTdeflevelF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Parse field list */
+  /* ---------------- */
+  nfields = HE5_EHparsestr(fieldlist, ',', pntr, slen);
+
+  /* Set up level data structure */
+  /* --------------------------- */
+  dtsinfo.nfields = (int)nfields;
+
+  /* Calculate maximum rank of all the fields */
+  /* ---------------------------------------- */
+  for( i = 0; i < nfields; i++ )
+    {
+      if( rank[i] > max_rank )
+	max_rank = rank[i];
+    }
+
+
+  /*  Load dimension array (2-d fortran dimension array is in fortran order) */
+  /* ----------------------------------------------------------------------- */
+  for( i = 0; i < max_rank; i++ )
+    {
+      for( j = 0; j < nfields; j++ )
+	{
+	  k  =  i * (int)nfields + j;
+	  dtsinfo.dims[j][i] = (size_t)dim_sizes[k];
+	}
+    }
+  
+
+  /* Store fieldname in level data structure */
+  /* --------------------------------------- */
+  for (i = 0; i < nfields; i++)
+    {
+      dtsinfo.fieldname[i] = (char *)calloc(HE5_HDFE_NAMBUFSIZE,sizeof(char));
+      memmove(utlbuf, pntr[i], slen[i]);
+      utlbuf[slen[i]]       = '\0';             
+      memmove(dtsinfo.fieldname[i], utlbuf, slen[i]+1);  
+    }
+
+  datatype_size  = (long *)calloc(nfields,sizeof(long));
+  datasize_field = (long *)calloc(nfields,sizeof(long));
+  offset         = (long *)calloc(nfields,sizeof(long));
+
+  for( i = 0; i < nfields; i++) 
+    {
+      switch( dtype[i] )
+	{
+	case HE5T_NATIVE_INT:
+	  {	datatype_size[i] = sizeof(int); }
+	  break;  
+	case HE5T_NATIVE_FLOAT:
+	  {	datatype_size[i] = sizeof(float); }
+	  break;  
+	case HE5T_NATIVE_DOUBLE:
+	  {	datatype_size[i] = sizeof(double); }
+	  break;  
+	case HE5T_NATIVE_CHAR:
+	  {	datatype_size[i] = sizeof(char); }
+	  break;  
+	case HE5T_NATIVE_LONG:
+	  {	datatype_size[i] = sizeof(long); }
+	  break;  
+	default:
+	  break;  
+	}
+
+      nelements_field = 0;
+      for( j = 0; j < rank[i]; j++ )
+	{
+	  nelements_field = nelements_field + (long)dtsinfo.dims[i][j];
+	}
+
+      datasize_field[i] = nelements_field*datatype_size[i];
+
+    }
+
+
+  offset[0] = 0;
+  datasize  = datasize_field[0];
+  for( i = 1; i < nfields; i++) 
+    {
+      offset[i] = offset[i-1] + datasize_field[i-1];
+      datasize  = datasize + datasize_field[i];
+    }
+
+  for( i = 0; i < nfields; i++ )
+    {
+      dtsinfo.array[i]  = array[i];
+      dtsinfo.rank[i]   = rank[i];
+      dtsinfo.offset[i] = (off_t)offset[i];    
+      dtsinfo.dtype[i]  = HE5_EHconvdatatype(dtype[i]);
+      /* 
+	 if dtype[i] is HE5 numbertype, rather than H5 numbertype, then convert
+	 it, otherwise use dtype[i] itself
+      */
+      if(dtsinfo.dtype[i] == FAIL)
+	{
+	  dtsinfo.dtype[i] = dtype[i];
+	}
+    }
+  
+  dtsinfo.datasize = (size_t)datasize;
+
+  PointID = (hid_t)pointID;
+  
+  /* Call HE5_PTdeflevel() */
+  /* --------------------- */ 
+  status = HE5_PTdeflevel(PointID, levelname, &dtsinfo);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Call to HE5_PTdeflevel() failed. \n");
+      H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  /* Free up space */
+  /* ------------- */ 
+  for (i = 0; i < nfields; i++ )
+    free(dtsinfo.fieldname[i]);
+  
+  free(errbuf);
+  free(datatype_size);
+  free(datasize_field);
+  free(offset);
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTdeflinkageF   (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Defines link field between two (adjacent) levels.             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  parent         char                parent level name                       |
+|  child          char                child level name                        |
+|  linkfield      char                linkage field name                      |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date        Programmer   Description                                      |
+|  =========   ============  ==============================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_PTdeflinkageF(int pointID, char *parent, char *child, char *linkfield)
+{
+  int       ret     = FAIL;/* (int) Return status variable   */
+
+  herr_t    status  = FAIL;/* routine return status variable */    
+
+  hid_t     PointID = FAIL;/* hdf5 type file ID              */ 
+  
+  char      *errbuf = NULL;/* Error message buffer           */
+
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTdeflinkageF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }  
+   
+  PointID = (hid_t)pointID;
+
+  /* Call HE5_PTdeflinkage                  */
+  /* -------------------------------------- */
+  status = HE5_PTdeflinkage(PointID, parent, child, linkfield);
+  if(status == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_PTdeflinkageF() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_PTdeflinkageF", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }  
+
+  ret = (int)status;
+
+  free(errbuf);
+
+  return(ret);
+}
+
+
+/* I/O routines */
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTreadlevelF   (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION: Reads data from the specified fields and records of a level.  |
+|               Reads only one field at a time                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|  fieldname      char                Name of field                           |
+|  ntype          int                 HDF numbertype of field datatype        |
+|  size           int                 Memory size (bytes) of field  being     |
+|                                     read.                                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                Data buffer                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_PTreadlevelF(int pointID, int level, char *fieldname, int ntype, void *datbuf)
+{
+  int            ret     = FAIL;/* (int) return status variable   */
+
+  herr_t         status  = FAIL;/* routine return status variable */
+
+  hid_t          ptID    = FAIL;
+  hid_t          dtype   = FAIL;/* HDF5 type  data type ID        */            
+
+  char           *errbuf = (char *)NULL;/*Error message buffer    */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTcloseF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtype = HE5_EHconvdatatype(ntype);
+  /* 
+     if ntype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use ntype itself
+  */
+  if(dtype == FAIL)
+    {
+      dtype = ntype;
+    }
+
+  ptID           = (hid_t)pointID;
+
+  /* Call HE5_PTreadlevel_f to read data */
+  /* ----------------------------------- */
+  status = HE5_PTreadlevel_f(ptID, level, fieldname, dtype, datbuf);  
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Reading data failed.\n");
+      H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTreadlevel_f                                                |
+|                                                                             |
+|  DESCRIPTION: Reads data from the specified fields and records of a level.  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|  fieldname      char                Name of field                           |
+|  ntype          int                 HDF numbertype of field datatype        |
+|  dtype          hid_t               datatype ID of field                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf                             Data buffer                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t   
+HE5_PTreadlevel_f(hid_t pointID, int level, char *fieldname, hid_t dtype, void *datbuf)  
+{
+  herr_t          status    = FAIL;/* routine return status variable  */
+
+  int             nlevels   =  0;  /* Number of levels in point       */
+  int             i, j;            /* Loop index                      */
+  int             ii        = 0;
+  int             nflds     = FAIL;
+  int             result    = 99;
+  int             field_size    = 0;
+  int             rank          = 0;
+
+  size_t          datatype_size = 0;
+
+  hid_t           fid       = FAIL;/* HDF-EOS file ID                 */
+  hid_t           gid       = FAIL;/* POINTS group ID                 */
+  hid_t           dataID    = FAIL;/* dataset ID                      */
+  hid_t           xfer_list = FAIL;/* Property list ID                */
+  hid_t           typeID    = FAIL;/* compound datatype ID            */
+  hid_t           arr_id    = FAIL;/* Array datatype ID               */
+  hid_t           mtype     = FAIL;/* Memory data type ID                 */
+
+  hsize_t         dims[HE5_DTSETRANKMAX];/* Array of dimension sizes  */
+  hsize_t         datasize  = 0;/* Size (bytes) of a dataset to read  */
+
+  long            idx       = FAIL;/* Point index                     */
+
+  HE5_CmpDTSinfo  dtsinfo;/* Structure to read information about level*/    
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTreadlevel_f", &fid, &gid, &idx);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Checking for the point  ID failed.\n");
+      H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[ i ] = 0;
+
+  /* Get number of levels in point */
+  /* ----------------------------- */
+  nlevels = HE5_PTnlevels(pointID);
+  if (nlevels == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID);
+      H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  else if (nlevels < level)
+    {
+      /* Report error if level # to large */
+      /* -------------------------------- */
+      status = FAIL;
+      sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID);
+      H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_FILE, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get level dataset ID */
+  /* ------------------ */
+  dataID = HE5_PTXPoint[idx].level[level].ID;
+
+  /* Create property list */
+  /* -------------------- */
+  xfer_list = H5Pcreate(H5P_DATASET_XFER);
+  if (xfer_list == FAIL)
+    {
+      sprintf(errbuf, "Cannot create the property list. \n");
+      H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Call HE5_PTlevelinfo() */
+  /* ---------------------- */
+  status = HE5_PTlevelinfo(pointID, level, &dtsinfo);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the level information. \n");
+      H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Get the dataset size */
+  /* -------------------- */
+  datasize = (hsize_t)(dtsinfo.datasize);   
+  
+  /* Set the buffer */
+  /* -------------- */
+  status = H5Pset_buffer(xfer_list, datasize, NULL, NULL);  
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot set the read buffer. \n");
+      H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+   
+  nflds = dtsinfo.nfields;
+
+  /* Check that field does exist */
+  /* --------------------------- */
+  if (HE5_PTfexist(dataID, fieldname, NULL, NULL, NULL, NULL) != 1)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Field: \"%s\" does not exist.\n",  fieldname);
+      H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf );
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Find index of fieldname in the compound datatype */
+  /* ------------------------------------------------ */
+  for( i = 0; i < nflds; i++ )
+    {
+      result  = strcmp(fieldname,dtsinfo.fieldname[i]);
+      if( result == 0 ) 
+	{
+	  ii = i;
+	  result = 99;
+	}    
+    } 
+  i = ii;
+
+  /* Calculate the data size of the field */
+  /* ------------------------------------ */
+
+  rank = dtsinfo.rank[i];
+
+  field_size = 1;
+  for( j=0; j < rank; j++ )
+    field_size = (int)(field_size*dtsinfo.dims[i][j]);
+
+
+  mtype = HE5_EHdtype2mtype(dtype);
+
+  datatype_size     = H5Tget_size(mtype);
+
+  field_size = field_size*((int)datatype_size);
+
+  /* Create Compound datatype */
+  /* ------------------------ */
+  typeID = H5Tcreate(H5T_COMPOUND, field_size);   /* field_size is size of the entire field  */
+  if (typeID == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot create the compound data type.\n");
+      H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  /* Add members of a compound datatype to read */
+  /* ------------------------------------------ */
+
+  /* Check if the member is an array */
+  /* ------------------------------- */
+  if ( dtsinfo.array[i] == TRUE)
+    {
+		  
+      for (j = 0; j < dtsinfo.rank[i]; j++)
+	dims[j] = (hsize_t)(dtsinfo.dims[i][j]);
+
+
+      /* Create array datatype */
+      /* --------------------- */
+      arr_id = H5Tarray_create(dtype, dtsinfo.rank[i], (const hsize_t *)dims, NULL);  
+      if (arr_id == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create \"array\" datatype. \n");
+	  H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Add array field */
+      /* --------------- */
+      status = H5Tinsert(typeID, dtsinfo.fieldname[i], 0, arr_id);                  
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot insert \"array\" element. \n");
+	  H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      /* Release the data type ID */
+      /* ------------------------ */
+      status = H5Tclose(arr_id);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot release data type ID. \n");
+	  H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  else 
+    {
+      status = H5Tinsert(typeID, dtsinfo.fieldname[i], 0,dtype);
+      /* Add atomic field */
+      /* ---------------- */
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot insert \"array\" element. \n");
+	  H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+    }
+ 
+  /* Release pointers to the name buffers */
+  /* ------------------------------------ */
+
+  for (i = 0; i < dtsinfo.nfields; i++)
+    {
+      if (dtsinfo.fieldname[i] != NULL) 
+	free(dtsinfo.fieldname[i]);
+    }
+
+  /* Read out the level fields */
+  /* ------------------------- */
+  status = H5Dread(dataID, typeID, H5S_ALL, H5S_ALL, xfer_list, datbuf);      
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot read the level dataset. \n");
+      H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Release the property list ID */
+  /* ---------------------------- */
+  status = H5Pclose(xfer_list);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the property list ID. \n");
+      H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Release the datatype ID */
+  /* ----------------------- */
+  status = H5Tclose(typeID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the data type ID.\n");
+      H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return (status);
+}
+
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTwritelevelF   (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Writes full records to a level.                               |
+|               Writes only one field at a time.                              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|  fieldname      char                Name of field                           |
+|  count[]        long                Number of records to write              |
+|  ntype          int                 HDF numbertype of field datatype        |
+|  data           void                data buffer                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|      None                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date        Programmer    Description                                     |
+|  ==========   ============  =============================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_PTwritelevelF(int pointID, int level, long count[], char *fieldname, int ntype, void *data)
+{
+  herr_t            status = FAIL;/* routine return status variable */
+
+  int               ret    = FAIL;/* (int) return status variable   */
+
+  hid_t             ptID   = FAIL;
+  hid_t             dtype  = FAIL;/* HDF5 type  data type ID        */            
+
+  hsize_t           count_t1[1] = {0};
+
+  char              *errbuf = (char *)NULL;/*Error message buffer   */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTcloseF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtype = HE5_EHconvdatatype(ntype);
+  /* 
+     if ntype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use ntype itself
+  */
+  if(dtype == FAIL)
+    {
+      dtype = ntype;
+    }
+
+  ptID           = (hid_t)pointID;
+  count_t1[0]    = (hsize_t)count[0]; 
+
+  /*   WRITE data   */
+  /*   ----------   */
+  status = HE5_PTwritelevel_f(ptID, level, count_t1, fieldname, ntype, dtype, data);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot write updated data to the level. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTwritelevel_f                                               |
+|                                                                             |
+|  DESCRIPTION: Writes full records to a level.                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|  count[]        hsize_t             Number of records to write              |
+|  fieldname      char                Name of field                           |
+|  ntype          int                 HDF numbertype of field datatype        |
+|  dtype          hid_t               datatype ID of field                    |
+|  data           void                data buffer                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|      None                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date        Programmer    Description                                     |
+|  ==========   ============  =============================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t 
+HE5_PTwritelevel_f(hid_t pointID, int level, hsize_t count[], char *fieldname, int ntype, hid_t dtype, void *data)
+{
+  herr_t         status    = FAIL;/* routine return status variable   */
+
+  int            nlevels   = FAIL;/* Number of levels in point        */
+  int            i,j;             /* Loop index                       */
+  int            ii        = 0;
+  int            nflds     = 0;
+  int            result    = 99;
+  int            datatype_size = 0;
+  int            field_size    = 0;
+  int            rank          = 0;
+  int            err_xfer      = FALSE;
+
+  hid_t          fid       = FAIL;/* HDF-EOS file ID                  */
+  hid_t          gid       = FAIL;/* POINTS group ID                  */
+  hid_t          dataID    = FAIL;/* dataset ID                       */
+  hid_t          typeID    = FAIL;/* data type ID                     */
+  hid_t          xfer_list = FAIL;/* Property list  ID                */ 
+
+  hid_t          arr_id    = FAIL;/* Array datatype ID                  */
+
+  long           idx       = FAIL;/* Point index                      */
+
+  size_t         orig_size = 0;
+
+  hssize_t       nrec      = FAIL;/* Current number of records        */
+  hsize_t        dims[HE5_DTSETRANKMAX];/* Array of dimension sizes   */
+  hsize_t        orig_size_t = 0;
+
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  HE5_CmpDTSinfo infolevel;   /*  Level information data structure  */
+
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTwritelevel_f", &fid, &gid, &idx);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Checking for file ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get the current number of records */
+  /* --------------------------------- */
+  status = HE5_PTwritesetup(pointID, level, &nrec);
+  if(status == FAIL)
+    {
+      sprintf(errbuf, "Cannot retrieve the current number of records\n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get number of levels */
+  /* -------------------- */
+  nlevels = HE5_PTnlevels(pointID);
+  if(nlevels == FAIL)
+    {
+      sprintf(errbuf, "Cannot retrieve the number of levels\n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Report error if no levels (dataset) defined */
+  /* ------------------------------------------- */
+  if (nlevels == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID);
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  else if (nlevels < level)
+    {
+      /* Report error if level # to large */
+      /* -------------------------------- */
+      status = FAIL;
+      sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID);
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get the level dataset ID  */
+  /* ------------------------- */
+  dataID = HE5_PTXPoint[idx].level[level].ID;
+
+  /* Extend the dataset size */
+  /* ----------------------- */
+  status = H5Dextend(dataID, count);   
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot extend the  dataset. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get the datatype ID */
+  /* ------------------- */
+  typeID = H5Dget_type(dataID);   /*  need to get the size of the orig compound datatype  */
+
+  orig_size = H5Tget_size(typeID);
+
+  status = H5Tclose(typeID);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release data type ID. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    } 
+
+  status = HE5_PTlevelinfo(pointID, level, &infolevel);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the level information. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Check that field does exist */
+  /* --------------------------- */
+
+  if (HE5_PTfexist(dataID, fieldname, NULL, NULL, NULL, NULL) != 1)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Field: \"%s\" does not exist.\n",  fieldname);
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf );
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Find index of fieldname in the compound datatype */
+  /* ------------------------------------------------ */
+  nflds = infolevel.nfields;
+  for( i = 0; i < nflds; i++ )
+    {
+      result  = strcmp(fieldname,infolevel.fieldname[i]);
+      if( result == 0 ) 
+	{
+	  ii = i;
+	  result = 99;
+	}    
+    }
+ 
+  i = ii;
+
+
+  /* Calculate the data size of the field */
+  /* ------------------------------------ */
+  rank = infolevel.rank[i];
+
+  field_size = 1;
+  for( j=0; j < rank; j++ )
+    field_size = (int)(field_size*infolevel.dims[i][j]);
+
+  switch( ntype )
+    {
+    case HE5T_NATIVE_INT:
+      {	datatype_size = sizeof(int); }
+      break;  
+    case HE5T_NATIVE_FLOAT:
+      {	datatype_size = sizeof(float); }
+      break;  
+    case HE5T_NATIVE_DOUBLE:
+      {	datatype_size = sizeof(double); }
+      break;  
+    case HE5T_NATIVE_CHAR:
+      {	datatype_size = sizeof(char); }
+      break;  
+    case HE5T_NATIVE_LONG:
+      {	datatype_size = sizeof(long); }
+      break;  
+    default:
+      break;  
+    }
+
+  field_size = field_size*datatype_size;
+
+  /* Create Compound datatype */
+  /* ------------------------ */
+  typeID = H5Tcreate(H5T_COMPOUND, field_size);     /*  field_size is size of the entire field  */
+  if (typeID == FAIL)
+    {
+      sprintf(errbuf, "Cannot get data type ID. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Add members to the compound data type */
+  /* ------------------------------------- */
+
+  /* Check if the field is an array */
+  /* ------------------------------ */
+  if (infolevel.array[i] == TRUE)
+    {
+      for (j = 0; j < infolevel.rank[i]; j++)
+	dims[j] = (hsize_t)infolevel.dims[i][j];
+		  
+      /* Create array datatypes */
+      /* ---------------------- */
+      arr_id = H5Tarray_create(dtype, infolevel.rank[i], (const hsize_t *)dims, NULL);
+      if (arr_id == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create \"array\" datatype. \n");
+	  H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Add array field */
+      /* --------------- */
+      status = H5Tinsert(typeID,infolevel.fieldname[i], 0, arr_id);    
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot insert \"array\" element. \n");
+	  H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      /* Release the data type ID */
+      /* ------------------------ */
+      status = H5Tclose(arr_id);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot release data type ID. \n");
+	  H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	} 
+    }
+  else 
+    {
+      /* Add atomic field */
+      /* ---------------- */
+      status = H5Tinsert(typeID,infolevel.fieldname[i], 0,dtype);      
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot insert \"array\" element. \n");
+	  H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+
+
+  /* Release pointers to the name buffers */
+  /* ------------------------------------ */
+  for (j = 0; j < infolevel.nfields; j++)
+    {
+      if (infolevel.fieldname[j] != NULL) 
+	free(infolevel.fieldname[j]);
+    }
+	  
+  /* Create the property list */
+  /* ------------------------ */
+  xfer_list = H5Pcreate(H5P_DATASET_XFER);
+  if (xfer_list == FAIL)
+    {
+      sprintf(errbuf, "Cannot create the property list ID. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Set type conversion and background buffer */
+  /* ----------------------------------------- */
+  orig_size_t = (hsize_t)orig_size;
+  status = H5Pset_buffer(xfer_list, orig_size_t, NULL, NULL);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot set type conversion and background buffer. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Preserve partially initialized fields to the compound datatypes */
+  /* --------------------------------------------------------------- */
+  err_xfer = H5Pget_preserve(xfer_list);
+  if (err_xfer == FAIL)
+    {
+      sprintf(errbuf, "Cannot get X-fer property list ID. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  err_xfer = H5Pset_preserve(xfer_list, 1);
+  if (err_xfer == FAIL)
+    {
+      sprintf(errbuf, "Cannot set X-fer property list ID. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  err_xfer = H5Pget_preserve(xfer_list);
+  if (err_xfer == FAIL)
+    {
+      sprintf(errbuf, "Cannot get X-fer property list ID. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Write data to the dataset */
+  /* ------------------------- */
+  status = H5Dwrite(dataID, typeID, H5S_ALL, H5S_ALL, xfer_list, data);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot write data to the dataset. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+  /* Release data type ID */
+  /* -------------------- */
+  status = H5Tclose(typeID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the data type ID. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Release property list ID */
+  /* ------------------------ */
+  status = H5Pclose(xfer_list);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the property list ID. \n");
+      H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  return (status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTwrbckptrF   (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Writes back pointer records                                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  level          int                 level index (0 - based)                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_PTwrbckptrF(int pointID, int level)
+{
+  int             ret    = FAIL;/* (int) Return status variable   */
+
+  herr_t          status = FAIL;/* routine return status variable */    
+   
+  hid_t           PointID = FAIL;/* HDF5 type point ID            */
+
+  char            *errbuf = (char *)NULL;/*Error message buffer   */
+
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTwrbckptrF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  PointID = (hid_t)pointID;
+
+  status = HE5_PTwrbckptr(PointID, level);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot write back pointer records. \n");
+      H5Epush(__FILE__, "HE5_PTwrbckptrF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTwrfwdptrF   (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Write foward pointer records                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  level          int                 level index (0 - based)                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_PTwrfwdptrF(int pointID, int level)
+{
+  int             ret    = FAIL;/* (int) Return status variable   */
+
+  herr_t          status = FAIL;/* routine return status variable */    
+   
+  hid_t           PointID = FAIL;/* HDF5 type point ID            */
+
+  char            *errbuf = (char *)NULL;/*Error message buffer   */
+
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTwrfwdptrF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  PointID = (hid_t)pointID;
+
+  status = HE5_PTwrfwdptr(PointID, level - 1);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot write back pointer records. \n");
+      H5Epush(__FILE__, "HE5_PTwrfwdptrF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTupdatelevelF   (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION: Updates the specified field and records of a level.           |
+|               Only updates one field at a time.                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|  fieldlist      char                fieldlist (of one field)                |
+|  nrec           long                number of records to update             |
+|  recs[]         long                array of record numbers to update       |
+|  ntype          int                 HDF numbertype of field datatype        |
+|  data           void                data buffer                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  Date     Programmer    Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_PTupdatelevelF(int pointID, int level, char *fieldlist, long nrec,  long recs[], int ntype, void *data)
+{
+  herr_t            status  = FAIL;
+
+  hid_t             PointID = FAIL;
+  hid_t             dtype   = FAIL;     /* HDF5 type  data type ID        */            
+
+  hsize_t           nrec_t  = 0;
+
+  hssize_t          *recs_t;
+
+  int               i;
+  int               ret     = FAIL;
+
+  char              *errbuf = (char *)NULL;/*Error message buffer   */
+
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTcloseF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(ret);
+    }
+
+  dtype   = HE5_EHconvdatatype(ntype);
+  /* 
+     if ntype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use ntype itself
+  */
+  if(dtype == FAIL)
+    {
+      dtype = ntype;
+    }
+
+  PointID = (hid_t)pointID;
+  nrec_t  = (hsize_t)nrec;
+
+  recs_t = (hssize_t *)calloc(nrec, sizeof(hssize_t));
+
+  for( i = 0; i < nrec; i++ )
+    recs_t[i] = (hssize_t)recs[i];
+  
+
+  /* Call HE5_PTupdatelevel_f() */
+  /* -------------------------- */ 
+  status = HE5_PTupdatelevel_f(PointID, level, fieldlist, nrec_t, recs_t, ntype, dtype, data);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Trouble calling HE5_PTupdatelevel_f(). \n");
+      H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (recs_t != NULL) free(recs_t);
+    }
+  
+  free(errbuf);
+  if (recs_t != NULL) free(recs_t);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTupdatelevel_f                                              |
+|                                                                             |
+|  DESCRIPTION: Updates the specified field and records of a level.           |
+|               Only updates one field at a time.                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|  fieldlist      char                fieldlist (of one field)                |
+|  nrec           hsize_t             Number of records to update             |
+|  recs[]         hssize_t            array of record numbers to update       |
+|  ntype          int                 HDF numbertype of field datatype        |
+|  dtype          hid_t               datatype ID of field                    |
+|  data           void                data buffer                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  Date     Programmer    Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t  
+HE5_PTupdatelevel_f(hid_t pointID, int level, char *fieldlist, hsize_t nrec,  hssize_t recs[], int ntype, hid_t dtype, void *data)
+{
+  herr_t            status    = FAIL;/* routine return status variable    */
+
+  int               j;               /* Loop index                        */
+  int               nlevels   =  0;  /* Number of levels in point         */
+  int               rank      =  1;  /* Rank of compound dataset          */
+  int               ii        =  0;
+  int               nflds     =  0;
+  int               result    = 99;
+  int               datatype_size = 0;
+  int               field_size    = 0;
+  int               field_rank    = 0;
+  int               err_xfer  = FALSE;
+
+  long              i;  	     /* Loop index                        */
+  long              idx       = FAIL;/* Point index                       */
+  long              nfields   =  0;  /* Number of fields in fieldlist     */
+  long              dum       = FAIL;/* Dummy variable                    */
+
+  hid_t             fid       = FAIL;/* HDF-EOS file ID                   */
+  hid_t             gid       = FAIL;/* "POINTS" group ID                 */
+  hid_t             dataID    = FAIL;/* Dataset ID                        */
+  hid_t             dspace    = FAIL;/* Disk data space ID                */
+  hid_t             mspace    = FAIL;/* Memory data space ID              */
+  hid_t             typeID    = FAIL;/* Data type ID                      */
+  hid_t             arr_id    = FAIL;/* Array datatype ID                 */
+  hid_t             xfer_list = FAIL;/* Property list  ID                 */ 
+  
+  hsize_t           nallrec   = 0;   /* Number of records in  Point       */
+  hsize_t           dims_1[1] = {0}; /* member dimensions in  dataset     */
+  hsize_t           *coord    = NULL;/* Coordinates of elemnts to update  */
+  hsize_t           dims[HE5_DTSETRANKMAX];/* Array of dimension sizes    */
+  hsize_t           orig_size_t = 0;
+  
+  size_t            orig_size = 0;
+  size_t            slen[HE5_HDFE_DIMBUFSIZE];  /* String length array   */
+
+  char              *fieldname = (char *)NULL;  /* Field name buffer     */       
+  char              utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer        */
+  char              *pntr[HE5_HDFE_DIMBUFSIZE];	/* String pointer array  */
+  char              errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  HE5_CmpDTSinfo    info;      /* Structure with the dataset information */
+  HE5_CmpDTSinfo    infolevel; /*  Level information data structure  */
+
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTupdatelevel_f", &fid, &gid, &idx);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Checking for point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get number of levels */
+  /* -------------------- */
+  nlevels = HE5_PTnlevels(pointID);
+  if (nlevels == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "No Levels Defined for point.\n");
+      H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  else if (nlevels < level)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Only %d levels defined for the point. \n", nlevels);
+      H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+	
+  /* Get dataset ID */
+  /* -------------- */
+  dataID = HE5_PTXPoint[idx].level[level].ID;
+
+  /* Initialize slen[] array */
+  /* ----------------------- */
+  for (j = 0; j < HE5_HDFE_DIMBUFSIZE; j++)
+    slen[ j ] = 0;
+  
+  /* Parse field list */
+  /* ---------------- */
+  nfields = HE5_EHparsestr(fieldlist, ',', pntr, slen);
+  if( nfields != 1 ) 
+    { 
+      status = FAIL;
+      sprintf(errbuf, "Should be only one field specified in fieldlist...nfields is not equal to 1 \n");
+      H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  else
+    {
+      fieldname = (char *)calloc(HE5_HDFE_NAMBUFSIZE,sizeof(char));
+      memmove(utlbuf, pntr[0], slen[0]);
+      utlbuf[slen[0]]       = '\0';             
+      memmove(fieldname, utlbuf, slen[0]+1);  
+    }
+
+  /* Check that all fields in list exist in level */
+  /* -------------------------------------------- */
+  for (i = 0; i < nfields; i++)
+    {
+      memmove(utlbuf, pntr[i], slen[i]);
+      utlbuf[slen[i]] = 0;
+      if (HE5_PTfexist(dataID, utlbuf, NULL, NULL, NULL, NULL) != 1)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Field: \"%s\" does not exist.\n",  utlbuf);
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf );
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (fieldname != NULL) free(fieldname);
+	  return(status);
+	}
+    }
+  
+  /* Check input records to update */
+  /* ----------------------------- */
+  if( nrec == 0 || recs == NULL )
+    {
+      /* Get neumber of records in level */
+      /* ------------------------------- */
+      nallrec = HE5_PTnrecs(pointID, level);
+      if (nallrec == 0)
+	{
+	  sprintf(errbuf, "Cannot retrieve number of records in Point. \n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (fieldname != NULL) free(fieldname);
+	  return(FAIL);
+	}
+
+      /* Call HE5_PTlevelinfo() */
+      /* ---------------------- */
+      status = HE5_PTlevelinfo(pointID, level, &info);
+      if (status == FAIL)
+        {
+          sprintf(errbuf, "Cannot get the level information. \n");
+          H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (fieldname != NULL) free(fieldname);
+          return(FAIL);
+        }
+
+      /* Release pointers to the name buffers */
+      /* ------------------------------------ */
+      for (j = 0; j < info.nfields; j++)
+	{
+	  if (info.fieldname[j] != NULL) 
+	    free(info.fieldname[j]);
+	}
+	  
+      /* Update all records in level */
+      /* --------------------------- */
+
+      /* USE "writelevel_f" routine which works on ONE FIELD at a time */
+      /* ------------------------------------------------------------- */
+      status = HE5_PTwritelevel_f(pointID, level, &nallrec, fieldname, ntype, dtype, data);   
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write updated data to the level. \n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (fieldname != NULL) free(fieldname);
+	  return(FAIL);
+	}
+	  
+      if (fieldname != NULL) free(fieldname);
+
+    }
+  else if( nrec > 0 && recs != NULL )
+    {
+      /* Get dataset space and datatype */
+      /* ------------------------------ */
+      dspace = H5Dget_space(dataID);
+      if (dspace == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (fieldname != NULL) free(fieldname);
+	  return(FAIL);
+	}
+	  
+
+      /* Get data type ID */
+      /* ---------------- */
+      typeID = H5Dget_type(dataID);
+      if (typeID == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the data type ID.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (fieldname != NULL) free(fieldname);
+	  return(FAIL);
+	}
+
+      /* Get the size of the original compound datatype */
+      /* ---------------------------------------------- */
+      orig_size = H5Tget_size(typeID);      
+      status    = H5Tclose(typeID);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the data type ID.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (fieldname != NULL) free(fieldname);
+	  return(FAIL);
+	}
+
+      status = HE5_PTlevelinfo(pointID, level, &infolevel);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the level information. \n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (fieldname != NULL) free(fieldname);
+	  return(FAIL);
+	}
+
+      /* Check that field does exist */
+      /* --------------------------- */
+      if (HE5_PTfexist(dataID, fieldname, NULL, NULL, NULL, NULL) != 1)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Field: \"%s\" does not exist.\n",  fieldname);
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf );
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (fieldname != NULL) free(fieldname);
+	  return(status);
+	}
+
+      /* Find index of fieldname in the compound datatype */
+      /* ------------------------------------------------ */
+      nflds = infolevel.nfields;
+      for( i = 0; i < nflds; i++ )
+	{
+	  result  = strcmp(fieldname,infolevel.fieldname[i]);
+	  if( result == 0 ) 
+	    {
+	      ii = (int)i;
+	      result = 99;
+	    }    
+	} 
+      i = ii;
+
+      /* Calculate the data size of the field */
+      /* ------------------------------------ */
+      field_rank = infolevel.rank[i];
+
+      field_size = 1;
+      for( j=0; j < field_rank; j++ )
+	field_size = (int)(field_size*infolevel.dims[i][j]);
+
+      switch( ntype )
+	{
+	case HE5T_NATIVE_INT:
+	  {	datatype_size = sizeof(int); }
+	  break;  
+	case HE5T_NATIVE_FLOAT:
+	  {	datatype_size = sizeof(float); }
+	  break;  
+	case HE5T_NATIVE_DOUBLE:
+	  {	datatype_size = sizeof(double); }
+	  break;  
+	case HE5T_NATIVE_CHAR:
+	  {	datatype_size = sizeof(char); }
+	  break;  
+	case HE5T_NATIVE_LONG:
+	  {	datatype_size = sizeof(long); }
+	  break;  
+	default:
+	  break;  
+	}
+
+      field_size = field_size*datatype_size;
+
+      /* Create Compound datatype */
+      /* ------------------------ */
+      typeID = H5Tcreate(H5T_COMPOUND, field_size);     /*  field_size is size of the entire field  */
+      if (typeID == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get data type ID. \n");
+	  H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Free previously allocated space */
+      /* ------------------------------- */
+      if (fieldname != NULL) free(fieldname);
+	  
+      /* Add members to the compound data type */
+      /* ------------------------------------- */
+	  
+      /* Check if the field is an array */
+      /* ------------------------------ */
+      if (infolevel.array[i] == TRUE)
+	{
+	  for (j = 0; j < infolevel.rank[i]; j++)
+	    dims[j] = (hsize_t)infolevel.dims[i][j];
+
+	  /* Create array datatypes */
+	  /* ---------------------- */
+	  arr_id = H5Tarray_create(dtype, infolevel.rank[i], (const hsize_t *)dims, NULL);   
+	  if (arr_id == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot create \"array\" datatype. \n");
+	      H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  /* Add array field */
+	  /* --------------- */
+	  status = H5Tinsert(typeID,infolevel.fieldname[i], 0, arr_id);  
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot insert \"array\" element. \n");
+	      H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  /* Release the data type ID */
+	  /* ------------------------ */
+	  status = H5Tclose(arr_id);
+	  if (status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot release data type ID. \n");
+	      H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    } 
+
+	}
+      else 
+	{
+	  /* Add atomic field */
+	  /* ---------------- */
+	  status = H5Tinsert(typeID,infolevel.fieldname[i], 0,dtype);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot insert \"array\" element. \n");
+	      H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	}
+	  
+      /* Release pointers to the name buffers */
+      /* ------------------------------------ */
+      for (j = 0; j < infolevel.nfields; j++)
+	{
+	  if (infolevel.fieldname[j] != NULL) 
+	    free(infolevel.fieldname[j]);
+	}
+
+      /* Preserve partially initialized fields of the compound datatypes */
+      /* --------------------------------------------------------------- */
+
+      /* Create the property list */
+      /* ------------------------ */
+
+      xfer_list = H5Pcreate(H5P_DATASET_XFER);
+      if (xfer_list == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create the property list ID. \n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Set type conversion and background buffer */
+      /* ----------------------------------------- */
+      orig_size_t  = (hsize_t)orig_size;
+      status = H5Pset_buffer(xfer_list, orig_size_t, NULL, NULL);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set type conversion and background buffer. \n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      err_xfer = H5Pget_preserve(xfer_list);
+      if (err_xfer == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get X-fer property list ID. \n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      err_xfer = H5Pset_preserve(xfer_list, 1);
+      if (err_xfer == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set X-fer property list ID. \n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      err_xfer = H5Pget_preserve(xfer_list);
+      if (err_xfer == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get X-fer property list ID. \n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      dims_1[0] = nrec;
+	  
+      /* Create the memory data space */
+      /* ---------------------------- */
+      mspace = H5Screate_simple(rank, dims_1, NULL);
+      if (mspace == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create the data space.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  
+	  return(FAIL);
+	}
+
+	  
+      /* Allocate memory */
+      /* --------------- */
+      coord = (hsize_t *)calloc(nrec, sizeof(hsize_t));
+      if (coord == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory. \n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	   
+      /* Loop through all records to update */
+      /* ---------------------------------- */
+      for (i = 0; i < nrec; i++)
+	coord[i] = (hsize_t)recs[i];
+
+      /* Select elements to update */
+      /* ------------------------- */
+      status = H5Sselect_elements(dspace, H5S_SELECT_SET, nrec, (const hsize_t *)coord);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot select elements.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(coord);
+	  return(FAIL);
+	}
+
+      /* Update selected records */
+      /* ----------------------- */
+      status = H5Dwrite(dataID, typeID, mspace, dspace, xfer_list, data);     
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write data to the dataset.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(coord);
+	  return(FAIL);
+	}
+
+      /* Release memory */
+      /* -------------- */
+      free(coord);
+
+      /* Release data space ID */
+      /* --------------------- */
+      status = H5Sclose(mspace);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Release data  type ID */
+      /* --------------------- */
+      status = H5Tclose(typeID);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the data type ID.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Release data space ID */
+      /* --------------------- */
+      status = H5Sclose(dspace);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+
+
+  /* Update Pointers to Previous Level */
+  /* -------------------------------- */
+  if (level > 0)
+    {
+      /* Store back linkage field in utlbuf */
+      /* ---------------------------------- */
+      status = HE5_PTbcklinkinfo(pointID, level, utlbuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get backward linkage information.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Check whether back linkage field is in fieldlist */
+      /* ------------------------------------------------ */
+      dum = HE5_EHstrwithin(utlbuf, fieldlist, ',');
+      if (dum != FAIL)
+	{
+	  /* Back pointers to previous level */
+	  /* ------------------------------- */
+	  status = HE5_PTwrbckptr(pointID, level);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot write backward pointer.\n");
+	      H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  /* Forward pointers from previous level */
+	  /* ------------------------------------ */
+	  status = HE5_PTwrfwdptr(pointID, level - 1);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot write forward pointer.\n");
+	      H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	}
+	  
+    }
+  
+  
+  /* Update Pointers to Next Level */
+  /* ---------------------------- */
+  if (level < HE5_PTnlevels(pointID) - 1 && dum != FAIL)
+    {
+      /* Store forward linkage field in utlbuf */
+      /* ------------------------------------- */
+      status = HE5_PTfwdlinkinfo(pointID, level, utlbuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get forward linkage information.\n");
+	  H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Check whether forward linkage field is in fieldlist */
+      /* --------------------------------------------------- */
+      dum = HE5_EHstrwithin(utlbuf, fieldlist, ',');
+      if (dum != FAIL)
+	{
+	  /* Back pointers from next level */
+	  /* ----------------------------- */
+	  status = HE5_PTwrbckptr(pointID, level + 1);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot write backward pointer.\n");
+	      H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+		  
+	  /* Forward pointers to next level */
+	  /* ------------------------------ */
+	  status = HE5_PTwrfwdptr(pointID, level);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot write forward pointer.\n");
+	      H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	}
+	  
+    }
+	
+  return(status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTwriteattrF   (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  attrname       char                attribute name                          |
+|  ntype          int                 attribute HDF numbertype                |
+|  fortcount      long                Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_PTwriteattrF(int pointID, const char *attrname, int ntype, long fortcount[], void *datbuf)
+{
+
+  int       ret     = FAIL;/* int return status variable                 */
+  int       rank    = 1;   /* Note: It is assumed that fortcout has just */
+  /* one element to agree with EHattr function  */
+  int	    i;             /* Loop index                                 */
+
+  hid_t     PointID    = FAIL;/* HDF-EOS Swath ID                        */
+  hid_t     numbertype = FAIL;/* HDF5 data type ID                       */ 
+
+  herr_t    status     = FAIL;/* routine return status variable          */
+  
+  hsize_t   *count = (hsize_t *)NULL; /* Pointer to count array (C order)*/
+    
+  char      *errbuf = (char *)NULL;   /* error message buffer            */
+  char      *tempbuf = (char *)NULL;  /* temp buffer                     */
+ 
+
+  numbertype = HE5_EHconvdatatype(ntype);
+  if(numbertype == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_PTwriteattrF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Error calling HE5_EHconvdatatype() from FORTRAN wrapper.");
+      HE5_EHprint("Error: Error calling HE5_EHconvdatatype() from FORTRAN wrapper, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate memory for error message buffers */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTwriteattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate memory for "count" array */  
+  count = (hsize_t *)calloc(rank, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_PTwriteattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < rank; i++)
+    count[i] = (hsize_t)fortcount[rank - 1 - i];
+  
+  PointID = (hid_t)pointID;
+
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_PTwriteattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n");
+	  H5Epush(__FILE__, "HE5_PTwriteattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+ 
+      /* Call PTwriteattr() */
+      /* ------------------ */
+      status = HE5_PTwriteattr(PointID, attrname, numbertype, count, tempbuf);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname);
+	  H5Epush(__FILE__, "HE5_PTwriteattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  free(tempbuf);
+	  return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    { 
+      /* Call PTwriteattr() */
+      /* ------------------ */
+      status = HE5_PTwriteattr(PointID, attrname, numbertype, count, datbuf);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname);
+	  H5Epush(__FILE__, "HE5_PTwriteattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+  
+      free(count);
+      free(errbuf);
+    }
+
+  ret = (int)status;
+  return(ret);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTwritegrpattrF   (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION:   Writes/updates attribute associated with the "Data"  group  |
+|                     in a point.                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  attrname       char                attribute name                          |
+|  ntype          int                 attribute HDF numbertype                |
+|  fortcount      long                Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_PTwritegrpattrF(int pointID, const char *attrname, int ntype, long fortcount[], void * datbuf)
+{
+  int          ret        = FAIL;        /* (int) return status variable      */
+  int	       rank       = 1;           /* Rank variable                     */
+  int	       i;                        /* Loop index                        */
+
+  herr_t       status     = FAIL;        /* routine return status variable    */
+  
+  hid_t        PointID    = FAIL;        /* HDF5 type Swath ID                */
+  hid_t        numbertype = FAIL;        /* HDF5 data type ID                 */
+             
+  hsize_t      *count  = (hsize_t *)NULL;/* Pointer to count array (C order)  */
+  
+  char         *errbuf = (char *)NULL;   /* error message buffer              */
+  char         *tempbuf = (char *)NULL;  /* temp buffer                       */
+  
+    
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTwritegrpattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get HDF5 data type ID */
+  /* --------------------- */
+  numbertype = HE5_EHconvdatatype(ntype);
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID.\n");
+      H5Epush(__FILE__, "HE5_PTwritegrpattrF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+
+  count = (hsize_t *)calloc(rank, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_PTwritegrpattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < rank; i++)
+    count[i] = (hsize_t)fortcount[rank - 1 - i];  
+  
+  PointID = (hid_t)pointID;
+
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of group attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_PTwritegrpattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n");
+	  H5Epush(__FILE__, "HE5_PTwritegrpattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+ 
+      status = HE5_PTwritegrpattr(PointID, attrname, numbertype, count, tempbuf);
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write group attribute value.\n");
+          H5Epush(__FILE__, "HE5_PTwritegrpattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(errbuf);
+          free(count);
+          free(tempbuf);
+          return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    {
+      status = HE5_PTwritegrpattr(PointID, attrname, numbertype, count, datbuf);
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write group attribute value.\n");
+	  H5Epush(__FILE__, "HE5_PTwritegrpattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(errbuf);
+          free(count);
+          return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTwritelocattrF   (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION:   Writes/updates attribute associated with the a specified    |
+|                   level in a point.                                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  levelname      char                level name                              |
+|  attrname       char                attribute name                          |
+|  ntype          int                 attribute HDF numbertype                |
+|  fortcount      long                Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_PTwritelocattrF(int pointID, const char *levelname, const char *attrname, int ntype, long fortcount[],void * datbuf)
+{
+  int	       ret  = FAIL;             /* routine return status variable             */
+  int 	       rank = 1;                /* Note: It is assumed that fortcout has just */
+  /* one element to agree with EHattr function  */
+  int	       i      = 0;
+
+  herr_t       status = FAIL;           /* routine return status variable             */
+  
+  hsize_t      *count = (hsize_t *)NULL;/* Pointer to count array (C order)           */
+ 
+  hid_t        PointID    = FAIL;       /* Swath HDF5 type ID                         */   
+  hid_t        numbertype = FAIL;       /* HDF5 dta type ID                           */
+  
+  char         *errbuf = (char *)NULL;  /* error message buffer                       */
+  char         *tempbuf = (char *)NULL; /* temp buffer                                */
+  
+
+  /* Get HDF5 type data type ID */
+  /* -------------------------- */
+  numbertype = HE5_EHconvdatatype(ntype);
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 data type ID.\n");
+      H5Epush(__FILE__, "HE5_PTwritelocattrF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTwritelocattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  count = (hsize_t *)calloc(rank, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_PTwritelocattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < rank; i++)
+    count[i] = (hsize_t)fortcount[rank - 1 - i];
+  
+  PointID = (hid_t)pointID;
+
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of local attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_PTwritelocattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n");
+	  H5Epush(__FILE__, "HE5_PTwritelocattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+ 
+      /* Write local attribute buffer */
+      /* ---------------------------- */
+      status = HE5_PTwritelocattr(PointID, levelname, attrname, numbertype, count, tempbuf);   
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write local attribute value.\n");
+          H5Epush(__FILE__, "HE5_PTwritelocattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(count);
+          free(errbuf);
+          free(tempbuf);
+          return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    {
+      /* Write local attribute buffer */
+      /* ---------------------------- */
+      status = HE5_PTwritelocattr(PointID, levelname, attrname, numbertype, count, datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write local attribute value.\n");
+	  H5Epush(__FILE__, "HE5_PTwritelocattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(count);
+          free(errbuf);
+          return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+    }
+
+  ret = (int)status;
+  return(ret);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTreadattrF   (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from a point.                                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_PTreadattrF(int pointID, const char *attrname, void *datbuf)
+{
+  int         ret     = FAIL;/* routine return status variable  */
+
+  herr_t      status  = FAIL;/* routine return status variable  */
+
+  hid_t       PointID = FAIL;/* HDF-EOS point ID                */
+
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+  
+  PointID = (hid_t)pointID;
+
+  /* Read the attribute buffer */
+  /* ------------------------- */
+  status = HE5_PTreadattr(PointID, attrname, datbuf);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot read the attribute value. \n");
+      H5Epush(__FILE__, "HE5_PTreadattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTreadgrpattrF   (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with the "Data" group from a point.|
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_PTreadgrpattrF(int pointID, const char *attrname, void *datbuf)
+{
+  int         ret             = FAIL;   /* (int) return status      */
+
+  herr_t      status          = FAIL;   /* return status variable   */
+  
+  hid_t       PointID         = FAIL;   /* HDF5 type Point ID       */
+  
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];  /* Error message buffer */
+ 
+  PointID = (hid_t)pointID;
+
+  status = HE5_PTreadgrpattr(PointID,attrname,datbuf);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot read Group Attribute \"%s\".\n", attrname);
+      H5Epush(__FILE__, "HE5_PTreadgrpattr", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTreadlocattrF   (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with a specified level in a point. |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  levelname      char                level name                              |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_PTreadlocattrF(int pointID, const char *levelname, const char *attrname, void *datbuf)
+{
+  int         ret             =  FAIL;/* return status variable   */
+
+  herr_t      status          =  FAIL;/* return status variable   */
+
+  hid_t       PointID         =  FAIL;/* HDF5 type Point  ID      */
+  
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */
+
+
+  PointID = (hid_t)pointID;
+
+  status = HE5_PTreadlocattr( PointID, levelname, attrname, datbuf);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" level.\n", attrname,levelname);
+      H5Epush(__FILE__, "HE5_PTreadlocattr", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret  = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:  HE5_PTc2fort                                                    |
+|                                                                             |
+|  DESCRIPTION:   Translates a buffer in Fortran order into a buffer in       |
+|                 'C' order.                                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  dims[]         long                Dimensions of Fortran array             |
+|  rank           int                 Rank of Fortran array                   |
+|  datatype       int                 Datatype of Fortran array               |
+|  inputfortbuf   void                input data buffer (Fortran array)       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  outputfortbuf  void                output data buffer (Fortran array)      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date        Programmer    Description                                     |
+|  ==========   ============  =============================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static int
+HE5_PTc2fort(long dims[], int rank, int datatype, void *inputfortbuf, void *outputfortbuf)
+{
+  herr_t            status    = FAIL;/* routine return status variable */
+
+  int               ret       = FAIL;/* (int) return status variable   */
+  int               i         = 0;
+  int               dim_index = 0;
+
+  long              *c_index         = (long *)NULL;
+  long              *coeffs          = (long *)NULL;
+  long              *n1              = (long *)NULL;
+  long              *fort_order_buf  = (long *)NULL;
+  long              num_elements1    = 0;
+  long              num_elements2    = 0;
+
+  int               *databuf1_int       = (int *)NULL;     
+  int               *databuf2_int       = (int *)NULL;
+  float             *databuf1_float     = (float *)NULL;
+  float             *databuf2_float     = (float *)NULL;
+  double            *databuf1_double    = (double *)NULL;
+  double            *databuf2_double    = (double *)NULL;
+  char              *databuf1_char      = (char *)NULL;
+  char              *databuf2_char      = (char *)NULL;
+  long              *databuf1_long      = (long *)NULL;
+  long              *databuf2_long      = (long *)NULL;
+
+  char              *errbuf = (char *)NULL;/*Error message buffer   */
+
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTc2fort", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Calculate the number of elements in the array */
+  /* --------------------------------------------- */
+  num_elements1 = 1;
+  for( i=0; i < rank; i++ )
+    num_elements1 = dims[i]*num_elements1;
+
+  /* Set up arguments for call to HE5_PTgetfort_order() */
+  /* -------------------------------------------------- */
+  
+  /* Initialize c_index array */
+  /* ------------------------ */
+  c_index    = (long *) calloc(rank, sizeof(long));
+  for( i=0; i< rank; i++ )
+    c_index[i] = 0;
+
+  /* Initialize coeffs array */
+  /* ----------------------- */
+  coeffs    = (long *) calloc(rank, sizeof(long));
+  for( i=0; i< rank; i++ )
+    coeffs[i] = 0;
+  coeffs[0] = 1;
+
+  /* Initialize n1 variable */
+  /* ---------------------- */
+  n1 = (long *) calloc(1,sizeof(long));
+  *n1        = 0;
+
+  dim_index = 1;
+
+  /* Initialize fort_order_buf */
+  /* ------------------------- */
+  fort_order_buf  =  (long *) calloc(num_elements1,sizeof(long));
+
+
+  status = HE5_PTgetfort_order(dims, dim_index, c_index, rank, fort_order_buf, coeffs, n1);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Call to HE5_PTgetfort_order() failed.\n");
+      H5Epush(__FILE__, "HE5_PTc2fort", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(fort_order_buf);
+      return(status);
+    }
+
+  num_elements2 = *n1;
+
+  /* Check num_elements2 against num_elements1 */
+  /* ----------------------------------------- */
+  if( num_elements1 != num_elements2 )
+    {
+      sprintf(errbuf, "Error with number of elements processed by HE5_PTgetfort_order or HE5_ptc2fort.\n");
+      H5Epush(__FILE__, "HE5_PTc2fort", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(fort_order_buf);
+      return(FAIL);
+    }
+
+  switch( datatype )
+    {
+    case HE5T_NATIVE_INT:
+      {	
+	databuf1_int = (int *) calloc(num_elements1,sizeof(int));
+	memmove(databuf1_int,inputfortbuf,num_elements1*sizeof(int));  
+   
+	databuf2_int = (int *) calloc(num_elements1,sizeof(int));
+
+	/* Create the Fortran ordered buffer from the hash list */
+	/* and the C buffer                                     */
+	/* ---------------------------------------------------- */
+	for( i = 0; i < num_elements1; i++ )
+	  {
+	    databuf2_int[fort_order_buf[i]] = databuf1_int[i];  
+	  }
+
+	memmove(outputfortbuf,databuf2_int,num_elements1*sizeof(int)); 
+
+	free(databuf1_int);
+	free(databuf2_int);
+      }	
+      break;  
+
+    case HE5T_NATIVE_FLOAT:
+      {	
+	databuf1_float = (float *) calloc(num_elements1,sizeof(float));
+	memmove(databuf1_float,inputfortbuf,num_elements1*sizeof(float));  
+   
+	databuf2_float = (float *) calloc(num_elements1,sizeof(float));
+
+	/* Create the Fortran ordered buffer from the hash list */
+	/* and the C buffer                                     */
+	/* ---------------------------------------------------- */
+	for( i = 0; i < num_elements1; i++ )
+	  {
+	    databuf2_float[fort_order_buf[i]] = databuf1_float[i];  
+	  }
+
+	memmove(outputfortbuf,databuf2_float,num_elements1*sizeof(float)); 
+
+	free(databuf1_float);
+	free(databuf2_float);
+      }	
+      break;  
+
+    case HE5T_NATIVE_DOUBLE:
+      {
+	databuf1_double = (double *) calloc(num_elements1,sizeof(double));
+	memmove(databuf1_double,inputfortbuf,num_elements1*sizeof(double));  
+   
+	databuf2_double = (double *) calloc(num_elements1,sizeof(double));
+
+	/* Create the Fortran ordered buffer from the hash list */
+	/* and the C buffer                                     */
+	/* ---------------------------------------------------- */
+	for( i = 0; i < num_elements1; i++ )
+	  {
+	    databuf2_double[fort_order_buf[i]] = databuf1_double[i];  
+	  }
+
+	memmove(outputfortbuf,databuf2_double,num_elements1*sizeof(double)); 
+
+	free(databuf1_double);
+	free(databuf2_double);
+      }	
+      break;  
+
+    case HE5T_NATIVE_CHAR:
+      {	
+	databuf1_char = (char *) calloc(num_elements1,sizeof(char));
+	memmove(databuf1_char,inputfortbuf,num_elements1*sizeof(char));  
+   
+	databuf2_char = (char *) calloc(num_elements1,sizeof(char));
+
+	/* Create the Fortran ordered buffer from the hash list */
+	/* and the C buffer                                     */
+	/* ---------------------------------------------------- */
+	for( i = 0; i < num_elements1; i++ )
+	  {
+	    databuf2_char[fort_order_buf[i]] = databuf1_char[i];  
+	  }
+		
+	memmove(outputfortbuf,databuf2_char,num_elements1*sizeof(char)); 
+		
+	free(databuf1_char);
+	free(databuf2_char);
+      }	
+      break;  
+	  
+    case HE5T_NATIVE_LONG:
+      {	
+	databuf1_long = (long *) calloc(num_elements1,sizeof(long));
+	memmove(databuf1_long,inputfortbuf,num_elements1*sizeof(long));  
+		
+	databuf2_long = (long *) calloc(num_elements1,sizeof(long));
+
+	/* Create the Fortran ordered buffer from the hash list */
+	/* and the C buffer                                     */
+	/* ---------------------------------------------------- */
+	for( i = 0; i < num_elements1; i++ )
+	  {
+	    databuf2_long[fort_order_buf[i]] = databuf1_long[i];  
+	  }
+		
+	memmove(outputfortbuf,databuf2_long,num_elements1*sizeof(long)); 
+		
+	free(databuf1_long);
+	free(databuf2_long);
+      }	
+      break;  
+
+    default:
+      {
+	sprintf(errbuf, "Bad datatype value in call to HE5_PTc2fort. \n");
+	H5Epush(__FILE__, "HE5_PTc2fort", __LINE__,  H5E_ARGS, H5E_BADVALUE,errbuf);
+	HE5_EHprint(errbuf, __FILE__, __LINE__);
+	status = FAIL;
+      }
+      break;  
+    }
+
+  /* Free up space */
+  /* ------------- */ 
+  free(c_index);
+  free(coeffs);
+  free(n1);
+  free(fort_order_buf);
+  free(errbuf);
+  
+  status = 0;
+  ret = (int)status;   
+  
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:  HE5_PTfort2c                                                    |
+|                                                                             |
+|  DESCRIPTION:   Translates a buffer in Fortran order into a buffer in       |
+|                 'C' order.                                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  dims[]         long                Dimensions of Fortran array             |
+|  rank           int                 Rank of Fortran array                   |
+|  datatype       int                 Datatype of Fortran array               |
+|  inputfortbuf   void                input data buffer (Fortran array)       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  outputfortbuf  void                output data buffer (Fortran array)      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date        Programmer    Description                                     |
+|  ==========   ============  =============================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static int
+HE5_PTfort2c(long dims[], int rank, int datatype, void *inputfortbuf, void *outputfortbuf)
+{
+  herr_t            status    = FAIL;/* routine return status variable */
+
+  int               ret       = FAIL;/* (int) return status variable   */
+  int               i         = 0;
+  int               dim_index = 0;
+
+  long              *c_index         = (long *)NULL;
+  long              *coeffs          = (long *)NULL;
+  long              *n1              = (long *)NULL;
+  long              *fort_order_buf  = (long *)NULL;
+  long              num_elements1    = 0;
+  long              num_elements2    = 0;
+
+  int               *databuf1_int       = (int *)NULL;     
+  int               *databuf2_int       = (int *)NULL;
+  float             *databuf1_float     = (float *)NULL;
+  float             *databuf2_float     = (float *)NULL;
+  double            *databuf1_double    = (double *)NULL;
+  double            *databuf2_double    = (double *)NULL;
+  char              *databuf1_char      = (char *)NULL;
+  char              *databuf2_char      = (char *)NULL;
+  long              *databuf1_long      = (long *)NULL;
+  long              *databuf2_long      = (long *)NULL;
+
+  char              *errbuf = (char *)NULL;/*Error message buffer   */
+
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTfort2c", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Calculate the number of elements in the array */
+  /* --------------------------------------------- */
+  num_elements1 = 1;
+  for( i=0; i < rank; i++ )
+    {
+      num_elements1 = dims[i]*num_elements1;      
+    }
+  
+
+  /* Set up arguments for call to HE5_PTgetfort_order() */
+  /* -------------------------------------------------- */
+  
+  /* Initialize c_index array */
+  /* ------------------------ */
+  c_index    = (long *) calloc(rank, sizeof(long));
+  for( i=0; i< rank; i++ )
+    c_index[i] = 0;
+  
+  /* Initialize coeffs array */
+  /* ----------------------- */
+  coeffs    = (long *) calloc(rank, sizeof(long));
+  for( i=0; i< rank; i++ )
+    coeffs[i] = 0;
+  coeffs[0] = 1;
+  
+  /* Initialize n1 variable */
+  /* ---------------------- */
+  n1 = (long *) calloc(1,sizeof(long));
+  *n1        = 0;
+  
+  dim_index = 1;
+
+  /* Initialize fort_order_buf */
+  /* ------------------------- */
+  fort_order_buf  =  (long *) calloc(num_elements1,sizeof(long));
+  
+  status = HE5_PTgetfort_order(dims, dim_index, c_index, rank, fort_order_buf, coeffs, n1);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Call to HE5_PTgetfort_order() failed.\n");
+      H5Epush(__FILE__, "HE5_PTfort2c", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(fort_order_buf);
+      return(status);
+    }
+  
+  num_elements2 = *n1;
+  
+  /* Check num_elements2 against num_elements1 */
+  /* ----------------------------------------- */
+  if( num_elements1 != num_elements2 )
+    {
+      sprintf(errbuf, "Error with number of elements processed by HE5_PTgetfort_order or HE5_ptfort2c.\n");
+      H5Epush(__FILE__, "HE5_PTfort2c", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(fort_order_buf);
+      return(FAIL);
+    }
+  
+  switch( datatype )
+    {
+    case HE5T_NATIVE_INT:
+      {	
+	databuf1_int = (int *) calloc(num_elements1,sizeof(int));
+	memmove(databuf1_int,inputfortbuf,num_elements1*sizeof(int));  
+   
+	databuf2_int = (int *) calloc(num_elements1,sizeof(int));
+		
+	/* Create the c ordered buffer from the hash list */
+	/* ---------------------------------------------- */
+	for( i = 0; i < num_elements1; i++ )
+	  {
+	    databuf2_int[i] = databuf1_int[fort_order_buf[i]];
+	  }
+
+	memmove(outputfortbuf,databuf2_int,num_elements1*sizeof(int)); 
+		
+	free(databuf1_int);
+	free(databuf2_int);
+      }	
+      break;  
+	  
+    case HE5T_NATIVE_FLOAT:
+      {	
+	databuf1_float = (float *) calloc(num_elements1,sizeof(float));
+	memmove(databuf1_float,inputfortbuf,num_elements1*sizeof(float));  
+		
+	databuf2_float = (float *) calloc(num_elements1,sizeof(float));
+		
+	/* Create the c ordered buffer from the hash list */
+	/* ---------------------------------------------- */
+	for( i = 0; i < num_elements1; i++ )
+	  {
+	    databuf2_float[i] = databuf1_float[fort_order_buf[i]];
+	  }
+		
+	memmove(outputfortbuf,databuf2_float,num_elements1*sizeof(float)); 
+		
+	free(databuf1_float);
+	free(databuf2_float);
+      }	
+      break;  
+	  
+    case HE5T_NATIVE_DOUBLE:
+      {	
+	databuf1_double = (double *) calloc(num_elements1,sizeof(double));
+	memmove(databuf1_double,inputfortbuf,num_elements1*sizeof(double));  
+		
+	databuf2_double = (double *) calloc(num_elements1,sizeof(double));
+
+	/* Create the c ordered buffer from the hash list */
+	/* ---------------------------------------------- */
+	for( i = 0; i < num_elements1; i++ )
+	  {
+	    databuf2_double[i] = databuf1_double[fort_order_buf[i]];
+	  }
+		
+	memmove(outputfortbuf,databuf2_double,num_elements1*sizeof(double)); 
+		
+	free(databuf1_double);
+	free(databuf2_double);
+      }	
+      break;  
+	  
+    case HE5T_NATIVE_CHAR:
+      {	
+	databuf1_char = (char *) calloc(num_elements1,sizeof(char));
+	memmove(databuf1_char,inputfortbuf,num_elements1*sizeof(char));  
+		
+	databuf2_char = (char *) calloc(num_elements1,sizeof(char));
+
+	/* Create the c ordered buffer from the hash list */
+	/* ---------------------------------------------- */
+	for( i = 0; i < num_elements1; i++ )
+	  {
+	    databuf2_char[i] = databuf1_char[fort_order_buf[i]];
+	  }
+		
+	memmove(outputfortbuf,databuf2_char,num_elements1*sizeof(char)); 
+		
+	free(databuf1_char);
+	free(databuf2_char);
+      }	
+      break;  
+	  
+    case HE5T_NATIVE_LONG:
+      {	
+	databuf1_long = (long *) calloc(num_elements1,sizeof(long));
+	memmove(databuf1_long,inputfortbuf,num_elements1*sizeof(long));  
+		
+	databuf2_long = (long *) calloc(num_elements1,sizeof(long));
+		
+	/* Create the c ordered buffer from the hash list */
+	/* ---------------------------------------------- */
+	for( i = 0; i < num_elements1; i++ )
+	  {
+	    databuf2_long[i] = databuf1_long[fort_order_buf[i]];
+	  }
+		
+	memmove(outputfortbuf,databuf2_long,num_elements1*sizeof(long)); 
+		
+	free(databuf1_long);
+	free(databuf2_long);
+      }	
+      break;  
+	  
+	  
+    default:
+      {
+	sprintf(errbuf, "Bad datatype value in call to HE5_PTfort2c. \n");
+	H5Epush(__FILE__, "HE5_PTfort2c", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	HE5_EHprint(errbuf, __FILE__, __LINE__);
+	status = FAIL;
+      }
+      break;  
+    }
+  
+  /* Free up space */
+  /* ------------- */ 
+  free(c_index);
+  free(coeffs);
+  free(n1);
+  free(fort_order_buf);
+  free(errbuf);
+  
+  ret = (int)status;   
+  
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:  HE5_PTgetfort_order                                             |
+|                                                                             |
+|  DESCRIPTION:   Translates a buffer in Fortran order into a buffer in       |
+|                 'C' order.                                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  dims           long                Dimensions of Fortran array             |
+|  dim_index      int                 Current dimension in recursive iteration|
+|  c_index                            Changing coeffiencients in equation to  |
+|                                     calculate fortran order                 |
+|  rank           int                 Rank of Fortran array                   |
+|  coeffs         long                Constant coefficients in equation to    |
+|                                     calculate fortran order                 |
+|                                                                             |
+|  n              long                number of elements processed which      |
+|                                     will equal num_elemnts in array         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  P              long                buffer containing Fortran ordering      |
+|                                                                             |
+|  NOTES:    This program is called recursively, once for each of the         |
+|            dimensions in the fortran array. Values in c_index and coeffs    |
+|            are calculated during each of the recursive calls.   Values in   |
+|            P are calculated in the last recursive call.                     |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|   Date        Programmer    Description                                     |
+|  ==========   ============  =============================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static int
+HE5_PTgetfort_order(long *dims, int dim_index, long *c_index, int rank, long *P, long *coeffs, long *n)
+{
+  herr_t              status       = FAIL;/* routine return status variable */
+
+  int                 ret          = FAIL;/* (int) return status variable   */
+  int                 i            = 0;
+  int                 j            = 0;
+  int                 k            = 0;
+  int                 l            = 0;
+  int                 dim_index_tt = 0;
+
+  long                K1           = 0;
+  long                P1           = 0;
+
+  char                *errbuf = (char *)NULL;/*Error message buffer   */
+   
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTgetfort_order", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+   
+  K1  = 1;
+   
+  for( i = 0; i < dim_index; i++ )
+    {
+      K1 = dims[i]*K1;
+    }
+
+  if( dim_index < rank ) 
+    {
+      coeffs[dim_index] = K1;
+	   
+      dim_index_tt      =  dim_index;
+      dim_index         =  dim_index + 1;
+	   
+      for( k = 0; k < dims[dim_index_tt-1]; k++ )
+	{
+	  c_index[dim_index_tt-1] = k;
+	  status = HE5_PTgetfort_order( dims, dim_index, c_index, rank, P, coeffs, n);         
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Call to HE5_PTgetfort_order() failed.\n");
+	      H5Epush(__FILE__, "HE5_PTgetfort_order", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      return(status);
+	    }
+	}
+    }
+  else
+    {
+      for( l = 0; l < dims[dim_index-1]; l++ )
+	{
+	  P1 = 0;
+	  c_index[dim_index-1] = l;
+		   
+	  for( j = 0; j < rank ; j++ )
+	    {
+	      P1  =  (coeffs[j])*(c_index[j]) + P1;
+	    }         
+		   
+	  P[*n] = P1;
+	  *n = *n+1;
+	}
+    }
+   
+  free(errbuf);
+   
+  status = 0;
+  ret = (int)status;
+  return(ret);   
+}
+
+/* Inquiry routines */
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTnrecsF   (FORTRAN wrapper)                                 |
+|                                                                             |
+|  DESCRIPTION: Returns the number of records in a level.                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nallrec        int                 Number of records in level              |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_PTnrecsF(int pointID, int level)
+{ 
+  hid_t           PointID = FAIL;/* HDF5 type point ID            */
+
+  hsize_t         nallrec  = 0;   /* Number of records in  Point       */
+
+  char            *errbuf = (char *)NULL;/*Error message buffer   */
+
+  PointID = (hid_t)pointID;
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTnrecsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }  
+  
+  nallrec = HE5_PTnrecs(PointID, level);
+  if(nallrec == 0)
+    {
+      sprintf(errbuf, "No records in current level. \n");
+      H5Epush(__FILE__, "HE5_PTnrecsF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }	
+
+  free(errbuf);
+  return((int)nallrec);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTnlevelsF   (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Returns the number of levels in a point data set.             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nlevels        int                 Number of levels in point structure     |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int        	      point structure ID                      |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_PTnlevelsF(hid_t pointID)
+{
+  hid_t           PointID = FAIL;/* HDF5 type point ID            */
+
+  int             nlevels  = 0;  /* Number of levels in point     */
+
+  char            *errbuf = (char *)NULL;/*Error message buffer   */
+
+  PointID = (hid_t)pointID;
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTnlevelsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }  
+ 
+  /* Get number of levels */
+  /* -------------------- */
+  nlevels = HE5_PTnlevels(PointID);
+  if(nlevels == FAIL)
+    {
+      sprintf(errbuf, "Cannot retrieve the number of levels. \n");
+      H5Epush(__FILE__, "HE5_PTnlevelsF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  free(errbuf);
+  return((int)nlevels);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTnfieldsF   (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Returns number of fields defined in a level.                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfields        int                 Number of fields in a level             |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                String length of fieldlist              |
+|  fieldlist      char                Coma separated list of fields           |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date       Programmer   Description                                       |
+|  ========   ============  ================================================= |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_PTnfieldsF(int pointID, int level, char *fieldlist, long *strbufsize)
+{
+  hid_t           PointID  = FAIL;/* HDF5 type point ID            */
+
+  int             nfields  = 0;   /* Number of fields in the level of the point*/
+
+  char            *errbuf = (char *)NULL;/*Error message buffer   */
+
+  PointID = (hid_t)pointID;
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTnfieldsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }  
+ 
+  /* Get number of fields and fieldlist */
+  /* ---------------------------------- */
+  nfields = HE5_PTnfields(PointID, level, fieldlist, strbufsize);
+  if(nfields == 0)
+    {
+      sprintf(errbuf, "Cannot retrieve the number of fields. \n");
+      H5Epush(__FILE__, "HE5_PTnfieldsF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  free(errbuf);
+
+  return((int)nfields);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTlevelindxF   (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION: Returns index number for a named level.                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  n              int                 Level number (0 - based)                |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        in                  point structure ID                      |
+|  levelname      char                point level name                        |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_PTlevelindxF(int pointID, const char *levelname)
+{
+  hid_t           PointID = FAIL;/* HDF5 type point ID            */
+
+  int             index   = FAIL;          
+
+  char            *errbuf = (char *)NULL;/*Error message buffer   */
+
+  PointID = (hid_t)pointID;
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTlevelindxF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }  
+
+  PointID = (hid_t)pointID;
+
+  /* Get index of named Level           */
+  /* ---------------------------------- */
+  index = HE5_PTlevelindx(PointID, levelname);
+  if(index == FAIL)
+    {
+      sprintf(errbuf, "Cannot retrieve the Level Index. \n");
+      H5Epush(__FILE__, "HE5_PTlevelindxF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  free(errbuf);
+  return(index);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTgetlevelnameF   (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION: Returns level name                                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  levelname      char                Level name                              |
+|  strbufsize     long                String length of fieldlist              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_PTgetlevelnameF(int pointID, int  level, char *levelname, long *strbufsize)
+{
+  int             ret     = FAIL;
+
+  herr_t          status  = FAIL;/* routine return status variable */
+
+  hid_t           PointID = FAIL;
+
+  char            *errbuf = (char *)NULL;/*Error message buffer   */
+
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTgetlevelnameF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(ret);
+    }  
+
+  PointID = (hid_t)pointID;
+
+  /* Get index of named Level           */
+  /* ---------------------------------- */
+
+  status = HE5_PTgetlevelname( PointID, level, levelname, strbufsize);
+  if(status == FAIL)
+    {
+      sprintf(errbuf, "Cannot retrieve the Level Name. \n");
+      H5Epush(__FILE__, "HE5_PTgetlevelnameF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  free(errbuf);
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTbcklinkinfoF   (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION: Returns link field to previous level.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|  linkfield      char                linkage field                           |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_PTbcklinkinfoF(int pointID, int level, char *linkfield)
+{
+  int             ret     = FAIL;
+
+  herr_t          status  = FAIL;/* routine return status variable */
+
+  hid_t           PointID = FAIL;/* HDF5 type point ID            */
+
+  char            *errbuf = (char *)NULL;/*Error message buffer   */
+
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTbcklinkinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(ret);
+    }  
+
+  PointID = (hid_t)pointID;
+
+  status = HE5_PTbcklinkinfo( PointID, level, linkfield);
+  if(status == FAIL)
+    {
+      sprintf(errbuf, "Error in Fortran Wrapper HE5_PTbcklinkinfoF(). \n");
+      H5Epush(__FILE__, "HE5_PTbcklinkinfoF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTfwdlinkinfoF   (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION: Returns link field to following level.                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|  linkfield      char                linkage field                           |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_PTfwdlinkinfoF(int pointID, int level, char *linkfield)
+{
+  int             ret     = FAIL;
+
+  herr_t          status  = FAIL;/* routine return status variable */
+
+  hid_t           PointID = FAIL;/* HDF5 type point ID            */
+
+  char            *errbuf = (char *)NULL;/*Error message buffer   */
+
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTfwdlinkinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(ret);
+    }  
+
+  PointID = (hid_t)pointID;
+
+  status = HE5_PTfwdlinkinfo( PointID, level, linkfield);
+  if(status == FAIL)
+    {
+      sprintf(errbuf, "Error in Fortran Wrapper HE5_PTfwdlinkinfoF(). \n");
+      H5Epush(__FILE__, "HE5_PTfwdlinkinfoF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  free(errbuf);
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTlevelinfoF   (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION: Returns information about a given level.                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  levelname      char                Name of Level                           |
+|  rank           int                 Rank of Fields                          |
+|  fieldlist      char                Fieldlist to read (comma-separated)     |
+|  dim_sizes                          Sizes of field dimensions               |
+|  datasize       long                Datasize of compound structure          |
+|  offset         long                Offsets of each of the fields           |
+|  dtype          int                 Datatypes of each of the fields         |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_PTlevelinfoF(int pointID, int level, char *levelname, int rank[], char *fieldlist, long *dim_sizes, long *datasize, long offset[], int dtype[])
+{
+  herr_t            status = FAIL;/* routine return status variable */    
+   
+  hid_t             PointID = FAIL;
+
+  HE5_CmpDTSinfo    dtsinfo;
+
+  int               ret           = FAIL;/* (int) Return status variable   */
+  int               i, j, k       = 0;
+  long              nfields       = FAIL;
+  long              max_rank      = 0;
+  long              strbufsize    = 0;
+ 
+  char              errbuf[HE5_HDFE_ERRBUFSIZE]; /* error message buffer */
+
+
+  PointID  =  (hid_t)pointID;
+
+
+  /* Call HE5_PTlevelinfo to get information structure */
+  /* ------------------------------------------------- */ 
+  status = HE5_PTlevelinfo(PointID, level, &dtsinfo);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Call to HE5_PTlevelinfo failed.\n");
+      H5Epush(__FILE__, "HE5_PTlevelinfoF", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  nfields   = (long)dtsinfo.nfields;
+  *datasize = (long)dtsinfo.datasize;
+
+  /* Release pointers to the name buffers */
+  /* ------------------------------------ */
+  for (j = 0; j < dtsinfo.nfields; j++)
+    {
+      if (dtsinfo.fieldname[j] != NULL) 
+	free(dtsinfo.fieldname[j]);
+    }
+
+  /* Get the levelname */
+  /* ----------------- */
+  status = HE5_PTgetlevelname(PointID, level, levelname, &strbufsize);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Call to HE5_PTgetlevelname failed.\n");
+      H5Epush(__FILE__, "HE5_PTlevelinfoF", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+   
+  for( i = 0; i < nfields; i++ )
+    {
+      rank[i]   = dtsinfo.rank[i];
+      offset[i] = (long)dtsinfo.offset[i];
+      dtype[i]  = (int)dtsinfo.dtype[i]; 
+    }
+   
+  /* Get fieldlist (output from HE5_PTnfields) */
+  /* ----------------------------------------- */
+  HE5_PTnfields(pointID, level, fieldlist, &strbufsize);  
+
+  /* Do work to store dimensions in level data structure */
+  /* --------------------------------------------------- */
+   
+  /* Calculate maximum rank */
+  /* ---------------------- */
+  for( i = 0; i < nfields; i++ )
+    {
+      if( rank[i] > max_rank )
+	max_rank = (long)rank[i]; 
+    }
+   
+  /* Load dimension arrays (2-d fortran dimension array is in fortran order) */
+  /* ----------------------------------------------------------------------- */
+  for( i = 0; i < max_rank; i++ )
+    {
+      for( j = 0; j < nfields; j++ )
+	{
+	  k  =  j * (int)max_rank + i;                   
+	  dim_sizes[k] = (long)dtsinfo.dims[j][i] ;   
+		   
+	}
+    }
+   
+  ret = (int)status;  
+  return(ret);  
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTinqdatatype   (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Inquires about datasets in Point                              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status          int                return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID         int                point structure ID                      |
+|  fieldname       char *             Name of field                           |
+|  attrname        char *             Name of attribute                       |
+|  fieldgroup      int                Field group flag                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dtype           int                Datatype flag                           |
+|  class           int                Class ID                                |
+|  Order           int                                                        |
+|  size            long                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_PTinqdatatypeF(int pointID, char *fieldname, char *attrname, int fieldgroup, int *Type, int *Class, int *Order, long *size)
+{
+  int	       ret      = FAIL;               /* (int) status variable  */
+
+  herr_t       status   = FAIL;               /* return status variable */
+  
+  size_t       *tsize   = (size_t *)NULL;     /* data size variable     */ 
+
+  hid_t        *typeID  = (hid_t *)NULL;      /* HDF5 Data type ID      */
+  hid_t        PointID  = FAIL;               /* HDF5 type Point ID     */
+ 
+  H5T_class_t  *classID = (H5T_class_t *)NULL;/*  Data type class ID    */
+  H5T_order_t  *order   = (H5T_order_t *)NULL;/* Byte order of datatype */
+
+  char         *errbuf  = (char *)NULL;       /* error message buffer   */
+
+
+  /* Change Fortran character '0' to NULL */
+  /* (still works with '0'                */
+  /* ------------------------------------ */
+  if( *fieldname == '0' ) { *fieldname = (char)(intptr_t)NULL; }
+  if( *attrname  == '0' ) { *attrname  = (char)(intptr_t)NULL; }
+
+
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  typeID = (hid_t *)calloc(1, sizeof(hid_t));
+  if(typeID == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for typeID.\n");
+      H5Epush(__FILE__, "HE5_PTinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  tsize = (size_t *)calloc(1, sizeof(size_t));
+  if(tsize == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tsize.\n");
+      H5Epush(__FILE__, "HE5_PTinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      return(FAIL);
+    }
+
+  classID = (H5T_class_t *)calloc(1, sizeof(H5T_class_t));
+  if(classID == (H5T_class_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for classID.\n");
+      H5Epush(__FILE__, "HE5_PTinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      free(tsize);
+      return(FAIL);
+    }
+
+  order = (H5T_order_t *)calloc(1, sizeof(H5T_order_t));
+  if(order == (H5T_order_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for order.\n");
+      H5Epush(__FILE__, "HE5_PTinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      free(tsize);
+      free(classID);
+      return(FAIL);
+    }
+
+  PointID = (hid_t)pointID;
+
+  /* Get data type information */
+  /* ------------------------- */
+  status = HE5_PTinqdatatype(PointID, fieldname, attrname, fieldgroup, typeID, classID, order, tsize);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about data type.\n");
+      H5Epush(__FILE__, "HE5_PTinqdatatypeF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  *Type   = (int)(*typeID);
+  *Class  = (int)(*classID);
+  *Order  = (int)(*order);
+  *size   = (long)(*tsize);
+  
+  free(errbuf);
+  free(typeID);
+  free(classID);
+  free(order);
+  free(tsize);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTinqpointF   (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Returns number and names of point structures in file          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nPoint         int                 Number of point structures in file      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  filename       char                HDF-EOS filename                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  pointlist      char                List of point names (comma-separated)   |
+|  strbufsize     long                Length of pointlist                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_PTinqpointF(const char *filename, char *pointlist, long *strbufsize)
+{
+  int             npoint    = FAIL;
+
+  long            nPoint    = FAIL;/* Number of point structures in file (return)  */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+
+  nPoint = HE5_PTinqpoint( filename, pointlist, strbufsize);
+  if ( nPoint < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the list of Point names. \n");
+      H5Epush(__FILE__, "HE5_PTinqpointF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  npoint = (int)nPoint;
+  return(npoint);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTattrinfoF   (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          int                 Data type of attribute                  |
+|  count          int                 Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer    Description                                        |
+|  =======   ============  =================================================  |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_PTattrinfoF(int pointID, const char *attrname, int *numbertype, long *fortcount)
+{
+  int          ret      = FAIL;               /* (int) return status variable  */ 
+
+  herr_t       status   = FAIL;	              /* return status variable        */
+
+  hid_t        *ntype   = (hid_t *)NULL;      /* Data type class ID            */
+
+  hid_t        PointID  = FAIL;               /* HDF5 type Point ID            */
+
+  hsize_t      *count   = (hsize_t *)NULL;    /* Pointer to count (C order)    */
+  
+  char         *errbuf  = (char *)NULL;       /* error message buffer          */
+
+  
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  count = (hsize_t *) calloc(1, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_PTattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+ 
+  ntype = (hid_t *) calloc(1, sizeof(hid_t));
+  if(ntype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for ntype.\n");
+      H5Epush(__FILE__, "HE5_PTattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      return(FAIL);
+    }
+
+  PointID = (hid_t)pointID;
+
+  status = HE5_PTattrinfo(PointID, attrname, ntype, count);    
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about attribute \"%s\".\n", attrname);
+      H5Epush(__FILE__, "HE5_PTattrinfoF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }  
+  
+  *fortcount  = (long)(*count);
+  *numbertype = (int)(*ntype);
+
+  free(errbuf);
+  free(count);
+  free(ntype);
+
+  ret = (int)status;
+  return(ret); 
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTgrpattrinfoF   (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION:  Retrieves information about attributes in "Data" group.      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          int                 Data type of attribute                  |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_PTgrpattrinfoF(int pointID, const char *attrname, int *numbertype, long *fortcount)
+{
+  int	      ret     = FAIL;	        /* (int) return status variable   */
+
+  herr_t      status  = FAIL;           /* routine return status variable */
+
+  hid_t       *ntype  = (hid_t *)NULL;  /* Data type class ID         */
+
+  hid_t       PointID = FAIL;           /* HDF5 type Point ID             */
+
+  hsize_t     *count  = (hsize_t *)NULL;/* Pointer to count  (C order)    */
+  
+  char        *errbuf = (char *)NULL;   /* error message buffer           */
+  
+  
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTgrpattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_PTgrpattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+  if( ntype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for ntype.\n");
+      H5Epush(__FILE__, "HE5_PTgrpattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      return(FAIL);
+    }
+
+  PointID = (hid_t)pointID;
+
+  status = HE5_PTgrpattrinfo(PointID, attrname, ntype, count);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about group attribute.\n");
+      H5Epush(__FILE__, "HE5_PTgrpattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  *fortcount  = (long)(*count);
+  *numbertype = (int)(*ntype);
+
+  free(errbuf);
+  free(count);
+  free(ntype);
+  
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTlocattrinfoF   (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION:  Retrieves information about attributes in associated with a  |
+|                 specified level in a point.                                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  levelname      char                level name                              |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          int                 Data type of attribute                  |
+|  count          long                Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_PTlocattrinfoF(int pointID, const char *levelname, const char *attrname, int *numbertype, long *fortcount)
+{
+  int	      ret     = FAIL;	        /* (int) return status variable   */
+
+  herr_t      status  = FAIL;           /* routine return status variable */
+
+  hid_t       *ntype  = (hid_t *)NULL;  /* Data type class ID         */
+
+  hid_t       PointID = FAIL;           /* HDF5 type Point ID             */
+
+  hsize_t     *count  = (hsize_t *)NULL;/* Pointer to count  (C order)    */
+  
+  char        *errbuf = (char *)NULL;   /* error message buffer           */
+
+  
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PTlocattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_PTlocattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+  if( ntype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for ntype.\n");
+      H5Epush(__FILE__, "HE5_PTlocattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      return(FAIL);
+    }
+
+  PointID = (hid_t)pointID;
+  
+  status = HE5_PTlocattrinfo(PointID, levelname, attrname, ntype, count);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about local attribute.\n");
+      H5Epush(__FILE__, "HE5_PTlocattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  *fortcount  = (long)(*count);
+  *numbertype = (int)(*ntype);
+  
+  free(errbuf);
+  free(count);
+  free(ntype);
+  
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTinqattrsF   (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in point struct    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  point ID       int                 point structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in point struct         |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_PTinqattrsF(int pointID, char *attrnames, long *strbufsize)
+{
+  long            nattr    = FAIL;/* Number of attributes (return)  */
+
+  hid_t           PointID  = FAIL;/* HDF5 type Point ID             */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+
+  char            *attrnames_t = (char *)NULL;   
+  char            buffer[1]    = {'0'};  
+  char            buffer1[1]   = {'1'};  
+
+  int             result       = 1;
+
+  PointID = (hid_t)pointID;
+
+  /* Change Fortran character '0' to NULL if needed */
+  /* ---------------------------------------------- */
+  buffer1[0] = attrnames[0];
+
+  result  = memcmp(buffer1,buffer,sizeof(buffer));
+
+  if( memcmp(buffer1,buffer,sizeof(buffer)) == 0 ) { result = 0; }   
+
+  if( result == 0 )  nattr = HE5_PTinqattrs(PointID, attrnames_t, strbufsize);
+  if( result != 0 )  nattr = HE5_PTinqattrs(PointID, attrnames, strbufsize);
+
+  if ( nattr < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+      H5Epush(__FILE__, "HE5_PTinqattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  return(nattr);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTinqgrpattrsF   (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list in "Data" group                               |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in point struct    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  point ID       int                 point structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in point struct         |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_PTinqgrpattrsF(int pointID, char *attrnames, long *strbufsize)
+{
+  long            nattr   = FAIL;         /* Number of attributes (return)  */
+
+  hid_t           PointID = FAIL;         /* HDF5 type swath ID             */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer           */
+
+  char            *attrnames_t = (char *)NULL;   
+  char            buffer[1]    = {'0'};  
+  char            buffer1[1]   = {'1'};  
+
+  int             result       = 1;
+
+  PointID = (hid_t)pointID;
+
+  /* Change Fortran character '0' to NULL if needed */
+  /* ---------------------------------------------- */
+  buffer1[0] = attrnames[0];
+
+  result  = memcmp(buffer1,buffer,sizeof(buffer));
+
+  if( memcmp(buffer1,buffer,sizeof(buffer)) == 0 ) { result = 0; }   
+  
+  if( result == 0 )  nattr = HE5_PTinqgrpattrs(PointID, attrnames_t, strbufsize);
+  if( result != 0 )  nattr = HE5_PTinqgrpattrs(PointID, attrnames, strbufsize);
+  if ( nattr < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+      H5Epush(__FILE__, "HE5_PTinqgrpattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  return(nattr);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTinqlocattrsF   (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list from a specified level in a point.            |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in a level         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  point ID       int                 point structure ID                      |
+|  levelname      char                level name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in a level              |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/01/01   C.Praderas   Initial coding                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_PTinqlocattrsF(int pointID, const char *levelname, char *attrnames, long *strbufsize)
+{
+  long            nattr       = FAIL;     /* Number of attributes   */
+
+  hid_t           PointID     = FAIL;     /* HDF5 type swath ID     */
+    
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */  
+  char            *attrnames_t = (char *)NULL;   
+  char            buffer[1]    = {'0'};  
+  char            buffer1[1]   = {'1'};  
+
+  int             result       = 1;
+
+  PointID = (hid_t)pointID;
+
+  /* Change Fortran character '0' to NULL if needed */
+  /* ---------------------------------------------- */
+  buffer1[0] = attrnames[0];
+
+  result  = memcmp(buffer1,buffer,sizeof(buffer));
+
+  if( memcmp(buffer1,buffer,sizeof(buffer)) == 0 ) { result = 0; }   
+
+  if( result == 0 )  nattr = HE5_PTinqlocattrs(PointID, levelname, attrnames_t, strbufsize);
+  if( result != 0 )  nattr = HE5_PTinqlocattrs(PointID, levelname, attrnames, strbufsize);
+  if ( nattr < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+      H5Epush(__FILE__, "HE5_PTinqlocattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+  return (nattr); 
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTnumtypeinfoF   (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION: Returns the number type about a given level.                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        int                 point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  numtype        int                 Number types of each of the fields      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 04    S.Zhao       Original development                                |
+|  Dec 05    T.Roegner    NCR 44092 - Added CYGWIN capability                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_PTnumtypeinfoF(int pointID, int level, int numtype[])
+{
+  herr_t            status = FAIL;/* routine return status variable */
+  
+  hid_t             PointID = FAIL;/* HDF-EOS Point ID              */
+
+  HE5_CmpDTSinfo    dtsinfo;
+
+  int               ret           = FAIL;/* (int) Return status variable */
+  int               i             = 0;
+  long              nfields       = FAIL;/* Number of fields in the level*/
+
+  char              errbuf[HE5_HDFE_ERRBUFSIZE]; /* error message buffer */
+
+
+  PointID  =  (hid_t)pointID;
+
+
+  /* Call HE5_PTlevelinfo to get information structure */
+  /* ------------------------------------------------- */
+  status = HE5_PTlevelinfo(PointID, level, &dtsinfo);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Call to HE5_PTlevelinfo failed.\n");
+      H5Epush(__FILE__, "HE5_PTnumtypeinfoF", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  nfields   = (long)dtsinfo.nfields;
+
+  for( i = 0; i < nfields; i++ )
+    {
+      numtype[i]  = (int)dtsinfo.numtype[i];
+    }
+  
+  ret = (int)status;
+  return(ret); 
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:   HE5_PTgetdtypesize                                             |
+|                                                                             |
+|  DESCRIPTION: Returns size of datatype for a member in a given level.       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return size if SUCCEED, (-1) FAIL       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  levelID        hid_t               level dataset ID                        |
+|  fieldnum       int                 member number in the level              |
+|                                     structure (0 - based)                   |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|   None                                                                      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Dec 05    Abe Taaheri  Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_PTgetdtypesize(hid_t levelID, int i)
+{
+  hid_t           typeID    = FAIL;    /* compound datatype ID           */
+  hid_t           mdt       = FAIL;    /* Member data type ID            */
+  int             ret       = FAIL;
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+  int             status;
+
+  typeID = H5Dget_type(levelID);
+  mdt = H5Tget_member_type(typeID, i);
+  ret = H5Tget_size(mdt);
+  if (ret == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the size of member daat type ID.\n");
+      H5Epush(__FILE__, "HE5_PTgetdtypesize", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  status = H5Tclose(mdt);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the field data type ID.\n");
+      H5Epush(__FILE__, "HE5_PTgetdtypesize", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  status  = H5Tclose(typeID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the data type ID.\n");
+      H5Epush(__FILE__, "HE5_PTgetdtypesize", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PTgetlevelname_fromSM                                        |
+|                                                                             |
+|  DESCRIPTION: Returns name of a given level from Structure Metadata         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  pointID        hid_t               point structure ID                      |
+|  level          int                 level number (0 - based)                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  LevelName      char string         Name for rquested level obtained from   |
+|                                     Structure Metadata                      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  12/28/05  Abe Taaheri   created                                    .       |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+
+herr_t  
+HE5_PTgetlevelname_fromSM(hid_t pointID, int level, char *LevelName)
+{
+  herr_t          status   = FAIL;            /* Return status variable   */
+
+  hid_t           fid      = FAIL;            /* HDF-EOS file ID          */
+  hid_t           pID      = FAIL;            /* Point ID - offset        */
+  hid_t           gid      = FAIL;
+  hid_t           idOffset = HE5_PTIDOFFSET;  /* Point ID offset          */
+
+  long 	          idx      = FAIL;            /* Point index              */
+ 
+  char            *metabuf = NULL;	      /* Pointer to SM            */
+  char            *metaptrs[2]={NULL,NULL};   /* Ptrs to begin/end of SM  */
+  char            name1[HE5_HDFE_NAMBUFSIZE]; /* Name string 1            */
+  char            level_subgroupname[HE5_HDFE_NAMBUFSIZE]; 
+  char            utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer           */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error messg buffer       */
+
+
+  strcpy(LevelName,"");
+
+  /* Check for valid point ID */
+  /* ------------------------ */
+  status = HE5_PTchkptid(pointID, "HE5_PTgetlevelname_fromSM", 
+			 &fid, &gid, &idx);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Checking for point ID failed. \n");
+      H5Epush(__FILE__, "HE5_PTgetlevelname_fromSM", __LINE__, 
+	      H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  /* Compute "reduced" point ID */
+  /* -------------------------- */
+  pID = pointID % idOffset;
+
+  /* construct level's group name */
+  /* -------------------------- */
+
+  sprintf(level_subgroupname, "Level_%d", level);
+
+  /* Get specific level's  structural metadata */
+  /* ---------------------------------- */
+  metabuf = (char *)HE5_EHmetagroup(fid, HE5_PTXPoint[pID].ptname, "p",
+				    level_subgroupname, metaptrs);
+  if (metabuf == NULL )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot get pointer to metadata buffer for the \"%s\" point. \n", HE5_PTXPoint[pID].ptname);
+      H5Epush(__FILE__, "HE5_PTgetlevelname_fromSM", __LINE__, 
+	      H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Search for LevelName=  entry */
+  /* ---------------------------- */
+  
+  status = HE5_EHgetmetavalue(metaptrs, "LevelName", LevelName);
+
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot get \"LevelName\" metavalue for the \"%s\" point. \n", HE5_PTXPoint[pID].ptname);
+      H5Epush(__FILE__, "HE5_PTgetlevelname_fromSM", __LINE__, 
+	      H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(metabuf);
+      return(status);
+    }
+  free(metabuf);
+  return(status);
+}
+
+#ifndef __cplusplus
+
+/* HDF types used in FORTRAN bindings */
+ 
+#if defined(DEC_ALPHA) || defined(IRIX) || defined(UNICOS) || defined(LINUX64) || defined(IA64) || defined(MACINTOSH) || defined(MACINTEL) || defined(IBM6000) || defined(CYGWIN)
+ 
+#define INT32  INT
+#define INT32V INTV
+#define PINT32 PINT
+ 
+#else
+ 
+#define INT32  LONG
+#define INT32V LONGV
+#define PINT32 PLONG
+ 
+#endif
+
+/* File/Point access routines */
+FCALLSCFUN2(INT, HE5_PTopenF, HE5_PTOPEN, he5_ptopen, STRING, INT)
+FCALLSCFUN2(INT, HE5_PTcreateF, HE5_PTCREATE, he5_ptcreate, INT, STRING)
+FCALLSCFUN2(INT, HE5_PTattachF, HE5_PTATTACH, he5_ptattach, INT, STRING)
+FCALLSCFUN1(INT, HE5_PTdetachF, HE5_PTDETACH, he5_ptdetach, INT)
+FCALLSCFUN1(INT, HE5_PTcloseF, HE5_PTCLOSE, he5_ptclose, INT)
+
+/* Definition routines */
+FCALLSCFUN7(INT, HE5_PTdeflevelF,HE5_PTDEFLEVEL, he5_ptdeflevel, INT, STRING, INTV, STRING, PLONG, INTV, INTV)
+FCALLSCFUN4(INT, HE5_PTdeflinkageF,HE5_PTDEFLINKAGE, he5_ptdeflinkage, INT, STRING, STRING, STRING)
+
+/* I/O routines */
+FCALLSCFUN5(INT, HE5_PTreadlevelF,HE5_PTREADLEVEL, he5_ptreadlevel, INT, INT, STRING, INT, PVOID)   
+FCALLSCFUN7(INT, HE5_PTupdatelevelF, HE5_PTUPDATELEVEL, he5_ptupdatelevel, INT, INT, STRING, LONG, LONGV, INT, PVOID)
+FCALLSCFUN6(INT, HE5_PTwritelevelF, HE5_PTWRITELEVEL, he5_ptwritelevel, INT, INT, LONGV, STRING, INT, PVOID)
+FCALLSCFUN5(INT, HE5_PTwriteattrF, HE5_PTWRITEATTR, he5_ptwriteattr, INT, STRING, INT, LONGV, PVOID)
+FCALLSCFUN5(INT, HE5_PTwritegrpattrF, HE5_PTWRITEGRPATTR, he5_ptwritegrpattr, INT, STRING, INT, LONGV, PVOID)
+FCALLSCFUN6(INT, HE5_PTwritelocattrF, HE5_PTWRITELOCATTR, he5_ptwritelocattr, INT, STRING, STRING, INT, LONGV, PVOID)
+FCALLSCFUN3(INT, HE5_PTreadattrF, HE5_PTREADATTR, he5_ptreadattr, INT, STRING, PVOID)
+FCALLSCFUN3(INT, HE5_PTreadgrpattrF, HE5_PTREADGRPATTR, he5_ptreadgrpattr, INT, STRING, PVOID)
+FCALLSCFUN4(INT, HE5_PTreadlocattrF, HE5_PTREADLOCATTR, he5_ptreadlocattr, INT, STRING, STRING, PVOID)
+FCALLSCFUN2(INT, HE5_PTwrbckptrF, HE5_PTWRBCKPTR, he5_ptwrbckptr, INT, INT)
+FCALLSCFUN2(INT, HE5_PTwrfwdptrF, HE5_PTWRFWDPTR, he5_ptwrfwdptr, INT, INT)
+
+/* Point inquiry routines */
+FCALLSCFUN2(INT, HE5_PTnrecsF,HE5_PTNRECS, he5_ptnrecs, INT, INT)
+FCALLSCFUN1(INT, HE5_PTnlevelsF,HE5_PTNLEVELS, he5_ptnlevels, INT)
+FCALLSCFUN4(INT, HE5_PTnfieldsF,HE5_PTNFIELDS, he5_ptnfields, INT, INT, PSTRING, PLONG)
+FCALLSCFUN2(INT, HE5_PTlevelindxF,HE5_PTLEVELINDX, he5_ptlevelindx, INT, PSTRING)
+FCALLSCFUN4(INT, HE5_PTgetlevelnameF,HE5_PTGETLEVELNAME, he5_ptgetlevelname, INT, INT, PSTRING, PLONG)
+FCALLSCFUN3(INT, HE5_PTbcklinkinfoF,HE5_PTBCKLINKINFO, he5_bcklinkinfo, INT, INT, PSTRING)
+FCALLSCFUN3(INT, HE5_PTfwdlinkinfoF,HE5_PTFWDLINKINFO, he5_fwdlinkinfo, INT, INT, PSTRING)
+FCALLSCFUN9(INT, HE5_PTlevelinfoF, HE5_PTLEVELINFO, he5_ptlevelinfo, INT, INT, PSTRING, INTV, PSTRING, PLONG, PLONG, LONGV, INTV)
+FCALLSCFUN8(INT, HE5_PTinqdatatypeF, HE5_PTINQDATATYPE, he5_ptinqdatatype, INT, PSTRING, PSTRING, INT, PINT, PINT, PINT, PLONG)
+FCALLSCFUN3(INT, HE5_PTinqpointF,HE5_PTINQPOINT, he5_inqpoint, PSTRING, PSTRING, PLONG)
+FCALLSCFUN4(INT, HE5_PTattrinfoF,HE5_PTATTRINFO, he5_ptattrinfo, INT, PSTRING, PINT, PLONG)
+FCALLSCFUN4(INT, HE5_PTgrpattrinfoF,HE5_PTGRPATTRINFO, he5_ptgrpattrinfo, INT, PSTRING, PINT, PLONG)
+FCALLSCFUN5(INT, HE5_PTlocattrinfoF,HE5_PTLOCATTRINFO, he5_ptlocattrinfo, INT, PSTRING, PSTRING, PINT, PLONG)
+FCALLSCFUN3(LONG, HE5_PTinqattrsF,HE5_PTINQATTRS, he5_ptinqattrs, INT, PSTRING, PLONG)
+FCALLSCFUN3(LONG, HE5_PTinqgrpattrsF,HE5_PTINQGRPATTRS, he5_ptinqgrpattrs, INT, PSTRING, PLONG)
+FCALLSCFUN4(LONG, HE5_PTinqlocattrsF,HE5_PTINQLOCATTRS, he5_ptinqlocattrs, INT, PSTRING, PSTRING, PLONG)
+FCALLSCFUN3(INT, HE5_PTnumtypeinfoF, HE5_PTNUMTYPEINFO, he5_ptnumtypeinfo, INT, INT, INTV)
+
+/* Point utility routines */
+FCALLSCFUN5(LONG, HE5_PTc2fort,HE5_PTC2FORT, he5_ptc2fort, LONGV, INT, INT, PVOID, PVOID)
+FCALLSCFUN5(LONG, HE5_PTfort2c,HE5_PTFORT2C, he5_ptfort2c, LONGV, INT, INT, PVOID, PVOID)
+
+
+#endif
+
+
+
+
+
+
+
diff --git a/src/SWapi.c b/src/SWapi.c
new file mode 100755
index 0000000..034c5fe
--- /dev/null
+++ b/src/SWapi.c
@@ -0,0 +1,31628 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999  Emergent IT Inc.  and Raytheon Systems Company    |
+ |                                                                          |
+ |  Permission to use, modify, and distribute this software and its         |
+ |  documentation for any purpose without fee is hereby granted, provided   |
+ |  that the above copyright notice appear in all copies and that both that |
+ |  copyright notice and this permission notice appear in supporting        |
+ |                          documentation.                                  |
+ ----------------------------------------------------------------------------
+ */
+
+#include <HE5_HdfEosDef.h>
+
+#define HE5_SWIDOFFSET 671088642
+#define HE5_NSWATH           400
+#define HE5_NSWATHREGN       512
+#define HE5_MAXNREGIONS     2048
+
+int  HE5_timeflag = 0;
+
+/* Swath Structure External Arrays */
+struct HE5_swathStructure 
+{
+  hid_t         fid;                     /* HDF-EOS file ID                   */
+  hid_t         obj_id;                  /* "SWATHS" group ID                 */
+  hid_t         sw_id;                   /* specified swath group ID          */
+  hid_t         data_id;                 /* "Data Fields" group ID            */
+  hid_t         geo_id;                  /* "Geo Fields" group ID             */
+  hid_t         prof_id;                 /* "Profile Fields" group ID         */
+  hid_t         plist;                   /* current dataset creation property */
+  
+  int           active;                  /* Flag: file active or not          */
+  int           compcode;                /* compression mode                  */
+  int           compparm[5];             /* compression level                 */
+
+  HE5_DTSinfo   *gdataset;               /* pointer to Geo field info         */
+  HE5_DTSinfo   *ddataset;               /* pointter to Data field info       */
+  HE5_DTSinfo   *pdataset;               /* pointer to Profile field info     */
+
+  long          nGFLD;                   /* number of geo fields              */
+  long          nDFLD;                   /* number of data fields             */
+  long          nPROF;                   /* number of profile fields          */
+  
+  char          swname[HE5_OBJNAMELENMAX];/* swath name                       */
+};
+
+struct HE5_swathStructure HE5_SWXSwath[HE5_NSWATH];
+
+struct HE5_swathRegion
+{
+  hid_t        fid;
+  hid_t        swathID;
+  
+  long         nRegions;
+  long         StartRegion[HE5_MAXNREGIONS];
+  long         StopRegion[HE5_MAXNREGIONS];
+  long         StartVertical[HE5_DTSETRANKMAX];
+  long         StopVertical[HE5_DTSETRANKMAX];
+  
+  char         *DimNamePtr[HE5_DTSETRANKMAX];
+};
+
+struct HE5_swathRegion *HE5_SWXRegion[HE5_NSWATHREGN];
+
+struct HE5_dtsIDs
+{
+  hid_t        type_id;
+  hid_t        space_id;
+  hid_t        plist_id;
+};
+
+struct HE5_dtsIDs  profile;
+
+
+/* INTERNAL FUNCTION PROTOTYPES */
+int HE5_szip_can_encode(void );
+static herr_t  
+HE5_SWchkswid(hid_t swathID, const char *routname, hid_t *fid, hid_t *gid,  long *idx);
+static long  
+HE5_SWinqfields(hid_t swathID, char *fieldtype, char *fieldlist, int rank[], hid_t ntype[]);
+static size_t 
+HE5_SWfieldsizeID(hid_t swathID, char *fieldname, hid_t *fieldID);
+static herr_t 
+HE5_SWdefinefield(hid_t swathID, char *fieldtype, const char *fieldname, char *dimlist, char *maxdimlist, hid_t typeID, int merge);
+static herr_t 
+HE5_SWwrrdfield(hid_t swathID, char *fieldname, char *code, const hssize_t start[], const hsize_t stride[], const hsize_t count[],  void * datbuf);
+static herr_t 
+HE5_SWfinfo(hid_t swathID, char *fieldtype, char *fieldname, int *rank, hsize_t dims[], hid_t ntype[], char *dimlist, char *maxdimlist);
+static int 
+HE5_SWfldnameinfo(hid_t swathID, char *fieldname, char *fldactualname);
+static herr_t
+HE5_SWupdatedim(int swathID,  char *dimname, hsize_t dim);
+static herr_t
+HE5_SWllmapedidxinfo(hid_t swathID, char *object, long *index0, long *index1);
+
+static herr_t
+HE5_SWflddiminfo(int SwathID, char *fieldname, int *rank,  hsize_t dims[], hsize_t maxdims[]);
+
+
+/* CUSTOM MEMORY MANAGEMENT ROUTINES */
+
+/*
+  void *
+  vltypes_alloc_custom(size_t size, void *info);
+  void  
+  vltypes_free_custom(void *mem, void *info);
+*/
+
+
+/* FORTRAN WRAPPER PROTOTYPES */
+
+
+/* File/Swath access routines */
+
+int
+HE5_SWopenF(char *filename, int flags);
+int 
+HE5_SWcreateF(int fileID, char *swathname);
+int 
+HE5_SWattachF(int fileID, char *swathname);
+int
+HE5_SWdetachF(int swathID);
+int 
+HE5_SWcloseF(int fileID);
+
+
+/* Definition routines */
+
+int
+HE5_SWdefdimF(int swathID,  char *dimname, long dim);
+int
+HE5_SWdefdimmapF(int swathID, char *geodim, char *datadim, long offset, long increment);
+int
+HE5_SWdefidxmapF(int swathID, char *geodim, char *datadim, long index[]);
+int 
+HE5_SWdefgfld(int swathID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int numtype, int create_plist_id);
+int 
+HE5_SWdefdfld(int swathID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int numtype, int create_plist_id);
+int
+HE5_SWdefchunkF(int swathID, int ndims, long *dim);
+int   
+HE5_SWdefcompF(int swathID, int compcode,  int *compparm);
+int   
+HE5_SWdefcomchunkF(int swathID, int compcode, int *compparm, int rank, long *dim);
+long 
+HE5_SWupimap(int swathID, int regionID, long indexin[], long indexout[], long indicies[]);
+int    
+HE5_SWfldrenameF(int swathID, char *oldfieldname, char *newfieldname);
+
+
+/* I/O routines */
+
+int
+HE5_SWwrfld(int swathID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *data);
+int
+HE5_SWwrcharfld(int swathID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *data);
+int
+HE5_SWrdfld(int swathID, char *fieldname, long fortstart[],  long fortstride[], long fortedge[], void *buffer);
+int
+HE5_SWrdcharfld(int swathID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *buffer);
+int
+HE5_SWsetfill(int swathID, char *fieldname, int ntype, void *fillval);
+int
+HE5_SWgetfill(int swathID, char *fieldname, void *fillval);
+int
+HE5_SWwrattr(int swathID, char *attrname, int ntype, long fortcount[], void * datbuf);
+int
+HE5_SWwrgattr(int swathID, char *attrname, int ntype, long fortcount[], void *datbuf);
+int
+HE5_SWwrgeogattr(int swathID, char *attrname, int ntype, long fortcount[], void *datbuf);
+int
+HE5_SWwrlattr(int swathID, char *fieldname, char *attrname, int ntype, long fortcount[], void *datbuf);
+int    
+HE5_SWrdattr(int swathID, char *attrname, void *datbuf);
+int    
+HE5_SWrdgattr(int swathID, char *attrname, void *datbuf);
+int
+HE5_SWrdgeogattr(int swathID, char *attrname, void *datbuf);
+int    
+HE5_SWrdlattr(int swathID, char *fieldname, char *attrname, void *datbuf);
+int    
+HE5_SWsetaliasF(int swathID, char *fieldname, char *fortaliaslist);
+int    
+HE5_SWdropaliasF(int swathID, int fldgroup, char *aliasname);
+
+
+/* Inquiry routines */
+
+long 
+HE5_SWinqswathF(char *filename, char *swathlist, long *strbufsize);
+long 
+HE5_SWnentriesF(int swathID, int entrycode, long *strbufsize);
+long 
+HE5_SWdiminfoF(int swathID, char *dimname);
+int
+HE5_SWfldinfoF(int swathID, char *fieldname, int *rank, long dims[], int *ntype, char *fortdimlist, char *fortmaxdimlist);
+long
+HE5_SWinqmapsF(int swathID, char *dimmaps, long offset[], long increment[]);
+long
+HE5_SWinqimapsF(int swathID, char *idxmaps, long idxsizes[]);
+long
+HE5_SWinqdimsF(int swathID, char *dimnames, long dims[]);
+long 
+HE5_SWinqgflds(int swathID, char *fieldlist, int rank[], int ntype[]);
+long 
+HE5_SWinqdflds(int swathID, char *fieldlist, int rank[], int ntype[]);
+int
+HE5_SWmapinfoF(int swathID, char *geodim, char *datadim, long *offset, long *increment);
+int    
+HE5_SWgmapinfo(int swathID, char *geodim);
+long
+HE5_SWidxmapinfoF(int swathID, char *geodim, char *datadim, long index[]);
+int
+HE5_SWatinfo(int swathID, char *attrname, int *ntype, long *fortcount);
+int
+HE5_SWgatinfo(int swathID, char *attrname, int *ntype, long *fortcount);
+int
+HE5_SWgeogatinfo(int swathID, char *attrname, int *ntype, long *fortcount);
+int
+HE5_SWlatinfo(int swathID, char *fieldname, char *attrname, int *ntype, long *fortcount);
+long 
+HE5_SWinqattrsF(int swathID, char *attrnames, long *strbufsize);
+long 
+HE5_SWinqgattrs(int swathID, char *attrnames, long *strbufsize);
+long
+HE5_SWinqgeogattrs(int swathID, char *attrnames, long *strbufsize);
+long 
+HE5_SWinqlattrs(int swathID, char *fieldname, char *attrnames, long *strbufsize);
+int 
+HE5_SWcompinfoF(int swathID, char *fieldname, int *compcode, int compparm[]);
+int 
+HE5_SWreginfo(int swathID, int regionID, char *fieldname, int *ntype, int *rank, long dims[], long *size);
+int
+HE5_SWperinfo(int swathID, int periodID, char *fieldname, int *ntype, int *rank, long dims[], long *size);
+int   
+HE5_SWidtype(int swathID, char *fieldname, char *attrname, int fieldgroup, int *Type, int *Class, int *Order, long *size);
+int    
+HE5_SWaliasinfoF(int swathID, int fldgroup, char *aliasname, int *length, char *buffer);
+long
+HE5_SWinqdfldaliasF(int swathID, char *fldalias, long *strbufsize);
+long
+HE5_SWinqgfldaliasF(int swathID, char *fldalias, long *strbufsize);
+int
+HE5_SWchunkinfoF(int swathID, char *fieldname, int *ndims, long dims[]);
+long
+HE5_SWgetaliaslistF(int swathID, int fldgroup, char *aliaslist, long *strbufsize);
+
+
+/* Subsetting routines */
+
+int
+HE5_SWdefboxreg(int swathID, double  cornerlon[], double cornerlat[], int mode);
+int
+HE5_SWdefvrtreg(int rwathID, int regionID, char *vertObj, double fortrange[]);
+int
+HE5_SWdeftmeper(int swathID, double starttime, double stoptime, int mode);
+int    
+HE5_SWextreg(int swathID, int regionID, char *fieldname, int externalflag, void *buffer);
+int    
+HE5_SWextper(int swathID, int periodID, char *fieldname, int externalflag, void *buffer);
+int
+HE5_SWregidx(int swathID, double cornerlon[], double cornerlat[], int mode, char *geodim, long idxrange[]);
+int 
+HE5_SWdupreg(int oldregionID);
+int    
+HE5_SWupscene(int swathID, int regionID);
+int
+HE5_SWindexinfoF(int regionID, char *object, int *rank, char *fortdimlist, long *fortindices);
+
+
+/* PROFILE INTERFACE */
+
+int  
+HE5_PRdefineF(int swathID, char *profilename, char *fortdimlist, char *fortmaxdimlist, int datatype_id);
+int    
+HE5_PRwriteF(int swathID, char *profilename, long fortstart[], long fortstride[], long fortedge[], long size, long len[], void *buffer);
+int     
+HE5_PRreadF(int swathID, char *profilename, long fortstart[], long fortstride[], long fortedge[], long len[], void *buffer);
+long  
+HE5_PRinquireF(int swathID, char *profnames, int *rank, int *ntype);
+int      
+HE5_PRinfoF(int swathID, char *profname, int *rank, long dims[], long maxdims[], int *ntype, char *fortdimlist, char *fortmaxdimlist);
+int
+HE5_PRwrgattrF(int swathID, char *attrname, int ntype, long fortcount[], void *datbuf);
+int
+HE5_PRrdgattrF(int swathID, char *attrname, void *datbuf);
+int
+HE5_PRgattrinfoF(int swathID, char *attrname, int *ntype, long *fortcount);
+long
+HE5_PRinqgattrsF(int swathID, char *attrnames, long *strbufsize);
+
+
+/* EXTERNAL DATA FILE INTERFACE */
+
+int   
+HE5_SWsetextdataF(int swathID, char *fortfilelist, long offset[], long size[]);
+int   
+HE5_SWgetextdataF(int swathID, char *fieldname, long namelength, char *fortfilelist, long offset[], long size[]);
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWopen                                                       |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|     fid          hid_t    None       HDF-EOS file ID                        |
+|                                                                             |
+|  INPUTS:                                                                    |
+|     filename    char*    None       File name string                        |
+|     flags       uintn    None       File access code                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|     None                                                                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date       Programmer   Description                                       |
+|  ========   ============  ================================================= |
+|  July  00   A.Muslimov    Unmasked hdf5 data types.                         |
+|                                                                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t 
+HE5_SWopen(const char *filename, uintn flags)
+{
+  hid_t     fid      = FAIL;/* hdf5 type file ID      */ 
+
+  char      *errbuf  = NULL;/* Error message buffer   */
+
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWopen", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+
+      return(FAIL);
+    }  
+
+  /* Call HE5_EHopen to open file */
+  /* ---------------------------- */
+  fid = HE5_EHopen(filename,flags, H5P_DEFAULT );
+  if(fid == FAIL)
+    {
+      sprintf(errbuf, "Cannot open the file \"%s\". Check the file name. \n", filename);
+      H5Epush(__FILE__, "HE5_SWopen", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }  
+  
+  free(errbuf);
+
+  return (fid);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWcreate                                                     |
+|                                                                             |
+|  DESCRIPTION: Creates a new swath structure and returns swath ID            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|   swathID       hid_t        None        Swath ID                           |
+|                                                                             |
+|  INPUTS:                                                                    |
+|   fid           hid_t        None        HDF-EOS file ID                    |
+|   swathname     const char*  None        Swath name string                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|   None                                                                      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                              ___________                                    |
+|                              |  Swath  |                                    |
+|                              -----------                                    |
+|                             /     |     \                                   |
+|                           Data  Profile Geolocation                         |
+|                          Fields  Fields    Fields                           |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7/20/99  A. Muslimov   Replaced parameter gid by fid in the call to        |
+|                         EHinsertmeta().                                     |
+|  8/20/99  A. Muslimov   Fixed a bug associated with a swath numbering:      |
+|                         within the 'if(nswathopen < NSWATH ){}' block       |
+|                         initialized NSWATH to NSWATHopen. Checked for the   |
+|                         statuses returned by H5Gclose() calls.              |
+|  8/31/99  A. Muslimov   Disabled assignment NSWATH = NSWATHopen. Replaced   |
+|                         the call to EHattrcat() by EHdatasetcat(). Added    |
+|                         error hadling after the calls to EHinsertmeta() and |
+|                         EHdatasetcat().                                     |
+|  02/08/00 A. Muslimov   Added more error checkings.                         |
+|  04/05/00 A. Muslimov   Removed "Ragged Arrays" group.                      |
+|  July  00 A. Muslimov   Unmasked hdf5 data types.                           |
+|  Sep   00 A. Muslimov   Added "PRofile Fields" group.                       |
+|  Dec   00 A. Muslimov   Added "ProfileField" section to the metadata.       |
+|  Sep   01 A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  Feb   03 S. Zhao       Removed the creation of the "Profile Fields" group  |
+|                         to HE5_PRdefine().                                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t 
+HE5_SWcreate(hid_t fid, const char *swathname)
+{
+  hid_t           swathID        = FAIL;/* return value of Swath ID        */
+  hid_t           HDFfid         = FAIL;/* HDF-EOS file ID                 */
+  hid_t           gid            = FAIL;/* "HDFEOS" group ID               */
+  hid_t           sw_id          = FAIL;/* HDF-EOS swath ID                */
+  hid_t           geo_id         = FAIL;/* "Geolocation Fields" group ID   */
+  hid_t           data_id        = FAIL;/* "Data Fields" group ID          */
+  hid_t           prof_id        = FAIL;/* "Profile Fields" group ID       */
+  hid_t           SWATHS_ID      = FAIL;/* "SWATHS" group ID               */
+  hid_t           i;                    /* Loop index                      */
+
+  int             nswathopen     = 0;   /* # of swath structures open      */
+
+  herr_t          status         = FAIL;/* routine return status variable  */
+  
+  uintn           access         = 0;   /* Read/Write file access code     */
+  
+  long            nSwath         = FAIL;/* Swath counter                   */
+  
+  char            *errbuf =(char *)NULL;/* Buffer for error message        */
+  char            *utlbuf =(char *)NULL;/* Utility buffer                  */
+  char            *utlbuf2=(char *)NULL;/* Utility buffer 2                */
+  
+  HE5_LOCK;
+  CHECKNAME(swathname);
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf = (char *)calloc( HE5_HDFE_DIMBUFSIZE, sizeof(char ) ) ;
+  if ( errbuf == NULL )
+    {
+      H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+  /*
+   * Check HDF-EOS file ID, get  HDFEOS group ID  and
+   * access code
+   */
+  status = HE5_EHchkfid(fid, "HE5_SWcreate", &HDFfid,  &gid, &access);
+  /* Check file access */
+  /* ------------------*/
+  if ( access == 0 )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot call HE5_SWcreate on a file opened read-only.\n");
+      H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for file ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+  
+  /* Check swathname for length */
+  /* -------------------------- */
+  if ( strlen(swathname) > HE5_OBJNAMELENMAX)
+    {
+      sprintf(errbuf, "Swath name \"%s\" must be less than %d characters.\n", swathname, HE5_OBJNAMELENMAX);
+      H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+	
+      return(FAIL);
+    }
+  
+  
+  /* Determine number of swaths currently opened */
+  /* ------------------------------------------- */
+  for (i = 0; i < HE5_NSWATH; i++)
+    nswathopen += HE5_SWXSwath[i].active;
+  
+  if(nswathopen <  HE5_NSWATH)
+    {
+
+      /* Probe , check if "SWATHS" group exists */
+      /* -------------------------------------- */
+      H5E_BEGIN_TRY {
+	SWATHS_ID = H5Gopen(gid, "SWATHS");
+      }
+      H5E_END_TRY;
+
+      if(SWATHS_ID == FAIL )
+	{
+	  nSwath = 0;
+
+	  /* Create the "SWATHS" group */
+	  /* ------------------------- */
+	  SWATHS_ID = H5Gcreate(gid,"SWATHS",0);
+	  if(SWATHS_ID == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot create the \"SWATHS\" group.\n");
+	      H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+			    
+	      return(FAIL);
+	    }
+		
+	}
+      else
+	{
+	  /* Probe , check if swathname group exist */
+	  /* -------------------------------------- */
+	  H5E_BEGIN_TRY{
+	    sw_id = H5Gopen(SWATHS_ID, swathname);
+	  }
+	  H5E_END_TRY;
+
+	  if( sw_id == FAIL ) 
+	    {
+	      /* Get the number of swaths in "SWATHS" group */
+	      /* ------------------------------------------ */
+	      nSwath = HE5_EHdatasetcat(fid, "/HDFEOS/SWATHS", NULL, NULL);
+	      if (nSwath == FAIL)
+		{
+		  sprintf(errbuf,"Cannot retrieve the number of swaths.\n");
+		  H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  status = H5Gclose(SWATHS_ID);
+		  free(errbuf);
+			    
+		  return(FAIL);
+		}
+
+	    }
+	  else
+	    {
+	      sprintf(errbuf, "Swath \"%s\" already exists.\n", swathname);
+	      H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_EXISTS, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      status = H5Gclose(SWATHS_ID);
+	      free(errbuf);
+			
+	      return(FAIL);
+	    }
+
+	}
+
+
+      /* Swath does not exist */
+      /* -------------------- */
+	 
+
+      /* Create swathname group */
+      /* ---------------------- */
+      sw_id = H5Gcreate( SWATHS_ID, swathname, 0);
+      if(sw_id == FAIL)
+	{
+	  sprintf(errbuf,"Cannot create the \"%s\" group.\n", swathname);
+	  H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  status = H5Gclose(SWATHS_ID);
+	  free(errbuf);
+	     
+	  return(FAIL);
+	}
+
+      /* Create "/SWATH/swathname/Geolocation Fields" group */
+      /* -------------------------------------------------- */
+      geo_id = H5Gcreate( sw_id, "Geolocation Fields", 0);
+      if(geo_id == FAIL)
+	{
+	  sprintf(errbuf,"Cannot create the \"Geolocation Fields\" group.\n");
+	  H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  status = H5Gclose(SWATHS_ID);
+	  free(errbuf);
+	     
+	  return(FAIL);
+	}
+
+      /* Create /SWATH/swathname/Data Fields group */
+      /* ----------------------------------------- */
+      data_id = H5Gcreate( sw_id, "Data Fields", 0);
+      if(data_id == FAIL)
+	{
+	  sprintf(errbuf,"Cannot create the \"Data Fields\" group.\n");
+	  H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  status = H5Gclose(SWATHS_ID);
+	  free(errbuf);
+	     
+	  return(FAIL);
+	}
+
+      /* Create /SWATH/swathname/Profile Fields group */
+      /* -------------------------------------------- */
+      /*
+	prof_id = H5Gcreate( sw_id, "Profile Fields", 0);
+	if(prof_id == FAIL)
+	{
+	sprintf(errbuf,"Cannot create the \"Profile Fields\" group.\n");
+	H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf);
+	HE5_EHprint(errbuf, __FILE__, __LINE__);
+	status = H5Gclose(SWATHS_ID);
+	free(errbuf);
+	     
+	return(FAIL);
+	}
+      */
+
+
+      /* Allocate memory for utility buffers */
+      /* ----------------------------------- */
+      utlbuf  = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char ) ) ;
+      if ( utlbuf == NULL )
+	{
+	  H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for utility buffer.\n");
+	  HE5_EHprint("Error: Cannot allocate memory for utility buffer, occured", __FILE__, __LINE__);
+	  status = H5Gclose(SWATHS_ID);
+	  free(errbuf);
+	     
+	  return(FAIL);
+	}
+      utlbuf2 = (char *)calloc(HE5_HDFE_UTLBUFSIZE,  sizeof(char ) ) ;	 
+      if ( utlbuf2 == NULL )
+	{
+	  H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for utility buffer2.\n");
+	  HE5_EHprint("Error: Cannot allocate memory for utility buffer2, occured", __FILE__, __LINE__);
+	  status = H5Gclose(SWATHS_ID);
+	  free(errbuf);
+	  free(utlbuf);
+	     
+	  return(FAIL);
+	}
+
+
+      /* Establish Swath in "Structural MetaData" Block */
+      /* ---------------------------------------------- */
+      sprintf(utlbuf, "%s%li%s%s%s", "\tGROUP=SWATH_", nSwath + 1, "\n\t\tSwathName=\"", swathname, "\"\n");
+      strcat(utlbuf, "\t\tGROUP=Dimension\n");
+      strcat(utlbuf, "\t\tEND_GROUP=Dimension\n");
+      strcat(utlbuf, "\t\tGROUP=DimensionMap\n");
+      strcat(utlbuf, "\t\tEND_GROUP=DimensionMap\n");
+      strcat(utlbuf, "\t\tGROUP=IndexDimensionMap\n");
+      strcat(utlbuf, "\t\tEND_GROUP=IndexDimensionMap\n");
+      strcat(utlbuf, "\t\tGROUP=GeoField\n");
+      strcat(utlbuf, "\t\tEND_GROUP=GeoField\n");
+      strcat(utlbuf, "\t\tGROUP=DataField\n");
+      strcat(utlbuf, "\t\tEND_GROUP=DataField\n");
+      strcat(utlbuf, "\t\tGROUP=ProfileField\n");
+      strcat(utlbuf, "\t\tEND_GROUP=ProfileField\n");
+      strcat(utlbuf, "\t\tGROUP=MergedFields\n");
+      strcat(utlbuf, "\t\tEND_GROUP=MergedFields\n");
+      sprintf(utlbuf2, "%s%li%s","\tEND_GROUP=SWATH_", nSwath + 1, "\n");
+      strcat(utlbuf, utlbuf2);
+	 
+      /* Insert metadata buffer to the "StructMetadata" */
+      /* ---------------------------------------------- */
+      status = HE5_EHinsertmeta(fid, (char*)swathname, "s", 1001L, utlbuf, NULL);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot insert metadata buffer to \"StructMetadata\".\n");
+	  H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  status = H5Gclose(SWATHS_ID);
+	  free(errbuf);
+	  free(utlbuf);
+	  free(utlbuf2);
+	    
+	  return(FAIL);
+	}
+
+      /* Release "SWATHS" group ID */
+      /* ------------------------- */
+
+      status = H5Gclose(SWATHS_ID);
+      if(status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the \"SWATHS\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  status = H5Gclose(SWATHS_ID);
+	  free(utlbuf);
+	  free(utlbuf2);
+	  free(errbuf);
+	     
+	  return(FAIL);
+	}	 
+
+
+      /* Assign swathID & Load swath and SWXSwath table entries */
+      /* ------------------------------------------------------ */
+      for (i = 0; i < HE5_NSWATH; i++)
+	{
+	  if (HE5_SWXSwath[i].active == 0)
+	    {
+	      /*
+	       * Set sw_id, Set swath entry active, Store root group
+	       * ID, Store sub group IDs, Store HDF-EOS file ID
+	       */
+	      HE5_SWXSwath[i].active                     = 1;
+	      HE5_SWXSwath[i].sw_id                      = sw_id;
+	      HE5_SWXSwath[i].data_id                    = data_id;
+	      HE5_SWXSwath[i].prof_id                    = prof_id;
+	      HE5_SWXSwath[i].geo_id                     = geo_id;
+	      HE5_SWXSwath[i].fid                        = fid;
+	      HE5_SWXSwath[i].obj_id                     = SWATHS_ID;
+	      HE5_SWXSwath[i].plist                      = FAIL;
+	      strcpy(HE5_SWXSwath[i].swname, swathname);
+	      HE5_SWXSwath[i].compcode                   = HE5_HDFE_COMP_NONE;
+	      swathID                                    = i + HE5_SWIDOFFSET;
+	      break;
+	    }
+	}
+    }
+  else
+    {
+      /* Too many files opened */
+      /* --------------------- */
+      swathID = FAIL;
+      sprintf(errbuf,"\n Illegal attempt to open more than %d swaths simultaneously.\n", HE5_NSWATH);
+      H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  
+  /* Release allocated memory */
+  /* ------------------------ */
+  free(errbuf);
+  free(utlbuf);
+  free(utlbuf2);
+
+ COMPLETION: 
+  
+  HE5_UNLOCK;
+  return (swathID);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWattach                                                     |
+|                                                                             |
+|  DESCRIPTION:  Attaches to an existing swath within the file.               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  swathID        hid_t               swath structure ID                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               HDF-EOS file ID                         |
+|  swathname      char                swath structure name                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|             (02/23/00 A.M.) The iteration over the "Data Fields" group has  |
+|             the followings side effect:  it counts as an object (which is   |
+|             supposed to be a dataset) the group "Ragged Arrays". So the     |
+|             external structure "ddataset" gets filled with  a fake member   |
+|             and nDFLD gets incremented by one. This shouldn't affect the    |
+|             other interfacing routines unless someone tries to  access the  |
+|             datasets in "Data Fields" group directly through their IDs      |
+|             retrieved from external "ddataset" structure, or use "nDFLD"    |
+|             data member of to retrieve the actual number of data sets       |
+|             (fields).  To avoid potential problems, the dataset counter is  |
+|             decremented by one and the corresponding error checking are     |
+|             inserted to handle this case.                                   |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|   Date        Programmer    Description                                     |
+|  =========   ============  ==============================================   |
+|  Aug 6,99    A. Muslimov   In the first block if( inout.name != NULL){}     |
+|                            changed the statement next to the last one from  |
+|                            "if(inout.name==NULL) free(inout.name);" onto    |
+|                            "if(inout.name!=NULL) free(inout.name);".Changed |
+|                            the type of datid from int32_t to hid_t.         |
+| 10/18/99     A.Muslimov    Replaced memcpy() by memmove() to avoid a problem|
+|                            when arguments 1 and 2 overlap in memory.        |
+| 10/28/99     A.Muslimov    Added ragged array stuff.                        |
+| 02/08/00     A.Muslimov    Added more error checkings.                      |
+| 04/05/00     A.Muslimov    Removed "Ragged Arrays" group.                   |
+| July  00     A.Muslimov    Unmasked hdf5 data types.                        |
+| Sep   00     A.Muslimov    Added "PRofile Fields group" and stuff           |
+| Sep   01     A. Muslimov   Added mutex "lock"/"unlock" calls.               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t 
+HE5_SWattach(hid_t fid, const char *swathname)
+{
+
+  hid_t           swathID    = FAIL;/* Swath ID (return value)       */ 
+  hid_t           i;			    /* Loop index                    */
+  hid_t           emptyslot  =  0;  /* Spare swath index             */
+
+  herr_t          status     = FAIL;/* Return status variable        */
+
+  int             nswathopen =  0;  /* # of swath structures open    */
+  int             idx        = FAIL;/* return value from an operator */
+
+  uintn           acs        = 0;   /* Read/Write file access code   */
+
+  hid_t           HDFfid     = FAIL;/* HDF-EOS file ID               */
+  hid_t           datid      = FAIL;/* Dataset ID                    */
+  hid_t           profid     = FAIL;/* Profile dataset ID            */
+  hid_t           gid        = FAIL;/* "HDFEOS" group ID             */
+  hid_t           geo_id     = FAIL;/* "Geolocation Fields" Group ID */
+  hid_t           data_id    = FAIL;/* "Data Fields" Group ID        */
+  hid_t           prof_id    = FAIL;/* "PRofile Fields" Group ID     */
+  hid_t           sw_id      = FAIL;/* Swath ID                      */
+  
+    
+  HE5_OBJINFO     inout;		 /* IN/OUT operator data             */
+
+  char            *grpname =NULL;/* Ptr to a group  name string      */
+  char            *tmpname1=NULL;/* ..... temporary name 1  ...      */
+  char            *tmpname2=NULL;/* ..... temporary name 2  ...      */
+  char            *tmpname3=NULL;/* ..... temporary name 3  ...      */
+  char            *namebuf =NULL;/* ..... temporary name    ...      */
+  char            *fldname =NULL;/* ..... temporary field name ...   */
+  char            *comma   =NULL;
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer*/
+
+
+  HE5_LOCK;
+  CHECKPOINTER(swathname);
+
+  /* Check HDF-EOS file ID, get back HDF file ID and access code */
+  /* ----------------------------------------------------------- */
+  status = HE5_EHchkfid(fid, "HE5_SWattach", &HDFfid, &gid, &acs);
+  if ( status == FAIL )
+    {
+      H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_ARGS, H5E_BADRANGE, "Checking for file ID failed.\n");
+      HE5_EHprint("Error: Checking for file ID failed, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Determine number of swaths currently opened */
+  /* ------------------------------------------- */
+  for (i = 0; i < HE5_NSWATH; i++)
+    nswathopen += HE5_SWXSwath[i].active;
+
+  /* Is there a room for more ? */
+  /* -------------------------- */
+  if (nswathopen < HE5_NSWATH)
+    {
+      /* Search for group "/SWATHS/swathname" */
+      /* ==================================== */ 
+      grpname = (char *) calloc( (strlen(swathname)+40), sizeof(char) );
+      if (grpname == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for grpname.\n") ;
+	  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+
+	  return(FAIL);
+	}
+	      
+      strcpy( grpname, "/HDFEOS/SWATHS/");
+      strcat( grpname, swathname);
+
+      /*
+       * If group with swathname found, open the group, load tables
+       */
+      H5E_BEGIN_TRY{
+	sw_id = H5Gopen(HDFfid, grpname);
+      }
+      H5E_END_TRY;
+
+      if( sw_id == FAIL )
+	{
+	  sprintf(errbuf, "Swath \"%s\" does not exist within HDF-EOS file.\n",swathname) ;
+	  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+
+	  return(FAIL);
+	}
+
+      /* Attach to "Geolocation Fields" */
+      /* =============================  */
+      geo_id  = H5Gopen( sw_id, "Geolocation Fields");
+      if (geo_id == FAIL)
+	{
+	  sprintf(errbuf, "Cannot open the \"Geolocation Fields\" group.\n") ;
+	  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+
+	  return(FAIL);
+	}
+	      
+      /* Attach to "Data Fields" */
+      /* ======================= */
+      data_id = H5Gopen( sw_id, "Data Fields");
+      if (data_id == FAIL)
+	{
+	  sprintf(errbuf, "Cannot open the \"Data Fields\" group. \n") ;
+	  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+
+	  return(FAIL);
+	}
+
+
+      /* Attach to "Profile Fields" */
+      /* ========================== */
+      H5Eset_auto(NULL, NULL);
+      prof_id = H5Gopen( sw_id, "Profile Fields");
+      /*
+	if (prof_id == FAIL)
+	{
+	sprintf(errbuf, "Cannot open the \"Profile Fields\" group. \n") ;
+	H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	HE5_EHprint(errbuf, __FILE__, __LINE__);
+	free(grpname);
+
+	return(FAIL);
+	}
+      */
+
+
+      /* Setup External Arrays */
+      /* --------------------- */
+      for (i = 0; i < HE5_NSWATH; i++)
+	{
+	  /* Find empty entry in array */
+	  /* ------------------------- */
+	  if (HE5_SWXSwath[i].active == 0)
+	    {
+	      /* Set IDs, codes., etc */
+	      /* ==================== */ 
+	      HE5_SWXSwath[i].active           = 1;
+	      HE5_SWXSwath[i].data_id          = data_id;
+	      HE5_SWXSwath[i].prof_id          = prof_id;
+	      HE5_SWXSwath[i].geo_id           = geo_id;
+	      HE5_SWXSwath[i].fid              = fid;
+	      HE5_SWXSwath[i].sw_id            = sw_id;
+	      HE5_SWXSwath[i].plist            = FAIL;
+	      HE5_SWXSwath[i].compcode         = HE5_HDFE_COMP_NONE;
+
+	      swathID                          = i + HE5_SWIDOFFSET;
+	      strcpy(HE5_SWXSwath[i].swname, swathname);
+	      break;
+	    }
+	}
+      emptyslot = i;
+
+      /*  Access swath "Data Fields" datasets   */
+      /* -------------------------------------- */
+      tmpname1 = (char *) calloc( (strlen(grpname)+ 20), sizeof(char));
+      if (tmpname1 == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for tmpname1. \n") ;
+	  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+
+	  return(FAIL);
+	}
+
+      strcpy(tmpname1,grpname);
+      strcat(tmpname1,"/Data Fields");
+
+
+      /* Get the number of OBJECTS in "Data Fields" group */
+      /* ================================================ */ 
+      inout.count   = 0;
+      inout.name    = NULL;
+      inout.strsize = 0;
+
+      idx = H5Giterate(data_id, tmpname1 , NULL, HE5_EHobj_info, &inout);
+      if ( idx == FAIL )
+	{
+	  sprintf(errbuf, "Iteration of \"HE5_EHobj_info()\" operation failed. \n") ;
+	  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  free(tmpname1);
+
+	  return(FAIL);
+	}
+
+      free(tmpname1);
+ 
+      /* Set the data members of external structure */
+      /* ========================================== */  
+      HE5_SWXSwath[emptyslot].nDFLD = inout.count;
+
+      /*------------------------------------------------------*/ 
+      /* Loop through all data field datasets and open it     */
+      /* Allocate space for namebuf, copy inout.name into it, */
+      /*              and append comma                        */
+      /*------------------------------------------------------*/
+      if( inout.name != NULL && inout.count > 0 )
+	{
+	  /* Allocate memory to ddataset struct */
+	  /* ---------------------------------- */
+	  HE5_SWXSwath[emptyslot].ddataset = (HE5_DTSinfo *)realloc((void *)HE5_SWXSwath[emptyslot].ddataset,(HE5_SWXSwath[emptyslot].nDFLD) * sizeof(HE5_DTSinfo));
+
+	  /* Allocate memory to the list of dataset names */
+	  /* -------------------------------------------- */
+	  namebuf = (char *) calloc(strlen(inout.name) + 2, sizeof(char));
+	  if (namebuf == NULL)
+	    {
+	      sprintf(errbuf, "Cannot allocate memory for namebuf. \n") ;
+	      H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(grpname);
+		       
+	      return(FAIL);
+	    }
+
+	  strcpy(namebuf, inout.name);
+	  strcat(namebuf, ",");
+
+	  /* Find comma */
+	  /* ---------- */
+	  comma = strchr(namebuf, ',');
+
+	  i = 0;
+
+	  /* Parse the list of dataset names */
+	  /* ------------------------------- */
+	  while (comma != NULL)
+	    {
+	      /* Allocate memory for fldname buffer */
+	      /* ---------------------------------- */
+	      fldname = (char *) calloc(comma - namebuf + 1, sizeof(char));
+	      if (fldname == NULL)
+		{
+		  sprintf(errbuf, "Cannot allocate memory for fldname. \n") ;
+		  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(grpname);
+		  free(namebuf);
+				  
+		  return(FAIL);
+		}
+
+	      /* Copy field list entry to fldname */
+	      /* -------------------------------- */
+	      memmove(fldname, namebuf, comma - namebuf);
+	      fldname[comma-namebuf]=0;
+  
+	      /* open dataset fldname */
+	      /* -------------------- */
+	      H5E_BEGIN_TRY{
+		datid = H5Dopen(data_id, fldname);
+	      }H5E_END_TRY;
+	      if ( datid == FAIL )
+		{
+		  sprintf(errbuf, "Cannot open the dataset \"%s\". \n",fldname );
+		  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(grpname);
+		  free(namebuf);
+		  free(fldname);
+		       
+		  return(FAIL);
+		}
+
+	      /* allocate memory to the dataset name */
+	      /* ----------------------------------- */
+	      HE5_SWXSwath[emptyslot].ddataset[i].name = (char *)calloc((strlen(fldname)+1), sizeof(char) );
+	      if (HE5_SWXSwath[emptyslot].ddataset[i].name == NULL)
+		{
+		  sprintf(errbuf, "Cannot allocate memory for the dataset name. \n") ;
+		  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(grpname);
+		  free(namebuf);
+		  free(fldname);
+		       
+		  return(FAIL);
+		}
+
+	      /* Set the data members of external structure */
+	      /* ========================================== */  
+	      HE5_SWXSwath[emptyslot].ddataset[i].ID = datid;
+	      strcpy(HE5_SWXSwath[emptyslot].ddataset[i].name, fldname);
+
+
+	      /* Go to next field entry, find next comma, ... */
+	      /* ============================================ */ 
+	      memmove(namebuf, comma + 1, strlen(comma + 1) + 1); 
+	      comma = strchr(namebuf, ',');
+	      if (fldname != NULL) free(fldname);
+	      i++;
+
+	    }
+
+	  if (namebuf != NULL) free(namebuf);
+	  if(inout.name != NULL ) free( inout.name);
+
+	} /* end if(inout.name!=NULL) */
+
+
+
+	  /*  Access swath "Geolocation Fields" datasets  */
+	  /*  ------------------------------------------- */
+      tmpname2 = (char *)calloc( (strlen(grpname)+60), sizeof(char) );
+      if (tmpname2 == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for tmpname2. \n") ;
+	  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+		       
+	  return(FAIL);
+	}
+
+      strcpy(tmpname2,grpname);
+      strcat(tmpname2,"/Geolocation Fields");
+
+      /* Get the number of OBJECTS in "Geolocation Fileds" group */
+      /* ======================================================= */ 
+      inout.count   = 0;
+      inout.name    = NULL;
+      inout.strsize = 0;
+
+      idx = H5Giterate(geo_id, tmpname2 , NULL, HE5_EHobj_info, &inout);
+      if ( idx == FAIL )
+	{
+	  sprintf(errbuf, "Iteration of \"HE5_EHobj_info()\" operation failed. \n") ;
+	  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  free(tmpname2);
+
+	  return(FAIL);
+	}
+
+      /* Set the data members of external structure */
+      /* ========================================== */  
+      HE5_SWXSwath[emptyslot].nGFLD = inout.count;
+
+      if (tmpname2 != NULL) free(tmpname2);
+
+      /*-----------------------------------------------------*/
+      /* Loop through all data fileds dataset and open it    */
+      /* Allocate space for namebuf, copy inout.name into it */
+      /*    and  append comma                                */
+      /*-----------------------------------------------------*/
+      if( inout.name != NULL && inout.count > 0)
+	{
+	  /* allocate memory to gdataset struct */
+	  /* ---------------------------------- */
+	  HE5_SWXSwath[emptyslot].gdataset = (HE5_DTSinfo *)realloc((void *)HE5_SWXSwath[emptyslot].gdataset, (HE5_SWXSwath[emptyslot].nGFLD) * sizeof(HE5_DTSinfo));
+
+
+	  /* Allocate memory to the list of dataset names */
+	  /* -------------------------------------------- */
+	  namebuf = (char *) calloc(strlen(inout.name) + 2, sizeof(char));
+	  if (namebuf == NULL)
+	    {
+	      sprintf(errbuf, "Cannot allocate memory for namebuf. \n") ;
+	      H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(grpname);
+		       
+	      return(FAIL);
+	    }
+
+	  strcpy(namebuf, inout.name);
+	  strcat(namebuf, ",");
+
+	  /* Find comma */
+	  /* ---------- */
+	  comma = strchr(namebuf, ',');
+
+	  i = 0;
+
+	  /* Parse the list of dataset names */
+	  /* ------------------------------- */
+	  while (comma != NULL)
+	    {
+	      /* Copy field list entry to fldname */
+	      /* -------------------------------- */
+	      fldname = (char *) calloc(comma - namebuf + 1, sizeof(char));
+	      if (fldname == NULL)
+		{
+		  sprintf(errbuf, "Cannot allocate memory for fldname. \n") ;
+		  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(grpname);
+		  free(namebuf);
+		       
+		  return(FAIL);
+		}
+
+	      memmove(fldname, namebuf, comma - namebuf);
+	      fldname[comma-namebuf]='\0';
+
+	      /* open dataset fldname */
+	      /* -------------------- */
+	      datid = H5Dopen(geo_id,fldname);
+	      if ( datid == FAIL )
+		{
+		  sprintf(errbuf, "Cannot open the dataset \"%s\". \n",fldname );
+		  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(grpname);
+		  free(namebuf);
+		  free(fldname);
+		       
+		  return(FAIL);
+		}
+
+	      /* Allocate memory to the dataset name */
+	      /* ----------------------------------- */
+	      HE5_SWXSwath[emptyslot].gdataset[i].name = (char *)calloc( (strlen(fldname)+1), sizeof(char) );
+	      if (HE5_SWXSwath[emptyslot].gdataset[i].name == NULL)
+		{
+		  sprintf(errbuf, "Cannot allocate memory for name. \n") ;
+		  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(grpname);
+		  free(namebuf);
+		  free(fldname);
+		       
+		  return(FAIL);
+		}
+
+	      /* Set the data members of external structure */
+	      /* ========================================== */  
+	      HE5_SWXSwath[emptyslot].gdataset[i].ID = datid;
+	      strcpy(HE5_SWXSwath[emptyslot].gdataset[i].name, fldname);
+
+
+	      /*  Go to next field entry, ...   */
+	      /* =============================  */ 
+	      memmove(namebuf, comma + 1, strlen(comma + 1) + 1); 
+	      comma = strchr(namebuf, ',');
+	      if (fldname != NULL) free(fldname);
+	      i++;
+	    }
+
+	  if (namebuf != NULL) free(namebuf);
+	  if(inout.name != NULL) free(inout.name);
+	  inout.name = NULL;
+
+	} /* end if(inout.name!==NULL) */
+
+
+	  /*  Access swath "Profile Fields" datasets   */
+	  /* ----------------------------------------- */
+      if (prof_id != FAIL)
+	{
+
+	  tmpname3 = (char *) calloc( (strlen(grpname)+ 20), sizeof(char));
+	  if (tmpname3 == NULL)
+	    {
+	      sprintf(errbuf, "Cannot allocate memory for tmpname3. \n") ;
+	      H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(grpname);
+
+	      return(FAIL);
+	    }
+
+	  strcpy(tmpname3,grpname);
+	  strcat(tmpname3,"/Profile Fields");
+
+
+	  /* Get the number of OBJECTS in "PRofile Fields" group */
+	  /* =================================================== */ 
+	  inout.count   = 0;
+	  inout.name    = NULL;
+	  inout.strsize = 0;
+
+	  idx = H5Giterate(HE5_SWXSwath[emptyslot].prof_id, tmpname3 , NULL, HE5_EHobj_info, &inout);
+	  if ( idx == FAIL )
+	    {
+	      sprintf(errbuf, "Iteration of \"HE5_EHobj_info()\" operation failed. \n") ;
+	      H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(grpname);
+	      free(tmpname3);
+
+	      return(FAIL);
+	    }
+
+	  free(tmpname3);
+ 
+	  /* Set the data members of external structure */
+	  /* ========================================== */  
+	  HE5_SWXSwath[emptyslot].nPROF = inout.count;
+
+	  /*-----------------------------------------------------------*/ 
+	  /* Loop through all "Profile Field" datasets and open it     */
+	  /* Allocate space for namebuf, copy inout.name into it,      */
+	  /*              and append comma                             */
+	  /*-----------------------------------------------------------*/
+	  if( inout.name != NULL && inout.count > 0 )
+	    {
+	      /* Allocate memory to ddataset struct */
+	      /* ---------------------------------- */
+	      HE5_SWXSwath[emptyslot].pdataset = (HE5_DTSinfo *)realloc((void *)HE5_SWXSwath[emptyslot].pdataset,(HE5_SWXSwath[emptyslot].nPROF) * sizeof(HE5_DTSinfo));
+	      /* Allocate memory to the list of dataset names */
+	      /* -------------------------------------------- */
+	      namebuf = (char *) calloc(strlen(inout.name) + 2, sizeof(char));
+	      if (namebuf == NULL)
+		{
+		  sprintf(errbuf, "Cannot allocate memory for namebuf. \n") ;
+		  H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(grpname);
+		       
+		  return(FAIL);
+		}
+
+	      strcpy(namebuf, inout.name);
+	      strcat(namebuf, ",");
+		  
+	      /* Find comma */
+	      /* ---------- */
+	      comma = strchr(namebuf, ',');
+
+	      i = 0;
+
+	      /* Parse the list of dataset names */
+	      /* ------------------------------- */
+	      while (comma != NULL)
+		{
+		  /* Allocate memory for fldname buffer */
+		  /* ---------------------------------- */
+		  fldname = (char *) calloc(comma - namebuf + 1, sizeof(char));
+		  if (fldname == NULL)
+		    {
+		      sprintf(errbuf, "Cannot allocate memory for fldname buffer. \n") ;
+		      H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(grpname);
+		      free(namebuf);
+		       
+		      return(FAIL);
+		    }
+		  /* Copy field list entry to fldname */
+		  /* -------------------------------- */
+		  memmove(fldname, namebuf, comma - namebuf);
+		  fldname[comma-namebuf]=0;
+  
+		  /* open dataset fldname */
+		  /* -------------------- */
+		  H5E_BEGIN_TRY{
+		    profid = H5Dopen(prof_id, fldname);
+		  }H5E_END_TRY;
+		  if ( profid == FAIL )
+		    {
+		      sprintf(errbuf, "Cannot open the profile dataset \"%s\". \n",fldname );
+		      H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(grpname);
+		      free(namebuf);
+		      free(fldname);
+		       
+		      return(FAIL);
+		    }
+
+		  /* allocate memory to the dataset name */
+		  /* ----------------------------------- */
+		  HE5_SWXSwath[emptyslot].pdataset[i].name = (char *)calloc((strlen(fldname)+1), sizeof(char) );
+		  if (HE5_SWXSwath[emptyslot].pdataset[i].name == NULL)
+		    {
+		      sprintf(errbuf, "Cannot allocate memory for profile name. \n") ;
+		      H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(grpname);
+		      free(namebuf);
+		      free(fldname);
+				  
+		      return(FAIL);
+		    }
+
+		  /* Set the data members of external structure */
+		  /* ========================================== */  
+		  HE5_SWXSwath[emptyslot].pdataset[i].ID = profid;
+		  strcpy(HE5_SWXSwath[emptyslot].pdataset[i].name, fldname);
+
+		  /* Go to next field entry, find next comma, ... */
+		  /* ============================================ */ 
+		  memmove(namebuf, comma + 1, strlen(comma + 1) + 1); 
+		  comma = strchr(namebuf, ',');
+		  if (fldname != NULL) free(fldname);
+		  i++;
+		}
+		  
+	      if (namebuf != NULL) free(namebuf);
+	      if(inout.name != NULL ) free( inout.name);
+		  
+	    } /* end if(inout.name!=NULL) */
+	}
+	  
+      if (grpname != NULL) free(grpname);
+	  
+    }
+  else
+    {
+      /* Too many swaths opened */
+      /* ---------------------- */
+      swathID = FAIL;
+      sprintf(errbuf,"\n Illegal attempt to open more than %d swaths simultaneously. \n", HE5_NSWATH);
+      H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_OHDR, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(swathID);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWchkswid                                                    |
+|                                                                             |
+|  DESCRIPTION: Checks for valid swathID and returns file ID and              |
+|               "HDFEOS" group ID                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/23/99  A. Muslimov   Checked for the status returned by EHchkfid().      |
+|                         Initialized status to -1.                           |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t
+HE5_SWchkswid(hid_t swathID, const char *routname, hid_t *fid, hid_t *gid, long *idx )
+{
+  herr_t            status    = FAIL;/* routine return status variable */
+
+  uintn             access    =  0;	 /* Read/Write access code         */
+
+  hid_t             HDFfid    = FAIL;/* HDF-EOS file ID                */
+  hid_t             idOffset  = HE5_SWIDOFFSET;
+
+  char              message1[] = "Invalid swath id: %d in routine \"%s\".  ID must be >= %d and < %d.\n";
+  char              message2[] = "Swath id %d in routine \"%s\" not active.\n";
+  char              errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */
+
+
+  /* Check for valid swath ID */
+  /* ------------------------ */
+  if (swathID < idOffset || swathID >= HE5_NSWATH + idOffset)
+    {
+      status = FAIL;
+      sprintf(errbuf, message1, swathID, routname, idOffset, HE5_NSWATH + idOffset);
+      H5Epush(__FILE__, "HE5_SWchkswid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  else
+    {
+      /* Check for active swath ID */
+      /* ------------------------- */
+      if (HE5_SWXSwath[swathID % idOffset].active == 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf,  message2, swathID, routname);
+	  H5Epush(__FILE__, "HE5_SWchkswid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+      else
+        {
+	  *idx = HE5_EHhid2long(swathID % idOffset);
+	  if (*idx == FAIL)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf,"Cannot set up the swath index.\n");
+	      H5Epush(__FILE__, "HE5_SWchkswid", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+            
+	  /* Get HDF file ID &  "HDFEOS" group ID */
+	  /* ------------------------------------ */
+	  *fid   = HE5_SWXSwath[*idx].fid;
+	  status = HE5_EHchkfid(*fid,"", &HDFfid, gid, &access);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf,"Checking for file ID failed.\n");
+	      H5Epush(__FILE__, "HE5_SWchkswid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+        }
+    }
+  return (status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefdim                                                     |
+|                                                                             |
+|  DESCRIPTION: Defines numerical value of dimension                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  dimname        char                Dimension name                          |
+|  dim            hsize_t             Dimension size                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7/16/99  A.Muslimov    In call to EHinsertmeta() replaced 'gid' by 'fid'.  |
+|  01/06/00 A.Muslimov    Changed the datatype of "dim" parameter from int32_t|
+|                         to hsize_t to handle an Unlimited dimension size.   |
+|  02/08/00 A.Muslimov    Added error checking after the EHinsertmeta() call. |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_SWdefdim(hid_t swathID,  char *dimname, hsize_t dim)
+{
+  herr_t       status    = FAIL;/* routine return status variable  */
+  
+  hid_t        fid       = FAIL;/* HDF-EOS file ID                 */
+  hid_t        gid       = FAIL;/* "HDFEOS" group ID               */
+  
+  long         idx       = FAIL;/* Swath index                     */
+  
+  char         errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+  
+  HE5_LOCK;
+  CHECKNAME(dimname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWdefdim", &fid, &gid, &idx); 
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for Swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWdefdim", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Make certain that dim != 0 */
+  /* -------------------------- */
+  if ( dim == 0 )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Invalid (zero) dimension size.\n");
+      H5Epush(__FILE__, "HE5_SWdefdim", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Write dimension to the dataset "StructMetadata.0" */
+  /* ------------------------------------------------- */
+  status = HE5_EHinsertmeta(fid, HE5_SWXSwath[idx].swname,"s", 0L, dimname, &dim);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot insert the value for \"%s\" dimension into Metadata.\n", dimname);
+      H5Epush(__FILE__, "HE5_SWdefdim", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWupdatedim                                                  |
+|                                                                             |
+|  DESCRIPTION: Updates numerical value of dimension                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  dimname        char*               Dimension name                          |
+|  dim            hsize_t             Dimension size                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 02    S. ZHAO      Original development                                |
+|  Dec 02    H. LO        Update the dimension size                           |
+|  Feb 03    H. LO        Update the dimension size                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t
+HE5_SWupdatedim(hid_t swathID,  char *dimname, hsize_t dim)
+{
+  herr_t       status    = FAIL;/* routine return status variable  */
+ 
+  hid_t        fid       = FAIL;/* HDF-EOS file ID                 */
+  hid_t        gid       = FAIL;/* "HDFEOS" group ID               */
+ 
+  long         idx       = FAIL;/* Swath index                     */
+ 
+  char         errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  hsize_t      predims;
+ 
+ 
+  HE5_LOCK;
+  CHECKNAME(dimname);
+ 
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWupdatedim", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for Swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWupdatedim", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+ 
+  /* Make certain that dim != 0 */
+  /* -------------------------- */
+  if ( dim == 0 )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Invalid (zero) dimension size.\n");
+      H5Epush(__FILE__, "HE5_SWupdatedim", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  predims = HE5_SWdiminfo(swathID, dimname);
+  if (predims == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Failed to retrieve the size of \"%s\" dimension. \n", dimname);
+      H5Epush(__FILE__, "HE5_SWupdatedim", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+ 
+
+  /* Write updated dimension back to the dataset "StructMetadata.0" */
+  /* -------------------------------------------------------------- */
+  if (dim > predims)
+    {
+      status = HE5_EHupdatemeta(fid, HE5_SWXSwath[idx].swname,"s", 0L, dimname, &dim);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot update the value for \"%s\" dimension in Metadata.\n", dimname);
+	  H5Epush(__FILE__, "HE5_SWupdatedim", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefdimscale                                                |
+|                                                                             |
+|  DESCRIPTION: Defines dimension scale for all fields that use the given     |
+|               dimesion                                                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  dimname        char                dim name                                |
+|  dimsize        hsize_t             Dimemsion size value                    |
+|  numbertype_in  hid_t               dim scale data type such as DFNT_INT32, |
+|                                     DFNT_FLOAT64, DFNT_FLOAT32, etc.        |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES: This function finds out which field in a swath has the dimension    |
+|         and sets dimension scale for that field calling HE5_SWsetdimscale() |
+|         User must detach swath after creating fields and attach again before|
+|         calling the routine.                                                |
+|                                                                             |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ===============================================   |
+|  Dec 2013   Abe Taaheri   Original Programmer                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_SWdefdimscale(hid_t swathID,  char *dimname,
+		  const hsize_t dimsize, hid_t numbertype_in, void * data)
+{
+  herr_t       status    = FAIL;/* routine return status variable  */
+  hid_t        fid       = FAIL;/* HDF-EOS file ID                 */
+  hid_t        gid       = FAIL;/* "HDFEOS" group ID               */
+  long         idx       = FAIL;/* Swath index                     */
+  char         errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+  char         *fieldlist = NULL;
+  long         strbufsize;
+  long         nflds   = FAIL;
+
+  HE5_LOCK;
+  CHECKNAME(dimname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWdefdimscale", &fid, &gid, &idx); 
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for Swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Make certain that dimsize != 0 */
+  /* ------------------------------ */
+  if ( dimsize == 0 )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Invalid (zero) dimension size.\n");
+      H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Loop over all fields in the swath and find out if 
+     field's dimension list  has the dimension name. 
+     If true then set the dimension scale for the dim 
+     in that field
+  */
+
+  /* Inquire Data Fields first*/
+  /* ------------------------ */
+  nflds = HE5_SWnentries(swathID, HE5_HDFE_NENTDFLD, &strbufsize);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n");
+      H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, 
+	      H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else
+    {
+      fieldlist = (char *) calloc(strbufsize + 1, sizeof(char));
+      if(fieldlist == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory.\n");
+	  H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, 
+		  H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      nflds = HE5_SWinqdatafields(swathID, fieldlist, NULL, NULL);
+      if (nflds == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the list of fields in \"Data Fields\" group. \n");
+	  H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, 
+		  H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(fieldlist);
+	  return(FAIL);
+	}
+
+      if(nflds > 0)
+	{
+	  size_t        fldnmlen[HE5_FLDNUMBERMAX];      /* Array of namelengths */
+	  char          *fldnm[HE5_FLDNUMBERMAX];        /* Array of names       */
+	  char          tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list       */
+	  int           rank     = FAIL;                 /* Rank of dataset       */
+	  hsize_t	tempdims[HE5_DTSETRANKMAX];      /* Dimension sizes array*/
+	  hid_t         dtype[1] = {FAIL};               /* Data type            */
+	  long          ntflds   =  0;                   /* field counter        */
+	  int           i;
+	  char          *tempfield = NULL;
+	  unsigned int  Dimindex;
+
+	  ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen);
+	  if(ntflds != FAIL)
+	    {
+	      for(i = 0; i < ntflds; i++)
+		{
+		  tempfield      = (char *)calloc(fldnmlen[i] + 1, sizeof(char));
+		  memmove(tempfield,fldnm[i],fldnmlen[i]);
+		  tempfield[fldnmlen[i]]='\0';
+
+		  /* for this field see if the dimlist contains dimname */
+		  status = HE5_SWfieldinfo(swathID, tempfield, &rank, tempdims, 
+					   dtype, tempdimlist, NULL);
+
+		  if (status != SUCCEED)
+		    {
+		      sprintf(errbuf, "Field \"%s\" not found.\n", tempfield);
+		      H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, 
+			      H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(tempfield);
+		      free(fieldlist);
+		      return(FAIL);
+		    }
+
+		  Dimindex = FAIL;
+		  Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ',');
+		  if (Dimindex == FAIL) /* dimension not found */
+		    {
+		      continue; /*dimlist does not contain dim name */
+		    }
+		  else
+		    {
+		      /* call HE5_SWsetdimscle */
+		      status = HE5_SWsetdimscale(swathID, (char *)tempfield, 
+						 dimname,
+						 dimsize, 
+						 numbertype_in, 
+						 data);
+		      if ( status == FAIL )
+			{
+			  sprintf(errbuf,"Cannot set dimension scale %s for the field %s. \n", 
+				  dimname, tempfield);
+			  H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, 
+				  H5E_OHDR, H5E_NOTFOUND, errbuf);
+			  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  free(tempfield);
+			  free(fieldlist);
+			  return(status);
+			}
+		    }
+		}
+	      free(tempfield);
+	      tempfield = NULL;
+	    }
+	}
+      free(fieldlist);
+      fieldlist = NULL;
+    }
+
+  /* Inquire Geo Fields */
+  /* -------------------*/
+  nflds = HE5_SWnentries(swathID, HE5_HDFE_NENTGFLD, &strbufsize);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number of fields in \"Geo Fields\" group. \n");
+      H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, 
+	      H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else
+    {
+      fieldlist = (char *) calloc(strbufsize + 1, sizeof(char));
+      if(fieldlist == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory.\n");
+	  H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, 
+		  H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      nflds = HE5_SWinqgeofields(swathID, fieldlist, NULL, NULL);
+      if (nflds == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the list of fields in \"Geo Fields\" group. \n");
+	  H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, 
+		  H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(fieldlist);
+	  return(FAIL);
+	}
+      
+      if(nflds > 0)
+	{
+	  size_t        fldnmlen[HE5_FLDNUMBERMAX];      /* Array of namelengths */
+	  char          *fldnm[HE5_FLDNUMBERMAX];        /* Array of names       */
+	  char          tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list       */
+	  int           rank     = FAIL;                 /* Rank of dataset       */
+	  hsize_t	tempdims[HE5_DTSETRANKMAX];      /* Dimension sizes array*/
+	  hid_t         dtype[1] = {FAIL};               /* Data type            */
+	  long          ntflds   =  0;                   /* field counter        */
+	  int           i;
+	  char          *tempfield = NULL;
+	  unsigned int  Dimindex;
+
+	  ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen);
+	  if(ntflds != FAIL)
+	    {
+	      for(i = 0; i < ntflds; i++)
+		{
+		  tempfield      = (char *)calloc(fldnmlen[i] + 1, sizeof(char));
+		  memmove(tempfield,fldnm[i],fldnmlen[i]);
+		  
+		  /* for this field see if the dimlist contains dimname */
+		  status = HE5_SWfieldinfo(swathID, tempfield, &rank, tempdims, 
+					   dtype, tempdimlist, NULL);
+		  if (status != SUCCEED)
+		    {
+		      sprintf(errbuf, "Field \"%s\" not found.\n", tempfield);
+		      H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, 
+			      H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(tempfield);
+		      free(fieldlist);
+		      return(FAIL);
+		    }
+		  
+		  Dimindex = FAIL;
+		  Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ',');
+		  if (Dimindex == FAIL) /* dimension not found */
+		    {
+		      continue;
+		    }
+		  else
+		    {
+		      /* call HE5_SWsetdimscle */
+		      status = HE5_SWsetdimscale(swathID, (char *)tempfield, 
+						 dimname,
+						 dimsize, 
+						 numbertype_in, 
+						 data);
+		      if ( status == FAIL )
+			{
+			  sprintf(errbuf,"Cannot set dimension scale %s for the field %s. \n", 
+				  dimname, tempfield);
+			  H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, 
+				  H5E_OHDR, H5E_NOTFOUND, errbuf);
+			  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  free(tempfield);
+			  free(fieldlist);
+			  return(status);
+			}
+		    }
+		}
+	      free(tempfield);
+	      tempfield = NULL;
+	    }
+	}
+      free(fieldlist);
+      fieldlist = NULL;
+    }
+  
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWsetdimscale                                                |
+|                                                                             |
+|  DESCRIPTION: Defines a dimension scale for a fields dimension in a swath   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fieldname      char                field name                              |
+|  dimname        char                Dimension name                          |
+|  dimsize        hsize_t             Dimemsion size value                    |
+|  numbertype_in  hid_t               dim scale data type such as DFNT_INT32, |
+|                                     DFNT_FLOAT64, DFNT_FLOAT32, etc.        |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_SWsetdimscale(hid_t swathID, char *fieldname, char *dimname,
+		  const hsize_t dimsize, hid_t numbertype_in, void * data)
+{
+  herr_t         status;
+  hid_t          ntype;
+  hsize_t        dims[HE5_DTSETRANKMAX];
+  int            rankSDS;
+  hid_t          field_ntype[1]={FAIL}; 
+  char           dimlist[HE5_HDFE_DIMBUFSIZE];
+  char           maxdimlist[HE5_HDFE_DIMBUFSIZE];
+
+  hid_t          fid    = FAIL; 	       /* HDF-EOS file ID     */
+  hid_t          gid    = FAIL;	               /* "HDFEOS"  group ID  */
+  hid_t          did;
+  hid_t          dsid;
+  hid_t          fspace   = FAIL;              /* File dataspace ID   */
+  unsigned int   Dimindex;
+  hid_t          dsplist  = FAIL;              /* Property list ID     */
+  H5D_layout_t   layout   = H5D_LAYOUT_ERROR;  /* Type of storage      */
+  hid_t          data_space  = FAIL;           /* dataspace ID         */
+  long           idx         = FAIL;           /* Swath index           */
+  char          *errbuf      = (char *)NULL;   /* buffer for error message*/
+  void          *data_buff;
+  int            i, found;
+  int            rankds;
+  hsize_t        dimsds[1];
+
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKNAME(dimname);
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer ", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Convert HDF-EOS5 datatype to HDF5 datatype */
+  if (
+      H5Tequal(numbertype_in, H5T_NATIVE_CHAR)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SHORT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_INT)    == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UINT)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LONG)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LLONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_FLOAT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== SUCCEED ||
+      H5Tequal(numbertype_in, H5T_C_S1) == SUCCEED)
+    {
+      ntype = numbertype_in;
+    }
+  else
+    {
+      ntype = HE5_EHconvdatatype((int) numbertype_in);
+    }
+
+  if(ntype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID for dimscale\n");
+      H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /*
+**********************************************************
+*  Check for proper swath ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Swath index                *  
+**********************************************************
+*/
+  status = HE5_SWchkswid(swathID, "HE5_SWsetdimscale", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for Swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  if (status == 0)
+    {
+      /* Check that field exists */
+      /* ----------------------- */
+
+      status = HE5_SWfieldinfo(swathID, fieldname, &rankSDS, dims, field_ntype, dimlist, maxdimlist);
+      if (status != 0)
+	{
+	  sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__,  H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+      
+      data_buff = data;
+      
+      /* Loop through all datasets in swath */
+      /* ------------------------------ */
+	for (i = 0; i < HE5_SWXSwath[idx].nDFLD; i++)
+	  {
+	    /* Get dataset name */
+	    if( strcmp(fieldname, HE5_SWXSwath[ idx ].ddataset[ i ].name) == 0 )
+	      {
+		found = 1; 
+		did = HE5_SWXSwath[ idx ].ddataset[ i ].ID;
+		break;
+	      } 
+	  }
+
+	if(found != 1) /* did not find fieldname */
+	  {
+	    sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname);
+	    H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__,  H5E_ARGS, H5E_BADRANGE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    return(FAIL);
+	  }
+	/* Dimension index */
+
+	Dimindex = FAIL;
+	Dimindex = HE5_EHstrwithin(dimname, dimlist, ',');
+	
+	if (Dimindex == FAIL) /* dimension not found */
+	  {
+	    status = FAIL;
+	    sprintf( errbuf, "Dimname \"%s\" does not exist for field \"%s\".\n", 
+		     dimname, fieldname );
+	    H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    return(status);
+	  }
+
+	/* If dimension found ... */
+	/* Found the dimname; Use its dimid to set Dimension Scale*/
+	
+	/* See if dimscale dataset already exist */
+	
+	dsid = H5Dopen(HE5_SWXSwath[idx].sw_id, dimname);
+	if(dsid < 0)
+	  {
+	    /* create Dim Scale dataset */
+	    /* Try to open the " group  */
+	    /* ======================== */
+	    
+	    dsplist = H5Pcreate(H5P_DATASET_CREATE);
+	    if(dsplist == FAIL)
+	      {
+		sprintf(errbuf,"Cannot create a new property list.\n");  
+		H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		return(FAIL);
+	      }
+	    /* Get layout information */
+	    /* ---------------------- */		
+	    layout = H5Pget_layout(dsplist);
+	    if(layout == H5D_LAYOUT_ERROR)
+	      {
+		sprintf(errbuf,"Cannot get layout information for the dataset.\n");  
+		H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		return(FAIL);
+	      }
+
+	    rankds = 1;
+	    dimsds[0] = dims[Dimindex];
+
+	    data_space = H5Screate_simple(rankds, dimsds, NULL);
+	    if(data_space == FAIL)
+	      {
+		sprintf(errbuf,"Cannot create dataspace for the dimension scale dataset.\n");  
+		H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		return(FAIL);
+	      }
+	    
+	    dsid = H5Dcreate(HE5_SWXSwath[idx].sw_id,dimname,ntype, data_space, dsplist);
+	    
+	    if( dsid == FAIL )
+	      {
+		sprintf(errbuf, "Cannot create dataset for Dimension Scale \"%s\" field. \n", dimname);
+		H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		return(FAIL);
+	      }
+
+	    /* write data_buff to it */
+
+	    /* Get the field space ID */
+	    /* --------------------- */
+	    fspace = H5Dget_space(dsid);
+	    if ( fspace == FAIL)
+	      {
+		sprintf(errbuf, "Cannot get the file data space ID.\n");
+		H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		return(FAIL);
+	      }
+
+	    status = H5Dwrite(dsid, ntype, data_space, fspace,  H5P_DEFAULT, data_buff);
+	    if( status == FAIL )
+	      {
+		sprintf(errbuf,"Cannot write data to the dataset.\n");
+		H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		return(FAIL);
+	      }
+	  }
+
+	/* Dataset exist. See if it is Dimension Scale already. If not make it */
+	if ((H5DSis_scale(dsid)) <= 0 )
+	  {
+	    status = H5DSset_scale(dsid, dimname);
+	    if( status < 0)
+	      {
+		status = -1;
+		free(errbuf);
+		goto COMPLETION;
+	      }
+	    
+	    if(H5DSattach_scale(did, dsid, Dimindex) < 0)
+	      {
+		status = -1;
+		free(errbuf);
+		goto COMPLETION;
+	      }
+	  }
+	else
+	  {
+	    if(H5DSattach_scale(did, dsid, Dimindex) < 0)
+	      {
+		status = -1;
+		free(errbuf);
+		goto COMPLETION;
+	      }
+	  }
+   
+	if( H5Dclose(dsid) < 0)
+	  {
+	    status = -1;
+	    free(errbuf);
+	    goto COMPLETION;
+	  }
+    }
+  free(errbuf);
+ COMPLETION:  
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWgetdimscale                                                |
+|                                                                             |
+|  DESCRIPTION: Get dimension scale for a dimension of a field in a swath     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         long                return databuffsize  SUCCEED, (-1) FAIL |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID         hid_t               swath structure ID                     |
+|  fieldname      char                field name                              |
+|  dimname        char                dim name                                |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dimsize        hsize_t             dimension size                          |
+|  ntype          hid_t               dtata type of dimension scale           |
+|  databuff       void                data buffer for read                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_SWgetdimscale(hid_t swathID, char *fieldname, char *dimname, 
+		  hsize_t *dimsize, hid_t *ntype, void * databuff)
+{
+  int             i,j;		                   /* Loop index             */
+  long            status;	                   /* routine return status  */
+  long            idx    = FAIL;                   /* Swath index            */
+  hid_t           fid    = FAIL; 	           /* HDF-EOS file ID        */
+  hid_t           gid    = FAIL;	           /* "HDFEOS" group ID      */
+  hid_t           did    = FAIL;                   /* dataset ID             */
+  hid_t           dsid   = FAIL;                   /* dimscale dataset ID    */
+  hid_t           dspace = FAIL;                   /* data space ID          */
+  hid_t           mspace = FAIL;                   /* memory data space ID   */
+  hid_t           dtype  = FAIL;                   /* data type ID           */
+  hid_t           mtype  = FAIL;                   /* memory data type ID    */
+  H5T_class_t     classid = H5T_NO_CLASS;          /* Data type class ID     */
+  hsize_t         dimsds[HE5_DTSETRANKMAX];        /* Field dimensions       */
+  char           *errbuf = (char *)NULL;           /* buff for error message */
+  long            size   = 0;                      /* data buffer size(bytes)*/
+  int             rankds;
+  size_t          sd_type_size = 0;	           /* Size of a data type    */
+  unsigned int    Dimindex;
+  int             rankSDS;
+   hid_t          field_ntype[1]={FAIL};           /* number types           */
+  char            dimlist[HE5_HDFE_DIMBUFSIZE];
+  char            maxdimlist[HE5_HDFE_DIMBUFSIZE];
+  /*hid_t           ntype   = FAIL;*/
+  hsize_t         dims[HE5_DTSETRANKMAX];
+  int             found = 0;
+  htri_t          str_is_variable; /* boolean: TRUE if string is variable 
+				      lengeth FALSE if string is fixed length
+				      -1 if error in H5Tis_variavle_str() */
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKNAME(dimname);
+
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /*
+**********************************************************
+*  Check for proper swath ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Swath index                *  
+**********************************************************
+*/
+  status = HE5_SWchkswid(swathID, "HE5_SWgetdimscale", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for Swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* See if dimscale dataset exist */
+
+  dsid = H5Dopen(HE5_SWXSwath[idx].sw_id, dimname);
+  if(dsid < 0)
+    {
+      status = FAIL;
+      sprintf( errbuf, "Dimension scale dataset \"%s\" does not exist.\n", 
+	       dimname);
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+
+  /* Loop through all datasets in swath */
+  /* ------------------------------ */
+  for (i = 0; i < HE5_SWXSwath[idx].nDFLD; i++)
+    {
+      /* Get dataset name */
+      if( strcmp(fieldname, HE5_SWXSwath[ idx ].ddataset[ i ].name) == 0 )
+	{
+	  found = 1; 
+	  did = HE5_SWXSwath[ idx ].ddataset[ i ].ID;
+	  break;
+	}
+    }
+  if(found != 1) /* did not find fieldname */
+    {
+      sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname);
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__,  H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Check that field exists */
+  /* ----------------------- */
+  status = HE5_SWfieldinfo(swathID, fieldname, &rankSDS, dims, field_ntype, dimlist, maxdimlist);
+  
+  if (status != 0)
+    {
+      sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname);
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__,  H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* find the index of the dimension in the field */
+
+  Dimindex = FAIL;
+  Dimindex = HE5_EHstrwithin(dimname, dimlist, ',');
+  if (Dimindex == FAIL) /* dimension not found */
+    {
+      status = FAIL;
+      sprintf( errbuf, "Dimname \"%s\" does not exist for field \"%s\".\n", 
+	       dimname, fieldname );
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+
+  /* check that dimname is dimension scale name for the field dimname */
+  status = H5DSis_attached(did, dsid, Dimindex);
+
+  if( status < 0)
+    {
+      status = FAIL;
+      sprintf( errbuf, "Dimname \"%s\" is not dimension scale for a dimension in the field \"%s\".\n", dimname, fieldname );
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+
+  /* OK. dsid is a dimension scale for did. It is time to read Dimension 
+     Scale dataset for output */
+
+  /* get size first ... */
+  /* ------------------ */
+  dtype = H5Dget_type(dsid);
+  if ( dtype == FAIL )
+    {
+      size = 0;
+      sprintf(errbuf, "Cannot get data type ID.\n");
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Get data type size (bytes) */
+  /* -------------------------- */   
+  sd_type_size = H5Tget_size(dtype);
+  if ( sd_type_size == 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve data type size.\n");
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Get data space ID */
+  /* ----------------- */
+  dspace = H5Dget_space( dsid );
+  if (dspace == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the dataspace ID for the \"%s\" dataset.\n", dimname);
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /* Get dataset rank */
+  /* ---------------- */
+  rankds = H5Sget_simple_extent_ndims(dspace);
+  if ( rankds == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the dataset rank for the \"%s\" dataset.\n", dimname);
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /* Get dataset dimension sizes */
+  /* --------------------------- */
+  status = H5Sget_simple_extent_dims(dspace,dimsds, NULL);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the dataset dimension sizes for the \"%s\" dataset.\n", dimname);
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+  
+  /*----------------------------------------------------------------------*/
+
+  /* Get data class ID */
+  /* ----------------- */
+  classid       = H5Tget_class(dtype);
+  if (classid == H5T_NO_CLASS)
+    {
+      sprintf(errbuf, "Cannot get the data type class ID for \"%s\" dataset.",
+	      dimname);
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_DATATYPE, 
+	      H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (errbuf  != NULL) free(errbuf);
+      return(FAIL);
+    }
+  
+  if (classid == H5T_STRING)
+    {
+      /* HE5T_CHARSTRING has variable length for data fields */
+      str_is_variable = H5Tis_variable_str(dtype);
+      if(str_is_variable == TRUE)
+	{
+	  *ntype = HE5T_CHARSTRING;
+	}
+      else if(str_is_variable == FALSE)
+	{
+	  *ntype = HE5T_NATIVE_CHAR;
+	}
+      else
+	{
+	  sprintf(errbuf, "Failed to see if string field is varaible or fixed length for the \"%s\" field.\n",dimname);
+	  H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_DATATYPE, 
+		  H5E_NOTFOUND, errbuf);
+	  
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (errbuf  != NULL) free(errbuf);
+	  return(FAIL);
+	}
+    }
+  else
+    {
+      *ntype = HE5_EHdtype2numtype(dtype);
+      if (*ntype == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the number type for \"%s\" dataset.", 
+		  dimname);
+	  H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_DATATYPE, 
+		  H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (errbuf  != NULL) free(errbuf);
+	  return(FAIL);
+	}
+    }
+  /*----------------------------------------------------------------------*/
+
+  status = H5Tclose(dtype);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot release the datatype ID.\n");
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /* Release the dataspace ID */
+  /* ------------------------ */
+  status = H5Sclose(dspace);
+  if ( status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" dataset.\n", dimname);
+      H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+
+  size = (long)dimsds[ 0 ];
+  *dimsize = (hsize_t)size;
+
+  for (j = 1; j < rankds; j++)
+    size *= (long)dimsds[j];
+ 
+  size *= (long)sd_type_size;
+
+  /* If data values are requested ... */
+  /* -------------------------------- */
+  if (databuff != NULL)
+    {
+      /* Create a data space in memory */
+      /* ----------------------------- */ 		
+      mspace = H5Screate_simple(rankds, (const hsize_t *)dimsds, NULL);
+      if ( mspace == FAIL )
+	{
+	  sprintf(errbuf,"Cannot create the data space.\n");
+	  H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_DATASPACE, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      dspace = H5Dget_space(dsid );
+      if (dspace == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the dataspace ID for the \"%s\" dataset.\n", dimname);
+	  H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+		
+      dtype = H5Dget_type(dsid);
+      if ( dtype == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get the datatype ID.\n");
+	  H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      /* Get the memory data type ID */
+      /* --------------------------- */
+      mtype = HE5_EHdtype2mtype(dtype);
+      if ( mtype == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get the memory data type.\n");
+	  H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      /* Read the selected points into the buffer */
+      /* ---------------------------------------  */
+      status = H5Dread(dsid, mtype, mspace, dspace, H5P_DEFAULT, databuff);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot read out the data from the dataset.\n");
+	  H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+				
+      status = H5Tclose(dtype);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the datatype ID.\n");
+	  H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+		
+      status = H5Sclose(mspace);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the memory data space ID.\n");
+	  H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+		
+      status = H5Sclose(dspace);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the file data space ID.\n");
+	  H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+    }
+
+  free(errbuf);
+ COMPLETION:
+  HE5_UNLOCK;
+  return (size);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWreaddscaleattr                                             |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with a dimension scale field       |
+|               from a swath.                                                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t   None        HDF-EOS type swath  ID                  |
+|  fieldname      char                field name                              |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 10   Abe Taaheri   Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_SWreaddscaleattr(hid_t swathID, const char *fieldname, const char *attrname, void *datbuf)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+
+  hid_t      ntype         = FAIL;/* hdf5 type data type ID         */
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      fieldID       = FAIL;/* Field-related dataset ID       */
+     
+  long       idx           = FAIL;/* Swath index                    */
+     
+  hsize_t    count[]={0};	   /* array with the number of elements */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer   */
+
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(attrname);
+
+  /*
+**********************************************************
+*  Check for proper swath ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Swath index                *  
+**********************************************************
+*/
+  status = HE5_SWchkswid(swathID, "HE5_SWreaddscaleattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get field ID */
+      /* ------------ */
+      fieldID = H5Dopen(HE5_SWXSwath[idx].sw_id, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWreaddscaleattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+		
+      /* Call EHattr to perform I/O */
+      /* -------------------------- */
+      status = HE5_EHattr(fieldID, attrname, ntype, count, "r", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" field.\n", attrname,fieldname);
+	  H5Epush(__FILE__, "HE5_SWreaddscaleattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+        
+      /* Release dataset ID */
+      /* ------------------ */
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWreaddscaleattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}			
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:  HE5_SWwritedscaleattr                                           |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with a dimension scale    |
+|               field in a swath.                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fieldname      char*               dimension scale SDS name                |
+|  attrname       char*               attribute name                          |
+|  numtype        hid_t               attribute datatype ID                   |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10   Abe Taaheri   Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWwritedscaleattr(hid_t swathID, const char *fieldname, const char *attrname, 
+		      hid_t numtype, hsize_t  count[],  void *datbuf)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+  
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      fieldID       = FAIL;/* Field-related dataset ID       */
+  
+  long       idx           = FAIL;/* Swath index                     */
+  
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+  hid_t      ntype;
+  
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+  
+  /* 
+     if numtype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use ntype itself
+  */
+  ntype = HE5_EHconvdatatype(numtype);
+  if(ntype == FAIL)
+    {
+      ntype = numtype;
+    }
+  
+  /*
+**********************************************************
+*  Check for proper swath ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Swath index                *  
+**********************************************************
+*/
+  status = HE5_SWchkswid(swathID, "HE5_SWwritedscaleattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      
+      /* Get field ID */
+      /* ------------ */
+      fieldID = H5Dopen(HE5_SWXSwath[idx].sw_id, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWwritedscaleattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      
+      /* Call EHattr to perform I/O */
+      /* -------------------------- */
+      status = HE5_EHattr(fieldID, attrname, ntype, count,"w", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write Attribute \"%s\" for the \"%s\" field.\n", attrname, fieldname);
+	  H5Epush(__FILE__, "HE5_SWwritedscaleattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+      
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWwritedscaleattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+    }
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdscaleattrinfo                                             |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about dimension scale attribute         |
+|               (attribute associated with a specified dimension scale field) |
+|                in a swath.                                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t     None      HDF-EOS type swath  ID                  |
+|  fieldname      char*               field name                              |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               attribute data type ID                  |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10   Abe Taaheri   Original Development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_SWdscaleattrinfo(hid_t swathID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+  
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      fieldID       = FAIL;/* Field-related dataset ID       */
+  
+  long       idx           = FAIL;/* Swath index                     */
+  
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+  
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(attrname);
+  
+  /*
+**********************************************************
+*  Check for proper swath ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Swath index                *  
+**********************************************************
+*/
+  status = HE5_SWchkswid(swathID, "HE5_SWdscaleattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get field ID */
+      /* ------------ */
+      fieldID = H5Dopen(HE5_SWXSwath[idx].sw_id, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWdscaleattrinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      
+      /* Call EHattrinfo */
+      /* --------------- */
+      if(strcmp(attrname,"REFERENCE_LIST") !=0)/* do not need ntype for 
+						  internal dimension
+						  scale attribute */
+	{
+	  status = HE5_EHattrinfo(fieldID, attrname, ntype, count);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" associated with the \"%s\" field.\n", attrname, fieldname);
+	      H5Epush(__FILE__, "HE5_SWdscaleattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	}
+      else
+	{
+	  status = -1;
+	  *ntype = -1;
+	  *count = 0;
+	  sprintf(errbuf,"Will not retrieve information about internal Attribute \"%s\" associated with the dimension scale \"%s\" .\n", attrname, fieldname);
+	  H5Epush(__FILE__, "HE5_SWdscaleattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWdscaleattrinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+    }
+
+ COMPLETION:
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdiminfo                                                    |
+|                                                                             |
+|  DESCRIPTION: Returns size in bytes of named dimension                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  size           hsize_t             Size of dimension                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  dimname        char                Dimension name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  3/18/99                                                                    |
+|  7/28/99  A.Muslimov    In the call to EHmetagroup() replaced gid by fid    |
+|                         (file ID).                                          |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Apr  01  A.Muslimov    Initialized size to 0, but "Unlim" returns -1!,not 0|
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hsize_t
+HE5_SWdiminfo(hid_t swathID, char *dimname)
+{
+  hsize_t       size                = 0;   /* Dimension size (return value) */
+  
+  herr_t        status              = FAIL;/* status variable               */
+  
+  hid_t         fid                 = FAIL;/* HDF-EOS file ID               */
+  hid_t         gid                 = FAIL;/* "HDFEOS" group ID             */
+  
+  long          idx                 = FAIL;/* Swath index                   */
+  
+  char          *metabuf=(char *)NULL;      /* Ptr to StrucMetadata (SM)    */
+  char          *metaptrs[2]={NULL,NULL};   /* Ptrs to the start/end of SM  */
+  char          utlstr[HE5_HDFE_UTLBUFSIZE];/* Utility string buffer        */
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer         */
+  
+  
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWdiminfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get pointers to "Dimension" section within SM */
+      /* --------------------------------------------- */
+      metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "Dimension", metaptrs);
+
+      /* Search for dimension name (surrounded by quotes) */
+      /* ------------------------------------------------ */
+      sprintf(utlstr, "%s%s%s", "\"", dimname, "\"\n");
+      metaptrs[0] = strstr(metaptrs[0], utlstr);
+
+      /*
+       * If dimension found within swath structure then get dimension value
+       */
+      if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+        {
+	  /* Set "end" ptr at the end of dimension definition entry */
+	  /* ------------------------------------------------------ */
+	  metaptrs[1] = strstr(metaptrs[0], "\t\t\tEND_OBJECT");
+		  
+	  /* Get the value of "Size" entry */
+	  /* ----------------------------- */
+	  status = HE5_EHgetmetavalue(metaptrs, "Size", utlstr);
+	  if (status == SUCCEED)
+	    {
+	      size = atol(utlstr);
+	      if (size == 0)
+		{
+		  sprintf(errbuf, "Returning zero \"Size\" value from Metadata.\n");
+		  H5Epush(__FILE__, "HE5_SWdiminfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+	    }
+	  else
+            {
+	      sprintf(errbuf, "The \"Size\" string not found in metadata. \n");
+	      H5Epush(__FILE__, "HE5_SWdiminfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+        }
+      else
+        {
+	  sprintf(errbuf, "The Dimension \"%s\" not found in metadata. \n", dimname);
+	  H5Epush(__FILE__, "HE5_SWdiminfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+		
+      if (metabuf != NULL) free(metabuf);
+    }
+  
+  return(size);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWmapinfo                                                    |
+|                                                                             |
+|  DESCRIPTION: Returns dimension mapping information                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  geodim         char                geolocation dimension name              |
+|  datadim        char                data dimension name                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  offset         long                mapping offset                          |
+|  increment      long                mapping increment                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|                                                                             |
+|  7/29/99  A.Muslimov    In the call to EHmetagroup() replace gid by fid.    |
+|  8/20/99  A.Muslimov    Initialized statuses to -1. Disabled the last error |
+|                         message:                                            |
+|                         " sprintf(errbuf,                                   |
+|                           "Mapping \"%s/%s\"not found.", geodim, datadim) ".|
+|                         This error message shouldn't be issued, because     |
+|                         the functions SWextractregion() and SWregioninfo()  |
+|                         that call SWmapinfo() issue a proper error message  |
+|                         upon receiving the error status = -1 from           |
+|                         SWmapinfo().                                        |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_SWmapinfo(hid_t swathID, char *geodim, char *datadim, long *offset, long *increment)
+{
+  herr_t         status   = FAIL;	  /* Routine return status variable */
+  herr_t         statmeta = FAIL;	  /* EHgetmetavalue return status   */
+
+  hid_t          fid      = FAIL;	  /* HDF-EOS file ID                */
+  hid_t          gid      = FAIL;	  /* "HDFEOS" group ID              */
+
+  long           idx      = FAIL;	  /* Swath index                    */
+
+  char           *metabuf    = (char *)NULL; /* Ptr to StrucMetadata    */
+  char           *metaptrs[2]={NULL,NULL};   /* Ptrs to start/end of SM */
+  char           utlstr[HE5_HDFE_UTLBUFSIZE];/* Utility string buffer   */
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+
+  CHECKPOINTER(geodim);
+  CHECKPOINTER(datadim);
+
+  /* Initialize return values */
+  /* ------------------------ */
+  *offset    = FAIL;
+  *increment = FAIL;
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWmapinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get pointers to "DimensionMap" section within SM */
+      /* ------------------------------------------------ */
+      metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "DimensionMap", metaptrs);
+
+      /* Search for mapping - GeoDim/DataDim (surrounded by quotes) */
+      /* ---------------------------------------------------------- */
+      sprintf(utlstr, "%s%s%s%s%s", "\t\t\t\tGeoDimension=\"", geodim, "\"\n\t\t\t\tDataDimension=\"", datadim, "\"\n");
+      metaptrs[0] = strstr(metaptrs[0], utlstr);
+
+      /*
+       * If mapping found within swath structure then get offset and
+       * increment value
+       */
+      if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+        {
+	  /* Get Offset */
+	  /* ---------- */
+	  statmeta = HE5_EHgetmetavalue(metaptrs, "Offset", utlstr);
+	  if (statmeta == SUCCEED)
+	    *offset = atol(utlstr);
+	  else
+            {
+	      status = FAIL;
+	      sprintf(errbuf, "The \"Offset\" string not found in metadata. \n");
+	      H5Epush(__FILE__, "HE5_SWmapinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+            }
+
+
+	  /* Get Increment */
+	  /* ------------- */
+	  statmeta = HE5_EHgetmetavalue(metaptrs, "Increment", utlstr);
+	  if (statmeta == SUCCEED)
+	    *increment = atol(utlstr);
+	  else
+            {
+	      status = FAIL;
+	      H5Epush(__FILE__, "HE5_SWmapinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, "The \"Increment\" string not found in metadata. \n");
+	      HE5_EHprint("Error: The \"Increment\" string not found in metadata, occured", __FILE__, __LINE__);
+            }
+        }
+      else
+        {
+	  status = FAIL;
+        }
+
+      if (metabuf != NULL) free(metabuf);
+    }
+
+ COMPLETION:  
+  return(status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWidxmapinfo                                                 |
+|                                                                             |
+|  DESCRIPTION: Returns indexed mapping information                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  gsize          hsize_t             Number of index values (sz of geo dim)  |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  geodim         char                geolocation dimension name              |
+|  datadim        char                data dimension name                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  index          long                array of index values                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  02/08/00 A.Muslimov    Initialized gsize to -1, and added more error       |
+|                          checkings.                                         |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  7/12/00  A.Muslimov    Added conversion from disk/file data type ID to     |
+|                          memory data type ID before H5Dread() call.         |
+|  Apr  01  A.Muslimov    Initialized gsize to 0, but "Unlim" returns -1!,    |
+|                          not 0.                                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hsize_t
+HE5_SWidxmapinfo(hid_t swathID, char *geodim, char *datadim, long index[])
+{
+  hsize_t         gsize    = 0;   /* Size of geo dim (return)     */
+
+  herr_t          status   = FAIL;/* Status variable              */
+
+  hid_t           fid      = FAIL;/* HDF-EOS file ID              */
+  hid_t           sw_id    = FAIL;/* Swath Attributes group ID    */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID            */
+  hid_t           id       = FAIL;/* Dataset ID                   */
+  hid_t	          tid      = FAIL;/* File/Disk data type ID       */
+  hid_t           mid      = FAIL;/* Memory data type ID          */
+
+  long            idx      = FAIL;/* Swath index                  */
+
+  char            utlbuf[HE5_HDFE_DIMBUFSIZE];/* Utility buffer   */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error buffer     */
+
+  CHECKPOINTER(geodim);
+  CHECKPOINTER(datadim);
+
+  /* if field is empty bail out */
+  if(strcmp(geodim,"") == 0)
+    {
+      sprintf(errbuf,"The geolocation dimension name \"%s\" is null.. \n", geodim);
+      H5Epush(__FILE__, "HE5_SWidxmapinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(gsize);
+    }
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWidxmapinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Find Index Mapping dataset  */
+      /* --------------------------  */
+      sprintf(utlbuf, "%s%s%s%s", "_INDEXMAP:", geodim, ",", datadim);
+      sw_id = HE5_SWXSwath[idx].sw_id;
+	  
+      /* Open dataset "INDEXMAP:geodim,datadim" in swath group */
+      /* ----------------------------------------------------- */
+      id = H5Dopen(sw_id, utlbuf);
+      if( id == FAIL )
+        {
+	  sprintf(errbuf,"The \"%s\" dataset not found. \n", utlbuf);
+	  H5Epush(__FILE__, "HE5_SWidxmapinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+	  
+      /* Get geodim size & read index mapping values */
+      /* ------------------------------------------- */
+      else
+        {
+	  /* Get data type ID */
+	  /* ---------------- */
+	  tid    = H5Dget_type(id);
+	  if (tid == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the data type ID. \n") ;
+	      H5Epush(__FILE__, "HE5_SWidxmapinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+
+	      return(gsize);
+	    }
+          
+	  /* Get memory data type ID */
+	  /* ----------------------- */
+	  mid    = HE5_EHdtype2mtype(tid);
+	  if (mid == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot convert to memory data type. \n") ;
+	      H5Epush(__FILE__, "HE5_SWidxmapinfo", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  
+	      return(gsize);
+	    }
+
+	  /* Read the dataset */
+	  /* ---------------- */
+	  status = H5Dread( id,mid , H5S_ALL, H5S_ALL, H5P_DEFAULT, index); 
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot read out the data. \n") ;
+	      H5Epush(__FILE__, "HE5_SWidxmapinfo", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  
+	      return(gsize);
+	    }
+		  
+	  /* Release the datatype ID */
+	  /* ----------------------- */
+	  status = H5Tclose(tid);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the data type ID. \n") ;
+	      H5Epush(__FILE__, "HE5_SWidxmapinfo", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  
+	      return(gsize);
+	    }
+		  
+	  /* Release the dataset ID */
+	  /* ---------------------- */
+	  status = H5Dclose(id);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID. \n") ;
+	      H5Epush(__FILE__, "HE5_SWidxmapinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  
+	      return(gsize);
+	    }
+
+	  gsize = HE5_SWdiminfo(swathID, geodim);
+	  if (gsize == 0)
+	    {
+	      sprintf(errbuf, "Failed to retrieve the size of \"%s\" dimension. \n", geodim) ;
+	      H5Epush(__FILE__, "HE5_SWidxmapinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+        }
+    }
+  
+ COMPLETION:
+  return (gsize);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWcompinfo                                                   |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        Return status  (0) SUCCEED, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t   None        Swath Object ID                         |
+|  compcode       int                                                         |
+|  compparm       int                                                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7/29/99  A.Muslimov    In the call to EHmetagroup() replace gid by fid.    |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Oct  00  A.Muslimov    Added the case where fieldname is an alias, and     |
+|                          updated to include profile dataset.                |
+|  Dec  00  A.Muslimov    Updated to include retrieving compression related   |
+|                          metadata information for profile.                  |
+|  Aug  03  S.Zhao        Added Szip compression methods.                     |
+|  Dec  13  Abe Taaheri   Added compression detection from field, if it is    |
+|                          not found from the structure metadata              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_SWcompinfo(hid_t swathID, char *fldname, int *compcode, int compparm[])
+{
+  herr_t          status   = FAIL;                   /* Return status variable      */
+  herr_t          statmeta = FAIL;                   /* Status variable             */
+
+  int             i;			             /* Loop Index                  */
+  int             nameflag = FAIL;                   /* Name flag (0-alias,1-actual)*/
+  int             fldgroup = FAIL;                   /* Field group flag            */
+
+  hid_t           fid      = FAIL;                   /* HDF-EOS file ID             */
+  hid_t           gid      = FAIL;                   /* "HDFEOS" group ID           */
+
+  long            idx      = FAIL;                   /* Swath index                 */
+  long            idOffset   = HE5_SWIDOFFSET;       /* HDF-EOS Grid ID offset      */
+  char            fieldname[HE5_HDFE_NAMBUFSIZE];    /* Field name buffer           */ 
+  char            fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual name of a field      */ 
+  char            *metabuf = (char *)NULL;           /* Pntr to StrucMetadata (SM)  */
+  char            *metaptrs[2]={NULL,NULL};          /* Ptrs to the start/end of SM */
+  char            *utlstr = (char *)NULL;            /* Utility string buffer       */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];       /* Error message buffer        */
+  hid_t           sdid,dcpl;
+  size_t          nelmts;
+  unsigned int    flags,filter_info;
+  int             got_compparm = 0;
+  int             found = 0;
+  int             numfilt;
+  hid_t           plist_id;
+  int             done_loop = 0;
+  H5Z_filter_t    filter_type;
+
+  char            *HDFcomp[18] = {"HE5_HDFE_COMP_NONE", "HE5_HDFE_COMP_RLE", "HE5_HDFE_COMP_NBIT", "HE5_HDFE_COMP_SKPHUFF", "HE5_HDFE_COMP_DEFLATE", "HE5_HDFE_COMP_SZIP_CHIP", "HE5_HDFE_COMP_SZIP_K13", "HE5_HDFE_COMP_SZIP_EC", "HE5_HDFE_COMP_SZIP_NN", "HE5_HDFE_COMP_SZIP_K13orEC", "HE5_HDFE_COMP_SZIP_K13orNN", "HE5_HDFE_COMP_SHUF_DEFLATE", "HE5_HDFE_COMP_SHUF_SZIP_CHIP", "HE5_HDFE_COMP_SHUF_SZIP_K13", "HE5_HDFE_COMP_SHUF_SZIP_EC", "HE5_HDFE_COMP_SHUF_SZIP_NN", "HE5_HDFE_COMP_SHUF_SZIP_K1 [...]
+
+
+  CHECKPOINTER(fldname);
+  
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWcompinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Allocate space for utility string */
+      /* --------------------------------- */
+      utlstr = (char *)calloc(HE5_HDFE_DIMBUFSIZE, sizeof(char));
+      if ( utlstr == NULL )
+	{
+	  sprintf( errbuf,"Cannot allocate memory for utility string.\n");
+	  H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  
+	  return(FAIL);
+	}
+
+      /* Call HE5_SWfldnameinfo() to get actual field name */
+      /* ------------------------------------------------- */
+      nameflag = HE5_SWfldnameinfo(swathID, fldname, fldactualname);
+      if ( nameflag == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get the actual name of the field.\n");
+	  H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (utlstr != NULL) free(utlstr);
+	  return(FAIL);
+	}
+  
+      /* If fieldname is alias, then change it to the actual name */
+      /* -------------------------------------------------------- */
+      if (nameflag == FALSE)
+	{
+	  strcpy(fieldname,"");
+	  strcpy(fieldname,fldactualname);
+	}
+
+      if (nameflag == TRUE)
+	{
+	  strcpy(fieldname,"");
+	  strcpy(fieldname,fldname);
+	}
+
+      /* Get the field group code */
+      /* ------------------------ */
+      fldgroup = HE5_SWfldsrch(swathID,fieldname,NULL,NULL,NULL,NULL);
+      if (fldgroup == HE5_HDFE_DATAGROUP)
+	{
+	  /* Get pointers to "DataField" section within SM */
+	  /* --------------------------------------------- */
+	  metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "DataField", metaptrs);
+		  
+	  /* Search for field */
+	  /* ---------------- */
+	  sprintf(utlstr, "%s%s%s", "\"", fieldname, "\"\n");
+	  metaptrs[0] = strstr(metaptrs[0], utlstr);
+	  
+	}
+      else if (fldgroup == HE5_HDFE_GEOGROUP)
+	{
+	  /* Search in "GeoField" section */
+	  /* ---------------------------- */
+	  if (metaptrs[0] > metaptrs[1] || metaptrs[0] == NULL)
+	    {
+	      /* Get pointers to "GeoField" section within SM */
+	      /* -------------------------------------------- */
+	      metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s","GeoField", metaptrs);
+			  
+	      /* Search for field */
+	      /* ---------------- */
+	      sprintf(utlstr, "%s%s%s", "\"", fieldname, "\"\n");
+	      metaptrs[0] = strstr(metaptrs[0], utlstr);
+	    }
+	}
+      else if (fldgroup == HE5_HDFE_PROFGROUP)
+	{
+
+	  /* Get pointers to "ProfileField" section within SM */
+	  /* ------------------------------------------------ */
+	  metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "ProfileField", metaptrs);
+		  
+	  /* Search for profile */
+	  /* ------------------ */
+	  sprintf(utlstr, "%s%s%s", "\"", fieldname, "\"\n");
+	  metaptrs[0] = strstr(metaptrs[0], utlstr);
+	}
+      else
+	{
+	  sprintf(errbuf , "Cannot get the field group code.\n");
+	  H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (metabuf != NULL) free(metabuf);
+	  if (utlstr != NULL) free(utlstr);
+	  return(FAIL);
+	}
+
+	  
+      /* If field found and user wants compression code ... */
+      /* -------------------------------------------------- */
+      if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+	{
+	  if (compcode != NULL)
+	    {
+	      /* Set endptr at end of field's definition entry */
+	      /* --------------------------------------------- */
+	      metaptrs[1] = strstr(metaptrs[0], "\t\t\tEND_OBJECT");
+			  
+	      /* Get compression type */
+	      /* -------------------- */
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "CompressionType", utlstr);
+			  
+	      /*
+	       * Default is no compression if "CompressionType" string not
+	       * in metadata
+	       */
+	      *compcode = HE5_HDFE_COMP_NONE;
+			  
+	      /* If compression code is found ... */
+	      /* -------------------------------- */
+	      if (statmeta == SUCCEED)
+		{
+		  /* Loop through compression types until match */
+		  /* ------------------------------------------ */
+		  for (i = 0; i < 18; i++)
+		    {
+		      if (strcmp(utlstr, HDFcomp[i]) == 0)
+			{
+			  *compcode = i;
+			  break;
+			}
+		    }
+		}
+	    }
+			  
+	  /* If user wants compression parameters ... */
+	  
+	  /* Compression is not listed in the structure metadata. 
+	     Lets see if the field is compressed by other means such 
+	     as herepack where the compression is done but does not 
+	     show up in the structure metadata.
+	  */
+	  got_compparm = 0;
+	  if(*compcode == HE5_HDFE_COMP_NONE)
+	    {
+	      if (HE5_SWXSwath[swathID % idOffset].active != 0)
+		{
+		  /* Get Swath index */
+		  /* -------------- */
+		  idx = HE5_EHhid2long(swathID) % idOffset;
+		  if ( idx == FAIL)
+		    {
+		      status = FAIL;
+		      sprintf(errbuf, "Cannot get the Swath index \n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf) ;
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      /* Loop through all datasets in swath */
+	      /* ------------------------------ */
+	      for (i = 0; i < HE5_SWXSwath[idx].nDFLD; i++)
+		{
+		  /* Get dataset name */
+		  if( strcmp(fieldname, HE5_SWXSwath[ idx ].ddataset[ i ].name) == 0 )
+		    {
+		      found = 1; 
+		      sdid = HE5_SWXSwath[ idx ].ddataset[ i ].ID;
+		      break;
+		    } 
+		}
+	      
+	      if(found == 1) /* did not find fieldname */
+		{
+		  /*
+		   * Retrieve dataset creation property list.
+		   */
+		  dcpl = H5Dget_create_plist (sdid); 
+		  numfilt = H5Pget_nfilters (plist_id);
+		  
+		  done_loop = 0;	      
+		  for (i=0; i<numfilt; i++) {
+		    nelmts = 0;
+		    filter_type = H5Pget_filter2 (plist_id, (unsigned)i, &flags, &nelmts, 
+						  NULL, 0, NULL,
+						  &filter_info);
+		    switch(filter_type)
+		      {
+			/*-------------------------------------------------------------------------
+			 * H5Z_FILTER_DEFLATE      1 , deflation like gzip
+			 *-------------------------------------------------------------------------
+			 */
+		      case H5Z_FILTER_DEFLATE:
+			if(numfilt == 1)
+			  {
+			    *compcode = 4; /* HE5_HDFE_COMP_DEFLATE */
+			    compparm[0] = 6; /* default value */
+			    done_loop = 1;
+			  }
+			else
+			  {
+			    *compcode = 11; /* HE5_HDFE_COMP_SHUF_DEFLATE */
+			    compparm[0] = 6; /* default value */
+			    done_loop = 1;
+			  }
+			break;
+			/*-------------------------------------------------------------------------
+			 * H5Z_FILTER_NBIT
+			 *-------------------------------------------------------------------------
+			 */
+		      case H5Z_FILTER_NBIT:
+			*compcode = 2; /* HE5_HDFE_COMP_NBIT */
+			/* Initialize to zero */
+			for (i = 0; i < 4; i++)
+			  {
+			    compparm[i] = 0.0;
+			  }
+			done_loop = 1;
+			break;
+			/*-------------------------------------------------------------------------
+			 * H5Z_FILTER_SZIP       4 , szip compression
+			 *-------------------------------------------------------------------------
+			 */
+		      case H5Z_FILTER_SZIP:
+			if(numfilt == 1)
+			  {
+			    *compcode = 7; /* HE5_HDFE_COMP_SZIP_CHIP */
+			    compparm[0] = 16;
+			    compparm[1] = 4;  /* SZ_EC */
+			    done_loop = 1;
+			  }
+			else
+			  {
+			    *compcode = 8; /* HE5_HDFE_COMP_SZIP_K13 */
+			    compparm[0] = 16;
+			    compparm[1] = 32;  /* SZ_NN */
+			    done_loop = 1;
+			  }
+			break;
+			/*-------------------------------------------------------------------------
+			 * H5Z_FILTER_SHUFFLE    2 , shuffle the data
+			 *-------------------------------------------------------------------------
+			 */
+		      case H5Z_FILTER_SHUFFLE:
+			if(numfilt == 2)
+			  {
+			    *compcode = 11; /* HE5_HDFE_COMP_SHUF_DEFLATE */
+			    compparm[0] = 6;
+			    done_loop = 1;
+			  }
+			else if(numfilt > 2)
+			  {
+			    *compcode = 12; /* HE5_HDFE_COMP_SHUF_SZIP_CHIP */
+			    compparm[0] = 16;
+			    done_loop = 1;
+			  }
+			break;
+			/*-------------------------------------------------------------------------
+			 * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
+			 *-------------------------------------------------------------------------
+			 */
+		      case H5Z_FILTER_FLETCHER32:
+			done_loop =  1;
+			break;
+			
+			/*-------------------------------------------------------------------------
+			 * H5Z_FILTER_SCALEOFFSET
+			 *-------------------------------------------------------------------------
+			 */
+		      case H5Z_FILTER_SCALEOFFSET:
+			done_loop =  1;
+			break;
+		      }/*switch*/
+		    if(done_loop ==  1) break;
+		  }/*for*/
+		}
+	      got_compparm = 1;
+	    }	  
+	  
+	  /* If user wants compression parameters ... */
+	  /* ---------------------------------------- */
+	  if (compparm != NULL && compcode != NULL && got_compparm != 1)
+	    {
+	      /* Initialize to zero */
+	      /* ------------------ */
+	      for (i = 0; i < 5; i++)
+		compparm[i] = 0;
+			  
+	      /* Get compression parameters */
+	      /* -------------------------- */
+	      if (*compcode == HE5_HDFE_COMP_NBIT)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "CompressionParams", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "(%d,%d,%d,%d)", &compparm[0], &compparm[1], &compparm[2], &compparm[3]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"\"CompressionParams\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_DEFLATE)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "DeflateLevel", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"DeflateLevel\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SZIP_CHIP)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SZIP_K13)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SZIP_EC)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SZIP_NN)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SZIP_K13orEC)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SZIP_K13orNN)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SHUF_DEFLATE)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "DeflateLevel", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"DeflateLevel\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_CHIP)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_EC)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_NN)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13orEC)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13orNN)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+
+	    }
+		  
+	}
+
+
+      if (metabuf != NULL) free(metabuf);
+      if (utlstr != NULL) free(utlstr);
+    }
+
+ COMPLETION:
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWfldnameinfo                                                |
+|                                                                             |
+|  DESCRIPTION: Retrieves actual name of the field                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nameFlag       int     None        return (1) actual name, (0) alias,      |
+|                                                (-1) FAIL                    |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  fieldname      char                name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  actualname     char                field actual name                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 00   A.Muslimov    Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static int
+HE5_SWfldnameinfo(int swathID, char *fieldname, char *actualname)
+{
+  int         nameFlag       = FAIL;/* Return value of flag            */
+  int         length         = 0;   /* String length                   */
+  int         fldgroup       = FAIL;/* Field group code                */
+
+  hid_t       fid            = FAIL;/* HDF-EOS file ID                 */
+  hid_t       gid            = FAIL;/* "HDFEOS" group ID               */
+  hid_t       groupID        = FAIL;/* data/geo/prof fields group ID   */
+
+  long        idx            = FAIL;/* Swath index                     */
+
+  H5G_stat_t  *statbuf = (H5G_stat_t *)NULL;/* buffer for link info    */
+
+  herr_t      status         = FAIL;/* routine return status variable  */
+
+  char        *namebuf       = NULL;/* Buffer for an actual field name */
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer      */
+   
+  CHECKPOINTER(fieldname); 
+  
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWfldnameinfo", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for Swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWfldnameinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  statbuf = (H5G_stat_t *)calloc(1, sizeof(H5G_stat_t ));
+
+  /* Try to get information about specified field */
+  /* -------------------------------------------- */
+  H5E_BEGIN_TRY {
+    groupID  = HE5_SWXSwath[idx].data_id;
+    fldgroup = HE5_HDFE_DATAGROUP;
+    status   = H5Gget_objinfo(groupID, fieldname, 0, statbuf);
+  }
+  H5E_END_TRY;
+  if (status == FAIL)
+    {
+      H5E_BEGIN_TRY {
+	groupID  = HE5_SWXSwath[idx].geo_id;
+	fldgroup = HE5_HDFE_GEOGROUP;
+	status   = H5Gget_objinfo(groupID, fieldname, 0, statbuf);
+      }
+      H5E_END_TRY;
+      if (status == FAIL)
+	{
+	  H5E_BEGIN_TRY {
+	    groupID  = HE5_SWXSwath[idx].prof_id;
+	    fldgroup = HE5_HDFE_PROFGROUP;
+	    status   = H5Gget_objinfo(groupID, fieldname, 0, statbuf);
+	  }
+	  H5E_END_TRY;
+	  if (status == FAIL)
+	    {
+	      nameFlag = FAIL;
+	      sprintf(errbuf, "Cannot find \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_SWfldnameinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(statbuf);
+	      return(nameFlag);
+	    }
+		  
+	}
+
+    }
+  
+  /* If the field name is an alias */
+  /* ----------------------------- */
+  if (statbuf->type == H5G_LINK)
+    nameFlag = FALSE;
+  else
+    nameFlag = TRUE;
+
+  if (nameFlag == FALSE)
+    {	
+      if (actualname != NULL)
+	{
+	  status = HE5_SWaliasinfo(swathID, fldgroup, fieldname, &length, NULL);
+	  if ( status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot get information about alias \"%s\".\n", fieldname);
+	      H5Epush(__FILE__, "HE5_SWfldnameinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+		  
+	  namebuf = (char *)calloc(length, sizeof(char));
+	  if ( namebuf == NULL )
+	    {
+	      sprintf(errbuf, "Cannot allocate memory for namebuf.\n");
+	      H5Epush(__FILE__, "HE5_SWfldnameinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+		 
+	  /* Retrieve information about alias */
+	  /* -------------------------------- */
+	  status = HE5_SWaliasinfo(swathID, fldgroup, fieldname, &length, namebuf);
+	  if ( status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot get information about alias \"%s\".\n", fieldname);
+	      H5Epush(__FILE__, "HE5_SWfldnameinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(namebuf);
+	      return(FAIL);
+	    }
+		  
+	  strcpy(actualname,"");
+	  strcpy(actualname,namebuf);  
+	  free(namebuf);
+	}
+    }
+  
+  if (nameFlag == TRUE)
+    {
+      if (actualname != NULL)
+	{
+	  strcpy(actualname,"");
+	  strcpy(actualname, fieldname);
+	}
+    }
+  
+  free(statbuf);
+
+ COMPLETION:  
+  return(nameFlag);
+} 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWfinfo                                                      |
+|                                                                             |
+|  DESCRIPTION: Returns field info                                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  fieldtype      char                fieldtype (geo or data)                 |
+|  fldname        char                name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  rank           int                 rank of field (# of dims)               |
+|  dims           hsize_t             field dimensions                        |
+|  numbertype     hid_t               field number type                       |
+|  dimlist        char                field dimension list                    |
+|  maxdimlist     char                field maximum dimension list            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7/29/99  A.Muslimov    In the call to EHmetagroup() replaced gid by fid.   |
+|  7/30/99  A.Muslimov    Added *rank  = H5Sget_simple_extent_ndims(dspace);  |
+|                         and checked for error status from H5Sget_simple_\   |
+|                         extent_dims() and H5Sclose(). Replaced maxdims      |
+|                         parameter by NULL in  H5Sget_simple_extent_dims().  |
+|  8/11/99  A.Muslimov    Initialized status to -1 before "Get pointers       |
+|                         to appropriate "Field" section within SM ".         |
+|                         Moved the lines of code under the comments          |
+|                         "Get field ID" and "Get actual dimension size "     |
+|                         within the block "if (metaptrs[0] <                 |
+|                         metaptrs[1] && metaptrs[0] != NULL) {} " to its end.|
+|                         Initialized "statmeta" and "fieldID" to -1.         |
+|                         Cleaned up some minor things (mostly cosmetic).     |
+| 10/18/99  A.Muslimov    Replaced memcpy() by memmove() to avoid a problem|  |
+|                            when arguments 1 and 2 overlap in memory.        |
+|                                                                             |
+| 01/13/00  A.Muslimov   Added "maxdimlist" parameter to make it possible     |
+|                        working with the appendable datasets. Modified the   |
+|                        blocks retrieving the dimension lists. Added proper  |
+|                        error handlings after the function calls.            |
+|02/04/00   A.Muslimov   H5Sget_simple_extent_ndims returns "int", so the     |
+|                        data type of rank was changed from int32_t to int.   |
+|04/19/00   A.Muslimov   Changed type of 'slen' from long to size_t.          |
+| July 00   A.Muslimov   Unmasked hdf5 data types.                            |
+|10/02/00   A.Muslimov   Updated to include alias field name.                 |
+| June 02   S.Zhao       Changed the type of 'numbertype' from an H5T_class_t |
+|                        to an hid_t.                                         |
+| Oct. 03   S.Zhao       Added the H5Tclose(datatype) call.                   |
+| Oct. 03   S.Zhao       Modified to enable a character string dataset.       |
+| Mar  04   S.Zhao       Modified for a character string dataset.             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t
+HE5_SWfinfo(int swathID, char *fieldtype, char *fieldname, int *rank, hsize_t dims[], hid_t numbertype[], char *dimlist, char *maxdimlist)
+{
+  herr_t     status         = FAIL;/* routine return status variable                  */
+  herr_t     statmeta       = FAIL;/* EHgetmetavalue return status                    */
+  herr_t     Dstatus        = FAIL;/* Status for H5Dclose                             */
+
+  int        groupflag      = FAIL;/* Flag for "Geo... Fields"/"Data Fields" group    */ 
+  
+  hid_t      fid            = FAIL;/* HDF-EOS file ID                                 */
+  hid_t      gid            = FAIL;/* "HDFEOS" group ID                               */
+  hid_t      dspace         = FAIL;/* "fieldname" Dataspace ID                        */
+  hid_t      fieldID        = FAIL;/* "fieldname" Dataset ID                          */
+  hid_t      groupid        = FAIL;/* group ID                                        */
+  hid_t      datasetid      = FAIL;/* dataset ID                                      */
+  hid_t      datatype       = FAIL;/* data type ID                                    */ 
+
+  H5T_class_t  classid = H5T_NO_CLASS;/* data type class ID                           */
+ 
+  long       ndims          = 0;   /* Number of dimensions                            */
+  long       idx            = FAIL;/* Index of a swath                                */
+  long       i              = 0;   /* Loop index                                      */
+
+  size_t     slen[HE5_DTSETRANKMAX];            /* Length of each entry in parsed string  */
+
+  char       *metabuf       = (char *)NULL;     /* Ptr to structural metadata (SM)        */
+  char       *metaptrs[2]   = {NULL, NULL};     /* Ptrs to the begining and end of SM     */
+  char       utlstr[HE5_HDFE_UTLBUFSIZE];       /* Utility string                         */
+  char       *ptr[HE5_DTSETRANKMAX];            /* String pointers for parsed string      */
+  char       dimstr[HE5_HDFE_DIMBUFSIZE];       /* Individual dimension entry string      */
+  char       maxdimstr[HE5_HDFE_DIMBUFSIZE];    /* Individual max. dimension entry string */
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];       /* Error message buffer                   */
+  htri_t     str_is_variable;                   /* boolean: TRUE if string is variable 
+						   lengeth FALSE if string is fixed length
+						   -1 if error in H5Tis_variavle_str()    */
+
+  CHECKPOINTER(fieldtype);  
+  CHECKPOINTER(fieldname);
+
+  /* Initialize rank to FAIL (error) */
+  /* ------------------------------- */
+  *rank = FAIL;
+
+  /* Initialize slen[] array */
+  /* ----------------------- */
+  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+    slen[i] = 0;
+
+  
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWfinfo", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for Swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+  /* Reset status to FAIL */
+  /* -------------------- */
+  status = FAIL;
+  
+  /* Get pointers to appropriate "Field" section within SM */
+  /* ----------------------------------------------------- */
+  if (strcmp(fieldtype, "Geolocation Fields") == 0)
+    {
+      metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "GeoField", metaptrs);
+      groupflag = 0;
+    }
+  else
+    {
+      metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "DataField", metaptrs);
+      groupflag = 1;
+    }
+  
+  if ( metabuf == NULL )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot get pointer to  metabuf.\n");
+      H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  sprintf(utlstr, "%s%s%s", "\"", fieldname, "\"\n");
+  
+  metaptrs[0] = strstr(metaptrs[0], utlstr);
+  
+  /* If field is found either in "Geolocation Fields" or "Data Fields" group */
+  /* ----------------------------------------------------------------------- */
+  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+    {
+      /* Get DataType string */
+      /* ------------------- */
+      statmeta = HE5_EHgetmetavalue(metaptrs, "DataType", utlstr);
+
+      /* Convert to data type class ID */
+      /* ----------------------------- */
+      if (statmeta == SUCCEED)
+        {
+	  if(groupflag == 0)
+	    groupid = HE5_SWXSwath[idx].geo_id; 
+	  else
+	    groupid = HE5_SWXSwath[idx].data_id;
+		  
+	  /* Open the field dataset */
+	  /* ---------------------- */
+	  datasetid     = H5Dopen(groupid, fieldname);
+	  if (datasetid == FAIL)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot open the dataset for the \"%s\" field.\n",fieldname);
+	      H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+		  
+	  /* Get the data type ID */
+	  /* -------------------- */
+	  datatype      = H5Dget_type(datasetid);
+	  if (datatype == FAIL)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot get the data type for the \"%s\" field.\n",fieldname);
+	      H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+		  
+	  /* Get the data type class ID */
+	  /* -------------------------- */
+	  classid       = H5Tget_class(datatype);
+	  if (classid == H5T_NO_CLASS)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" field.\n",fieldname);
+	      H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+
+	  if (classid == H5T_STRING)
+	    {
+	      /* HE5T_CHARSTRING has variable length for data fields */
+	      str_is_variable = H5Tis_variable_str(datatype);
+	      if(str_is_variable == TRUE)
+		{
+		  numbertype[0] = HE5T_CHARSTRING;
+		}
+	      else if(str_is_variable == FALSE)
+		{
+		  numbertype[0] = HE5T_NATIVE_CHAR;
+		}
+	      else
+		{
+		  status = FAIL;
+		  sprintf(errbuf, "Failed to see if string field is varaible or fixed length for the \"%s\" field.\n",fieldname);
+		  H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+		  if (metabuf != NULL) free(metabuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+		      
+	      /*numbertype[0] = HE5_SWgetstringtype(swathID, fieldname,classid);*/
+	      /*numbertype[0] = HE5T_CHARSTRING;*/
+	    }
+	  else
+	    {
+	      /*numbertype[0] = classid;*/
+	      numbertype[0] = HE5_EHdtype2numtype(datatype);
+	      if (numbertype[0] == FAIL)
+		{
+		  status = FAIL;
+		  sprintf(errbuf, "Cannot get the number type for the \"%s\" field.\n",fieldname);
+		  H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+		  if (metabuf != NULL) free(metabuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    }
+
+	  /* Release the datatype ID */
+	  /* ----------------------- */
+	  status = H5Tclose(datatype);
+	  if ( status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot release the datatype ID for the \"%s\" field.\n",fieldname);
+	      H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+
+	  /* Release the dataset ID */
+	  /* ---------------------- */
+	  Dstatus       = H5Dclose(datasetid);
+	  if (Dstatus == FAIL)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" field.\n",fieldname);
+	      H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+        }
+      else
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "The \"DataType\" string not found in metadata. \n");
+	  H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf);
+	  if (metabuf != NULL) free(metabuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }
+
+      /* Get "DimList" string, trim off "(" and ")" */
+      /* ------------------------------------------ */
+      statmeta = HE5_EHgetmetavalue(metaptrs, "DimList", utlstr);
+      if (statmeta == SUCCEED)
+        {
+	  memmove(utlstr, utlstr + 1, strlen(utlstr) - 2);
+	  utlstr[strlen(utlstr) - 2] = 0;
+
+	  /* Parse trimmed "DimList" string and get rank */
+	  /* ------------------------------------------- */
+	  ndims = HE5_EHparsestr(utlstr, ',', ptr, slen);
+	  *rank = HE5_EHlong2int(ndims);
+	  if (*rank == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot convert from \"long\" to \"int\" data type. \n");
+	      H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+        }
+      else
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "The \"DimList\" string not found in metadata. \n");
+	  H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf);
+	  if (metabuf != NULL) free(metabuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }
+
+      /* If "DimList" IS REQUESTED ...  */
+      /* -----------------------------  */
+      if (dimlist != NULL) 
+	{
+	  strcpy(dimstr,"");
+	  strcpy(dimlist,"");
+			
+	  /*
+	   * Copy each entry in DimList and remove leading and trailing quotes.
+	   * Get dimension sizes and concatenate dimension names to dimension list.
+	   */
+	  for (i = 0; i < ndims; i++)
+	    {
+	      memmove(dimstr, ptr[i] + 1, slen[i] - 2);
+	      dimstr[slen[i] - 2] = 0;
+	      if (i > 0)
+		{
+		  strcat(dimlist,",");
+		}
+	      strcat(dimlist, dimstr);
+	    }
+	}
+		
+
+      /* If "MaxdimList" IS REQUESTED  ...      */
+      /* -------------------------------------- */
+      if(maxdimlist != NULL)
+	{
+	  strcpy(utlstr,"");
+	  statmeta = HE5_EHgetmetavalue(metaptrs,"MaxdimList", utlstr);
+	  if (statmeta == SUCCEED)
+	    {
+	      memmove(utlstr, utlstr + 1, strlen(utlstr) - 2);
+	      utlstr[strlen(utlstr) - 2] = 0;
+	      ndims = HE5_EHparsestr(utlstr,',', ptr, slen);
+	    }
+	  else
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "The \"MaxdimList\" string not found in metadata. \n");
+	      H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+			
+	  strcpy(maxdimstr,"");
+	  strcpy(maxdimlist,"");
+			
+	  for (i = 0; i < ndims; i++)
+	    {
+	      memmove(maxdimstr, ptr[i] + 1, slen[i] - 2);
+	      maxdimstr[slen[i] - 2] = 0;
+	      if (maxdimlist != NULL)
+		{
+		  if (i > 0)
+		    {
+		      strcat(maxdimlist,",");
+		    }
+		  strcat(maxdimlist, maxdimstr);
+		}
+	    }
+	}
+	  
+
+      /* Get field ID */
+      /* ------------ */
+      HE5_SWfieldsizeID( swathID, fieldname, &fieldID);
+	  
+      /* Get the data space ID */
+      /* --------------------- */
+      dspace = H5Dget_space( fieldID );
+      if(dspace == FAIL)
+	{	    
+	  status = FAIL;
+	  sprintf(errbuf, "Cannot get the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+	  if (metabuf != NULL) free(metabuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+		
+      /* Get the dataset rank */
+      /* -------------------- */
+      *rank  = H5Sget_simple_extent_ndims(dspace);
+      if( *rank == FAIL)
+	{	    
+	  status = FAIL;
+	  sprintf(errbuf, "Cannot get the rank of the dataset.\n");
+	  H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  if (metabuf != NULL) free(metabuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+		
+      /* Get the dataset dimension sizes */
+      /* ------------------------------- */
+      status = H5Sget_simple_extent_dims(dspace, dims, NULL);
+      if( status == FAIL)
+	{	    
+	  sprintf(errbuf, "Cannot get the dimension array of the dataset.\n");
+	  H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  if (metabuf != NULL) free(metabuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    
+      /* Release the data space ID */
+      /* ------------------------- */
+      status = H5Sclose(dspace);
+      if( status == FAIL)
+	{	    
+	  sprintf(errbuf, "Cannot release the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  if (metabuf != NULL) free(metabuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  
+  if (metabuf != NULL) free(metabuf);
+
+ COMPLETION:
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWfieldinfo                                                  |
+|                                                                             |
+|  DESCRIPTION: Wrapper around HE5_SWfinfo                                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        herr_t              swath structure ID                      |
+|  fldname        char*               name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  rank           int                 rank of field (# of dims)               |
+|  dims           hsize_t             field dimensions                        |
+|  ntype          hid_t               number types                            |
+|  dimlist        char*               field dimension list                    |
+|  maxdimlist     char*               field maximum dimension list            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date       Programmer    Description                                      |
+|  =========   ============  ================================================ |
+|  01/13/00    A.Muslimov    Added "maxdimlist" parameter to make it possible |
+|                            working with the appendable datasets.            |
+|  05/10/00    A.Muslimov    Replaced 'H5T_class_t' type by 'int' data type.  |
+|  July 00     A.Muslimov    Unmasked hdf5 data types.                        |
+|  Oct 5 00    A.Muslimov    Added checking for actual field name (in case of |
+|                             passing an alias name as 'fldname').            |
+|  Jan 03      S.Zhao        Changed the type of 'ntype' from an H5T_class_t  |
+|                            to an hid_t.                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_SWfieldinfo(hid_t swathID, char *fldname, int *rank, hsize_t dims[], hid_t ntype[], char *dimlist, char *maxdimlist)
+{
+
+  herr_t       status      = FAIL;/* routine return status variable */
+
+  int          nameflag    = FAIL;/* Actual(1)/Alias(0) field name  */   
+
+  hid_t        fid         = FAIL;/* HDF-EOS file ID                */
+  hid_t        gid         = FAIL;/* "HDFEOS" group ID              */
+  
+  long         idx         = FAIL;/* Swath index                    */
+
+  char         fieldname[HE5_HDFE_NAMBUFSIZE];    /* field name buffer    */
+  char         fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual field name    */  
+  char         errbuf[HE5_HDFE_ERRBUFSIZE];       /* Error message buffer */
+  
+  CHECKPOINTER(fldname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWfieldinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Call HE5_SWfldnameinfo() to get actual field name */
+      /* ------------------------------------------------- */
+      nameflag = HE5_SWfldnameinfo(swathID, fldname, fldactualname);
+      if ( nameflag == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get actual name of the field.\n");
+	  H5Epush(__FILE__, "HE5_SWfieldinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Name is not alias */
+      /* ----------------- */
+      if (nameflag == TRUE)
+	{
+	  strcpy(fieldname,"");
+	  strcpy(fieldname,fldname);
+	}
+
+      /* Name is alias */
+      /* ------------- */
+      if (nameflag == FALSE)
+	{
+	  strcpy(fieldname,"");
+	  strcpy(fieldname,fldactualname);
+	}
+
+      /* Check for field within Geolocatation Fields */
+      /* ------------------------------------------- */
+      status = HE5_SWfinfo(swathID, "Geolocation Fields", fieldname, rank, dims, ntype, dimlist, maxdimlist);
+
+      /* If not there then check within Data Fields */
+      /* ------------------------------------------ */
+      if (status == FAIL)
+	status = HE5_SWfinfo(swathID, "Data Fields", fieldname, rank, dims, ntype, dimlist, maxdimlist);
+
+      /* If not there either then can't be found */
+      /* --------------------------------------- */
+      if (status == FAIL)
+        {
+	  sprintf(errbuf,"Field \"%s\" not found. Check out the field name. \n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWfieldinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }	  
+    }
+
+ COMPLETION:  
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWchunkinfo                                                  |
+|                                                                             |
+|  DESCRIPTION: Retrieves chunking information                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  fldname        char*               name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  chunk_rank     int*                rank of a dataset                       |
+|  chunk_dims     hsize_t             the array containing sizes              |
+|                                     of each dimension of a chunk            |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  Date        Programmer    Description                                      |
+|  =========   ============  ==============================================   |
+|  Dec 03      S.Zhao        Original development                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_SWchunkinfo(hid_t swathID, char *fldname, int *chunk_rank,  hsize_t chunk_dims[])
+{
+  herr_t          status   = FAIL;/* Return status variable */
+
+  hid_t           fid      = FAIL;/* HDF-EOS file ID        */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID      */
+  long            idx      = FAIL;/* Swath index            */
+  hid_t           fieldID  = FAIL;/* field dataset ID       */
+  hid_t           plist    = FAIL;/* field dataset property list ID   */
+  hid_t           dspace   = FAIL;/* "fieldname" Dataspace ID         */
+
+  int             ndims    = 0;   /* Number of dimensions   */
+
+  H5D_layout_t    layout = H5D_LAYOUT_ERROR; /* Storage layout type   */
+ 
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+ 
+  HE5_LOCK;
+  CHECKPOINTER(fldname);
+ 
+  /* Initialize chunk_rank to FAIL (error) */
+  /* ------------------------------------- */
+  *chunk_rank = FAIL;
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWchunkinfo", &fid, &gid, &idx);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Checking for valid swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Check out the field group and get field ID */
+  /* ------------------------------------------ */
+  HE5_SWfldsrch(swathID,fldname,&fieldID,NULL,NULL,NULL);
+  if(fieldID == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the field ID for the \"%s\" field.\n", fldname);
+      H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Get the property list ID */
+  /* ------------------------ */
+  plist = H5Dget_create_plist(fieldID);
+  if (plist == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fldname);
+      H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get the data space ID */
+  /* --------------------- */
+  dspace = H5Dget_space(fieldID);
+  if(dspace == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the data space ID for the \"%s\" data field.\n", fldname);
+      H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get the dataset rank */
+  /* -------------------- */
+  ndims  = H5Sget_simple_extent_ndims(dspace);
+  if(ndims == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the rank of the dataset.\n");
+      H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get Layout */
+  /* ---------- */
+  layout = H5Pget_layout(plist);
+  if (layout == H5D_LAYOUT_ERROR)
+    {
+      sprintf(errbuf, "Cannot get the layout of the raw data. \n");
+      H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_PLIST, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else if (layout == H5D_CHUNKED)
+    {
+      /* Get chunking */
+      /* ------------ */
+      *chunk_rank = H5Pget_chunk(plist, ndims, chunk_dims);
+      if (*chunk_rank == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the sizes of chunks. \n");
+	  H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+  else
+    {
+      *chunk_rank = 0;
+    }
+
+  /* Release property list ID */
+  /* ------------------------ */
+  status = H5Pclose(plist);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release property list ID. \n");
+      H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Release the data space ID */
+  /* ------------------------- */
+  status = H5Sclose(dspace);
+  if( status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the data space ID.\n");
+      H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefdimmap                                                  |
+|                                                                             |
+|  DESCRIPTION: Defines mapping between geolocation and data dimensions       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  3/18/99                                                                    |
+|  7/29/99  A.Muslimov    In the call to EHinsertmeta() replaced gid by fid.  |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_SWdefdimmap(hid_t swathID, char *geodim, char *datadim, hsize_t offset, hsize_t increment)
+{
+  herr_t       status      = FAIL;          /* Routine return status */
+  
+  hid_t        fid         = FAIL;          /* HDF-EOS file ID       */
+  hid_t        gid         = FAIL;          /* "HDFEOS" group ID     */
+  
+  hsize_t      size        = 0;             /* Size of geo dim       */
+  hsize_t      metadata[2] = { 0, 0 };      /* Offset & Increment    */
+  
+  long         idx         = FAIL;          /* Swath index           */
+  
+  char         mapname[HE5_HDFE_NAMBUFSIZE];/* Mapping name buffer   */
+  char         errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer  */
+
+  HE5_LOCK;  
+  CHECKNAME(geodim);
+  CHECKNAME(datadim);
+
+  
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWdefdimmap", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /*  Geolocation Dimension Search */
+      /*  ---------------------------- */
+      size = HE5_SWdiminfo(swathID, geodim);
+      if (size == 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "Geolocation dimension \"%s\" not found.", geodim);
+	  H5Epush(__FILE__, "HE5_SWdefdimmap", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+
+      /* Data Dimension Search */
+      /* --------------------- */
+      if (status == SUCCEED)
+        {
+	  size = HE5_SWdiminfo(swathID, datadim);
+	  if (size == 0)
+            {
+	      status = FAIL;
+	      sprintf(errbuf, "Data dimension \"%s\" not found.", datadim);
+	      H5Epush(__FILE__, "HE5_SWdefdimmap", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+        }
+	  
+      /* Write "DimensionMap" to Structural MetaData */
+      /* ------------------------------------------- */
+      if (status == SUCCEED)
+        {
+	  sprintf(mapname, "%s%s%s", geodim, "/", datadim);
+	  metadata[0] = offset;
+	  metadata[1] = increment;
+	  status = HE5_EHinsertmeta(fid, HE5_SWXSwath[idx].swname, "s", 1L, mapname, metadata);
+	  if (status == FAIL)
+            {
+	      sprintf(errbuf, "Cannot write \"Dimension Map\" offset and increment values to Structural Metadata.");
+	      H5Epush(__FILE__, "HE5_SWdefdimmap", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+        }
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefidxmap                                                  |
+|                                                                             |
+|  DESCRIPTION: Defines indexed (non-linear) mapping between geolocation      |
+|               and data dimensions                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  geodim         char                Geolocation dimension                   |
+|  datadim        char                Data dimension                          |
+|  index          long                Index mapping array                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  3/18/99                                                                    |
+|  7/29/99  A.Muslimov    In the call to EHinsertmeta() replaced gid by fid.  |
+|  8/23/99  A.Muslimov    Checked for the statuses returned by H5Dwrite(),    |
+|                         H5Sclose(), and H5Dclose().                         |
+|  2/08/00  A.Muslimov    Added more error checkings.                         |
+|  3/03/00  A.Muslimov    Changed the datatype passed to H5Dcreate() and      |
+|                         H5Dwrite() from H5T_NASTIVE_INT to H5T_NATIVE_LONG. |               
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_SWdefidxmap(hid_t swathID, char *geodim, char *datadim, long index[])
+{
+  herr_t      status   = FAIL;             /* Return status variable */
+  
+  hid_t       fid      = FAIL;             /* HDF-EOS file ID        */
+  hid_t       gid      = FAIL;             /* "HDFEOS" group ID      */
+  hid_t       dspace   = FAIL;             /* dataspace ID           */
+  hid_t       id       = FAIL;             /* dataset ID             */
+  hid_t       sw_id    = FAIL;             /* Swath ID               */
+  
+  long        idx      = FAIL;             /* Swath index            */
+  
+  hsize_t     metadata =  0;               /* Dummy metadata buffer  */
+  hsize_t     gsize    =  0;               /* Size of geo dim        */
+  hsize_t     dsize    =  0;               /* Size of data dim       */
+  
+  char        mapname[HE5_HDFE_NAMBUFSIZE];/* Mapping name           */
+  char        utlbuf[HE5_HDFE_DIMBUFSIZE]; /* Utility buffer         */
+  char        errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer   */
+  
+
+  HE5_LOCK;
+  CHECKNAME(geodim);
+  CHECKNAME(datadim);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWdefidxmap", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Geo Dimension Search */
+      /* -------------------- */
+      gsize = HE5_SWdiminfo(swathID, geodim);
+      if (gsize == 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "Geolocation dimension \"%s\" not found. \n", geodim);
+	  H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+
+      /* Data Dimension Search */
+      /* --------------------- */
+      if (status == SUCCEED)
+        {
+	  dsize = HE5_SWdiminfo(swathID, datadim);
+	  if (dsize == 0)
+            {
+	      status = FAIL;
+	      sprintf(errbuf, "Data dimension \"%s\" not found. \n", datadim);
+	      H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+            }
+        }
+
+      /* Define Index  and Store Index Array */
+      /* ----------------------------------- */
+      if (status == SUCCEED)
+        {
+	  sw_id = HE5_SWXSwath[idx].sw_id;
+
+	  /*  Name: "_INDEXMAP:" + geodim + "/" + datadim  */
+	  /*  -------------------------------------------  */
+	  sprintf(utlbuf, "%s%s%s%s", "_INDEXMAP:", geodim, ",", datadim);
+
+	  /* Create dataspace */
+	  /* ---------------- */
+	  dspace = H5Screate_simple(1, &gsize, NULL);
+	  if (dspace == FAIL)
+            {
+	      sprintf(errbuf, "Cannot create the data space. \n");
+	      H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+            }
+
+	  /* create dataset */
+	  /* -------------- */
+	  id = H5Dcreate(sw_id, utlbuf, H5T_NATIVE_LONG, dspace, H5P_DEFAULT);
+	  if (id == FAIL)
+            {
+	      sprintf(errbuf, "Cannot create the dataset. \n");
+	      H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+            }
+
+	  /*  Write data buffer to dataset */
+	  /*  ---------------------------- */
+	  status = H5Dwrite(id, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, index); 
+	  if (status == FAIL)
+            {
+	      sprintf(errbuf, "Cannot write data to the dataset. \n");
+	      H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+            }
+
+	  /* Write to Structural Metadata */
+	  /* ---------------------------- */
+	  sprintf(mapname, "%s%s%s", geodim, "/", datadim);
+	  status = HE5_EHinsertmeta(fid, HE5_SWXSwath[idx].swname, "s", 2L, mapname, &metadata);
+	  if (status == FAIL)
+            {
+	      sprintf(errbuf, "Cannot insert data to the Metadata. \n");
+	      H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+            }            
+
+	  /* Release dataspace ID */
+	  /* -------------------- */
+	  status = H5Sclose(dspace);
+	  if (status == FAIL)
+            {
+	      sprintf(errbuf, "Cannot release the data space ID. \n");
+	      H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+            }
+		  
+	  /* Release dataset ID */
+	  /* ------------------ */         
+	  status = H5Dclose(id);
+	  if (status == FAIL)
+            {
+	      sprintf(errbuf, "Cannot release the dataset ID. \n");
+	      H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+            }
+        }
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefchunk                                                   |
+|                                                                             |
+|  DESCRIPTION: Defines size of chunk used to store a chunked layout dataset  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  rank           int                 rank of a dataset                       |
+|  *dim           const hsize_t       pointer to the array containing sizes   |
+|                                     of each dimension of a chunk            |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  Date        Programmer    Description                                      |
+|  =========   ============  ==============================================   |
+|  8/134/99    A.Muslimov    Checked the statuses for H5P... calls.           |
+|  02/08/00    A.Muslimov    Added more error checkings.                      |
+|  July 00     A.Muslimov    Unmasked hdf5 data types.                        |
+|  Sep  01     A. Muslimov   Added mutex "lock"/"unlock" calls.               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_SWdefchunk(hid_t swathID, int rank,  const hsize_t *dim)
+{
+  herr_t          status   = FAIL;/* Return status variable */
+
+  hid_t           fid      = FAIL;/* HDF-EOS file ID        */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID      */
+
+  long            idx      = FAIL;/* Swath index            */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  HE5_LOCK;
+  CHECKPOINTER(dim);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWdefchunk", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* get the current dataset creation property ID from external array  */
+      /* if current property instance has not been created, then create it */
+      if( HE5_SWXSwath[idx].plist == FAIL){
+	HE5_SWXSwath[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+
+	if (HE5_SWXSwath[idx].plist == FAIL){
+	  sprintf(errbuf, "Cannot create the property list. \n");
+	  H5Epush(__FILE__, "HE5_SWdefchunk", __LINE__, H5E_PLIST, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      }
+
+      /* Set layout */
+      /* ---------- */
+      status = H5Pset_layout( HE5_SWXSwath[idx].plist, H5D_CHUNKED);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage. \n");
+	  H5Epush(__FILE__, "HE5_SWdefchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      /* Set chunking */
+      /* ------------ */
+      status = H5Pset_chunk( HE5_SWXSwath[idx].plist, rank, dim); 
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the sizes of chunks. \n");
+	  H5Epush(__FILE__, "HE5_SWdefchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefcomp                                                    |
+|                                                                             |
+|  DESCRIPTION: Defines compression type and parameters                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  compcode       int                 compression code                        |
+|  compparm       int                 compression parameters                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:   Before calling this function, storage must be CHUNKED             |
+|                      Values of compression code                             |
+|                         HDFE_COMP_NONE                  0                   |
+|                         HDFE_COMP_RLE                   1                   |
+|                         HDFE_COMP_NBIT                  2                   |
+|                         HDFE_COMP_SKPHUFF               3                   |
+|                         HDFE_COMP_DEFLATE               4                   |
+|                         HDFE_COMP_SZIP_EC               5                   |
+|                         HDFE_COMP_SZIP_NN               6                   |
+|                         HDFE_COMP_SZIP_K13              7                   |
+|                         HDFE_COMP_SZIP_CHIP             8                   |
+|                         HDFE_COMP_SZIP_K13orEC          9                   |
+|                         HDFE_COMP_SZIP_K13orNN          10                  |
+|                         HDFE_COMP_SHUF_DEFLATE          11                  |
+|                         HDFE_COMP_SHUF_SZIP_CHIP        12                  |
+|                         HDFE_COMP_SHUF_SZIP_K13         13                  |
+|                         HDFE_COMP_SHUF_SZIP_EC          14                  |
+|                         HDFE_COMP_SHUF_SZIP_NN          15                  |
+|                         HDFE_COMP_SHUF_SZIP_K13orEC     16                  |
+|                         HDFE_COMP_SHUF_SZIP_K13orNN     17                  |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|                                                                             |
+|  8/13/99  A.Muslimov    Changed the return type of SWdefcomp from int       |
+|                         to int   . Checked the statuses in the H5P... calls.|
+|  02/08/00 A.Muslimov    Added more error checkings.                         |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  June 01  A.Muslimov    Added checking of the compression code/level.       |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  Aug  03  S.Zhao        Added Szip compression methods.                     |
+|  Oct  03  S.Zhao        Added the shuffling method.                         |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWdefcomp(hid_t swathID, int compcode,  int *compparm)
+{
+  herr_t          status   = FAIL; /* routine return status variable   */
+
+  hid_t           fid      = FAIL; /* HDF-EOS file ID                  */
+  hid_t           gid      = FAIL; /* "HDFEOS" group ID                */
+
+  long            idx      = FAIL; /* Swath index                      */
+
+  H5D_layout_t    layout = H5D_LAYOUT_ERROR; /* Storage layout type    */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+  int             can_encode = 0;        /* szip encoder presence flag */
+
+  HE5_LOCK;
+  CHECKPOINTER(compparm);
+
+  /* Check if compression code is valid */
+  /* ---------------------------------- */
+  if( compcode != HE5_HDFE_COMP_DEFLATE && compcode != HE5_HDFE_COMP_NONE &&
+      compcode != HE5_HDFE_COMP_SZIP_CHIP && compcode != HE5_HDFE_COMP_SZIP_K13 &&
+      compcode != HE5_HDFE_COMP_SZIP_EC && compcode != HE5_HDFE_COMP_SZIP_NN &&
+      compcode != HE5_HDFE_COMP_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SZIP_K13orNN &&
+      compcode != HE5_HDFE_COMP_SHUF_DEFLATE && compcode != HE5_HDFE_COMP_SHUF_SZIP_CHIP &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_K13 && compcode != HE5_HDFE_COMP_SHUF_SZIP_EC &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_NN && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orEC &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orNN )
+    {
+      status = FAIL;
+      sprintf(errbuf,"Invalid/unsupported compression code. \n");
+      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  if( compcode == HE5_HDFE_COMP_DEFLATE || 
+      compcode == HE5_HDFE_COMP_NONE    || 
+      compcode == HE5_HDFE_COMP_SHUF_DEFLATE)
+    {
+      /* Check GZIP compression level */
+      /* ---------------------------- */
+      if( compparm[0] < 0 || compparm[0] > 9)
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Invalid GZIP compression level. \n");
+	  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  else
+    {
+      /* Check SZIP compression block size */
+      /* --------------------------------- */
+      if( compparm[0] != 2 && compparm[0] != 4 && compparm[0] != 6 && compparm[0] != 8 &&
+	  compparm[0] != 10 && compparm[0] != 12 && compparm[0] != 14 && compparm[0] != 16 &&
+	  compparm[0] != 18 && compparm[0] != 20 && compparm[0] != 22 && compparm[0] != 24 &&
+	  compparm[0] != 26 && compparm[0] != 28 && compparm[0] != 30 && compparm[0] != 32)
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Invalid SZIP compression block size. \n");
+	  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  
+#ifdef H5_HAVE_FILTER_SZIP
+  can_encode = HE5_szip_can_encode();
+#endif
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWdefcomp", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* If the current property list is not set up */
+      /* ------------------------------------------ */
+      if( HE5_SWXSwath[idx].plist == FAIL)
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Unable to compress, dataset storage layout has not been set to CHUNKED. \n");
+	  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+      else 
+	{
+	  layout = H5Pget_layout(HE5_SWXSwath[idx].plist);
+	  if (layout == H5D_LAYOUT_ERROR)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot get the layout of the raw data. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_PLIST, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	  
+	  if( layout != H5D_CHUNKED )
+	    status =  H5Pset_layout(HE5_SWXSwath[idx].plist, H5D_CHUNKED);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage of the raw data. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	  
+	  
+	  switch (compcode)
+	    {
+	      /* Set NBIT compression parameters in compression external array */
+	      /* ------------------------------------------------------------- */ 
+	    case HE5_HDFE_COMP_NBIT:
+	      
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      HE5_SWXSwath[idx].compparm[1] = compparm[1];
+	      HE5_SWXSwath[idx].compparm[2] = compparm[2];
+	      HE5_SWXSwath[idx].compparm[3] = compparm[3];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_DEFLATE:
+	      
+	      /* ------------------------------------------------- */
+	      /* Set compression method to H5D_COMPRESS_DEFLATE    */
+	      /*       and compression level to "compparm[0]"      */
+	      /* ------------------------------------------------- */
+	      status = H5Pset_deflate(HE5_SWXSwath[idx].plist, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	      
+	      /* ------------------------------------------------- */
+	      /* Set GZIP compression method and compression       */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_SWXSwath[idx].compcode = compcode; 
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_SZIP_CHIP:
+	      
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_CHIP compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+	      
+	      /* ----------------------------------------------- */
+	      /* Set SZIP_CHIP compression method and compression*/
+	      /*    parameters in external array                 */
+	      /* ----------------------------------------------- */
+	      HE5_SWXSwath[idx].compcode = compcode;
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_SZIP_K13:
+	      
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_SWXSwath[idx].plist, 
+				       H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+	      
+	      /* ------------------------------------------------- */
+	      /* Set SZIP_K13 compression method and compression   */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_SWXSwath[idx].compcode = compcode;
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_SZIP_EC:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+
+	      /* ------------------------------------------------- */
+	      /* Set SZIP_EC compression method and compression    */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_SWXSwath[idx].compcode = compcode;
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_SZIP_NN:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+
+	      /* ------------------------------------------------- */
+	      /* Set SZIP_NN compression method and compression    */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_SWXSwath[idx].compcode = compcode;
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_SZIP_K13orEC:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_SWXSwath[idx].plist, 
+				       H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_K13orEC compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+
+	      /* ------------------------------------------------- */
+	      /* Set SZIP_K13orEC compression method and           */
+	      /*    compression parameters in external array       */
+	      /* ------------------------------------------------- */
+	      HE5_SWXSwath[idx].compcode = compcode;
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_SZIP_K13orNN:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_SWXSwath[idx].plist, 
+				       H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+
+	      /* ------------------------------------------------- */
+	      /* Set SZIP_K13orNN compression method and           */
+	      /*    compression parameters in external array       */
+	      /* ------------------------------------------------- */
+	      HE5_SWXSwath[idx].compcode = compcode;
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_SHUF_DEFLATE:
+	      
+	      status = H5Pset_shuffle(HE5_SWXSwath[idx].plist);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the shuffling method. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	      
+	      status = H5Pset_deflate(HE5_SWXSwath[idx].plist, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	      
+	      /* ------------------------------------------------- */
+	      /* Set shuffling+GZIP method and compression         */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_SWXSwath[idx].compcode = compcode;
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_SHUF_SZIP_CHIP:
+	      
+	      status = H5Pset_shuffle(HE5_SWXSwath[idx].plist);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the shuffling method. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_CHIP method and block size. \n");
+		      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+
+	      /* ------------------------------------------------- */
+	      /* Set shuffling+SZIP_CHIP method and compression    */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_SWXSwath[idx].compcode = compcode;
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_SHUF_SZIP_K13:
+	      
+	      status = H5Pset_shuffle(HE5_SWXSwath[idx].plist);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the shuffling method. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+
+	      /* ------------------------------------------------- */
+	      /* Set shuffling+SZIP_K13 method and compression     */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_SWXSwath[idx].compcode = compcode;
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_SHUF_SZIP_EC:
+	      
+	      status = H5Pset_shuffle(HE5_SWXSwath[idx].plist);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the shuffling method. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+
+	      /* ------------------------------------------------- */
+	      /* Set shuffling+SZIP_EC method and compression      */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_SWXSwath[idx].compcode = compcode;
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_SHUF_SZIP_NN:
+	      
+	      status = H5Pset_shuffle(HE5_SWXSwath[idx].plist);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the shuffling method. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+
+	      /* ------------------------------------------------- */
+	      /* Set shuffling+SZIP_NN method and compression      */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_SWXSwath[idx].compcode = compcode;
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_SHUF_SZIP_K13orEC:
+	      
+	      status = H5Pset_shuffle(HE5_SWXSwath[idx].plist);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the shuffling method. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_SWXSwath[idx].plist, 
+				       H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_K13orEC compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+
+	      /* ------------------------------------------------- */
+	      /* Set shuffling+SZIP_K13orEC method and             */
+	      /*    compression parameters in external array       */
+	      /* ------------------------------------------------- */
+	      HE5_SWXSwath[idx].compcode = compcode;
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_SHUF_SZIP_K13orNN:
+	      
+	      status = H5Pset_shuffle(HE5_SWXSwath[idx].plist);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the shuffling method. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_SWXSwath[idx].plist, 
+				       H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+
+	      /* ------------------------------------------------- */
+	      /* Set shuffling+SZIP_K13orNN method and             */
+	      /*    compression parameters in external array       */
+	      /* ------------------------------------------------- */
+	      HE5_SWXSwath[idx].compcode = compcode;
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    case HE5_HDFE_COMP_NONE:
+	      
+	      HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	      
+	      break;
+	      
+	    default:
+	      {
+		status = FAIL;
+		sprintf(errbuf, "Invalid compression method \"%d\" . \n", compcode);
+		H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      }
+	      break;
+	      
+	    }
+	}
+      
+    }
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefcomchunk                                                |
+|                                                                             |
+|  DESCRIPTION: Defines compression type and parameters and sets chunking     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  compcode       int                 compression code                        |
+|  compparm       int                 compression parameters                  |
+|  rank           int                 rank of a dataset                       |
+|  *dim           const hsize_t       pointer to the array containing sizes   |
+|                                     of each dimension of a chunk            |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:   Before calling this function, storage must be CHUNKED             |
+|                      Values of compression code                             |
+|                         HDFE_COMP_NONE                  0                   |
+|                         HDFE_COMP_RLE                   1                   |
+|                         HDFE_COMP_NBIT                  2                   |
+|                         HDFE_COMP_SKPHUFF               3                   |
+|                         HDFE_COMP_DEFLATE               4                   |
+|                         HDFE_COMP_SZIP_EC               5                   |
+|                         HDFE_COMP_SZIP_NN               6                   |
+|                         HDFE_COMP_SZIP_K13              7                   |
+|                         HDFE_COMP_SZIP_CHIP             8                   |
+|                         HDFE_COMP_SZIP_K13orEC          9                   |
+|                         HDFE_COMP_SZIP_K13orNN          10                  |
+|                         HDFE_COMP_SHUF_DEFLATE          11                  |
+|                         HDFE_COMP_SHUF_SZIP_CHIP        12                  |
+|                         HDFE_COMP_SHUF_SZIP_K13         13                  |
+|                         HDFE_COMP_SHUF_SZIP_EC          14                  |
+|                         HDFE_COMP_SHUF_SZIP_NN          15                  |
+|                         HDFE_COMP_SHUF_SZIP_K13orEC     16                  |
+|                         HDFE_COMP_SHUF_SZIP_K13orNN     17                  |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|                                                                             |
+|  8/13/99  A.Muslimov    Changed the return type of SWdefcomp from int       |
+|                         to int   . Checked the statuses in the H5P... calls.|
+|  02/08/00 A.Muslimov    Added more error checkings.                         |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  July 00  A.Muslimov    Original tayloring from SWdefcomp() & SWdefchunk(). |
+|  June 01  A.Muslimov    Added checking for validity of input parameters.    |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  Aug  03  S.Zhao        Added Szip compression methods.                     |
+|  Oct  03  S.Zhao        Added the shuffling method.                         |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWdefcomchunk(hid_t swathID, int compcode, int *compparm, int rank, const hsize_t *dim)
+{
+  herr_t          status   = FAIL;            /* Return status variable */
+
+  int             i        = 0;               /* Loop index             */
+
+  hid_t           fid      = FAIL;            /* HDF-EOS file ID        */
+  hid_t           gid      = FAIL;            /* "HDFEOS" group ID      */
+
+  hsize_t         dims[HE5_DTSETRANKMAX];     /* Default dim. sizes     */
+
+  long            idx      = FAIL;            /* Swath index            */
+
+  H5D_layout_t    layout = H5D_LAYOUT_ERROR;  /* Storage layout type    */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+  int             can_encode;                 /* szip encoder presence flag */
+
+  HE5_LOCK;
+  CHECKPOINTER(compparm);
+  CHECKPOINTER(dim);
+
+  /* Check if compression code is valid */
+  /* ---------------------------------- */
+  if( compcode != HE5_HDFE_COMP_DEFLATE && compcode != HE5_HDFE_COMP_NONE &&
+      compcode != HE5_HDFE_COMP_SZIP_CHIP && compcode != HE5_HDFE_COMP_SZIP_K13 &&
+      compcode != HE5_HDFE_COMP_SZIP_EC && compcode != HE5_HDFE_COMP_SZIP_NN &&
+      compcode != HE5_HDFE_COMP_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SZIP_K13orNN &&
+      compcode != HE5_HDFE_COMP_SHUF_DEFLATE && compcode != HE5_HDFE_COMP_SHUF_SZIP_CHIP &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_K13 && compcode != HE5_HDFE_COMP_SHUF_SZIP_EC &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_NN && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orEC &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orNN )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Invalid/unsupported compression code. \n");
+      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  if( compcode == HE5_HDFE_COMP_DEFLATE || 
+      compcode == HE5_HDFE_COMP_NONE || 
+      compcode == HE5_HDFE_COMP_SHUF_DEFLATE)
+    {
+      /* Check GZIP compression level */
+      /* ---------------------------- */
+      if( compparm[0] < 0 || compparm[0] > 9)
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Invalid GZIP compression level. \n");
+	  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  else
+    {
+      /* Check SZIP compression block size */
+      /* --------------------------------- */
+      if( compparm[0] != 2 && compparm[0] != 4 && compparm[0] != 6 && compparm[0] != 8 &&
+	  compparm[0] != 10 && compparm[0] != 12 && compparm[0] != 14 && compparm[0] != 16 &&
+	  compparm[0] != 18 && compparm[0] != 20 && compparm[0] != 22 && compparm[0] != 24 &&
+	  compparm[0] != 26 && compparm[0] != 28 && compparm[0] != 30 && compparm[0] != 32)
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Invalid SZIP compression block size. \n");
+	  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+
+#ifdef H5_HAVE_FILTER_SZIP
+  can_encode = HE5_szip_can_encode();
+#endif
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWdefcomchunk", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Initialize dims[] array */
+      /* ----------------------- */
+      for (i = 0; i < HE5_DTSETRANKMAX; i++)
+	dims[i] = 0;
+      
+      /* get the current dataset creation property ID from external array  */
+      /* ----------------------------------------------------------------- */
+      if(HE5_SWXSwath[idx].plist == FAIL)
+	{
+	  /* create property list */
+	  /* -------------------- */
+	  HE5_SWXSwath[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+	  
+	  /* set layout to "H5D_CHUNKED" */
+	  /* --------------------------- */
+	  status = H5Pset_layout(HE5_SWXSwath[idx].plist, H5D_CHUNKED);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_STORAGE, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	}
+      else 
+	{
+	  /* Get layout of the raw data */
+	  /* -------------------------- */
+	  layout = H5Pget_layout(HE5_SWXSwath[idx].plist);
+	  if (layout == H5D_LAYOUT_ERROR)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot get the layout of the raw data. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_STORAGE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	  
+	  if( layout != H5D_CHUNKED )
+	    {
+	      
+	      /* set layout to "H5D_CHUNKED" */
+	      /* --------------------------- */
+	      status = H5Pset_layout( HE5_SWXSwath[idx].plist, H5D_CHUNKED);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_STORAGE, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    }
+	}
+      
+      /* set chunking */
+      /* ------------ */
+      if ( rank > 0 && dim != (hsize_t *)NULL)
+	{
+	  status = H5Pset_chunk(HE5_SWXSwath[idx].plist, rank, dim); 
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the sizes of chunks. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	}
+      else if ( rank > 0 && dim == (hsize_t *)NULL)
+	{
+	  /* Set default chunk sizes */
+	  /* ----------------------- */
+	  for (i = 0; i < rank; i++)
+	    dims[ i ] = HE5_CHUNKSIZE;
+	  
+	  status = H5Pset_chunk(HE5_SWXSwath[idx].plist, rank, dims); 
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the sizes of chunks. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	}
+      else
+	{
+	  sprintf(errbuf, "Invalid dataset rank,\"%d\" . \n", rank);
+	  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      
+      
+      switch (compcode)
+	{
+	  /* Set NBIT compression parameters in compression external array */
+	  /* ------------------------------------------------------------- */ 
+	case HE5_HDFE_COMP_NBIT:
+	  
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  HE5_SWXSwath[idx].compparm[1] = compparm[1];
+	  HE5_SWXSwath[idx].compparm[2] = compparm[2];
+	  HE5_SWXSwath[idx].compparm[3] = compparm[3];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_DEFLATE:
+	  
+	  /* ------------------------------------------------- */
+	  /* Set compression method to H5D_COMPRESS_DEFLATE    */
+	  /*       and compression level to "compparm[0]"      */
+	  /* ------------------------------------------------- */
+	  status = H5Pset_deflate(HE5_SWXSwath[idx].plist, compparm[0]);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	  
+	  /* ------------------------------------------------- */
+	  /* Set GZIP compression method and compression       */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  HE5_SWXSwath[idx].compcode = compcode;
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_SZIP_CHIP:
+	  
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set SZIP_CHIP compresssion method and block size. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+	  
+	  /* ------------------------------------------------- */
+	  /* Set SZIP_CHIP compression method and compression  */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  HE5_SWXSwath[idx].compcode = compcode;
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_SZIP_K13:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set SZIP_K13 compression method and compression   */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  HE5_SWXSwath[idx].compcode = compcode;
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_SZIP_EC:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set SZIP_EC compression method and compression    */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  HE5_SWXSwath[idx].compcode = compcode;
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_SZIP_NN:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set SZIP_NN compression method and compression    */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  HE5_SWXSwath[idx].compcode = compcode;
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_SZIP_K13orEC:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_SWXSwath[idx].plist, 
+				   H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set SZIP_K13orSZIP_EC compresssion method and block size. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set SZIP_K13orEC compression method and           */
+	  /*    compression parameters in external array       */
+	  /* ------------------------------------------------- */
+	  HE5_SWXSwath[idx].compcode = compcode;
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_SZIP_K13orNN:
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_SWXSwath[idx].plist, 
+				   H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set SZIP_K13orNN compression method and           */
+	  /*    compression parameters in external array       */
+	  /* ------------------------------------------------- */
+	  HE5_SWXSwath[idx].compcode = compcode;
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_SHUF_DEFLATE:
+	  
+	  status = H5Pset_shuffle(HE5_SWXSwath[idx].plist);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the shuffling method. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	  
+	  status = H5Pset_deflate(HE5_SWXSwath[idx].plist, compparm[0]);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	  
+	  /* ------------------------------------------------- */
+	  /* Set shuffling+GZIP method and compression         */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  HE5_SWXSwath[idx].compcode = compcode;
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_SHUF_SZIP_CHIP:
+	  
+	  status = H5Pset_shuffle(HE5_SWXSwath[idx].plist);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the shuffling method. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set SZIP_CHIP compresssion method and block size. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set shuffling+SZIP_CHIP method and compression    */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  HE5_SWXSwath[idx].compcode = compcode;
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_SHUF_SZIP_K13:
+	  
+	  status = H5Pset_shuffle(HE5_SWXSwath[idx].plist);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the shuffling method. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set shuffling+SZIP_K13 method and compression     */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  HE5_SWXSwath[idx].compcode = compcode;
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_SHUF_SZIP_EC:
+	  
+	  status = H5Pset_shuffle(HE5_SWXSwath[idx].plist);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the shuffling method. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set shuffling+SZIP_EC method and compression      */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  HE5_SWXSwath[idx].compcode = compcode;
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_SHUF_SZIP_NN:
+	  
+	  status = H5Pset_shuffle(HE5_SWXSwath[idx].plist);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the shuffling method. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set shuffling+SZIP_NN method and compression      */
+	  /*    parameters in external array                   */
+	  /* ------------------------------------------------- */
+	  HE5_SWXSwath[idx].compcode = compcode;
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_SHUF_SZIP_K13orEC:
+ 
+	  status = H5Pset_shuffle(HE5_SWXSwath[idx].plist);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the shuffling method. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {
+	      status = H5Pset_szip(HE5_SWXSwath[idx].plist, 
+				   H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set SZIP_K13orEC compresssion method and block size. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+
+	  /* ------------------------------------------------- */
+	  /* Set shuffling+SZIP_K13orEC method and             */
+	  /*    compression parameters in external array       */
+	  /* ------------------------------------------------- */
+	  HE5_SWXSwath[idx].compcode = compcode;
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_SHUF_SZIP_K13orNN:
+	  
+	  status = H5Pset_shuffle(HE5_SWXSwath[idx].plist);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the shuffling method. \n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+
+#ifdef H5_HAVE_FILTER_SZIP
+	  if(can_encode == 1)
+	    {	  
+	      status = H5Pset_szip(HE5_SWXSwath[idx].plist, 
+				   H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n");
+		  H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    } 
+	  else
+	    {
+	      sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+	      H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+#endif
+	  
+	  /* ------------------------------------------------- */
+	  /* Set shuffling+SZIP_K13orNN method and             */
+	  /*    compression parameters in external array       */
+	  /* ------------------------------------------------- */
+	  HE5_SWXSwath[idx].compcode = compcode;
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	case HE5_HDFE_COMP_NONE:
+	  
+	  HE5_SWXSwath[idx].compparm[0] = compparm[0];
+	  
+	  break;
+	  
+	default:
+	  {
+	    status = FAIL;
+	    sprintf(errbuf, "Invalid (unsupported) compression method \"%d\". \n", compcode);
+	    H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  }
+	  break;
+	  
+	}
+    }  
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefinefield                                                |
+|                                                                             |
+|  DESCRIPTION: Defines geolocation or data field within swath structure      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fieldtype      char                geo/data fieldtype                      |
+|  fieldname      char                fieldname                               |
+|  dimlist        char                Dimension (comma-separated)list         |
+|  maxdimlist     char                Maximum Dimension (comma-separated) list|
+|  numbertype     hid_t               field data type ID                      |
+|  merge          int                 merge code                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:  H5S_UNLIMITED is -1, not 0  => unlimited extendiable dimention     |
+|           size = -1.                                                        |
+|          (A.M.) If maxdimlist = NULL, then dimlist string is copied to the  |
+|          maxdimlist string, and corresponding information is written to     |
+|          the metadata section.                                              |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/23/99  A.Muslimov    Checked for the statuse returned by H5Dclose() and  |
+|                         H5Sclose().                                         |
+| 10/18/99  A.Muslimov    Replaced memcpy() by memmove() to avoid a problem   |
+|                            when arguments 1 and 2 overlap in memory.        |
+| 12/3/99   A.Muslimov    Added a call (see last lines) to H5Pclose().        |
+| 01/14/00  A.Muslimov    Modified setting up of the metadata strings to      |
+|                         to enable the proper functioning of calls involving |
+|                         appendible fields.                                  |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Nov  00  A.Muslimov    Updated a block checking if the data type is valid. |
+|                         Modified to enable appendability of any dimension.  |
+|  Aug  03  S.Zhao        Added Szip compression methods.                     |
+|  Oct  03  S.Zhao        Added to create a character string dataset.         |
+|  Mar  04  S.Zhao        Modified for a character string dataset.            |
+|  Apr  04  S.Zhao        Modified for a character string dataset.            |
+|  May  05  S.Zhao        Added HE5_EHdtype2numtype() function call.          |
+|  Sep  11  Abe Taaheri   Modified for correcting Unlimited dimension         |
+|                         behavior and extension, removing hardcoded name     |
+|                         Unlim                                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t   
+HE5_SWdefinefield(hid_t swathID, char *fieldtype, const char *fieldname, char *dimlist, char *maxdimlist, hid_t numbertype, int merge)
+{
+  herr_t          status      = FAIL; /* Return status variable             */
+ 
+  int             i           = 0;    /* Loop index                         */
+  int             foundAllDim = 1;    /* found all dimensions flag          */
+  int             append      = FALSE;/* "Is field appendable?" flag        */
+  int             first       = 1;    /* first entry flag                   */
+  int             fac         = 0;    /* Data (1)/Geo (2) Field flag        */
+  int             compcode    = FAIL; /* Compression code                   */
+  int             rank        = 0;    /* Field rank                         */
+  int             maxrank     = 0;    /* max dim  rank                      */
+
+  hid_t           fid        = FAIL;/* HDF-EOS file ID                      */
+  hid_t           gid        = FAIL;/* "HDFEOS" group ID                    */
+  hid_t           data_space = FAIL;/* dataspace ID                         */
+  hid_t           dataset    = FAIL;/* dataset ID                           */
+  hid_t           heos_gid   = FAIL;/* "SWATHS" group ID                    */
+
+  hsize_t         metavalue = 0;        /* Metavalue to insert              */
+  hsize_t         dims[HE5_DTSETRANKMAX];   /* Dimension size array         */
+  hsize_t         maxdims[HE5_DTSETRANKMAX];/* Dimension size array         */
+  hsize_t         dimsize   = 0;        /* Dimension size                   */
+  hsize_t         count[]   = { 1 };    /* number of elements to insert     */
+
+  long            idx       = FAIL;     /* Swath index                      */
+
+  H5D_layout_t    layout = H5D_LAYOUT_ERROR; /* Storage layout for raw data */
+
+  void            *value;
+
+  size_t          tsize     = 0;            /* Size of a datatype in bytes  */
+  hid_t           ntype     = FAIL;         /* number type ID               */
+  int             attr      = 0;            /* attribute value              */
+  hid_t           numtype   = FAIL;
+
+  H5D_fill_value_t fill_status;      /* to see if fill value is set or not  */
+
+  char            *dimbuf   = (char *)NULL;	   /* Dimension buffer             */
+  char            *comma    = (char *)NULL;	   /* Pointer to comma             */
+  char            *dimcheck = (char *)NULL;        /* Dimension check buffer       */
+  char            utlbuf[HE5_HDFE_UTLBUFSIZE];     /* Utility buffer               */
+  char            utlbuf2[HE5_HDFE_UTLBUFSIZE];	   /* Utility buffer 2             */
+  char            errbuf1[HE5_HDFE_ERRBUFSIZE];	   /* Error message buffer 1       */
+  char            errbuf2[HE5_HDFE_ERRBUFSIZE];    /* Error message buffer 2       */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];     /* Error message buffer         */
+  char            maxdimlstbuf[HE5_HDFE_DIMBUFSIZE];
+  char            dimlstbuf[HE5_HDFE_DIMBUFSIZE];
+  char            compparmbuf[HE5_HDFE_DIMBUFSIZE];/* Compression parmeter         */
+  char            *HDFcomp[18] = {"HE5_HDFE_COMP_NONE", "HE5_HDFE_COMP_RLE", "HE5_HDFE_COMP_NBIT", "HE5_HDFE_COMP_SKPHUFF", "HE5_HDFE_COMP_DEFLATE", "HE5_HDFE_COMP_SZIP_CHIP", "HE5_HDFE_COMP_SZIP_K13", "HE5_HDFE_COMP_SZIP_EC", "HE5_HDFE_COMP_SZIP_NN", "HE5_HDFE_COMP_SZIP_K13orEC", "HE5_HDFE_COMP_SZIP_K13orNN", "HE5_HDFE_COMP_SHUF_DEFLATE", "HE5_HDFE_COMP_SHUF_SZIP_CHIP", "HE5_HDFE_COMP_SHUF_SZIP_K13", "HE5_HDFE_COMP_SHUF_SZIP_EC", "HE5_HDFE_COMP_SHUF_SZIP_NN", "HE5_HDFE_COMP_SHUF_SZIP_K1 [...]
+
+  CHECKNAME(fieldname);
+  CHECKPOINTER(fieldtype);
+  CHECKPOINTER(dimlist);
+
+  /* Setup error message strings */
+  /* --------------------------- */
+  strcpy(errbuf1, "HE5_SWXSDname array too small.\nPlease increase ");
+  strcat(errbuf1, "size of HE5_HDFE_NAMBUFSIZE in \"HE5_HdfEosDef.h\".\n");
+  strcpy(errbuf2, "HE5_SWXSDdims array too small.\nPlease increase ");
+  strcat(errbuf2, "size of HE5_HDFE_DIMBUFSIZE in \"HE5_HdfEosDef.h\".\n");
+  	
+  /* assuming that fillvalue is undefined for the field */
+  fill_status = H5D_FILL_VALUE_UNDEFINED;
+
+  
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWdefinefield", &fid, &heos_gid, &idx);
+  if(status == FAIL ) return(status);
+	
+  /* initialize dims and maxdims array */
+  /* --------------------------------- */
+  for(i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      dims[i]    = 0;
+      maxdims[i] = 0;
+    }
+
+	
+  /* Allocate space for dimbuf, copy dimlist into it, & append comma */
+  /* --------------------------------------------------------------- */
+  dimbuf = (char *) calloc(strlen(dimlist) + 64, sizeof(char));
+  if(dimbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, 
+	      "Cannot allocate memory. \n");
+      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+	
+  /*
+********************************************************************
+*   C H E C K  T H E   C O N T E N T   O F   dimlist  S T R I N G  *   
+********************************************************************
+*/
+  
+  strcpy(dimbuf, dimlist);
+  strcat(dimbuf, ",");
+  
+  /* Find comma */
+  /* ---------- */
+  comma = strchr(dimbuf, ',');
+	
+  /*
+   * Loop through entries in dimension list to make sure they are
+   * defined in swath
+   */
+  while (comma != NULL)
+    {
+      /* Copy dimension list entry to dimcheck */
+      /* ------------------------------------- */
+      dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char));
+      if(dimcheck == NULL)
+	{
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, 
+		  "Cannot allocate memory. \n");
+	  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	  free(dimbuf);
+	  return(FAIL);
+	}
+      memmove(dimcheck, dimbuf, comma - dimbuf);
+
+      /* Get dimension size */
+      /* ------------------ */
+      dimsize = HE5_SWdiminfo(swathID, dimcheck);
+      if (dimsize > 0)
+	{
+	  dims[rank] = dimsize;
+	  rank++;
+	}
+      else
+	{
+	  /*
+	   * If dimension list entry not found - set error return
+	   * status, append name to utility buffer for error report
+	   */
+	  status = FAIL;
+	  foundAllDim = 0;
+	  if (first == 1)
+	    strcpy(utlbuf, dimcheck);
+	  else
+	    {
+	      strcat(utlbuf, ",");
+	      strcat(utlbuf, dimcheck);
+	    }
+	  first = 0;
+	}
+
+      /*
+       * Go to next dimension entry, find next comma, & free up
+       * dimcheck buffer
+       */
+      memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); 
+      comma = strchr(dimbuf, ',');
+      free(dimcheck);
+
+    }
+  free(dimbuf);
+	
+  /* If no dimensions found, report error */
+  /* ------------------------------------ */
+  if (foundAllDim == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" field. \n", utlbuf, fieldname);
+      H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return (status); 
+    }
+	
+	
+  /*
+************************************************************************
+*   C H E C K  T H E   C O N T E N T   O F   maxdimlist   S T R I N G  *   
+************************************************************************
+*/
+	
+	
+  /* Allocate space for dimbuf, copy maxdimlist into it, & append comma */
+  /* ------------------------------------------------------------------ */
+  if(maxdimlist != NULL) 
+    {
+      dimbuf = (char *) calloc(strlen(maxdimlist) + 64, sizeof(char));
+      if(dimbuf == NULL)
+	{
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, 
+		  "Cannot allocate memory. \n");
+	  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	  return(FAIL);
+
+	}
+	  
+      /* Copy "maxdimlist" to "dimbuf", & append comma */
+      /* --------------------------------------------- */
+      strcpy(dimbuf, maxdimlist);
+      strcat(dimbuf, ",");
+
+      /* Find comma */
+      /* ---------- */
+      comma = strchr(dimbuf, ',');
+
+      /*
+       * Loop through entries in dimension list to make sure they are
+       *                     defined in swath
+       */
+      while (comma != NULL)
+	{
+	  /* Copy dimension list entry to dimcheck */
+	  /* ------------------------------------- */
+	  dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char));
+	  if(dimcheck == NULL)
+	    {
+	      H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n");
+	      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	      free(dimbuf);
+	      return(FAIL);
+	    }
+	  memmove(dimcheck, dimbuf, comma - dimbuf);
+
+	  /* Get dimension size */
+	  /* ------------------ */
+	  dimsize = HE5_SWdiminfo(swathID, dimcheck);
+	  if ( (dimsize > 0) || (dimsize == H5S_UNLIMITED) )
+	    {
+	      maxdims[maxrank] = dimsize;
+	      maxrank++;
+	    }
+	  else
+	    {
+	      /*
+	       * If dimension list entry not found - set error return
+	       * status, append name to utility buffer for error report
+	       */
+	      status = FAIL;
+	      foundAllDim = 0;
+	      if (first == 1)
+		strcpy(utlbuf, dimcheck);
+	      else
+		{
+		  strcat(utlbuf, ",");
+		  strcat(utlbuf, dimcheck);
+		}
+	      first = 0;
+	    }
+
+	  /*
+	   * Go to next dimension entry, find next comma, & free up
+	   * dimcheck buffer
+	   */
+	  memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); 
+	  comma = strchr(dimbuf, ',');
+	  free(dimcheck);
+	}
+
+      free(dimbuf);
+
+      /* If no dimensions found, report error */
+      /* ------------------------------------ */
+      if (foundAllDim == 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" field. \n", utlbuf, fieldname);
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+
+
+      /* If maxrank !=rank  then report error */
+      /* ------------------------------------ */
+      if ( maxrank != rank )
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Dimension rank doesn't match Maximum dimension rank. \n");
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+    } 
+  /* "maxlist == NULL"  ==> maxdims[]= dims[] */
+  /* ---------------------------------------- */
+  else
+    {
+      for(i = 0; i < rank; i++ )
+	maxdims[ i ] = dims[ i ];
+    }
+  
+	
+  /* Find out if the dataset dimension is appendable */
+  /* ----------------------------------------------- */
+  for(i = 0; i < rank; i++)
+    {
+      if( dims[i] == maxdims[i] )
+	append = FALSE;
+      else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED))
+	{
+	  append = TRUE;
+	  break;
+	}
+      else
+	{
+	  status = FAIL;
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADRANGE, 
+		  "Maximum dimension size is smaller than Dimension size. \n");
+	  HE5_EHprint("Error: Maximum dimension size is smaller than Dimension size, occured", 
+		      __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+	
+	
+  /* Check for valid data type ID ("numbertype") */
+  /* ------------------------------------------- */
+  if (numbertype != HE5T_CHARSTRING)
+    {
+      if (
+	  H5Tequal(numbertype, H5T_NATIVE_CHAR)   != SUCCEED &&
+	  H5Tequal(numbertype, H5T_NATIVE_SCHAR)  != SUCCEED &&
+	  H5Tequal(numbertype, H5T_NATIVE_UCHAR)  != SUCCEED &&
+	  H5Tequal(numbertype, H5T_NATIVE_SHORT)  != SUCCEED &&
+	  H5Tequal(numbertype, H5T_NATIVE_USHORT) != SUCCEED &&
+	  H5Tequal(numbertype, H5T_NATIVE_INT)    != SUCCEED &&
+	  H5Tequal(numbertype, H5T_NATIVE_UINT)   != SUCCEED &&
+	  H5Tequal(numbertype, H5T_NATIVE_LONG)   != SUCCEED &&
+	  H5Tequal(numbertype, H5T_NATIVE_ULONG)  != SUCCEED &&
+	  H5Tequal(numbertype, H5T_NATIVE_LLONG)  != SUCCEED &&
+	  H5Tequal(numbertype, H5T_NATIVE_ULLONG) != SUCCEED &&
+	  H5Tequal(numbertype, H5T_NATIVE_FLOAT)  != SUCCEED &&
+	  H5Tequal(numbertype, H5T_NATIVE_DOUBLE) != SUCCEED &&
+	  H5Tequal(numbertype, H5T_NATIVE_LDOUBLE)!= SUCCEED &&
+          H5Tequal(numbertype, H5T_C_S1) != SUCCEED
+	  )
+	{
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, 
+		  "Invalid (unsupported) data type. \n");
+	  HE5_EHprint("Error: Invalid (unsupported) data type, occured", __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+	
+	
+  /* Get the field group ID */
+  /*----------------------- */
+  if (strcmp(fieldtype, "Data Fields") == 0)
+    {
+      gid = HE5_SWXSwath[idx].data_id;
+      fac = 1;
+    }
+  else if (strcmp(fieldtype, "Geolocation Fields") == 0)
+    {
+      gid = HE5_SWXSwath[idx].geo_id;
+      fac = 2;
+    }
+  else
+    {
+      sprintf(errbuf,"Invalid (unsupported) field group. \n");
+      H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return (FAIL);	  
+    }
+	
+  /* Create dataspace then create dataset */
+  /*------------------------------------ */
+  if( HE5_SWXSwath[idx].plist == FAIL )  
+    {   
+      HE5_SWXSwath[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+    }
+
+  /* Get dataset layout */
+  /* ------------------ */
+  layout = H5Pget_layout(HE5_SWXSwath[idx].plist);
+  if( layout == H5D_LAYOUT_ERROR)
+    {
+      H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, 
+	      "Cannot get dataset layout.\n");
+      HE5_EHprint("Error: Cannot get dataset layout, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }	
+
+  if(append == FALSE)
+    data_space = H5Screate_simple(rank, dims, NULL);
+  else
+    {
+      if( layout == H5D_CHUNKED)
+	data_space = H5Screate_simple(rank, dims, maxdims);
+      else
+	{
+	  status = FAIL;
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, 
+		  "Appendable dataset MUST BE CHUNKED first.\n");
+	  HE5_EHprint("Error: Appendable dataset MUST BE CHUNKED first, occured", __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+	
+  /* Get current compression code */
+  /* ---------------------------- */
+  compcode = HE5_SWXSwath[idx].compcode;
+
+  /* Note: in inquiry routines HE5T_CHARSTRING is distinguished 
+     from HE5T_NATIVE_CHAR for the field data (not attributes) based
+     on whether string has variable or fixed length as set below.
+     The field data of type HE5T_NATIVE_CHAR has fixed length of 1, and
+     the field is array of characters, not strings. However, HE5T_CHARSTRING
+     sets array of vaiable length strings for the field data.
+     Currently HE5_EHattr treats HE5T_NATIVE_CHAR, HE5T_CHARSTRING, and
+     H5T_C_S1 as fixed (any size) for attributes. 
+  */
+  ntype = numbertype;
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_C_S1))
+    {
+      ntype = H5Tcopy(H5T_C_S1);
+      status = H5Tset_size(ntype, H5T_VARIABLE);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set HDF5 datatype size for \"%s\" field. \n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      /* Create dataset */
+      /* -------------- */
+      dataset = H5Dcreate(gid, fieldname, ntype, data_space, HE5_SWXSwath[idx].plist);
+      if (dataset == FAIL)
+        {
+          status = FAIL;
+          sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", fieldname);
+          H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(status);
+        }
+
+    }
+  else if (numbertype == H5T_NATIVE_CHAR)
+    {
+      ntype = H5Tcopy(H5T_C_S1);
+      status = H5Tset_size(ntype, 1);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set HDF5 datatype size for \"%s\" field. \n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+      /* Create dataset */
+      /* -------------- */
+      dataset = H5Dcreate(gid, fieldname, ntype, data_space, HE5_SWXSwath[idx].plist);
+      if (dataset == FAIL)
+        {
+          status = FAIL;
+          sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", fieldname);
+          H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(status);
+        }
+ 
+    }
+  else
+    {
+      /* Create dataset */
+      /* -------------- */
+      dataset = H5Dcreate(gid, fieldname, numbertype, data_space, HE5_SWXSwath[idx].plist);
+      if (dataset == FAIL)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);   
+	}
+    }
+    
+  /* Extend the dataset. assure that dataset is at least dims */
+  /* -------------------------------------------------------- */
+  if( append == TRUE)
+    {
+      status = H5Dextend(dataset,dims);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot extend the dataset for \"%s\" field.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);   
+	}
+    }
+    
+	
+  /* load external array */
+  /* ------------------- */
+  if ( fac == 2 )				/*"Geo fields"*/
+    {
+      /* Store dataset IDs and dataset name */
+      /* ---------------------------------- */
+      if (HE5_SWXSwath[idx].nGFLD > 0)
+	{
+	  /* allocate memory to gdataset struct */
+	  /* ---------------------------------- */
+	  HE5_SWXSwath[idx].gdataset = (HE5_DTSinfo *)realloc((void *)HE5_SWXSwath[idx].gdataset, (HE5_SWXSwath[idx].nGFLD + 1) * sizeof(HE5_DTSinfo));
+	}
+      else
+	{
+	  HE5_SWXSwath[idx].gdataset = (HE5_DTSinfo *)calloc(1, sizeof(HE5_DTSinfo));
+	  if (HE5_SWXSwath[idx].gdataset == NULL )
+	    {
+	      status = FAIL;
+	      H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, 
+		      "Cannot allocate memory. \n");
+	      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	      return(status);
+	    }
+	}
+		
+		
+      /* Allocate memory to name */
+      /* ----------------------- */
+      HE5_SWXSwath[idx].gdataset[HE5_SWXSwath[idx].nGFLD].name = 
+	(char *)calloc( (strlen(fieldname)+1), sizeof(char) );
+      if (HE5_SWXSwath[idx].gdataset[HE5_SWXSwath[idx].nGFLD].name == NULL)
+	{
+	  status = FAIL;
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, 
+		  "Cannot allocate memory.\n");
+	  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	  return(status);
+	}
+		
+      /* Load table */
+      /* ---------- */
+      HE5_SWXSwath[idx].gdataset[HE5_SWXSwath[idx].nGFLD].ID = dataset;
+      strcpy(HE5_SWXSwath[idx].gdataset[HE5_SWXSwath[idx].nGFLD].name, fieldname);
+		
+      HE5_SWXSwath[idx].nGFLD++;
+    }
+  else	 /* "Data Fields" */
+    {
+      /* store dataset IDs and dataset name */
+      /* ---------------------------------- */
+      if (HE5_SWXSwath[idx].nDFLD > 0)
+	{
+	  /* Allocate memory to ddataset struct */
+	  /* ---------------------------------- */
+	  HE5_SWXSwath[idx].ddataset = (HE5_DTSinfo *)realloc((void *)HE5_SWXSwath[idx].ddataset,(HE5_SWXSwath[idx].nDFLD + 1) * sizeof(HE5_DTSinfo));
+			
+	}
+      else
+	{
+	  HE5_SWXSwath[idx].ddataset = (HE5_DTSinfo *)calloc(1, sizeof(HE5_DTSinfo));
+	  if (HE5_SWXSwath[idx].ddataset == NULL )
+	    {
+	      status = FAIL;
+	      H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, 
+		      "Cannot allocate memory. \n");
+	      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	      return(status);
+	    }	  
+			
+	}
+		
+      /* Allocate memory to name */
+      /* ----------------------- */
+      HE5_SWXSwath[idx].ddataset[HE5_SWXSwath[idx].nDFLD].name = 
+	(char *)calloc( (strlen(fieldname)+1), sizeof(char) );
+      if (HE5_SWXSwath[idx].ddataset[HE5_SWXSwath[idx].nDFLD].name == NULL)
+	{
+	  status = FAIL;
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, 
+		  "Cannot allocate memory.\n");
+	  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	  return(status);
+	}
+
+      /* load table */
+      /* ---------- */
+      HE5_SWXSwath[idx].ddataset[HE5_SWXSwath[idx].nDFLD].ID = dataset;
+      strcpy(HE5_SWXSwath[idx].ddataset[HE5_SWXSwath[idx].nDFLD].name, fieldname);
+      HE5_SWXSwath[idx].nDFLD++;
+    }
+	
+  if ((numbertype != HE5T_CHARSTRING) && (numbertype != H5T_NATIVE_CHAR) && (numbertype != H5T_C_S1))
+    {
+      /* Get the size of a datatype in bytes */
+      /* ----------------------------------- */ 
+      tsize = H5Tget_size( numbertype);
+      if( tsize == 0)
+	{
+	  sprintf(errbuf, "Cannot get the size of a datatype. \n");
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (FAIL);
+	}
+  
+      /* allocate memory for "fill" value */
+      /* -------------------------------- */
+      value = (void *)calloc(1, tsize);
+      if( value == (void *)NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for fill value.\n");
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (FAIL);
+	}
+	
+      /* Try to retrieve the fill value (in case it's already defined) */
+      /* ------------------------------------------------------------- */ 
+
+      H5E_BEGIN_TRY {
+	status = H5Pfill_value_defined(HE5_SWXSwath[idx].plist, &fill_status );
+      }
+      H5E_END_TRY;
+      if (fill_status == H5D_FILL_VALUE_USER_DEFINED)
+	{
+	  H5E_BEGIN_TRY {
+	    status = H5Pget_fill_value(HE5_SWXSwath[idx].plist,  numbertype,  value);
+	  }
+	  H5E_END_TRY;
+	  
+	  /* Store fill value in the dataset attribute "_FillValue" */
+	  /* -----------------------------------------------------  */ 
+	  if( status != FAIL)
+	    {
+	      status = HE5_EHattr( dataset, "_FillValue", numbertype, count, "w", value);
+	      if( status == FAIL )
+		{
+		  sprintf(errbuf, "Cannot store fill value in the attribute \"_FillValue\".");
+		  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(value);
+		  return (status);
+		}
+	    }
+	}
+    
+      free( value);
+
+    }
+
+	
+  /*  
+******************************************************************
+*                  SET   UP  METADATA  STRINGS                   *
+******************************************************************
+*/
+	
+	
+  /*  set up "DimList" string content */
+  /*  ------------------------------- */
+  strcpy(utlbuf,"");
+  sprintf(utlbuf, "%s%s%s", fieldname,":",dimlist);
+    
+  /* set up "MaxdimList"  string content */
+  /* ----------------------------------- */ 
+  if ( maxdimlist != NULL)
+    {
+      status = HE5_EHmetalist(maxdimlist,maxdimlstbuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot convert the input \"%s\" list to the metadata list. \n", maxdimlist);
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+      sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=", maxdimlstbuf);
+      strcat(utlbuf,utlbuf2);
+		 
+    }
+  if (maxdimlist == NULL)
+    {
+      status = HE5_EHmetalist(dimlist,dimlstbuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot convert the input \"%s\" list to the metadata list.\n", dimlist);
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+      sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=", dimlstbuf);
+      strcat(utlbuf,utlbuf2);       
+		
+    }
+    
+  /* setup "CompressionType" & "CompressionParams" strings content */
+  /* ------------------------------------------------------------- */
+  if (compcode != HE5_HDFE_COMP_NONE)
+    {
+      sprintf(utlbuf2,"%s%s","\n\t\t\t\tCompressionType=", HDFcomp[compcode]);
+		
+      switch (compcode)
+	{
+	case HE5_HDFE_COMP_NBIT:
+
+	  sprintf(compparmbuf,
+		  "%s%d,%d,%d,%d%s",
+		  "\n\t\t\t\tCompressionParams=(",
+		  HE5_SWXSwath[idx].compparm[0],
+		  HE5_SWXSwath[idx].compparm[1],
+		  HE5_SWXSwath[idx].compparm[2],
+		  HE5_SWXSwath[idx].compparm[3], ")");
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+			
+			
+	case HE5_HDFE_COMP_DEFLATE:
+			
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SZIP_CHIP:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SZIP_K13:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SZIP_EC:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SZIP_NN:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SZIP_K13orEC:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SZIP_K13orNN:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SHUF_DEFLATE:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_CHIP:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_K13:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_EC:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_NN:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_K13orEC:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_K13orNN:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	default:
+	  {
+	    sprintf(errbuf,"Compression code \"%d\" is not supported. \n", compcode);
+	    H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  }
+			
+	  break;		    
+			
+			
+	}
+		
+      /* Concatanate compression parameters with compression code */
+      /* -------------------------------------------------------- */
+      strcat(utlbuf, utlbuf2);
+    }
+	
+	
+  /* 
+******************************************************************
+*   Insert metadata information to Structural Metadata section   *
+******************************************************************
+*/          
+  numtype = HE5_EHdtype2numtype(numbertype);
+  if (numtype == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number type ID. \n");
+      H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else if (numtype == 0)
+    {
+      metavalue = 0;
+    }
+  else
+    {
+      metavalue = HE5_EHhid2hsize(numtype);
+      if (metavalue == 0)
+	{
+	  sprintf(errbuf, "Cannot convert \"hid_t\" to \"hsize_t\" data type. \n");
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+
+  if (strcmp(fieldtype, "Geolocation Fields") == 0)
+    status = HE5_EHinsertmeta(fid, HE5_SWXSwath[idx].swname, "s", 3L, utlbuf, &metavalue);
+  else
+    status = HE5_EHinsertmeta(fid, HE5_SWXSwath[idx].swname, "s", 4L, utlbuf, &metavalue);
+	
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot insert metadata for \"%s\" field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);   
+    }
+
+  /* Release data space ID */
+  /* --------------------- */
+  status =  H5Sclose(data_space);
+  if (status == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, "Cannot release the data space ID.\n");
+      HE5_EHprint("Error: Cannot release the data space ID, occured", __FILE__, __LINE__);
+      return(status);   
+    }
+
+  /* Release property list ID */
+  /* ------------------------ */
+  status = H5Pclose(HE5_SWXSwath[idx].plist);
+  if (status == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_PLIST, H5E_CLOSEERROR, "Cannot release the property list ID.\n");
+      HE5_EHprint("Error: Cannot release the property list ID, occured", __FILE__, __LINE__);
+      return(status);
+    }
+	
+  /* Reset external array entry for next dataset creation */
+  /* ==================================================== */
+  HE5_SWXSwath[idx].plist    = FAIL;
+  HE5_SWXSwath[idx].compcode = HE5_HDFE_COMP_NONE; 
+
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_C_S1))
+    {
+      attr = HE5T_CHARSTRING;
+      status = HE5_SWwritelocattr(swathID, fieldname, "ARRAYOFSTRINGS", H5T_NATIVE_INT, count, &attr);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write attribute to the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+    }
+
+		
+ COMPLETION:
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefgeofield                                                |
+|                                                                             |
+|  DESCRIPTION: Defines geolocation field within swath structure (wrapper)    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWdefgeofield(hid_t swathID, const char *fieldname, char *dimlist, char *maxdimlist, hid_t numbertype_in , int merge)
+{
+  herr_t            status     = FAIL;          /* Return status variable   */
+  hid_t             numbertype;
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKPOINTER(dimlist);
+
+  /* Convert HDF-EOS5 datatype to HDF5 datatype */
+  if (
+      H5Tequal(numbertype_in, H5T_NATIVE_CHAR)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SHORT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_INT)    == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UINT)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LONG)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LLONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_FLOAT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== SUCCEED ||
+      H5Tequal(numbertype_in, H5T_C_S1) == SUCCEED)
+    {
+      numbertype = numbertype_in;
+    }
+  else
+    {
+      numbertype = HE5_EHconvdatatype((int) numbertype_in);
+    }
+
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID for Geolocation Field.\n");
+      H5Epush(__FILE__, "HE5_SWdefdatafield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Call HE5_SWdefinefield routine  */
+  /* ==============================  */
+  status = HE5_SWdefinefield(swathID, "Geolocation Fields", fieldname, dimlist, maxdimlist,  numbertype, merge);
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefdatafield                                               |
+|                                                                             |
+|  DESCRIPTION: Defines data field within swath structure (wrapper)           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWdefdatafield(hid_t swathID, const char *fieldname, char *dimlist, char *maxdimlist, hid_t numbertype_in, int merge)
+{
+  herr_t       status     = FAIL;          /* routine return status variable */
+  hid_t        numbertype;
+  char         errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKPOINTER(dimlist);
+
+  /* Convert HDF-EOS5 datatype to HDF5 datatype */
+  if (
+      H5Tequal(numbertype_in, H5T_NATIVE_CHAR)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SHORT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_INT)    == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UINT)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LONG)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LLONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_FLOAT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== SUCCEED ||
+      H5Tequal(numbertype_in, H5T_C_S1) == SUCCEED)
+    {
+      numbertype = numbertype_in;
+    }
+  else
+    {
+      numbertype = HE5_EHconvdatatype((int) numbertype_in);
+    }
+
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID for Data Field.\n");
+      H5Epush(__FILE__, "HE5_SWdefdatafield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+
+  /* Call HE5_SWdefinefield routine  */
+  /* ==============================  */
+  status = HE5_SWdefinefield(swathID, "Data Fields", fieldname, dimlist,maxdimlist,numbertype, merge);
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwritedatameta                                              |
+|                                                                             |
+|  DESCRIPTION: Defines structural metadata for pre-existing data             |
+|               field within swath structure                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath object ID                         |
+|  fieldname      char                fieldname                               |
+|  dimlist        char                Dimension list (comma-separated list)   |
+|  mvalue         hid_t               metavalue to insert                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  May  05  S.Zhao        Added HE5_EHdtype2numtype() function call.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWwritedatameta(hid_t swathID, const char *fieldname, char *dimlist, hid_t mvalue)
+{
+  herr_t        status     = FAIL;          /* Return status variable */
+
+  hid_t         fid        = FAIL;          /* HDF-EOS file ID        */
+  hid_t         gid        = FAIL;          /* "HDFEOS" group ID      */
+
+  hsize_t       metavalue  =  0;            /* Metavalue to insert    */
+
+  long          idx        = FAIL;          /* Swath index            */
+
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+  char          utlbuf[HE5_HDFE_DIMBUFSIZE];/* Utility buffer         */
+  hid_t         numtype    = FAIL;          /* Number type ID         */
+
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKPOINTER(dimlist);
+ 
+  numtype = HE5_EHdtype2numtype(mvalue);
+  if (numtype == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number type ID. \n");
+      H5Epush(__FILE__, "HE5_SWwritedatameta", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else if (numtype == 0)
+    {
+      metavalue = 0;
+    }
+  else
+    {
+      /* Convert 'numtype' to 'metavalue' */
+      /* -------------------------------- */    
+      metavalue = HE5_EHhid2hsize(numtype);
+      if ( metavalue == 0 )
+	{
+	  sprintf(errbuf, "Cannot convert metadata value. \n");
+	  H5Epush(__FILE__, "HE5_SWwritedatameta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWwritedatameta", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Setup and write field metadata */
+      /* ------------------------------ */
+      sprintf(utlbuf, "%s%s%s", fieldname, ":", dimlist);
+      status = HE5_EHinsertmeta(gid, HE5_SWXSwath[idx].swname, "s", 4L, utlbuf, &metavalue);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot insert metadata value. \n");
+	  H5Epush(__FILE__, "HE5_SWwritedatameta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwritegeometa                                               |
+|                                                                             |
+|  DESCRIPTION: Defines structural metadata for pre-existing data             |
+|               field within swath structure                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath object ID                         |
+|  fieldname      char                fieldname                               |
+|  dimlist        char                Dimension list (comma-separated list)   |
+|  mvalue         hid_t               metadata value to write                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  May  05  S.Zhao        Added HE5_EHdtype2numtype() function call.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWwritegeometa(hid_t swathID, const char *fieldname, char *dimlist, hid_t mvalue)
+{
+  herr_t        status     = FAIL;/* routine return status variable */
+
+  hid_t         fid        = FAIL;/* HDF-EOS file ID                */
+  hid_t         gid        = FAIL;/* "HDFEOS" group ID              */
+
+  hsize_t       metavalue  =  0;  /* Metavalue to insert            */
+
+  long          idx        = FAIL;/* Swath index                    */
+  
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ 
+  char          utlbuf[HE5_HDFE_DIMBUFSIZE];/* Utility buffer       */
+  hid_t         numtype    = FAIL;          /* Number type ID       */
+
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKPOINTER(dimlist);
+
+  numtype = HE5_EHdtype2numtype(mvalue);
+  if (numtype == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number type ID. \n");
+      H5Epush(__FILE__, "HE5_SWwritegeometa", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else if (numtype == 0)
+    {
+      metavalue = 0;
+    }
+  else
+    {
+      /* Convert 'numtype' to 'metavalue' */
+      /* -------------------------------- */
+      metavalue = HE5_EHhid2hsize(numtype);
+      if ( metavalue == 0 )
+	{
+	  sprintf(errbuf, "Cannot convert metadata value. \n");
+	  H5Epush(__FILE__, "HE5_SWwritegeometa", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWwritegeometa", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Setup and write field metadata */
+      /* ------------------------------ */
+      sprintf(utlbuf, "%s%s%s", fieldname, ":", dimlist);
+      status = HE5_EHinsertmeta(gid, HE5_SWXSwath[idx].swname, "s", 3L, utlbuf, &metavalue);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot insert metadata value. \n");
+	  H5Epush(__FILE__, "HE5_SWwritegeometa", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwriteattr                                                  |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute in a swath.                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  attrname       char                attribute name                          |
+|  numtype        hid_t               attribute dataset datatype ID           |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWwriteattr(hid_t swathID, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf)
+{
+  herr_t     status     = FAIL;          /* Return status variable  */
+
+  hid_t      fid        = FAIL;          /* HDF-EOS file ID         */
+  hid_t      gid        = FAIL;          /* "HDFEOS" group ID       */
+
+  long       idx        = FAIL;          /* Swath index             */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+  hid_t      numbertype;
+
+  HE5_LOCK;
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+
+  /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use numtype itself
+  */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      numbertype = numtype;
+    }
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWwriteattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Call HE5_EHattr to perform I/O */
+      /* ------------------------------ */
+      status = HE5_EHattr(HE5_SWXSwath[idx].sw_id, attrname, numbertype, count,"w", datbuf);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot write the attribute value. \n");
+	  H5Epush(__FILE__, "HE5_SWwriteattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWrdadattr                                                   |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from a swath.                                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWreadattr(hid_t swathID, const char *attrname, void *datbuf)
+{
+  herr_t      status  = FAIL;             /* Return status variable  */
+
+  hid_t       fid     = FAIL;             /* HDF-EOS file ID         */
+  hid_t       gid     = FAIL;             /* "HDFEOS" group ID       */
+  hid_t       ntype   = FAIL;             /* Data type ID            */  
+
+  long        idx     = FAIL;             /* Swath index             */
+  
+  hsize_t     count[] ={0};               /* Number of elements      */
+
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+
+  HE5_LOCK;
+  CHECKPOINTER(attrname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWreadattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Call HE5_EHattr to perform I/O */
+      /* ------------------------------ */
+      status = HE5_EHattr(HE5_SWXSwath[idx].sw_id, attrname, ntype, count,"r", datbuf);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot read the attribute value. \n");
+	  H5Epush(__FILE__, "HE5_SWreadattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWattrinfo                                                   |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  attrname       const char*         attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               Data type ID                            |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date       Programmer   Description                                       |
+|  ========   ============  ================================================= |
+|  05/10/00   A.Muslimov    Replaced 'H5T_class_t' type by 'int' data type.   |
+|  July 00    A.Muslimov    Unmasked hdf5 data types.                         |
+|  Feb  03    S.Zhao        Changed the type of 'ntype' from an H5T_class_t   |
+|                           to an hid_t.                                      |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t        status  = FAIL;             /* Return status variable  */
+
+  hid_t         fid     = FAIL;             /* HDF-EOS file ID         */
+  hid_t         gid     = FAIL;             /* "HDFEOS" group ID       */
+
+  long          idx     = FAIL;             /* Swath index             */
+
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+
+  CHECKPOINTER(attrname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get attribute group ID and call HE5_EHattrinfo */
+      /* ---------------------------------------------- */
+      status = HE5_EHattrinfo(HE5_SWXSwath[idx].sw_id, attrname, ntype, count);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot retrieve information about attribute. \n");
+	  H5Epush(__FILE__, "HE5_SWattrinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+
+ COMPLETION:
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqattrs                                                   |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in swath struct    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swath ID       hid_t               Swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in swath struct         |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqattrs(hid_t swathID, char *attrnames, long *strbufsize)
+{
+  long            nattr    = FAIL;/* Number of attributes (return)    */
+  long            idx      = FAIL;/* Swath index                      */
+
+  herr_t          status   = FAIL;/* routine return status variable   */
+
+  hid_t           fid      = FAIL;/* HDF-EOS file ID                  */
+  hid_t           gid      = FAIL;/* swath group ID                   */
+
+  char            *grpname = (char *)NULL;/* Group name string        */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWinqattrs", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      grpname = (char *)calloc( HE5_HDFE_NAMBUFSIZE, sizeof(char) );
+      if( grpname == NULL)
+        {
+          H5Epush(__FILE__, "HE5_SWinqattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+          HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      strcpy(grpname,"/HDFEOS/SWATHS/");
+      strcat(grpname, HE5_SWXSwath[idx].swname);
+
+      nattr = HE5_EHattrcat(fid,  grpname, attrnames, strbufsize);
+      if ( nattr == FAIL )
+	{
+	  sprintf(errbuf, "Cannot find the attributes. \n");
+	  H5Epush(__FILE__, "HE5_SWinqattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	}
+
+      if (grpname != NULL) free(grpname);
+
+    }
+
+  return (nattr);
+}
+
+
+#define REMQUOTE					\
+							\
+  memmove(utlstr, utlstr + 1, strlen(utlstr) - 2);	\
+  utlstr[strlen(utlstr) - 2] = 0;
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqdims                                                    |
+|                                                                             |
+|  DESCRIPTION: Returns dimension names and values defined in swath structure |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nDim           long                Number of defined dimensions            |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dimnames       char                Dimension names (comma-separated)       |
+|  dims           hsize_t             Dimension values                        |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  3/22/99                                                                    |
+|  7/29/99  A.Muslimov    In the call to EHmetagroup() replace gid by fid.    |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqdims(hid_t swathID, char *dimnames, hsize_t dims[])
+{
+  herr_t         status    = FAIL;/* routine return status variable      */
+
+  hid_t          fid       = FAIL;/* HDF-EOS file ID                     */
+  hid_t          gid       = FAIL;/* "HDFEOS" group ID                   */
+
+  long           idx       = FAIL;/* Swath index                         */
+  long           nDim      =  0;  /* Number of dimensions                */
+
+  hsize_t        size      =  0;  /* Dimension size                      */
+
+  char           *metabuf = (char *)NULL;     /* Pointer to SM           */
+  char           *metaptrs[2]={NULL,NULL};    /* Ptrs to start/end of SM */
+  char           utlstr[HE5_HDFE_UTLBUFSIZE]; /* Utility string          */
+  char           errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer    */
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWinqdims", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for Swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWinqdims", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* If dimension names or sizes are desired ... */
+  /* ------------------------------------------- */
+  if (dimnames != NULL || dims != NULL)
+    {
+      /* Get pointers to "Dimension" section within SM */
+      /* --------------------------------------------- */
+      metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "Dimension", metaptrs);
+	  
+      /* If dimension names are desired then "clear" name buffer */
+      /* ------------------------------------------------------- */
+      if (dimnames != NULL)
+	dimnames[0] = 0;
+	  
+      /* Begin loop through dimension entries in metadata */
+      /* ------------------------------------------------ */
+      while (1)
+	{
+	  /* Search for OBJECT string */
+	  /* ------------------------ */
+	  metaptrs[0] = strstr(metaptrs[0], "\t\tOBJECT=");
+	  /* If found within "Dimension" metadata section ... */
+	  /* ------------------------------------------------ */
+	  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+	    {
+	      /* Get Dimension Name (if desired) */
+	      /* ------------------------------- */
+	      if (dimnames != NULL)
+		{
+		  /* Check 1st for old meta data then new */
+		  /* ------------------------------------ */
+		  HE5_EHgetmetavalue(metaptrs, "OBJECT", utlstr);
+				  
+		  /*
+		   * If OBJECT value begins with double quote then old
+		   * metadata, dimension name is OBJECT value.
+		   * Otherwise search for "DimensionName" string
+		   */
+		  if (utlstr[0] != '"')
+		    {
+		      metaptrs[0] = strstr(metaptrs[0], "\t\t\t\tDimensionName=");
+		      HE5_EHgetmetavalue(metaptrs, "DimensionName", utlstr);
+		    }
+				  
+		  /* Strip off double quotes */
+		  /* ----------------------- */
+		  REMQUOTE
+						
+		    /* If not first name then add comma delimitor */
+		    /* ------------------------------------------ */
+		    if (nDim > 0)
+		      {
+			strcat(dimnames, ",");
+		      }
+				  
+		  /* Add dimension name to dimension list */
+		  /* ------------------------------------ */
+		  strcat(dimnames, utlstr);
+		}
+			  
+	      /* Get Dimension Size (if desired) */
+	      /* ------------------------------- */
+	      if (dims != NULL)
+		{
+		  HE5_EHgetmetavalue(metaptrs, "Size", utlstr);
+		  size = (hsize_t)atol(utlstr);
+		  dims[ nDim ] = size;
+		}
+	      /* Increment dimension counter */
+	      /* --------------------------- */
+	      nDim++;
+	    }
+	  else
+	    /* No more dimensions found */
+	    /* ------------------------ */
+	    break;
+	}
+	  
+      free(metabuf);
+    }
+  
+  return(nDim);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqmaps                                                    |
+|                                                                             |
+|  DESCRIPTION: Returns dimension mappings and offsets and increments         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nMap           long                Number of dimension mappings            |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dimmaps        char                dimension mappings (comma-separated)    |
+|  offset         long                array of offsets                        |
+|  increment      long                array of increments                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|                                                                             |
+|  7/29/99  A.Muslimov    In the call to EHmetagroup() replace gid by fid.    |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqmaps(hid_t swathID, char *dimmaps, long offset[], long increment[])
+{
+  herr_t         status    = FAIL;           /* Return status variable  */
+
+  hid_t          fid       = FAIL;           /* HDF-EOS file ID         */
+  hid_t          gid       = FAIL;           /* "HDFEOS" group ID       */
+
+  long           idx       = FAIL;           /* Swath index             */
+  long           off       = 0;              /* Mapping Offset          */
+  long           incr      = 0;	             /* Mapping Increment       */
+  long           nMap      = 0;	             /* Number of mappings      */
+
+  char           *metabuf = (char *)NULL;    /* Pntr to SM              */
+  char           *metaptrs[2]={NULL,NULL};   /* Ptrs to start/end of SM */
+  char           utlstr[HE5_HDFE_UTLBUFSIZE];/* Utility string          */
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWinqmaps", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for Swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWinqmaps", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* If mapping names or offsets or increments desired ... */
+  /* ----------------------------------------------------- */
+  if (dimmaps != NULL || offset != NULL || increment != NULL)
+    {
+      /* Get pointers to "DimensionMap" section within SM */
+      /* ------------------------------------------------ */
+      metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "DimensionMap", metaptrs);
+
+      /* If mapping names are desired then "clear" name buffer */
+      /* ----------------------------------------------------- */
+      if (dimmaps != NULL)
+	dimmaps[0] = 0;
+	  
+      /* Begin loop through mapping entries in metadata */
+      /* ---------------------------------------------- */
+      while (1)
+	{
+	  /* Search for OBJECT string */
+	  /* ------------------------ */
+	  metaptrs[0] = strstr(metaptrs[0], "\t\tOBJECT=");
+		  
+	  /* If found within "DimensionMap" metadata section ... */
+	  /* --------------------------------------------------- */
+	  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+	    {
+	      /* Get Geo & Data Dimensions (if desired) */
+	      /* -------------------------------------- */
+	      if (dimmaps != NULL)
+		{
+		  /* Get Geo Dim, remove quotes, add "/" */
+		  /* ----------------------------------- */
+		  HE5_EHgetmetavalue(metaptrs, "GeoDimension", utlstr);
+		  REMQUOTE
+		    strcat(utlstr, "/");
+
+		  /* if not first map then add comma delimitor */
+		  /* ----------------------------------------- */
+		  if (nMap > 0)
+		    {
+		      strcat(dimmaps, ",");
+		    }
+				  
+		  /* Add to map list */
+		  /* --------------- */
+		  strcat(dimmaps, utlstr);
+				  
+		  /* Get Data Dim, remove quotes */
+		  /* --------------------------- */
+		  HE5_EHgetmetavalue(metaptrs, "DataDimension", utlstr);
+		  REMQUOTE
+					
+		    /* Add to map list */
+		    /* --------------- */
+		    strcat(dimmaps, utlstr);
+		}
+
+	      /* Get Offset (if desired) */
+	      /* ----------------------- */
+	      if (offset != NULL)
+		{
+		  HE5_EHgetmetavalue(metaptrs, "Offset", utlstr);
+		  off          = atol(utlstr);
+		  offset[nMap] = off;
+		}
+			  
+	      /* Get Increment (if desired) */
+	      /* -------------------------- */
+	      if (increment != NULL)
+		{
+		  HE5_EHgetmetavalue(metaptrs, "Increment", utlstr);
+		  incr            = atol(utlstr);
+		  increment[nMap] = incr;
+		}
+			  
+	      /* Increment map counter */
+	      /* --------------------- */
+	      nMap++;
+	    }
+	  else
+	    /* No more mappings found */
+	    /* ---------------------- */
+	    break;
+	}
+	  
+      free(metabuf);
+    }
+  
+  return (nMap);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqidxmaps                                                 |
+|                                                                             |
+|  DESCRIPTION: Returns indexed mappings and index sizes                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nMap           long                Number of indexed dimension mappings    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  idxmaps        char                indexed dimension mappings              |
+|                                     (comma-separated)                       |
+|  idxsizes       hsize_t             Number of elements in each mapping      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|                                                                             |
+|  7/29/99  A.Muslimov    In the call to EHmetagroup() replace gid by fid.    |
+|  8/20/99  A.Muslimov    Checked for the statuses returned by EHgetmetavalue.|
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqidxmaps(hid_t swathID, char *idxmaps, hsize_t idxsizes[])
+{
+  herr_t          status   = FAIL;               /* Return status variable   */
+
+  hid_t           fid      = FAIL;               /* HDF-EOS file ID          */
+  hid_t           gid      = FAIL;               /* "HDFEOS" group ID        */
+
+  long            idx      = FAIL;               /* Swath index              */
+  long            nMap     =  0;                 /* Number of mappings       */
+
+  char            *metabuf = (char *)NULL;       /* Pntr to SM               */
+  char            *metaptrs[2]={NULL,NULL};      /* Pntrs to start/end of SM */
+  char            *utlstr  = (char *)NULL;   	 /* Utility string           */
+  char            *slash   = (char *)NULL;       /* Pointer to slash         */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];   /* Error message buffer     */
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWinqidxmaps", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for Swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWinqidxmaps", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate space for utility string */
+  /* --------------------------------- */
+  utlstr = (char *) calloc(HE5_HDFE_DIMBUFSIZE, sizeof(char));
+  if ( utlstr == NULL )
+    {
+      sprintf( errbuf,"Cannot allocate memory for utility string.\n");
+      H5Epush(__FILE__, "HE5_SWinqidxmaps", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  
+      return(FAIL);
+    }
+
+
+  /* If mapping names or index sizes desired ... */
+  /* ------------------------------------------- */
+  if (idxmaps != NULL || idxsizes != NULL)
+    {
+      /* Get pointers to "IndexDimensionMap" section within SM */
+      metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "IndexDimensionMap", metaptrs);
+	  
+      /* If mapping names are desired then "clear" name buffer */
+      /* ----------------------------------------------------- */
+      if (idxmaps != NULL)
+	idxmaps[ 0 ] = 0;
+	  
+      /* Begin loop through mapping entries in metadata */
+      /* ---------------------------------------------- */
+      while (1)
+	{
+	  /* Search for OBJECT string */
+	  /* ------------------------ */
+	  metaptrs[0] = strstr(metaptrs[0], "\t\tOBJECT=");
+	  /* If found within "IndexDimensionMap" metadata section ... */
+	  /* -------------------------------------------------------- */
+	  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+	    {
+	      /* Get Geo & Data Dimensions and # of indices */
+	      /* ------------------------------------------ */
+	      if (idxmaps != NULL)
+		{
+		  /* Get Geo Dim, remove quotes, add "/" */
+		  /* ----------------------------------- */
+		  status = HE5_EHgetmetavalue(metaptrs, "GeoDimension", utlstr);
+		  REMQUOTE
+		    strcat(utlstr, "/");
+				  
+		  /* if not first map then add comma delimitor */
+		  /* ----------------------------------------- */
+		  if(nMap > 0)
+		    strcat(idxmaps, ",");
+				  
+		  /* Add to map list */
+		  /* --------------- */
+		  strcat(idxmaps, utlstr);
+
+		  /* Get Index size (if desired) */
+		  /* --------------------------- */
+		  if (idxsizes != NULL)
+		    {
+		      /* Parse off geo dimension and find its size */
+		      /* ----------------------------------------- */
+		      slash = strchr(utlstr, '/');
+		      *slash = 0;
+		      idxsizes[ nMap ] = HE5_SWdiminfo(swathID, utlstr);
+		    }
+				  
+		  /* Get Data Dim, remove quotes */
+		  /* --------------------------- */
+		  status = HE5_EHgetmetavalue(metaptrs, "DataDimension", utlstr);
+		  REMQUOTE
+					
+		    /* Add to map list */
+		    /* --------------- */
+		    strcat(idxmaps, utlstr);
+		}
+			  
+	      /* Increment map counter */
+	      /* --------------------- */
+	      nMap++;
+	    }
+	  else
+	    /* No more mappings found */
+	    /* ---------------------- */
+	    break;
+	}
+	  
+      if (metabuf != NULL) free(metabuf);
+    }
+  
+  if(utlstr != NULL) free(utlstr);
+  
+  return (nMap);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqfields                                                  |
+|                                                                             |
+|  DESCRIPTION: Returns fieldnames, ranks and numbertypes defined in swath.   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nFld           long                Number of (geo/data) fields in swath    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  fieldtype      char                field type (geo or data)                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fieldlist      char                Field names (comma-separated)           |
+|  rank           int                 Array of ranks                          |
+|  numbertype     hid_t               Array of HDF number types               |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7/29/99  A.Muslimov    In the call to EHmetagroup() replace gid by fid.    |
+|  4/19/00  A.Muslimov    Changed type of 'slen' and 'fldnmlen' from long to  |
+|                          size_t.                                            |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  June 02  S.Zhao        Changed the type of 'numbertype' from an H5T_class_t|
+|                         to an hid_t.                                        |
+|  Oct. 03  S.Zhao        Added the H5Tclose(datatype) call.                  |
+|  Oct. 03  S.Zhao        Modified to enable a character string dataset.      |
+|  Mar  04  S.Zhao        Modified for a character string dataset.            |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static long 
+HE5_SWinqfields(hid_t swathID, char *fieldtype, char *fieldlist, int rank[], hid_t numbertype[])
+{
+  long          nFld       =  0;       /* Return number of mappings  */
+  long          i          =  0;       /* Loop index                 */
+  long          idx        =  FAIL;    /* Swath index                */
+  long          ntflds     =  0;       /* field counter              */
+
+  herr_t        status     = FAIL;/* routine return status variable  */
+  herr_t        Dstatus    = FAIL;/* Status for H5Dclose             */
+
+  int           groupflag  = FAIL;/* "0" - geolocation, "1" - data   */
+ 
+  hid_t         fid        = FAIL;/* HDF-EOS file ID                 */
+  hid_t         gid        = FAIL;/* "HDFEOS" group ID               */
+  hid_t         datasetid  = FAIL;/* Dataset ID                      */
+  hid_t         datatype   = FAIL;/* Data type ID                    */
+  hid_t         groupid    = FAIL;/* Group ID                        */
+
+  H5T_class_t   classid    = H5T_NO_CLASS;   /* Data type class ID   */
+
+  size_t        slen[HE5_DTSETRANKMAX];	     /* String length array  */
+  size_t        fldnmlen[HE5_FLDNUMBERMAX];  /* Array of namelengths */
+
+  char          *fldnm[HE5_FLDNUMBERMAX];    /* Array of names       */
+  char          *metabuf = (char *)NULL;     /* Pntr to SM           */
+  char          *metaptrs[2]={NULL,NULL};    /* Start/end of SM      */
+  char          utlstr[HE5_HDFE_UTLBUFSIZE]; /* Utility string       */
+  char          utlstr2[HE5_HDFE_UTLBUFSIZE];/* Utility string 2     */
+  char          *ptr[HE5_DTSETRANKMAX];	     /* String pointer array */
+  char          *tempfield = (char *)NULL;
+  char          errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */
+  htri_t     str_is_variable;                /* boolean: TRUE if 
+						string is variable 
+						lengeth FALSE if 
+						string is fixed length
+						-1 if error in 
+						H5Tis_variavle_str() */
+  
+  CHECKPOINTER(fieldtype);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWinqfields", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for Swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Initialize slen[] array */
+  /* ----------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    slen[i] = 0;
+
+  /* Initialize fldnmlen[] array */
+  /* --------------------------- */
+  for (i = 0; i < HE5_FLDNUMBERMAX; i++)
+    fldnmlen[i] = 0;
+
+
+  /* If field names, ranks,  or number types desired ... */
+  /* --------------------------------------------------- */
+  if (fieldlist != NULL || rank != NULL || numbertype != NULL)
+    {
+      /* Get pointers to "GeoField" or "DataField" section within SM */
+      /* ----------------------------------------------------------- */
+      if (strcmp(fieldtype, "Geolocation Fields") == 0)
+	{
+	  metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "GeoField", metaptrs);
+	  strcpy(utlstr2, "GeoFieldName");
+	  groupflag = 0;
+	}
+      else
+	{
+	  metabuf = (char *)HE5_EHmetagroup( fid, HE5_SWXSwath[idx].swname, "s", "DataField", metaptrs);
+	  strcpy(utlstr2, "DataFieldName");
+	  groupflag = 1;
+	}
+	  
+	  
+      /* If field names are desired then "clear" name buffer */
+      /* --------------------------------------------------- */
+      if (fieldlist != NULL)
+	fieldlist[0] = 0;
+	  
+      /* Begin loop through mapping entries in metadata */
+      /* ---------------------------------------------- */
+      while (1)
+	{
+	  /* Search for OBJECT string */
+	  /* ------------------------ */
+	  metaptrs[0] = strstr(metaptrs[0], "\t\tOBJECT=");
+		  
+	  /* If found within "Geo" or "Data" Field metadata section ... */
+	  /* ---------------------------------------------------------- */
+	  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+	    {
+	      /* Get field names (if desired) */
+	      /* ---------------------------- */
+	      if (fieldlist != NULL)
+		{
+		  /* Check 1st for old meta data then new */
+		  /* ------------------------------------ */
+		  HE5_EHgetmetavalue(metaptrs, "OBJECT", utlstr);
+
+		  /*
+		   * If OBJECT value begins with double quote then old
+		   * metadata, field name is OBJECT value. Otherwise
+		   * search for "GeoFieldName" or "DataFieldName"
+		   * string
+		   */
+				  
+		  if (utlstr[0] != '"')
+		    {
+		      strcpy(utlstr, "\t\t\t\t");
+		      strcat(utlstr, utlstr2);
+		      strcat(utlstr, "=");
+		      metaptrs[0] = strstr(metaptrs[0], utlstr);
+		      HE5_EHgetmetavalue(metaptrs, utlstr2, utlstr);
+		    }
+				  
+		  /* Strip off double quotes */
+		  /* ----------------------- */
+		  REMQUOTE
+						
+		    /* Add to fieldlist */
+		    /* ---------------- */
+		    if (nFld > 0)
+		      strcat(fieldlist, ",");
+				  
+		  strcat(fieldlist, utlstr);
+				  
+		}
+			  
+	      /* If numbertype  are desired then "clear" name buffer */
+	      /* --------------------------------------------------- */
+	      if (numbertype != NULL)
+		{
+		  ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen);
+		  if(ntflds != FAIL)
+		    {
+		      if(groupflag == 0)
+			groupid = HE5_SWXSwath[idx].geo_id;
+		      else
+			groupid = HE5_SWXSwath[idx].data_id;
+					  
+		      for(i = 0; i < ntflds; i++)
+			{
+			  tempfield      = (char *)calloc(fldnmlen[i] + 1, sizeof(char));
+			  memmove(tempfield,fldnm[i],fldnmlen[i]);
+						  
+			  /* Open the dataset */
+			  /* ---------------- */
+			  datasetid = H5Dopen(groupid, tempfield);
+			  if ( datasetid == FAIL )
+			    {
+			      sprintf(errbuf, "Cannot open the dataset \"%s\". \n", tempfield);
+			      H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+			      return(FAIL);
+			    }
+						  
+			  /* Get the data type */
+			  /* ----------------- */
+			  datatype = H5Dget_type(datasetid);
+			  if ( datatype == FAIL )
+			    {
+			      sprintf(errbuf, "Cannot get the data type ID. \n");
+			      H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+			      return(FAIL);
+			    }
+						  
+			  /* Get the data type class ID */
+			  /* -------------------------- */
+			  classid = H5Tget_class(datatype);
+			  if ( classid == H5T_NO_CLASS )
+			    {
+			      sprintf(errbuf, "Cannot get the data type class ID. \n");
+			      H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+			      return(FAIL);
+			    }
+
+			  if (classid == H5T_STRING)
+			    {
+			      /* HE5T_CHARSTRING has variable length for data fields */
+			      str_is_variable = H5Tis_variable_str(datatype);
+			      if(str_is_variable == TRUE)
+				{
+				  numbertype[i] = HE5T_CHARSTRING;
+				}
+			      else if(str_is_variable == FALSE)
+				{
+				  numbertype[i] = HE5T_NATIVE_CHAR;
+				}
+			      else
+				{
+				  status = FAIL;
+				  sprintf(errbuf, "Failed to see if string field is varaible or fixed length.\n");
+				  H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+				  if (metabuf != NULL) free(metabuf);
+				  HE5_EHprint(errbuf, __FILE__, __LINE__);
+				  return(status);
+				}
+
+			      /*HE5_SWgetstringtype(swathID, fieldname,classid);*/
+			      /*numbertype[i] = HE5T_CHARSTRING;*/
+			    }
+			  else
+			    {
+			      /*numbertype[i]  = classid;*/
+			      numbertype[i] = HE5_EHdtype2numtype(datatype);
+			      if ( numbertype[i] == FAIL )
+				{
+				  sprintf(errbuf, "Cannot get the number type ID. \n");
+				  H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+				  HE5_EHprint(errbuf, __FILE__, __LINE__);
+				  if (metabuf != NULL) free(metabuf);
+				  free(tempfield);
+				  return(FAIL);
+				}
+			    }
+						  
+			  /* Release the datatype ID */
+			  /* ----------------------- */
+			  status = H5Tclose(datatype);
+			  if ( status == FAIL )
+			    {
+			      sprintf(errbuf, "Cannot close the datatype \"%s\". \n", tempfield);
+			      H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+			      return(FAIL);
+			    }
+
+			  /* Release the dataset ID */
+			  /* ---------------------- */
+			  Dstatus = H5Dclose(datasetid);
+			  if ( Dstatus == FAIL )
+			    {
+			      sprintf(errbuf, "Cannot close the dataset \"%s\". \n", tempfield);
+			      H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+			      return(FAIL);
+			    }
+			  free(tempfield);
+			}
+		    }
+		}
+			  
+  
+	      /*
+	       * Get Rank (if desired) by counting # of dimensions in
+	       * "DimList" string
+	       */
+	      if (rank != NULL)
+		{
+		  HE5_EHgetmetavalue(metaptrs, "DimList", utlstr);
+		  rank[nFld] = HE5_EHlong2int(HE5_EHparsestr(utlstr, ',', ptr, slen) );
+		  if (rank[nFld] == FAIL )
+		    {
+		      sprintf(errbuf, "Cannot convert data type. \n");
+		      H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      if(metabuf != NULL) free(metabuf);
+		      return(FAIL);
+		    } 
+		}
+			  
+	      /* Increment field counter */
+	      /* ----------------------- */
+	      nFld++;
+			  
+	    }
+	  else
+	    /* No more fields found */
+	    /* -------------------- */
+	    break;
+	}               
+	  
+      if (metabuf != NULL) free(metabuf);
+    }
+  
+ COMPLETION:  
+  return(nFld);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqdatafields                                              |
+|                                                                             |
+|  DESCRIPTION: Inquires about data fields in swath                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nflds          long                Number of data fields in swath          |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fieldlist      char                Field names (comma-separated)           |
+|  rank           int                 Array of ranks                          |
+|  ntype          hid_t               number types                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/23/99  A.Muslimov    Changed datatype of nflds from int to int32_t.      |
+|  05/10/00 A.Muslimov    Replaced 'H5T_class_t' type by 'int' data type.     |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Jan 03   S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqdatafields(hid_t swathID, char *fieldlist, int rank[], hid_t ntype[])
+{
+  long            nflds   = FAIL;             /* Number of Data fields */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+
+  /* Call "HE5_SWinqfields" routine to get number of fields */
+  /* ------------------------------------------------------ */
+  nflds = HE5_SWinqfields(swathID, "Data Fields", fieldlist, NULL, NULL);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n");
+      H5Epush(__FILE__, "HE5_SWinqdatafields", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+        
+  /* Call "HE5_SWinqfields" routine to get other parameters */
+  /* ------------------------------------------------------ */
+  nflds = HE5_SWinqfields(swathID, "Data Fields", fieldlist, rank, ntype);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Inquiry about fields in \"Data Fields\" group fails. \n");
+      H5Epush(__FILE__, "HE5_SWinqdatafields", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  return(nflds);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqgeofields                                               |
+|                                                                             |
+|  DESCRIPTION: Inquires about geo fields in swath                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nflds          long                Number of geo fields in swath           |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fieldlist      char                Field names (comma-separated)           |
+|  rank           int                 Array of ranks                          |
+|  ntype          hid_t               number types                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  05/10/00 A.Muslimov    Replaced 'H5T_class_t' type by 'int' data type.     |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Jan 03   S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqgeofields(hid_t swathID, char *fieldlist, int rank[], hid_t ntype[])
+{
+
+  long            nflds   = FAIL;             /* Number of Geo  fields */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  /* Call "HE5_SWinqfields" routine to get number of fields */
+  /* ------------------------------------------------------ */
+  nflds = HE5_SWinqfields(swathID, "Geolocation Fields", fieldlist, NULL, NULL);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number of fields in \"Geolocation Fields\" group. \n");
+      H5Epush(__FILE__, "HE5_SWinqgeofields", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Call "HE5_SWinqfields" routine to get other parameters */
+  /* ------------------------------------------------------ */
+  nflds = HE5_SWinqfields(swathID, "Geolocation Fields", fieldlist, rank, ntype);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Inquiry about fields in \"Geolocation Fields\" group fails. \n");
+      H5Epush(__FILE__, "HE5_SWinqgeofields", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  return (nflds);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqdatatype                                                |
+|                                                                             |
+|  DESCRIPTION: Inquires about geo/data/prof fields in swath                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t               return status (0) SUCCEED, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t                                                       |
+|  fieldname      char *                                                      |
+|  attrname       char *                                                      |
+|  group          int                 Group flag:                             |
+|                                       ...GEOGROUP, ...DATAGROUP,            |
+|                                       ...PROFGROUP    - for the field       |
+|                                       ...ATTRGROUP, ...GRPATTRGROUP,        |
+|                                       ...PROFGRPATTRGROUP,                  |
+|                                       ...GEOGRPATTRGROUP,                   |
+|                                       ...LOCATTRGROUP - for the attribute   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datatype       hid_t                                                       |
+|  classid        H5T_class_t                                                 |
+|  order          H5T_order_t                                                 |
+|  size           size_t                                                      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 99   D.Wynne       Original Programmer                                 |
+|  Dec 99   A.Muslimov    Changed the status data type from hid_t to int   .  |
+|  Feb 00   A.Muslimov    Added error checking after the function calls.      |
+|  Mar 00   A.Muslimov    Updated to include Group/Local Attributes options.  |
+|  May 00   A.Muslimov    Replaced 'H5T_class_t' type by 'int' data type.     |
+|  Jul 00   A.Muslimov    Unmasked hdf5 data types.                           |
+|  Set 00   A.Muslimov    Updated to incorporate profile datasets.            |
+|  Feb 04   S.Zhao        Added a group flag for the "Profile Fields" group   |
+|                         attribute.                                          |
+|  Feb 04   S.Zhao        Added a group flag for the "Geolocation Fields"     |
+|                         group attribute.                                    |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWinqdatatype(hid_t swathID, const char *fieldname, const char *attrname, 
+int group, hid_t *datatype, H5T_class_t *classid, H5T_order_t *order, size_t *size)
+{
+ 
+  herr_t      status     = FAIL;	      /* routine return status */
+
+  int         fldgroup   = FAIL;          /* Field group flag      */
+
+  hid_t       datasetid  = FAIL;	      /* Dataset ID            */
+  hid_t       fid        = FAIL;	      /* HDF-EOS file ID       */
+  hid_t       gid        = FAIL;	      /* "HDFEOS" group ID     */
+  hid_t       attr       = FAIL;	      /* attribute dataset ID  */
+  hid_t       fldgroupID = FAIL;	      /* Field group ID        */
+  hid_t       fieldID    = FAIL;	      /* Field dataset ID      */         
+
+  long        idx        = FAIL;	      /* swath index           */
+
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWinqdatatype", &fid, &gid, &idx);
+  if(status == SUCCEED)
+    {
+      if(group == HE5_HDFE_GEOGROUP)
+	fldgroupID = HE5_SWXSwath[idx].geo_id;
+      else if(group == HE5_HDFE_DATAGROUP)
+	fldgroupID = HE5_SWXSwath[idx].data_id;
+      else if(group == HE5_HDFE_PROFGROUP)
+	fldgroupID = HE5_SWXSwath[idx].prof_id;
+      else if(group == HE5_HDFE_ATTRGROUP)
+	fldgroupID = HE5_SWXSwath[idx].sw_id;
+      else if(group == HE5_HDFE_GRPATTRGROUP)
+	fldgroupID = HE5_SWXSwath[idx].data_id;
+      else if(group == HE5_HDFE_GEOGRPATTRGROUP)
+	fldgroupID = HE5_SWXSwath[idx].geo_id;
+      else if(group == HE5_HDFE_PROFGRPATTRGROUP)
+	fldgroupID = HE5_SWXSwath[idx].prof_id;
+      else if(group == HE5_HDFE_LOCATTRGROUP)
+	{
+	  /* Get the field group flag */
+	  /* ------------------------ */
+	  fldgroup = HE5_SWfldsrch(swathID,(char *)fieldname,NULL,NULL,NULL,NULL);
+	  if(fldgroup == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot get the group flag for \"%s\" field.\n",fieldname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+		  
+	  if (fldgroup == HE5_HDFE_DATAGROUP)
+	    fldgroupID = HE5_SWXSwath[idx].data_id;
+
+	  if (fldgroup == HE5_HDFE_GEOGROUP)
+	    fldgroupID = HE5_SWXSwath[idx].geo_id;
+
+	  if (fldgroup == HE5_HDFE_PROFGROUP)
+	    fldgroupID = HE5_SWXSwath[idx].prof_id;		  
+	}
+      else
+	{
+	  sprintf(errbuf, "Invalid group flag (\"%d\"). \n", group);
+	  H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+		
+      /* Get data type information for the field */
+      /* --------------------------------------- */
+      if( group == HE5_HDFE_GEOGROUP || group == HE5_HDFE_DATAGROUP || group == HE5_HDFE_PROFGROUP)
+	{
+	  datasetid = H5Dopen(fldgroupID, fieldname);
+	  if (datasetid == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the dataset for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+			
+	  *datatype = H5Dget_type(datasetid);
+	  if (*datatype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the datatype for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	   
+	      return(FAIL);
+	    }
+
+	  *classid  = H5Tget_class(*datatype);
+	  if (*classid == H5T_NO_CLASS)
+	    {
+	      sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	   
+	      return(FAIL);
+	    }
+
+	  *order    = H5Tget_order(*datatype);
+	  if (*order == H5T_ORDER_ERROR)
+	    {
+	      sprintf(errbuf, "Cannot get the data type order for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+			
+	  if (*classid == H5T_STRING)
+	    {
+	      *size = H5Tget_size(*datatype);
+	    }
+	  else
+	    {
+	      *size     = H5Tget_size(*datatype);
+	      if (*size == 0)
+		{
+		  sprintf(errbuf, "Cannot get the data type size for the \"%s\" field.\n", fieldname);
+		  H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+		  return(FAIL);
+		}
+	    }
+			
+	  status = H5Dclose(datasetid);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+	}
+      /* Get data type information about global/group attribute */
+      /* ------------------------------------------------------ */
+      else if(group == HE5_HDFE_ATTRGROUP || group == HE5_HDFE_GRPATTRGROUP || 
+	      group == HE5_HDFE_PROFGRPATTRGROUP || group == HE5_HDFE_GEOGRPATTRGROUP)
+	{
+	  attr      = H5Aopen_name(fldgroupID, attrname);
+	  if (attr == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	   
+	      return(FAIL);
+	    }
+
+	  *datatype = H5Aget_type(attr);
+	  if (*datatype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the data type for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+			
+	  *classid  = H5Tget_class(*datatype);
+	  if (*classid == H5T_NO_CLASS)
+	    {
+	      sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	   
+	      return(FAIL);
+	    }
+
+	  *order    = H5Tget_order(*datatype);
+	  if (*order == H5T_ORDER_ERROR)
+	    {
+	      sprintf(errbuf, "Cannot get the data type order for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+
+	  if (*classid == H5T_STRING)
+	    {
+	      *size = H5Tget_size(*datatype);
+	    }
+	  else
+	    {
+	      *size     = H5Tget_size(*datatype);
+	      if (*size == 0)
+		{
+		  sprintf(errbuf, "Cannot get the data type size for the \"%s\" attribute.\n", attrname);
+		  H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+		  return(FAIL);
+		}
+	    }
+			
+	  status = H5Aclose(attr);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+			
+	}
+      /* Get data type information for local attribute */
+      /* --------------------------------------------- */
+      else if(group == HE5_HDFE_LOCATTRGROUP)
+	{
+
+	  fieldID = H5Dopen(fldgroupID, fieldname);
+	  if(fieldID == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  attr = H5Aopen_name(fieldID, attrname);
+	  if (attr == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	   
+	      return(FAIL);
+	    }
+
+	  *datatype = H5Aget_type(attr);
+	  if (*datatype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the data type for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+			
+	  *classid  = H5Tget_class(*datatype);
+	  if (*classid == H5T_NO_CLASS)
+	    {
+	      sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	   
+	      return(FAIL);
+	    }
+
+	  *order    = H5Tget_order(*datatype);
+	  if (*order == H5T_ORDER_ERROR)
+	    {
+	      sprintf(errbuf, "Cannot get the data type order for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+
+	  if (*classid == H5T_STRING)
+	    {
+	      *size = H5Tget_size(*datatype);
+	    }
+	  else
+	    {
+	      *size     = H5Tget_size(*datatype);
+	      if (*size == 0)
+		{
+		  sprintf(errbuf, "Cannot get the data type size for the \"%s\" attribute.\n", attrname);
+		  H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+		  return(FAIL);
+		}
+	    }
+			
+	  status = H5Aclose(attr);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+
+	  status = H5Dclose(fieldID);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }		   
+	}
+    }
+
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWnentries                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns number of entries and string buffer size              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nEntries       long                Number of entries                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  entrycode      int                 Entry code:                             |
+|                                                                             |
+|                                     HDFE_NENTDIM  (0)                       |
+|                                     HDFE_NENTMAP  (1)                       |
+|                                     HDFE_NENTIMAP (2)                       |
+|                                     HDFE_NENTGFLD (3)                       |
+|                                     HDFE_NENTDFLD (4)                       |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                Length of comma-separated list          |
+|                                     (Does not include null-terminator       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|                                                                             |
+| 7/29/99   A.Muslimov    In the call to EHmetagroup() replace gid by fid.    |
+| 9/01/99   A.Muslimov    Initialized metabuf pointer. Added error handling   |
+|                         right after the calls to EHmetagroup() and          |
+|                         EHmetavalue(). Initialized nEntries to -1, and set  |
+|                         nEntries to 0 in 'if( status == 0 ){}' block.       |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWnentries(hid_t swathID, int entrycode, long *strbufsize)
+{
+  herr_t          status     = FAIL;/* routine return status variable  */  
+  
+  hid_t           fid        = FAIL;/* HDF-EOS file ID                 */
+  hid_t           gid        = FAIL;/* "HDFEOS" group ID               */
+  
+  long            idx        = FAIL;/* Swath index                     */
+  long            nEntries   = 0;   /* Number of entries               */
+  long            metaflag   = FAIL;/* Old (0), New (1) metadata flag) */
+  long            nVal       = 0;   /* Number of strings to search for */
+  long            i;                /* Loop index                      */
+  
+  char            *metabuf = (char *)NULL;    /* Ptr to SM             */
+  char            *metaptrs[2]={NULL,NULL};   /* Start/end of SM       */
+  char            utlstr[HE5_HDFE_UTLBUFSIZE];/* Utility string        */
+  char            valName[2][32];             /* Strings to search for */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+  
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWnentries", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Zero out string buffer size */
+      /* --------------------------- */
+      *strbufsize = 0;
+       
+      /*
+       * Get pointer to relevant section within SM and Get names of
+       * metadata strings to inquire about
+       */
+      switch (entrycode)
+        {
+        case HE5_HDFE_NENTDIM:
+	  /* Dimensions */
+	  /* ---------- */
+	  {
+	    metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "Dimension", metaptrs);
+	    nVal = 1;
+	    strcpy(&valName[0][0], "DimensionName");
+	  }
+	  break;
+		  
+        case HE5_HDFE_NENTMAP:
+	  /* Dimension Maps */
+	  /* -------------- */
+	  {
+	    metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "DimensionMap", metaptrs);
+	    nVal = 2;
+	    strcpy(&valName[0][0], "GeoDimension");
+	    strcpy(&valName[1][0], "DataDimension");
+	  }
+	  break;
+
+        case HE5_HDFE_NENTIMAP:
+	  /* Indexed Dimension Maps */
+	  /* ---------------------- */
+	  {
+	    metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s","IndexDimensionMap", metaptrs);
+	    nVal = 2;
+	    strcpy(&valName[0][0], "GeoDimension");
+	    strcpy(&valName[1][0], "DataDimension");
+	  }
+	  break;
+		  
+        case HE5_HDFE_NENTGFLD:
+	  /* Geolocation Fields */
+	  /* ------------------ */
+	  {
+	    metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "GeoField", metaptrs);
+	    nVal = 1;
+	    strcpy(&valName[0][0], "GeoFieldName");
+	  }
+	  break;
+
+        case HE5_HDFE_NENTDFLD:
+	  /* Data Fields */
+	  /* ----------- */
+	  {
+	    metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "DataField", metaptrs);
+	    nVal = 1;
+	    strcpy(&valName[0][0], "DataFieldName");
+	  }
+	  break;
+
+	default:
+	  {
+	    sprintf(errbuf,"Invalid (unsupported) entry code \"%d\". \n", entrycode);       
+	    H5Epush(__FILE__, "HE5_SWnentries", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  }
+	  break;
+        }
+
+	  
+      if ( metabuf == NULL )
+	{
+	  nEntries = FAIL;
+	  sprintf(errbuf,"Cannot get the number of entries. \n");
+	  H5Epush(__FILE__, "HE5_SWnentries", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(nEntries);
+	}
+	  
+
+
+      /*
+       * Check for presence of 'GROUP="' string If found then old metadata,
+       * search on OBJECT string
+       */
+      metaflag = (strstr(metabuf, "GROUP=\"") == NULL) ? 1 : 0;
+      if (metaflag == 0)
+        {
+	  nVal = 1;
+	  strcpy(&valName[0][0], "\t\tOBJECT");
+        }
+
+      /* Begin loop through entries in metadata */
+      /* -------------------------------------- */
+      while (1)
+        {
+	  /* Search for first string */
+	  /* ----------------------- */
+	  strcpy(utlstr, &valName[0][0]);
+	  strcat(utlstr, "=");
+	  metaptrs[0] = strstr(metaptrs[0], utlstr);
+
+	  /* If found within relevant metadata section ... */
+	  /* --------------------------------------------- */
+	  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+            {
+	      for (i = 0; i < nVal; i++)
+                {
+		  /*
+		   * Get all string values Don't count quotes
+		   */
+		  status = HE5_EHgetmetavalue(metaptrs, &valName[i][0], utlstr);
+		  if ( status == FAIL )
+		    {
+		      nEntries = FAIL;
+		      sprintf(errbuf,"Cannot get metavalue. \n");
+		      H5Epush(__FILE__, "HE5_SWnentries", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(metabuf);
+			    
+		      return(nEntries);
+		    }
+
+
+		  *strbufsize += strlen(utlstr) - 2;
+                }
+	      /* Increment number of entries */
+	      /* --------------------------- */
+	      nEntries++;
+
+	      /* Go to end of OBJECT */
+	      /* ------------------- */
+	      metaptrs[0] = strstr(metaptrs[0], "END_OBJECT");
+            }
+	  else
+	    /* No more entries found */
+	    /* --------------------- */
+            {
+	      break;
+            }
+        }
+      if (metabuf != NULL) free(metabuf);
+
+
+      /* Count comma separators & slashes (if mappings) */
+      /* ---------------------------------------------- */
+      if (nEntries > 0)
+        {
+	  *strbufsize += nEntries - 1;
+	  *strbufsize += (nVal - 1) * nEntries;
+        }
+    }
+  
+  return(nEntries);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqswath                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns number and names of swath structures in file          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nSwath         long                Number of swath structures in file      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  filename       char                HDF-EOS filename                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  swathlist      char                List of swath names (comma-separated)   |
+|  strbufsize     long                Length of swathlist                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqswath(const char *filename, char *swathlist, long *strbufsize)
+{
+  long       nSwath   = FAIL;            /* Number of swaths in file */
+
+  herr_t     status   = FAIL;            /* Return status variable   */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */  
+
+  CHECKPOINTER(filename);
+
+  /* Call "HE5_EHinquire" routine */
+  /* ---------------------------- */
+  nSwath = HE5_EHinquire(filename,  "/HDFEOS/SWATHS", swathlist, strbufsize);
+  if ( nSwath == FAIL )
+    {
+      sprintf(errbuf,"Cannot get information about Swath. \n");
+      H5Epush(__FILE__, "HE5_SWinqswath", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }								 
+
+ COMPLETION:
+  return(nSwath);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWextend                                                     |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fieldname      char                fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/23/99  A. Muslimov   Checked  for the status returned by H5Dextend().    |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWextend(hid_t swathID, char *fieldname, hsize_t  size[])
+{
+  herr_t   status   = FAIL;/* Routine return status */
+
+  hid_t    gid      = FAIL;/* Swath group  ID       */
+  hid_t    fid      = FAIL;/* HDF-EOS file ID       */
+  hid_t    fieldID  = FAIL;/* fieldname dataset ID  */
+
+  long     idx      = FAIL;/* Swath index           */
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWextend", &fid, &gid, &idx);
+
+  HE5_SWfieldsizeID( swathID, fieldname,  &fieldID);
+ 
+  status = H5Dextend(fieldID, size);
+
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwrrdfield                                                  |
+|                                                                             |
+|  DESCRIPTION: Writes/Reads fields                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fldname        char                field name                              |
+|  code           char                Write/Read code (w/r)                   |
+|  start          hssize_t            start array                             |
+|  stride         hsize_t             stride array                            |
+|  count          hsize_t             edge array                              |
+|  datbuf         void                data buffer for read                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                data buffer for write                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|                                                                             |
+|  8/23/99  A. Muslimov   Added error checkings after the function calls.     |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  7/12/00  A.Muslimov    Added conversion from disk/file data type ID to     |
+|                          memory data type ID before H5Dread() call.         |
+|  10/5/00  A.Muslimov    Added checking for the field name (in case of pas-  |
+|                          sing an alias as a "fldname").                     |
+|  Nov 00   A.Muslimov    Modified a block checking if the dataset is         |
+|                          appendable. Added "break" statement.               |
+|  Dec 00   A.Muslimov    Modified to fix a problem with appending data to the|
+|                          extendible datset.                                 |
+|  Apr 03   S.Zhao        Added conversion from data type ID to memory data   |
+|                         type ID before H5Dwrite() call.                     |
+|  Oct 03   S.Zhao        Added to write/read a character string dataset.     |
+|  Apr 04   S.Zhao        Modified for a character string dataset.            |
+|  Feb 05   S.Zhao        Replaced the "count" array by the "dims" array if   |
+|                         it was declared larger than the dimension size.     |
+|  Sep  11  Abe Taaheri   Modified for correcting Unlimited dimension         |
+|                         behavior and extension                              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t    
+HE5_SWwrrdfield(hid_t swathID, char *fldname, char *code, const hssize_t start[], 
+const hsize_t stride[], const hsize_t count[],  void *datbuf)
+{    
+  herr_t          status   = FAIL; /* routine return status variable     */    
+
+  int             i;		   /* Loop index                         */
+  int             startf   =  0;   /* flag (if start is NULL)            */
+  int             countf   =  0;   /* flag (if counf is NULL)            */
+  int             bothf    =  0;   /* flag (if start and count are NULL) */
+  int             append   = FALSE;/* FLAG (if field is appendible)      */
+  int             rank     = FAIL; /* Rank of dataset                    */
+  int             maxrank  =  0;   /* Rank dummy variable                */
+  int             nameflag = FAIL; /* Actual (1)/Alias (0) field name    */
+   
+  hid_t           fid      = FAIL;/* HDF-EOS file ID                     */
+  hid_t           fieldID  = FAIL;/* fieldname Dataset ID                */
+  hid_t           fspace   = FAIL;/* file data space ID                  */
+  hid_t           mid      = FAIL;/* memory data space ID                */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID                   */
+  hid_t           tid      = FAIL;/* datatype ID                         */
+  hid_t           mtype    = FAIL;/* Memory data type ID                 */
+
+  long            idx      = FAIL;/* Swath index                         */
+  
+  hsize_t         dims[HE5_DTSETRANKMAX];   /* Field dimensions          */
+  hsize_t         maxdims[HE5_DTSETRANKMAX];/* Field maximum dimensions  */
+  hssize_t        *tstart =(hssize_t *)NULL;/* Not NULL "start" value    */
+  hsize_t         *tcount = (hsize_t *)NULL;/* Not NULL "count" value    */
+  hsize_t         *lcount = (hsize_t *)NULL;
+  hsize_t         dimsize = 0;		    /* Field dimension size      */
+  hsize_t         size[HE5_DTSETRANKMAX];   /* Extended dimension size   */
+
+  hid_t           ntype[1]  = {FAIL};       /* numbertype                */
+
+  char            *dimbuf   = (char *)NULL;  
+  char            *comma    = (char *)NULL;
+  char            *dimcheck = (char *)NULL;
+  char            fieldname[HE5_HDFE_NAMBUFSIZE];    /* Field name buffer      */
+  char            fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual field name      */     
+  char            maxdimlist[HE5_HDFE_DIMBUFSIZE];   /* Maximum dimension list */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];       /* Error message buffer   */  
+  H5T_class_t     classid = H5T_NO_CLASS;            /* data type class ID     */
+
+  char            dimlist[HE5_HDFE_DIMBUFSIZE];
+  char            *dimbuf1   = (char *)NULL;
+  char            *dimbuf2   = (char *)NULL;
+  char            *comma1    = (char *)NULL;
+  char            *comma2    = (char *)NULL;
+  char            *newname   = (char *)NULL;
+  char            *newname1  = (char *)NULL;
+
+  int             ibuf;                /* Loop index                        */
+  char            **chardatbuf = NULL; /* string data buffer                */ 
+  int             maxlen = 0;          /* max length in array of string     */
+  int             strsize = 0;         /* each str length in array of str   */
+  hsize_t         numattr[1];          /* number of attribute elements      */
+  int             mycount = 0;         /* flag                              */
+  long            strbufsize1;         /* string buffer size                */
+  long            strbufsize2;         /* string buffer size                */
+  long            nattr = 0;           /* number of attributes              */
+  char            *attrlist1 = (char *)NULL;/* attribute list               */
+  char            *attrlist2 = (char *)NULL;/* attribute list               */
+  char            *attptr = (char *)NULL;   /* attribute pointer            */
+  hsize_t	  dimsize_dim, dimsize_maxdim;
+  int             extend_flag = 0;
+
+
+  CHECKNAME(fldname);
+  
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWwrrdfield", &fid, &gid, &idx);  
+  if (status == FAIL) return(status);
+
+  /* Get field info  */
+  /* --------------- */
+  status = HE5_SWfieldinfo(swathID, fldname, &rank, dims, ntype, NULL, NULL);
+  if( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot get information about \"%s\" field. \n", fldname);
+      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  for (i=0; i<rank; i++)
+    {
+      if(start != NULL && start[i] > 0) /* we may want to extend a dataset */
+	{
+	  extend_flag = 1;
+	  break;
+	}
+    }
+
+    /* since in hdf5 all dimension can be appendable, the following 
+    was modified so that any dimension is extedned. In HDF4 only the first
+    dimension is appenable, so start[0] > 0 is valid only for HDF4 based 
+    hdfeos
+  if (start != NULL && start[0] > 0 && (strcmp(code,"w") == 0))
+    */
+
+    if (start != NULL && extend_flag == 1 && (strcmp(code,"w") == 0))
+    {
+      /* Check whether fieldname is in dataset (multi-dim field) */
+      /* ------------------------------------------------------- */
+      status = HE5_SWfieldinfo(swathID, fldname, &rank, dims, ntype, dimlist, maxdimlist);
+      if( status == FAIL )
+	{
+          sprintf(errbuf,"Cannot get information about \"%s\" field. \n", fldname);
+          H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(status);
+	}
+
+      dimbuf1 = (char *) calloc((strlen(dimlist) + 2), sizeof(char));
+      if(dimbuf1 == NULL)
+	{
+          sprintf(errbuf,"Cannot allocate memory.\n");
+          H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(FAIL);
+	}
+
+      memcpy(dimbuf1,dimlist, strlen(dimlist));
+
+      dimbuf2 = (char *) calloc((strlen(maxdimlist) + 2), sizeof(char));
+      if(dimbuf2 == NULL)
+	{
+          sprintf(errbuf,"Cannot allocate memory.\n");
+          H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(dimbuf1);
+          return(FAIL);
+	}
+
+      memcpy(dimbuf2,maxdimlist, strlen(maxdimlist));
+ 
+      for (i = 1; i < rank + 1; i++)
+	{
+	  strcat(dimbuf1,",");
+	  comma1 = strchr(dimbuf1,',');
+	  newname = (char *) calloc(comma1 - dimbuf1 + 1, sizeof(char));
+	  if(newname == NULL)
+	    {
+              sprintf(errbuf,"Cannot allocate memory.\n");
+              H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+              HE5_EHprint(errbuf, __FILE__, __LINE__);
+              free(dimbuf1);
+              free(dimbuf2);
+              return(FAIL);
+	    }
+
+	  memmove(newname,dimbuf1,comma1 - dimbuf1);
+	  memmove(dimbuf1, comma1 + 1, strlen(comma1 + 1) + 1); 
+ 
+	  strcat(dimbuf2,",");
+	  comma2 = strchr(dimbuf2,',');
+	  newname1 = (char *) calloc(comma2 - dimbuf2 + 1, sizeof(char));
+	  if(newname1 == NULL)
+	    {
+              sprintf(errbuf,"Cannot allocate memory.\n");
+              H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+              HE5_EHprint(errbuf, __FILE__, __LINE__);
+              free(dimbuf1);
+              free(dimbuf2);
+              free(newname);
+              return(FAIL);
+	    }
+
+	  memmove(newname1,dimbuf2,comma2 - dimbuf2);
+	  memmove(dimbuf2, comma2 + 1, strlen(comma2 + 1) + 1); 
+ 
+	  /* get dimsize for newname1, and dimsize for 
+	     the dimension whose maxdim is newname1 */
+
+	  dimsize_dim = HE5_SWdiminfo(swathID, newname);
+	  dimsize_maxdim = HE5_SWdiminfo(swathID, newname1);
+
+	  /* Find out if the dataset dimension is appendable */
+	  /* ----------------------------------------------- */
+	  if ( (dimsize_dim < dimsize_maxdim) || (dimsize_maxdim == H5S_UNLIMITED))
+	    {
+	      /* update dim if new dim is still <= maxdim */
+	      if((start[i]+1) > dimsize_maxdim && (dimsize_maxdim != H5S_UNLIMITED))
+		{
+		      sprintf(errbuf, "Cannot update the dimension, new dimension size is larger than the max dimension size in the datafiled.\n");
+		      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(dimbuf1);
+		      free(dimbuf2);
+		      free(newname);
+		      free(newname1);
+		      return(FAIL);
+		}
+	      else
+		{
+		  status = HE5_SWupdatedim(swathID, newname, start[i]+1);
+	      if( status == FAIL )
+		{
+		  sprintf(errbuf, "Cannot update the dimension.\n");
+		  H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(dimbuf1);
+		  free(dimbuf2);
+		  free(newname);
+		  free(newname1);
+		  return(FAIL);
+		} 
+	    }
+	    }
+	  free(newname);
+	  free(newname1);
+
+	  newname = NULL;
+	  newname1 = NULL;
+	}
+
+      free(dimbuf1);
+      free(dimbuf2);
+
+      dimbuf1 = NULL;
+      dimbuf2 = NULL;
+ 
+    }
+
+
+
+  /* Call HE5_SWfldnameinfo() to get actual field name */
+  /* --------------------------------------------- */
+  nameflag = HE5_SWfldnameinfo(swathID, fldname, fldactualname);
+  if ( nameflag == FAIL )
+    {
+      sprintf(errbuf, "Cannot get actual name of the field.\n");
+      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Name is not alias */
+  /* ----------------- */
+  if (nameflag == TRUE)
+    {
+      strcpy(fieldname,"");
+      strcpy(fieldname,fldname);
+    }
+
+  /* Name is an alias */
+  /* ---------------- */
+  if (nameflag == FALSE)
+    {
+      strcpy(fieldname,"");
+      strcpy(fieldname,fldactualname);
+    }
+
+
+  /* Initialize dims[]/maxdims[]/size[] arrays */
+  /* ----------------------------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      dims[i]    = 0;
+      maxdims[i] = 0;
+      size[i]    = 0;
+    }
+  
+  /* Check whether fieldname is in dataset (multi-dim field) */
+  /* ------------------------------------------------------- */
+  status = HE5_SWfieldinfo(swathID, fieldname, &rank, dims, ntype, NULL, maxdimlist);
+  if( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot get information about \"%s\" field. \n", fieldname);
+      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  /* Find out if the field is appendable */
+  /* ----------------------------------- */
+  dimbuf = (char *) calloc(strlen(maxdimlist) + 64, sizeof(char));
+  if(dimbuf == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  strcpy(dimbuf,maxdimlist);
+  strcat(dimbuf,",");
+  comma = strchr(dimbuf,',');
+  
+  while(comma != NULL)
+    {
+      dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char));
+      if(dimcheck == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory.\n");
+	  H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(dimbuf);
+	  return(FAIL);
+	}
+      memmove(dimcheck,dimbuf,comma-dimbuf);
+
+      /* Get dimension size */
+      /* ------------------ */
+      dimsize = HE5_SWdiminfo(swathID, dimcheck);
+
+      if((dimsize == H5S_UNLIMITED) || (dims[maxrank] <= dimsize))
+	{
+	  maxdims[maxrank] = dimsize;
+	  maxrank++;
+	}
+      memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); 
+      comma = strchr(dimbuf,',');
+      free(dimcheck);
+    }
+
+  free(dimbuf);
+  
+  for(i = 0; i < rank; i++)
+    {
+      if(   dims[i] == maxdims[i] )
+	append = FALSE;
+      else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED))
+	{
+	  append = TRUE;
+	  break;
+	}
+      else
+	{
+	  sprintf(errbuf,"Maximum dimension size is smaller than dimension size.\n");
+	  H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }        
+  
+  /* ============================================================== */
+  /* start and count are being passed as NULL from SWdefvrtregion   */
+  /* which calls SWreadfield, which have NULL for start and count.  */
+  /* H5Sselect_hyperslab won't take NULL values for start and count */
+  /* ============================================================== */
+  if(start == NULL)
+    {
+      tstart = (hssize_t *)calloc(rank, sizeof(hssize_t));
+      for(i = 0; i < rank; i++)
+	tstart[ i ] = 0;
+      startf = 1;
+    }
+  if(count == NULL)
+    {
+      tcount = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      for(i = 0; i < rank; i++)
+	tcount[ i ] = dims[ i ];
+      if(startf == 1)
+	bothf = 1;
+      else
+	countf = 1;
+    }
+  else
+    {
+      lcount =  (hsize_t *)calloc(rank, sizeof(hsize_t));
+      for(i = 0; i < rank; i++)
+	{
+	  if(count[ i ] > dims[ i ])
+	    lcount[ i ] = dims[ i ];
+	  else
+	    lcount[ i ] = count[ i ];
+	} 
+    }
+  
+  if (append == TRUE)
+    {
+      /* Get the field-related dataset ID */
+      /* -------------------------------- */
+      HE5_SWfieldsizeID(swathID, fieldname, &fieldID);
+	  
+      if(bothf == 1)
+	status = H5Dextend(fieldID, tcount);
+      else if(startf == 1)
+	status = H5Dextend(fieldID, lcount);
+      else if(countf == 1)
+	status = H5Dextend(fieldID, tcount);
+      else
+	{
+	  for(i = 0; i < rank; i++)
+	    size[ i ] = start[ i ] + lcount[ i ];
+		 
+	  /* Extend the dataset size */
+	  /* ----------------------- */
+	  status = H5Dextend(fieldID, size);
+	}
+
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot extend the dataset. \n");
+	  H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (start == NULL)
+	    {
+	      if (tstart != NULL)
+		free(tstart);
+	    }
+	  if (count == NULL)
+	    {
+	      if (tcount != NULL)
+		free(tcount);
+	    }
+	  if (lcount != NULL)
+	    free(lcount);
+
+	  return(FAIL);
+	}
+    }
+  
+  if (append == FALSE)
+    {   
+      /* Get the field-related dataset ID */
+      /* -------------------------------- */
+      HE5_SWfieldsizeID(swathID, fieldname, &fieldID);
+    }
+  
+  /* Get the file space ID */
+  /* --------------------- */
+  fspace = H5Dget_space(fieldID );
+  if( fspace == FAIL)
+    {
+      sprintf(errbuf,"Cannot get data space ID. \n");
+      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL) 
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL) 
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+	  
+      return(FAIL);
+    }
+  
+  /* Select the hyperslab */
+  /* -------------------- */
+  if(bothf == 1)
+    status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)tstart,stride,tcount,NULL);
+  else if(startf == 1)
+    status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)tstart,stride,lcount,NULL);
+  else if(countf == 1)
+    status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)start,stride,tcount,NULL);
+  else
+    status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)start,stride,lcount,NULL) ;
+  
+  if( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot select a hyperslab. \n");
+      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL) 
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL) 
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+		
+      return(FAIL);
+    }
+  
+  
+  /* Define memory space */
+  /* =================== */
+  if(countf == 1 || bothf == 1)
+    mid = H5Screate_simple(rank, tcount, NULL);
+  else
+    mid = H5Screate_simple(rank, lcount, NULL);
+  
+  if( mid == FAIL)
+    {
+      sprintf(errbuf,"Cannot create the data space.\n");
+      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASPACE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL) 
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL) 
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+		
+      return(FAIL);
+    }
+  
+  
+  /* Get the data type ID */
+  /* -------------------- */
+  tid = H5Dget_type(fieldID );
+  if( tid == FAIL )
+    {
+      sprintf(errbuf,"Cannot get the data type ID.\n");
+      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL) 
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL) 
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+		
+      return(FAIL);
+    }
+  
+  /* Get the data type class ID */
+  /* -------------------------- */
+  classid = H5Tget_class(tid);
+  if (classid == H5T_NO_CLASS)
+    {
+      sprintf(errbuf,"Cannot get the data type class ID.\n");
+      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL)
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL)
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+ 
+      return(FAIL);
+    }
+
+  /* Write/read whole data to/from the dataset */
+  /* ========================================= */
+  if( strcmp(code,"w") == 0)
+    {
+      strbufsize1 = 0;
+      nattr = HE5_SWinqlocattrs(swathID, fieldname, NULL, &strbufsize1);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot retrieve the attributes. \n");
+	  H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (start == NULL)
+	    {
+	      if (tstart != NULL)
+		free(tstart);
+	    }
+	  if (count == NULL)
+	    {
+	      if (tcount != NULL)
+		free(tcount);
+	    }
+	  if (lcount != NULL)
+	    free(lcount);
+ 
+	  return(FAIL);
+ 
+	}
+ 
+      attrlist1 = (char *) calloc(strbufsize1 + 2, sizeof(char));
+      if (attrlist1 == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for attrlist1.\n") ;
+	  H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (start == NULL)
+	    {
+	      if (tstart != NULL)
+		free(tstart);
+	    }
+	  if (count == NULL)
+	    {
+	      if (tcount != NULL)
+		free(tcount);
+	    }
+	  if (lcount != NULL)
+	    free(lcount);
+ 
+	  return(FAIL);
+ 
+	}
+
+      nattr = HE5_SWinqlocattrs(swathID, fieldname, attrlist1, &strbufsize1);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot retrieve the attributes. \n");
+	  H5Epush(__FILE__,"HE5_SWwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND,  errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (attrlist1 != NULL)
+	    {
+	      free(attrlist1);
+	      attrlist1 = NULL;
+	    }
+	  if (start == NULL)
+	    {
+	      if (tstart != NULL)
+		free(tstart);
+	    }
+	  if (count == NULL)
+	    {
+	      if (tcount != NULL)
+		free(tcount);
+	    }
+	  if (lcount != NULL)
+	    free(lcount);
+ 
+	  return(FAIL);
+ 
+	}
+
+      attptr = strstr(attrlist1,"ARRAYOFSTRINGS");
+      if ( (classid == H5T_STRING) && (attptr == NULL) )
+	{
+	  status = H5Dwrite(fieldID, tid, mid, fspace,  H5P_DEFAULT, datbuf);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot write data to the dataset.\n");
+	      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(status);
+	    }
+	}
+
+      else if ( (classid == H5T_STRING) && (attptr != NULL) )
+	{
+	  strbufsize2 = 0;
+	  nattr = HE5_SWinqlocattrs(swathID, fieldname, NULL, &strbufsize2);
+	  if ( nattr < 0 )
+	    {
+	      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+	      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(FAIL);
+
+	    }
+
+	  attrlist2 = (char *) calloc(strbufsize2 + 2, sizeof(char));
+	  if (attrlist2 == NULL)
+	    {
+	      sprintf(errbuf, "Cannot allocate memory for attrlist2.\n") ;
+	      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(FAIL);
+ 
+	    }
+
+	  nattr = HE5_SWinqlocattrs(swathID, fieldname, attrlist2, &strbufsize2);
+	  if ( nattr < 0 )
+	    {
+	      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+	      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (attrlist2 != NULL)
+		{
+		  free(attrlist2);
+		  attrlist2 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(FAIL);
+ 
+	    }
+
+	  if ( (nattr == 0) || ((attptr = strstr(attrlist2,"StringLengthAttribute")) == NULL) )
+	    {
+	      chardatbuf = (char **)datbuf;
+	      if (count == NULL) mycount = tcount[0];
+	      if (count != NULL) mycount = *lcount;
+	      for (ibuf = 0; ibuf < mycount; ibuf++)
+		{
+		  if (chardatbuf[ibuf] == NULL)
+		    strsize = 0;
+		  else
+		    strsize = strlen(chardatbuf[ibuf]);
+		  if (strsize > maxlen)
+		    maxlen = strsize;
+
+		}
+
+	      numattr[0] = 1;
+	      status = HE5_SWwritelocattr(swathID, fieldname, "StringLengthAttribute", H5T_NATIVE_INT, numattr, &maxlen);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot write attribute to the field \"%s\".",fieldname) ;
+		  H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (attrlist1 != NULL)
+		    {
+		      free(attrlist1);
+		      attrlist1 = NULL;
+		    }
+		  if (attrlist2 != NULL)
+		    {
+		      free(attrlist2);
+		      attrlist2 = NULL;
+		    }
+		  if (start == NULL)
+		    {
+		      if (tstart != NULL)
+			free(tstart);
+		    }
+		  if (count == NULL)
+		    {
+		      if (tcount != NULL)
+			free(tcount);
+		    }
+		  if (lcount != NULL)
+		    free(lcount);
+ 
+		  return(status);
+		}
+
+	    }
+
+	  status = H5Dwrite(fieldID, tid, mid, fspace,  H5P_DEFAULT, datbuf);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot write data to the dataset.\n");
+	      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (attrlist2 != NULL)
+		{
+		  free(attrlist2);
+		  attrlist2 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(status);
+	    }
+	}
+      else
+	{
+	  /* Get memory data type ID */
+	  /* ----------------------- */
+	  mtype  = HE5_EHdtype2mtype(tid);
+	  if( mtype == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot convert to memory data type.\n");
+	      status = FAIL;
+	      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(status);
+	    }
+
+	  status = H5Dwrite(fieldID, mtype, mid, fspace, H5P_DEFAULT, datbuf);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot write data to the dataset.\n");
+	      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL) 
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL) 
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+			
+	      return(status);
+	    }
+	}
+
+      if (attrlist1 != NULL)
+	{
+	  free(attrlist1);
+	  attrlist1 = NULL;
+	}
+      if (attrlist2 != NULL)
+	{
+	  free(attrlist2);
+	  attrlist2 = NULL;
+	}
+		
+    }
+  else
+    {
+      if (classid == H5T_STRING)
+	{
+	  /* Read the data buffer */
+	  /* -------------------- */
+	  status = H5Dread(fieldID, tid, mid, fspace , H5P_DEFAULT, datbuf);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot read data from the dataset.\n");
+	      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(status);
+	    }
+ 
+	}
+      else
+	{
+
+	  /* Get memory data type ID */
+	  /* ----------------------- */
+          mtype  = HE5_EHdtype2mtype(tid);
+	  if( mtype == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot convert to memory data type.\n");
+	      status = FAIL;
+	      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+		  
+	      return(status);
+	    }
+
+	  /* Read the data buffer */
+	  /* -------------------- */
+	  status = H5Dread(fieldID, mtype, mid, fspace , H5P_DEFAULT, datbuf);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot read data from the dataset.\n");
+	      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (start == NULL)
+		{
+		  if (tstart != NULL) 
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL) 
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+			
+	      return(status);
+	    }
+	}
+
+    }
+  
+  if ( count  == NULL)
+    {	
+      if(tcount != NULL) free(tcount);
+    }
+  if( start == NULL)
+    {	
+      if(tstart != NULL) free(tstart);
+    }
+  if (lcount != NULL)
+    free(lcount);
+  
+  /* Release data space ID */
+  /* --------------------- */  
+  status = H5Sclose(mid); 
+  if( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot release memory data space ID.\n");
+      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		
+      return(status);
+    }
+
+  /* Release data space ID */
+  /* --------------------- */   
+  status = H5Sclose(fspace);
+  if( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot release the file data space ID.\n");
+      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		
+      return(status);
+    }
+
+  /* Release data type ID */
+  /* -------------------- */    
+  status = H5Tclose(tid);
+  if( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot release the data type ID.\n");
+      H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  
+      return(status);
+    }
+  
+ COMPLETION:
+  return(status);
+
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwritefield                                                 |
+|                                                                             |
+|  DESCRIPTION: Writes data to field                                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fieldname      char                fieldname                               |
+|  start          hssize_t            start array                             |
+|  stride         hsize_t             stride array                            |
+|  edge           hsize_t             edge array                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  Sep  11  Abe Taaheri   Modified for correcting Unlimited dimension         |
+|                         behavior and extension                              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWwritefield(hid_t swathID, char *fieldname, const hssize_t start[], const hsize_t stride[], const hsize_t edge[],  void *data)
+{
+  herr_t          status  = FAIL;           /* return status variable    */
+  hsize_t         dims[HE5_DTSETRANKMAX];   /* Field dimensions          */
+  int   	  rank     = 0;             /* Field rank                */
+  int             unlimdim;
+  hsize_t         maxdims[HE5_DTSETRANKMAX];/* Field maximum dimensions  */
+  int             append   = FALSE;         /* FLAG (if field is appendible)*/
+  int             i;                        /* Loop index                   */
+  char            *errbuf = (char *)NULL;   /* error message buffer        */
+
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKPOINTER(data);
+
+  /* If a field is appendable and need to be extended, do extension here 
+     before writing extended data into it 
+  */
+
+  /* get maxdims for the field */
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWwritefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  status = HE5_SWflddiminfo(swathID, fieldname, &rank, dims, maxdims);
+  
+  /* see if we need first to extend data dimensions for unlimited 
+     dimensions */
+  
+  for (i = 0; i < rank; i++)
+    {
+      if( dims[i] == maxdims[i] )
+	append = FALSE;
+      else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED))
+	{
+	  append = TRUE;
+	  break;
+	}
+    }
+  unlimdim = i;
+
+  if((append == TRUE) && (edge[unlimdim] > dims[unlimdim]))
+    {
+      hssize_t newstart[8];
+      hsize_t newedge[8];
+      
+      for (i = 0; i < rank; i++)
+	{
+	  if (start != NULL)
+	    {
+	      newstart[i]=start[i];
+	    }
+	  else
+	    {
+	      newstart[i]= 0;
+	    }
+
+	  if (edge!= NULL)
+	    {
+	      newedge[i] = edge[i];
+	    }
+	  else
+	    {
+	      newedge[i]=dims[i];
+	    }
+	}
+      newstart[unlimdim]=edge[unlimdim]-1;
+      newedge[unlimdim] = 1;
+      status = HE5_SWwrrdfield(swathID, fieldname, "w", newstart, stride, newedge,data);
+
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_SWwritefield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+      else
+	{
+	  
+	  for (i = 0; i < rank; i++)
+	    {
+	      dims[i]=edge[i];
+	    }
+	 
+	}
+    }
+
+  status = HE5_SWwrrdfield(swathID, fieldname, "w", start, stride, edge, data);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ;
+      H5Epush(__FILE__, "HE5_SWwritefield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  else
+    {
+      status = SUCCEED;
+      free(errbuf);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWreadfield                                                  |
+|                                                                             |
+|  DESCRIPTION: Reads data from field                                         |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fieldname      char                fieldname                               |
+|  start          hssize_t            start array                             |
+|  stride         hsize_t             stride array                            |
+|  edge           hsize_t             edge array                              |
+|  buffer         void                data buffer for read                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWreadfield(hid_t  swathID, char *fieldname,const hssize_t start[], const hsize_t stride[], const hsize_t edge[],  void *data)
+{
+  
+  herr_t   status  = FAIL;/* routine return status variable    */
+  
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  status = HE5_SWwrrdfield(swathID, fieldname, "r", start, stride, edge, data);
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWfldsrch                                                    |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about field DATASET                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  fldgroup        int                 Flag representing one of the groups:   |
+|                                     (0) "Data Fields", (1)"Geolocation      |
+|                                     Fields", and (5) "HE5_PRofile Fields".  |
+|                                     (-1) FAILS.                             |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fldname        char                field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fieldID        hid_t                Field dataset ID                       |
+|  rank           int                  dataset Rank                           |
+|  dims           hsize_t              Dimensions of field                    |
+|  typeID         hid_t                Data type ID                           |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/23/99  A.Muslimov    Checked for the status returned by H5Sclose().      |
+|  4/18/00  A.Muslimov    Added more error handlings.                         |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  00  A.Muslimov    Modified to incorporate "PRofile Fields" group.     |
+|                         Changed the coding scheme.                          |
+|  Oct  00  A.Muslimov    Added the case where fieldname is an alias.         |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_SWfldsrch(hid_t swathID, char *fldname, hid_t *fieldID, int *rank,  hsize_t dims[], hid_t *typeID)
+{
+  int      fldgroup  = FAIL;       /* Field group flag  (return value)   */
+  int      i;                      /* Loop index                         */
+  int      nameflag  = FAIL;       /* Alias (0) /actual (1) name flag    */
+
+  herr_t   status    = FAIL;       /* routine return status variable     */
+  
+  hid_t    idx       = FAIL;       /* Swath index                        */
+  hid_t    idOffset  = HE5_SWIDOFFSET;/* Swath ID offset                 */
+  hid_t    spaceID   = FAIL;       /* File data space ID                 */
+
+  char     fieldname[HE5_HDFE_NAMBUFSIZE];    /* Buffer for name of a field  */ 
+  char     fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual name of a field      */ 
+  char     fldtype   ='n';             /* Internal group discriminating flag */
+  char     name[HE5_HDFE_NAMBUFSIZE];  /* Field Name buffer                  */
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Buffer for error message           */
+
+
+  CHECKPOINTER(fldname);
+
+  /* Compute "reduced" swath ID */
+  /* -------------------------- */
+  idx = swathID % idOffset;
+
+  
+  /* Call HE5_SWfldnameinfo() to get actual field name */
+  /* --------------------------------------------- */
+  nameflag = HE5_SWfldnameinfo(swathID, fldname, fldactualname);
+  if (nameflag == FAIL)
+    {
+      sprintf(errbuf, "Cannot get actual name of the field.\n");
+      H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  if (nameflag == FALSE)
+    {
+      strcpy(fieldname,"");
+      strcpy(fieldname,fldactualname);
+    }
+
+  if (nameflag == TRUE)
+    {
+      strcpy(fieldname,"");
+      strcpy(fieldname,fldname);
+    }
+  
+
+  /* Loop through all geo datasets in swath */
+  /* -------------------------------------- */
+  for (i = 0; i < HE5_SWXSwath[idx].nGFLD; i++)
+    {
+      /* get dataset name */
+      /* ---------------- */
+      strcpy(name, HE5_SWXSwath[idx].gdataset[i].name);
+      if( strcmp(fieldname, name) == 0 ) 
+	{
+	  fldtype ='g';
+	  fldgroup = HE5_HDFE_GEOGROUP;
+	  break;
+	}
+
+    } 
+
+  /* not found in geo fields */
+  /* ----------------------- */
+  if( fldtype == 'n')
+    {
+      /* Loop through all data datasets in swath */
+      /* --------------------------------------- */
+      for (i = 0; i < HE5_SWXSwath[idx].nDFLD; i++)
+	{
+	  /* get dataset name */
+	  /* ---------------- */
+	  strcpy(name, HE5_SWXSwath[idx].ddataset[i].name);
+	  if( strcmp(fieldname, name) == 0 )
+	    {
+	      fldtype ='d';
+	      fldgroup   = HE5_HDFE_DATAGROUP;
+	      break;
+	    }
+        }
+    }
+  
+
+  /* not found in data fields */
+  /* ------------------------ */
+  if( fldtype == 'n')
+    {
+      /* Loop through all profile datasets in swath */
+      /* ------------------------------------------ */
+      for (i = 0; i < HE5_SWXSwath[idx].nPROF; i++)
+	{
+	  /* get dataset name */
+	  /* ---------------- */
+	  strcpy(name, HE5_SWXSwath[idx].pdataset[i].name);
+	  if( strcmp(fieldname, name) == 0 )
+	    {
+	      fldtype ='p';
+	      fldgroup   = HE5_HDFE_PROFGROUP;
+	      break;
+	    }
+        }
+    }
+
+
+  if (fieldID != NULL)
+    {
+
+      /* Get dataset ID */
+      /* ============== */
+      if( fldtype =='g')
+	*fieldID    = HE5_SWXSwath[idx].gdataset[i].ID;
+      else if (fldtype =='d')
+	*fieldID    = HE5_SWXSwath[idx].ddataset[i].ID;
+      else if (fldtype =='p')
+	*fieldID    = HE5_SWXSwath[idx].pdataset[i].ID;
+      else
+	{
+	  sprintf(errbuf,"Cannot find \"%s\" field in Swath. Check the spelling.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Get data space ID */
+      /* ----------------- */
+      spaceID  = H5Dget_space(*fieldID);
+      if (spaceID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      if (rank != NULL)
+	{
+	  /* Get dataset rank */
+	  /* ---------------- */
+	  *rank  = H5Sget_simple_extent_ndims(spaceID);
+	  if (*rank == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot get the dataset rank.\n");
+	      H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	}
+	  
+      if (typeID != NULL || dims != NULL)
+	{
+		  
+	  /* Get data type ID */
+	  /* ---------------- */
+	  *typeID = H5Dget_type(*fieldID);
+	  if (*typeID == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot get the data type ID.\n");
+	      H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  /* Get dimension sizes */
+	  /* ------------------- */
+	  status      = H5Sget_simple_extent_dims(spaceID, dims, NULL);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot get the data space dimension sizes.\n");
+	      H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+		  
+	  /* Release data type ID */
+	  /* -------------------- */
+	  status = H5Tclose(*typeID);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot release the data type ID.\n");
+	      H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  
+	  /* Release data space ID */
+	  /* --------------------- */
+	  status = H5Sclose(spaceID);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot release the data space ID.\n");
+	      H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+		  
+	}
+	  
+    }
+  
+ COMPLETION:
+  return(fldgroup);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdetach                                                     |
+|                                                                             |
+|  DESCRIPTION: Detachs swath structure and performs housekeeping             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/23/99  A. Muslimov   Checked for the statuses returned by H5Dclose()     |
+|                         and H5Gclose().                                     |
+|  10/28/99 A.Muslimov    Added a block 'Close previously opened ragged       |
+|                         arrays'. Added a call to                            |
+|                         H5Gclose(SWXSwath[sID].ra_id), and the lines, cor-  |
+|                         responding to the ragged arrays in the block        |
+|                         'Delete entries from External Arrays'.              |
+|  Feb,2000 A.Muslimov    Fixed a bug-prone release of IDs.                   |
+|  Apr,2000 A.Muslimov    Removed "Ragged Arrays" group.                      |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  00  A.Muslimov    Added "PRofile Fields" group.                       |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWdetach(hid_t swathID)
+{
+  herr_t         status  = FAIL;             /* Return status variable */
+  long           idx     = FAIL;             /* Swath index            */
+  hid_t          fid     = FAIL;             /* HDF-EOS file ID        */
+  hid_t          gid     = FAIL;             /* "HDFEOS" group ID      */
+  int            i, k;		 	     /* Loop indices           */
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+
+  HE5_LOCK;
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWdetach", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+		
+      /* "Detach" from previously attached "Data Fields" datasets */
+      /* -------------------------------------------------------- */
+      if( HE5_SWXSwath[idx].nDFLD > 0 )
+	{
+	  for (k = 0; k < HE5_SWXSwath[idx].nDFLD; k++)
+	    {
+				
+	      if ( HE5_SWXSwath[idx].ddataset[k].ID > 0 )
+		{    
+		  status = H5Dclose(HE5_SWXSwath[idx].ddataset[k].ID);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot release the data dataset ID. \n") ;
+		      H5Epush(__FILE__, "HE5_SWdetach", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+						
+		      return(status);
+		    }
+		}
+	      if(HE5_SWXSwath[idx].ddataset[k].name != NULL)
+		free(HE5_SWXSwath[idx].ddataset[k].name);
+				
+	    }
+	  if (HE5_SWXSwath[idx].ddataset != NULL)
+	    free(HE5_SWXSwath[idx].ddataset);
+	}
+
+
+      /* "Detach" from previously attached "PRofile Fields" datasets */
+      /* ----------------------------------------------------------- */
+      if( HE5_SWXSwath[idx].nPROF > 0 )
+	{
+	  for (k = 0; k < HE5_SWXSwath[idx].nPROF; k++)
+	    {
+				
+	      if ( HE5_SWXSwath[idx].pdataset[k].ID > 0 )
+		{    
+		  status = H5Dclose(HE5_SWXSwath[idx].pdataset[k].ID);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot release the profile dataset ID. \n") ;
+		      H5Epush(__FILE__, "HE5_SWdetach", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+					  
+		      return(status);
+		    }
+		}
+	      if(HE5_SWXSwath[idx].pdataset[k].name != NULL)
+		free(HE5_SWXSwath[idx].pdataset[k].name);
+			  
+	    }
+	  if (HE5_SWXSwath[idx].pdataset != NULL)
+	    free(HE5_SWXSwath[idx].pdataset);
+	}
+		
+
+      /* "Detach" from previously attached "Geolocation Fields" datasets */
+      /* --------------------------------------------------------------- */
+      if( HE5_SWXSwath[idx].nGFLD > 0 )
+	{
+	  for (k = 0; k < HE5_SWXSwath[idx].nGFLD; k++)
+	    {
+	      if ( HE5_SWXSwath[idx].gdataset[k].ID > 0 )
+		{    
+		  status = H5Dclose(HE5_SWXSwath[idx].gdataset[k].ID);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot release the geolocation dataset ID. \n") ;
+		      H5Epush(__FILE__, "HE5_SWdetach", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+						
+		      return(status);
+		    }
+					
+		}
+	      if (HE5_SWXSwath[idx].gdataset[k].name != NULL)
+		free(HE5_SWXSwath[idx].gdataset[k].name);   
+	    }
+	  if (HE5_SWXSwath[idx].gdataset != NULL)
+	    free(HE5_SWXSwath[idx].gdataset);
+			
+	}
+		
+		
+      /* Detach from the Swath groups */
+      /* ---------------------------- */
+      if ( HE5_SWXSwath[idx].geo_id > 0 )
+	{
+	  status = H5Gclose(HE5_SWXSwath[idx].geo_id);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the \"Geolocation Fields\" group ID. \n") ;
+	      H5Epush(__FILE__, "HE5_SWdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(status);
+	    }
+	}
+		
+		
+      if ( HE5_SWXSwath[idx].data_id > 0 )
+	{
+	  status = H5Gclose(HE5_SWXSwath[idx].data_id);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the \"Data Fields\" group ID. \n") ;
+	      H5Epush(__FILE__, "HE5_SWdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(status);
+	    }
+	}
+		
+		
+      if ( HE5_SWXSwath[idx].prof_id > 0 )
+	{
+	  status = H5Gclose(HE5_SWXSwath[idx].prof_id);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the \"Profile Fields\" group ID.") ;
+	      H5Epush(__FILE__, "HE5_SWdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(status);
+	    }
+	}
+
+		
+      if ( HE5_SWXSwath[idx].sw_id > 0 )
+	{
+	  status = H5Gclose(HE5_SWXSwath[idx].sw_id);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the swath group ID. \n") ;
+	      H5Epush(__FILE__, "HE5_SWdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(status);
+	    }
+	}
+ 
+		
+      /* Delete entries from External Arrays */
+      /* ----------------------------------- */
+      HE5_SWXSwath[idx].active       = 0;
+
+      HE5_SWXSwath[idx].geo_id       = 0;
+      HE5_SWXSwath[idx].data_id      = 0;
+      HE5_SWXSwath[idx].prof_id      = 0;
+
+      HE5_SWXSwath[idx].ddataset     = NULL;
+      HE5_SWXSwath[idx].pdataset     = NULL;
+      HE5_SWXSwath[idx].gdataset     = NULL;
+
+      HE5_SWXSwath[idx].fid          = 0;
+      HE5_SWXSwath[idx].sw_id        = 0;
+      HE5_SWXSwath[idx].obj_id       = 0;
+
+      HE5_SWXSwath[idx].nDFLD        = 0;
+      HE5_SWXSwath[idx].nPROF        = 0;
+      HE5_SWXSwath[idx].nGFLD        = 0;
+
+      /* Free Region Pointers */
+      /* -------------------- */
+      for (k = 0; k < HE5_NSWATHREGN; k++)
+	{
+	  if (HE5_SWXRegion[k] != NULL && HE5_SWXRegion[k]->swathID == swathID)
+	    {
+	      for (i = 0; i < HE5_DTSETRANKMAX; i++)
+		{
+		  if (HE5_SWXRegion[k]->DimNamePtr[i] != NULL)
+		    {
+		      free(HE5_SWXRegion[k]->DimNamePtr[i]);
+		    }
+		}
+				
+	      free(HE5_SWXRegion[k]);
+	      HE5_SWXRegion[k] = NULL;
+	    }
+	}		
+    }
+
+ COMPLETION:  
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefboxregion                                               |
+|                                                                             |
+|  DESCRIPTION: Finds swath cross tracks within area of interest and returns  |
+|               region ID                                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  regionID       hid_t               Region ID                               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  cornerlon      double   dec deg    Longitude of opposite corners of box    |
+|  cornerlat      double   dec deg    Latitude of opposite corners of box     |
+|  mode           int                 Search mode                             |
+|                                     HDFE_MIDPOINT - Use midpoint of Xtrack  |
+|                                     HDFE_ENDPOINT - Use endpoints of Xtrack |
+|                                     HDFE_ANYPOINT - Use all points of Xtrack|
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 98   Abe Taaheri   Fixed core dump in SWregioninfo associated with     |
+|                         SWXRegion[k]->nRegions exceeding MAXNREGIONS in     |
+|                         this function                                       |
+|                                                                             |
+|  Aug 3,99  A.Muslimov   Changed the type of lonArr[] and latArr[] from char |
+|                         to float64. Changed types of fid, idx from int32_t  |
+|                         to hid_t.                                           |
+|  Aug 11,99 A.Muslimov   Left out a factor 8 in front of "(i * edge[1] + j)" |
+|                         in  "memcpy(&lonTestVal,&lonArr[i*edge[1]+j],8);"   |
+|                         and "memcpy(&latTestVal,&latArr[i*edge[1]+j],8);".  |
+|                         Made similar changes in the calls to                |
+|                         "memcpy(&lonTestVal,&lonArr[j],8);" and             |
+|                         "memcpy(&latTestVal,&latArr[j],8);", and in all     |
+|                         other calls to  memcpy().                           |
+| 10/18/99     A.Muslimov Replaced memcpy() by memmove() to avoid a problem   |
+|                            when arguments 1 and 2 overlap in memory.        |
+| 02/08/00     A.Muslimov Added more error checkings.                         |
+| 03/13/00     A.Muslimov Modified to convert non-native datatypes to native  |
+|                         ones.                                               |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  Jan  05  S. Zhao       Modified to include a region starts and stops with  |
+|                         the same index on the track.                        |
+|  Jan  05  S. Zhao       Returned error if regionID exceeded HE5_NSWATHREGN. |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t
+HE5_SWdefboxregion(hid_t swathID, double  cornerlon[], double cornerlat[], int mode)
+{
+
+  hid_t           regionID  = FAIL;/* Region ID (return)                     */
+  hid_t           fid       = FAIL;/* HDF-EOS file ID                        */
+  hid_t           gid       = FAIL;/* "HDFEOS" group ID                      */
+  hid_t           tid       = FAIL;/* Longitude/Latitude Datatype ID         */
+  hid_t           fieldID   = FAIL;/* Longitude/Latitude Dataset ID          */
+  hid_t           k;               /* Loop index                             */
+
+  herr_t          status    = FAIL;/* routine return status variable         */
+  herr_t          statLon   = FAIL;/* Status from SWfieldinfo for longitude  */
+  herr_t          statLat   = FAIL;/* Status from SWfieldinfo for latitude   */
+  herr_t          statCoLat = FAIL;/* Status from SWfieldinfo for            */
+
+
+  int             validReg  = FAIL;                 /* validReg flag         */
+  int             rank      = FAIL;                 /* Rank of dataset       */
+
+  hid_t           nt[1]     ={FAIL};                /* number types          */
+
+  unsigned        found     = 0;                    /* Found flag            */
+
+  unsigned char   *flag     = (unsigned char *)NULL;/* Track flag array      */
+
+  long            idx       = FAIL;                 /* Swath index           */
+  long            bndflag   = FAIL;                 /* +/-180 boundary flag  */
+  long            lonTest   = FAIL;                 /* Longitude test flag   */
+  long            latTest   = FAIL;                 /* Latitude test flag    */
+  long            i = 0, j  = 0;                    /* Loop indices          */
+
+  size_t          tsize      =  0;                  /* Data type size (bytes)*/
+
+  hssize_t        start[2]   = {FAIL, FAIL};        /* Start array (read)    */
+  hssize_t        anyStart[2]= {FAIL, FAIL};        /* ANYPOINT start array  */
+
+  hsize_t         nElem      = 0;        /* Number of elements to read       */
+  hsize_t         dims[HE5_DTSETRANKMAX];/* Dims of geolocation fields       */
+  hsize_t         stride[2]  = {1, 1};   /* Stride array (read)              */
+  hsize_t         edge[2]    = {0, 0};	 /* Edge array (read)                */
+  hsize_t         anyEdge[2] = {0, 0};	 /* ANYPOINT edge array (read)       */
+
+  float           tempFloat  = 0.;	 /* Temporary float variable         */
+
+  double          tempDouble = 0.;       /* Temporary double variable        */
+  double          lonTestVal = 0.;       /* Longitude test value             */
+  double          latTestVal = 0.;       /* Latitude test value              */
+
+  char            *lonArr = (char *)NULL;/* Longitude data array             */
+  char            *latArr = (char *)NULL;/* Latitude data array              */
+  char            dimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list             */
+  char            latName[16];	          /* Latitude field name             */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer        */
+
+  HE5_LOCK;
+  CHECKPOINTER(cornerlon);
+  CHECKPOINTER(cornerlat);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWdefboxregion", &fid, &gid, &idx);	
+	
+  /* Inclusion mode must be between 0 and 2 */
+  /* -------------------------------------- */
+  if (mode < 0 || mode > 2)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Improper Inclusion Mode: %d.\n", mode);
+      H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+	
+  strcpy(dimlist,"");
+	
+  if (status == SUCCEED)
+    {
+      /* Initialize dims[] array */
+      /* ----------------------- */
+      for (i = 0; i < HE5_DTSETRANKMAX; i++)
+	dims[i] = 0;
+
+      /* Get "Longitude" field info */
+      /* -------------------------- */
+      statLon = HE5_SWfieldinfo(swathID, "Longitude", &rank, dims, nt, dimlist, NULL);
+      if (statLon == FAIL)
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"\"Longitude\" field not found.\n");
+	  H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+		
+      /* Get "Latitude" field info */
+      /* -------------------------- */
+      statLat = HE5_SWfieldinfo(swathID, "Latitude", &rank, dims, nt, dimlist, NULL);
+      if (statLat == FAIL)
+	{
+	  /* If not found check for "Colatitude" field info */
+	  /* ---------------------------------------------- */
+	  statCoLat = HE5_SWfieldinfo(swathID, "Colatitude", &rank, dims, nt,dimlist, NULL);
+	  if (statCoLat == FAIL)
+	    {
+	      /* Neither "Latitude" nor "Colatitude" field found */
+	      /* ----------------------------------------------- */
+	      status = FAIL;
+	      sprintf( errbuf, "Neither \"Latitude\" nor \"Colatitude\" fields found.\n");
+	      H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+	  else
+	    {
+	      /* Latitude field is "Colatitude" */
+	      /* ------------------------------ */
+	      strcpy(latName, "Colatitude");
+	    }
+	}
+      else
+	{
+	  /* Latitude field is "Latitude" */
+	  /* ---------------------------- */
+	  strcpy(latName, "Latitude");
+	}
+		
+		
+      /* Get "Latitude" or "Longitude" datatype */
+      tsize = HE5_SWfieldsizeID(swathID, "Latitude", &fieldID);
+      if (tsize == 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"The size of a data type = 0.\n");
+	  H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+		
+		
+      tid = H5Dget_type( fieldID);
+      if (tid == FAIL)
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Cannot get the dataset data type ID.\n");
+	  H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+		
+		
+      if (status == SUCCEED)
+	{
+	  /* Search along entire "Track" dimension from beginning to end */
+	  /* ----------------------------------------------------------- */
+	  start[0] = 0;
+	  edge[0]  = dims[0];
+			
+			
+	  /* If 1D geolocation fields then set mode to MIDPOINT */
+	  /* -------------------------------------------------- */
+	  if (rank == 1)
+	    mode = HE5_HDFE_MIDPOINT;
+			
+	  switch (mode)
+	    {
+	      /* If MIDPOINT search single point in middle of "CrossTrack" */
+	      /* --------------------------------------------------------- */
+	    case HE5_HDFE_MIDPOINT:
+				
+	      start[1] = HE5_EHlong2hssize( (dims[ 1 ] / 2) );
+	      edge[1]  = 1;
+				
+	      break;
+				
+	      /* If ENDPOINT search 2 points at either end of "CrossTrack" */
+	      /* --------------------------------------------------------- */
+	    case HE5_HDFE_ENDPOINT:
+				
+	      start[1]  = 0;
+	      stride[1] = dims[1] - 1;
+	      edge[1]   = 2;
+				
+	      break;
+				
+	      /* If ANYPOINT do initial MIDPOINT search */
+	      /* -------------------------------------- */
+	    case HE5_HDFE_ANYPOINT:
+				
+	      start[1] = HE5_EHlong2hssize( (dims[1] / 2) );
+	      if ( start[1] == FAIL )
+		{
+		  sprintf(errbuf, "Cannot convert data type. \n");
+		  H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+	      edge[1]  = 1;
+				
+	      break;
+	    }
+			
+			
+	  /* Compute number of elements */
+	  /* -------------------------- */
+	  nElem = edge[ 0 ] * edge[ 1 ];
+			
+			
+	  /* Allocate space for longitude and latitude  */
+	  /* ------------------------------------------ */
+	  lonArr = (char *)calloc(nElem, sizeof(double));
+	  if(lonArr == NULL)
+	    {
+	      H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+	      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+			
+	  latArr = (char *)calloc(nElem, sizeof(double));
+	  if(latArr == NULL)
+	    {
+	      H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+	      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	      free(lonArr);
+	      lonArr = NULL;
+	      return(FAIL);
+	    }
+			
+	  /* Allocate space for flag array */
+	  /* ----------------------------- */
+	  flag = (unsigned char *) calloc(edge[0] + 1, sizeof(unsigned char ));
+	  if(flag == NULL)
+	    {
+	      H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+	      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	      free(lonArr);
+	      free(latArr);
+	      lonArr = NULL;
+	      latArr = NULL;
+	      return(FAIL);
+	    }
+
+
+	  /* Read Longitude and Latitude fields */
+	  /* ---------------------------------- */
+	  status = HE5_SWreadfield(swathID, "Longitude", start, stride, edge, lonArr);
+	  if( status == FAIL )
+	    {
+	      H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot read the \"Longitude\" field.");
+	      HE5_EHprint("Error: Cannot read the \"Longitude\" field, occured", __FILE__, __LINE__);
+	      free(lonArr);
+	      free(latArr);
+	      free(flag);
+	      lonArr = NULL;
+	      latArr = NULL;
+	      flag   = NULL;
+		
+	      return(FAIL);
+	    }
+			
+	  status = HE5_SWreadfield(swathID, latName, start, stride, edge, latArr);
+	  if( status == FAIL )
+	    {
+	      H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot read the \"Latitude\" field.");
+	      HE5_EHprint("Error: Cannot read the \"Latitude\" field, occured", __FILE__, __LINE__);
+	      free(lonArr);
+	      free(latArr);
+	      free(flag);
+	      lonArr = NULL;
+	      latArr = NULL;
+	      flag   = NULL;
+		
+	      return(FAIL);
+	    }
+			
+			
+	  /*
+	   * If geolocation fields are FLOAT then cast each entry as DOUBLE
+	   */
+	  if ( H5Tequal( tid, H5T_NATIVE_FLOAT) || 
+	       H5Tequal( tid, H5T_IEEE_F32LE) || 
+	       H5Tequal( tid, H5T_IEEE_F32BE) )
+	    {
+	      for (i = nElem - 1; i >= 0; i--)
+		{
+		  memmove(&tempFloat, lonArr + sizeof(float) * i, sizeof(float));
+		  tempDouble = (double)tempFloat;
+		  memmove(lonArr + sizeof(double) * i, &tempDouble, sizeof(double));
+		  memmove(&tempFloat, latArr + sizeof(float) * i, sizeof(float));
+		  tempDouble = (double) tempFloat;
+		  memmove(latArr + sizeof(double) * i, &tempDouble, sizeof(double));
+		}
+	    }
+			
+			
+	  /* Set boundary flag */
+	  /* ----------------- */
+			
+	  /*
+	   * This variable is set to 1 if the region of interest crosses
+	   * the +/- 180 longitude boundary
+	   */
+	  bndflag = (cornerlon[0] < cornerlon[1]) ? 0 : 1;
+			
+			
+	  /* Main Search Loop */
+	  /* ---------------- */
+			
+	  /* For each track ... */
+	  /* ------------------ */
+	  for (i = 0; i < edge[0]; i++)
+	    {
+	      /* For each value from Cross Track ... */
+	      /* ----------------------------------- */
+	      for (j = 0; j < edge[1]; j++)
+		{
+		  /* Read in single lon & lat values from data buffers */
+		  /* ------------------------------------------------- */
+		  memmove(&lonTestVal, &lonArr[sizeof(double) * (i * edge[1] + j)], sizeof(double));
+		  memmove(&latTestVal, &latArr[sizeof(double) * (i * edge[1] + j)], sizeof(double));
+					
+					
+		  /* If longitude value > 180 convert to -180 to 180 range */
+		  /* ----------------------------------------------------- */
+		  if (lonTestVal > 180)
+		    lonTestVal = lonTestVal - 360;
+				  
+		  /* If Colatitude value convert to latitude value */
+		  /* --------------------------------------------- */
+		  if (statCoLat == 0)
+		    latTestVal = 90 - latTestVal;
+					
+					
+		  /* Test if lat value is within range */
+		  /* --------------------------------- */
+		  latTest = (latTestVal >= cornerlat[0] && latTestVal <= cornerlat[1]);
+						
+		  if (bndflag == 1)
+		    {
+		      /*
+		       * If boundary flag set test whether longitude value
+		       * is outside region and then flip
+		       */
+		      lonTest = (lonTestVal >= cornerlon[1] && lonTestVal <= cornerlon[0]);
+		      lonTest = 1 - lonTest;
+		    }
+		  else
+		    {
+		      lonTest = (lonTestVal >= cornerlon[0] && lonTestVal <= cornerlon[1]);
+		    }
+					
+					
+		  /*
+		   * If both longitude and latitude are within region set
+		   * flag on for this track
+		   */
+		  if ( (lonTest + latTest) == 2 )
+		    {
+		      flag[i] = 1;
+		      found   = 1;
+		      break;
+		    }
+		}
+            }
+			
+			
+			
+	  /* ANYPOINT search */
+	  /* --------------- */
+	  if ( (mode == HE5_HDFE_ANYPOINT) && (rank > 1) )
+	    {
+	      free(lonArr);
+	      free(latArr);
+	      lonArr = NULL;
+	      latArr = NULL;
+				
+				
+	      /* Allocate space for an entire single cross track */
+	      /* ----------------------------------------------- */
+	      lonArr = (char *) calloc(dims[1], sizeof(double));
+	      if(lonArr == NULL)
+		{
+		  H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); 
+		  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+		  return(FAIL);
+		}
+				
+	      latArr = (char *) calloc(dims[1], sizeof(double));
+	      if(latArr == NULL)
+		{
+		  H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); 
+		  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+		  free(lonArr);
+		  lonArr = NULL;
+		  return(FAIL);
+		}
+				
+				
+	      /* Setup start and edge */
+	      /* -------------------- */
+	      anyStart[1] = 0;
+	      anyEdge[0]  = 1;
+	      anyEdge[1]  = dims[1];
+				
+				
+	      /* For each track starting from 0 */
+	      /* ------------------------------ */
+	      for (i = 0; i < edge[0]; i++)
+		{
+					
+		  /* If cross track not in region (with MIDPOINT search ... */
+		  /* ------------------------------------------------------ */
+		  if (flag[i] == 0)
+		    {
+		      /* Setup track start */
+		      /* ----------------- */
+		      anyStart[0] = HE5_EHlong2hssize(i);
+		      if (anyStart[0] == FAIL )
+			{
+			  sprintf(errbuf, "Cannot convert data type. \n");
+			  H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+			  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  free(lonArr);
+			  free(latArr);
+			  lonArr = NULL;
+			  latArr = NULL;
+
+			  return(FAIL);
+			}						
+
+
+		      /* Read in lon and lat values for cross track */
+		      /* ------------------------------------------ */
+		      status = HE5_SWreadfield(swathID, "Longitude", anyStart, NULL, anyEdge, lonArr);
+		      if(status == FAIL)
+			{
+			  H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot read the \"Longitude\" field. \n"); 
+			  HE5_EHprint("Error: Cannot read the \"Longitude\" field, occured", __FILE__, __LINE__);
+			  free(lonArr);
+			  free(latArr);
+			  lonArr = NULL;
+			  latArr = NULL;
+							
+			  return(FAIL);
+			}
+						
+		      status = HE5_SWreadfield(swathID, latName, anyStart, NULL, anyEdge, latArr);
+		      if(status == FAIL)
+			{
+			  H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot read the \"Latitude\" field. \n"); 
+			  HE5_EHprint("Error: Cannot read the \"Latitude\" field, occured", __FILE__, __LINE__);
+			  free(lonArr);
+			  free(latArr);
+			  lonArr = NULL;
+			  latArr = NULL;
+							
+			  return(FAIL);
+			}
+						
+		      /*
+		       * If geolocation fields are FLOAT then cast each entry as DOUBLE
+		       */
+		      if ( H5Tequal( tid, H5T_NATIVE_FLOAT) ||
+			   H5Tequal( tid, H5T_IEEE_F32LE) ||
+			   H5Tequal( tid, H5T_IEEE_F32BE) )
+			{
+			  for (j = dims[1] - 1; j >= 0; j--)
+			    {
+			      memmove(&tempFloat, lonArr + sizeof(float) * j, sizeof(float));
+			      tempDouble = (double)tempFloat;
+			      memmove(lonArr + sizeof(double) * j, &tempDouble, sizeof(double));
+			      memmove(&tempFloat, latArr + sizeof(float) * j, sizeof(float));
+			      tempDouble = (double)tempFloat;
+			      memmove(latArr + sizeof(double) * j, &tempDouble, sizeof(double));
+			    }
+			}
+
+		      /* For each value from Cross Track ... */
+		      /* ----------------------------------- */
+		      for (j = 0; j < dims[1]; j++)
+			{
+			  /* Read in single lon & lat values from buffers */
+			  /* -------------------------------------------- */
+			  memmove(&lonTestVal, &lonArr[sizeof(double) * j], sizeof(double));
+			  memmove(&latTestVal, &latArr[sizeof(double) * j], sizeof(double));
+							
+							
+			  /* If lon value > 180 convert to -180 - 180 range */
+			  /* ---------------------------------------------- */
+			  if (lonTestVal > 180)
+			    lonTestVal = lonTestVal - 360;
+						  
+			  /* If Colatitude value convert to latitude value */
+			  /* --------------------------------------------- */
+			  if (statCoLat == 0)
+			    latTestVal = 90 - latTestVal;
+							
+							
+			  /* Test if lat value is within range */
+			  /* --------------------------------- */
+			  latTest = (latTestVal >= cornerlat[0] && latTestVal <= cornerlat[1]);
+							
+			  if (bndflag == 1)
+			    {
+			      /*
+			       * If boundary flag set test whether
+			       * longitude value is outside region and then
+			       * flip
+			       */
+			      lonTest = (lonTestVal >= cornerlon[1] && lonTestVal <= cornerlon[0]);
+			      lonTest = 1 - lonTest;
+			    }
+			  else
+			    {
+			      lonTest = (lonTestVal >= cornerlon[0] && lonTestVal <= cornerlon[1]);
+			    }
+							
+							
+			  /*
+			   * If both longitude and latitude are within
+			   * region set flag on for this track
+			   */
+							
+			  if ( (lonTest + latTest) == 2 )
+			    {
+			      flag[i] = 1;
+			      found   = 1;
+			      break;
+			    }
+			}
+		    }
+		}
+	    }
+			
+	  /* If within region setup Region Structure */
+	  /* --------------------------------------- */
+	  if (found == 1)
+	    {
+	      /* For all entries in SWXRegion array ... */
+	      /* -------------------------------------- */
+	      for (k = 0; k < HE5_NSWATHREGN; k++)
+		{
+		  /* If empty region ... */
+		  /* ------------------- */
+		  if (HE5_SWXRegion[k] == 0)
+		    {
+		      /* Allocate space for region entry */
+		      /* ------------------------------- */
+		      HE5_SWXRegion[k] = (struct HE5_swathRegion *)calloc(1, sizeof(struct HE5_swathRegion));
+		      if(HE5_SWXRegion[k] == NULL)
+			{
+			  H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); 
+			  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+			  return(FAIL);
+			}
+					  
+		      /* Store file and swath ID */
+		      /* ----------------------- */
+		      HE5_SWXRegion[k]->fid     = fid;
+		      HE5_SWXRegion[k]->swathID = swathID;
+					  
+						
+		      /* Set Start & Stop Vertical arrays to FAIL */
+		      /* ---------------------------------------- */
+		      for (j = 0; j < HE5_DTSETRANKMAX; j++)
+			{
+			  HE5_SWXRegion[k]->StartVertical[j] = FAIL;
+			  HE5_SWXRegion[k]->StopVertical[j]  = FAIL;
+			}
+						
+		      /* Set region ID */
+		      /* ------------- */
+		      regionID = k;
+		      break;
+		    }
+		}
+                          
+	      if (k >= HE5_NSWATHREGN)
+		{
+		  sprintf(errbuf, "regionID exceeded HE5_NSWATHREGN.\n");
+		  H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_BTREE,  H5E_BADRANGE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (lonArr != NULL) free(lonArr);
+		  if (latArr != NULL) free(latArr);
+		  if (flag   != NULL) free(flag);
+		  return(FAIL);
+		} 
+				
+	      /* Find start and stop of regions */
+	      /* ------------------------------ */
+				
+	      /* Subtract previous flag value from current one */
+	      /* --------------------------------------------- */
+				
+	      /*
+	       * Transisition points will have flag value (+1) start or
+	       * (255 = (uint8_t) -1) stop of region
+	       */
+	      for (i = edge[0]; i > 0; i--)
+		flag[i] -= flag[i - 1];
+				
+				
+	      for (i = 0; i <= edge[0]; i++)
+		{
+		  /* Start of region */
+		  /* --------------- */
+		  if (flag[i] == 1)
+		    {
+		      /* Increment (multiple) region counter */
+		      /* ----------------------------------- */
+		      j = ++HE5_SWXRegion[k]->nRegions;
+
+		      if ((HE5_SWXRegion[k]->nRegions) > HE5_MAXNREGIONS)
+			{
+			  sprintf(errbuf, "HE5_SWXRegion[%d]->nRegions exceeded HE5_MAXNREGIONS = %d.\n", k, HE5_MAXNREGIONS);
+			  H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+			  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  if (lonArr != NULL) free(lonArr);
+			  if (latArr != NULL) free(latArr);
+			  if (flag   != NULL) free(flag);
+			  return(FAIL);
+			}
+
+		      HE5_SWXRegion[k]->StartRegion[j - 1] = i;
+
+		    }
+					
+		  /* End of region */
+		  /* ------------- */
+		  if (flag[i] == 255)
+		    {
+		      HE5_SWXRegion[k]->StopRegion[j - 1]  = i - 1;
+		      validReg = 0;
+		    }
+		}
+	    }
+	  if (lonArr != NULL) free(lonArr);
+	  if (latArr != NULL) free(latArr);
+	  if (flag   != NULL) free(flag);			
+	}
+
+      status = H5Tclose(tid);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the data type ID.\n");
+	  H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+  
+  if(validReg != 0)
+    {
+      sprintf(errbuf,"Invalid region ID.\n");
+      H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      regionID = FAIL;
+    }
+
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(regionID);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWregionindex                                                |
+|                                                                             |
+|  DESCRIPTION: Finds swath cross tracks within area of interest and returns  |
+|               region index and region ID                                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  regionID       hid_t               Region ID                               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  cornerlon      double   dec deg    Longitude of opposite corners of box    |
+|  cornerlat      double   dec deg    Latitude of opposite corners of box     |
+|  mode           int                 Search mode                             |
+|                                     HDFE_MIDPOINT - Use midpoint of Xtrack  |
+|                                     HDFE_ENDPOINT - Use endpoints of Xtrack |
+|                                     HDFE_ANYPOINT - Use all points of Xtrack|
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  geodim         char                geolocation track dimension             |
+|  idxrange       hsize_t             indices of region for along track dim.  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+| 10/18/99     A.Muslimov Replaced memcpy() by memmove() to avoid a problem   |
+|                            when arguments 1 and 2 overlap in memory.        |
+| 03/13/00     A.Muslimov Modified to convert non-native datatypes to native  |
+|                           ones.                                             |
+| 06/21/00     A.Muslimov Casted "flag[]" to "int". Moved "l = (hsize_t)i" out|
+|                           of the loop "if (mapstatus == 2){}".              |
+| July 00      A.Muslimov Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t 
+HE5_SWregionindex(hid_t swathID, double cornerlon[], double cornerlat[], int  mode, char *geodim, hsize_t idxrange[])
+{
+
+  hid_t           regionID     = FAIL;         /* Region ID (return value)      */  
+  hid_t           k            = 0;            /* loop index (region counter)   */
+  
+  herr_t          status       = FAIL;         /* status variable               */
+  herr_t          mapstatus    = FAIL;         /* status variable               */
+  herr_t          statLon      = FAIL;         /* status variable               */
+  herr_t          statLat      = FAIL;         /* status variable               */
+  herr_t          statCoLat    = FAIL;         /* status variable               */  
+  
+  int             validReg     = FAIL;         /* validReg  flag                */
+  int             rank         = FAIL;         /* Rank of geolocation fields    */
+  
+  hid_t           *nt          = (hid_t *)NULL;/* number types                  */
+  
+  hid_t           fid          = FAIL;         /* HDF-EOS file ID               */
+  hid_t           gid          = FAIL;         /* "HDFEOS" group ID             */
+  hid_t           datasetid    = FAIL;         /* Dataset ID                    */
+  hid_t           datatype     = FAIL;         /* Data type ID                  */
+  
+  unsigned char   found        =  0;           /* Found flag                    */
+  unsigned char   *flag        = (unsigned char *)NULL;/* Track flag array      */
+  
+  long            idx          = FAIL;         /* Swath index                   */
+  long            bndflag      = FAIL;         /* +/-180 boundary flag          */
+  long            lonTest      = FAIL;         /* Longitude test flag           */
+  long            latTest      = FAIL;         /* Latitude test flag            */
+  
+  hssize_t        start[2]     =  {FAIL, FAIL};/* Start array (read)            */
+  hssize_t        anyStart[2]  =  {FAIL, FAIL};/* ANYPOINT start array (read)   */    
+  hssize_t        i = 0, j = 0;                /* Loop indices                  */
+  
+  hsize_t         l            = 0;            /* loop index                    */
+  hsize_t         tmpVal       = 0;            /* Start region tmp value        */
+  hsize_t         dims[HE5_DTSETRANKMAX];      /* Dimension array               */
+  hsize_t         nElem        = 0;            /* Number of elements to read    */
+  hsize_t         stride[2]    = {1, 1};       /* Stride array (read)           */
+  hsize_t         edge[2]      = {0, 0};       /* Edge array (read)             */
+  hsize_t         anyEdge[2]   = {0, 0};       /* ANYPOINT edge array (read)    */
+  
+  float           tempFloat    = 0.;           /* Temporary float variable      */
+  
+  double          lonTestVal   = 0.;           /* Longitude test value          */
+  double          latTestVal   = 0.;           /* Latitude test value           */
+  double          tempDouble   = 0.;           /* Temporary double variable     */
+  
+  size_t          size         = 0;            /* Data type size (bytes)        */
+  
+  char            *lonArr  = (char *)NULL;     /* Longitude data array          */
+  char            *latArr  = (char *)NULL;     /* Latitude data array           */
+  char            dimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list (geo fields)   */
+  char            latName[16];                 /* Latitude field name           */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer          */
+  
+  CHECKPOINTER(cornerlon);
+  CHECKPOINTER(cornerlat);  
+  
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWregionindex", &fid, &gid, &idx);
+  
+  /* Inclusion mode must be between 0 and 2 */
+  /* -------------------------------------- */
+  if (mode < 0 || mode > 2)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Improper Inclusion Mode: %d.\n", mode);
+      H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  strcpy(dimlist,"");
+  
+  
+  if (status == SUCCEED)
+    {
+      /* Initialize dims[] array */
+      /* ----------------------- */
+      for (l = 0; l < HE5_DTSETRANKMAX; l++)
+	dims[l] = 0;
+
+      /* Allocate memory for nt variable */
+      /* ------------------------------- */
+      nt = (hid_t *)calloc(1, sizeof(hid_t));
+      if(nt == (hid_t *)NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory.\n");
+	  H5Epush(__FILE__, "HE5_SWregionindex",  __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Get "Longitude" field info */
+      /* -------------------------- */
+      statLon = HE5_SWfieldinfo(swathID, "Longitude", &rank, dims, nt, dimlist,NULL);
+      if (statLon != SUCCEED)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "\"Longitude\" field not found.\n");
+	  H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(nt);
+        }
+
+      /* Get "Latitude" field info */
+      /* ------------------------- */
+      statLat = HE5_SWfieldinfo(swathID, "Latitude", &rank, dims, nt, dimlist,NULL);
+      if (statLat != SUCCEED)
+        {
+	  /* If not found check for "Colatitude" field info */
+	  /* ---------------------------------------------- */
+	  statCoLat = HE5_SWfieldinfo(swathID, "Colatitude", &rank, dims, nt, dimlist, NULL);
+	  if (statCoLat != SUCCEED)
+            {
+	      /* Neither "Latitude" nor "Colatitude" field found */
+	      /* ----------------------------------------------- */
+	      status = FAIL;
+	      sprintf(errbuf,  "Neither \"Latitude\" nor \"Colatitude\" fields found.\n");
+	      H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(nt);
+            }
+	  else
+            {
+	      /* Latitude field is "Colatitude" */
+	      /* ------------------------------ */
+	      strcpy(latName, "Colatitude");
+            }
+        }
+      else
+        {
+	  /* Latitude field is "Latitude" */
+	  /* ---------------------------- */
+	  strcpy(latName, "Latitude");
+        }
+
+      /* This line modifies the dimlist variable so only the along-track */
+      /* dimension remains.                                              */
+      /* --------------------------------------------------------------- */
+      strtok(dimlist,",");
+      mapstatus = HE5_SWgeomapinfo(swathID,dimlist);
+      if(mapstatus == FAIL)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Cannot retrieve geo map information.\n");
+	  H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(nt);
+	}
+	  
+      strcpy(geodim,dimlist);
+
+      if (status == SUCCEED)
+        {
+	  /* Search along entire "Track" dimension from beginning to end */
+	  /* ----------------------------------------------------------- */
+	  start[0] = 0;
+	  edge[0]  = dims[0];
+
+
+	  /* If 1D geolocation fields then set mode to MIDPOINT */
+	  /* -------------------------------------------------- */
+	  if (rank == 1)
+            {
+	      mode = HE5_HDFE_MIDPOINT;
+            }
+
+
+	  switch (mode)
+            {
+	      /* If MIDPOINT search single point in middle of "CrossTrack" */
+	      /* --------------------------------------------------------- */
+            case HE5_HDFE_MIDPOINT:
+
+	      start[1] = HE5_EHhsize2hssize(dims[ 1 ]/2);
+	      if ( start[1] == FAIL )
+		{
+		  sprintf(errbuf, "Cannot convert data type. \n");
+		  H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(nt);
+		  return(FAIL);
+		}
+	      edge[1]  = 1;
+
+	      break;
+
+	      /* If ENDPOINT search 2 points at either end of "CrossTrack" */
+	      /* --------------------------------------------------------- */
+            case HE5_HDFE_ENDPOINT:
+
+	      start[1]  = 0;
+	      stride[1] = dims[1] - 1;
+	      edge[1]   = 2;
+
+	      break;
+
+	      /* If ANYPOINT do initial MIDPOINT search */
+	      /* -------------------------------------- */
+            case HE5_HDFE_ANYPOINT:
+
+	      start[1] = HE5_EHhsize2hssize(dims[ 1 ]/2);
+	      if ( start[1] == FAIL )
+		{
+		  sprintf(errbuf, "Cannot convert data type. \n");
+		  H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(nt);
+		  return(FAIL);
+		}
+	      edge[1]  = 1;
+
+	      break;
+            }
+
+
+	  /* Compute number of elements */
+	  /* -------------------------- */
+	  nElem = edge[0] * edge[1];
+
+	  /* Allocate space for longitude and latitude  */
+	  /* ------------------------------------------ */
+	  lonArr = (char *)calloc(nElem, sizeof(double));
+	  if(lonArr == NULL)
+            {
+	      H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+	      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	      free(nt);
+	      return(FAIL);
+            }
+
+	  latArr = (char *) calloc(nElem, sizeof(double));
+	  if(latArr == NULL)
+            {
+	      H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+	      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	      free(lonArr);
+	      free(nt);
+	      return(FAIL);
+            }
+
+
+	  /* Allocate space for flag array */
+	  /* ----------------------------- */
+	  flag = (unsigned char *)calloc(edge[0] + 1, sizeof(unsigned char));
+	  if(flag == NULL)
+            {
+              
+	      H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+	      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	      free(lonArr);
+	      free(latArr);
+	      free(nt);
+	      return(FAIL);
+            }
+
+
+	  /* Read Longitude and Latitude fields */
+	  /* ---------------------------------- */
+	  status = HE5_SWreadfield(swathID, "Longitude",start, stride, edge, lonArr);
+	  if( status  == FAIL)
+            {
+	      H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_READERROR, "Cannot read the \"Longitude\" field.");
+	      HE5_EHprint("Error: Cannot read the \"Longitude\" field, occured", __FILE__, __LINE__);
+	      free(lonArr);
+	      free(latArr);
+	      free(nt);
+	      free(flag);
+	      return(FAIL);
+            }
+
+
+	  status = HE5_SWreadfield(swathID, latName, start, stride, edge, latArr);
+	  if( status  == FAIL)
+            {
+	      H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_READERROR, "Cannot read the \"Latitude\" field.");
+	      HE5_EHprint("Error: Cannot read the \"Latitude\" field, occured", __FILE__, __LINE__);
+	      free(lonArr);
+	      free(latArr);
+	      free(nt);
+	      free(flag);
+	      return(FAIL);
+            }
+
+
+	  /*
+	   * If geolocation fields are FLOAT then cast each entry as DOUBLE 
+	   */
+
+	  datasetid = H5Dopen(HE5_SWXSwath[idx].geo_id, "Longitude");
+	  if(datasetid == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the dataset.\n");
+	      H5Epush(__FILE__, "HE5_SWregionindex",  __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(lonArr);
+	      free(latArr);
+	      free(nt);
+	      free(flag);
+	      return(FAIL);
+	    }
+
+	  datatype  = H5Dget_type(datasetid);
+	  if(datatype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the data type ID.\n");
+	      H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(lonArr);
+	      free(latArr);
+	      free(nt);
+	      free(flag);
+	      return(FAIL);
+	    }
+
+	  size      = H5Tget_size(datatype);
+	  if(size == 0)
+	    {
+	      sprintf(errbuf, "Cannot get the data type size.\n");
+	      H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(lonArr);
+	      free(latArr);
+	      free(nt);
+	      free(flag);
+	      return(FAIL);
+	    }
+
+	  status    = H5Dclose(datasetid);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot close the dataset.\n");
+	      H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(lonArr);
+	      free(latArr);
+	      free(nt);
+	      free(flag);
+	      return(FAIL);
+	    }
+
+	  if ( H5Tequal( datatype, H5T_NATIVE_FLOAT) ||
+	       H5Tequal( datatype, H5T_IEEE_F32LE) ||
+	       H5Tequal( datatype, H5T_IEEE_F32BE) )
+	    {
+	      for (i = nElem - 1; i >= 0; i--)
+		{
+		  memmove(&tempFloat, lonArr + sizeof(float) * i, sizeof(float));
+		  tempDouble = (double)tempFloat;
+		  memmove(lonArr + sizeof(double) * i, &tempDouble, sizeof(double));
+		  memmove(&tempFloat, latArr + sizeof(float) * i, sizeof(float));
+		  tempDouble = (double)tempFloat;
+		  memmove(latArr + sizeof(double) * i, &tempDouble, sizeof(double));
+		}
+	    }
+
+
+	  /* Set boundary flag */
+	  /* ----------------- */
+
+	  /*
+	   * This variable is set to 1 if the region of interest crosses
+	   * the +/- 180 longitude boundary
+	   */
+	  bndflag = (cornerlon[0] < cornerlon[1]) ? 0 : 1;
+
+
+	  /* Main Search Loop */
+	  /* ---------------- */
+
+	  /* For each track ... */
+	  /* ------------------ */
+	  for (i = 0; i < edge[0]; i++)
+	    {		 
+	      /* For each value from Cross Track ... */
+	      /* ----------------------------------- */
+	      for (j = 0; j < edge[1]; j++)
+		{
+		  /* Read in single lon & lat values from data buffers */
+		  /* ------------------------------------------------- */
+		  memmove(&lonTestVal, &lonArr[ sizeof(double) * (i * edge[1] + j)], sizeof(double));
+		  memmove(&latTestVal, &latArr[ sizeof(double) * (i * edge[1] + j)], sizeof(double));
+
+
+		  /* If longitude value > 180 convert to -180 to 180 range */
+		  /* ----------------------------------------------------- */
+		  if (lonTestVal > 180)
+		    lonTestVal = lonTestVal - 360;
+				  
+				  
+		  /* If Colatitude value convert to latitude value */
+		  /* --------------------------------------------- */
+		  if (statCoLat == 0)
+		    latTestVal = 90 - latTestVal;
+				  
+
+		  /* Test if lat value is within range */
+		  /* --------------------------------- */
+		  latTest = (latTestVal >= cornerlat[0] && latTestVal <= cornerlat[1]);
+
+		  if (bndflag == 1)
+		    {
+		      /*
+		       * If boundary flag set test whether longitude value
+		       * is outside region and then flip
+		       */
+		      lonTest = (lonTestVal >= cornerlon[1] && lonTestVal <= cornerlon[0]);
+		      lonTest = 1 - lonTest;
+		    }
+		  else
+		    {
+		      lonTest = (lonTestVal >= cornerlon[0] && lonTestVal <= cornerlon[1]);
+		    }
+
+
+		  /*
+		   * If both longitude and latitude are within region set
+		   * flag on for this track
+		   */
+		  if (lonTest + latTest == 2)
+		    {
+		      flag[i] = 1;
+		      found   = 1;
+		      break;
+		    }
+		}
+	    }
+
+
+
+	  /* ANYPOINT search */
+	  /* --------------- */
+	  if (mode == HE5_HDFE_ANYPOINT && rank > 1)
+	    {
+	      if (lonArr != NULL) free(lonArr);
+	      if (latArr != NULL) free(latArr);
+
+	      /* Allocate space for an entire single cross track */
+	      /* ----------------------------------------------- */
+	      lonArr = (char *)calloc(dims[1], sizeof(double));
+	      if(lonArr == NULL)
+		{
+		  H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+		  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+		  if (nt != NULL) free(nt);
+		  if (flag != NULL) free(flag);
+		  return(FAIL);
+		}
+
+	      latArr = (char *)calloc(dims[1], sizeof(double));
+	      if(latArr == NULL)
+		{
+		  H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+		  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+		  free(lonArr);
+		  if (nt != NULL) free(nt);
+		  if (flag != NULL) free(flag);
+		  return(FAIL);
+		}
+
+	      /* Setup start and edge */
+	      /* -------------------- */
+	      anyStart[1] = 0;
+	      anyEdge[0]  = 1;
+	      anyEdge[1]  = dims[1];
+
+
+	      /* For each track ... */
+	      /* ------------------ */
+	      for (i = 0; i < edge[0]; i++)
+		{
+
+		  /* If cross track not in region (with MIDPOINT search ... */
+		  /* ------------------------------------------------------ */
+		  if (flag[i] == 0)
+		    {
+		      /* Setup track start */
+		      /* ----------------- */
+		      anyStart[0] = i;
+
+		      /* Read in lon and lat values for cross track */
+		      /* ------------------------------------------ */
+		      status = HE5_SWreadfield(swathID, "Longitude", anyStart, NULL, anyEdge, lonArr);
+		      if( status  == FAIL )
+			{
+			  H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_READERROR, "Cannot read the \"Longitude\" field. \n");
+			  HE5_EHprint("Error: Cannot read the \"Longitude\" field, occured", __FILE__, __LINE__);
+			  free(lonArr);
+			  free(latArr);
+			  if (nt != NULL) free(nt);
+			  if (flag != NULL) free(flag);
+			  return(FAIL);
+			}
+
+
+		      status = HE5_SWreadfield(swathID, latName, anyStart, NULL, anyEdge, latArr);
+		      if( status == FAIL )
+			{
+			  H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_READERROR, "Cannot read the \"Latitude\" field. \n");
+			  HE5_EHprint("Error: Cannot read the \"Latitude\" field, occured", __FILE__, __LINE__);
+			  free(lonArr);
+			  free(latArr);
+			  if (nt != NULL) free(nt);
+			  if (flag != NULL) free(flag);
+			  return(FAIL);
+			}
+
+
+		      /*
+		       * If geolocation fields are FLOAT32 then cast each
+		       *              entry as FLOAT64
+		       */
+		      datasetid = H5Dopen(HE5_SWXSwath[idx].geo_id, "Longitude");
+		      if(datasetid == FAIL)
+			{
+			  sprintf(errbuf, "Cannot open the dataset.\n");
+			  H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+			  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  free(lonArr);
+			  free(latArr);
+			  if (nt != NULL) free(nt);
+			  if (flag != NULL) free(flag);
+			  return(FAIL);
+			}
+
+		      datatype  = H5Dget_type(datasetid);
+		      if(datatype == FAIL)
+			{
+			  sprintf(errbuf, "Cannot get the data type ID.\n");
+			  H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+			  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  free(lonArr);
+			  free(latArr);
+			  if (nt != NULL) free(nt);
+			  if (flag != NULL) free(flag);
+			  return(FAIL);
+			}
+
+		      size      = H5Tget_size(datatype);
+		      if(size == 0)
+			{
+			  sprintf(errbuf, "Cannot get the data type size.\n");
+			  H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+			  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  free(lonArr);
+			  free(latArr);
+			  if (nt != NULL) free(nt);
+			  if (flag != NULL) free(flag);
+			  return(FAIL);
+			}
+
+		      status    = H5Dclose(datasetid);
+		      if(status == FAIL)
+			{
+			  sprintf(errbuf, "Cannot close the dataset.\n");
+			  H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+			  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  free(lonArr);
+			  free(latArr);
+			  if (nt != NULL) free(nt);
+			  if (flag != NULL) free(flag);
+			  return(FAIL);
+			}
+
+		      if ( H5Tequal( datatype, H5T_NATIVE_FLOAT) ||
+			   H5Tequal( datatype, H5T_IEEE_F32LE) ||
+			   H5Tequal( datatype, H5T_IEEE_F32BE) )
+			{
+			  for (j = dims[1] - 1; j >= 0; j--)
+			    {
+			      memmove(&tempFloat, lonArr + sizeof(float) * j, sizeof(float));
+			      tempDouble = (double)tempFloat;
+			      memmove(lonArr + sizeof(double) * j, &tempDouble, sizeof(double));
+			      memmove(&tempFloat, latArr + sizeof(float) * j, sizeof(float));
+			      tempDouble = (double)tempFloat;
+			      memmove(latArr + sizeof(double) * j, &tempDouble, sizeof(double));
+			    }
+			}
+
+		      /* For each value from Cross Track ... */
+		      /* ----------------------------------- */
+		      for (j = 0; j < dims[1]; j++)
+			{
+			  /* Read in single lon & lat values from buffers */
+			  /* -------------------------------------------- */
+			  memmove(&lonTestVal, &lonArr[ sizeof(double) * j ], sizeof(double));
+			  memmove(&latTestVal, &latArr[ sizeof(double) * j ], sizeof(double));
+
+
+			  /* If lon value > 180 convert to -180 - 180 range */
+			  /* ---------------------------------------------- */
+			  if (lonTestVal > 180)
+			    {
+			      lonTestVal = lonTestVal - 360;
+			    }
+
+			  /* If Colatitude value convert to latitude value */
+			  /* --------------------------------------------- */
+			  if (statCoLat == 0)
+			    {
+			      latTestVal = 90 - latTestVal;
+			    }
+
+
+			  /* Test if lat value is within range */
+			  /* --------------------------------- */
+			  latTest = (latTestVal >= cornerlat[0] && latTestVal <= cornerlat[1]);
+
+			  if (bndflag == 1)
+			    {
+			      /*
+			       * If boundary flag set test whether
+			       * longitude value is outside region and then
+			       * flip
+			       */
+			      lonTest = (lonTestVal >= cornerlon[1] && lonTestVal <= cornerlon[0]);
+			      lonTest = 1 - lonTest;
+			    }
+			  else
+			    {
+			      lonTest = (lonTestVal >= cornerlon[0] && lonTestVal <= cornerlon[1]);
+			    }
+
+
+			  /*
+			   * If both longitude and latitude are within
+			   * region set flag on for this track
+			   */
+			  if (lonTest + latTest == 2)
+			    {
+			      flag[i] = 1;
+			      found   = 1;
+			      break;
+			    }
+			}
+		    }
+		}
+	    }
+
+
+
+	  /* If within region setup Region Structure */
+	  /* --------------------------------------- */
+	  if (found == 1)
+	    {
+	      /* For all entries in SWXRegion array ... */
+	      /* -------------------------------------- */
+	      for (k = 0; k < HE5_NSWATHREGN; k++)
+		{
+		  /*  If empty region ...  */
+		  /* --------------------- */
+		  if ( HE5_SWXRegion[ k ] == 0 )
+		    {
+		      /* Allocate space for region entry */
+		      /* ------------------------------- */
+		      HE5_SWXRegion[ k ] = (struct HE5_swathRegion *) calloc(1, sizeof(struct HE5_swathRegion));
+		      if( HE5_SWXRegion[ k ] == NULL )
+			{
+			  H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");  
+			  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+			  if(lonArr != NULL) free(lonArr);
+			  if(latArr != NULL) free(latArr);
+			  if(flag   != NULL) free(flag);
+			  if(nt != (hid_t *)NULL) free(nt);
+			  return(FAIL);
+			}
+
+		      /* Store file and swath ID */
+		      /* ----------------------- */
+		      HE5_SWXRegion[ k ]->fid     = fid;
+		      HE5_SWXRegion[ k ]->swathID = swathID;
+
+
+		      /* Set Start & Stop Vertical arrays to FAIL */
+		      /* ---------------------------------------- */
+		      for (j = 0; j < HE5_DTSETRANKMAX; j++)
+			{
+			  HE5_SWXRegion[ k ]->StartVertical[j] = FAIL;
+			  HE5_SWXRegion[ k ]->StopVertical[j]  = FAIL;
+			}
+
+		      /* Set region ID */
+		      /* ------------- */
+		      regionID = k;
+		      break;
+		    }
+		}
+
+
+	      /* Find start and stop of regions */
+	      /* ------------------------------ */
+
+	      /* Subtract previous flag value from current one */
+	      /* --------------------------------------------- */
+
+	      /*
+	       * Transisition points will have flag value (+1) start or
+	       * (255 = (uint8_t) -1) stop of region
+	       */
+	      for ( i = edge[0]; i > 0; i-- )
+		flag[ i ] -= flag[i - 1];
+
+
+	      for ( i = 0; i <= edge[0]; i++ )
+		{
+		  /* Start of region */
+		  /* --------------- */
+		  if ( (int)flag[i] == 1 )
+		    {
+		      /* Delyth Jones Moved the increment of the region down */
+		      /*  to next if statement j = ++SWXRegion[k]->nRegions; */
+		      /*  using temp value, if not equal to stop region      */
+		      /*  invalid region otherwise ok Delyth Jones           */
+
+		      tmpVal = HE5_EHhssize2hsize(i + 1);
+		      if ( tmpVal == 0 )
+			{
+			  sprintf(errbuf, "Cannot convert data type. \n");
+			  H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+			  if(lonArr != NULL) free(lonArr);
+			  if(latArr != NULL) free(latArr);
+			  if(flag   != NULL) free(flag);
+			  if(nt != (hid_t *)NULL) free(nt);
+			  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  return(FAIL);
+			}
+		    }
+
+		  /* End of region */
+		  /* ------------- */
+		  if ( (int)flag[i] == 255 )
+		    {
+		      if( tmpVal != i )
+			{
+			  /* Increment (multiple) region counter */
+			  /* ----------------------------------- */
+			  j = ++HE5_SWXRegion[k]->nRegions;
+						  
+			  l = HE5_EHhssize2hsize(i);
+
+			  if (mapstatus == 2)
+			    {
+			      if ((tmpVal - 1) % 2 == 1)
+				tmpVal = tmpVal + 1;
+							  
+			      if ((l-1) % 2 == 0)
+				l = l - 1;
+					   
+			    }
+			  HE5_SWXRegion[k]->StartRegion[j - 1] = HE5_EHhsize2long( (tmpVal - 1) );
+			  if ( HE5_SWXRegion[k]->StartRegion[j - 1] == FAIL )
+			    {
+			      sprintf(errbuf, "Cannot convert data type. \n");
+			      H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+			      if(lonArr != NULL) free(lonArr);
+			      if(latArr != NULL) free(latArr);
+			      if(flag   != NULL) free(flag);
+			      if(nt != (hid_t *)NULL )  free(nt);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+
+			      return(FAIL);
+			    }
+			  idxrange[0] = tmpVal - 1;
+			  HE5_SWXRegion[k]->StopRegion[j - 1] = HE5_EHhsize2long( (l - 1) );
+			  if ( HE5_SWXRegion[k]->StopRegion[j - 1] == FAIL )
+			    {
+			      sprintf(errbuf, "Cannot convert data type. \n");
+			      H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+			      if(lonArr != NULL) free(lonArr);
+			      if(latArr != NULL) free(latArr);
+			      if(flag   != NULL) free(flag);
+			      if(nt != (hid_t *)NULL )  free(nt);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+
+			      return(FAIL);
+			    }
+			  idxrange[1] = l - 1;
+			  validReg = 0;
+			}
+		    }
+
+		}
+
+	    }
+
+	  if(lonArr != NULL) free(lonArr);
+	  if(latArr != NULL) free(latArr);
+	  if(flag   != NULL) free(flag);
+        }
+      if(nt != (hid_t *)NULL)	free(nt);
+    }
+
+  if(validReg != 0)
+    {
+      H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_FUNC, H5E_CANTINIT, "Invalid Region ID. \n");
+      HE5_EHprint("Error: Invalid Region ID, occured", __FILE__, __LINE__);
+      regionID = FAIL;
+    }
+
+ COMPLETION:  
+  return(regionID);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdeftimeperiod                                              |
+|                                                                             |
+|  DESCRIPTION: Finds swath cross tracks observed during time period and      |
+|               returns  period ID                                            |
+|                                                                             |
+|               region ID                                                     |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  periodID       hid_t               Period ID                               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  starttime      double  TAI sec     Start of time period                    |
+|  stoptime       doubel  TAI sec     Stop of time period                     |
+|  mode           int                 Search mode                             |
+|                                     HDFE_MIDPOINT - Use midpoint of Xtrack  |
+|                                     HDFE_ENDPOINT - Use endpoints of Xtrack |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|                                                                             |
+|  8/23/99  A.Muslimov    Changed the datatype of fid from int32_t to hid_t.  |
+| 03/13/00  A.Muslimov    Modified to convert non-native datatypes to native  |
+|                         ones.                                               |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t
+HE5_SWdeftimeperiod(hid_t swathID, double starttime, double stoptime, int mode)
+{
+  hid_t           periodID = FAIL;               /* Period ID (return)     */
+  hid_t           k        = 0;			         /* Loop index             */
+  hid_t           fid      = FAIL;               /* HDF-EOS file ID        */
+  hid_t           gid      = FAIL;               /* "HDFEOS" group ID      */
+
+  int             dum      = 0;			         /* Dummy (loop) variable  */
+  int             rank     = FAIL;               /* Rank of a dataset      */
+
+  herr_t          status   = FAIL;               /* status variable        */
+  herr_t          statTime = FAIL;               /* status variable        */
+
+  hid_t           *nt      = (hid_t *)NULL;      /* number types           */
+
+  unsigned char   found    =  0;                 /* Found flag             */
+
+  long            idx      = FAIL;               /* Swath index            */
+  long            i = 0, j = 0;			         /* Loop indices           */
+  
+  hssize_t        start[2] = {FAIL, FAIL};       /* Start array (read)     */
+
+  hsize_t         dims[HE5_DTSETRANKMAX];        /* Dimens. of geo fields  */
+  hsize_t         stride[2] = {1, 1};            /* Stride array (read)    */
+  hsize_t         edge[2]   = {0, 0};		     /* Edge array (read)      */
+
+  double          timeTest    = 0.;		         /* Time test value        */
+  double          *timeDouble = (double *)NULL;	 /* Time data array        */
+
+  char            dimlist[HE5_HDFE_DIMBUFSIZE];	 /* Dim. list (geo flds)   */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];   /* Error message buffer   */
+
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWdeftimeperiod", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Initialize dims[] array */
+      /* ----------------------- */
+      for (i = 0; i < HE5_DTSETRANKMAX; i++)
+	dims[i] = 0;
+
+      strcpy(dimlist,"");
+
+      /* Get "Time" field info */
+      /* --------------------- */
+      nt = (hid_t *)calloc(1, sizeof(hid_t));
+      if(nt == (hid_t *)NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory.\n");
+	  H5Epush(__FILE__, "HE5_SWdeftimeperiod", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      statTime = HE5_SWfieldinfo(swathID, "Time", &rank, dims, nt, dimlist,NULL);
+      if (statTime != SUCCEED)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "\"Time\" field not found.\n");
+	  H5Epush(__FILE__, "HE5_SWdeftimeperiod", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(nt);
+        }
+
+      if (status == SUCCEED)
+        {
+	  /* Search along entire "Track" dimension from beginning to end */
+	  /* ----------------------------------------------------------- */
+	  start[0] = 0;
+	  edge[0]  = dims[0];
+
+	  /* If 1D geolocation fields then set mode to MIDPOINT */
+	  /* -------------------------------------------------- */
+	  if (rank == 1)
+            {
+	      mode = HE5_HDFE_MIDPOINT;
+            }
+
+	  switch (mode)
+            {
+	      /* If MIDPOINT search single point in middle of "CrossTrack" */
+	      /* --------------------------------------------------------- */
+            case HE5_HDFE_MIDPOINT:
+
+	      start[1] = HE5_EHhsize2hssize(dims[ 1 ]/2);
+	      if ( start[1] == FAIL )
+		{
+		  sprintf(errbuf, "Cannot convert data type. \n");
+		  H5Epush(__FILE__, "HE5_SWdeftimeperiod", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  if (nt != NULL) free(nt);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+	      edge[1]  = 1;
+
+
+	      /* Allocate space for time data */
+	      /* ---------------------------- */
+	      timeDouble = (double *)calloc(edge[0], sizeof(double));
+	      if(timeDouble == NULL)
+                {
+		  sprintf(errbuf, "Cannot allocate memory. \n");
+		  H5Epush(__FILE__, "HE5_SWdeftimeperiod", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (nt != NULL) free(nt);
+		    
+		  return(FAIL);
+                }
+
+
+	      /* Read "Time" field */
+	      /* ----------------- */
+	      status = HE5_SWreadfield(swathID,"Time",start,NULL,edge,timeDouble);
+	      break;
+
+	      /* If ENDPOINT search 2 points at either end of "CrossTrack" */
+	      /* --------------------------------------------------------- */
+            case HE5_HDFE_ENDPOINT:
+	      start[1]  = 0;
+	      stride[1] = dims[1] - 1;
+	      edge[1]   = 2;
+
+	      /* Allocate space for time data */
+	      /* ---------------------------- */
+	      timeDouble = (double *)calloc(edge[0] * 2, sizeof(double));
+	      if(timeDouble == (double *)NULL)
+                {
+		  sprintf(errbuf, "Cannot allocate memory. \n");
+		  H5Epush(__FILE__, "HE5_SWdeftimeperiod", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (nt != NULL) free(nt);
+		    
+		  return(FAIL);
+                }
+				
+	      /* Read "Time" field */
+	      /* ----------------- */
+	      status = HE5_SWreadfield(swathID, "Time", start, stride, edge, timeDouble);
+	      break;
+
+            }
+
+
+	  /* For each track (from top) ... */
+	  /* ----------------------------- */
+	  for (i = 0; i < edge[0]; i++)
+	    {
+	      /* For each value from Cross Track ... */
+	      /* ----------------------------------- */
+	      for (j = 0; j < edge[1]; j++)
+		{
+					
+		  /* Get time test value */
+		  /* ------------------- */
+		  timeTest = timeDouble[i * edge[1] + j];
+					
+		  /* If within time period ... */
+		  /* ------------------------- */
+		  if (timeTest >= starttime && timeTest <= stoptime)
+		    {
+		      /* Set found flag */
+		      /* -------------- */
+		      found = 1;
+						
+		      /* For all entries in SWXRegion array ... */
+		      /* -------------------------------------- */
+		      for (k = 0; k < HE5_NSWATHREGN; k++)
+			{
+			  /* If empty region ... */
+			  /* ------------------- */
+			  if (HE5_SWXRegion[k] == 0)
+			    {
+			      /* Allocate space for region entry */
+			      /* ------------------------------- */
+			      HE5_SWXRegion[k] = (struct HE5_swathRegion *) calloc(1, sizeof(struct HE5_swathRegion));
+			      if(HE5_SWXRegion[k] == NULL)
+				{
+				  sprintf(errbuf, "Cannot allocate memory. \n");
+				  H5Epush(__FILE__, "HE5_SWdeftimeperiod", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+				  HE5_EHprint(errbuf, __FILE__, __LINE__);
+				  if(nt != (hid_t *)NULL) free(nt);
+				  if(timeDouble != (double *)NULL) free(timeDouble);
+									
+				  return(FAIL);
+				}
+								
+			      /* Store file and swath ID */
+			      /* ----------------------- */
+			      HE5_SWXRegion[k]->fid     = fid;
+			      HE5_SWXRegion[k]->swathID = swathID;
+								
+								
+			      /* Set number of isolated regions to 1 */
+			      /* ----------------------------------- */
+			      HE5_SWXRegion[k]->nRegions = 1;
+								
+								
+			      /* Set start of region to first track found */
+			      /* ---------------------------------------- */
+			      HE5_SWXRegion[k]->StartRegion[0] = i;
+								
+								
+			      /* Set Start & Stop Vertical arrays to FAIL */
+			      /* ---------------------------------------- */
+			      for (dum = 0; dum < HE5_DTSETRANKMAX; dum++)
+				{
+				  HE5_SWXRegion[k]->StartVertical[dum] = FAIL;
+				  HE5_SWXRegion[k]->StopVertical[dum]  = FAIL;
+				}
+
+			      /* Set period ID */
+			      /* ------------- */
+			      periodID = k;
+								
+			      break; /* Break from "k" loop */
+			    }
+			}
+		    }
+		  if (found == 1)
+		    {
+		      break;	/* Break from "j" loop */
+		    }
+		}
+	      if (found == 1)
+		{
+		  break;		/* Break from "i" loop */
+		}
+	    }
+			
+			
+	  /* Clear found flag */
+	  /* ---------------- */
+	  found = 0;
+			
+	  /* For each track (from bottom) ... */
+	  /* -------------------------------- */
+	  for (i = edge[0] - 1; i >= 0; i--)
+	    {
+	      /* For each value from Cross Track ... */
+	      /* ----------------------------------- */
+	      for (j = 0; j < edge[1]; j++)
+		{
+		  /* Get time test value */
+		  /* ------------------- */
+		  timeTest = timeDouble[i * edge[1] + j];
+					
+		  /* If within time period ... */
+		  /* ------------------------- */
+		  if (timeTest >= starttime && timeTest <= stoptime)
+		    {
+		      /* Set found flag */
+		      /* -------------- */
+		      found = 1;
+						
+		      /* Set start of region to first track found */
+		      /* ---------------------------------------- */
+		      HE5_SWXRegion[k]->StopRegion[0] = i;
+						
+		      break;	/* Break from "j" loop */
+		    }
+		}
+	      if (found == 1)
+		{
+		  break;		/* Break from "i" loop */
+		}
+	    }
+	  if (timeDouble != (double *)NULL) free(timeDouble);
+	}
+		
+    }
+
+  if (nt != (hid_t *)NULL) free(nt);
+    
+  return (periodID);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWextractregion                                              |
+|                                                                             |
+|  DESCRIPTION: Retrieves data from specified region.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  regionID       hid_t               Region ID                               |
+|  fieldname      char                Fieldname                               |
+|  externalflag   int                 External geolocation fields flag        |
+|                                     HDFE_INTERNAL (0)                       |
+|                                     HDFE_EXTERNAL (1)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  buffer         void                Data buffer containing subsetted region |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+| 10/18/99  A.Muslimov    Replaced memcpy() by memmove() to avoid a problem   |
+|                            when arguments 1 and 2 overlap in memory.        |
+| 04/19/00  A.Muslimov    Changed type of 'slen' from long to size_t.         |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Feb. 03  Terry Haran/                                                      |
+|           Abe Taaheri   Forced map offset to 0 so that data is extracted    |
+|                         without offset consideration. This will preserve    |
+|                         original mapping between geofields and the data     |
+|                         field.                                              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWextractregion(hid_t swathID, hid_t regionID, char *fieldname, int externalflag, void *buffer)
+{
+  herr_t          status     = FAIL;           /* Return status variable      */
+  herr_t          statMap    = FAIL;           /* status variable             */
+
+  int             rank       = FAIL;           /* Field rank                  */
+  int             dum        = FAIL;           /* Dummy (rank) variable       */
+  int             i = 0, j = 0, k = 0;	       /* Loop indices                */
+
+  hid_t           ntype[1]   = {FAIL};         /*  Field number types         */
+  hid_t           dumtype[1] = {FAIL};         /*  Dummy number types         */
+
+  unsigned char   found      =  0;             /* Found flag                  */
+  unsigned char   vfound     =  0;             /* Found flag for vert.subset. */
+
+  hid_t           fid        = FAIL;           /* HDF-EOS file ID             */
+  hid_t     	  gid        = FAIL;           /* "HDFEOS" group ID           */
+  hid_t           fieldID    = FAIL;           /* Field dataset ID            */
+
+  long 	          idx        = FAIL;           /* Swath index                 */
+  long            index      = FAIL;           /* Geo Dim Index               */
+  long            nDim       =  0;             /* Number of dimensions        */
+  long            offset     = FAIL;           /* Mapping offset              */
+  long            incr       = FAIL;           /* Mapping increment           */
+  long	          *idxmap    = (long *)NULL;   /* Index mapping array         */
+  long            nXtrk      = 0;              /* Number of cross tracks      */
+
+  size_t          bufOffset  = 0;              /* Output buffer offset        */
+  size_t          size       = 0;              /* Size of data buffer         */
+  size_t          slen[HE5_DTSETRANKMAX];      /* String length array         */
+ 
+  hssize_t        start[HE5_DTSETRANKMAX];     /* Start array for data read   */
+
+  hsize_t 	  idxMapElem = 0;              /* Number of idxmap elements   */
+  hsize_t         dumsize    = 0;              /*  Dummy size variable        */
+  hsize_t         dumdims[HE5_DTSETRANKMAX];   /* Dimensions array            */
+  hsize_t         edge[HE5_DTSETRANKMAX];      /* Edge array for data read    */
+  hsize_t         dims[HE5_DTSETRANKMAX];      /* Dimensions                  */
+
+  char            dimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list              */
+  char            geodim[HE5_HDFE_DIMBUFSIZE]; /* Geolocation dimension list  */
+  char            tgeodim[HE5_HDFE_DIMBUFSIZE];/* Time field dimension list   */
+  char            utlbuf[HE5_HDFE_DIMBUFSIZE]; /* Utility buffer              */
+  char            *ptr[HE5_DTSETRANKMAX];      /* String pointer array        */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* error message buffer        */
+
+  CHECKPOINTER(fieldname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWextractregion", &fid, &gid, &idx);
+
+  /* Check for valid region ID */
+  /* ------------------------- */
+  if (status == SUCCEED)
+    {
+      if (regionID < 0 || regionID >= HE5_NSWATHREGN)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "Invalid Region ID: %d.\n", regionID);
+	  H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+    }
+
+  /* Check for active region ID */
+  /* -------------------------- */
+  if (status == SUCCEED)
+    {
+      if (HE5_SWXRegion[regionID] == 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "Inactive Region ID: %d.\n", regionID);
+	  H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+    }
+
+  /* Check that geo file and data file are same for INTERNAL subsetting */
+  /* ------------------------------------------------------------------ */
+  if (status == SUCCEED)
+    {
+      if (HE5_SWXRegion[regionID]->fid != fid && externalflag != HE5_HDFE_EXTERNAL)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "Region is not defined for this file.\n");
+	  H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+    }
+
+  /* Check that geo swath and data swath are same for INTERNAL subsetting */
+  /* -------------------------------------------------------------------- */
+  if (status == SUCCEED)
+    {
+      if (HE5_SWXRegion[regionID]->swathID != swathID && externalflag != HE5_HDFE_EXTERNAL)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "Region is not defined for this SWath.\n");
+	  H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+    }
+
+  /* Check for valid fieldname */
+  /* ------------------------- */
+  if (status == SUCCEED)
+    {
+      /* Initialize dims[] array */
+      /* ----------------------- */
+      for (i = 0; i < HE5_DTSETRANKMAX; i++)
+	dims[i] = 0;
+
+      /* Get data field info */
+      /* ------------------- */
+      strcpy(dimlist,"");
+      status = HE5_SWfieldinfo(swathID, fieldname, &rank, dims, ntype, dimlist, NULL);
+      if (status != SUCCEED)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "Fieldname \"%s\" not found.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+    }
+
+  /* No problems so proceed ... */
+  /* -------------------------- */
+  if (status == SUCCEED)
+    {
+      /* Initialize start and edge for all dimensions */
+      /* -------------------------------------------- */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i] = 0;
+	  edge[i]  = dims[i];
+        }
+
+      /* Vertical Subset */
+      /* --------------- */
+      for (j = 0; j < HE5_DTSETRANKMAX; j++)
+        {
+	  /* If active vertical subset ... */
+	  /* ----------------------------- */
+	  if (HE5_SWXRegion[regionID]->StartVertical[j] != FAIL)
+            {
+	      /* Find vertical dimension within dimlist */
+	      /* -------------------------------------- */
+	      dum = HE5_EHlong2int(HE5_EHstrwithin(HE5_SWXRegion[regionID]->DimNamePtr[j],dimlist, ',') );
+	      if ( dum == FAIL )
+		{
+		  sprintf(errbuf, "Cannot convert data type. \n");
+		  H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+	      /* If dimension found ... */
+	      /* ---------------------- */
+	      if (dum != FAIL)
+                {
+		  /* Compute start and edge for vertical dimension */
+		  /* --------------------------------------------- */
+		  vfound = 1;
+		  start[dum] = HE5_SWXRegion[regionID]->StartVertical[j];
+		  edge[dum]  = HE5_SWXRegion[regionID]->StopVertical[j] - HE5_SWXRegion[regionID]->StartVertical[j] + 1;
+                }
+	      else
+                {
+		  /* Vertical dimension not found */
+		  /* ---------------------------- */
+		  status = FAIL;
+		  sprintf(errbuf, "Vertical Dimension Not Found: \"%s\".\n", HE5_SWXRegion[regionID]->DimNamePtr[j]);
+		  H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+                }
+            }
+        }
+
+
+
+      /* No problems so proceed ... */
+      /* -------------------------- */
+      if (status == SUCCEED)
+        {
+	  /* If non-vertical subset regions defined ... */
+	  /* ------------------------------------------ */
+	  if (HE5_SWXRegion[regionID]->nRegions > 0)
+            {
+	      /* Initialize dumdims[] array */
+	      /* -------------------------- */
+	      for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+		dumdims[i] = 0;
+
+	      /* Get geolocation dimension name */
+	      /* ------------------------------ */
+	      strcpy(geodim,"");
+
+	      status = HE5_SWfieldinfo(HE5_SWXRegion[regionID]->swathID, "Longitude", &dum, dumdims, dumtype, geodim, NULL);
+
+	      /* If Time field being used, check for dimensions */
+	      /* ---------------------------------------------- */
+	      if (HE5_timeflag == 1)
+                {
+		  /* code change to fix time subset bug for Landsat7 */
+		  strcpy(tgeodim,"");
+		  status = HE5_SWfieldinfo(HE5_SWXRegion[regionID]->swathID,"Time", &dum, dumdims, dumtype, tgeodim, NULL);
+
+		  if (strcmp(geodim, tgeodim) != 0)
+		    {
+                      strcpy(geodim, tgeodim);
+		    }
+                }
+	      HE5_timeflag = 0;
+
+	      /* Initialize slen[] array */
+	      /* ----------------------- */
+	      for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+		slen[i] = 0;
+
+	      /* Get "Track" (first) Dimension from geo dimlist */
+	      /* ---------------------------------------------- */
+	      nDim = HE5_EHparsestr(geodim, ',', ptr, slen);
+	      geodim[slen[0]] = 0;
+
+	      /* Parse Data Field Dimlist & find mapping */
+	      /* --------------------------------------- */
+	      nDim = HE5_EHparsestr(dimlist, ',', ptr, slen);
+
+	      /* Loop through all dimensions and search for mapping */
+	      /* -------------------------------------------------- */
+	      strcpy(utlbuf,"");
+	      for (i = 0; i < nDim; i++)
+                {
+		  memmove(utlbuf, ptr[i], slen[i]);
+		  utlbuf[slen[i]] = 0;
+		  statMap = HE5_SWmapinfo(swathID, geodim, utlbuf,&offset, &incr);
+
+		  /*
+		   *  Force offset to 0.
+		   *  We're not changing the mapping, so we want
+		   *  the original offset to apply to the subsetted data.
+		   *  Otherwise, bad things happen, such as subsetting
+		   *  past the end of the original data, and being unable
+		   *  to read the first <offset> elements of the
+		   *  original data.
+		   *  The offset is only important for aligning the
+		   *  data with interpolated (incr > 0) or decimated
+		   *  (incr < 0) geolocation information for the data.
+		   */
+ 
+		  offset = 0;
+
+		  /* Mapping found */
+		  /* ------------- */
+		  if (statMap == SUCCEED)
+                    {
+		      found = 1;
+		      index = i;
+		      break;
+                    }
+                }
+
+
+	      /* If mapping not found check for geodim within dimlist */
+	      /* ---------------------------------------------------- */
+	      if (found == 0)
+                {
+		  index = HE5_EHstrwithin(geodim, dimlist, ',');
+
+		  /* Geo dimension found within subset field dimlist */
+		  /* ----------------------------------------------- */
+		  if (index != FAIL)
+                    {
+		      found  = 1;
+		      offset = 0;
+		      incr   = 1;
+                    }
+                }
+
+	      /* If mapping not found check for indexed mapping */
+	      /* ---------------------------------------------- */
+	      if (found == 0)
+                {
+		  /* Get size of geo dim & allocate space of index mapping */
+		  /* ----------------------------------------------------- */
+		  dumsize = HE5_SWdiminfo(swathID, geodim);
+		  if(dumsize == 0)
+                    {
+		      H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot get the dimension size. \n"); 
+		      HE5_EHprint("Error: Cannot get the dimension size, occured", __FILE__, __LINE__);
+		      return(FAIL);
+                    }
+
+		  idxmap  = (long *)calloc(dumsize, sizeof(long));
+		  if(idxmap == NULL)
+                    {
+		      H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); 
+		      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+		      return(FAIL);
+                    }
+
+		  /* Loop through all dimensions and search for mapping */
+		  /* -------------------------------------------------- */
+		  strcpy(utlbuf,"");
+		  for (i = 0; i < nDim; i++)
+                    {
+		      memmove(utlbuf, ptr[i], slen[i]);
+		      utlbuf[slen[i]] = 0;
+		      idxMapElem = HE5_SWidxmapinfo(swathID, geodim, utlbuf, idxmap);
+
+		      /* Mapping found */
+		      /* ------------- */
+		      if (idxMapElem > 0)
+                        {
+			  found = 1;
+			  index = i;
+			  break;
+                        }
+                    }
+                }
+
+
+	      /* If regular mapping found ... */
+	      /* ---------------------------- */
+	      if (found == 1 && idxMapElem == 0)
+                {
+		  for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++)
+                    {
+		      if (k > 0)
+                        {
+			  /* Compute size in bytes of previous region */
+			  /* ---------------------------------------- */
+			  size = edge[0];
+			  for (j = 1; j < rank; j++)
+                            {
+			      size *= edge[j];
+                            }
+			  size *= HE5_SWfieldsizeID(swathID, fieldname, &fieldID);
+
+
+			  /* Compute output buffer offset */
+			  /* ---------------------------- */
+			  bufOffset += size;
+                        }
+		      else
+                        {
+			  /* Initialize output buffer offset */
+			  /* ------------------------------- */
+			  bufOffset = 0;
+                        }
+
+
+		      /* Compute number of cross tracks in region */
+		      /* ---------------------------------------- */
+		      nXtrk = HE5_SWXRegion[regionID]->StopRegion[k] - HE5_SWXRegion[regionID]->StartRegion[k] + 1;
+
+
+		      /* Positive increment (geodim <= datadim) */
+		      /* -------------------------------------- */
+		      if (incr > 0)
+                        {
+			  start[index] = HE5_SWXRegion[regionID]->StartRegion[k] * incr + offset;
+			  edge[index]  = nXtrk * incr;
+                        }
+		      else
+                        {
+			  /* Negative increment (geodim > datadim) */
+			  /* ------------------------------------- */
+			  start[index] = HE5_SWXRegion[regionID]->StartRegion[k] / (-incr) + offset;
+			  edge[index]  = nXtrk / (-incr);
+
+			  /*
+			   * If Xtrk not exactly divisible by incr, round
+			   * edge to next highest integer
+			   */
+
+			  if (nXtrk % (-incr) != 0)
+                            {
+			      edge[index]++;
+                            }
+                        }
+
+
+		      /* Read Data into output buffer */
+		      /* ---------------------------- */
+		      status = HE5_SWreadfield(swathID, fieldname,start, NULL, edge,(unsigned char *) buffer + bufOffset);
+                    }
+                }
+	      else if (found == 1 && idxMapElem > 0)
+                {
+		  /* Indexed Mapping */
+		  /* --------------- */
+		  for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++)
+                    {
+		      if (k > 0)
+                        {
+			  /* Compute size in bytes of previous region */
+			  /* ---------------------------------------- */
+			  size = edge[0];
+			  for (j = 1; j < rank; j++)
+                            {
+			      size *= edge[j];
+                            }
+			  size *= HE5_SWfieldsizeID(swathID,fieldname, &fieldID);
+
+			  /* Compute output buffer offset */
+			  /* ---------------------------- */
+			  bufOffset += size;
+                        }
+		      else
+                        {
+			  /* Initialize output buffer offset */
+			  /* ------------------------------- */
+			  bufOffset = 0;
+                        }
+
+		      /* Compute start & edge from index mappings */
+		      /* ---------------------------------------- */
+		      start[index] = idxmap[HE5_SWXRegion[regionID]->StartRegion[k]];
+		      edge[index]  = idxmap[HE5_SWXRegion[regionID]->StopRegion[k]] - idxmap[HE5_SWXRegion[regionID]->StartRegion[k]] + 1;
+
+		      /* Read Data into output buffer */
+		      /* ---------------------------- */
+		      status = HE5_SWreadfield(swathID, fieldname, start, NULL, edge,(unsigned char *)buffer + bufOffset);
+                    }
+                }
+	      else if(vfound == 1)
+                {
+		  /* Vertical subsetting found previously, */
+		  /* read out data buffer  (xhua)          */
+		  status = HE5_SWreadfield(swathID, fieldname, start, NULL, edge, (unsigned char *)buffer);
+                }
+	      else
+                {
+		  /* Mapping not found */
+		  /* ----------------- */
+		  status = FAIL;
+		  sprintf(errbuf,"Mapping Not Defined for \"%s\" Dimension.\n", geodim);
+                }
+            }
+	  else
+            {
+	      /* Read Data (Vert SS only) */
+	      /* ------------------------ */
+	      status = HE5_SWreadfield(swathID, fieldname, start, NULL,  edge,(unsigned char *)buffer);
+            }
+        }
+    }
+  /* Free index mappings if applicable */
+  /* --------------------------------- */
+  if (idxmap != NULL)  free(idxmap);
+
+ COMPLETION:
+  return (status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWextractperiod                                              |
+|                                                                             |
+|  DESCRIPTION: Retrieves data from specified period.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  periodID       hid_t               Period ID                               |
+|  fieldname      char                Fieldname                               |
+|  externalflag   int                 External geolocation fields flag:       |
+|                                                                             |
+|                                     HDFE_INTERNAL (0)                       |
+|                                     HDFE_EXTERNAL (1)                       |
+|  OUTPUTS:                                                                   |
+|  buffer         void                Data buffer containing subsetted region |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWextractperiod(hid_t swathID, hid_t periodID, char *fieldname, int externalflag, void *buffer)
+{
+  herr_t          status = FAIL;/* routine return status variable */
+
+  HE5_timeflag           = 1;
+
+  CHECKPOINTER(fieldname);
+
+  /* Call SWextractregion routine */
+  /* ---------------------------- */
+  status = HE5_SWextractregion(swathID, periodID, fieldname, externalflag, (char *)buffer);
+
+ COMPLETION:
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdupregion                                                  |
+|                                                                             |
+|  DESCRIPTION: Duplicates a region                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  newregionID    hid_t               New region ID                           |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  oldregionID    hid_t               Old region ID                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======   ============  =================================================  |
+|  July 00   A.Muslimov    Unmasked hdf5 data types.                          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t 
+HE5_SWdupregion(hid_t oldregionID)
+{
+  hid_t   newregionID = FAIL;/* New region ID (return) */
+  hid_t   i;			     /* Loop index             */
+
+
+  /* Find first empty (inactive) region */
+  /* ---------------------------------- */
+  for (i = 0; i < HE5_NSWATHREGN; i++)
+    {
+      if (HE5_SWXRegion[ i ] == 0)
+        {
+	  /* Allocate space for new swath region entry */
+	  /* ----------------------------------------- */
+	  HE5_SWXRegion[ i ] = (struct HE5_swathRegion *) calloc(1, sizeof(struct HE5_swathRegion));
+	  if(HE5_SWXRegion[ i ] == NULL)
+            {
+	      H5Epush(__FILE__, "HE5_SWdupregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n");
+	      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	      return(FAIL);
+            }
+
+	  /* Copy old region structure data to new region */
+	  /* -------------------------------------------- */
+	  *HE5_SWXRegion[ i ] = *HE5_SWXRegion[ oldregionID ];
+
+	  /* Define new region ID */
+	  /* -------------------- */
+	  newregionID = i;
+
+	  break;
+        }
+    }
+
+  return (newregionID);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefvrtregion                                               |
+|                                                                             |
+|  DESCRIPTION: Finds elements of a monotonic field within a given range.     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  regionID       hid_t               Region ID                               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  regionID       hid_t               Region ID                               |
+|  vertObj        char                Vertical object to subset               |
+|  range          double              Vertical subsetting range               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+| 10/18/99  A.Muslimov Replaced memcpy() by memmove() to avoid a problem      |
+|                            when arguments 1 and 2 overlap in memory.        |
+| 03/13/00  A.Muslimov Modified to convert non-native datatypes to            |
+|                              native ones.                                   |
+|                                                                             |
+|  July 00   A.Muslimov   Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  Mar  04  S.Zhao        Modified for supported field type.                  |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+
+
+/* Macro to initialize swath region entry */
+/* -------------------------------------- */
+
+/*
+ * 1) Find empty (inactive) region. 2) Allocate space for region entry. 3)
+ * Store file ID and swath ID. 4) Set region ID. 5) Initialize vertical
+ * subset entries to FAIL.
+ */
+
+#define HE5_SETSWTHREG						\
+								\
+  for (k = 0; k < HE5_NSWATHREGN; k++)				\
+    {								\
+      if (HE5_SWXRegion[k] == 0)				\
+	{							\
+	  HE5_SWXRegion[k] = (struct HE5_swathRegion *)		\
+	    calloc(1, sizeof(struct HE5_swathRegion));		\
+	  HE5_SWXRegion[k]->fid = fid;				\
+	  HE5_SWXRegion[k]->swathID = swathID;			\
+	  regionID = k;						\
+	  for (j = 0; j < HE5_DTSETRANKMAX; j++)		\
+	    {							\
+	      HE5_SWXRegion[k]->StartVertical[j] = FAIL;	\
+	      HE5_SWXRegion[k]->StopVertical[j]  = FAIL;	\
+	    }							\
+	  break;						\
+	}							\
+    }
+
+
+/* Macro to fill vertical subset entry */
+/* ----------------------------------- */
+
+/*
+ * 1) Find empty (inactive) vertical region. 2) Set start of vertical region.
+ * 3) Allocate space for name of vertical dimension. 4) Write vertical
+ * dimension name.
+ */
+
+
+#define HE5_FILLVERTREG						\
+  for (j = 0; j < HE5_DTSETRANKMAX; j++)			\
+    {								\
+      if (HE5_SWXRegion[regionID]->StartVertical[j] == FAIL)	\
+	{							\
+	  HE5_SWXRegion[regionID]->StartVertical[j] = i;	\
+	  HE5_SWXRegion[regionID]->DimNamePtr[j] =		\
+            (char *)calloc( (slen + 1), sizeof(char) );		\
+	  memmove(HE5_SWXRegion[regionID]->DimNamePtr[j],	\
+		  dimlist, slen + 1);				\
+	  break;						\
+	}							\
+    }
+
+
+hid_t 
+HE5_SWdefvrtregion(hid_t swathID, hid_t regionID, char *vertObj, double range[])
+{
+
+  hid_t           fid       = FAIL;/* HDF-EOS file ID                     */
+  hid_t           gid       = FAIL;/* "HDFEOS" group ID                   */
+  hid_t     	  dtype     = FAIL;/* Data type ID                        */
+  hid_t           fieldID   = FAIL;/* Field related dataset ID            */
+  hid_t           k         = 0;   /* Loop index                          */
+
+  herr_t          status    = FAIL;/* routine return status variable      */
+
+  int             vertINT   = 0;   /* Temporary INT variable              */
+  int             rank      = FAIL;/* Field rank                          */
+  int     	      temp      = FAIL;/* Temporary data type code            */
+  int             j         = 0;   /* Loop index                          */
+
+  hid_t           *nt       = (hid_t *)NULL;     /*  number types         */
+
+  unsigned char   found     =  0;   /* Found flag                         */
+
+  long            idx       = FAIL; /* Swath index                        */
+  long            slen      = 0;    /* String length                      */
+  long            i         = 0;    /* Loop index                         */
+ 
+  hsize_t         dims[HE5_DTSETRANKMAX];/* Field dimensions              */
+
+  size_t          size      = 0;     /* Size of numbertype in bytes       */
+
+  short           vertSHT   = 0;	 /* Temporary SHORT variable          */
+
+  float           vertFLT   = 0.;	 /* Temporary FLOAT variable          */
+
+  double          vertDBL   = 0.;	 /* Temporary DOUBLE variable         */
+
+  char            *vertArr = (char *)NULL;/* Ptr to vrt field data buffer */
+  char            dimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list          */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */
+
+  HE5_LOCK;
+  CHECKPOINTER(vertObj);
+  CHECKPOINTER(range);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWdefvrtregion", &fid, &gid, &idx);
+
+  strcpy(dimlist,"");
+
+  if (status == SUCCEED)
+    {
+      /* Copy first 4 characters of vertObj into dimlist */
+      /* ----------------------------------------------- */
+      memmove(dimlist, vertObj, 4);
+      dimlist[4] = 0;
+
+      /* If first 4 characters of vertObj = "DIM:" ... */
+      /* --------------------------------------------- */
+
+      /* Vertical Object is dimension name */
+      /* --------------------------------- */
+      if (strcmp(dimlist, "DIM:") == 0)
+        {
+	  /* Get string length of vertObj (minus "DIM:) */
+	  /* ------------------------------------------ */
+	  slen = strlen(vertObj) - 4;
+
+	  /* Setup swath region entry */
+	  /* ------------------------ */
+	  if (regionID == FAIL)
+            {
+	      HE5_SETSWTHREG;
+            }
+
+	  /* Find first empty (inactive) vertical subset entry */
+	  /* ------------------------------------------------- */
+	  for (j = 0; j < HE5_DTSETRANKMAX; j++)
+            {
+	      if (HE5_SWXRegion[regionID]->StartVertical[j] == FAIL)
+                {
+		  /* Store start & stop of vertical region */
+		  /* ------------------------------------- */
+		  HE5_SWXRegion[regionID]->StartVertical[j] = (long)range[0];
+		  HE5_SWXRegion[regionID]->StopVertical[j]  = (long)range[1];
+
+		  /* Store vertical dimension name */
+		  /* ----------------------------- */
+		  HE5_SWXRegion[regionID]->DimNamePtr[j] = (char *)calloc( (slen + 1), sizeof(char) );
+		  if(HE5_SWXRegion[regionID]->DimNamePtr[j] == NULL)
+                    {
+		      H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n");
+		      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+
+		      return(FAIL);
+                    }
+		  memmove(HE5_SWXRegion[regionID]->DimNamePtr[j], vertObj + 4, slen + 1);
+		  break;
+                }
+            }
+        }
+      else
+        {
+	  /* Check for valid fieldname */
+	  /* ------------------------- */
+	  nt = (hid_t *)calloc(1, sizeof(hid_t));
+	  if ( nt == (hid_t *)NULL )
+	    {
+	      status = FAIL;
+	      sprintf( errbuf,"Cannot allocate memory for data type class ID.\n");
+	      H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+		  
+	  /* Initialize dims[] array */
+	  /* ----------------------- */
+	  for ( j = 0; j < HE5_DTSETRANKMAX; j++)
+	    dims[j] = 0;
+
+	  /* Get field information */
+	  /* --------------------- */
+	  status = HE5_SWfieldinfo(swathID, vertObj, &rank, dims, nt,dimlist,NULL);
+	  if (status != SUCCEED)
+            {
+	      status = FAIL;
+	      sprintf(errbuf,"Vertical Field: \"%s\" not found.\n", vertObj);
+	      H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (nt != NULL) free(nt);
+            }
+
+	  /* Get field ID and field data type */
+	  /* ------------------------------- */
+	  HE5_SWfieldsizeID(swathID, vertObj, &fieldID);
+	  dtype = H5Dget_type( fieldID);
+
+	  /* Check for supported field type */
+	  /* ------------------------------ */
+	  if (!H5Tequal(dtype, H5T_NATIVE_SHORT)  &&
+	      !H5Tequal(dtype, H5T_STD_I16BE) &&
+	      !H5Tequal(dtype, H5T_STD_I16LE) &&
+	      !H5Tequal(dtype, H5T_NATIVE_INT)    &&
+	      !H5Tequal(dtype, H5T_STD_I32BE)     &&
+	      !H5Tequal(dtype, H5T_STD_I32LE)     &&
+	      !H5Tequal(dtype, H5T_NATIVE_FLOAT)  &&
+	      !H5Tequal(dtype, H5T_IEEE_F32BE)    &&
+	      !H5Tequal(dtype, H5T_IEEE_F32LE)    &&
+	      !H5Tequal(dtype, H5T_NATIVE_DOUBLE) &&
+	      !H5Tequal(dtype, H5T_IEEE_F64BE)    &&
+	      !H5Tequal(dtype, H5T_IEEE_F64LE))
+	    {
+	      status = FAIL;
+	      sprintf(errbuf,"Fieldtype not supported for vertical subsetting");
+	      H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (nt != NULL) free(nt);		
+	    }
+
+
+	  if ( H5Tequal( dtype, H5T_NATIVE_SHORT) ||
+	       H5Tequal( dtype, H5T_STD_I16BE) ||
+	       H5Tequal( dtype, H5T_STD_I16LE) )
+	    temp = 1;
+	  else if ( H5Tequal(dtype, H5T_NATIVE_INT) ||
+		    H5Tequal(dtype, H5T_STD_I32BE) ||
+		    H5Tequal(dtype, H5T_STD_I32LE) )
+	    temp = 2;
+	  else if ( H5Tequal( dtype, H5T_NATIVE_FLOAT) ||
+		    H5Tequal( dtype, H5T_IEEE_F32BE) ||
+		    H5Tequal( dtype, H5T_IEEE_F32LE) )
+	    temp = 3;
+	  else if ( H5Tequal(dtype, H5T_NATIVE_DOUBLE) ||
+		    H5Tequal(dtype, H5T_IEEE_F64BE) ||
+		    H5Tequal(dtype, H5T_IEEE_F64LE) )
+	    temp = 4;
+
+
+	  /* Check that vertical dimension is 1D */
+	  /* ----------------------------------- */
+	  if (status == SUCCEED)
+            {
+	      if (rank != 1)
+                {
+		  status = FAIL;
+		  sprintf(errbuf, "Vertical Field: \"%s\" must be 1-dim.\n", vertObj);
+		  H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (nt != NULL) free(nt);
+                }
+            }
+
+
+	  /* If no problems then continue */
+	  /* ---------------------------- */
+	  if (status == SUCCEED)
+            {
+	      /* Get string length of vertical dimension */
+	      /* --------------------------------------- */
+	      slen = strlen(dimlist);
+
+	      /* Get size in bytes of vertical field numbertype */
+	      /* ---------------------------------------------- */
+	      size = HE5_SWfieldsizeID(swathID,vertObj, &fieldID);
+
+	      /* Allocate space for vertical field */
+	      /* --------------------------------- */
+	      vertArr = (char *)calloc(dims[0], size);
+	      if(vertArr == NULL)
+                {
+		  H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+		  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+                  if (nt != NULL) free(nt);
+		  return(FAIL);
+                }
+
+	      /* Read vertical field */
+	      /* ------------------- */
+	      status = HE5_SWreadfield(swathID, vertObj, NULL, NULL, NULL, vertArr);
+
+	      switch (temp)
+                {
+                case 1:
+
+		  for (i = 0; i < dims[0]; i++)
+                    {
+		      /* Get single element of vertical field */
+		      /* ------------------------------------ */
+		      memmove(&vertINT, vertArr + i * size, size);
+
+		      /* If within range ... */
+		      /* ------------------- */
+		      if (vertINT >= range[0] && vertINT <= range[1])
+                        {
+			  /* Set found flag */
+			  /* -------------- */
+			  found = 1;
+
+			  /* Setup swath region entry */
+			  /* ------------------------ */
+			  if (regionID == FAIL)
+                            {
+			      HE5_SETSWTHREG;
+                            }
+
+			  /* Fill-in vertical region entries */
+			  /* ------------------------------- */
+			  HE5_FILLVERTREG;
+
+			  break;
+                        }
+                    }
+
+
+		  /* If found read from "bottom" of data field */
+		  /* ----------------------------------------- */
+		  if (found == 1)
+                    {
+		      for (i = dims[0] - 1; i >= 0; i--)
+                        {
+			  /* Get single element of vertical field */
+			  /* ------------------------------------ */
+			  memmove(&vertINT, vertArr + i * size, size);
+
+			  /* If within range ... */
+			  /* ------------------- */
+			  if (vertINT >= range[0] && vertINT <= range[1])
+                            {
+			      /* Set end of vertical region */
+			      /* -------------------------- */
+			      HE5_SWXRegion[regionID]->StopVertical[j] = i;
+			      break;
+                            }
+                        }
+                    }
+		  else
+                    {
+		      /* No vertical entries within region */
+		      /* --------------------------------- */
+		      status = FAIL;
+		      sprintf(errbuf, "No vertical field entries within region.\n");
+		      H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); 
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      if (nt != NULL) free(nt);
+			
+                    }
+		  break;
+
+                case 2:
+
+		  for (i = 0; i < dims[0]; i++)
+                    {
+		      /* Get single element of vertical field */
+		      /* ------------------------------------ */
+		      memmove(&vertSHT, vertArr + i * size, size);
+
+		      /* If within range ... */
+		      /* ------------------- */
+		      if (vertSHT >= range[0]  && vertSHT <= range[1])
+                        {
+			  /* Set found flag */
+			  /* -------------- */
+			  found = 1;
+
+			  /* Setup swath region entry */
+			  /* ------------------------ */
+			  if (regionID == FAIL)
+			    {
+			      HE5_SETSWTHREG;
+			    }
+
+			  /* Fill-in vertical region entries */
+			  /* ------------------------------- */
+			  HE5_FILLVERTREG;
+
+			  break;
+                        }
+                    }
+
+
+		  /* If found read from "bottom" of data field */
+		  /* ----------------------------------------- */
+		  if (found == 1)
+                    {
+		      for (i = dims[0] - 1; i >= 0; i--)
+                        {
+			  /* Get single element of vertical field */
+			  /* ------------------------------------ */
+			  memmove(&vertSHT, vertArr + i * size, size);
+
+			  /* If within range ... */
+			  /* ------------------- */
+			  if (vertSHT >= range[0] && vertSHT <= range[1])
+                            {
+			      /* Set end of vertical region */
+			      /* -------------------------- */
+			      HE5_SWXRegion[regionID]->StopVertical[j] = i;
+			      break;
+                            }
+                        }
+                    }
+		  else
+                    {
+		      /* No vertical entries within region */
+		      /* --------------------------------- */
+		      status = FAIL;
+		      sprintf(errbuf, "No vertical field entries within region.\n");
+		      H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); 
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      if (nt != NULL) free(nt);
+			
+                    }
+		  break;
+
+                case 3:
+
+		  for (i = 0; i < dims[0]; i++)
+                    {
+		      /* Get single element of vertical field */
+		      /* ------------------------------------ */
+		      memmove(&vertFLT, vertArr + i * size, size);
+
+
+		      /* If within range ... */
+		      /* ------------------- */
+		      if (vertFLT >= range[0] && vertFLT <= range[1])
+                        {
+			  /* Set found flag */
+			  /* -------------- */
+			  found = 1;
+
+
+			  /* Setup swath region entry */
+			  /* ------------------------ */
+			  if (regionID == FAIL)
+                            {
+			      HE5_SETSWTHREG;
+                            }
+
+
+			  /* Fill-in vertical region entries */
+			  /* ------------------------------- */
+			  HE5_FILLVERTREG;
+
+			  break;
+                        }
+                    }
+
+
+		  /* If found read from "bottom" of data field */
+		  /* ----------------------------------------- */
+		  if (found == 1)
+                    {
+		      for (i = dims[0] - 1; i >= 0; i--)
+                        {
+			  /* Get single element of vertical field */
+			  /* ------------------------------------ */
+			  memmove(&vertFLT, vertArr + i * size, size);
+
+			  /* If within range ... */
+			  /* ------------------- */
+			  if (vertFLT >= range[0] && vertFLT <= range[1])
+                            {
+			      /* Set end of vertical region */
+			      /* -------------------------- */
+			      HE5_SWXRegion[regionID]->StopVertical[j] = i;
+			      break;
+                            }
+                        }
+                    }
+		  else
+                    {
+		      /* No vertical entries within region */
+		      /* --------------------------------- */
+		      status = FAIL;
+		      sprintf(errbuf, "No vertical field entries within region.\n");
+		      H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); 
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      if (nt != NULL) free(nt);
+			
+                    }
+		  break;
+
+                case 4:
+
+		  for (i = 0; i < dims[0]; i++)
+                    {
+		      /* Get single element of vertical field */
+		      /* ------------------------------------ */
+		      memmove(&vertDBL, vertArr + i * size, size);
+
+
+		      /* If within range ... */
+		      /* ------------------- */
+		      if (vertDBL >= range[0] && vertDBL <= range[1])
+                        {
+			  /* Set found flag */
+			  /* -------------- */
+			  found = 1;
+
+
+			  /* Setup swath region entry */
+			  /* ------------------------ */
+			  if (regionID == FAIL)
+                            {
+			      HE5_SETSWTHREG;
+                            }
+
+
+			  /* Fill-in vertical region entries */
+			  /* ------------------------------- */
+			  HE5_FILLVERTREG;
+
+			  break;
+                        }
+                    }
+
+
+		  /* If found read from "bottom" of data field */
+		  /* ----------------------------------------- */
+		  if (found == 1)
+                    {
+		      for (i = dims[0] - 1; i >= 0; i--)
+                        {
+			  /* Get single element of vertical field */
+			  /* ------------------------------------ */
+			  memmove(&vertDBL, vertArr + i * size, size);
+
+			  /* If within range ... */
+			  /* ------------------- */
+			  if (vertDBL >= range[0] && vertDBL <= range[1])
+                            {
+			      /* Set end of vertical region */
+			      /* -------------------------- */
+			      HE5_SWXRegion[regionID]->StopVertical[j] = i;
+			      break;
+                            }
+                        }
+                    }
+		  else
+                    {
+		      /* No vertical entries within region */
+		      /* --------------------------------- */
+		      status = FAIL;
+		      sprintf(errbuf, "No vertical field entries within region.\n");
+		      H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); 
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      if (nt != NULL) free(nt);
+			
+                    }
+		  break;
+
+                } /* End of switch */
+	      if (vertArr != NULL) free(vertArr);
+            }
+        }
+    }
+
+  if(nt != (hid_t *)NULL) 
+    free(nt);
+
+
+ COMPLETION:
+  
+  if (status == FAIL)
+    regionID = FAIL;
+
+  HE5_UNLOCK;  
+  return(regionID);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWsetfillvalue                                               |
+|                                                                             |
+|  DESCRIPTION: Sets fill value for the specified field.                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fieldname      char*               field name                              |
+|  fillval        void*               fill value                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/23/99  A.Muslimov    Checked for the status returned by                  |
+|                         H5Pset_fill_value(). Changed the return status      |
+|                         from intn to int   .                                |
+|  11/9/99  A.Muslimov    Modified the calls to write fill value to the       |
+|                         attribute which fixed a bug resulted in a wrong     |
+|                         value returned by the SWgetfillvalue().             |
+|  12/3/99  A.Muslimov    Fixed a bug resulted in not writing a fill value    |
+|                         into the dataset.                                   |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  Mar  04  S.Zhao        Modified for a character string dataset.            |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWsetfillvalue(hid_t swathID, char *fieldname, hid_t numbertype_in, void *fillval)
+{
+  herr_t          status       = FAIL;/* return status variable       */
+  
+  hid_t           fid          = FAIL;/* HDF-EOS file ID              */
+  hid_t           gid          = FAIL;/* "HDFEOS" group ID            */
+  
+  long            idx          = FAIL;/* Swath index                  */
+  
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+  hid_t           numbertype;
+
+  HE5_LOCK;
+  CHECKPOINTER(fillval);
+
+  /* Convert HDF-EOS5 datatype to HDF5 datatype */
+  if (
+      H5Tequal(numbertype_in, H5T_NATIVE_CHAR)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SHORT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_INT)    == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UINT)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LONG)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LLONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_FLOAT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== SUCCEED ||
+      H5Tequal(numbertype_in, H5T_C_S1) == SUCCEED)
+    {
+      numbertype = numbertype_in;
+    }
+  else
+    {
+      numbertype = HE5_EHconvdatatype((int) numbertype_in);
+    }
+
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID for fillvalue.\n");
+      H5Epush(__FILE__, "HE5_SWsetfillvalue", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWsetfillvalue", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for valid swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWsetfillvalue", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get current dataset creation property list */
+  /* ------------------------------------------ */  
+  if( HE5_SWXSwath[idx].plist == FAIL)
+    {
+      HE5_SWXSwath[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+      if (HE5_SWXSwath[idx].plist == FAIL)
+	{
+	  sprintf(errbuf,"Cannot create the dataset property list.\n");
+	  H5Epush(__FILE__, "HE5_SWsetfillvalue", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+  
+  /* Set fill value */
+  /* -------------- */  
+  if ((numbertype != HE5T_CHARSTRING) && (numbertype != H5T_NATIVE_CHAR) && (numbertype != H5T_C_S1))
+    {
+      status = H5Pset_fill_value(HE5_SWXSwath[idx].plist, numbertype, fillval);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot set fill value for \"%s\" field.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWsetfillvalue", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+
+ 
+ COMPLETION: 
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWgetfillvalue                                               |
+|                                                                             |
+|  DESCRIPTION: Retrieves fill value for a specified field.                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  fieldname      char*               field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fillval        void*               fill value                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/23/99  A.Muslimov    Changed the return status from intn to int   .      |
+|  11/9/99  A.Muslimov    Replaced a call to H5Pget_fill_value( plist, tid,   |
+|                         fillval) by EHattr().                               |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Oct  00  A.Muslimov    Updated to allow getting of a fill value for a      |
+|                         profile field. Replaced two calls by HE5_SWfldsrch. |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+| Aug 22,11 Abe Taaheri   Add code to return error if fillvalue attribute     |
+|                         not found.                                          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWgetfillvalue(hid_t swathID, char *fieldname, void *fillval)
+{
+  herr_t          status   = FAIL;/* routine return status variable   */
+
+  hid_t           fid      = FAIL;/* HDF-EOS file ID                  */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID                */
+  hid_t           fieldID  = FAIL;/* field dataset ID                 */
+  hid_t           tid      = FAIL;/* field dataset data type ID       */
+  hid_t           plist    = FAIL;/* field dataset property list ID   */
+ 
+  long            idx      = FAIL;/* Swath index                      */
+  
+  hsize_t         count[1] = { 1 };/* number of attribute elements    */
+    
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+  long            strbufsize;
+  char           *attrnames;
+  long            nattr = 0;           /* number of attributes              */
+
+  HE5_LOCK;
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWgetfillvalue", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for valid swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+  /* Check out the field group and get field ID */
+  /* ------------------------------------------ */
+  HE5_SWfldsrch(swathID,fieldname,&fieldID,NULL,NULL,NULL);
+  if( fieldID == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the field ID for the \"%s\" field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+   
+  nattr = HE5_SWinqlocattrs(swathID, fieldname, NULL, &strbufsize);
+  if ( nattr < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve fillvalue attribute. \n");
+      H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  attrnames = (char*)malloc(sizeof(char)*(strbufsize+1));
+  if (attrnames == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for attrnames.\n") ;
+      H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  nattr  = HE5_SWinqlocattrs(swathID, fieldname, attrnames, &strbufsize);
+  if ( nattr < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve fillvalue attribute. \n");
+      H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  if(strstr(attrnames, "_FillValue")!=NULL)
+    {
+      /* Get the property list ID */
+      /* ------------------------ */
+      plist = H5Dget_create_plist(fieldID);
+      if ( plist == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      
+      /* Get the datatype ID */ 
+      /* ------------------- */
+      tid   = H5Dget_type(fieldID);
+      if ( tid == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get the data type ID for the \"%s\" data field.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      
+      /* Read out a fill value from the attribute */
+      /* ---------------------------------------- */ 
+      status = HE5_EHattr(fieldID, "_FillValue", tid, count, "r", fillval); 
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get fill value for the  \"%s\" field.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+      
+      /* Release data type ID */
+      /* -------------------- */
+      status = H5Tclose(tid);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot release data type ID for the \"%s\" dataset.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+      
+      /* Release property list ID */
+      /* ------------------------ */
+      status = H5Pclose(plist);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot release property list ID for the \"%s\" dataset.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  else
+    {
+      sprintf(errbuf, "Cannot retrieve fillvalue attribute. \n");
+      H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWregioninfo                                                 |
+|                                                                             |
+|  DESCRIPTION: Returns size of region in bytes                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  regionID       hid_t               Region ID                               |
+|  fieldname      char                Fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               field number types                      |
+|  rank           int                 field rank                              |
+|  dims           hsize_t             dimensions of field region              |
+|  size           size_t              size in bytes of field region           |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer    Description                                        |
+|  ========  ============  =================================================  |
+|  08/20/99  A. Muslimov   Initialized return statuses to -1.                 |
+|  10/18/99  A.Muslimov    Replaced memcpy() by memmove() to avoid a problem  |
+|                            when arguments 1 and 2 overlap in memory.        |
+|  04/19/00  A.Muslimov    Changed type of 'slen' from long to size_t.        |
+|  05/10/00  A.Muslimov    Replaced 'H5T_class_t' type by 'int' data type.    |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Apr  01  A.Muslimov    Initialized size to 0, but "Unlim" returns -1!,     |
+|                          not 0.                                             |
+|  Jan 03   S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWregioninfo(hid_t swathID, hid_t regionID, char *fieldname, hid_t *ntype, int *rank, hsize_t dims[], size_t *size)
+{
+  herr_t          status   = FAIL;/* routine return status variable                 */
+  herr_t          statMap  = FAIL;/* Status from SWmapinfo                          */
+
+  int             i, j, k;		  /* Loop indices                                   */
+  int             dum      = FAIL;/* Dummy (rank) variable */
+
+  hid_t           dum2[1]  ={FAIL};/* Dummy (number types) variable                 */
+
+  unsigned char   found    =  0;  /* Found flag                                     */
+
+  hid_t           fid      = FAIL;/* HDF-EOS file ID                                */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID                              */
+  hid_t           fieldID  = FAIL;/* fieldname Dataset ID                           */
+
+  long            idx      = FAIL;/* Swath index                                    */
+  long            index    = FAIL;/* Geo Dim Index                                  */
+  long            nDim     =  0;  /* Number of dimensions                           */
+  long            incr     =  0;  /* Mapping increment                              */
+  long            offset   = FAIL;/* Mapping offset                                 */
+  long            *idxmap  = (long *)NULL;/* Pointer to index mapping array         */
+  long            nXtrk       =  0;            /* Number of cross tracks            */
+
+  hsize_t         idxMapElem  =  0;            /* Number of index map elements      */
+  hsize_t         dumsize     =  0;            /* Dummy size variable               */
+  hsize_t         dumdims[HE5_DTSETRANKMAX];   /* Dimensions from SWfieldinfo       */
+
+  size_t          slen[HE5_DTSETRANKMAX];      /* String length array               */
+
+  char            dimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list                    */
+  char            geodim[HE5_HDFE_DIMBUFSIZE]; /* Geolocation field dimension list  */
+  char            tgeodim[HE5_HDFE_DIMBUFSIZE];/* Time Geolocation field dim. list  */
+  char            utlbuf[HE5_HDFE_DIMBUFSIZE]; /* Utility buffer                    */
+  char            *ptr[HE5_DTSETRANKMAX];      /* String pointer array              */
+  char            *errMesg = "Vertical Dimension Not Found: \"%s\".\n";
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error buffer                      */
+
+  CHECKPOINTER(fieldname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWregioninfo", &fid, &gid, &idx);
+
+  /* Check for valid region ID */
+  /* ------------------------- */
+  if (status == SUCCEED)
+    {
+      if (regionID < 0 || regionID >= HE5_NSWATHREGN)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "Invalid Region id: %d.\n", regionID);
+	  H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+    }
+
+  /* Check for active region ID */
+  /* -------------------------- */
+  if (status == SUCCEED)
+    {
+      if (HE5_SWXRegion[regionID] == 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf,"Inactive Region ID: %d.\n", regionID);
+	  H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+    }
+
+
+  /* Check for valid fieldname */
+  /* ------------------------- */
+  if (status == SUCCEED)
+    {
+      /* Get data field info */
+      /* ------------------- */
+      strcpy(dimlist,"");
+      status = HE5_SWfieldinfo(swathID, fieldname, rank, dims, ntype, dimlist, NULL);
+      if (status != SUCCEED)
+        {
+	  status = FAIL;
+	  sprintf(errbuf,"Field \"%s\" Not Found.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+    }
+
+
+  /* No problems so proceed ... */
+  /* -------------------------- */
+  if (status == SUCCEED)
+    {
+      /* If non-vertical subset regions defined ... */
+      /* ------------------------------------------ */
+      if (HE5_SWXRegion[regionID]->nRegions > 0)
+        {
+	  /* Initialize dumdims[] array */
+	  /* -------------------------- */
+	  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+	    dumdims[ i ] = 0;
+
+	  /* Get geolocation dimension name */
+	  /* ------------------------------ */
+	  strcpy(geodim,"");
+
+	  status = HE5_SWfieldinfo(HE5_SWXRegion[regionID]->swathID, "Longitude", &dum, dumdims, dum2, geodim,NULL);
+
+	  /* If Time field being used, check for dimensions */
+	  /* ---------------------------------------------- */
+	  if (HE5_timeflag == 1)
+            {
+	      /* code change to fix time subset bug for Landsat7 */
+	      strcpy(tgeodim,"");
+	      status = HE5_SWfieldinfo(HE5_SWXRegion[regionID]->swathID, "Time", &dum, dumdims, dum2, tgeodim,NULL);
+
+	      if (strcmp(geodim, tgeodim) != 0)
+		{
+                  strcpy(geodim, tgeodim);
+		}
+            }
+		
+	  HE5_timeflag = 0;
+
+	  /* Initialize slen[] array */
+	  /* ----------------------- */
+	  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+	    slen[ i ] = 0;
+
+	  /* Get "Track" (first) Dimension from geo dimlist */
+	  /* ---------------------------------------------- */
+	  nDim = HE5_EHparsestr(geodim, ',', ptr, slen);
+	  geodim[slen[0]] = 0;
+
+
+	  /* Parse Data Field Dimlist & find mapping */
+	  /* --------------------------------------- */
+	  nDim = HE5_EHparsestr(dimlist, ',', ptr, slen);
+
+	  /* Loop through all dimensions and search for mapping */
+	  /* -------------------------------------------------- */
+	  strcpy(utlbuf,"");
+	  for (i = 0; i < nDim; i++)
+            {
+	      memmove(utlbuf, ptr[i], slen[i]);
+	      utlbuf[slen[i]] = 0;
+	      offset = HE5_EHint2long(dum);
+	      if ( offset == FAIL )
+		{
+		  sprintf(errbuf, "Cannot convert data type. \n");
+		  H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(FAIL);
+		}
+
+	      statMap = HE5_SWmapinfo(swathID, geodim, utlbuf, &offset, &incr);
+
+	      /* Mapping found */
+	      /* ------------- */
+	      if (statMap == SUCCEED)
+                {
+		  found = 1;
+		  index = HE5_EHint2long(i);
+		  if ( index == FAIL )
+		    {
+		      sprintf(errbuf, "Cannot convert data type. \n");
+		      H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(FAIL);
+		    }
+		  break;
+                }
+            }
+
+
+	  /* If mapping not found check for geodim within dimlist */
+	  /* ---------------------------------------------------- */
+	  if (found == 0)
+            {
+	      index = HE5_EHstrwithin(geodim, dimlist, ',');
+
+	      /* Geo dimension found within subset field dimlist */
+	      /* ----------------------------------------------- */
+	      if (index != FAIL)
+                {
+		  found = 1;
+		  incr  = 1;
+                }
+            }
+
+
+
+	  /* If mapping not found check for indexed mapping */
+	  /* ---------------------------------------------- */
+	  if (found == 0)
+            {
+	      /* Get size of geo dim & allocate space of index mapping */
+	      /* ----------------------------------------------------- */
+	      dumsize = HE5_SWdiminfo(swathID, geodim);
+	      if(dumsize == 0)
+                {
+		  H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot get the dimension size. \n");
+		  HE5_EHprint("Error: Cannot get the dimension size, occured", __FILE__, __LINE__);
+		  return(FAIL);
+                }
+
+	      idxmap = (long *) calloc(dumsize, sizeof(long));
+	      if(idxmap == NULL)
+                {
+		  H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+		  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+		  return(FAIL);
+                }
+
+	      /* Loop through all dimensions and search for mapping */
+	      /* -------------------------------------------------- */
+	      strcpy(utlbuf,"");
+	      for (i = 0; i < nDim; i++)
+                {
+		  memmove(utlbuf, ptr[i], slen[i]);
+		  utlbuf[slen[i]] = 0;
+
+		  idxMapElem = HE5_SWidxmapinfo(swathID, geodim, utlbuf, idxmap);
+
+		  /* Mapping found */
+		  /* ------------- */
+		  if (idxMapElem > 0)
+                    {
+		      found = 1;
+		      index = i;
+		      break;
+                    }
+                }
+            }
+
+
+	  /* Regular Mapping Found */
+	  /* --------------------- */
+	  if (found == 1 && idxMapElem == 0)
+            {
+	      dims[index] = 0;
+
+	      /* Loop through all regions */
+	      /* ------------------------ */
+	      for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++)
+                {
+		  /* Get number of cross tracks in particular region */
+		  /* ----------------------------------------------- */
+		  nXtrk = HE5_SWXRegion[regionID]->StopRegion[k] - HE5_SWXRegion[regionID]->StartRegion[k] + 1;
+
+		  /* If increment is positive (geodim <= datadim) ... */
+		  /* ------------------------------------------------ */
+		  if (incr > 0)
+                    {
+		      dims[index] += nXtrk * incr;
+                    }
+		  else
+                    {
+		      /* Negative increment (geodim > datadim) */
+		      /* ------------------------------------- */
+		      dims[index] += nXtrk / (-incr);
+
+		      /*
+		       * If Xtrk not exactly divisible by incr, round dims
+		       * to next highest integer
+		       */
+		      if (nXtrk % (-incr) != 0)
+                        {
+			  dims[index]++;
+                        }
+                    }
+                }
+            }
+	  else if (found == 1 && idxMapElem > 0)
+            {
+
+	      /* Indexed Mapping */
+	      /* --------------- */
+
+	      dims[index] = 0;
+	      /* Loop through all regions */
+	      /* ------------------------ */
+	      for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++)
+                {
+		  /* Get number of cross tracks in particular region */
+		  /* ----------------------------------------------- */
+		  nXtrk = idxmap[HE5_SWXRegion[regionID]->StopRegion[k]] - idxmap[HE5_SWXRegion[regionID]->StartRegion[k]] + 1;
+
+		  dims[index] += nXtrk;
+                }
+            }
+	  else
+            {
+	      /* Mapping not found */
+	      /* ----------------- */
+	      status = FAIL;
+	      sprintf( errbuf, "Mapping Not Defined for \"%s\" Dimension.\n", geodim);
+	      H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+            }
+        }
+
+      /* Vertical Subset */
+      /* --------------- */
+      if (status == SUCCEED || status == FAIL)
+        {
+	  for (j = 0; j < HE5_DTSETRANKMAX; j++)
+            {
+	      /* If active vertical subset ... */
+	      /* ----------------------------- */
+	      if (HE5_SWXRegion[regionID]->StartVertical[j] != FAIL)
+                {
+
+		  /* Find vertical dimension within dimlist */
+		  /* -------------------------------------- */
+		  index = HE5_EHstrwithin(HE5_SWXRegion[regionID]->DimNamePtr[j], dimlist, ',');
+
+		  /* If dimension found ... */
+		  /* ---------------------- */
+		  if (index != FAIL)
+                    {
+		      /* Compute dimension size */
+		      /* ---------------------- */
+		      dims[index] = HE5_SWXRegion[regionID]->StopVertical[j] - HE5_SWXRegion[regionID]->StartVertical[j] + 1;
+                    }
+		  else
+                    {
+		      /* Vertical dimension not found */
+		      /* ---------------------------- */
+		      status = FAIL;
+		      *size  = 0;
+		      sprintf(errbuf, errMesg, HE5_SWXRegion[regionID]->DimNamePtr[j]);
+		      H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+                    }
+                }
+            }
+
+
+
+	  /* Compute size of region data buffer */
+	  /* ---------------------------------- */
+	  if (status == SUCCEED)
+            {
+	      /* Compute number of total elements */
+	      /* -------------------------------- */
+	      *size = dims[0];
+
+	      for (j = 1; j < *rank; j++)
+		*size *= dims[j];
+
+
+	      /* Multiply by size in bytes of numbertype */
+	      /* --------------------------------------- */
+	      *size *= HE5_SWfieldsizeID(swathID,fieldname, &fieldID);
+            }
+        }
+    }
+
+
+
+  /* Free index mappings if applicable */
+  /* --------------------------------- */
+  if (idxmap != NULL) free(idxmap);
+
+ COMPLETION:
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWperiodinfo                                                 |
+|                                                                             |
+|  DESCRIPTION: Returns size in bytes of region                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  periodID       hid_t               Period ID                               |
+|  fieldname      char                Fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               field number types                      |
+|  rank           int                 field rank                              |
+|  dims           hsize_t             dimensions of field region              |
+|  size           size_t              size in bytes of field region           |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/23/99  A.Muslimov    Changed the return status from intn to int   .      |
+|  05/10/00 A.Muslimov    Replaced 'H5T_class_t' type by 'int' data type.     |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Jan 03   S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWperiodinfo(hid_t swathID, hid_t periodID, char *fieldname, hid_t *ntype, int *rank, hsize_t dims[], size_t *size)
+{
+  herr_t   status = FAIL;/* routine return status variable */
+  
+  HE5_timeflag    = 1;
+  
+  CHECKPOINTER(fieldname);
+  
+  /* Call HE5_SWregioninfo */
+  /* --------------------- */
+  status = HE5_SWregioninfo(swathID, periodID, fieldname, ntype, rank, dims, size);
+  
+ COMPLETION:
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWclose                                                      |
+|                                                                             |
+|  DESCRIPTION: Closes HDF-EOS file                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               File ID                                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWclose(hid_t fid)
+{
+  herr_t   status = FAIL;/* routine return status variable */
+
+  /* Call HE5_EHclose to perform file close */
+  /* -------------------------------------- */
+  status = HE5_EHclose(fid);
+  
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWupdatescene                                                |
+|                                                                             |
+|  DESCRIPTION: Updates the StartRegion and StopRegion values                 |
+|               for a specified region. This function is for Landsat.         |
+|               The start and stop values must be set to the beginning        |
+|               and the end of a scene, fixed scene subsetting.               |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  regionID       hid_t               Region ID                               |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Nov 98   Xinmin Hua    Original developing                                 |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  Jan  05  S. Zhao       Modified to exclude regions that have the same      |
+|                         start and stop.                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWupdatescene(hid_t swathID, hid_t regionID)
+{
+  herr_t          status  = FAIL;/* routine return status variable  */
+
+  hid_t           fid     = FAIL;/* HDF-EOS file ID                 */
+  hid_t           gid     = FAIL;/* "HDFEOS" group ID               */
+     
+  long            k;		 /* Loop index                      */
+  long            idx     = FAIL;/* Swath index                     */
+  long            startReg= 0;   /* Indexed start region            */
+  long            stopReg = 0;   /* Indexed stop region             */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+  long            index[HE5_MAXNREGIONS];/* to store indicies when stop and                                                                                 start are different */ 
+  long            ind;           /* index                           */
+  long            tempnRegions;  /* temp number of regions          */
+
+
+  HE5_LOCK;
+  
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWupdatescene", &fid, &gid, &idx);
+
+  /* Check for valid region ID */
+  /* ------------------------- */
+  if (status == SUCCEED)
+    {
+      if (regionID < 0 || regionID >= HE5_NSWATHREGN)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "Invalid Region ID: %d.\n", regionID);
+	  H5Epush(__FILE__, "HE5_SWupdatescene", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); 
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+    }
+
+  /* Check for active region ID */
+  /* -------------------------- */
+  if (status == SUCCEED)
+    {
+      if (HE5_SWXRegion[regionID] == 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "Inactive Region ID: %d.\n", regionID);
+	  H5Epush(__FILE__, "HE5_SWupdatescene", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+    }
+
+  if (status == SUCCEED)
+    {
+      tempnRegions = HE5_SWXRegion[regionID]->nRegions;
+      ind =0;
+
+      for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++)
+	{
+	  startReg = HE5_SWXRegion[regionID]->StartRegion[k];
+	  stopReg = HE5_SWXRegion[regionID]->StopRegion[k];
+	  if(startReg == stopReg)
+	    {
+	      /* reduce number of regions by 1, if tempnRegions is 0 issue
+		 error and break from loop*/
+	      tempnRegions -= 1;
+
+	      if(tempnRegions == 0)
+		{
+		  /* first free allocated memory for HE5_SWXRegion[regionID]
+		     in the function HE5_SWdefboxregion and make regionID
+		     inactive */
+		  free(HE5_SWXRegion[regionID]);
+		  HE5_SWXRegion[regionID] = 0;
+		  status = FAIL;
+		  sprintf(errbuf, "Inactive Region ID: %d.\n", regionID);
+		  H5Epush(__FILE__, "HE5_SWupdatescene", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  break;
+		}
+	    }
+	  else
+	    {
+	      /* store index number of regions that have different start and stop */
+	      index[ind] = k;
+	      ind += 1;
+	    }
+	}
+          
+      if (status != SUCCEED)
+	{
+	  return (status);
+	}
+      else
+	{
+	  HE5_SWXRegion[regionID]->nRegions = tempnRegions;
+	}
+
+      /* keep starts and stops that are different in the structure  */
+      for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++)
+	{
+	  HE5_SWXRegion[regionID]->StartRegion[k] = 
+	    HE5_SWXRegion[regionID]->StartRegion[index[k]];
+	  HE5_SWXRegion[regionID]->StopRegion[k] =
+	    HE5_SWXRegion[regionID]->StopRegion[index[k]];
+	}
+    }
+
+  if (status == SUCCEED)
+    {
+      for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++)
+	{
+	  startReg = HE5_SWXRegion[regionID]->StartRegion[k];
+	  stopReg  = HE5_SWXRegion[regionID]->StopRegion[k];
+
+	  if(startReg % 2 == 1) {
+	    HE5_SWXRegion[regionID]->StartRegion[k] = ++startReg;
+	  }
+	  if(stopReg % 2 == 0) {
+	    HE5_SWXRegion[regionID]->StopRegion[k] = --stopReg;
+	  }
+	}
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return( status );
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWupdateidxmap                                               |
+|                                                                             |
+|  DESCRIPTION: Updates the map index for a specified region.                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nout           long                return Number of elements in output     |
+|                                     index array if SUCCEED, (-1) FAIL       |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  regionID       hid_t               Region ID                               |
+|  indexin        long                array of index values                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  indexout       long                array of index values                   |
+|  indicies       long                array of start and stop in region       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 97   Abe Taaheri   Original Programmer                                 |
+|  AUG 97   Abe Taaheri   Add support for index mapping                       |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWupdateidxmap(hid_t swathID, hid_t regionID, long indexin[], long indexout[], long indicies[])
+{
+  long        nout     = FAIL;/* # of elements in output array (return)  */
+  long        i, k ;		  /* Loop indices                            */
+  long        idx      = FAIL;/* Swath index                             */
+  long        startReg =  0;  /* Indexed start region                    */
+  long        stopReg  =  0;  /* Indexed stop region                     */
+
+  herr_t      status   = FAIL;/* routine return status variable          */
+
+  hid_t       fid      = FAIL;/* HDF-EOS file ID                         */
+  hid_t       gid      = FAIL;/* "HDFEOS" group ID                       */
+
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error buffer                */
+
+  HE5_LOCK;
+  CHECKPOINTER(indexin);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWupdateidxmap", &fid, &gid, &idx);
+
+  /* Check for valid region ID */
+  /* ------------------------- */
+  if (status == SUCCEED)
+    {
+      if (regionID < 0 || regionID >= HE5_NSWATHREGN)
+        {
+	  status = FAIL;
+	  sprintf(errbuf,"Invalid Region id: %d.\n", regionID);
+	  H5Epush(__FILE__, "HE5_SWupdateidxmap", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); 
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+    }
+
+  /* Check for active region ID */
+  /* -------------------------- */
+  if (status == SUCCEED)
+    {
+      if (HE5_SWXRegion[regionID] == 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "Inactive Region ID: %d.\n", regionID);
+	  H5Epush(__FILE__, "HE5_SWupdateidxmap", __LINE__, H5E_FILE, H5E_BADRANGE, errbuf );
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+    }
+
+  if (status == SUCCEED)
+    {
+      /* Loop through all regions */
+      /* ------------------------ */
+      for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++)
+        {
+
+	  /* fix overlap index mapping problem for Landsat7 */
+	  startReg = HE5_SWXRegion[regionID]->StartRegion[ k ];
+	  stopReg  = HE5_SWXRegion[regionID]->StopRegion[ k ];
+
+	  /* If start of region is odd then increment */
+	  /* ---------------------------------------- */
+	  if (startReg % 2 == 1)
+            {
+	      startReg++;
+            }
+
+	  /* If end of region is even then decrement */
+	  /* --------------------------------------- */
+	  if (stopReg % 2 == 0)
+            {
+	      stopReg--;
+            }
+        }
+
+      indicies[0] = startReg;
+      indicies[1] = stopReg;
+
+      if (indexout != NULL)
+        {
+	  /* get new index values */
+	  for(i = startReg; i <= stopReg  ; i++)
+            {
+	      indexout[i - startReg] = indexin[ i ] - indexin[startReg];
+            }
+        }
+
+      nout = (stopReg - startReg) + 1;
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  
+  if(status == FAIL)
+    return(FAIL);
+  else
+    return(nout);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWgeomapinfo                                                 |
+|                                                                             |
+|  DESCRIPTION: Returns mapping information for dimension                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              2 for indexed mapping, 1 for regular    |
+|                                     mapping, 0 if the dimension is not      |
+|                                     and (-1) FAIL                           |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  geodim         char                geolocation dimension name              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  NONE                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  7/29/99  A.Muslimov    In the call to EHmetagroup() replace gid by fid.    |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWgeomapinfo(hid_t swathID, char *geodim)
+{
+  herr_t         status    = FAIL;         /* Return status variable    */
+
+  hid_t          fid       = FAIL;         /* HDF-EOS file ID           */
+  hid_t          gid       = FAIL;         /* "HDFEOS" group ID         */
+
+  long           idx       = FAIL;         /* Swath index               */
+
+  char           *metabufr = (char *)NULL; /* Pointer to SM             */
+  char           *metabufi = (char *)NULL; /* Pointer to SM             */
+  char           *metaptrsr[2]={NULL,NULL};/* Pntrs to begin, end of SM */
+  char           *metaptrsi[2]={NULL,NULL};/* Pntrs to begin, end of SM */
+  char           utlstrr[HE5_HDFE_DIMBUFSIZE]; /* Utility string        */
+  char           utlstri[HE5_HDFE_DIMBUFSIZE]; /* Utility string        */
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];  /* Error message buffer  */
+ 
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWgeomapinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get pointers to "DimensionMap" section within SM */
+      metabufr = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "DimensionMap", metaptrsr);
+      if (metabufr == NULL)
+	{
+	  sprintf(errbuf, "Cannot get  pointer to metabufer. \n") ;
+	  H5Epush(__FILE__, "HE5_SWgeomapinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  
+	  return(FAIL);
+	}
+
+      /* Search for mapping - GeoDim/DataDim (surrounded by quotes) */
+      sprintf(utlstrr, "%s%s%s", "\t\t\t\tGeoDimension=\"", geodim, "\"\n\t\t\t\tDataDimension=");
+      metaptrsr[0] = strstr(metaptrsr[0], utlstrr);
+
+      /* Get pointers to "IndexDimensionMap" section within SM */
+      metabufi = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "IndexDimensionMap", metaptrsi);
+      if (metabufi == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for metabufi.") ;
+	  H5Epush(__FILE__, "HE5_SWgeomapinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(metabufr);
+
+	  return(FAIL);
+	}
+
+      /* Search for mapping - GeoDim/DataDim (surrounded by quotes) */
+      sprintf(utlstri, "%s%s%s", "\t\t\t\tGeoDimension=\"", geodim, "\"\n\t\t\t\tDataDimension=");
+      metaptrsi[0] = strstr(metaptrsi[0], utlstri);
+
+      /*
+      ** If regular mapping found add 1 to status
+      ** If indexed mapping found add 2
+      */
+      if (metaptrsr[0] < metaptrsr[1] && metaptrsr[0] != NULL)
+        {
+	  status = status + 1;
+        }
+
+      if (metaptrsi[0] < metaptrsi[1] && metaptrsi[0] != NULL)
+        {
+	  status = status + 2;
+        }
+
+      free(metabufr);
+      free(metabufi);
+    }
+
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWfieldsizeID                                                |
+|                                                                             |
+|  DESCRIPTION:  Returns the size (in bytes) of field-related data type,      |
+|                otherwise returns 0.                                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  size           size_t  none                                                |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fieldname      char                fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fieldID        hid_t               field-related dataset ID                |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  8/23/99  A.Muslimov    Checked for the statuses returned by H5Tclose().    |
+|  2/08/00  A.Muslimov    Added more error checkings and desciption.          |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static size_t 
+HE5_SWfieldsizeID( hid_t swathID, char *fieldname, hid_t  *fieldID)
+{
+  size_t         size      =  0;             /* Size of field data type  */
+
+  herr_t         status    = FAIL;           /* Return status variable   */
+
+  int            i;				             /* Loop index               */
+  int            found     =  0;             /* Flag                     */
+
+  hid_t          fid       = FAIL;           /* HDF-EOS file ID          */
+  hid_t          gid       = FAIL;           /* "HDFEOS" group ID        */
+  hid_t          dtype     = FAIL;           /* datatype ID              */
+
+  long           idx       = FAIL;           /* Swath index              */
+
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* Buffer for error message */
+
+  CHECKPOINTER(fieldname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWfieldsizeID", &fid, &gid, &idx);
+
+  /* Loop through all geo datasets in swath */
+  /* -------------------------------------- */
+  for (i = 0; i < HE5_SWXSwath[idx].nGFLD; i++)
+    {
+      if( strcmp(fieldname, HE5_SWXSwath[idx].gdataset[i].name) == 0 )
+	{
+	  /* Get dataset ID */
+	  /* -------------- */
+	  *fieldID = HE5_SWXSwath[idx].gdataset[i].ID;
+			
+	  dtype    = H5Dget_type( *fieldID);
+	  if (dtype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the dataset data type. \n");
+	      H5Epush(__FILE__, "HE5_SWfieldsizeID", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(0);
+	    }
+			
+	  size     = H5Tget_size(dtype);
+	  if (size == 0)
+	    {
+	      sprintf(errbuf, "Cannot get the data type size. \n");
+	      H5Epush(__FILE__, "HE5_SWfieldsizeID", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(0);
+	    }
+
+	  status   = H5Tclose(dtype);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the data type ID. \n");
+	      H5Epush(__FILE__, "HE5_SWfieldsizeID", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(0);
+	    }
+	  found = 1;
+	  break;
+	}
+		
+    }
+
+  /* not found in geo field */
+  /* ---------------------- */
+  if(  found == 0 )
+    {
+      /* Loop through all data fields in swath */
+      /* ------------------------------------- */
+      for (i = 0; i < HE5_SWXSwath[idx].nDFLD; i++)
+	{
+	  if( strcmp(fieldname, HE5_SWXSwath[idx].ddataset[i].name) == 0 )
+	    {
+	      /* get dataset ID */
+	      /* -------------- */
+	      *fieldID = HE5_SWXSwath[idx].ddataset[i].ID;
+				
+	      dtype    = H5Dget_type(*fieldID);
+	      if (dtype == FAIL)
+		{
+		  sprintf(errbuf, "Cannot get the dataset data type. \n");
+		  H5Epush(__FILE__, "HE5_SWfieldsizeID", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(0);
+		}
+
+	      size     = H5Tget_size(dtype);
+	      if (size == 0)
+		{
+		  sprintf(errbuf, "Cannot get the data type size. \n");
+		  H5Epush(__FILE__, "HE5_SWfieldsizeID", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(0);
+		}
+				
+	      status   = H5Tclose(dtype);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot release the data type ID. \n");
+		  H5Epush(__FILE__, "HE5_SWfieldsizeID", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(0);
+		}               
+	      found = 1;
+	      break;
+	    }
+	}
+    }
+  if(  found == 0 )
+    {
+      sprintf(errbuf, "field \"%s\" is not in Swath. \n", fieldname);
+      H5Epush(__FILE__, "HE5_SWfieldsizeID", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+ COMPLETION:
+  return(size);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwritegrpattr                                               |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with the "Data Fields"    |
+|               group in a swath.                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  attrname       char                attribute name                          |
+|  numtype        hid_t               attribute dataset datatype ID           |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jan 00   A.Muslimov                                                        |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWwritegrpattr(hid_t swathID, const char *attrname, hid_t numtype, hsize_t  count[], void *datbuf)
+{
+  herr_t     status          = FAIL;     /* Return status variable */
+
+  hid_t      fid             = FAIL;     /* HDF-EOS file ID        */
+  hid_t      gid             = FAIL;     /* "HDFEOS" group ID      */
+  hid_t      DataFieldsGrpID = FAIL;     /* "Data Fields" group ID */
+    
+  long       idx             = FAIL;     /* Swath index            */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+  hid_t      numbertype;
+
+  HE5_LOCK;
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+
+  /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use numtype itself
+  */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      numbertype = numtype;
+    }
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWwritegrpattr", &fid, &gid, &idx);
+
+  if (status == SUCCEED)
+    {
+      /* Get "Data Fields" group ID and call HE5_EHattr to perform I/O */
+      /* ------------------------------------------------------------- */
+      DataFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Data Fields");
+      if(DataFieldsGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data Fields\" group ID. \n");
+	  H5Epush(__FILE__, "HE5_SWwritegrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	} 
+
+      status = HE5_EHattr(DataFieldsGrpID, attrname, numbertype, count,"w", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write Attribute \"%s\"to the \"Data Fields\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_SWwritegrpattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      status = H5Gclose(DataFieldsGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data Fields\" group ID. \n");
+	  H5Epush(__FILE__, "HE5_SWwritegrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWreadgrpattr                                                |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from the "Data Fields" group in a swath.      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jan 00   A.Muslimov                                                        |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWreadgrpattr(hid_t swathID, const char *attrname, void * datbuf)
+{
+  herr_t      status          = FAIL;     /* return status variable   */
+  
+  hid_t       fid             = FAIL;     /* HDF-EOS file ID          */
+  hid_t       gid             = FAIL;     /* "HDFEOS" group ID        */
+  hid_t       ntype           = FAIL;     /* Data type ID             */
+  hid_t       DataFieldsGrpID = FAIL;     /* "Data Fields" group ID   */
+  
+  long        idx             = FAIL;     /* Swath index              */
+  
+  hsize_t     count[]         = { 0 };    /* # of attribute elements  */
+  
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */
+  
+
+  HE5_LOCK;
+  CHECKPOINTER(attrname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWreadgrpattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get "Data Fields"  group ID and call HE5_EHattr to perform I/O */
+      /* -------------------------------------------------------------- */
+      DataFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Data Fields");
+      if(DataFieldsGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_SWreadgrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+        }
+
+      status = HE5_EHattr(DataFieldsGrpID,attrname,ntype,count,"r", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot read Attribute \"%s\" from the \"Data Fields\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_SWreadgrpattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }
+
+      status = H5Gclose(DataFieldsGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n");
+	  H5Epush(__FILE__,  "HE5_SWreadgrpattr", __LINE__,H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+	
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWgrpattrinfo                                                |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about attributes in "Data Fields" group.|
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  attrname       const char*         attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               data type ID                            |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jan 00   A.Muslimov                                                        |
+|  May 00   A.Muslimov    Replaced 'H5T_class_t' type by 'int' data type.     |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Feb 03   S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWgrpattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t     status          = FAIL;     /* routine return status variable */
+
+  hid_t      fid             = FAIL;     /* HDF-EOS file ID                */
+  hid_t      gid             = FAIL;     /* "HDFEOS" group ID              */
+  hid_t      DataFieldsGrpID = FAIL;     /* "Data Fields" group ID         */
+
+  long       idx             = FAIL;     /* Swath index                    */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/*  Error message buffer          */
+
+  CHECKPOINTER(attrname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWgrpattrinfo", &fid, &gid, &idx);	
+  if (status == SUCCEED)
+    {
+      /* Get "Data Fields"  group ID and call HE5_EHattrinfo */
+      /* --------------------------------------------------- */
+      DataFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Data Fields");
+      if(DataFieldsGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_SWgrpattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      status = HE5_EHattrinfo(DataFieldsGrpID,attrname,ntype,count);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"Data Fields\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_SWgrpattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      status = H5Gclose(DataFieldsGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_SWgrpattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+
+
+    }
+  
+ COMPLETION:
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqgrpattrs                                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list in "Data Fields" group                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in "Data Fields"   |
+|                                       group.                                |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swath ID       hid_t               swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in "Data Fields" group  |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jan 00   A.Muslimov                                                        |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqgrpattrs(hid_t swathID, char *attrnames, long *strbufsize)
+{
+  long            nattr   = FAIL;             /* Number of attributes (return)  */
+  long            idx     = FAIL;             /* Swath index                    */
+
+  herr_t          status  = FAIL;             /* Return status variable         */
+
+  hid_t           fid     = FAIL;             /* HDF-EOS file ID                */
+  hid_t           gid     = FAIL;             /* "SWATHS" group ID              */
+    
+  char            *grpname = (char *)NULL;    /* Group name string              */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer           */
+
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWinqgrpattrs", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) );
+      if( grpname == NULL)
+        {
+          H5Epush(__FILE__, "HE5_SWinqgrpattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Can not allocate memory");
+          HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      strcpy(grpname,"/HDFEOS/SWATHS/");
+      strcat(grpname, HE5_SWXSwath[idx].swname);
+      strcat(grpname,"/Data Fields");
+	
+      /* search group with grpname for the number of attributes */
+      /* ------------------------------------------------------ */ 
+      nattr = HE5_EHattrcat(fid,  grpname, attrnames, strbufsize);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot find the attributes. \n");
+	  H5Epush(__FILE__, "HE5_SWinqgrpattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	}
+
+      if (grpname != NULL) free(grpname);
+    }
+  
+  return (nattr);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwritegeogrpattr                                            |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with the "Geolocation     |
+|               Fields" group in a swath.                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  attrname       char                attribute name                          |
+|  numtype        hid_t               attribute dataset datatype ID           |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04   S.Zhao        Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWwritegeogrpattr(hid_t swathID, const char *attrname, hid_t numtype, hsize_t  count[], void *datbuf)
+{
+  herr_t     status          = FAIL;     /* Return status variable        */
+ 
+  hid_t      fid             = FAIL;     /* HDF-EOS file ID               */
+  hid_t      gid             = FAIL;     /* "HDFEOS" group ID             */
+  hid_t      GeoFieldsGrpID  = FAIL;     /* "Geolocation Fields" group ID */
+ 
+  long       idx             = FAIL;     /* Swath index                   */
+ 
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer          */
+  hid_t      numbertype;
+ 
+  HE5_LOCK;
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+ 
+  /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use numtype itself
+  */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      numbertype = numtype;
+    }
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWwritegeogrpattr", &fid, &gid, &idx);
+ 
+  if (status == SUCCEED)
+    {
+      /* Get "Geolocation Fields" group ID and call HE5_EHattr to perform I/O */
+      /* -------------------------------------------------------------------- */
+      GeoFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Geolocation Fields");
+      if(GeoFieldsGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Geolocation Fields\" group ID. \n");
+	  H5Epush(__FILE__, "HE5_SWwritegeogrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+ 
+      status = HE5_EHattr(GeoFieldsGrpID, attrname, numbertype, count,"w", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write attribute \"%s\"to the \"Geolocation Fields\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_SWwritegeogrpattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+      status = H5Gclose(GeoFieldsGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Geolocation Fields\" group ID. \n");
+	  H5Epush(__FILE__, "HE5_SWwritegeogrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+ 
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWreadgeogrpattr                                             |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from the "Geolocation Fields" group           |
+|               in a swath.                                                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04   S.Zhao        Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWreadgeogrpattr(hid_t swathID, const char *attrname, void * datbuf)
+{
+  herr_t      status          = FAIL;     /* return status variable          */
+ 
+  hid_t       fid             = FAIL;     /* HDF-EOS file ID                 */
+  hid_t       gid             = FAIL;     /* "HDFEOS" group ID               */
+  hid_t       ntype           = FAIL;     /* Data type ID                    */
+  hid_t       GeoFieldsGrpID  = FAIL;     /* "Geolocation Fields" group ID   */
+ 
+  long        idx             = FAIL;     /* Swath index                     */
+ 
+  hsize_t     count[]         = { 0 };    /* # of attribute elements         */
+ 
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer            */
+ 
+ 
+  HE5_LOCK;
+  CHECKPOINTER(attrname);
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWreadgeogrpattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get "Geolocation Fields"  group ID and call HE5_EHattr to perform I/O */
+      /* --------------------------------------------------------------------- */
+      GeoFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Geolocation Fields");
+      if(GeoFieldsGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Geolocation Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_SWreadgeogrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+        }
+ 
+      status = HE5_EHattr(GeoFieldsGrpID,attrname,ntype,count,"r", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot read attribute \"%s\" from the \"Geolocation Fields\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_SWreadgeogrpattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }
+ 
+      status = H5Gclose(GeoFieldsGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Geolocation Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_SWreadgeogrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+    }
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+ 
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWgeogrpattrinfo                                             |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about attributes in "Geolocation Fields"|
+|               group.                                                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  attrname       const char*         attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               data type ID                            |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWgeogrpattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t     status          = FAIL;     /* routine return status variable */
+ 
+  hid_t      fid             = FAIL;     /* HDF-EOS file ID                */
+  hid_t      gid             = FAIL;     /* "HDFEOS" group ID              */
+  hid_t      GeoFieldsGrpID  = FAIL;     /* "Geolocation Fields" group ID  */
+ 
+  long       idx             = FAIL;     /* Swath index                    */
+ 
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/*  Error message buffer          */
+ 
+  CHECKPOINTER(attrname);
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWgeogrpattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get "Geolocation Fields"  group ID and call HE5_EHattrinfo */
+      /* ---------------------------------------------------------- */
+      GeoFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Geolocation Fields");
+      if(GeoFieldsGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Geolocation Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_SWgeogrpattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+ 
+      status = HE5_EHattrinfo(GeoFieldsGrpID,attrname,ntype,count);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot retrieve information about attribute \"%s\" in the \"Geolocation Fields\" group.\n",attrname);
+	  H5Epush(__FILE__, "HE5_SWgeogrpattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+      status = H5Gclose(GeoFieldsGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Geolocation Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_SWgeogrpattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+    }
+ 
+ COMPLETION:
+  return (status);
+}
+ 
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqgeogrpattrs                                             |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list in "Geolocation Fields" group.                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in "Geolocation    |
+|                                     Fields" group.                          |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swath ID       hid_t               swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in "Geolocation Fields" |
+|                                     group (Comma-separated list)            |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_SWinqgeogrpattrs(hid_t swathID, char *attrnames, long *strbufsize)
+{
+  long            nattr   = FAIL;             /* Number of attributes (return)  */
+  long            idx     = FAIL;             /* Swath index                    */
+ 
+  herr_t          status  = FAIL;             /* Return status variable         */
+ 
+  hid_t           fid     = FAIL;             /* HDF-EOS file ID                */
+  hid_t           gid     = FAIL;             /* "SWATHS" group ID              */
+ 
+  char            *grpname = (char *)NULL;    /* Group name string              */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer           */
+ 
+ 
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWinqgeogrpattrs", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) );
+      if( grpname == NULL)
+        {
+          H5Epush(__FILE__, "HE5_SWinqgeogrpattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Can not allocate memory");
+          HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+          return(FAIL);
+        }
+ 
+      strcpy(grpname,"/HDFEOS/SWATHS/");
+      strcat(grpname, HE5_SWXSwath[idx].swname);
+      strcat(grpname,"/Geolocation Fields");
+ 
+      /* search group with grpname for the number of attributes */
+      /* ------------------------------------------------------ */
+      nattr = HE5_EHattrcat(fid,  grpname, attrnames, strbufsize);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot find the attributes. \n");
+	  H5Epush(__FILE__, "HE5_SWinqgeogrpattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	}
+ 
+      if (grpname != NULL) free(grpname);
+    }
+ 
+  return (nattr);
+}
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwritelocattr                                               |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with a specified field in |
+|                        a swath.                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fieldname      char                field name                              |
+|  attrname       char                attribute name                          |
+|  numtype        hid_t               attribute dataset datatype ID           |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jan 00   A.Muslimov                                                        |
+|  Jul 00   A.Muslimov    Unmasked hdf5 data types.                           |
+|  Nov 00   A.Muslimov    Added writing local attribute to the field of       |
+|                          "Geolocation Fields" group.                        |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  Jan 04   S.Zhao        Added writing local attribute to the field of       |
+|                         "Profile Fields" group.                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWwritelocattr(hid_t swathID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t  count[], void *datbuf)
+{
+  herr_t     status          =  FAIL;    /* Return status variable */
+
+  int        fldgroup        =  FAIL;    /* Field group flag       */
+  
+  hid_t      fid             =  FAIL;    /* HDF-EOS file ID        */
+  hid_t      gid             =  FAIL;    /* "HDFEOS" group ID      */
+  hid_t      FieldGrpID      =  FAIL;    /* Field group ID         */
+  hid_t      fieldID         =  FAIL;    /* Field dataset ID       */
+  
+  long       idx             =  FAIL;    /* Swath index            */
+  
+  char       *grpname = (char *)NULL;    /* Group name buffer      */    
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+  hid_t      numbertype;
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+
+  /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use numtype itself
+  */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      numbertype = numtype;
+    }
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWwritelocattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Allocate memory for the group name buffer */
+      /* ----------------------------------------- */
+      grpname = (char *)calloc(64, sizeof(char) );
+      if( grpname == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n");
+          H5Epush(__FILE__, "HE5_SWwritelocattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      /* Get the field group flag */
+      /* ------------------------ */
+      fldgroup = HE5_SWfldsrch(swathID,(char *)fieldname,NULL,NULL,NULL,NULL);
+      if(fldgroup == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get the group flag for \"%s\" field.\n",fieldname);
+	  H5Epush(__FILE__, "HE5_SWwritelocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      if (fldgroup == HE5_HDFE_GEOGROUP)
+	strcpy(grpname,"Geolocation Fields");
+
+      else if (fldgroup == HE5_HDFE_DATAGROUP)
+	strcpy(grpname,"Data Fields");
+
+      else if (fldgroup == HE5_HDFE_PROFGROUP)
+	strcpy(grpname,"Profile Fields");
+
+
+      /* Get the Field group ID */
+      /* ---------------------- */
+      FieldGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, grpname);
+      if(FieldGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" group.\n", grpname);
+	  H5Epush(__FILE__, "HE5_SWwritelocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      /* Get field ID and call HE5_EHattr to perform I/O */
+      /* ----------------------------------------------- */
+      fieldID = H5Dopen(FieldGrpID, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWwritelocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      /* Call EHattr() to perform I/O */
+      /* ---------------------------- */
+      status = HE5_EHattr(fieldID, attrname, numbertype, count,"w", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write Attribute \"%s\" for the \"%s\" field.\n", attrname, fieldname);
+	  H5Epush(__FILE__, "HE5_SWwritelocattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}
+
+      /* Release dataset ID */
+      /* ------------------ */
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWwritelocattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}
+
+      /* Release group ID */
+      /* ---------------- */
+      status = H5Gclose(FieldGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" group ID.\n",grpname);
+	  H5Epush(__FILE__, "HE5_SWwritelocattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}
+
+      free(grpname);
+    }
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);	
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWreadlocattr                                                |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with a specified field in a swath. |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fieldname      char                fieldname                               |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jan 00   A.Muslimov    Original version.                                   |
+|  Jul 00   A.Muslimov    Unmasked hdf5 data types.                           |
+|  Nov 00   A.Muslimov    Added reading local attribute from "Geolocation     |
+|                          Fields" group.                                     |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  Jan 04   S.Zhao        Added reading local attribute from the field of     |
+|                         "Profile Fields" group.                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_SWreadlocattr(hid_t swathID, const char *fieldname, const char *attrname, void * datbuf)
+{
+  herr_t      status          =  FAIL;    /* return status variable   */
+
+  int         fldgroup        =  FAIL;    /* Field group flag         */
+
+  hid_t       fid             =  FAIL;    /* HDF-EOS file ID          */
+  hid_t       gid             =  FAIL;    /* "HDFEOS" group ID        */
+  hid_t       ntype           =  FAIL;    /* Data type ID             */
+  hid_t       FieldGrpID      =  FAIL;    /* Field group ID           */
+  hid_t       fieldID         =  FAIL;    /* Field dataset ID         */
+  
+  long        idx             =  FAIL;    /* Swath index              */
+  
+  hsize_t     count[]         = { 0 };    /* number of elements       */
+  
+  char        *grpname = (char *)NULL;    /* Group name buffer        */
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */
+
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(attrname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWreadlocattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Allocate memory for the group name buffer */
+      /* ----------------------------------------- */
+      grpname = (char *)calloc(64, sizeof(char) );
+      if( grpname == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n");
+          H5Epush(__FILE__, "HE5_SWreadlocattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      /* Get the field group flag */
+      /* ------------------------ */
+      fldgroup = HE5_SWfldsrch(swathID,(char *)fieldname,NULL,NULL,NULL,NULL);
+      if(fldgroup == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get the group flag for \"%s\" field. \n",fieldname);
+	  H5Epush(__FILE__, "HE5_SWreadlocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      if (fldgroup == HE5_HDFE_GEOGROUP)
+	strcpy(grpname,"Geolocation Fields");
+
+      else if (fldgroup == HE5_HDFE_DATAGROUP)
+	strcpy(grpname,"Data Fields");
+
+      else if (fldgroup == HE5_HDFE_PROFGROUP)
+	strcpy(grpname,"Profile Fields");
+
+
+      /* Get Field  group ID  */
+      /* -------------------- */
+      FieldGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, grpname);
+      if(FieldGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" group.\n", grpname);
+	  H5Epush(__FILE__, "HE5_SWreadlocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      /* Get field ID and call HE5_EHattr to perform I/O */
+      /* ----------------------------------------------- */
+      fieldID = H5Dopen(FieldGrpID, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWreadlocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+        
+      /* Call EHattr() to perform I/O */
+      /* ---------------------------- */
+      status = HE5_EHattr(fieldID,attrname,ntype,count,"r", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" field.\n", attrname,fieldname);
+	  H5Epush(__FILE__, "HE5_SWreadlocattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}
+
+      /* Release the dataset ID */
+      /* ---------------------- */
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWreadlocattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}	
+
+      /* Release the group ID */
+      /* -------------------- */
+      status = H5Gclose(FieldGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" group ID.\n", grpname);
+	  H5Epush(__FILE__, "HE5_SWreadlocattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}
+	
+      free(grpname);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWlocattrinfo                                                |
+|                                                                             |
+|  DESCRIPTION: Retrievs information about attribute associated with a        |
+|               specified field in the "Data Fields" / "Geolocation Fields" / |
+|               "Profile Fields" group.                                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fieldname      char*               field name                              |
+|  attrname       const char*         attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               data type ID                            |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jan 00   A.Muslimov    Original draft.                                     |
+|  May 00   A.Muslimov    Replaced 'H5T_class_t' type by 'int' data type.     |
+|  Jul 00   A.Muslimov    Unmasked hdf5 data types.                           |
+|  Nov 00   A.Muslimov    Added retrieving info about attribute to a          |
+|                          field from the "Geolocation Fields" group.         |
+|  Feb 03   S.Zhao        Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|  Jan 04   S.Zhao        Added retrieving info about attribute from a field  |
+|                         in the "Profile Fields" group.                      |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWlocattrinfo(hid_t swathID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t     status          =  FAIL;    /* Return status variable */
+  
+  int        fldgroup        =  FAIL;    /* Field group flag       */
+
+  hid_t      fid             =  FAIL;    /* HDF-EOS file ID        */
+  hid_t      gid             =  FAIL;    /* "HDFEOS" group ID      */
+  hid_t      FieldGrpID      =  FAIL;    /* Field group ID         */
+  hid_t      fieldID         =  FAIL;    /* Field dataset ID       */
+
+  long       idx             =  FAIL;    /* Swath index            */
+  
+  char       *grpname  = (char *)NULL;   /* Group name buffer      */
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+  
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(attrname); 
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */ 
+  status = HE5_SWchkswid(swathID, "HE5_SWlocattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Allocate memory for the group name buffer */
+      /* ----------------------------------------- */
+      grpname = (char *)calloc(64, sizeof(char) );
+      if( grpname == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n");
+          H5Epush(__FILE__, "HE5_SWlocattrinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      /* Get the field group flag */
+      /* ------------------------ */
+      fldgroup = HE5_SWfldsrch(swathID,(char *)fieldname,NULL,NULL,NULL,NULL);
+      if(fldgroup == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get the group flag for \"%s\" field. \n",fieldname);
+	  H5Epush(__FILE__, "HE5_SWlocattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      if (fldgroup == HE5_HDFE_GEOGROUP)
+	strcpy(grpname,"Geolocation Fields");
+
+      else if (fldgroup == HE5_HDFE_DATAGROUP)
+	strcpy(grpname,"Data Fields");
+
+      else if (fldgroup == HE5_HDFE_PROFGROUP)
+	strcpy(grpname,"Profile Fields");
+
+      /* Get Field  group ID  */
+      /* -------------------  */
+      FieldGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, grpname);
+      if(FieldGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" group.\n", grpname);
+	  H5Epush(__FILE__, "HE5_SWlocattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      /* Get field ID */
+      /* ------------ */
+      fieldID = H5Dopen(FieldGrpID, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWlocattrinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      /* Call EHattrinfo() to perform I/O */
+      /* -------------------------------- */
+      status = HE5_EHattrinfo(fieldID,attrname,ntype,count);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"%s\" group.\n", attrname, grpname);
+	  H5Epush(__FILE__, "HE5_SWlocattrinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}
+
+      /* Release dataset ID */
+      /* ------------------ */
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_SWlocattrinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}	
+
+      /* Release group ID */
+      /* ---------------- */
+      status = H5Gclose(FieldGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the field group ID.\n");
+	  H5Epush(__FILE__, "HE5_SWlocattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}	
+	  
+      free(grpname);	  
+    }
+
+ COMPLETION:
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqdscaleattrs                                             |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list associated with a specified dimension scale   |
+|                in a swath.                                                  |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                number of attributes (-1 if fails)      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t   None        HDF-EOS type swath  ID                  |
+|  fieldname      char                dimension scale name                    |
+|  attrnames      char                attribute name(s)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                String length of attribute (in bytes)   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  June 10   Abe Taaheri  Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqdscaleattrs(hid_t swathID, const char *fieldname, char *attrnames, long *strbufsize)
+{
+  long       nattr         =  0;  /* Number of attributes (return)  */
+  long       idx           = FAIL;/* Swath index                    */    
+  
+  herr_t     status        = FAIL;/* routine return status variable */
+  
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  
+  char       *dtsname      = NULL;/* Buffer for dataset name        */
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];
+  
+  CHECKPOINTER(fieldname);
+  
+  /*
+**********************************************************
+*  Check for proper swath ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Swath index                *  
+**********************************************************
+*/
+  status = HE5_SWchkswid(swathID, "HE5_SWinqdscaleattrs", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Checking for swath ID failed.\n" );
+      H5Epush(__FILE__, "HE5_SWinqdscaleattrs", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtsname = (char *) calloc(HE5_HDFE_NAMBUFSIZE, 1);
+  if( dtsname == NULL)
+    {
+      sprintf(errbuf, "Can not allocate memory.\n");
+      H5Epush(__FILE__, "HE5_SWinqdscaleattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+	
+  strcpy(dtsname,"/HDFEOS/SWATHS/");
+  strcat(dtsname, HE5_SWXSwath[idx].swname);
+  strcat(dtsname,"/");
+  strcat(dtsname,fieldname);
+
+  nattr = HE5_EHattrcat(fid, dtsname, attrnames, strbufsize);
+	
+  if (dtsname != NULL) free(dtsname);
+    
+ COMPLETION:
+  return(nattr);
+	
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqlocattrs                                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list associated with a specified field in the      |
+|                "Data Fields" / "Geolocation Fields" / "Profile Fields"      |
+|                group.                                                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in "Data Fields"   |
+|                                       group.                                |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fieldname      char                field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in "Data Fields" group  |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jan 00   A.Muslimov                                                        |
+|  Jul 00   A.Muslimov    Unmasked hdf5 data types.                           |
+|  Nov 00   A.Muslimov    Added inquiring about local attributes from         |
+|                          "Geolocation Fields" group.                        |
+|  Jan 04   S.Zhao        Added inquiring about local attributes from         |
+|                         the "Profile Fields" group.                         |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqlocattrs(hid_t swathID, const char *fieldname, char *attrnames, long *strbufsize)
+{
+  long            nattr       = FAIL;         /* Number of attributes     */
+  long            idx         = FAIL;         /* Swath index              */
+
+  herr_t          status      = FAIL;         /* Return status variable   */
+
+  int             fldgroup    =  FAIL;        /* Field group flag         */ 
+
+  hid_t           fid         = FAIL;         /* HDF-EOS file ID          */
+  hid_t           gid         = FAIL;         /* "SWATHS" group ID        */
+    
+  char            *dtsname    = (char *)NULL; /* Dataset name string      */
+  char            *grpname    = (char *)NULL; /* Group name buffer        */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */  
+
+  CHECKPOINTER(fieldname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWinqlocattrs", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      /* Allocate memory for the dataset name buffer */
+      /* ------------------------------------------- */
+      dtsname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) );
+      if( dtsname == NULL)
+        {
+	  sprintf(errbuf, "Cannot allocate memory for the dataset name buffer. \n");
+          H5Epush(__FILE__, "HE5_SWinqlocattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      /* Allocate memory for the group name buffer */
+      /* ----------------------------------------- */
+      grpname = (char *)calloc(64, sizeof(char) );
+      if( grpname == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n");
+          H5Epush(__FILE__, "HE5_SWinqlocattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(dtsname);
+          return(FAIL);
+        }
+
+      /* Get the field group flag */
+      /* ------------------------ */
+      fldgroup = HE5_SWfldsrch(swathID,(char *)fieldname,NULL,NULL,NULL,NULL);
+      if(fldgroup == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get the group flag for \"%s\" field.\n",fieldname);
+	  H5Epush(__FILE__, "HE5_SWinqlocattrs", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  free(dtsname);
+	  return(FAIL);
+	}
+
+      if (fldgroup == HE5_HDFE_GEOGROUP)
+	strcpy(grpname,"/Geolocation Fields/");
+
+      else if (fldgroup == HE5_HDFE_DATAGROUP)
+	strcpy(grpname,"/Data Fields/");
+
+      else if (fldgroup == HE5_HDFE_PROFGROUP)
+	strcpy(grpname,"/Profile Fields/");
+
+      strcpy(dtsname,"/HDFEOS/SWATHS/");
+      strcat(dtsname, HE5_SWXSwath[idx].swname);
+      strcat(dtsname, grpname);
+      strcat(dtsname, fieldname);
+	  
+      /* search group with grpname for the number of attributes */
+      /* ------------------------------------------------------ */ 
+      nattr = HE5_EHattrcat(fid,  dtsname, attrnames, strbufsize);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot find the attributes. \n");
+	  H5Epush(__FILE__, "HE5_SWinqlocattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+
+      if (dtsname != NULL) free(dtsname);
+      if (grpname != NULL) free(grpname);
+    }
+  
+ COMPLETION:
+  return(nattr);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PRdefine                                                     |
+|                                                                             |
+|  DESCRIPTION:  Defines "Profile" dataset within a specified Swath, under the|
+|                 "Profile Fields" group.                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status (0) SUCCEED (-1)     |
+|                                          FAIL                               |
+|  INPUTS:                                                                    |
+|    swathID      hid_t                    Swath ID                           |
+|    profilename  const char               Profile/dataset name               |
+|    dimlist      char                     Comma separated list of dimensions |
+|    maxdimlist   char                     List of maximum dimensions         |
+|    datatype_id  hid_t                    Base datatype ID                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    None                                                                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Jun  00  A.Muslimov    Original development                                |
+|  Jul  00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  00  A.Muslimov    Changed referencing the "Data Fields" to "Profile   |
+|                          Fields".                                           |
+|  Oct  00  A.Muslimov    Moved a block that tries to retrieve a fill value   |
+|                          to HE5_PRwrite() interface.                        |
+|  Dec  00  A.Muslimov    Modified to add "dimlist" and "maxdimlist" parame-  |
+|                          ters and related metadata blocks.                  |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  Feb  03  S. Zhao       Added the creation of the "Profile Fields" group.   |
+|  Aug  03  S.Zhao        Added Szip compression methods.                     |
+|  May  05  S.Zhao        Added HE5_EHdtype2numtype() function call.          |
+|  Sep  11  Abe Taaheri   Modified for correcting Unlimited dimension         |
+|                         behavior and extension, removing hardcoded name     |
+|                         Unlim                                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_PRdefine(hid_t swathID, const char *profilename, char *dimlist, char *maxdimlist, hid_t numbertype_in)
+{ 
+  herr_t        status      = FAIL;               /* Status variable (return)  */
+
+  int           i;                                /* Loop index                */
+  int           compcode    = FAIL;               /* Compression method flag   */
+  int           foundAllDim = 1;                  /* "found all dims" flag     */
+  int           append      = FALSE;              /* "Appendability" flag      */
+  int           first       = 1;                  /* first entry flag          */
+  int           rank        = 0;                  /* Profile rank              */
+  int           maxrank     = 0;                  /* Max. dims rank            */
+
+  hid_t         heos_gid    = FAIL;               /* "SWATHS" group ID         */
+  hid_t         fid         = FAIL;               /* HDF-EOS file ID           */
+  hid_t         gid         = FAIL;               /* "Profile Fields" group ID */
+  hid_t         dataset     = FAIL;               /* Profile dataset ID        */
+  hid_t         space       = FAIL;               /* Data space ID             */
+  hid_t         type        = FAIL;               /* Data type ID              */
+  hid_t         numtype     = FAIL;               /* Number type               */
+  hid_t         datatype_id;                      /* HDF5 type Number type     */
+
+  hsize_t       metavalue   = 0;                  /* Metadata value to insert  */
+  hsize_t       dims[HE5_DTSETRANKMAX];           /* Dimension size array      */
+  hsize_t       maxdims[HE5_DTSETRANKMAX];        /* Dimension size array      */
+  hsize_t       dimsize     = 0;                  /* Dimension size            */
+
+  long          idx         = FAIL;               /* Swath index               */
+
+  H5D_layout_t  layout      = H5D_LAYOUT_ERROR;   /* Type of storage layout    */
+
+  char          *dimbuf     = (char *)NULL;       /* Dimension buffer          */
+  char          *comma      = (char *)NULL;       /* Pointer to comma          */
+  char          *dimcheck   = (char *)NULL;       /* Dimension check buffer    */
+  char          maxdimlstbuf[HE5_HDFE_DIMBUFSIZE];/* Max. dim. list buffer     */
+  char          dimlstbuf[HE5_HDFE_DIMBUFSIZE];   /* Dim. list buffer          */
+  char          compparmbuf[HE5_HDFE_DIMBUFSIZE]; /* Compression parameter     */
+  char          utlbuf[HE5_HDFE_UTLBUFSIZE];      /* Utility buffer            */
+  char          utlbuf2[HE5_HDFE_UTLBUFSIZE];     /* Utility buffer 2          */
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];      /* Error message buffer      */
+  char          *HDFcomp[18] = {"HE5_HDFE_COMP_NONE", "HE5_HDFE_COMP_RLE", "HE5_HDFE_COMP_NBIT", "HE5_HDFE_COMP_SKPHUFF", "HE5_HDFE_COMP_DEFLATE", "HE5_HDFE_COMP_SZIP_CHIP", "HE5_HDFE_COMP_SZIP_K13", "HE5_HDFE_COMP_SZIP_EC", "HE5_HDFE_COMP_SZIP_NN", "HE5_HDFE_COMP_SZIP_K13orEC", "HE5_HDFE_COMP_SZIP_K13orNN", "HE5_HDFE_COMP_SHUF_DEFLATE", "HE5_HDFE_COMP_SHUF_SZIP_CHIP", "HE5_HDFE_COMP_SHUF_SZIP_K13", "HE5_HDFE_COMP_SHUF_SZIP_EC", "HE5_HDFE_COMP_SHUF_SZIP_NN", "HE5_HDFE_COMP_SHUF_SZIP_K13o [...]
+
+
+  HE5_LOCK;
+  CHECKNAME(profilename);
+  CHECKPOINTER(dimlist);
+
+
+  /* Convert HDF-EOS5 datatype to HDF5 datatype */
+  if (
+      H5Tequal(numbertype_in, H5T_NATIVE_CHAR)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SHORT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_INT)    == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UINT)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LONG)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LLONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_FLOAT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== SUCCEED ||
+      H5Tequal(numbertype_in, H5T_C_S1) == SUCCEED)
+    {
+      datatype_id = numbertype_in;
+    }
+  else
+    {
+      datatype_id = HE5_EHconvdatatype((int) numbertype_in);
+    }
+
+  if(datatype_id == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID for PR Field.\n");
+      H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_PRdefine", &fid, &heos_gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* initialize dims and maxdims array */
+  /* --------------------------------- */
+  for(i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      dims[i]    = 0;
+      maxdims[i] = 0;
+    }
+	
+  /* Allocate space for dimbuf, copy dimlist into it, & append comma */
+  /* --------------------------------------------------------------- */
+  dimbuf = (char *) calloc(strlen(dimlist) + 64, sizeof(char));
+  if(dimbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n");
+      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+	
+  /*
+********************************************************************
+*   C H E C K  T H E   C O N T E N T   O F   dimlist  S T R I N G  *   
+********************************************************************
+*/
+  
+  strcpy(dimbuf, dimlist);
+  strcat(dimbuf, ",");
+  
+  /* Find comma */
+  /* ---------- */
+  comma = strchr(dimbuf, ',');
+	
+  /*
+   * Loop through entries in dimension list to make sure they are
+   *                    defined in swath
+   */
+  while (comma != NULL)
+    {
+      /* Copy dimension list entry to dimcheck */
+      /* ------------------------------------- */
+      dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char));
+      if(dimcheck == NULL)
+	{
+	  H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n");
+	  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	  free(dimbuf);
+	  return(FAIL);
+	}
+      memmove(dimcheck, dimbuf, comma - dimbuf);
+
+      /* Get dimension size */
+      /* ------------------ */
+      dimsize = HE5_SWdiminfo(swathID, dimcheck);
+      if (dimsize > 0)
+	{
+	  dims[rank] = dimsize;
+	  rank++;
+	}
+      else
+	{
+	  /*
+	   * If dimension list entry not found - set error return
+	   * status, append name to utility buffer for error report
+	   */
+	  status = FAIL;
+	  foundAllDim = 0;
+	  if (first == 1)
+	    strcpy(utlbuf, dimcheck);
+	  else
+	    {
+	      strcat(utlbuf, ",");
+	      strcat(utlbuf, dimcheck);
+	    }
+	  first = 0;
+	}
+
+      /*
+       * Go to next dimension entry, find next comma, & free up
+       * dimcheck buffer
+       */
+      memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); 
+      comma = strchr(dimbuf, ',');
+      free(dimcheck);
+
+    }
+  free(dimbuf);
+	
+  /* If no dimensions found, report error */
+  /* ------------------------------------ */
+  if (foundAllDim == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" profile. \n", utlbuf, profilename);
+      H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return (status); 
+    }
+	
+	
+  /*
+************************************************************************
+*   C H E C K  T H E   C O N T E N T   O F   maxdimlist   S T R I N G  *   
+************************************************************************
+*/
+	
+	
+  /* Allocate space for dimbuf, copy maxdimlist into it, & append comma */
+  /* ------------------------------------------------------------------ */
+  if(maxdimlist != NULL) 
+    {
+      dimbuf = (char *) calloc(strlen(maxdimlist) + 64, sizeof(char));
+      if(dimbuf == NULL)
+	{
+	  H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n");
+	  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	  return(FAIL);
+
+	}
+	  
+      /* Copy "maxdimlist" to "dimbuf", & append comma */
+      /* --------------------------------------------- */
+      strcpy(dimbuf, maxdimlist);
+      strcat(dimbuf, ",");
+
+      /* Find comma */
+      /* ---------- */
+      comma = strchr(dimbuf, ',');
+
+      /*
+       * Loop through entries in dimension list to make sure they are
+       *                     defined in swath
+       */
+      while (comma != NULL)
+	{
+	  /* Copy dimension list entry to dimcheck */
+	  /* ------------------------------------- */
+	  dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char));
+	  if(dimcheck == NULL)
+	    {
+	      H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n");
+	      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	      free(dimbuf);
+	      return(FAIL);
+	    }
+	  memmove(dimcheck, dimbuf, comma - dimbuf);
+
+	  /* Get dimension size */
+	  /* ------------------ */
+	  dimsize = HE5_SWdiminfo(swathID, dimcheck);
+	  if ( (dimsize > 0) || (dimsize == H5S_UNLIMITED)  )
+	    {
+	      maxdims[maxrank] = dimsize;
+	      maxrank++;
+	    }
+	  else
+	    {
+	      /*
+	       * If dimension list entry not found - set error return
+	       * status, append name to utility buffer for error report
+	       */
+	      status = FAIL;
+	      foundAllDim = 0;
+	      if (first == 1)
+		strcpy(utlbuf, dimcheck);
+	      else
+		{
+		  strcat(utlbuf, ",");
+		  strcat(utlbuf, dimcheck);
+		}
+	      first = 0;
+	    }
+
+	  /*
+	   * Go to next dimension entry, find next comma, & free up
+	   * dimcheck buffer
+	   */
+	  memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); 
+	  comma = strchr(dimbuf, ',');
+	  free(dimcheck);
+	}
+
+      free(dimbuf);
+
+      /* If no dimensions found, report error */
+      /* ------------------------------------ */
+      if (foundAllDim == 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" profile. \n", utlbuf, profilename);
+	  H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+
+
+      /* If maxrank !=rank  then report error */
+      /* ------------------------------------ */
+      if ( maxrank != rank )
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Dimension rank doesn't match Maximum dimension rank. \n");
+	  H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+    } 
+  /* "maxdimlist == NULL"  ==> maxdims[]= dims[] */
+  /* ------------------------------------------- */
+  else
+    {
+      for(i = 0; i < rank; i++ )
+	maxdims[ i ] = dims[ i ];
+    }
+
+  /* Find out if the dataset dimension is appendable */
+  /* ----------------------------------------------- */
+  for(i = 0; i < rank; i++)
+    {
+      if( dims[i] == maxdims[i] )
+	append = FALSE;
+      else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED))
+	{
+	  append = TRUE;
+	  break;
+	}
+      else
+	{
+	  status = FAIL;
+	  H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_BADRANGE, "Maximum dimension size is smaller than Dimension size. \n");
+	  HE5_EHprint("Error: Maximum dimension size is smaller than Dimension size, occured", __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+	
+  
+  /* Check for valid base data type ID */
+  /* --------------------------------- */
+  if (H5Tequal(datatype_id, H5T_NATIVE_CHAR)    == FAIL &&
+      H5Tequal(datatype_id, H5T_NATIVE_SCHAR)   == FAIL &&
+      H5Tequal(datatype_id, H5T_NATIVE_UCHAR)   == FAIL &&
+      H5Tequal(datatype_id, H5T_NATIVE_SHORT)   == FAIL &&
+      H5Tequal(datatype_id, H5T_NATIVE_USHORT)  == FAIL &&
+      H5Tequal(datatype_id, H5T_NATIVE_INT)     == FAIL &&
+      H5Tequal(datatype_id, H5T_NATIVE_UINT)    == FAIL &&
+      H5Tequal(datatype_id, H5T_NATIVE_LONG)    == FAIL &&
+      H5Tequal(datatype_id, H5T_NATIVE_ULONG)   == FAIL &&
+      H5Tequal(datatype_id, H5T_NATIVE_LLONG)   == FAIL &&
+      H5Tequal(datatype_id, H5T_NATIVE_ULLONG)  == FAIL &&
+      H5Tequal(datatype_id, H5T_NATIVE_FLOAT)   == FAIL &&
+      H5Tequal(datatype_id, H5T_NATIVE_DOUBLE)  == FAIL &&
+      H5Tequal(datatype_id, H5T_NATIVE_LDOUBLE) == FAIL
+      )
+    {
+      H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, "Invalid (unsupported) data type. \n");
+      HE5_EHprint("Error: Invalid (unsupported) data type, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Check if "Profile Fields" group exists */
+  /* -------------------------------------- */
+  if (HE5_SWXSwath[idx].prof_id != FAIL)
+    {
+ 
+      /* Get the "Profile Fields" group ID */
+      /* --------------------------------- */
+      gid = HE5_SWXSwath[idx].prof_id;
+ 
+    }
+  else
+    {
+ 
+      /* Create /SWATH/swathname/Profile Fields group */
+      /* -------------------------------------------- */
+      gid = H5Gcreate(HE5_SWXSwath[idx].sw_id, "Profile Fields", 0);
+      if (gid == FAIL)
+	{
+	  sprintf(errbuf,"Cannot create the \"Profile Fields\" group.\n");
+	  H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+ 
+      /* Setup External Arrays */
+      /* --------------------- */
+      HE5_SWXSwath[idx].prof_id = gid;
+ 
+    }
+
+		
+  /* Create dataspace then create dataset */
+  /*------------------------------------ */
+  if( HE5_SWXSwath[idx].plist == FAIL )     
+    HE5_SWXSwath[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+	
+  /* Get dataset layout */
+  /* ------------------ */
+  layout = H5Pget_layout(HE5_SWXSwath[idx].plist);
+  if (layout == H5D_LAYOUT_ERROR)
+    {
+      status = FAIL;
+      H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot get dataset layout.\n");
+      HE5_EHprint("Error: Cannot get dataset layout, occured", __FILE__, __LINE__);
+      return(status);
+    }
+	
+  if(append == FALSE)
+    space = H5Screate_simple(rank, dims, NULL);
+  else
+    {
+      if( layout == H5D_CHUNKED)
+	space = H5Screate_simple(rank, dims, maxdims);
+      else
+	{
+	  status = FAIL;
+	  H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_BADVALUE, "Appendable dataset MUST BE CHUNKED first.\n");
+	  HE5_EHprint("Error: Appendable dataset MUST BE CHUNKED first, occured", __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+	
+  /* Create the VL data type from the base data type */
+  /* ----------------------------------------------- */
+  type = H5Tvlen_create(datatype_id);
+  if (type == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot create the VL-data type for \"%s\" profile.\n", profilename);
+      H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status); 
+    }
+
+	
+  /* Create dataset */
+  /* -------------- */
+  dataset = H5Dcreate(gid, profilename, type, space, HE5_SWXSwath[idx].plist);
+  if (dataset == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot create dataset for \"%s\" profile. \n", profilename);
+      H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);   
+    }
+    
+  /* Extend the dataset. assure that it is at least dims size */
+  /* -------------------------------------------------------- */
+  if( append == TRUE)
+    {
+      status = H5Dextend(dataset, dims);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot extend the dataset for \"%s\" profile.\n", profilename);
+	  H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);   
+	}
+    }
+  
+  /* Store dataset IDs and dataset name */
+  /* ---------------------------------- */
+  if (HE5_SWXSwath[idx].nPROF > 0)
+    {
+      /* Allocate memory to "Profile" struct */
+      /* ----------------------------------- */
+      HE5_SWXSwath[idx].pdataset = (HE5_DTSinfo *)realloc((void *)HE5_SWXSwath[idx].pdataset,(HE5_SWXSwath[idx].nPROF + 1) * sizeof(HE5_DTSinfo));
+	  
+    }
+  else
+    {
+      HE5_SWXSwath[idx].pdataset = (HE5_DTSinfo *)calloc(1, sizeof(HE5_DTSinfo));
+      if (HE5_SWXSwath[idx].pdataset == (HE5_DTSinfo *)NULL )
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Cannot allocate memory for \"Profile\" structure. \n");
+	  H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	  
+	  
+    }
+  
+  /* Allocate memory to name */
+  /* ----------------------- */
+  HE5_SWXSwath[idx].pdataset[HE5_SWXSwath[idx].nPROF].name = (char *)calloc( (strlen(profilename)+1), sizeof(char) );
+  if ( HE5_SWXSwath[idx].pdataset[HE5_SWXSwath[idx].nPROF].name == (char *)NULL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot allocate memory for \"Profile\" structure. \n");
+      H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(HE5_SWXSwath[idx].pdataset);
+      return(status);
+    }
+  
+  /* Load Table */
+  /* ---------- */
+  HE5_SWXSwath[idx].pdataset[HE5_SWXSwath[idx].nPROF].ID = dataset;
+  strcpy(HE5_SWXSwath[idx].pdataset[HE5_SWXSwath[idx].nPROF].name, profilename);
+
+  /* Increment the profile counter */
+  /* ----------------------------- */
+  HE5_SWXSwath[idx].nPROF++;
+
+
+  /*  
+******************************************************************
+*                  SET   UP  METADATA  STRINGS                   *
+******************************************************************
+*/
+
+  /*  Set up "DimList" string content */
+  /*  ------------------------------- */
+  strcpy(utlbuf,"");
+  sprintf(utlbuf, "%s%s%s", profilename,":",dimlist);
+    
+  /* Set up "MaxdimList"  string content */
+  /* ----------------------------------- */ 
+  if ( maxdimlist != NULL)
+    {
+      status = HE5_EHmetalist(maxdimlist,maxdimlstbuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot convert the input \"%s\" list to the metadata list. \n", maxdimlist);
+	  H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+      sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=", maxdimlstbuf);
+      strcat(utlbuf,utlbuf2);
+		 
+    }
+  if (maxdimlist == NULL)
+    {
+      status = HE5_EHmetalist(dimlist,dimlstbuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot convert the input \"%s\" list to the metadata list.\n", dimlist);
+	  H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+      sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=", dimlstbuf);
+      strcat(utlbuf,utlbuf2);       
+		
+    }
+
+  /* Get current compression code */
+  /* ---------------------------- */
+  compcode = HE5_SWXSwath[idx].compcode;
+    
+  /* setup "CompressionType" & "CompressionParams" strings content */
+  /* ------------------------------------------------------------- */
+  if (compcode != HE5_HDFE_COMP_NONE)
+    {
+      sprintf(utlbuf2,"%s%s","\n\t\t\t\tCompressionType=", HDFcomp[compcode]);
+		
+      switch (compcode)
+	{
+	case HE5_HDFE_COMP_NBIT:
+
+	  sprintf(compparmbuf,
+		  "%s%d,%d,%d,%d%s",
+		  "\n\t\t\t\tCompressionParams=(",
+		  HE5_SWXSwath[idx].compparm[0],
+		  HE5_SWXSwath[idx].compparm[1],
+		  HE5_SWXSwath[idx].compparm[2],
+		  HE5_SWXSwath[idx].compparm[3], ")");
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+			
+			
+	case HE5_HDFE_COMP_DEFLATE:
+			
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SZIP_CHIP:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SZIP_K13:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SZIP_EC:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SZIP_NN:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SZIP_K13orEC:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SZIP_K13orNN:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SHUF_DEFLATE:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_CHIP:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_K13:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_EC:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_NN:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_K13orEC:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_K13orNN:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	default:
+	  { 
+	    sprintf(errbuf,"Compression code \"%d\" is not supported. \n", compcode);
+	    H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  }
+			
+	  break;		    
+			
+			
+	}
+	  
+      /* Concatanate compression parameters with compression code */
+      /* -------------------------------------------------------- */
+      strcat(utlbuf, utlbuf2);
+    }
+	
+  /* Generate value of "DataType" metadata */
+  /* ------------------------------------- */
+  numtype = HE5_EHdtype2numtype(datatype_id);
+  if (numtype == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number type ID. \n");
+      H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else if (numtype == 0)
+    {
+      metavalue = 0;
+    }
+  else
+    {
+      metavalue = HE5_EHhid2hsize(numtype);
+      if (metavalue == 0)
+	{
+	  sprintf(errbuf, "Cannot convert \"hid_t\" to \"hsize_t\" data type. \n");
+	  H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+
+  /* 
+******************************************************************
+*   Insert metadata information to Structural Metadata section   *
+******************************************************************
+*/          
+  status = HE5_EHinsertmeta(fid, HE5_SWXSwath[idx].swname, "s", 5L, utlbuf, &metavalue);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot insert metadata for \"%s\" profile.\n",profilename);
+      H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);   
+    }
+	
+  /* Release data type ID */
+  /* -------------------- */
+  status = H5Tclose(type);    
+  if ( status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release the property list ID. \n");
+      H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(HE5_SWXSwath[idx].pdataset);
+      free(HE5_SWXSwath[idx].pdataset[HE5_SWXSwath[idx].nPROF].name);
+      return(status);
+    }
+
+  /* Release data space ID */
+  /* --------------------- */
+  status = H5Sclose(space);
+  if ( status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release the data space ID. \n");
+      H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(HE5_SWXSwath[idx].pdataset);
+      free(HE5_SWXSwath[idx].pdataset[HE5_SWXSwath[idx].nPROF].name);
+      return(status);
+    }
+  
+
+  /* Reset external array entry */
+  /* -------------------------- */
+  /* The reset was moved to HE5_PRwrite, to make dataset property reset
+     consistent with metadata reset. Unlike swath, grid and ZA, where the
+     property list is reset after definition of every field, the PR APIs
+     reset property list after first dataset writing (not definition), 
+     so if one defines several PR fields, all will have the same properties, 
+     such as compression.
+     HE5_SWXSwath[idx].compcode = HE5_HDFE_COMP_NONE;
+     
+     for (i = 0; i < 5; i++)       
+     HE5_SWXSwath[idx].compparm[ i ] = 0; 
+  */
+  
+ COMPLETION:  
+  HE5_UNLOCK;
+  return (status);    
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PRwrite                                                      |
+|                                                                             |
+|  DESCRIPTION: Writes data into the "Profile" dataset within a Swath.        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status (0) SUCCEED (-1)     |
+|                                          FAIL                               |
+|  INPUTS:                                                                    |
+|    Swath_ID     hid_t                    Swath ID                           |
+|    profilename  const char               Name of Profile dataset            |
+|    start        hssize_t                 start array                        |
+|    stride       hsize_t                  stride array                       |
+|    edge         hsize_t                  edge array                         |
+|    size         size_t                   Size (in bytes) of data to write   |
+|    buffer       void                     Data buffer                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    None                                                                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|     The "NULL" values for "start" and "edge" are not allowed.               |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  6/8/00   A.Muslimov    Original development                                |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  00  A.Muslimov    Changed referencing the "Data Fields" by "Profile   |
+|                            Fields".                                         |
+|  Oct 00   A.Muslimov    Added conditional release of the property list ID.  |
+|  Dec 00   A.Muslimov    Enhanced to add "start", "stride", and "edge" para- |
+|                            meters.                                          |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  Apr  03  S.Zhao        Added conversion from dataset base datatype ID to   |
+|                         memory base datatype ID.                            |
+|  Sep  06  Abe Taaheri   Added H5Dclose to close opened dataset              |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_PRwrite(hid_t swathID, const char *profilename, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], size_t size, void *buffer)
+{  
+  herr_t      status      = FAIL;         /* Status variable (return) */
+
+  int         rank        = FAIL;         /* Rank of profile dataset  */      
+  int         i;                          /* Loop index               */
+  int         append      = FALSE;        /* FLAG (appendability)     */
+
+  hid_t       heos_gid    = FAIL;         /* "SWATHS" group ID        */
+  hid_t       fid         = FAIL;         /* HDF-EOS file ID          */
+  hid_t       dataset     = FAIL;         /* Profile dataset ID       */
+  hid_t       datatype    = FAIL;         /* Profile datatype ID      */
+  hid_t       btype       = FAIL;         /* Dataset base datatype ID */
+  hid_t       space       = FAIL;         /* File data space ID       */  
+  hid_t       mspace      = FAIL;         /* Memory data space ID     */  
+  hid_t       xfer_list   = FAIL;         /* Property list ID         */     
+  hid_t       grp_id      = FAIL;         /* "Data Fields" group ID   */
+  hid_t       mbtype      = FAIL;         /* "Memory" base datatype ID*/
+  hid_t       mtype       = FAIL;         /* Memory data type ID      */
+
+  H5D_fill_value_t fill_status;      /* to see if fill value is set or not */
+
+  void        *value      = (void *)NULL; /* Temp fill value variable */
+
+  hsize_t     count[]     = { 1 };        /* Number of attr. elements */
+  hsize_t     dims[HE5_DTSETRANKMAX];     /* Array of dimension sizes */
+  hsize_t     maxdims[HE5_DTSETRANKMAX];  /* Array of Max. dim. sizes */
+  hsize_t     size_ext[HE5_DTSETRANKMAX]; /* Extended dimension size  */
+
+  size_t      tsize       = 0;            /* Size of base data type   */
+
+  long        idx         = FAIL;         /* Swath index              */
+
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */
+
+
+  HE5_LOCK;
+  CHECKPOINTER(profilename);
+  CHECKPOINTER(buffer);
+
+
+  /* assuming that fillvalue is undefined for the field */
+  fill_status = H5D_FILL_VALUE_UNDEFINED;
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_PRwrite", &fid, &heos_gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Initialize dims[]/maxdims[]/size_ext[] arrays */
+  /* --------------------------------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      dims[i]     = 0;
+      maxdims[i]  = 0;
+      size_ext[i] = 0;
+    }
+
+  /* Get "Profile Fields" group ID */
+  /* ----------------------------- */
+  grp_id = HE5_SWXSwath[idx].prof_id;
+
+  /* Open the dataset */
+  /* ---------------- */  
+  dataset = H5Dopen(grp_id, profilename);
+  if (dataset == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot open the profile \"%s\". \n", profilename);
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+    
+  /* Create property list ID */
+  /* ----------------------- */
+  xfer_list = H5Pcreate(H5P_DATASET_XFER);  
+  if (xfer_list == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot create the property list for the profile \"%s\". \n", profilename);
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get the dataset data type ID */
+  /* ---------------------------- */
+  datatype = H5Dget_type(dataset);
+  if (datatype == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot get the datatype ID for the profile \"%s\". \n", profilename);
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get the data space ID */
+  /* --------------------- */
+  space = H5Dget_space(dataset);
+  if (space == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot get the data space ID for the profile \"%s\". \n", profilename);
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get the base data type ID */
+  /* ------------------------- */
+  btype = H5Tget_super(datatype);
+  if( btype == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the base data type ID. \n");
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return (FAIL);
+    }
+
+  /* Get the memory base data type ID */
+  /* -------------------------------- */
+  mbtype = HE5_EHdtype2mtype(btype);
+  if (mbtype == FAIL)
+    {
+      sprintf(errbuf,"Cannot get the memory data type from the base data type.\n");
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Create data type ID */
+  /* ------------------- */
+  mtype  = H5Tvlen_create(mbtype);
+  if (mtype == FAIL)
+    {
+      sprintf(errbuf,"Cannot create data type from the base data type.\n");
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Get the size of a base data type in bytes */
+  /* ----------------------------------------- */ 
+  tsize = H5Tget_size(btype);
+  if( tsize == 0)
+    {
+      sprintf(errbuf, "Cannot get the size of a base data type. \n");
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return (FAIL);
+    }
+    
+
+  /* Allocate memory for a fill value */
+  /* -------------------------------- */
+  value = (void *)calloc(1, tsize);
+  if( value == (void *)NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for fill value. \n");
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+	
+  /* Try to retrieve the fill value (in case it's already defined) */
+  /* ------------------------------------------------------------- */ 
+  H5E_BEGIN_TRY {
+    status = H5Pfill_value_defined(HE5_SWXSwath[idx].plist, &fill_status );
+  }
+  H5E_END_TRY;
+  if (fill_status == H5D_FILL_VALUE_USER_DEFINED)
+    {
+      H5E_BEGIN_TRY {
+	status = H5Pget_fill_value(HE5_SWXSwath[idx].plist, btype, value);
+      }
+      H5E_END_TRY;
+      
+      /* Store fill value in the dataset attribute "_FillValue" */
+      /* -----------------------------------------------------  */ 
+      if( status != FAIL)
+	{
+	  status = HE5_EHattr( dataset, "_FillValue", btype, count, "w", value);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot write fill value to the attribute \"_FillValue\". \n");
+	      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(value);
+	      return(status);
+	    }
+	}
+    }  
+  free( value);
+
+  /* Get the dataset rank, and dimension sizes */
+  /* ----------------------------------------- */
+  rank = H5Sget_simple_extent_dims(space, dims, maxdims);
+  if (rank == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the data space dimension size and maximum dimension size. \n");
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }  
+
+  /* Find out if the dataset is extendible */
+  /* ------------------------------------- */
+  for(i = 0; i < rank; i++)
+    {
+      if(   dims[i] == maxdims[i] )
+	append = FALSE;
+      else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED))
+	{
+	  append = TRUE;
+	  break;
+	}
+      else
+	{
+	  sprintf(errbuf,"Maximum dimension size is smaller than dimension size.\n");
+	  H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    } 
+  
+  /* If the dataset is APPENDIBLE, extend it */
+  /* --------------------------------------- */
+  if (append == TRUE)
+    {
+      for(i = 0; i < rank; i++)
+	size_ext[ i ] = start[ i ] + edge[ i ];
+
+      status = H5Dextend(dataset, size_ext);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot extend the dataset. \n");
+	  H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+
+  /* Select the hyperslab */
+  /* -------------------- */
+  status = H5Sselect_hyperslab( space, H5S_SELECT_SET, (const hsize_t *)start, stride, edge, NULL) ;
+  if( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot select a hyperslab. \n");
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+	
+  /* Create dataspace in memory */
+  /* -------------------------- */
+  mspace = H5Screate_simple(rank, edge, NULL);
+  if( mspace == FAIL)
+    {
+      sprintf(errbuf,"Cannot create the memory data space.\n");
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Set "write" data buffer */
+  /* ----------------------- */
+  status = H5Pset_buffer(xfer_list, size, NULL, NULL);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot set data buffer for the profile \"%s\". \n", profilename);
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }  
+
+  /* Write data to the dataset */
+  /* ------------------------- */
+  status = H5Dwrite(dataset, mtype, mspace, space, xfer_list, buffer);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot write data to the profile \"%s\". \n", profilename);
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+  
+  /* Reclaim the write VL data. */
+  /* -------------------------- */ 
+  status = H5Dvlen_reclaim(datatype, space, H5P_DEFAULT, buffer);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot reclaim the write VL data for the profile \"%s\". \n", profilename);
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+  /* Release the data space ID */
+  /* ------------------------- */
+  status = H5Sclose(space);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the file data space ID. \n");
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Release the memory data space ID */
+  /* -------------------------------- */
+  status = H5Sclose(mspace);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the memory data space ID. \n");
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Check if the property list is "on" */
+  /* ---------------------------------- */
+  if ( HE5_SWXSwath[idx].plist  != FAIL )
+    {
+      /* Release property list ID */
+      /* ------------------------ */
+      status = H5Pclose(HE5_SWXSwath[idx].plist);
+      if ( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the property list ID.\n");
+	  H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      /* Reset the externally stored property list ID */
+      /* -------------------------------------------- */
+      HE5_SWXSwath[idx].plist   = FAIL;
+	
+      /* Reset external array entry */
+      /* -------------------------- */
+      HE5_SWXSwath[idx].compcode = HE5_HDFE_COMP_NONE;
+      
+      for (i = 0; i < 5; i++)       
+	HE5_SWXSwath[idx].compparm[ i ] = 0;  
+ 
+    }  
+
+
+  /* Release the xfer property list ID */
+  /* --------------------------------- */
+  status = H5Pclose(xfer_list);
+  if (status == FAIL)
+    { 
+      sprintf(errbuf, "Cannot release the xfer property list ID. \n");
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+
+  /* Release the data type ID */
+  /* ------------------------ */
+  status = H5Tclose(datatype);
+  if (status == FAIL)
+    { 
+      sprintf(errbuf, "Cannot release the data type ID. \n");
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+ 
+  /* Release dataset ID */
+  /* ------------------ */
+  status = H5Dclose(dataset);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release dataset ID.\n");
+      H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);    
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:  HE5_PRread                                                      |
+|                                                                             |
+|  DESCRIPTION:  Reads data from the profile dataset.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status (0) SUCCEED (-1)     |
+|                                          FAIL                               |
+|  INPUTS:                                                                    |
+|   swathID       hid_t                    Swath ID                           |
+|   profilename   const char               Name of profile/dataset            |
+|   start         hssize_t                 start array                        |
+|   stride        hsize_t                  stride array                       |
+|   edge          hsize_t                  edge array                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|   buffer        void                     Data buffer                        |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Jun 00   A.Muslimov    Original development                                |
+|  Jul 00   A.Muslimov    Unmasked hdf5 data types.                           |
+|  Jul 00   A.Muslimov    Added calls to H5Tget_super() and EHdtype2mtype()   |
+|                          to make sure that the data type ID passed to       |
+|                          H5Dread() won't cause a portability problem.       |
+|  Sep 00   A.Muslimov    Updated to change "Data Fields" group by "Profile   |
+|                          Fields" group.                                     |
+|  Dec 00   A.Muslimov    Enhanced to add "start", "stride", and "edge" para- |
+|                            meters.                                          |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|  Sep  06  Abe Taaheri   Added H5Dclose to close opened dataset              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t     
+HE5_PRread(hid_t swathID, const char *profilename, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void *buffer)
+{
+  herr_t      status      = FAIL;         /* Return status variable    */
+
+  /*  int         mem_used    =  0;*/           /* "Memory allocated"        */
+  int         rank        = FAIL;         /* Rank of profile dataset   */
+
+  hid_t       heos_gid    = FAIL;         /* "SWATHS" group ID         */
+  hid_t       fid         = FAIL;         /* HDF-EOS file ID           */
+  hid_t       dataset     = FAIL;         /* dataset ID                */
+  hid_t       plist       = FAIL;         /* Property list ID          */             
+  hid_t       type        = FAIL;         /* Datatype ID               */
+  hid_t       space       = FAIL;         /* File data space ID        */
+  hid_t       mspace      = FAIL;         /* Memory data space ID      */
+  hid_t       grp_id      = FAIL;         /* "Data Fields" group ID    */
+  hid_t       btype       = FAIL;         /* Base data type ID         */
+  hid_t       mbtype      = FAIL;         /* "Memory" base datatype ID */
+  hid_t       mtype       = FAIL;         /* "Memory" data type ID     */
+
+  long        idx         = FAIL;         /* Swath index               */
+
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer      */
+  
+
+  HE5_LOCK;
+  CHECKPOINTER(profilename);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_PRread", &fid, &heos_gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Get "Profile Fields" group ID */
+  /* ----------------------------- */
+  grp_id = HE5_SWXSwath[idx].prof_id;
+
+
+  /* Open the Profile dataset */
+  /* ------------------------ */ 
+  dataset = H5Dopen(grp_id, profilename);
+  if (dataset == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot open the profile dataset \"%s\". \n", profilename);
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get the file data space ID */
+  /* -------------------------- */
+  space = H5Dget_space(dataset);
+  if (space == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot get the space ID for the profile dataset \"%s\".\n", profilename);
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+  /* Create the property list */
+  /* ------------------------ */
+  plist = H5Pcreate(H5P_DATASET_XFER);
+  if (plist == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot create the property list. \n");
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+  /* Set up memory manager */
+  /* --------------------- */ 
+  /*
+    status = H5Pset_vlen_mem_manager(plist,vltypes_alloc_custom, &mem_used,vltypes_free_custom, &mem_used);
+    if (status == FAIL)
+    {
+    sprintf(errbuf,"Cannot set up the memory manager. \n");
+    H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+    HE5_EHprint(errbuf, __FILE__, __LINE__);
+    return(status);
+    } 
+  */
+
+  /* Get the datatype ID */
+  /* ------------------- */
+  type = H5Dget_type(dataset);
+  if (type == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot get the data type ID.\n");
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get the dataset base data type ID */
+  /* --------------------------------- */
+  btype = H5Tget_super(type);
+  if (btype == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot get the base data type ID.\n");
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get the memory base data type ID */
+  /* -------------------------------- */
+  mbtype = HE5_EHdtype2mtype(btype);
+  if (mbtype == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot get the memory data type from the base data type.\n");
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Create data type ID */
+  /* ------------------- */
+  mtype  = H5Tvlen_create(mbtype);
+  if (mtype == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot create data type from the base data type.\n");
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get the dataset rank */
+  /* -------------------- */
+  rank = H5Sget_simple_extent_ndims(space);
+  if (rank == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot get the dataset rank.\n");
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Select the hyperslab */
+  /* -------------------- */
+  status = H5Sselect_hyperslab(space, H5S_SELECT_SET, (const hsize_t *)start, stride, edge, NULL) ;
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot select the hyperslab.\n");
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Create the memory dataspace */
+  /* --------------------------- */
+  mspace = H5Screate_simple(rank, edge, NULL); 
+  if (mspace == FAIL)
+    {
+      status = FAIL;
+      sprintf(errbuf,"Cannot create the memory dataspace.\n");
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Read out the dataset from the disk  */
+  /* ----------------------------------- */
+  status = H5Dread(dataset, mtype, mspace, space, plist, buffer);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot read the data from profile dataset \"%s\".\n",profilename);
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  /* Save the IDs for "reclaimspace" */
+  /* ------------------------------- */
+  profile.plist_id  = plist;
+  profile.type_id   = mtype;  
+  profile.space_id  = space;
+
+
+  /* Release "disk" data type ID */
+  /* --------------------------- */
+  status = H5Tclose(type);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release data type ID.\n");
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Release memory space ID */
+  /* ----------------------- */
+  status = H5Sclose(mspace);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release memory space ID.\n");
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Release base data type ID */
+  /* ------------------------- */
+  status = H5Tclose(btype);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release base data type ID.\n");
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  /* Release dataset ID */
+  /* ------------------ */
+  status = H5Dclose(dataset);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release dataset ID.\n");
+      H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);    
+}
+
+/*
+  ------------------------------------------------------------ 
+  |       VL datatype custom memory allocation routine       |
+  ------------------------------------------------------------
+*/ 
+/*
+  void *vltypes_alloc_custom(size_t size, void *info)
+  {
+  void   *ret_value = NULL;
+  int    *mem_used  = (int *)info;
+  size_t extra;
+
+  extra = MAX(sizeof(void *), sizeof(int));
+  if ( (ret_value = malloc(extra+size)) != NULL)
+  {
+  *(int *)ret_value = (int)size;
+*mem_used += (int)size;
+}
+ret_value = ((unsigned char*)ret_value) + extra;
+return(ret_value);
+}
+*/
+
+/*
+  ------------------------------------------------------------ 
+  |       VL datatype custom memory freeing routine          |
+  ------------------------------------------------------------
+*/ 
+/*
+  void vltypes_free_custom(void *_mem, void *info)
+  {
+  unsigned char  *mem;
+  int            *mem_used = (int *)info;
+  size_t         extra;
+
+  extra = MAX(sizeof(void *), sizeof(int));
+  if (_mem != NULL)
+  {
+  mem = ((unsigned char *)_mem) - extra;
+  *mem_used -= *(int *)mem;
+  free(mem);
+  } 
+  }
+*/
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PRreclaimspace                                               |
+|                                                                             |
+|  DESCRIPTION:  Reclaims the memory used by the read buffer.                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status (0) SUCCEED (-1)     |
+|                                          FAIL                               |
+|  INPUTS:                                                                    |
+|   swathID       hid_t                    Swath ID                           |
+|   profilename   const char               Name of profile/dataset            |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|   buffer        void                     Data buffer                        |
+|                                                                             |
+|  NOTES:                                                                     |
+|            After passing to H5Dvlen_reclaim the IDs may change,             |
+|             so please use externally stored ID values.                      |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  6/8/00   A.Muslimov    Original development                                |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t     
+HE5_PRreclaimspace(hid_t swathID, const char *profilename, void *buffer)
+{
+  herr_t      status      = FAIL;         /* Return status variable  */
+    
+  hid_t       heos_gid    = FAIL;         /* "SWATHS" group ID       */
+  hid_t       fid         = FAIL;         /* HDF-EOS file ID         */
+  hid_t       plist       = FAIL;         /* property list ID        */             
+  hid_t       type        = FAIL;         /* datatype ID             */
+  hid_t       space       = FAIL;         /* data space ID           */
+
+  long        idx         = FAIL;         /* Swath index             */
+
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+  
+  HE5_LOCK;
+  CHECKPOINTER(buffer);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_PRreclaimspace", &fid, &heos_gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_PRreclaimspace", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get the stored IDs  */
+  /* ------------------- */
+  type    = profile.type_id;
+  space   = profile.space_id;
+  plist   = profile.plist_id;
+  
+  /* Reclaim the data space */
+  /* ---------------------- */
+  status = H5Dvlen_reclaim(type, space, plist, buffer);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot reclaim the memory space. \n");
+      H5Epush(__FILE__, "HE5_PRreclaimspace", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+  /* Release property list ID */
+  /* ------------------------ */
+  status = H5Pclose(profile.plist_id);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the property list ID. \n");
+      H5Epush(__FILE__, "HE5_PRreclaimspace", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Release the data type ID */
+  /* ------------------------ */
+  status = H5Tclose(profile.type_id);
+  if (status == FAIL)
+    { 
+      sprintf(errbuf, "Cannot release the data type ID. \n");
+      H5Epush(__FILE__, "HE5_PRreclaimspace", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Release the data space ID */
+  /* ------------------------- */
+  status = H5Sclose(profile.space_id);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the data space ID. \n");
+      H5Epush(__FILE__, "HE5_PRreclaimspace", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Reset IDs for next buffer */
+  /* ------------------------- */
+  profile.type_id   = FAIL;
+  profile.space_id  = FAIL;
+  profile.plist_id  = FAIL;
+
+ COMPLETION:    
+  HE5_UNLOCK;
+  return (status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:  HE5_PRinquire                                                   |
+|                                                                             |
+|  DESCRIPTION:  Retrieves number of profiles in a swath                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  nProf          long                     Return number of profiles          |
+|                                          FAIL                               |
+|  INPUTS:                                                                    |
+|    swathID      hid_t                    swath ID                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    profnames    char                     List of profile names              |
+|    rank[]       int                      Profile/dataset rank array         |
+|    classID[]    H5T_class_t              Array of profile base datatype IDs |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  8/30/00  A. Muslimov   Original development                                |
+|  Sep 00   A. Muslimov   Modified to change "Data Fields" onto "Profile      |
+|                                Fields"                                      |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long  
+HE5_PRinquire(hid_t swathID, char *profnames, int *rank, H5T_class_t *classID)
+{
+
+  long       nProf    = FAIL;            /* Number of profiles        */
+  long       idx      = FAIL;            /* Swath index               */
+
+  int        index    = FAIL;            /* Iterator index            */
+  int        i;                          /* Loop index                */
+
+  herr_t     status   = FAIL;            /* Status variable           */
+   
+  hid_t      gid      = FAIL;            /* "SWATHS" group ID         */
+  hid_t      fid      = FAIL;            /* HDF-EOS file ID           */
+  hid_t      groupID  = FAIL;            /* "Profile Fields" group ID */
+  hid_t      profID   = FAIL;            /* Profile dataset ID        */
+  hid_t      typeID   = FAIL;            /* Dataset type ID           */
+  hid_t      spaceID  = FAIL;            /* Dataset space ID          */
+  hid_t      btypeID  = FAIL;            /* Base data type ID         */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer      */
+  char       *namebuf   = (char *)NULL;  /* Buffer for the list       */
+  char       *prname    = (char *)NULL;  /* Buffer for each entry     */    
+  char       *comma     = (char *)NULL;  /* Pntr to comma             */  
+  char       *groupname = (char *)NULL;  /* Group name string         */
+
+  HE5_OBJINFO    profdata;
+
+  
+  /* Initialize the output data structure */
+  /* ------------------------------------ */
+  profdata.count   = 0;
+  profdata.name    = NULL;
+  profdata.strsize = 0;
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_PRinquire", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  groupname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char));
+  if (groupname == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for \"groupname\".\n");
+      H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }  
+
+  strcpy(groupname,"/HDFEOS/SWATHS/");
+  strcat(groupname, HE5_SWXSwath[idx].swname);
+  strcat(groupname,"/Profile Fields");
+  
+  
+  /* Get "Profile Fields" group  ID */
+  /* ------------------------------ */
+  groupID = HE5_SWXSwath[idx].prof_id;
+
+  index = H5Giterate(groupID,groupname, NULL, HE5_EHobj_info, &profdata);
+  if (index < 0)
+    {
+      sprintf(errbuf,"Iteration through the \"Profile Fields\" group failed.\n");
+      H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(groupname);
+      if(profdata.name != NULL ) free(profdata.name);
+      return(FAIL);
+    }
+
+  free(groupname);
+
+  nProf = profdata.count;
+  
+  if (profnames != NULL)
+    strcpy(profnames,profdata.name);
+    
+  
+  if (rank != NULL || classID != NULL)
+    {
+      /* Allocate memory for name buffer */
+      /* ------------------------------- */
+      namebuf = (char *)calloc(strlen(profdata.name)+2, sizeof(char));
+      if (namebuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for \"namebuf\".\n");
+	  H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if(profdata.name != NULL ) free(profdata.name);
+	  return(FAIL);
+	}
+	  
+
+      strcpy(namebuf, profdata.name);
+      strcat(namebuf, ",");
+ 
+      /* Find comma */
+      /* ---------- */
+      comma = strchr(namebuf, ',');
+ 
+      i = 0;
+      /* Parse the list of profiles names */
+      /* -------------------------------- */
+      while (comma != NULL)
+	{
+	  /* Copy profile list entry to prname */
+	  /* --------------------------------- */
+	  prname = (char *)calloc(comma - namebuf + 1, sizeof(char));
+	  if (prname == NULL)
+	    {
+	      sprintf(errbuf,"Cannot allocate memory for \"Profile name\".\n");
+	      H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if(profdata.name != NULL ) free(profdata.name);
+	      if (namebuf != NULL) free(namebuf);
+	      return(FAIL);
+	    }
+
+	  memmove(prname, namebuf, comma - namebuf);
+	  prname[comma-namebuf] = 0;
+		  
+	  /* Open each profile dataset */
+	  /* ------------------------- */
+	  profID  = H5Dopen(groupID, prname);
+	  if (profID == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot open the profile \"%s\" dataset.\n", prname);
+	      H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (prname != NULL) free(prname);
+	      if (namebuf != NULL) free(namebuf);
+	      if (profdata.name != NULL ) free(profdata.name);
+	      return(FAIL);
+	    }
+
+	  if (rank != NULL)
+	    {
+	      /* Get rank of the dataset */
+	      /* ----------------------- */
+	      spaceID = H5Dget_space(profID);
+	      if (spaceID == FAIL)
+		{
+		  sprintf(errbuf,"Cannot get data space ID.\n");
+		  H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (prname != NULL) free(prname);
+		  if (namebuf != NULL) free(namebuf);
+		  if (profdata.name != NULL ) free(profdata.name);
+		  return(FAIL);
+		}
+
+	      rank[i] = H5Sget_simple_extent_ndims(spaceID);
+	      if (rank[i] == FAIL)
+		{
+		  sprintf(errbuf,"Cannot get dataset rank.\n");
+		  H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (prname != NULL) free(prname);
+		  if (namebuf != NULL) free(namebuf);
+		  if (profdata.name != NULL ) free(profdata.name);
+		  return(FAIL);
+		}
+			  
+	      status  = H5Sclose(spaceID);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf,"Cannot release data space ID.\n");
+		  H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (prname != NULL) free(prname);
+		  if (namebuf != NULL) free(namebuf);
+		  if (profdata.name != NULL ) free(profdata.name);
+		  return(FAIL);
+		}
+
+	    }
+
+	  if (classID != NULL)
+	    {
+	      /* Get base data type class ID */
+	      /* --------------------------- */
+	      typeID     = H5Dget_type(profID);
+	      if (typeID == FAIL)
+		{
+		  sprintf(errbuf,"Cannot get data type ID.\n");
+		  H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (prname != NULL) free(prname);
+		  if (namebuf != NULL) free(namebuf);
+		  if (profdata.name != NULL ) free(profdata.name);
+		  return(FAIL);
+		}
+			  
+	      btypeID    = H5Tget_super(typeID);
+	      if (btypeID == FAIL)
+		{
+		  sprintf(errbuf,"Cannot get base data type ID.\n");
+		  H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (prname != NULL) free(prname);
+		  if (namebuf != NULL) free(namebuf);
+		  if (profdata.name != NULL ) free(profdata.name);
+		  return(FAIL);
+		}
+
+	      /* ------------------------------------------ */
+	      /* Call "classID[i] = H5Tget_class(btypeID);" */
+	      /*  to get dataset (VL) data type class ID    */
+	      /* ------------------------------------------ */
+
+	      classID[i] = H5Tget_class(btypeID);
+	      if (classID[i] == H5T_NO_CLASS)
+		{
+		  sprintf(errbuf,"Cannot get data type class ID.\n");
+		  H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (prname != NULL) free(prname);
+		  if (namebuf != NULL) free(namebuf);
+		  if (profdata.name != NULL ) free(profdata.name);
+		  return(FAIL);
+		} 
+			  
+	      status   = H5Tclose(typeID);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf,"Cannot release data type ID.\n");
+		  H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (prname != NULL) free(prname);
+		  if (namebuf != NULL) free(namebuf);
+		  if (profdata.name != NULL ) free(profdata.name);
+		  return(FAIL);
+		}
+
+	    }
+
+	  /* Release dataset ID */
+	  /* ------------------ */
+	  status = H5Dclose(profID);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot release dataset ID.\n");
+	      H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (prname != NULL) free(prname);
+	      if (namebuf != NULL) free(namebuf);
+	      if (profdata.name != NULL ) free(profdata.name);
+	      return(FAIL);
+	    }
+		  
+
+	  /* Go to next list entry, find next comma, ... */
+	  /* ------------------------------------------- */ 
+	  memmove(namebuf, comma + 1, strlen(comma + 1) + 1); 
+	  comma = strchr(namebuf, ',');
+	  if (prname != NULL) free(prname);
+	  i++; 
+	}
+	  
+      free(namebuf);	  	  
+    }
+  
+  free(profdata.name);
+  
+  return(nProf);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:   HE5_PRinfo                                                     |
+|                                                                             |
+|  DESCRIPTION:  Retrieves information about specified profile.               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    swathID      hid_t                    swath ID                           |
+|    profname     char                     Profile name                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    rank[]       int                      Profile/dataset rank array         |
+|    dims[]       hsize_t                  dimension size array               |
+|    maxdims[]    hsize_t                  max. dimension size array          |
+|    ntype[]      hid_t                    Array of profile base numtype IDs  |
+|    dimlist      char                     Dimension list                     |
+|    maxdimlist   char                     Maximum Dimension List             |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  8/30/00  A. Muslimov   Original development                                |
+|  Sep  00  A. Muslimov   Modified to change the group from "Data Fields" to  |
+|                          "Profile Fields".                                  |
+|  Dec  00  A. Muslimov   Updated to set up "dimlist" and "maxdimlist" strings|
+|                          using metadata.                                    |
+|  May  03  S. Zhao       Changed the type of 'ntype' from an H5T_class_t to  |
+|                         an hid_t.                                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_PRinfo(hid_t swathID, const char *profname, int *rank, hsize_t dims[], hsize_t maxdims[], hid_t *ntype, char *dimlist, char *maxdimlist)
+{
+  herr_t     status   = FAIL;               /* Return status variable                 */
+  herr_t     statmeta = FAIL;               /* EHgetmetavalue return status           */
+
+  int        i        = 0;                  /* Loop index                             */
+
+  long       idx      = FAIL;               /* Swath index                            */
+  long       ndims    = 0;                  /* Number of dimensions                   */
+
+  hid_t      groupID  = FAIL;               /* "Profile Fields" group ID              */
+  hid_t      gid      = FAIL;               /* "SWATHS" group ID                      */
+  hid_t      fid      = FAIL;               /* HDF-EOS file ID                        */   
+  hid_t      profID   = FAIL;               /* Profile dataset ID                     */
+  hid_t      typeID   = FAIL;               /* Dataset type ID                        */
+  hid_t      spaceID  = FAIL;               /* Dataset space ID                       */
+  hid_t      btypeID  = FAIL;               /* Base data type ID                      */
+  H5T_class_t  classid = H5T_NO_CLASS;      /* data type class ID                     */
+
+  size_t     slen[HE5_DTSETRANKMAX];        /* Length of each entry in parsed string  */
+
+  char       *metabuf       = (char *)NULL; /* Ptr to structural metadata (SM)        */
+  char       *metaptrs[2]   = {NULL,NULL};  /* Ptrs to the begining and end of SM     */
+  char       utlstr[HE5_HDFE_UTLBUFSIZE];   /* Utility string                         */
+  char       *ptr[HE5_DTSETRANKMAX];        /* String pointers for parsed string      */
+  char       dimstr[HE5_HDFE_DIMBUFSIZE];   /* Individual dimension entry string      */
+  char       maxdimstr[HE5_HDFE_DIMBUFSIZE];/* Individual max. dimension entry string */
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];   /* Error message buffer                   */
+
+  CHECKPOINTER(profname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_PRinfo", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get "Profile Fields" group ID */
+  /* ----------------------------- */
+  groupID = HE5_SWXSwath[idx].prof_id;
+
+  /* Open specified profile dataset */
+  /* ------------------------------ */
+  profID     = H5Dopen(groupID, profname);
+  if (profID == FAIL)
+    {
+      sprintf(errbuf,"Cannot open \"%s\" profile.\n", profname);
+      H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+
+  /* Get data space ID */
+  /* ----------------- */
+  spaceID    = H5Dget_space(profID);
+  if (spaceID == FAIL)
+    {
+      sprintf(errbuf,"Cannot get data space ID.\n");
+      H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+
+  /* Get dataset rank */
+  /* ---------------- */
+  *rank = H5Sget_simple_extent_dims(spaceID, dims, maxdims);
+  if (*rank == FAIL)
+    {
+      sprintf(errbuf,"Cannot get rank of \"%s\" profile.\n", profname);
+      H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+
+
+  if (ntype != (hid_t *)NULL)
+    {
+      /* Get data type ID */
+      /* ---------------- */
+      typeID     = H5Dget_type(profID);
+      if (typeID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get data type ID.\n");
+	  H5Epush(__FILE__, "HE5_PR0info", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	} 
+	  
+      /* Get base data type ID */
+      /* --------------------- */
+      btypeID    = H5Tget_super(typeID);  
+      if (btypeID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get base data type ID.\n");
+	  H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	} 
+	  
+      /* Get data type class ID */
+      /* ---------------------- */
+      classid   = H5Tget_class(btypeID);
+      if (classid == H5T_NO_CLASS)
+	{
+	  sprintf(errbuf,"Cannot get data type class ID.\n");
+	  H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	} 
+
+      /* Get base number type ID */
+      /* ----------------------- */
+      *ntype = HE5_EHdtype2numtype(btypeID);
+      if (*ntype == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get base number type ID.\n");
+	  H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Release data type ID */
+      /* -------------------- */
+      status     = H5Tclose(typeID);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release data type ID.\n");
+	  H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+    }
+  
+  /* Release data space ID */
+  /* --------------------- */
+  status     = H5Sclose(spaceID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release data space ID.\n");
+      H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+
+
+  /* Release dataset ID */
+  /* ------------------ */
+  status = H5Dclose(profID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release dataset ID.\n");
+      H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Get pointers to "Profile Fields" section within SM */
+  /* -------------------------------------------------- */
+  metabuf = (char *)HE5_EHmetagroup(fid,HE5_SWXSwath[idx].swname,"s","ProfileField",metaptrs);
+  if ( metabuf == NULL )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot get pointer to  metabuf.\n");
+      H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  sprintf(utlstr, "%s%s%s", "\"", profname, "\"\n");
+  
+  metaptrs[0] = strstr(metaptrs[0], utlstr);
+  
+  /* If profile is found in "Profile Fields" group */
+  /* --------------------------------------------- */
+  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+    {
+      /* Get "DimList" string, trim off "(" and ")" */
+      /* ------------------------------------------ */
+      statmeta = HE5_EHgetmetavalue(metaptrs, "DimList", utlstr);
+      if (statmeta == SUCCEED)
+        {
+	  memmove(utlstr, utlstr + 1, strlen(utlstr) - 2);
+	  utlstr[strlen(utlstr) - 2] = 0;
+
+	  /* Initialize slen[] array */
+	  /* ----------------------- */
+	  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+	    slen[ i ] = 0;
+
+	  /* Parse trimmed "DimList" string and get rank */
+	  /* ------------------------------------------- */
+	  ndims = HE5_EHparsestr(utlstr, ',', ptr, slen);
+		  
+	  /*------------------------------------------------------------------------------*/
+	  /*           Metadata-based rank info (redundant)                               */
+	  /*------------------------------------------------------------------------------*/ 
+	  /* *rank = HE5_EHlong2int(ndims);                                               */
+	  /* if (*rank == FAIL)                                                           */
+	  /* {                                                                            */
+	  /* sprintf(errbuf, "Cannot convert from \"long\" to \"int\" data type. \n");    */
+	  /* H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);   */
+	  /* if (metabuf != NULL) free(metabuf);                                          */
+	  /* HE5_EHprint(errbuf, __FILE__, __LINE__);                                     */        
+	  /* return(FAIL);                                                                */
+	  /* }                                                                            */
+	  /*------------------------------------------------------------------------------*/
+
+        }
+      else
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "The \"DimList\" string not found in metadata. \n");
+	  H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf);
+	  if (metabuf != NULL) free(metabuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }
+
+
+      /* If "DimList" IS REQUESTED ...  */
+      /* -----------------------------  */
+      if (dimlist != NULL) 
+	{
+	  strcpy(dimstr,"");
+	  strcpy(dimlist,"");
+			
+	  /*
+	   * Copy each entry in DimList and remove leading and trailing quotes.
+	   * Get dimension sizes and concatenate dimension names to dimension list.
+	   */
+	  for (i = 0; i < ndims; i++)
+	    {
+	      memmove(dimstr, ptr[i] + 1, slen[i] - 2);
+	      dimstr[slen[i] - 2] = 0;
+	      if (i > 0)
+		{
+		  strcat(dimlist,",");
+		}
+	      strcat(dimlist, dimstr);
+	    }
+	}
+		
+
+      /* If "MaxdimList" IS REQUESTED  ...      */
+      /* -------------------------------------- */
+      if(maxdimlist != NULL)
+	{
+	  strcpy(utlstr,"");
+	  statmeta = HE5_EHgetmetavalue(metaptrs,"MaxdimList", utlstr);
+	  if (statmeta == SUCCEED)
+	    {
+	      memmove(utlstr, utlstr + 1, strlen(utlstr) - 2);
+	      utlstr[strlen(utlstr) - 2] = 0;
+	      ndims = HE5_EHparsestr(utlstr,',', ptr, slen);
+	    }
+	  else
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "The \"MaxdimList\" string not found in metadata. \n");
+	      H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+			
+	  strcpy(maxdimstr,"");
+	  strcpy(maxdimlist,"");
+			
+	  for (i = 0; i < ndims; i++)
+	    {
+	      memmove(maxdimstr, ptr[i] + 1, slen[i] - 2);
+	      maxdimstr[slen[i] - 2] = 0;
+	      if (maxdimlist != NULL)
+		{
+		  if (i > 0)
+		    {
+		      strcat(maxdimlist,",");
+		    }
+		  strcat(maxdimlist, maxdimstr);
+		}
+	    }
+	}
+	  
+    }
+
+
+  if (metabuf != NULL) free(metabuf);
+
+ COMPLETION:
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PRwritegrpattr                                               |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with the "Profile Fields" |
+|               group in a swath.                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  attrname       char                attribute name                          |
+|  numtype        hid_t               attribute dataset datatype ID           |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04   S.Zhao        Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_PRwritegrpattr(hid_t swathID, const char *attrname, hid_t numtype, hsize_t  count[], void *datbuf)
+{
+  herr_t     status          = FAIL;     /* Return status variable    */
+ 
+  hid_t      fid             = FAIL;     /* HDF-EOS file ID           */
+  hid_t      gid             = FAIL;     /* "HDFEOS" group ID         */
+  hid_t      ProfFieldsGrpID = FAIL;     /* "Profile Fields" group ID */
+ 
+  long       idx             = FAIL;     /* Swath index               */
+ 
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer      */
+  hid_t      numbertype;
+ 
+  HE5_LOCK;
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+
+  /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use numtype itself
+  */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      numbertype = numtype;
+    }
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_PRwritegrpattr", &fid, &gid, &idx);
+ 
+  if (status == SUCCEED)
+    {
+      /* Get "Profile Fields" group ID and call HE5_EHattr to perform I/O */
+      /* ---------------------------------------------------------------- */
+      ProfFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Profile Fields");
+      if(ProfFieldsGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Profile Fields\" group ID. \n");
+	  H5Epush(__FILE__, "HE5_PRwritegrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+ 
+      status = HE5_EHattr(ProfFieldsGrpID, attrname, numbertype, count,"w", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write attribute \"%s\"to the \"Profile Fields\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_PRwritegrpattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+      status = H5Gclose(ProfFieldsGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Profile Fields\" group ID. \n");
+	  H5Epush(__FILE__, "HE5_PRwritegrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PRreadgrpattr                                                |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from the "Profile Fields" group in a swath.   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04   S.Zhao        Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_PRreadgrpattr(hid_t swathID, const char *attrname, void * datbuf)
+{
+  herr_t      status          = FAIL;     /* return status variable      */
+ 
+  hid_t       fid             = FAIL;     /* HDF-EOS file ID             */
+  hid_t       gid             = FAIL;     /* "HDFEOS" group ID           */
+  hid_t       ntype           = FAIL;     /* Data type ID                */
+  hid_t       ProfFieldsGrpID = FAIL;     /* "Profile Fields" group ID   */
+ 
+  long        idx             = FAIL;     /* Swath index                 */
+ 
+  hsize_t     count[]         = { 0 };    /* # of attribute elements     */
+ 
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer        */
+ 
+ 
+  HE5_LOCK;
+  CHECKPOINTER(attrname);
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_PRreadgrpattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get "Profile Fields"  group ID and call HE5_EHattr to perform I/O */
+      /* ----------------------------------------------------------------- */
+      ProfFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Profile Fields");
+      if(ProfFieldsGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Profile Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PRreadgrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+ 
+      status = HE5_EHattr(ProfFieldsGrpID,attrname,ntype,count,"r", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot read attribute \"%s\" from the \"Profile Fields\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_PRreadgrpattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+      status = H5Gclose(ProfFieldsGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Profile Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PRreadgrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+    }
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+ 
+ 
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PRgrpattrinfo                                                |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about attributes in "Profile Fields"    |
+|               group.                                                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  attrname       const char*         attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               data type ID                            |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04   S.Zhao        Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_PRgrpattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t     status          = FAIL;     /* routine return status variable    */
+ 
+  hid_t      fid             = FAIL;     /* HDF-EOS file ID                   */
+  hid_t      gid             = FAIL;     /* "HDFEOS" group ID                 */
+  hid_t      ProfFieldsGrpID = FAIL;     /* "Profile Fields" group ID         */
+ 
+  long       idx             = FAIL;     /* Swath index                       */
+ 
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/*  Error message buffer             */
+ 
+  CHECKPOINTER(attrname);
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_PRgrpattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get "Profile Fields" group ID and call HE5_EHattrinfo */
+      /* ----------------------------------------------------- */
+      ProfFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Profile Fields");
+      if(ProfFieldsGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Profile Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PRgrpattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+ 
+      status = HE5_EHattrinfo(ProfFieldsGrpID,attrname,ntype,count);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot retrieve information about attribute \"%s\" in the \"Profile Fields\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_PRgrpattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+      status = H5Gclose(ProfFieldsGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Profile Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_PRgrpattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+    }
+ 
+ COMPLETION:
+  return (status);
+}
+ 
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PRinqgrpattrs                                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list in "Profile Fields" group                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in "Profile Fields"|
+|                                     group.                                  |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swath ID       hid_t               swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in "Profile Fields"     |
+|                                     group (Comma-separated list)            |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04   S.Zhao        Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_PRinqgrpattrs(hid_t swathID, char *attrnames, long *strbufsize)
+{
+  long            nattr   = FAIL;             /* Number of attributes (return)  */
+  long            idx     = FAIL;             /* Swath index                    */
+ 
+  herr_t          status  = FAIL;             /* Return status variable         */
+ 
+  hid_t           fid     = FAIL;             /* HDF-EOS file ID                */
+  hid_t           gid     = FAIL;             /* "SWATHS" group ID              */
+ 
+  char            *grpname = (char *)NULL;    /* Group name string              */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer           */
+ 
+ 
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_PRinqgrpattrs", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) );
+      if( grpname == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory. \n");
+	  H5Epush(__FILE__, "HE5_PRinqgrpattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+ 
+      strcpy(grpname,"/HDFEOS/SWATHS/");
+      strcat(grpname, HE5_SWXSwath[idx].swname);
+      strcat(grpname,"/Profile Fields");
+ 
+      /* search group with grpname for the number of attributes */
+      /* ------------------------------------------------------ */
+      nattr = HE5_EHattrcat(fid,  grpname, attrnames, strbufsize);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot find the attributes. \n");
+	  H5Epush(__FILE__, "HE5_PRinqgrpattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	}
+ 
+      if (grpname != NULL) free(grpname);
+    }
+ 
+  return (nattr);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWsetalias                                                   |
+|                                                                             |
+|  DESCRIPTION:  Defines alias for a specified field name                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    swathID      hid_t                    swath ID                           |
+|    fieldname    char                     Original field name                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    aliaslist    char                     List of aliases for the field name |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Sep  00  A. Muslimov   Original development                                |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_SWsetalias(hid_t swathID, char *fieldname, const char *aliaslist)
+{
+  herr_t   status     = FAIL;          /* return status variable      */
+
+  int      fldgroup   = FAIL;          /* Field group flag            */
+
+  hid_t    fid        = FAIL;          /* HDF-EOS file ID             */
+  hid_t    gid        = FAIL;          /* "SWATHS"  group ID          */
+  hid_t    groupID    = FAIL;          /* Field group ID              */
+
+  long     idx        = FAIL;          /* Swath index                 */
+
+  char     *buf       = NULL;          /* Pointer to temporary buffer */
+  char     *comma     = NULL;          /* Pointer to comma            */
+  char     *aliasname = NULL;          /* Pointer to the alias name   */
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer        */
+
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(aliaslist);
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWsetalias", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_SWsetalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Find out the field group */
+  /* ------------------------ */
+  fldgroup = HE5_SWfldsrch(swathID,fieldname,NULL,NULL,NULL,NULL);
+
+  if (fldgroup == HE5_HDFE_GEOGROUP)
+    groupID = HE5_SWXSwath[idx].geo_id;
+
+  else if (fldgroup == HE5_HDFE_DATAGROUP)
+    groupID = HE5_SWXSwath[idx].data_id;
+
+  else if (fldgroup == HE5_HDFE_PROFGROUP)
+    groupID = HE5_SWXSwath[idx].prof_id;
+  
+  else
+    {	  
+      sprintf(errbuf, "Cannot find \"%s\" field in swath. \n", fieldname);
+      H5Epush(__FILE__, "HE5_SWsetalias", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Allocate memory for temporary buffer */
+  /* ------------------------------------ */
+  buf = (char *)calloc(strlen(aliaslist)+64, sizeof(char));
+  if (buf == NULL)
+    {
+      sprintf(errbuf, "Cannot alocate memory for \"buf\". \n");
+      H5Epush(__FILE__, "HE5_SWsetalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+  /* Make a list like "name1,name2,name3," */
+  /* ------------------------------------- */
+  strcpy(buf,aliaslist);
+  strcat(buf,",");
+
+  /* Find first comma and make pointer pointing to it */
+  /* ------------------------------------------------ */
+  comma = strchr(buf, ',');
+  while(comma != NULL)
+    {
+      /* Allocate memory for individual entry */
+      /* ------------------------------------ */
+      aliasname = (char *)calloc(comma-buf+1, sizeof(char));
+      if (aliasname == NULL)
+	{
+	  sprintf(errbuf, "Cannot alocate memory for \"aliasname\". \n");
+	  H5Epush(__FILE__, "HE5_SWsetalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (buf != NULL) free(buf);
+	  return(FAIL);
+	}
+	  
+      /* Pick up an individual entry and put it to the "aliasname" */
+      /* --------------------------------------------------------- */
+      memmove(aliasname,buf,comma-buf);
+  
+      /* Create a symbolic link for a specified object */
+      /* --------------------------------------------- */
+      status = H5Glink(groupID, H5G_LINK_SOFT, fieldname, aliasname);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create an alias \"%s\" for \"%s\" field. \n", aliasname, fieldname);
+	  H5Epush(__FILE__, "HE5_SWsetalias", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (aliasname != NULL) free(aliasname);
+	  if (buf != NULL) free(buf);
+	  return(FAIL);
+	}
+  
+      /* Go to the next name entry */
+      /* ------------------------- */
+      memmove(buf, comma + 1, strlen(comma + 1) + 1); 
+      comma = strchr(buf, ',');
+      if (aliasname != NULL) free(aliasname);
+    }
+  
+  if (buf != NULL) free(buf);
+	  
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdropalias                                                  |
+|                                                                             |
+|  DESCRIPTION:  Removes the alias for a specified field name                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    swathID      hid_t                    swath ID                           |
+|    aliasname    char                     alias name to remove               |
+|    fldgroup     int                      Field group flag                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Sep  00  A. Muslimov   Original development                                |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_SWdropalias(hid_t swathID, int fldgroup, const char *aliasname)
+{  
+  herr_t   status     = FAIL;          /* return status variable   */
+
+  hid_t    fid        = FAIL;          /* HDF-EOS file ID          */
+  hid_t    gid        = FAIL;          /* "SWATHS"  group ID       */
+  hid_t    groupID    = FAIL;          /* Field group ID           */
+
+  long     idx        = FAIL;          /* Swath index              */
+
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */
+
+
+  HE5_LOCK;
+  CHECKPOINTER(aliasname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWdropalias", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_SWdropalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get Group ID */
+  /* ------------ */
+  if (fldgroup == HE5_HDFE_GEOGROUP)
+    groupID = HE5_SWXSwath[idx].geo_id;
+  else if (fldgroup == HE5_HDFE_DATAGROUP)
+    groupID = HE5_SWXSwath[idx].data_id;
+  else if (fldgroup == HE5_HDFE_PROFGROUP)
+    groupID = HE5_SWXSwath[idx].prof_id;
+  else
+    {	  
+      sprintf(errbuf, "Invalid input group flag. \n");
+      H5Epush(__FILE__, "HE5_SWdropalias", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Destroy a symbolic link */
+  /* ----------------------- */
+  status = H5Gunlink(groupID, aliasname);
+  if (status == FAIL)
+    {	  
+      sprintf(errbuf, "Cannot remove alias named \"%s\". \n", aliasname);
+      H5Epush(__FILE__, "HE5_SWdropalias", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqdfldalias                                               |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of fields & aliases and string length of|
+|                fields & aliases list in "Data Fields" group                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfldalias      long                Number of fields & aliases in "Data     |
+|                                     Fields" group.                          |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fldalias       char*               Fields & aliases names in "Data Fields" |
+|                                     group (Comma-separated list)            |
+|  strbufsize     long*               Fields & aliases name list string length|
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Mar 03    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_SWinqdfldalias(hid_t swathID, char *fldalias, long *strbufsize)
+{
+  long            nfldalias   = FAIL;         /* Number of fields & aliases (return)  */
+  long            idx     = FAIL;             /* Swath index                    */
+ 
+  herr_t          status  = FAIL;             /* Return status variable         */
+ 
+  hid_t           fid     = FAIL;             /* HDF-EOS file ID                */
+  hid_t           gid     = FAIL;             /* "SWATHS" group ID              */
+ 
+  char            *grpname = (char *)NULL;    /* Group name string              */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer           */
+ 
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWinqdfldalias", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) );
+      if( grpname == NULL)
+	{
+	  H5Epush(__FILE__, "HE5_SWinqdfldalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Can not allocate memory");
+	  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	  return(FAIL);
+	}
+ 
+      strcpy(grpname,"/HDFEOS/SWATHS/");
+      strcat(grpname, HE5_SWXSwath[idx].swname);
+      strcat(grpname,"/Data Fields");
+ 
+      /* search group with grpname for the number of fields & aliases */
+      /* ------------------------------------------------------------ */
+      nfldalias = HE5_EHdatasetcat(fid,  grpname, fldalias, strbufsize);
+      if ( nfldalias < 0 )
+	{
+	  sprintf(errbuf, "Cannot find the fields & aliases. \n");
+	  H5Epush(__FILE__, "HE5_SWinqdfldalias", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	}
+ 
+      if (grpname != NULL) free(grpname);
+    }
+  else
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_SWinqdfldalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  return (nfldalias);
+}
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqgfldalias                                               |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of fields & aliases and string length of|
+|                fields & aliases list in "Geolocation Fields" group          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfldalias      long                Number of fields & aliases in "Geo-     |
+|                                     location Fields" group.                 |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fldalias       char*               Fields & aliases names in "Geolocation  |
+|                                     Fields" group (Comma-separated list)    |
+|  strbufsize     long*               Fields & aliases name list string length|
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 03    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_SWinqgfldalias(hid_t swathID, char *fldalias, long *strbufsize)
+{
+  long            nfldalias   = FAIL;         /* Number of fields & aliases (return)  */
+  long            idx     = FAIL;             /* Swath index                    */
+ 
+  herr_t          status  = FAIL;             /* Return status variable         */
+ 
+  hid_t           fid     = FAIL;             /* HDF-EOS file ID                */
+  hid_t           gid     = FAIL;             /* "SWATHS" group ID              */
+ 
+  char            *grpname = (char *)NULL;    /* Group name string              */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer           */
+ 
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWinqgfldalias", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) );
+      if( grpname == NULL)
+	{
+	  H5Epush(__FILE__, "HE5_SWinqgfldalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Can not allocate memory");
+	  HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+	  return(FAIL);
+	}
+ 
+      strcpy(grpname,"/HDFEOS/SWATHS/");
+      strcat(grpname, HE5_SWXSwath[idx].swname);
+      strcat(grpname,"/Geolocation Fields");
+ 
+      /* search group with grpname for the number of fields & aliases */
+      /* ------------------------------------------------------------ */
+      nfldalias = HE5_EHdatasetcat(fid,  grpname, fldalias, strbufsize);
+      if ( nfldalias < 0 )
+	{
+	  sprintf(errbuf, "Cannot find the fields & aliases. \n");
+	  H5Epush(__FILE__, "HE5_SWinqgfldalias", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	}
+ 
+      if (grpname != NULL) free(grpname);
+    }
+  else
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_SWinqgfldalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  return (nfldalias);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWaliasinfo                                                  |
+|                                                                             |
+|  DESCRIPTION:  Retrieves information about field aliases                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    swathID      hid_t                    swath ID                           |
+|    aliasname    char                     alias name                         |
+|    fldgroup     int                      Field group flag                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    length       int                      Buffer size                        |
+|    buffer       char                     Buffer with original field name    |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Sep  00  A. Muslimov   Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_SWaliasinfo(hid_t swathID, int fldgroup, const char *aliasname, int *length, char *buffer)
+{
+  herr_t        status     = FAIL;               /* return status variable   */
+
+  int           type       = FAIL;               /* type-value of an object  */
+
+  size_t        size       = 0;                  /* Size of the name buffer  */
+
+  hid_t         fid        = FAIL;               /* HDF-EOS file ID          */
+  hid_t         gid        = FAIL;               /* "SWATHS"  group ID       */
+  hid_t         groupID    = FAIL;               /* Field group ID           */
+
+  long          idx        = FAIL;               /* Swath index              */
+
+  H5G_stat_t    *statbuf   = (H5G_stat_t *)NULL; /* pointer to a structure   */
+
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];     /* Error message buffer     */
+
+  CHECKPOINTER(aliasname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWaliasinfo", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_SWaliasinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Get the group ID */
+  /* ---------------- */
+  if (fldgroup == HE5_HDFE_GEOGROUP)
+    groupID = HE5_SWXSwath[idx].geo_id;
+  else if (fldgroup == HE5_HDFE_DATAGROUP)
+    groupID = HE5_SWXSwath[idx].data_id;
+  else if (fldgroup == HE5_HDFE_PROFGROUP)
+    groupID = HE5_SWXSwath[idx].prof_id;
+  else
+    {	  
+      sprintf(errbuf, "Invalid input group flag. \n");
+      H5Epush(__FILE__, "HE5_SWaliasinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  if (buffer == NULL)
+    {
+      /* Get the string length of a "real" name  */
+      /* --------------------------------------  */
+      statbuf = (H5G_stat_t *)calloc(1, sizeof(H5G_stat_t));   
+      if (statbuf == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for \"statbuf\". \n");
+	  H5Epush(__FILE__, "HE5_SWaliasinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Get the Object Info */
+      /* ------------------- */
+      status = H5Gget_objinfo(groupID, aliasname, 0, statbuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get information about \"%s\" alias. \n", aliasname);
+	  H5Epush(__FILE__, "HE5_SWaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* LINK name length with a null terminator */
+      /* --------------------------------------- */
+      size = statbuf->linklen;
+
+      /* Object type (dataset, link, etc) */
+      /* -------------------------------- */
+      type   = statbuf->type;
+  
+      /* Make sure that the object is a LINK */
+      /* ----------------------------------- */
+      if (type != H5G_LINK)
+	{
+	  sprintf(errbuf,"The object named \"%s\" is not a symbolic link.\n", aliasname);
+	  H5Epush(__FILE__, "HE5_SWaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      *length = (int)size;
+	  
+      if ( statbuf != (H5G_stat_t *)NULL ) free(statbuf);
+	  
+    }
+  
+  if (buffer != NULL)
+    {
+      size = (size_t)*length;
+	  
+      /* Get the "real" name by an "alias" */
+      /* --------------------------------- */
+      status = H5Gget_linkval(groupID, aliasname, size, buffer);
+      if (status == FAIL) 
+	{
+	  sprintf(errbuf,"Cannot get the real name for the alias named \"%s\".\n", aliasname);
+	  H5Epush(__FILE__, "HE5_SWaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+  
+ COMPLETION:
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWgetaliaslist                                               |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of aliases and the list of aliases in   |
+|                swath                                                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nalias         long                number of aliases in swath              |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fldgroup       int                 field group flag (geo or data)          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  aliaslist      char*               list of aliases (comma-separated list)  |
+|  strbufsize     long*               length of aliases list                  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 05    S.Zhao       Original development                                |
+|  Mar 06    Abe Taaheri  Added code to get alias strbufsize only when user   |
+|                         passes aliaslist as NULL pointer                    |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_SWgetaliaslist(hid_t swathID, int fldgroup, char *aliaslist, long *strbufsize)
+{
+  long            nalias  = FAIL;             /* Number of aliases (return)  */
+  long            idx     = FAIL;             /* Swath index                 */
+
+  herr_t          status  = FAIL;             /* Return status variable      */
+  hid_t           fid     = FAIL;             /* HDF-EOS file ID             */
+  hid_t           gid     = FAIL;             /* "SWATHS" group ID           */
+  char            *fieldlist = (char *)NULL;  /* List of fields              */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer        */
+  long            fldstrbuf = FAIL;           /* Buffer size for fields      */
+  long            nflds   = FAIL;             /* Number of fields            */
+  long            nfldalias = FAIL;           /* Number of fields & aliases  */
+  char            *fldalias = (char *)NULL;   /* List of fields & aliases    */
+  long            fldaliasbuf = FAIL;         /* Buffer size for fields & 
+						 aliases */
+  char            *buff   = (char *)NULL;     /* Pointer to temporary buffer */
+  char            *comma  = (char *)NULL;     /* Pointer to comma            */
+  char            *comma1 = (char *)NULL;     /* Pointer to comma            */
+  char            *nameptr = (char *)NULL;    /* Pointer to each name        */
+  char            *tmpbuf  = (char *)NULL;    /* Pointer to temp buffer      */
+  long            nameflag = FAIL;            /* Name flag                   */
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWgetaliaslist", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      /* If aliaslist and strbufsize desired */
+      /* ----------------------------------- */
+      if (fldgroup == HE5_HDFE_DATAGROUP)
+	{
+          /* Call "HE5_SWnentries" routine to get number of Data fields */
+          /* ---------------------------------------------------------- */
+          nflds = HE5_SWnentries(swathID, HE5_HDFE_NENTDFLD, &fldstrbuf);
+          if (nflds == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  
+          /* Allocate memory for fields list buffer */
+          /* -------------------------------------- */
+          fieldlist = (char *) calloc(fldstrbuf+6, sizeof(char));
+          if(fieldlist == NULL)
+	    {
+	      sprintf(errbuf,"Cannot allocate memory.\n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  
+          /* Call "HE5_SWinqdatafields" routine to get the list of Data 
+	     fields */
+          /* --------------------------------------------------------- */
+          nflds = HE5_SWinqdatafields(swathID, fieldlist, NULL, NULL);
+          if (nflds == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the list of fields in \"Data Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      return(FAIL);
+	    }
+	  
+          /* Call "HE5_SWinqdfldalias" routine to get number of fields & 
+	     aliases */
+          /* --------------------------------------------------------- */
+          nfldalias = HE5_SWinqdfldalias(swathID, NULL, &fldaliasbuf);
+          if (nfldalias == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the number of fields & aliases in \"Data Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      return(FAIL);
+	    }
+	  
+          /* Allocate memory for fields & aliases list buffer */
+          /* ------------------------------------------------ */
+          fldalias = (char *) calloc(fldaliasbuf+6, sizeof(char));
+          if(fldalias == NULL)
+	    {
+	      sprintf(errbuf,"Cannot allocate memory.\n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      return(FAIL);
+	    }
+	  
+          /* Call "HE5_SWinqdfldalias" routine to get the list of fields & 
+	     aliases */
+          /* ----------------------------------------------------------- */
+          nfldalias = HE5_SWinqdfldalias(swathID, fldalias, &fldaliasbuf);
+          if (nfldalias == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the list of fields & aliases in \"Data Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      free(fldalias);
+	      return(FAIL);
+	    } 
+        }
+      else if (fldgroup == HE5_HDFE_GEOGROUP)
+        {
+          /* Call "HE5_SWnentries" routine to get number of Geolocation 
+	     fields */
+          /* --------------------------------------------------------- */
+          nflds = HE5_SWnentries(swathID, HE5_HDFE_NENTGFLD, &fldstrbuf);
+          if (nflds == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the number of fields in \"Geolocation Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  
+          /* Allocate memory for fields list buffer */
+          /* -------------------------------------- */
+          fieldlist = (char *) calloc(fldstrbuf+6, sizeof(char));
+          if(fieldlist == NULL)
+	    {
+	      sprintf(errbuf,"Cannot allocate memory.\n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  
+          /* Call "HE5_SWinqgeofields" routine to get the list of 
+	     Geolocation fields */
+          /* -------------------------------------------------- */
+          nflds = HE5_SWinqgeofields(swathID, fieldlist, NULL, NULL);
+          if (nflds == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the list of fields in \"Geolocation Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      return(FAIL);
+	    }
+	  
+          /* Call "HE5_SWinqgfldalias" routine to get number of fields & 
+	     aliases */
+          /* --------------------------------------------------------- */
+          nfldalias = HE5_SWinqgfldalias(swathID, NULL, &fldaliasbuf);
+          if (nfldalias == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the number of fields & aliases in \"Geolocation Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      return(FAIL);
+	    }
+	  
+          /* Allocate memory for fields & aliases list buffer */
+          /* ------------------------------------------------ */
+          fldalias = (char *) calloc(fldaliasbuf+6, sizeof(char));
+          if(fldalias == NULL)
+	    {
+	      sprintf(errbuf,"Cannot allocate memory.\n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      return(FAIL);
+	    }
+	  
+          /* Call "HE5_SWinqgfldalias" routine to get the list of fields & 
+	     aliases */
+          /* ----------------------------------------------------------- */
+          nfldalias = HE5_SWinqgfldalias(swathID, fldalias, &fldaliasbuf);
+          if (nfldalias == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the list of fields & aliases in \"Geolocation Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      free(fldalias);
+	      return(FAIL);
+	    }
+        }
+      else
+        {
+          sprintf(errbuf, "Invalid input group flag. \n");
+          H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		  H5E_OHDR, H5E_NOTFOUND, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(FAIL);
+        }
+      
+      *strbufsize = strlen(fldalias) - strlen(fieldlist);
+      if (*strbufsize <= 0)
+        {
+          sprintf(errbuf, "Cannot find the aliases.\n");
+          H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		  H5E_OHDR, H5E_NOTFOUND, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          if(fieldlist != NULL) free(fieldlist);
+          if(fldalias != NULL) free(fldalias);
+          return(FAIL);
+        }
+      else
+        {
+          nalias = 0;
+	  
+          /* Allocate memory for temporary buffer */
+          /* ------------------------------------ */
+          buff = (char *)calloc(strlen(fldalias)+6, sizeof(char));
+          if (buff == NULL)
+            {
+	      sprintf(errbuf, "Cannot allocate memory for \"buff\". \n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if(fieldlist != NULL) free(fieldlist);
+	      if(fldalias != NULL) free(fldalias);
+	      return(FAIL);
+            }
+	  
+          /* Allocate memory for aliases */
+          /* --------------------------- */
+          tmpbuf = (char *)calloc(*strbufsize+6, sizeof(char));
+          if (tmpbuf == NULL)
+            {
+              sprintf(errbuf, "Cannot allocate memory for \"tmpbuf\". \n");
+              H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_RESOURCE, H5E_NOSPACE, errbuf);
+              HE5_EHprint(errbuf, __FILE__, __LINE__);
+              if(fieldlist != NULL) free(fieldlist);
+              if(fldalias != NULL) free(fldalias);
+              if(buff != NULL) free(buff);
+              return(FAIL);
+            }
+	  
+          strcpy(buff, fldalias);
+          strcat(buff, ",");
+          strcat(fieldlist, ",");
+	  
+          /* Find first comma and make pointer pointing to it */
+          /* ------------------------------------------------ */
+          comma = strchr(buff, ',');
+          while(comma != NULL)
+            {
+              /* Allocate memory for individual entry */
+              /* ------------------------------------ */
+              nameptr = (char *)calloc(comma-buff+6, sizeof(char));
+              if (nameptr == NULL)
+		{
+                  sprintf(errbuf,"Cannot allocate memory for \"nameptr\". \n");
+                  H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+			  H5E_RESOURCE, H5E_NOSPACE, errbuf);
+                  HE5_EHprint(errbuf, __FILE__, __LINE__);
+                  if(fieldlist != NULL) free(fieldlist);
+                  if(fldalias != NULL) free(fldalias);
+                  if(buff != NULL) free(buff);
+                  if(tmpbuf != NULL) free(tmpbuf);
+                  return(FAIL);
+		}
+	      
+              /* Pick up an individual entry and put it to the "nameptr" */
+              /* ------------------------------------------------------- */
+              memmove(nameptr,buff,comma-buff);
+              strcat(nameptr, ",");
+	      
+              nameflag = (strstr(fieldlist,nameptr) == NULL) ? 1 : 0;
+              if (nameflag == 1)
+		{
+                  comma1 = strchr(tmpbuf, ',');
+                  if(comma1 == NULL)
+		    strcpy(tmpbuf, nameptr);
+                  else
+		    strcat(tmpbuf, nameptr);
+		  
+                  nalias++;
+		}
+	      
+	      memmove(buff, comma + 1, strlen(comma + 1) + 1); 
+              comma = strchr(buff, ',');
+	      
+              if (nameptr != NULL) free(nameptr);
+	    }
+	}
+
+      if(aliaslist == NULL)/* just return buffersize 
+			      and number of aliases */
+	{
+	  if(nalias > 0 )
+	    {
+	      if (fieldlist != NULL) free(fieldlist);
+	      if (fldalias != NULL) free(fldalias);
+	      if (buff != NULL) free(buff);
+	      if (tmpbuf != NULL) free(tmpbuf);
+	      return (nalias);
+	    }
+	  else
+	    {
+	      sprintf(errbuf, "Cannot find the aliases.\n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_OHDR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if(fieldlist != NULL) free(fieldlist);
+	      if(fldalias != NULL) free(fldalias);
+	      if (buff != NULL) free(buff);
+	      if (tmpbuf != NULL) free(tmpbuf);
+	      return(FAIL);
+	    }
+	}
+      else
+	{
+	  if(nalias > 0 )
+	    {
+	      strncpy(aliaslist, tmpbuf, *strbufsize-1);
+	      aliaslist[*strbufsize-1] = '\0';
+	    }
+	  else
+	    {
+	      sprintf(errbuf, "Cannot find the aliases.\n");
+	      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+		      H5E_OHDR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if(fieldlist != NULL) free(fieldlist);
+	      if(fldalias != NULL) free(fldalias);
+	      if (buff != NULL) free(buff);
+	      if (tmpbuf != NULL) free(tmpbuf);
+	      return(FAIL);
+	    }
+	}
+    }
+  else
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, 
+	      H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  if (fieldlist != NULL) free(fieldlist);
+  if (fldalias != NULL) free(fldalias);
+  if (buff != NULL) free(buff);
+  if (tmpbuf != NULL) free(tmpbuf);
+
+  return (nalias);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWfldrename                                                  |
+|                                                                             |
+|  DESCRIPTION:  Changes the field name                                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    swathID      hid_t                    swath ID                           |
+|    oldfieldname char                     Original field name                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    newfieldname char                     New field name                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Sep  00  A. Muslimov   Original development                                |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_SWfldrename(hid_t swathID, char *oldfieldname, const char *newfieldname)
+{
+  
+  herr_t   status     = FAIL;          /* Return status variable */
+
+  int      fldgroup   = FAIL;          /* Field group flag       */
+  int      k;                          /* Loop index             */
+
+  hid_t    fid        = FAIL;          /* HDF-EOS file ID        */
+  hid_t    gid        = FAIL;          /* "SWATHS"  group ID     */
+  hid_t    groupID    = FAIL;          /* Field group ID         */
+
+  long     idx        = FAIL;          /* Swath index            */
+
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+
+
+
+  HE5_LOCK;
+  CHECKPOINTER(oldfieldname);
+  CHECKNAME(newfieldname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWfldrename", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_SWfldrename", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Find out the field group */
+  /* ------------------------ */
+  fldgroup = HE5_SWfldsrch(swathID,oldfieldname,NULL,NULL,NULL,NULL);
+  if (fldgroup == HE5_HDFE_GEOGROUP)
+    groupID = HE5_SWXSwath[idx].geo_id;
+  else if (fldgroup == HE5_HDFE_DATAGROUP)
+    groupID = HE5_SWXSwath[idx].data_id;
+  else if (fldgroup == HE5_HDFE_PROFGROUP)
+    groupID = HE5_SWXSwath[idx].prof_id;
+  else
+    {	  
+      sprintf(errbuf, "Error returning field group flag. \n");
+      H5Epush(__FILE__, "HE5_SWfldrename", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Rename the field */
+  /* ---------------- */
+  status = H5Gmove(groupID, oldfieldname, newfieldname);
+  if (status == FAIL)
+    {	  
+      sprintf(errbuf, "Cannot change the field name from \"%s\" to \"%s\". \n", oldfieldname, newfieldname);
+      H5Epush(__FILE__, "HE5_SWfldrename", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Update Table */
+  /* ------------ */
+  if (fldgroup == HE5_HDFE_DATAGROUP)
+    {
+      for (k = 0; k < HE5_SWXSwath[idx].nDFLD; k++)
+	{
+	  if (strcmp(HE5_SWXSwath[idx].ddataset[k].name, oldfieldname) == 0 )
+	    strcpy(HE5_SWXSwath[idx].ddataset[k].name, newfieldname);
+	}
+    }
+
+  if (fldgroup == HE5_HDFE_GEOGROUP)
+    {
+      for(k = 0; k < HE5_SWXSwath[idx].nGFLD; k++)
+	{
+	  if (strcmp(HE5_SWXSwath[idx].gdataset[k].name, oldfieldname) == 0 )
+	    strcpy(HE5_SWXSwath[idx].gdataset[k].name, newfieldname);
+	}
+    }
+
+  if (fldgroup == HE5_HDFE_PROFGROUP)
+    {
+      for(k = 0; k < HE5_SWXSwath[idx].nPROF; k++)
+	{
+	  if (strcmp(HE5_SWXSwath[idx].pdataset[k].name, oldfieldname) == 0 )
+	    strcpy(HE5_SWXSwath[idx].pdataset[k].name, newfieldname);
+	}
+    }
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWmountexternal                                              |
+|                                                                             |
+|  DESCRIPTION:  Mounts external data file onto "Data Fields",  "Profile      |
+|                    Fields", or "Geolocation Fields" group.                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|    extfID       hid_t                    External file ID                   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    swathID      hid_t                    swath ID                           |
+|    fldgroup     int                      Group flag                         |
+|    extfilename  char                     External File Name                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Sep  00  A. Muslimov   Original development                                |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t 
+HE5_SWmountexternal(hid_t swathID, int fldgroup, const char *extfilename)
+{
+  
+  hid_t    extfID     = FAIL;           /* External file ID (return)   */
+  hid_t    fid        = FAIL;           /* HDF-EOS file ID             */
+  hid_t    gid        = FAIL;           /* "SWATHS"  group ID          */
+  herr_t   status     = FAIL;           /* Return status variable      */
+
+  long     idx        = FAIL;           /* Swath index                 */
+
+  char     grpname[HE5_HDFE_NAMBUFSIZE];/* Group name buffer           */
+  char     errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer        */
+
+
+  HE5_LOCK; 
+  CHECKNAME(extfilename);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWmountexternal", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_SWmountexternal", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  strcpy(grpname,"/HDFEOS/SWATHS/");
+  strcat(grpname, HE5_SWXSwath[idx].swname);
+
+  if (fldgroup == HE5_HDFE_DATAGROUP)
+    strcat(grpname,"/Data Fields");
+
+  if (fldgroup == HE5_HDFE_PROFGROUP)
+    strcat(grpname,"/Profile Fields");
+
+  if (fldgroup == HE5_HDFE_GEOGROUP)
+    strcat(grpname,"/Geolocation Fields");
+
+
+  /* Open external data file */
+  /* ----------------------- */
+  extfID = H5Fopen(extfilename, H5F_ACC_RDONLY, H5P_DEFAULT);
+  if ( extfID == FAIL )
+    {
+      sprintf(errbuf, "Cannot open external file named \"%s\". \n", extfilename);
+      H5Epush(__FILE__, "HE5_SWmountexternal", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+
+  /* Mount external file */
+  /* ------------------- */
+  status = H5Fmount(fid, grpname, extfID, H5P_DEFAULT);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot mount external file onto \"%s\" group. \n", grpname);
+      H5Epush(__FILE__, "HE5_SWmountexternal", __LINE__, H5E_FILE, H5E_MOUNT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+ COMPLETION:  
+  HE5_UNLOCK;
+  return(extfID);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:     SWunmount                                                    |
+|                                                                             |
+|  DESCRIPTION:  Unmounts external data file from "Data Fields",  "Profile    |
+|                    Fields", or "Geolocation Fields" group.                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    swathID      hid_t                    swath ID                           |
+|    fldgroup     int                      Group flag                         |
+|    fileID       hid_t                    ID of file  to be unmounted        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Sep  00  A. Muslimov   Original development                                |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_SWunmount(hid_t swathID, int fldgroup, hid_t fileID)
+{
+  herr_t   status     = FAIL;           /* Return status variable */
+
+  hid_t    fid        = FAIL;           /* HDF-EOS file ID        */
+  hid_t    gid        = FAIL;           /* "SWATHS"  group ID     */
+
+  long     idx        = FAIL;           /* Swath index            */
+
+  char     grpname[HE5_HDFE_NAMBUFSIZE];/* Group name buffer      */
+  char     errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer   */
+
+
+  HE5_LOCK;
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWunmount", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_SWunmount", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  strcpy(grpname,"/HDFEOS/SWATHS/");
+  strcat(grpname, HE5_SWXSwath[idx].swname);
+
+  if (fldgroup == HE5_HDFE_DATAGROUP)
+    strcat(grpname,"/Data Fields");
+
+  if (fldgroup == HE5_HDFE_PROFGROUP)
+    strcat(grpname,"/Profile Fields");
+
+  if (fldgroup == HE5_HDFE_GEOGROUP)
+    strcat(grpname,"/Geolocation Fields");
+
+
+  status = H5Funmount(fid, grpname);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot unmount external file from \"%s\" group. \n", grpname);
+      H5Epush(__FILE__, "HE5_SWunmount", __LINE__, H5E_FILE, H5E_MOUNT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  status = H5Fclose(fileID);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot close external file. \n");
+      H5Epush(__FILE__, "HE5_SWunmount", __LINE__, H5E_FILE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWreadexternal                                               |
+|                                                                             |
+|  DESCRIPTION:  Reads external dataset                                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    swathID      hid_t                    swath ID                           |
+|    fldgroup     int                      Group flag                         |
+|    fieldname    char                     Field name to read                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    buffer       void                     Output data bufer                  |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Sep  00  A. Muslimov   Original development                                |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_SWreadexternal(hid_t swathID, int fldgroup, const char *fieldname, void *buffer)
+{
+  herr_t   status     = FAIL;/* return status variable      */
+
+  hid_t    fid        = FAIL;/* HDF-EOS file ID             */
+  hid_t    gid        = FAIL;/* "SWATHS"  group ID          */
+  hid_t    groupID    = FAIL;/* Group ID                    */
+  hid_t    datasetID  = FAIL;/* Dataset ID                  */
+  hid_t    typeID     = FAIL;/* File data type ID           */
+  hid_t    mtypeID    = FAIL;/* Memory datatype ID          */
+
+  long     idx        = FAIL;/* Swath index                 */
+
+  char     grpname[HE5_HDFE_NAMBUFSIZE];/* Group name buffer    */
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWreadexternal", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  strcpy(grpname,"/HDFEOS/SWATHS/");
+  strcat(grpname, HE5_SWXSwath[idx].swname);
+
+  if (fldgroup == HE5_HDFE_DATAGROUP)
+    strcat(grpname,"/Data Fields");
+
+  if (fldgroup == HE5_HDFE_PROFGROUP)
+    strcat(grpname,"/Profile Fields");
+
+  if (fldgroup == HE5_HDFE_GEOGROUP)
+    strcat(grpname,"/Geolocation Fields");
+
+
+  /* Open the group containing mounted file   */
+  /* ---------------------------------------- */
+  groupID = H5Gopen(fid, grpname);
+  if ( groupID == FAIL )
+    {
+      sprintf(errbuf, "Cannot open group containing mounted file. \n");
+      H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Open the dataset */
+  /* ---------------- */
+  datasetID = H5Dopen(groupID, fieldname);
+  if ( datasetID == FAIL )
+    {
+      sprintf(errbuf, "Cannot open mounted dataset. \n");
+      H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+
+  /* Get the data type ID */
+  /* -------------------- */
+  typeID = H5Dget_type(datasetID);
+  if ( typeID == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the data type ID of  mounted dataset. \n");
+      H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get memory data type ID */
+  /* ----------------------- */
+  mtypeID    = HE5_EHdtype2mtype(typeID);
+  if (mtypeID == FAIL)
+    {
+      sprintf(errbuf, "Cannot convert to memory data type.") ;
+      H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Read the mounted dataset */
+  /* ------------------------ */
+  status = H5Dread(datasetID, mtypeID, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot read mounted data.") ;
+      H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+  /* Release data type ID */
+  /* -------------------- */
+  status = H5Tclose(typeID);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release data type ID.") ;
+      H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Release dataset ID */
+  /* ------------------ */
+  status = H5Dclose(datasetID);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release dataset ID.") ;
+      H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Release the group ID */
+  /* -------------------- */
+  status = H5Gclose(groupID);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release group ID.") ;
+      H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWsetextdata                                                 |
+|                                                                             |
+|  DESCRIPTION: Sets external data files.                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  filelist       const char*         list of external files                  |
+|  offset         off_t               array of offsets (in bytes) from the    |
+|                                     beginning of the file to the location   |
+|                                     in the file where the data starts       |
+|  size           hsize_t             array of sizes (in bytes) reserved in   |
+|                                     the file for the data.                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 01   A.Muslimov    Original development.                               |
+|  Sep  01  A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_SWsetextdata(hid_t swathID, const char *filelist, off_t offset[], hsize_t size[])
+{
+  herr_t          status       = FAIL;        /* return status variable */
+
+  int             i;                          /* Loop index             */
+
+  hid_t           fid          = FAIL;        /* HDF-EOS file ID        */
+  hid_t           gid          = FAIL;        /* "HDFEOS" group ID      */
+  
+  long            idx          = FAIL;        /* Swath index            */
+  
+  char            *namebuf     = (char *)NULL;/* File list buffer       */
+  char            *filename    = (char *)NULL;/* File name buffer       */
+  char            *comma       = (char *)NULL;/* Pointer to comma       */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+  
+
+  HE5_LOCK;
+  CHECKPOINTER(filelist);
+  CHECKPOINTER(offset);
+  CHECKPOINTER(size);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWsetextdata", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for valid swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWsetextdata", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Get current dataset creation property list */
+  /* ------------------------------------------ */  
+  if( HE5_SWXSwath[idx].plist == FAIL)
+    HE5_SWXSwath[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+
+
+  /* Allocate space for namebuf, copy dimlist into it, & append comma */
+  /* ---------------------------------------------------------------- */
+  namebuf = (char *)calloc(strlen(filelist) + 64, sizeof(char));
+  if(namebuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWsetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory.");
+      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+	
+
+  /*
+********************************************************************
+*   C H E C K  T H E   C O N T E N T   O F  filelist  S T R I N G  *   
+********************************************************************
+*/
+
+  strcpy(namebuf, filelist);
+  strcat(namebuf, ",");
+
+  /* Find comma */
+  /* ---------- */
+  comma = strchr(namebuf, ',');
+  
+  i = 0;
+  
+  /* Parse the list of file names */
+  /* ---------------------------- */
+  while (comma != NULL)
+    {
+      /* Allocate memory for filename buffer */
+      /* ----------------------------------- */
+      filename = (char *) calloc(comma - namebuf + 1, sizeof(char));
+      if (filename == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for filename. \n") ;
+	  H5Epush(__FILE__, "HE5_SWsetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(namebuf);
+		  
+	  return(FAIL);
+	}
+	  
+      /* Copy file list entry to filename */
+      /* -------------------------------- */
+      memmove(filename, namebuf, comma - namebuf);
+      filename[comma-namebuf] = 0;
+	  
+      /* Set the property list */
+      /* --------------------- */
+      status = H5Pset_external(HE5_SWXSwath[idx].plist, filename, offset[i], size[i]);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot set external dataset property list.\n");
+	  H5Epush(__FILE__, "HE5_SWsetextdata", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(namebuf);
+	  free(filename);
+	  return(status);
+	}
+	  
+	  
+      /* Go to next file  entry, find next comma, ... */
+      /* ============================================ */ 
+      memmove(namebuf, comma + 1, strlen(comma + 1) + 1); 
+      comma = strchr(namebuf, ',');
+	  
+      if (filename != NULL) free(filename);
+	  
+      i++;
+    }
+  
+  if (namebuf != NULL) free(namebuf);
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWgetextdata                                                 |
+|                                                                             |
+|  DESCRIPTION: Gets external data files information.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfiles         int                 number of external files  SUCCEED,      |
+|                                               (-1) FAIL                     |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               swath structure ID                      |
+|  fieldname      char*               External field name                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  namelength     size_t              Length of each name entry               |
+|  filelist       char*               List of file names                      |
+|  offset         off_t               array of offsets (in bytes) from the    |
+|                                     beginning of the file to the location   |
+|                                     in the file where the data starts       |
+|  size           hsize_t             array of sizes (in bytes) reserved in   |
+|                                     the file for the data.                  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 01   A.Muslimov    Original development.                               |
+|  Sep 01   A. Muslimov   Added mutex "lock"/"unlock" calls.                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_SWgetextdata(hid_t swathID, char *fieldname, size_t namelength, char *filelist, off_t offset[], hsize_t size[])
+{
+  int             nfiles       = FAIL;        /* Number of ext. files   */
+  int             i;                          /* Loop index             */
+
+  size_t          slen         = 0;           /* String length          */
+
+  herr_t          status       = FAIL;        /* return status variable */
+
+  hid_t           fid          = FAIL;        /* HDF-EOS file ID        */
+  hid_t           gid          = FAIL;        /* "HDFEOS" group ID      */
+  hid_t           fieldID      = FAIL;        /* Data field ID          */
+  hid_t           plist        = FAIL;        /* Property list ID       */
+
+  off_t           off          = 0;           /* Offset of data segment */
+ 
+  hsize_t         sz           = 0;           /* Size of data segment   */
+
+  long            idx          = FAIL;        /* Swath index            */
+  
+  char            *filename    = (char *)NULL;/* File name buffer       */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+  
+
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_SWgetextdata", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for valid swath ID failed.\n");
+      H5Epush(__FILE__, "HE5_SWgetextdata", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Check out the field group and get field ID */
+  /* ------------------------------------------ */
+  HE5_SWfldsrch(swathID,fieldname,&fieldID,NULL,NULL,NULL);
+  if( fieldID == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the field ID for the \"%s\" field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_SWgetextdata", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+   
+  /* Get the property list ID */
+  /* ------------------------ */
+  plist = H5Dget_create_plist(fieldID);
+  if ( plist == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_SWgetextdata", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get the number of external files */
+  /* -------------------------------- */
+  nfiles = H5Pget_external_count(plist);
+  if ( nfiles < 0 )
+    {
+      sprintf(errbuf, "Cannot get the number of external files.\n");
+      H5Epush(__FILE__, "HE5_SWgetextdata", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Allocate memory for file name */
+  /* ----------------------------- */
+  filename = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char));
+  if(filename == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWgetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory.");
+      HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+	
+  strcpy(filelist,"");
+  
+  /* Loop through all external files */
+  /* ------------------------------- */
+  for (i = 0; i < nfiles; i++)
+    {
+      strcpy(filename,"");
+
+      /* Get the file name, offset, and size */
+      /* ----------------------------------- */
+      status = H5Pget_external(plist, i, namelength, filename, &off, &sz);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get information about external file.\n");
+	  H5Epush(__FILE__, "HE5_SWgetextdata", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(filename);
+	  return(FAIL);
+	}
+	  
+      offset[i] = off;
+      size[i]   = sz;
+	  
+      strcat(filelist, filename);
+	  
+      /* Append comma */
+      /* ------------ */
+      if (nfiles > 1 && i < nfiles - 1) 
+	strcat(filelist,",");
+	  
+    }
+  
+  slen = strlen(filelist);
+  
+  filelist[slen] = 0;
+
+  if (filename != NULL) free(filename);
+
+
+  /* Release property list ID */
+  /* ------------------------ */
+  status = H5Pclose(plist);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release property list ID.\n");
+      H5Epush(__FILE__, "HE5_SWgetextdata", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return (nfiles);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWindexinfo                                                  |
+|                                                                             |
+|  DESCRIPTION: Returns indices of a subsetted region                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  regionID       hid_t               Region ID                               |
+|  object         char*               field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  rank           int*                field rank                              |
+|  dimlist        char*               field dimension list                    |
+|  indices        hsize_t*            indices of region for along track dim.  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  June 04   S.Zhao       Original development                                |
+|  Oct 11   Abe Taaheri   Modified correcting indicies for fields with        |
+|                         ranks larger than 2                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_SWindexinfo(hid_t regionID, char *object, int *rank, char *dimlist, hsize_t *indices[HE5_DTSETRANKMAX])
+{
+  herr_t          status = FAIL;        /* routine return status variable */
+  int             j,k, fi, gi;          /* loop index                     */
+ 
+  hid_t           *nt = (hid_t *)NULL;   /* number types          */
+  hsize_t         dims[HE5_DTSETRANKMAX];/* Dimension array       */
+  char            tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list  */
+ 
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error buffer    */
+  long             index0, index1;
+ 
+ 
+  CHECKPOINTER(object);
+ 
+  /* Check for valid region ID */
+  /* ------------------------- */
+  if (regionID < 0 || regionID >= HE5_NSWATHREGN)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Invalid Region ID: %d.\n", regionID);
+      H5Epush(__FILE__, "HE5_SWindexinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+ 
+  /* Check for active region ID */
+  /* -------------------------- */
+  if (HE5_SWXRegion[regionID] == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Inactive Region ID: %d.\n", regionID);
+      H5Epush(__FILE__, "HE5_SWindexinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+ 
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for (k = 0; k < HE5_DTSETRANKMAX; k++)
+    dims[k] = 0;
+ 
+  /* Allocate memory for nt variable */
+  /* ------------------------------- */
+  nt = (hid_t *)calloc(1, sizeof(hid_t));
+  if(nt == (hid_t *)NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_SWindexinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get field info for given object */
+  /* -------------------------- */
+  status = HE5_SWfieldinfo(HE5_SWXRegion[regionID]->swathID, object, rank, dims, nt, tempdimlist, NULL);
+  if (status != SUCCEED)
+    {
+      sprintf(errbuf, "Field \"%s\" not found.\n", object);
+      H5Epush(__FILE__, "HE5_SWindexinfo", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(nt);
+      return(FAIL);
+    }
+ 
+  strcpy(dimlist, tempdimlist);
+ 
+  /* Find out Field indicies corresponding to the 1st and 2nd indicies of
+   * Longitude (which automatically will be the same for Latitude or
+   * Colatitude) field. For 2 or multi-dimansional fields, other than 
+   * Longitude, Latitude (or  Colatitude) it is important to know these
+   * indicies.
+   */
+  status = HE5_SWllmapedidxinfo(HE5_SWXRegion[regionID]->swathID,object,&index0,&index1);
+  if (status != SUCCEED)
+  {
+      sprintf(errbuf, "Field \"%s\" not found.\n", object);
+      H5Epush(__FILE__, "HE5_SWindexinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+  }
+
+  /* index0 is field index correcponding to the 0 index of Longitude */
+  /* index1 is field index correcponding to the 1 index of Longitude */
+
+  /* Vertical Subset or regular subset */
+  /* --------------------------------- */
+  for (j = 0; j < *rank; j++)
+    {
+      if(j == index0)
+	{
+	  gi = 0;
+	  fi = index0;
+	}
+      else if(j == index1)
+	{
+	  gi = 1;
+	  fi = index1;
+	}
+      else
+	{
+	  if (j <index0)
+	    {
+	      gi = j + 2;
+	      if(gi > 7) gi = 7;
+	    }
+	  else
+	    {
+	      gi = j;
+	    }
+	  fi = j;
+	}
+
+      if (HE5_SWXRegion[regionID]->StartVertical[gi] == FAIL)
+        {
+          if (HE5_SWXRegion[regionID]->StartRegion[gi] == 0)
+            {
+              indices[fi][0] = 0;
+            }
+          else
+            {
+              indices[fi][0] = HE5_EHlong2hsize(HE5_SWXRegion[regionID]->StartRegion[gi]);
+            }
+        }
+      else
+        {
+          if (HE5_SWXRegion[regionID]->StartVertical[gi] == 0)
+            {
+              indices[fi][0] = 0;
+            }
+          else
+            {
+              indices[fi][0] = HE5_EHlong2hsize(HE5_SWXRegion[regionID]->StartVertical[gi]);
+            }
+        }
+ 
+      if (HE5_SWXRegion[regionID]->StopVertical[gi] == FAIL)
+        {
+          if (HE5_SWXRegion[regionID]->StopRegion[gi] == 0)
+            {
+              indices[fi][1] = dims[fi] - 1;
+            }
+          else
+            {
+              indices[fi][1] = HE5_EHlong2hsize(HE5_SWXRegion[regionID]->StopRegion[gi]);
+            }
+        }
+      else
+        {
+          if (HE5_SWXRegion[regionID]->StopVertical[gi] == 0)
+            {
+              indices[fi][1] = dims[fi] - 1;
+            }
+          else
+            {
+              indices[fi][1] = HE5_EHlong2hsize(HE5_SWXRegion[regionID]->StopVertical[gi]);
+            }
+        }
+ 
+    }
+ 
+  free(nt);
+ 
+ COMPLETION:
+  return (status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWllmapedidxinfo                                             |
+|                                                                             |
+|  DESCRIPTION: Returns indices of a subsetted region                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath ID                                |
+|  object         char*               field name                              |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  indices        long                0th and 1st indices of the field        |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 11   Abe Taaheri   Original development,                               |
+|  Jan 12   AT            Fixed problem with preventing memcpy to use         |
+|                         unacceptable pointrs for ptr and ptr2               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_SWllmapedidxinfo(hid_t swathID, char *object, long *index0, long *index1)
+{
+  herr_t          status = -1;   /* routine return status variable */
+  herr_t          statMap = -1;  /* Status from SWmapinfo          */
+  char            dimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list   */
+  char            maxdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list*/
+  int             i,j,k, iDim;   /* loop index                     */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];   /* Error buffer   */
+  hid_t           nt, ntype;     /* number types                   */
+  hsize_t         dims[HE5_DTSETRANKMAX];       /* Dimension array */
+  int             rank;
+  char            dimname0[HE5_HDFE_DIMBUFSIZE],dimname1[HE5_HDFE_DIMBUFSIZE];
+  char            geodim[HE5_HDFE_DIMBUFSIZE];   /* Geolocation field dimension list */
+  char            maxgeodim[HE5_HDFE_DIMBUFSIZE];/* Geolocation field max dimension list */
+  char            geodimbuf[HE5_HDFE_DIMBUFSIZE];/* Geolocation field dimension list */
+  long            nDim;	             /* Number of dimensions       */
+  long            mDim;	             /* Number of dimensions       */
+  size_t          slen[HE5_DTSETRANKMAX],slen2[HE5_DTSETRANKMAX]; /* String length array  */
+  char           *ptr[HE5_DTSETRANKMAX],*ptr2[HE5_DTSETRANKMAX];  /* String pointer array */
+  hsize_t         dumdims[HE5_DTSETRANKMAX];	     /* Dimensions from SWfieldinfo */
+  unsigned        found = 0;         /* Found flag                  */
+  char            utlbuf[HE5_HDFE_DIMBUFSIZE];    /* Utility buffer */
+  long            incr;	             /* Mapping increment           */
+  hsize_t         dummy;             /* Dummy variable              */
+  long            dum;	             /* Dummy variable              */
+  long           *idxmap = NULL;     /* Pointer to index mapping array */
+  hsize_t         idxMapElem = 0;    /* Number of index map elements   */
+  long            index[HE5_DTSETRANKMAX];
+  long            maxrank = HE5_DTSETRANKMAX;
+
+  /* Get data field info */
+  /* ------------------- */
+  status = HE5_SWfieldinfo(swathID, object, &rank,
+			   dims, &ntype, dimlist, maxdimlist);
+  if (status != 0)
+    {
+      status = -FAIL;
+      sprintf(errbuf,"Cannot get information about \"%s\" field. \n", object);
+      H5Epush(__FILE__, "HE5_SWllmapedidxinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  status = HE5_SWfieldinfo(swathID, "Longitude", &rank, 
+			   dumdims, &nt, geodim, maxgeodim);
+  if (status != 0)
+  {
+      sprintf(errbuf, "Field \"%s\" not found.\n", "Longitude");
+      H5Epush(__FILE__, "HE5_SWllmapedidxinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+  }
+
+   /* Get "Track" (first) Dimension from geo dimlist */
+  /* ---------------------------------------------- */
+  for(iDim=0; iDim<maxrank; iDim++)
+    {
+      ptr[iDim] = NULL;
+      ptr2[iDim] = NULL;
+    }
+
+  nDim = HE5_EHparsestr(geodim, ',', ptr, slen);
+
+  for(iDim=0; iDim<nDim; iDim++)
+    {
+      index[iDim] = 0;
+    }
+
+  for(iDim=0; iDim<nDim; iDim++)
+    {
+      if(ptr[iDim] == NULL) break;
+      else
+	{
+	  memcpy(geodimbuf, ptr[iDim], slen[iDim]);
+	  geodimbuf[slen[iDim]] = 0;
+	}
+
+      if(strcmp(geodimbuf,"") == 0 ) break;
+
+      /* Parse Data Field Dimlist & find mapping */
+      /* --------------------------------------- */
+      mDim = HE5_EHparsestr(dimlist, ',', ptr2, slen2);
+      
+  
+      /* Loop through all dimensions and search for mapping */
+      /* -------------------------------------------------- */
+      for (i = 0; i < mDim; i++)
+	{
+	  memcpy(utlbuf, ptr2[i], slen2[i]);
+	  utlbuf[slen2[i]] = 0;
+	  
+	  statMap = HE5_SWmapinfo(swathID, geodimbuf, utlbuf,
+			      &dum, &incr);
+	  
+	  /* Mapping found */
+	  /* ------------- */
+	  if (statMap == 0)
+	    {
+	      found = 1;
+	      index[iDim] = i;
+	      break;
+	    }
+	}  
+      
+      /* If mapping not found check for geodim within dimlist */
+      /* ---------------------------------------------------- */
+      if (found == 0)
+	{
+	  index[iDim] = HE5_EHstrwithin(geodimbuf, dimlist, ',');
+	  
+	  /* Geo dimension found within subset field dimlist */
+	  /* ----------------------------------------------- */
+	  if (index[iDim] != -1)
+	    {
+	      found = 1;
+	      incr = 1;
+	    }
+	}
+      
+      /* If mapping not found check for indexed mapping */
+      /* ---------------------------------------------- */
+      if (found == 0)
+	{
+	  /* Get size of geo dim & allocate space of index mapping */
+	  /* ----------------------------------------------------- */
+	  dummy = HE5_SWdiminfo(swathID, geodimbuf);
+	  idxmap = (long *) calloc(dummy, sizeof(long));
+	  if(idxmap == NULL)
+	    {
+	      sprintf(errbuf, "Failed to retrieve the size of \"%s\" dimension. \n", geodimbuf) ;
+	      H5Epush(__FILE__, "HE5_SWllmapedidxinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  
+	  /* Loop through all dimensions and search for mapping */
+	  /* -------------------------------------------------- */
+	  for (i = 0; i < mDim; i++)
+	    {
+	      memcpy(utlbuf, ptr2[i], slen2[i]);
+	      utlbuf[slen2[i]] = 0;
+	      
+	      idxMapElem = HE5_SWidxmapinfo(swathID, geodimbuf, utlbuf, idxmap);
+	      
+	      /* Mapping found */
+	      /* ------------- */
+	      if (idxMapElem > 0)
+		{
+		  found = 1;
+		  index[iDim] = i;
+		  break;
+		}
+	    }
+	}
+      found = 0;
+    }
+
+  *index0 = index[0];
+  *index1 = index[1];;
+
+  return(status);
+}
+
+
+ 
+ /*---------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:    HE5_SWgetstringtype                                           |
+|                                                                             |
+|  DESCRIPTION: Determines type of STRING as H5T_NATIVE_CHAR or               |
+|               HE5T_CHARSTRING. These are two two different                  |
+|               types of Strings that HDF-EOS uses for data fieleds           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  String datatype int                return status H5T_NATIVE_CHAR or        |
+|                                     HE5T_CHARSTRING if succeed, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t               Swath structure ID                      |
+|  fldname        char                Fieldname                               |
+|  classid        H5T_class_t         Class ID                                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+| 08/1/06  Abe Taaheri    Original programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWgetstringtype(hid_t swathID, char *fldname, H5T_class_t classid)
+{
+  char            *attrlist1 = (char *)NULL;/* attribute list               */
+  long            strbufsize1;              /* string buffer size           */
+  char            fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual field name   */
+  char            fieldname[HE5_HDFE_NAMBUFSIZE];    /* Field name buffer   */
+  char            *attptr = (char *)NULL;   /* attribute pointer            */
+  herr_t	  status   = SUCCEED;       /* return status variable       */
+  char		  *errbuf = (char *)NULL;   /* error message buffer         */
+  int             attr = H5T_NATIVE_CHAR;   /* attribute value              */
+  int             nameflag = FAIL;          /* Name flag (0-alias,1-actual) */
+  long            nattr    = FAIL;          /* Number of attributes (return)*/
+
+  HE5_LOCK;
+  CHECKPOINTER(fldname);
+
+  if(classid != H5T_STRING)/* if field is not string type, return error */
+    {
+      sprintf(errbuf, "Cannot get strig type for none-string field.\n");
+      H5Epush(__FILE__, "HE5_SWgetstringtype", __LINE__, H5E_OHDR, 
+	      H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else
+    {
+      /* Call HE5_SWfldnameinfo() to get actual field name */
+      /* --------------------------------------------- */
+      nameflag = HE5_SWfldnameinfo(swathID, fldname, fldactualname);
+      if ( nameflag == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get actual name of the field.\n");
+	  H5Epush(__FILE__, "HE5_SWgetstringtype", __LINE__, H5E_OHDR, 
+		  H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      
+      /* Name is not alias */
+      /* ----------------- */
+      if (nameflag == TRUE)
+	{
+	  strcpy(fieldname,"");
+	  strcpy(fieldname,fldname);
+	}
+      
+      /* Name is an alias */
+      /* ---------------- */
+      if (nameflag == FALSE)
+	{
+	  strcpy(fieldname,"");
+	  strcpy(fieldname,fldactualname);
+	}
+      
+      strbufsize1 = 0;
+      nattr = HE5_SWinqlocattrs(swathID, fieldname, NULL, &strbufsize1);
+      if ( nattr <= 0 )/* this means ARRAYOFSTRINGS attribute does not exist,
+			  therefore, String datatype cannot be HE5T_CHARSTRING,
+			  or H5T_C_S1 type */
+	{
+	  return(HE5T_NATIVE_CHAR);
+	}
+      
+      attrlist1 = (char *) calloc(strbufsize1 + 2, sizeof(char));
+      if (attrlist1 == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for attrlist1.\n") ;
+	  H5Epush(__FILE__, "HE5_SWgetstringtype", __LINE__, H5E_RESOURCE, 
+		  H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);   
+	}
+
+      nattr = HE5_SWinqlocattrs(swathID, fieldname, attrlist1, &strbufsize1);
+      attptr = strstr(attrlist1,"ARRAYOFSTRINGS");
+      if ( (classid == H5T_STRING) && (attptr == NULL) )
+	{
+	  /* this means ARRAYOFSTRINGS attribute does not exist,
+	     therefore, String datatype cannot be HE5T_CHARSTRING,
+	     or H5T_C_S1 type 
+	  */
+	  return(HE5T_NATIVE_CHAR);
+	}
+      else if((classid == H5T_STRING) && (attptr != NULL) )
+	{
+	  status = HE5_SWreadlocattr(swathID, fieldname, "ARRAYOFSTRINGS", 
+				     &attr);
+	  if(status ==FAIL)
+	    {
+	      sprintf(errbuf, "Cannot read attribute from the field \"%s\".",
+		      fieldname) ;
+	      H5Epush(__FILE__, "HE5_SWgetstringtype", __LINE__, H5E_DATASET, 
+		      H5E_READERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  if(attr == HE5T_CHARSTRING)
+	    {
+	      return(HE5T_CHARSTRING);
+	    }
+	  else
+	    {
+	      return(HE5T_NATIVE_CHAR);
+	    }
+	}
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (attr);
+}
+
+
+/* 
+******************************************************************************
+|                                                                            |
+|          F  O  R  T  R  A  N  7 7      W  R  A  P  P  E  R  S              |
+|                                                                            |
+******************************************************************************
+*/
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWopenF (FORTRAN wrapper)                                    |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|     FileID      int     None        HDF-EOS file ID                         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|     filename    char*    None       File name string                        |
+|     Flags       int      None       File access code                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|     None                                                                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date       Programmer   Description                                       |
+|  ========   ============  ================================================= |
+|  Aug  00   A.Muslimov                                                       |
+|  Mar  02   A.Muslimov     Added "Flags" values for core methadata.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_SWopenF(char *filename, int Flags)
+{
+  hid_t     fid     = FAIL;/* HDF5 file ID          */
+
+  int       FileID  = FAIL;/* hdf-eos file ID       */
+  
+  uintn     flags   = 9999;/* HDF5 file access code */
+
+  char      *errbuf = NULL;/* Error message buffer  */
+
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWopenF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+
+      return(FAIL);
+    }  
+
+  /* Set up the file access flag */
+  /* --------------------------- */
+  if (Flags == HE5F_ACC_RDWR || Flags == HDF5_ACC_RDWR) flags = H5F_ACC_RDWR;
+  else if (Flags == HE5F_ACC_RDONLY || Flags == HDF5_ACC_RDONLY) flags = H5F_ACC_RDONLY;
+  else if (Flags == HE5F_ACC_TRUNC || Flags == HDF5_ACC_CREATE)  flags = H5F_ACC_TRUNC;
+  else
+    {
+      sprintf(errbuf, "File access flag is not supported. \n");
+      H5Epush(__FILE__, "HE5_SWopenF", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }  
+	
+
+
+  /* Call HE5_EHopen to open file */
+  /* ---------------------------- */
+  fid = HE5_EHopen(filename, flags, H5P_DEFAULT);
+  if(fid == FAIL)
+    {
+      sprintf(errbuf, "Cannot open the file \"%s\". Check the file name. \n", filename);
+      H5Epush(__FILE__, "HE5_SWopenF", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }  
+
+  free(errbuf);
+
+  FileID = (int)fid;
+  return(FileID);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWcreateF (FORTRAN wrapper)                                  |
+|                                                                             |
+|  DESCRIPTION: Creates a new swath structure and returns swath ID            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|   SwathID       int          None        Swath ID                           |
+|                                                                             |
+|  INPUTS:                                                                    |
+|   FileID        int          None        HDF-EOS file ID                    |
+|   swathname     char*        None        Swath name string                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|   None                                                                      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A. Muslimov                                                       |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_SWcreateF(int FileID, char *swathname)
+{
+  hid_t           swathID        = FAIL;/* return value of Swath ID        */
+  hid_t           fid            = FAIL;/* HDF-EOS file ID                 */
+
+  int             SwathID        = FAIL;/* int Swath ID                    */
+  
+  char            *errbuf =(char *)NULL;/* Buffer for error message        */
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf = (char *)calloc(HE5_HDFE_DIMBUFSIZE, sizeof(char ) ) ;
+  if ( errbuf == NULL )
+    {
+      H5Epush(__FILE__, "HE5_SWcreateF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+  fid = (hid_t)FileID;
+  
+  swathID = HE5_SWcreate(fid, swathname);
+  if (swathID == FAIL)
+    {
+      sprintf(errbuf,"Cannot create Swath. \n");
+      H5Epush(__FILE__, "HE5_SWcreateF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+	
+  SwathID = (int)swathID;	
+  
+  /* Deallocate memory */
+  /* ----------------- */
+  free(errbuf);
+  
+  return(SwathID);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWattachF     (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION:  Attaches to an existing swath within the file.               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  SwathID        int                 swath structure ID                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int                 HDF-EOS file ID                         |
+|  swathname      char                swath structure name                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date        Programmer    Description                                     |
+|  =========   ============  ==============================================   |
+|  Aug  00     A.Muslimov                                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_SWattachF(int FileID, char *swathname)
+{
+  int             SwathID    = FAIL;/* int Swath ID (return)         */
+
+  hid_t           swathID    = FAIL;/* Swath ID (return value)       */ 
+  hid_t           fid        = FAIL;/* HDF-EOS file ID               */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  fid = (hid_t)FileID;
+
+  swathID = HE5_SWattach(fid, swathname);
+  if (swathID == FAIL)
+    {
+      sprintf(errbuf,"Cannot attach to the Swath \"%s\". \n", swathname);
+      H5Epush(__FILE__, "HE5_SWattachF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  SwathID = (int)swathID;
+
+  return (SwathID);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdetachF  (FORTRAN wrapper)                                 |
+|                                                                             |
+|  DESCRIPTION: Detachs swath structure and performs housekeeping             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_SWdetachF(int SwathID)
+{
+  int            ret     = FAIL;/* int return status              */
+
+  hid_t          swathID = FAIL;/* HDF-EOS Swath ID               */
+  herr_t         status  = FAIL;/* routine return status variable */
+
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  swathID = (hid_t)SwathID;
+
+  status = HE5_SWdetach(swathID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot detach from the Swath. \n");
+      H5Epush(__FILE__, "HE5_SWdetachF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  ret = (int)status;	
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWcloseF    (FORTRAN wrapper)                                |
+|                                                                             |
+|  DESCRIPTION: Closes HDF-EOS file                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int                 File ID                                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_SWcloseF(int FileID)
+{
+  int      ret    = FAIL;/* int return status variable     */
+
+  hid_t    fid    = FAIL;/* HDF-EOS file ID                */
+
+  herr_t   status = FAIL;/* routine return status variable */
+
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+
+  fid = (hid_t)FileID;
+  status = HE5_SWclose(fid);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot close the file. \n");
+      H5Epush(__FILE__, "HE5_SWcloseF", __LINE__, H5E_FILE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefdimF                                                    |
+|                                                                             |
+|  DESCRIPTION: Defines numerical value of dimension (FORTRAN wrapper)        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  dim. name      char                dimension name                          |
+|  dim. size      long                dimension size                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 00   D.Wynne       Original Version                                    |
+|  Sep 00   A.Muslimov    Updated to reflect most recent data type changes.   |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWdefdimF(int SwathID, char *dimname, long dim)
+{
+  int       ret       = SUCCEED;/* (int) return status variable  */ 
+
+  hid_t     swathID   = FAIL;   /* HDF5 type swath ID            */
+
+  herr_t	status    = SUCCEED;/* HDF5 type return status       */
+ 
+  hsize_t	tdim      = 0;      /* temporary(dimension) variable */
+  
+  char		*errbuf   = (char *)NULL;/* Error message buffer     */
+  
+  
+  errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  
+  tdim    = (hsize_t)dim;	
+  swathID = (hid_t)SwathID;
+
+  status = HE5_SWdefdim(swathID, dimname, tdim);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Error calling HE5_SWdefdim from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_SWdefdimF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefdimmapF                                                 |
+|                                                                             |
+|  DESCRIPTION: Defines mapping between geolocation and data dimensions       |
+|               (FORTRAN wrapper)                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  geo dim.       char                geolocation dimension                   |
+|  data dim.      char                data dimension                          |
+|  offset         long                offset between dimensions               |
+|  incr           long                increment between dimensions            |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 00   D.Wynne       Original Version                                    |
+|  Sep 00   A.Muslimov    Updated to reflect most recent data type changes.   |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_SWdefdimmapF(int SwathID, char *geodim, char *datadim, long offset, long increment)
+{
+  herr_t	status     = SUCCEED;/* HDF5 type status variable   */
+  
+  int       ret        = SUCCEED;/* (int) return variable       */  
+
+  hid_t     swathID    = FAIL;   /* HDF5 type swath ID          */
+
+  hsize_t	toffset    = 0;      /* offset variable             */
+  hsize_t	tincrement = 0;      /* increment variable          */
+  
+  char		*errbuf    = (char *)NULL;/* Error message buffer   */
+  
+
+  errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  
+  /* Cast variable datatype to HDF5 datatype for HDF function calls */
+  /* -------------------------------------------------------------- */
+  toffset    = (hsize_t)offset;	
+  tincrement = (hsize_t)increment;
+
+  swathID = (int)SwathID;
+  
+  status = HE5_SWdefdimmap(swathID, geodim, datadim, toffset, tincrement);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Error calling SWdefdimmap from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_SWdefdimmapF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefidxmapF                                                 |
+|                                                                             |
+|  DESCRIPTION: Defines index mapping between geolocation and data dimensions |
+|               (FORTRAN wrapper)                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  geo dim.       char                geolocation dimension                   |
+|  data dim.      char                data dimension                          |
+|  index          long                array of indices                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov    Original Version                                    |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_SWdefidxmapF(int SwathID, char *geodim, char *datadim, long index[])
+{
+  herr_t	status     = SUCCEED;/* HDF5 type return status variable */
+  
+  int       ret        = SUCCEED;/* (int) return status variable     */  
+
+  hid_t     swathID    = FAIL;   /* HDF5 type swath ID               */
+  
+  char		*errbuf    = (char *)NULL;/* Error message buffer        */
+
+  errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  
+  swathID = (hid_t)SwathID; 
+  status = HE5_SWdefidxmap(swathID, geodim, datadim, index);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Error calling SWdefidxmap from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_SWdefidxmapF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefgfld                                                    |
+|                                                                             |
+|  DESCRIPTION: Defines geolocation field within swath structure (FORTRAN)    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        int                 swath structure ID                      |
+|  fieldname      char                fieldname                               |
+|  fortdimlist    char                Dimension list (comma-separated list)   |
+|                                         FORTRAN dimesion order              |
+|  fortmaxdimlist char                Max Dimension list (FORTRAN order)      |
+|  numbertype     int                 field type                              |
+|  merge          int                 merge code                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Nov 99   Abe Taaheri   Modified for HDF5                                   |
+|  May 00   D.Wynne       Updated to reflect datatypes changes throughout     |
+|                         the library                                         |
+|  Sep 00   A.Muslimov    Updated to reflect most recent data type changes.   |
+|  Nov 00   A.Muslimov    Updated to reverse order of "fortmaxdimlist"entries.|
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWdefgfld(int swathID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int numtype, int merge)
+{
+  int       ret        = SUCCEED;    /* (int) return status variable   */
+
+  herr_t    status     = SUCCEED;	 /* routine return status variable */
+  
+  hid_t     SwathID    = FAIL;       /* HDF5 type swath ID             */
+  hid_t	    numbertype = FAIL;       /* HDF5 tyep data type  ID        */
+  
+  char		*dimlist   = (char *)NULL;/* Dimension list (C order)      */
+  char		*maxdimlist= (char *)NULL;/* Max. dimension list (C)       */
+  char		*errbuf    = (char *)NULL;/* error message buffer          */
+
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWdefgfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  if(strcmp(fortmaxdimlist,"") == 0)
+    fortmaxdimlist = NULL;
+
+
+  /* Convert data type ID */
+  /* -------------------- */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert \"int\" data type ID to HDF5 data type ID.\n");
+      H5Epush(__FILE__, "HE5_SWdefgfld", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  dimlist = (char *)calloc(strlen(fortdimlist) + 1, sizeof(char));
+  if(dimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for dimlist.\n");
+      H5Epush(__FILE__, "HE5_SWdefgfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /* Reverse entries in dimension list (FORTRAN -> C) */
+  /* ------------------------------------------------ */
+  status = HE5_EHrevflds(fortdimlist, dimlist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in dimension list.\n");
+      H5Epush(__FILE__, "HE5_SWdefgfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      return(FAIL);
+    }
+
+  if (fortmaxdimlist != NULL)
+    {
+      /* Allocate space for C order maximum dimension list */
+      /* ------------------------------------------------- */
+      maxdimlist = (char *)calloc(strlen(fortmaxdimlist) + 1, sizeof(char));
+      if(maxdimlist == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for maxdimlist.\n");
+	  H5Epush(__FILE__, "HE5_SWdefgfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(dimlist);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      /* Reverse entries in maximum dimension list (FORTRAN -> C) */
+      /* -------------------------------------------------------- */
+      status = HE5_EHrevflds(fortmaxdimlist, maxdimlist);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot reverse entries in maximum dimension list.\n");
+	  H5Epush(__FILE__, "HE5_SWdefgfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(maxdimlist);
+	  return(FAIL);
+	}
+	  
+    }
+  else 
+    {
+      maxdimlist = NULL;
+    }
+
+
+  SwathID = (hid_t)swathID;
+    
+  
+  /* Call Define Field routine */
+  /* ------------------------- */
+  status = HE5_SWdefinefield(SwathID, "Geolocation Fields", fieldname, dimlist, maxdimlist, numbertype, merge);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_SWdefinefield() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWdefgfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      if (maxdimlist !=NULL) 
+	free(maxdimlist);
+	  
+      return(FAIL);
+    }  
+
+  free(dimlist);
+  if (maxdimlist !=NULL) 
+    free(maxdimlist);
+  
+  free(errbuf);
+
+  ret = (int)status;
+  return (ret);
+}
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefdfld                                                    |
+|                                                                             |
+|                                                                             |
+|  DESCRIPTION: Defines data field within swath structure (FORTRAN)           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        int                 swath structure ID                      |
+|  fieldname      char                fieldname                               |
+|  fortdimlist    char                Dimension list (comma-separated list)   |
+|                                         FORTRAN dimesion order              |
+|  fortmaxdimlist char                Max Dimension list (FORTRAN order)      |
+|  numbertype     int                 field type                              |
+|  merge          int                 merge code                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Sep 00   A.Muslimov    Updated to reflect most recent data type changes.   |
+|  Nov 00   A.Muslimov    Updated to reverse order of "fortmaxdimlist"entries.|
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWdefdfld(int swathID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int numtype, int merge)
+ 
+{
+  int       ret        = SUCCEED;/* (int) return status variable   */  
+
+  herr_t	status     = SUCCEED;/* routine return status variable */
+
+  hid_t     SwathID    = FAIL;   /* HDF5 type swath ID             */
+  hid_t	    numbertype = FAIL;   /* HDF5 type data type ID         */
+  
+  char		*dimlist   = (char *)NULL;/* Dimension list (C order)  */
+  char		*maxdimlist= (char *)NULL;/* Max. dimension list (C)   */
+  char		*errbuf    = (char *)NULL;/* error message buffer      */
+
+  SwathID = (hid_t)swathID;
+
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_SWdefdfld", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Cannot convert datatype for FORTRAN wrapper.");
+      HE5_EHprint("Error: Cannot convert datatype for FORTRAN wrapper, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  if(strcmp(fortmaxdimlist,"") == 0)
+    fortmaxdimlist = NULL;
+  
+  
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWdefdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  dimlist = (char *)calloc(strlen(fortdimlist) + 1, sizeof(char));
+  if(dimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for dimlist.\n");
+      H5Epush(__FILE__, "HE5_SWdefdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /* Reverse entries in dimension list (FORTRAN -> C) */
+  /* ------------------------------------------------ */
+  status = HE5_EHrevflds(fortdimlist, dimlist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in dimension list.\n");
+      H5Epush(__FILE__, "HE5_SWdefdfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      return(FAIL);
+    }
+
+  if (fortmaxdimlist != NULL)
+    {
+      /* Allocate space for C order max. dim. list */
+      /* ----------------------------------------- */
+      maxdimlist = (char *)calloc(strlen(fortmaxdimlist) + 1, sizeof(char));
+      if(maxdimlist == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for maxdimlist.\n");
+	  H5Epush(__FILE__, "HE5_SWdefdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(dimlist);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+
+      /* Reverse entries in dimension list (FORTRAN -> C) */
+      /* ------------------------------------------------ */
+      status = HE5_EHrevflds(fortmaxdimlist, maxdimlist);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot reverse entries in maximum dimension list.\n");
+	  H5Epush(__FILE__, "HE5_SWdefdfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(maxdimlist);
+	  return(FAIL);
+	}
+    }
+  else
+    {
+      maxdimlist = NULL;
+    }
+	  
+  
+  /* Call Define Field routine */
+  /* ------------------------- */
+  status = HE5_SWdefinefield(SwathID, "Data Fields", fieldname, dimlist, maxdimlist, numbertype, merge);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot define \"%s\" field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_SWdefdfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      if (maxdimlist!=NULL) 
+	free(maxdimlist);
+	  
+      return(FAIL);
+    }
+  
+  free(dimlist);
+  if (maxdimlist != NULL) 
+    free(maxdimlist);
+  
+  free(errbuf);
+
+  ret = (int)status;
+  return (ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefcompF      (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Defines compression type and parameters                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  compcode       int                 compression code                        |
+|  compparm       int                 compression parameters                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:   Before calling this function, storage must be CHUNKED             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_SWdefcompF(int SwathID, int compcode,  int *compparm)
+{
+  int             ret      = FAIL; /* routine return status variable   */
+
+  herr_t          status   = FAIL; /* routine return status variable   */
+
+  hid_t           swathID  = FAIL; /* HDF5 type  Swath ID              */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer     */
+
+  swathID = (hid_t)SwathID;
+
+  status = HE5_SWdefcomp(swathID, compcode, compparm);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling SWdefcomp() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWdefcompF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret = (int)status;
+  return(ret);
+
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefchunkF                                                  |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper for SWdefchunk                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  ndims          int                 rank of a dataset                       |
+|  *dim           long                pointer to the array containing sizes   |
+|                                     of each dimension of a chunk            |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date         Programmer    Description                                    |
+|  =========   ============  ==============================================   |
+|  8/13/99     A.Muslimov    Changed the return type of SWdefchunk from intn  |
+|                            to herr_t. Checked the statuses for H5P... calls.|
+|  May 00      D.Wynne       Updated to reflect datatype changes in Library   |
+|  Aug 00      A.Muslimov    Updated to reflect data type changes.            |
+|  Jan 01      A.Muslimov    Added proper FORTRAN to C dimension order        |
+|                             conversion.                                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWdefchunkF(int SwathID, int ndims, long *dim)
+{
+  int		ret       = FAIL;           /* return status        */
+  int		j = 0;                      /* Loop index           */
+
+  herr_t	status    = FAIL;           /* return status        */
+
+  hid_t     swathID   = FAIL;           /* HDF5 type swath ID   */
+
+  hsize_t	*tempdims = (hsize_t *)NULL;/* Temporary variable   */
+  
+  char		*errbuf   = (char *)NULL;   /* error message buffer */
+
+  /* Allocate memory for error message buffer */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWdefchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  tempdims = (hsize_t *)calloc(ndims, sizeof(hsize_t));
+  if(tempdims == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tempdims.\n");
+      H5Epush(__FILE__, "HE5_SWdefchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  
+  /* Change from FORTRAN to C dimension order */
+  /* ---------------------------------------- */
+  for (j = 0; j < ndims; j++)
+    tempdims[j] = (hsize_t)dim[ndims - 1 - j];
+
+
+  swathID = (hid_t)SwathID;
+
+  status = HE5_SWdefchunk(swathID, ndims, tempdims);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling SWdefchunk() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWdefchunkF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(tempdims);
+      return(FAIL);
+    }
+
+  
+  free(tempdims);
+  free(errbuf);
+  
+  ret = (int)status;
+  return(ret);
+ 
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWcompinfoF  (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        Return status  (0) SUCCEED, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int     None        Swath Object ID                         |
+|  compcode       int                                                         |
+|  compparm       int                                                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_SWcompinfoF(int SwathID, char *fieldname, int *compcode, int compparm[])
+{
+  int             ret      = FAIL;        /* Return status variable       */
+
+  herr_t          status   = FAIL;        /* Return status variable       */
+
+  hid_t           swathID  = FAIL;        /* HDF5 type Swath ID           */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */
+
+
+  swathID = (hid_t)SwathID;
+
+  status = HE5_SWcompinfo(swathID, fieldname, compcode, compparm);
+  if (status == FAIL)
+    {
+      sprintf(errbuf , "Compression information for \"%s\" not found.\n", fieldname);
+      H5Epush(__FILE__, "HE5_SWcompinfoF", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwrcharfld                                                  |
+|                                                                             |
+|  DESCRIPTION: Writes data to a character string field (FORTRAN wrapper      |
+|               around SWwritefield)                                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fieldname      char                fieldname                               |
+|  elemlen        int                 each element length in array of string  |
+|  numelem        int                 number of elements in declared buffer   |
+|                                     array                                   |
+|  fortstart      long                start array                             |
+|  fortstride     long                stride array                            |
+|  fortedge       long                edge array                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04   S.Zhao        For an array of character string dataset.           |
+|  Jun 04   S.Zhao        Added one more argument (numelem).                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWwrcharfld(int SwathID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *data)
+{
+  int             ret      = SUCCEED;       /* int return status variable     */
+  int             i;                        /* Loop index                     */
+  int             rank     = 0;             /* Field rank                     */
+ 
+  herr_t          status   = SUCCEED;       /* routine return status variable */
+ 
+  hid_t           ntype[1] = {FAIL};        /* Field numbertypes              */
+ 
+  hid_t           swathID  = FAIL;          /* HDF-EOS swath ID               */
+ 
+  hssize_t        *start  = (hssize_t *)NULL;/* Pointer to start array (C order)  */
+ 
+  hsize_t         dims[HE5_DTSETRANKMAX];    /* Field dimensions                  */
+  hsize_t         *stride = (hsize_t *)NULL; /* Pointer to stride array (C order) */
+  hsize_t         *edge   = (hsize_t *)NULL; /* Pointer to edge array (C order)   */
+ 
+  char            *errbuf = (char *)NULL;    /* error message buffer              */
+  char            **strdatabuf = NULL;       /* string data buffer                */
+  int             nelem = 0;                 /* number of elements in array of str*/
+  int             strsize = 0;               /* each str length in array of str   */
+  char            *blankPtr = (char *)NULL;  /* pointer to blank character        */
+  char            *tmpString = (char *)NULL; /* pointer to temp string            */
+  int             attr = 0;                  /* attribute value                   */
+  hsize_t         count[1];                  /* number of attribute elements      */
+ 
+ 
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  swathID = (hid_t)SwathID;
+ 
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[ i ] = 0;
+ 
+  /* Get field info  */
+  /* --------------- */
+  status = HE5_SWfieldinfo(swathID, fieldname, &rank, dims, ntype, NULL, NULL);
+  if (status != FAIL)
+    {
+      start = (hssize_t *)calloc(rank, sizeof(hssize_t));
+      if(start == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for start.\n");
+	  H5Epush(__FILE__, "HE5_SWwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      stride = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(stride == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for stride.\n");
+	  H5Epush(__FILE__, "HE5_SWwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      edge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(edge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_SWwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      /* Reverse order of dimensions (FORTRAN -> C) */
+      /* ------------------------------------------ */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i]  = (hssize_t)fortstart[rank - 1 - i];
+	  stride[i] = (hsize_t)fortstride[rank - 1 - i];
+	  edge[i]   = (hsize_t)fortedge[rank - 1 - i];
+        }
+ 
+      strsize = elemlen;
+      nelem = dims[0];
+
+      tmpString = (char *)calloc(1,strsize+1);
+      if(tmpString == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for tmpString.\n");
+	  H5Epush(__FILE__, "HE5_SWwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      strdatabuf = (char **)malloc(nelem*sizeof(char *));
+      for (i = 0; i<nelem; i++)
+	{
+	  strdatabuf[i] = NULL;
+	  strdatabuf[i] = (char *)malloc((strsize+1)*sizeof(char));
+	  strncpy(strdatabuf[i],(char *)data+(strsize*i), strsize);
+	  strdatabuf[i][strsize] = '\0';
+	  strcpy(tmpString,strdatabuf[i]);
+ 
+	  /* Find the first non blank character from the end */
+	  /* ----------------------------------------------- */
+	  blankPtr = tmpString + strsize -1;
+	  while (*blankPtr == ' ')
+	    {
+	      blankPtr--;
+	    }
+ 
+	  /* Turn it into a C string */
+	  /* ----------------------- */
+	  blankPtr++;
+	  *blankPtr = '\0';
+ 
+	  strcpy(strdatabuf[i], tmpString);
+	} 
+ 
+      free(tmpString);
+
+      count[0] = 1;
+      attr = strsize;
+      status = HE5_SWwritelocattr(swathID, fieldname, "StringLengthAttribute", H5T_NATIVE_INT, count, &attr);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write attribute to the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_SWwrcharfld", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }
+	  return(FAIL);
+	}
+ 
+      status = HE5_SWwrrdfield(swathID, fieldname, "w", start, stride, edge, strdatabuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_SWwrcharfld", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }
+
+	  return(FAIL);
+	}
+ 
+      free(start);
+      free(stride);
+      free(edge);
+      free(errbuf);
+      if (strdatabuf != NULL)
+	{
+	  for (i = 0; i<nelem; i++)
+	    {
+	      if (strdatabuf[i] != NULL)
+		{
+		  free (strdatabuf[i]);
+		  strdatabuf[i] = NULL;
+		}
+	    }
+	  free (strdatabuf);
+	  strdatabuf = NULL;
+	}
+
+    }
+  else
+    {
+      sprintf(errbuf, "Error calling HE5_SWfieldinfo() from FORTRAN wrapper. \n") ;
+      H5Epush(__FILE__, "HE5_SWwrcharfld", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+ 
+      free(errbuf);
+    }
+ 
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwrfld                                                      |
+|                                                                             |
+|  DESCRIPTION: Writes data to field (FORTRAN wrapper around SWwritefield)    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fieldname      char                fieldname                               |
+|  fortstart      long                start array                             |
+|  fortstride     long                stride array                            |
+|  fortedge       long                edge array                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Nov 99   Abe Taaheri   Modified for HDF5                                   |
+|  Aug 00   A.Muslimov    Modified to conform to HDF5 data types.             |
+|  Feb 05   S.Zhao        Replaced the "myedge" array by the "dims" array if  |
+|                         it was larger than the dimension size.              |
+|  Sep 11   Abe Taaheri   Modified for correcting Unlimited dimension         |
+|                         behavior and extension                              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWwrfld(int SwathID, char *fieldname, long fortstart[], long fortstride[],
+ long fortedge[], void *data)
+{
+  int             ret      = SUCCEED;       /* int return status variable     */
+  int             i;                        /* Loop index                     */
+  int   	  rank     = 0;             /* Field rank                     */
+
+  herr_t          status   = SUCCEED;       /* routine return status variable */
+
+  hid_t   	  ntype[1] = {FAIL};        /* Field numbertypes              */
+ 
+  hid_t           swathID  = FAIL;          /* HDF-EOS swath ID               */
+    
+  hssize_t        *start  = (hssize_t *)NULL;/* Pointer to start array (C order)  */
+
+  hsize_t         dims[HE5_DTSETRANKMAX];    /* Field dimensions                  */
+  hsize_t         *stride = (hsize_t *)NULL; /* Pointer to stride array (C order) */
+  hsize_t         *edge   = (hsize_t *)NULL; /* Pointer to edge array (C order)   */
+  
+  char            *errbuf = (char *)NULL;    /* error message buffer              */
+  hsize_t         *myedge = (hsize_t *)NULL;
+  int             unlimdim;
+  hsize_t         maxdims[HE5_DTSETRANKMAX];/* Field maximum dimensions     */
+  int             append   = FALSE;         /* FLAG (if field is appendible)*/
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWwrfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  swathID = (hid_t)SwathID;
+
+  /* Initialize dims[] , maxdims[] array */
+  /* ----------------------- */
+  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      dims[ i ] = 0;
+      maxdims[ i ] = 0;
+    }
+
+  /* Get field info  */
+  /* --------------- */
+  status = HE5_SWfieldinfo(swathID, fieldname, &rank, dims, ntype, NULL, NULL);
+  if (status != FAIL)
+    {
+      start = (hssize_t *)calloc(rank, sizeof(hssize_t));
+      if(start == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for start.\n");
+	  H5Epush(__FILE__, "HE5_SWwrfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+        }
+
+      stride = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(stride == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for stride.\n");
+	  H5Epush(__FILE__, "HE5_SWwrfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(errbuf);
+	  return(FAIL);
+        }
+
+      edge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(edge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_SWwrfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(errbuf);
+	  return(FAIL);
+        }
+
+      /* Reverse order of dimensions (FORTRAN -> C) */
+      /* ------------------------------------------ */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i]  = (hssize_t)fortstart[rank - 1 - i];
+	  stride[i] = (hsize_t)fortstride[rank - 1 - i];
+	  edge[i]   = (hsize_t)fortedge[rank - 1 - i];
+        }
+
+      myedge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(myedge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_SWwrfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      /* get maxdims for the field */
+      status = HE5_SWflddiminfo(swathID, fieldname, &rank, dims, maxdims);
+
+      /* see if we need first to extend data dimensions for unlimited 
+	 dimensions */
+
+      for (i = 0; i < rank; i++)
+        {
+	  if( dims[i] == maxdims[i] )
+	    append = FALSE;
+	  else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED))
+	    {
+	      append = TRUE;
+	      break;
+	    }
+	}
+      unlimdim = i;
+
+      if(append == FALSE)
+	{
+      for (i = 0; i < rank; i++)
+        {
+	  if(edge[i] > dims[i])
+	    myedge[i] = dims[i];
+	  else
+	    myedge[i] = edge[i];
+        }
+	}
+      else
+	{
+	  for (i = 0; i < rank; i++)
+	    {
+	      myedge[i] = edge[i];
+	    }
+	}
+
+      if((append == TRUE) && (edge[unlimdim] > dims[unlimdim]))
+	{
+	  hssize_t newstart[8];
+	  hsize_t newedge[8];
+
+	  for (i = 0; i < rank; i++)
+	    {
+	      newstart[i]=start[i];
+	      newedge[i] = edge[i];
+	    }
+	  newstart[unlimdim]=edge[unlimdim]-1;
+	  newedge[unlimdim] = 1;
+	  status = HE5_SWwrrdfield(swathID, fieldname, "w", newstart, stride, newedge,data);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ;
+	      H5Epush(__FILE__, "HE5_SWwrfld", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(start);
+	      free(stride);
+	      free(edge);
+	      free(myedge);
+	      free(errbuf);
+	      return(FAIL);
+	    }
+	  else
+	    {
+	      for (i = 0; i < rank; i++)
+		{
+		  dims[i]=edge[i];
+		}
+	    }
+	}
+
+      status = HE5_SWwrrdfield(swathID, fieldname, "w", start, stride, myedge,data);
+      if (status == FAIL)
+        {
+	  sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_SWwrfld", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(myedge);
+	  free(errbuf);
+	  return(FAIL);
+        }
+
+      free(start);
+      free(stride);
+      free(edge);
+      free(myedge);
+      free(errbuf);
+
+    }
+  else
+    {
+      sprintf(errbuf, "Error calling HE5_SWfieldinfo() from FORTRAN wrapper. \n") ;
+      H5Epush(__FILE__, "HE5_SWwrfld", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+ 
+      free(errbuf);
+    }
+ 
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwrattr                                                     |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper for Writes/updates attribute in a swath.      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  attrname       char*               attribute name                          |
+|  numtype        int                 attribute HDF numbertype                |
+|  fortcount[]    long                Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 99   Abe Taaheri   Modified data types                                 |
+|  Aug 00   A.Muslimov    Modified to conform to HDF5 data types              |
+|  Nov 02   S.Zhao        Modified to get the size of a string attribute.     |
+|  Mar 04   S.Zhao        Modified for a character string attribute.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWwrattr(int SwathID, char *attrname, int numtype, long fortcount[], void * datbuf)
+{
+  int       ret     = FAIL;/* int return status variable                 */
+  int       rank    = 1;   /* Note: It is assumed that fortcout has just */
+  /* one element to agree with EHattr function  */
+  int		i;             /* Loop index                                 */
+
+  hid_t     swathID    = FAIL;/* HDF-EOS Swath ID                        */
+  hid_t     numbertype = FAIL;/* HDF5 data type ID                       */ 
+
+  herr_t	status     = FAIL;/* routine return status variable          */
+  
+  hsize_t	*count     = (hsize_t *)NULL;/* Pointer to count array (C order)*/
+    
+  char      *errbuf = (char *)NULL;   /* error message buffer            */
+  char      *tempbuf = (char *)NULL;  /* temp buffer */
+  
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_SWwrattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Error calling HE5_EHconvdatatype() from FORTRAN wrapper.");
+      HE5_EHprint("Error: Error calling HE5_EHconvdatatype() from FORTRAN wrapper, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate memory for "count" array */
+  /* --------------------------------- */
+  count = (hsize_t *)calloc(rank, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_SWwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < rank; i++)
+    {
+      count[i] = (hsize_t)fortcount[rank - 1 - i];
+    }
+  
+  swathID = (hid_t)SwathID;
+
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_SWwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); 
+	  H5Epush(__FILE__, "HE5_SWwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+ 
+      /* Call SWwriteattr() */
+      /* ------------------ */
+      status = HE5_SWwriteattr(swathID, attrname, numbertype, count, tempbuf);
+      if( status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname);
+          H5Epush(__FILE__, "HE5_SWwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(count);
+          free(errbuf);
+          free(tempbuf);
+          return(FAIL);
+	}
+ 
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    {
+      /* Call SWwriteattr() */
+      /* ------------------ */
+      status = HE5_SWwriteattr(swathID, attrname, numbertype, count, datbuf);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname);
+	  H5Epush(__FILE__, "HE5_SWwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+          return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWsetfill  (FORTRAN wrapper)                                 |
+|                                                                             |
+|  DESCRIPTION: Sets fill value for the specified field.                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fieldname      char*               field name                              |
+|  fillval        void*               fill value                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWsetfill(int SwathID, char *fieldname, int numtype, void *fillval)
+{
+  int          ret        = FAIL;/* int return status variable  */ 
+
+  herr_t       status     = FAIL;/* return status variable      */
+ 
+  hid_t        numbertype = FAIL;/* HDF5 data tyope ID          */
+  hid_t        swathID    = FAIL;/* HDF5 Swath ID               */
+
+  char         errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWsetfill", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  swathID = (hid_t)SwathID;
+  status = HE5_SWsetfillvalue(swathID, fieldname, numbertype, fillval);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot set fill value for the field \"%s\".\n", fieldname);
+      H5Epush(__FILE__, "HE5_SWsetfill", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWgetfill   (FORTRAN wrapper)                                |
+|                                                                             |
+|  DESCRIPTION: Retrieves fill value for a specified field.                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  fieldname      char*               field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fillval        void*               fill value                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_SWgetfill(int SwathID, char *fieldname, void *fillval)
+{
+  int             ret      = FAIL;/* routine return status variable   */
+
+  herr_t          status   = FAIL;/* routine return status variable   */
+
+  hid_t           swathID  = FAIL;/* HDF5 type swath ID               */
+    
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  swathID = (hid_t)SwathID;
+
+  status = HE5_SWgetfillvalue(swathID, fieldname, fillval);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get fill value for the field \"%s\".\n", fieldname);
+      H5Epush(__FILE__, "HE5_SWgetfill", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret = (int)status;
+  return (ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWrdfld                                                      |
+|                                                                             |
+|  DESCRIPTION: Reads data from field (FORTRAN wrapper around SWreadfield)    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fieldname      char                fieldname                               |
+|  fortstart      long                start array                             |
+|  fortstride     long                stride array                            |
+|  fortedge       long                edge array                              |
+|  buffer         void                data buffer for read                    |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|     None                                                                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Nov 99   Abe Taaheri   Modified for HDF5                                   |
+|  May 00   D.Wynne       Updated to reflect data type changes                |
+|  Aug 00   A.Muslimov    Updated to conform to HDF5 data types               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWrdfld(int SwathID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *buffer)
+ 
+{
+  int              ret      = SUCCEED;       /* routine return status variable */
+  int              i        = 0;             /* Loop index                     */
+  int              rank     = 0;             /* Field rank                     */
+ 
+  hid_t            ntype[1] = {FAIL};        /* Field number types             */
+ 
+  hid_t            swathID  = FAIL;          /* Swath HDF5 type  ID            */
+ 
+  herr_t           status   = SUCCEED;       /* routine return status variable */
+ 
+  hssize_t         *start  = (hssize_t *)NULL;/* Pointer to start array (C order)  */
+  hsize_t          dims[HE5_DTSETRANKMAX];    /* Field dimensions                  */
+  hsize_t          *stride = (hsize_t *)NULL; /* Pointer to stride array (C order) */
+  hsize_t          *edge   = (hsize_t *)NULL; /* Pointer to edge array (C order)   */
+ 
+  char             *errbuf = (char *)NULL;    /* error message buffer              */
+ 
+ 
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  swathID = (hid_t)SwathID;
+ 
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[ i ] = 0;
+ 
+  /* Get field info */
+  /* -------------- */
+  status = HE5_SWfieldinfo(swathID, fieldname, &rank, dims, ntype, NULL,NULL);
+  if (status != FAIL)
+    {
+      start =  (hssize_t *)calloc(rank, sizeof(hssize_t));
+      if(start == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for start.\n");
+	  H5Epush(__FILE__, "HE5_SWrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+        }
+      stride = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(stride == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for stride.\n");
+	  H5Epush(__FILE__, "HE5_SWrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(errbuf);
+	  return(FAIL);
+        }
+      edge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(edge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_SWrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      /* Reverse order of dimensions (FORTRAN -> C) */
+      /* ------------------------------------------ */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i]  = (hssize_t)fortstart[rank - 1 - i];
+	  stride[i] = (hsize_t)fortstride[rank - 1 - i];
+	  edge[i]   = (hsize_t)fortedge[rank - 1 - i];
+        }
+ 
+      /* Read data from the field */
+      /* ------------------------ */
+      status = HE5_SWwrrdfield(swathID, fieldname, "r", start, stride, edge, buffer);
+      if (status == FAIL)
+        {
+	  sprintf(errbuf, "Cannot read data from the \"%s\" field.",fieldname) ;
+	  H5Epush(__FILE__, "HE5_SWrdfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      free(start);
+      free(stride);
+      free(edge);
+      free(errbuf);
+ 
+    }
+  else
+    {
+      sprintf(errbuf, "Fieldname \"%s\" does not exist.",fieldname) ;
+      H5Epush(__FILE__, "HE5_SWrdfld", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      status = FAIL;
+    }
+ 
+ 
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWrdcharfld                                                  |
+|                                                                             |
+|  DESCRIPTION: Reads data from a character string field (FORTRAN wrapper     |
+|               around SWreadfield)                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fieldname      char                fieldname                               |
+|  elemlen        int                 each element length in array of string  |
+|  numelem        int                 number of elements in declared buffer   |
+|                                     array                                   |
+|  fortstart      long                start array                             |
+|  fortstride     long                stride array                            |
+|  fortedge       long                edge array                              |
+|  buffer         void                data buffer for read                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|     None                                                                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 04   S.Zhao        For an array of character string dataset.           |
+|  Jun 04   S.Zhao        Added two more arguments (elemlen and numelem).     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWrdcharfld(int SwathID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *buffer)
+ 
+{
+  int		   ret      = SUCCEED;       /* routine return status variable */
+  int		   i        = 0;	     /* Loop index                     */
+  int		   rank     = 0;             /* Field rank                     */
+
+  hid_t            ntype[1] = {FAIL};        /* Field number types             */
+
+  hid_t            swathID  = FAIL;          /* Swath HDF5 type  ID            */
+
+  herr_t	   status   = SUCCEED;       /* routine return status variable */
+    
+  hssize_t	   *start  = (hssize_t *)NULL;/* Pointer to start array (C order)  */
+  hsize_t	   dims[HE5_DTSETRANKMAX];    /* Field dimensions                  */
+  hsize_t	   *stride = (hsize_t *)NULL; /* Pointer to stride array (C order) */
+  hsize_t	   *edge   = (hsize_t *)NULL; /* Pointer to edge array (C order)   */
+  
+  char		   *errbuf = (char *)NULL;    /* error message buffer              */
+  char             **strdatabuf = NULL;       /* string data buffer                */
+  int              stlen = 0;                 /* whole string array length         */ 
+  int              nelem = 0;                 /* number of elements in array of str*/
+  int              strsize = 0;               /* each str length in array of str   */
+  int              attr = 0;                  /* attribute value                   */
+  int              j = 0;                     /* Loop index                        */
+
+  int              num_elem_passed_out;
+  int              numread;
+
+
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  swathID = (hid_t)SwathID;
+  
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[ i ] = 0;
+
+  /* Get field info */
+  /* -------------- */
+  status = HE5_SWfieldinfo(swathID, fieldname, &rank, dims, ntype, NULL,NULL);  
+  if (status != FAIL)
+    {
+      start =  (hssize_t *)calloc(rank, sizeof(hssize_t));
+      if(start == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for start.\n");
+	  H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+        }
+      stride = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(stride == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for stride.\n");
+	  H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(errbuf);
+	  return(FAIL);
+        }
+      edge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(edge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      /* Reverse order of dimensions (FORTRAN -> C) */
+      /* ------------------------------------------ */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i]  = (hssize_t)fortstart[rank - 1 - i];
+	  stride[i] = (hsize_t)fortstride[rank - 1 - i];
+	  edge[i]   = (hsize_t)fortedge[rank - 1 - i];
+        }
+
+      status = HE5_SWreadlocattr(swathID, fieldname, "StringLengthAttribute", &attr);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot read attribute from the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      if(elemlen < attr )
+	{
+	  sprintf(errbuf, "Element length passed in is not correct. Should be same as in declration");
+	  H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      strsize = attr;
+      stlen = dims[0] * strsize;
+      nelem = stlen / strsize;
+      strdatabuf = (char **)malloc(nelem*sizeof(char *));
+      for (i = 0; i<nelem; i++)
+	{
+	  strdatabuf[i] = NULL;
+	  strdatabuf[i] = (char *)malloc((strsize+1)*sizeof(char));
+	} 
+
+      /* Read data from the field */
+      /* ------------------------ */           
+      status = HE5_SWwrrdfield(swathID, fieldname, "r", start, stride, edge, strdatabuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot read data from the \"%s\" field.",fieldname) ;
+	  H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }                                 
+	  return(FAIL);
+	}
+      if(numelem == 0)
+	{
+	  sprintf(errbuf, "Number of elements passed in cannot be zero.") ;
+	  H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }                                 
+	  return(FAIL);
+	}
+
+      if(edge != NULL)
+	{
+	  numread = edge[0];
+	}
+      else
+	{
+	  numread = (dims[0] - start[0])/stride[0];
+	}
+
+      if(numread <= 0)
+	{
+	  sprintf(errbuf, "Number of elements passed in cannot be zero.") ;
+	  H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }                                 
+	  return(FAIL);
+	}
+      if(numread <=  numelem)
+	{
+	  num_elem_passed_out = numread;
+	}
+      else
+	{
+	  num_elem_passed_out = numelem;
+	}
+
+      stlen = strlen(strdatabuf[0]);
+      strcpy((char *)buffer,strdatabuf[0]);
+      for (j = stlen; j < elemlen; j++)
+	{
+	  strcat((char *)buffer," ");
+	}
+
+      for (i = 1; i < num_elem_passed_out; i++)
+	{
+	  strcat((char *)buffer,strdatabuf[i]);
+	  stlen = strlen(strdatabuf[i]);
+	  for (j = stlen; j < elemlen; j++)
+	    {
+	      strcat(buffer," ");
+	    }
+	}
+
+      free(start);
+      free(stride);
+      free(edge);
+      free(errbuf);
+      if (strdatabuf != NULL)
+	{
+	  for (i = 0; i<nelem; i++)
+	    {
+	      if (strdatabuf[i] != NULL)
+		{
+		  free (strdatabuf[i]);
+		  strdatabuf[i] = NULL;
+		}
+	    }
+	  free (strdatabuf);
+	  strdatabuf = NULL;
+	}
+
+    }
+  else
+    {
+      sprintf(errbuf, "Fieldname \"%s\" does not exist.",fieldname) ;
+      H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      status = FAIL;
+    }
+  
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWrdattr  (FORTRAN wrapper)                                  |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from a swath.                                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_SWrdattr(int SwathID, char *attrname, void *datbuf)
+{
+  int         ret     = FAIL;/* routine return status variable    */
+
+  herr_t      status  = FAIL;/* routine return status variable    */
+
+  hid_t       swathID = FAIL;/* HDF-EOS swath ID                  */
+
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  swathID = (hid_t)SwathID;
+
+  /* Read the attribute buffer */
+  /* ------------------------- */
+  status = HE5_SWreadattr(swathID, attrname, datbuf);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot read the attribute value. \n");
+      H5Epush(__FILE__, "HE5_SWrdattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWrdgattr     (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from the "Data Fields" group in a swath.      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_SWrdgattr(int SwathID, char *attrname, void *datbuf)
+{
+  int         ret             = FAIL;   /* (int) return status      */
+
+  herr_t      status          = FAIL;   /* return status variable   */
+  
+  hid_t       swathID         = FAIL;   /* HDF5 type Swath ID       */
+  
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];  /* Error message buffer */
+  
+  swathID = (hid_t)SwathID;
+
+  status = HE5_SWreadgrpattr(swathID,attrname,datbuf);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot read Attribute \"%s\" from the \"Data Fields\" group.\n", attrname);
+      H5Epush(__FILE__, "HE5_SWrdgattr", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWrdgeogattr     (FORTRAN wrapper)                           |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from the "Geolocation Fields" group           |
+|               in a swath.                                                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_SWrdgeogattr(int SwathID, char *attrname, void *datbuf)
+{
+  int         ret             = FAIL;   /* (int) return status      */
+ 
+  herr_t      status          = FAIL;   /* return status variable   */
+ 
+  hid_t       swathID         = FAIL;   /* HDF5 type Swath ID       */
+ 
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];  /* Error message buffer */
+ 
+  swathID = (hid_t)SwathID;
+ 
+  status = HE5_SWreadgeogrpattr(swathID,attrname,datbuf);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot read attribute \"%s\" from the \"Geolocation Fields\" group.\n", attrname);
+      H5Epush(__FILE__, "HE5_SWrdgeogattr", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwrlattr                                                    |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper to Write/update local attribute in a swath.   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fieldname      char*               field with local attribute              |
+|  attrname       char*               local attribute name                    |
+|  numtype        int                 local attribute HDF numbertype          |
+|  fortcount[]    long                Number of local attribute elements      |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 00   D.Wynne       Original Programmer                                 |
+|  Aug 00   A.Muslimov    Modified to conform to HDF5 data types.             |
+|  Nov 02   S.Zhao        Modified to get the size of a string attribute.     |
+|  Mar 04   S.Zhao        Modified for a character string attribute.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWwrlattr(int SwathID, char *fieldname, char *attrname, int numtype, long fortcount[], void *datbuf)
+{
+  int		   ret  = FAIL;             /* routine return status variable             */
+  int 	       rank = 1;                /* Note: It is assumed that fortcout has just */
+  /* one element to agree with EHattr function  */
+  int		   i = 0;
+
+  herr_t	   status = FAIL;           /* routine return status variable             */
+  
+  hsize_t	   *count = (hsize_t *)NULL;/* Pointer to count array (C order)           */
+ 
+  hid_t        swathID    = FAIL;       /* Swath HDF5 type ID                         */   
+  hid_t        numbertype = FAIL;       /* HDF5 dta type ID                           */
+  
+  char         *errbuf = (char *)NULL;  /* error message buffer                       */
+  char         *tempbuf = (char *)NULL; /* temp buffer                                */
+
+
+  /* Get HDF5 type data type ID */
+  /* -------------------------- */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 data type ID.\n");
+      H5Epush(__FILE__, "HE5_SWwrlattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWwrlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  count = (hsize_t *)calloc(rank, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_SWwrlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < rank; i++)
+    {
+      count[i] = (hsize_t)fortcount[rank - 1 - i];
+    }
+  
+  swathID = (hid_t)SwathID;
+
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of local attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_SWwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n");
+	  H5Epush(__FILE__, "HE5_SWwrlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+
+      /* Write local attribute buffer */
+      /* ---------------------------- */
+      status = HE5_SWwritelocattr(swathID, fieldname, attrname, numbertype, count, tempbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write local attribute value.\n");
+	  H5Epush(__FILE__, "HE5_SWwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+          free(tempbuf);
+          return(FAIL);
+	} 
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    {
+      /* Write local attribute buffer */
+      /* ---------------------------- */
+      status = HE5_SWwritelocattr(swathID, fieldname, attrname, numbertype, count, datbuf);
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write local attribute value.\n");
+          H5Epush(__FILE__, "HE5_SWwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(count);
+          free(errbuf);
+          return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWrdlattr    (FORTRAN  wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with a specified field in a swath. |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fieldname      char                fieldname                               |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_SWrdlattr(int SwathID, char *fieldname, char *attrname, void *datbuf)
+{
+  int         ret             =  FAIL;/* return status variable   */
+
+  herr_t      status          =  FAIL;/* return status variable   */
+
+  hid_t       swathID         =  FAIL;/* HDF5 type Swath  ID      */
+  
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  swathID = (hid_t)SwathID;
+
+  status = HE5_SWreadlocattr(swathID,fieldname, attrname, datbuf);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" field.\n", attrname,fieldname);
+      H5Epush(__FILE__, "HE5_SWrdlattr", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret  = (int)status;
+  return(ret);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqmapsF    (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Returns dimension mappings and offsets and increments         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nMap           long                Number of dimension mappings            |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dimmaps        char                dimension mappings (comma-separated)    |
+|  offset         long                array of offsets                        |
+|  increment      long                array of increments                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqmapsF(int SwathID, char *dimmaps, long offset[], long increment[])
+{
+  long           nMap      = FAIL;/* Number of mappings                */
+
+  hid_t          swathID   = FAIL;/* HDF-EOS swath ID                  */
+
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+
+  swathID = (hid_t)SwathID;
+
+  /* Call HE5_SWinqmaps */
+  /* ------------------ */
+  nMap = HE5_SWinqmaps(swathID, dimmaps, offset, increment);
+  if(nMap == FAIL)
+    {
+      sprintf(errbuf,"Error calling SWinqmaps() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWinqmapsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return(nMap);
+}
+
+
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqimapsF                                                  |
+|                                                                             |
+|  DESCRIPTION: Returns indexed mappings and index sizes                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nMap           long                Number of indexed dimension mappings    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  idxmaps        char                indexed dimension mappings              |
+|                                     (comma-separated)                       |
+|  idxsizes       long                Number of elements in each mapping      |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 00   D.Wynne       Original Version                                    |
+|  Aug 00   A.Muslimov    Modified to conform to HDF5 data type               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_SWinqimapsF(int SwathID, char *idxmaps, long idxsizes[])
+{
+  int		i          = 0;   /* Loop index                       */         
+  
+  hid_t     swathID    = FAIL;/* HDF5 type swath ID               */
+
+  long		nmaps      = FAIL;/* Number of index maps             */
+  long		strbufsize = 0;   /* Buffer size for length of string */
+  
+  hsize_t	*tidxsizes = (hsize_t *)NULL;/* Size of mapping       */
+
+  char      errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer  */
+
+  swathID = (hid_t)SwathID;
+
+  /* Get the number of index maps */
+  /* ---------------------------- */
+  nmaps = HE5_SWnentries(swathID, 2, &strbufsize);
+  if(nmaps == FAIL)
+    {
+      sprintf(errbuf,"Error calling SWnentries() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWinqimapsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate space for index sizes */
+  /* ------------------------------ */
+  tidxsizes = (hsize_t *)calloc(nmaps, sizeof(hsize_t));
+  if(tidxsizes == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tidxsizes.\n");
+      H5Epush(__FILE__, "HE5_SWinqimapsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  
+  /* Retrieve the list of maps and the sizes */
+  /* --------------------------------------- */
+  nmaps = HE5_SWinqidxmaps(swathID, idxmaps, tidxsizes);
+  if(nmaps == FAIL)
+    {
+      sprintf(errbuf,"Error calling SWinqidxmaps() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWinqimapsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(tidxsizes);
+      return(FAIL);
+    }
+
+
+  /* Convert data type  */
+  /* ------------------ */
+  for(i = 0; i < nmaps; i++)
+    idxsizes[i] = (long)tidxsizes[i];
+  
+
+  free(tidxsizes);
+  
+  return(nmaps);
+}
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqdimsF                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns dimension names and values defined in swath structure |
+|               (FORTRAN Wrapper)                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nDim           long                Number of defined dimensions            |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dimnames       char                Dimension names (comma-separated)       |
+|  dims           long                Dimension values                        |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 00   D.Wynne       Original Version                                    |
+|  Aug 00   A.Muslimov    Modified to conform to HDF5 data type               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_SWinqdimsF(int SwathID, char *dimnames, long dims[])
+{
+  int		i          = 0;   /* Loop index                    */
+  
+  hid_t     swathID    = FAIL;/* HDF5 type swath ID            */ 
+ 
+  long		nDim       = FAIL;/* (return) number of dimensions */
+  long		strbufsize = 0;   /* String size variable          */
+  
+  hsize_t	*tdims     = (hsize_t *)NULL;/* Dimension variable */
+
+  char      errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+
+  swathID = (hid_t)SwathID;  
+  
+  nDim = HE5_SWnentries(swathID, 0, &strbufsize);
+  if(nDim == FAIL)
+    {
+      sprintf(errbuf,"Error calling SWnentries() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWinqdimsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  tdims = (hsize_t *)calloc(nDim, sizeof(hsize_t));
+  if(tdims == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tdims.\n");
+      H5Epush(__FILE__, "HE5_SWinqdimsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+
+  nDim = HE5_SWinqdims(swathID, dimnames, tdims);
+  if(nDim == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_SWinqdims() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWinqdimsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(tdims);
+      return(FAIL);
+    }
+  
+  
+  /* Convert data type */
+  /* ----------------- */
+  for(i = 0; i < nDim; i++)
+    dims[i] = (long)tdims[i];
+  
+
+  free(tdims);
+  
+  return (nDim); 
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqgflds    (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Inquires about geo fields in swath                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nflds          long                Number of geo fields in swath           |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fieldlist      char                Field names (comma-separated)           |
+|  rank           int                 Array of ranks                          |
+|  ntype          int                 number types                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqgflds(int SwathID, char *fieldlist, int rank[], int ntype[])
+{
+  long            nflds   = FAIL;              /* Number of Geo  fields */
+  long            i;                           /* Loop index            */
+
+  hid_t           swathID = FAIL;              /* HDF5 data type ID     */
+
+  hid_t           *dtype = (hid_t *)NULL;      /* Data type             */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer  */
+
+  swathID = (hid_t)SwathID;
+
+  /* Call "HE5_SWinqgeofields" routine to get number of fields */
+  /* ----------------------------------------------------- */
+  nflds = HE5_SWinqgeofields(swathID, fieldlist, NULL, NULL);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Cannot get information about fields in \"Geolocation Fields\" group. \n");
+      H5Epush(__FILE__, "HE5_SWinqgflds", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtype = (hid_t *)calloc(nflds,sizeof(hid_t));
+  if (dtype == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory. \n");
+      H5Epush(__FILE__, "HE5_SWinqgflds", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  nflds = HE5_SWinqgeofields(swathID, fieldlist, rank, dtype);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Cannot get information about fields in \"Geolocation Fields\" group. \n");
+      H5Epush(__FILE__, "HE5_SWinqgflds", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(dtype);
+      return(FAIL);
+    }
+
+  for (i = 0; i < nflds; i++)
+    ntype[i] = (int)dtype[i];
+  
+  free(dtype);
+  return (nflds);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqdflds      (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Inquires about data fields in swath                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nflds          long                Number of data fields in swath          |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fieldlist      char                Field names (comma-separated)           |
+|  rank           int                 Array of ranks                          |
+|  ntype          int                 number types                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqdflds(int SwathID, char *fieldlist, int rank[], int ntype[])
+{
+  long            nflds   = FAIL;               /* Number of Data fields  */
+  long            i;                            /* Looop index            */
+  
+  hid_t           swathID = FAIL;               /* HDF5 type swath ID     */
+
+  hid_t           *dtype  = (hid_t *)NULL;      /* Data type              */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];      /* Error message buffer   */
+
+
+  swathID = (hid_t)SwathID;
+
+  /* Call "HE5_SWinqdatafields" routine to get number of fields */
+  /* ------------------------------------------------------ */
+  nflds = HE5_SWinqdatafields(swathID, fieldlist, NULL, NULL);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n");
+      H5Epush(__FILE__, "HE5_SWinqdflds", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtype = (hid_t *)calloc(nflds, sizeof(hid_t));
+  if (dtype == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory. \n");
+      H5Epush(__FILE__, "HE5_SWinqdflds", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  nflds = HE5_SWinqdatafields(swathID, fieldlist, rank, dtype);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n");
+      H5Epush(__FILE__, "HE5_SWinqdflds", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(dtype);
+      return(FAIL);
+    }
+
+  for (i = 0; i < nflds; i++)
+    ntype[i] = (int)dtype[i];
+
+
+  free(dtype);
+  return(nflds);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdiminfoF                                                   |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper for SWdiminfo to Retrieve size of specified   |
+|               dimension.                                                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  size           long    None        Size of dimension                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int     None        swath structure ID                      |
+|  dimname        char*   None        Dimension name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/21/99  A.Muslimov    In the call to EHmetagroup() replaced the argument  |
+|                         gid by fid.                                         |
+|  Oct 99   Abe Taaheri   Added to convert hsize_t to integer                 |
+|  Aug 00   A.Muslimov    Modified to conform to HDF5 data type               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_SWdiminfoF(int SwathID, char *dimname)
+{
+  long        size    = 0;                 /* dimension size  (return) */
+
+  hid_t       swathID = FAIL;              /* HDF5 data type ID        */  
+
+  hsize_t     tsize   = 0;                 /* size variable            */
+  
+  char        errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer     */
+
+  swathID = (hid_t)SwathID;
+
+  tsize = HE5_SWdiminfo(swathID, dimname);
+  if (tsize == 0)
+    {
+      sprintf(errbuf, "Error calling SWdiminfo() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_SWdiminfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  size = (long)tsize;
+  
+  return(size);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWmapinfoF   (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Returns dimension mapping information                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  geodim         char                geolocation dimension name              |
+|  datadim        char                data dimension name                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  offset         long                mapping offset                          |
+|  increment      long                mapping increment                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_SWmapinfoF(int SwathID, char *geodim, char *datadim, long *offset, long *increment)
+{
+  int            ret      = FAIL;	/* routine return status variable */
+   
+  herr_t         status   = FAIL;	/* routine return status variable */
+
+  hid_t          swathID  = FAIL;	/* HDF-EOS swath ID               */
+
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  /* Initialize return values */
+  /* ------------------------ */
+  *offset    = FAIL;
+  *increment = FAIL;
+
+  swathID = (hid_t)SwathID;
+
+  status = HE5_SWmapinfo(swathID, geodim, datadim, offset, increment);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot get mapping information.") ;
+      H5Epush(__FILE__, "HE5_SWmapinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWgmapinfo   (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Returns mapping information for dimension                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 2 for indexed mapping, 1 for regular    |
+|                                     mapping, 0 if the dimension is not      |
+|                                     and (-1) FAIL                           |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  geodim         char                geolocation dimension name              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  NONE                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_SWgmapinfo(int SwathID, char *geodim)
+{
+  int            ret       = FAIL;           /* Return status variable    */
+
+  herr_t         status    = FAIL;           /* Return status variable    */
+
+  hid_t          swathID   = FAIL;           /* HDF5 type swath ID        */
+
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer      */
+ 
+  swathID = (hid_t)SwathID;
+
+  status = HE5_SWgeomapinfo(swathID, geodim);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot get geolocation mapping information.") ;
+      H5Epush(__FILE__, "HE5_SWgmapinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWfldinfoF                                                   |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper arount SWfieldinfo                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure id                      |
+|  fieldname      char                name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  rank           long                rank of field (# of dims)               |
+|  dims           long                field dimensions                        |
+|  ntype          int                 field number type                       |
+|  fortdimlist    char                field dimension list (FORTRAN order)    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Nov 99   Abe Taaheri   Modified for HDF5                                   |
+|  Aug 00   A.Muslimov    Updated to conform to the HDF5 data types.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWfldinfoF(int SwathID, char *fieldname, int *rank, long dims[], int *ntype, char *fortdimlist, char *fortmaxdimlist)
+{
+  int		   ret      = SUCCEED;    /* routine return status variable */
+  int		   j        = 0;          /* Loop Index                     */
+
+  herr_t	   status   = SUCCEED;    /* routine return status variable */
+
+  hid_t            swathID  = FAIL;       /* HDF5 type data type ID         */   
+  
+  hid_t            dtype[1] = {FAIL}; /* Data type                      */
+
+  hsize_t	   tempdims[HE5_DTSETRANKMAX];/* Dimension sizes array      */       
+  hsize_t 	   swap     = 0;              /* Temporary dimension size   */
+
+  char		   *errbuf  = (char *)NULL;   /* error message buffer       */
+ 
+  /* Dimension lists in C order */
+  /* -------------------------- */
+  char		   *dimlist    = (char *)NULL;
+  char		   *maxdimlist = (char *)NULL;
+
+  
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWfldinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  maxdimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  dimlist    = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(dimlist == NULL || maxdimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input list.\n");
+      H5Epush(__FILE__, "HE5_SWfldinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  swathID = (hid_t)SwathID;
+
+  /* Initialize tempdims[] array */
+  /* --------------------------- */
+  for ( j = 0; j < HE5_DTSETRANKMAX; j++)
+    tempdims[ j ] = 0;
+
+  /* Get field info */
+  /* -------------- */
+  status = HE5_SWfieldinfo(swathID, fieldname, rank, tempdims, dtype, dimlist, maxdimlist);
+  if (status == SUCCEED)
+    {
+      for (j = 0; j < *rank / 2; j++)
+        {
+	  swap = tempdims[*rank - 1 - j];
+	  tempdims[*rank - 1 - j] = tempdims[j];
+	  tempdims[j] = swap;
+        }
+      /* change the datatype */
+      /* ------------------- */
+      for (j = 0; j < *rank; j++)
+	dims[j] = (long)tempdims[j];
+
+      /* Reverse order of dimensions entries in dimension list */
+      /* ----------------------------------------------------- */
+      if(fortdimlist != (char *)NULL)
+	{
+	  status = HE5_EHrevflds(dimlist, fortdimlist);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot reverse entries in dimension list.\n");
+	      H5Epush(__FILE__, "HE5_SWfldinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(dimlist);
+	      free(maxdimlist);
+	      return(FAIL);
+	    }
+	}
+      if(fortmaxdimlist != (char *)NULL)
+	{
+	  status = HE5_EHrevflds(maxdimlist, fortmaxdimlist);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot reverse entries in maximum dimension list.\n");
+	      H5Epush(__FILE__, "HE5_SWfldinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(dimlist);
+	      free(maxdimlist);
+	      return(FAIL);
+	    }
+		  
+	}
+    }
+
+  *ntype = (int)dtype[0];
+
+  free(maxdimlist);
+  free(dimlist);
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret); 
+}
+  
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWchunkinfoF                                                 |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper for SWchunkinfo                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fieldname      char*               name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ndims          int*                rank of a dataset                       |
+|  dims           long                the array containing sizes              |
+|                                     of each dimension of a chunk            |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date         Programmer    Description                                    |
+|   =========    ============  ============================================   |
+|   Dec 03       S.Zhao        Original development                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWchunkinfoF(int SwathID, char *fieldname, int *ndims, long dims[])
+{
+  int           ret       = FAIL;           /* return status        */
+  int           j         = 0;              /* Loop index           */
+ 
+  herr_t        status    = FAIL;           /* return status        */
+ 
+  hid_t         swathID   = FAIL;           /* HDF5 type swath ID   */
+ 
+  hsize_t       tempdims[HE5_DTSETRANKMAX]; /* Temporary dimension sizes array */
+  hsize_t       swap      = 0;              /* Temporary dimension size   */
+ 
+  char          *errbuf   = (char *)NULL;   /* error message buffer */
+ 
+  /* Allocate memory for error message buffer */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWchunkinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Initialize tempdims[] array */
+  /* --------------------------- */
+  for ( j = 0; j < HE5_DTSETRANKMAX; j++)
+    tempdims[ j ] = 0; 
+ 
+  swathID = (hid_t)SwathID;
+ 
+  status = HE5_SWchunkinfo(swathID, fieldname, ndims, tempdims);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling SWchunkinfo() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWchunkinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  for (j = 0; j < *ndims / 2; j++)
+    {
+      swap = tempdims[*ndims - 1 - j];
+      tempdims[*ndims - 1 - j] = tempdims[j];
+      tempdims[j] = swap;
+    }
+
+  for (j = 0; j < *ndims; j++)
+    dims[j] = (long)tempdims[j];
+ 
+  free(errbuf);
+ 
+  ret = (int)status;
+  return(ret);
+ 
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWidxmapinfoF                                                |
+|                                                                             |
+|  DESCRIPTION: Returns indexed mapping information                           |
+|               (FORTRAN Wrapper)                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  size           long                Number of index values (sz of geo dim)  |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure id                      |
+|  geodim         char                geolocation dimension name              |
+|  datadim        char                data dimension name                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  index          long                array of index values                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 00   D.Wynne       Original Version                                    |
+|  Aug 00   A.Muslimov    Updated to conform to HDF5 data types               |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_SWidxmapinfoF(int SwathID, char *geodim, char *datadim, long index[])
+{
+  long        size    = FAIL;         /* routine return status variable */
+
+  hid_t       swathID = FAIL;         /* HDF5 type swath ID             */
+
+  hsize_t     gsize   = 0;            /* Temporary size variable        */
+  
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+
+  swathID = (hid_t)SwathID;
+
+  gsize = HE5_SWidxmapinfo(swathID, geodim, datadim, index);
+  if (gsize == 0)
+    {
+      sprintf(errbuf, "Error calling SWidxmapinfo() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_SWidxmapinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  size = (long)gsize;
+
+  return(size);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwrgattr                                                    |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper to Write/update group attribute in a swath.   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  attrname       char*               group attribute name                    |
+|  numtype        int                 group attribute HDF numbertype          |
+|  fortcount[]    long                Number of group attribute elements      |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                   It is assumed that fortcout has just one element to agree |
+|                   with EHattr() call.                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 00   D.Wynne       Original Programmer                                 |
+|  Aug 00   A.Muslimov    Updated to reflect most recent data type changes.   |
+|  Nov 02   S.Zhao        Modified to get the size of a string attribute.     |
+|  Mar 04   S.Zhao        Modified for a character string attribute.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWwrgattr(int SwathID, char *attrname, int numtype, long fortcount[], void *datbuf)
+{
+  int          ret    = FAIL;            /* (int) return status variable      */
+  int		   rank   = 1;               /* Rank variable                     */
+  int		   i;                        /* Loop index                        */
+
+  herr_t	   status     = FAIL;        /* routine return status variable    */
+  
+  hid_t        swathID    = FAIL;        /* HDF5 type Swath ID                */
+  hid_t        numbertype = FAIL;        /* HDF5 data type ID                 */
+             
+  hsize_t      *count  = (hsize_t *)NULL;/* Pointer to count array (C order)  */
+  
+  char         *errbuf = (char *)NULL;   /* error message buffer              */
+  char         *tempbuf = (char *)NULL;  /* temp buffer                       */
+  
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get HDF5 data type ID */
+  /* --------------------- */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID.\n");
+      H5Epush(__FILE__, "HE5_SWwrgattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+
+  count = (hsize_t *)calloc(rank, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_SWwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < rank; i++)
+    count[i] = (hsize_t)fortcount[rank - 1 - i];
+  
+  
+  swathID = (hid_t)SwathID;
+
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of group attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_SWwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n");
+	  H5Epush(__FILE__, "HE5_SWwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+ 
+      status = HE5_SWwritegrpattr(swathID, attrname, numbertype, count, tempbuf);
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write group attribute value.\n");
+          H5Epush(__FILE__, "HE5_SWwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(errbuf);
+          free(count);
+          free(tempbuf);
+          return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    {
+      status = HE5_SWwritegrpattr(swathID, attrname, numbertype, count, datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write group attribute value.\n");
+	  H5Epush(__FILE__, "HE5_SWwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(count);
+	  return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwrgeogattr                                                 |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper to write/update the "Geolocation Fields" group|
+|               attribute in a swath.                                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  attrname       char*               group attribute name                    |
+|  numtype        int                 group attribute HDF numbertype          |
+|  fortcount[]    long                Number of group attribute elements      |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                   It is assumed that fortcout has just one element to agree |
+|                   with EHattr() call.                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04   S.Zhao        Original development                                |
+|  Mar 04   S.Zhao        Modified for a character string attribute.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWwrgeogattr(int SwathID, char *attrname, int numtype, long fortcount[], void *datbuf)
+{
+  int          ret    = FAIL;            /* (int) return status variable      */
+  int          rank   = 1;               /* Rank variable                     */
+  int          i;                        /* Loop index                        */
+ 
+  herr_t       status     = FAIL;        /* routine return status variable    */
+ 
+  hid_t        swathID    = FAIL;        /* HDF5 type Swath ID                */
+  hid_t        numbertype = FAIL;        /* HDF5 data type ID                 */
+ 
+  hsize_t      *count  = (hsize_t *)NULL;/* Pointer to count array (C order)  */
+ 
+  char         *errbuf = (char *)NULL;   /* error message buffer              */
+  char         *tempbuf = (char *)NULL;  /* temp buffer                       */
+ 
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWwrgeogattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get HDF5 data type ID */
+  /* --------------------- */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID.\n");
+      H5Epush(__FILE__, "HE5_SWwrgeogattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+ 
+  count = (hsize_t *)calloc(rank, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_SWwrgeogattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+ 
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < rank; i++)
+    count[i] = (hsize_t)fortcount[rank - 1 - i];
+ 
+ 
+  swathID = (hid_t)SwathID;
+ 
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of group attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_SWwrgeogattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n");
+	  H5Epush(__FILE__, "HE5_SWwrgeogattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+ 
+      status = HE5_SWwritegeogrpattr(swathID, attrname, numbertype, count, tempbuf);
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write group attribute value.\n");
+          H5Epush(__FILE__, "HE5_SWwrgeogattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(errbuf);
+          free(count);
+          free(tempbuf);
+          return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    {
+      status = HE5_SWwritegeogrpattr(swathID, attrname, numbertype, count, datbuf);
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write group attribute value.\n");
+          H5Epush(__FILE__, "HE5_SWwrgeogattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(errbuf);
+          free(count);
+          return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+    }
+ 
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWatinfo                                                     |
+|                                                                             |
+|  DESCRIPTION:  FORTRAN wrapper for SWattrinfo                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  numbertype     int                 attribute HDF numbertype                |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/28/99  A.Muslimov    Changed the type of return value from intn          |
+|                         to herr_t.                                          |
+|  Oct 99   Abe Taaheri   Added for HDF5                                      |
+|  May 00   D.Wynne       Updated to reflect datatype changes                 |
+|  Aug 00   A.Muslimov    Updated to reflect yet another datatype changes     |
+|                                                                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+|                                                                             |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWatinfo(int SwathID, char *attrname, int *numbertype, long *fortcount)
+{
+  int          ret      = FAIL;               /* (int) return status variable  */ 
+
+  herr_t	   status   = FAIL;	              /* return status variable        */
+
+  hid_t        *ntype   = (hid_t *)NULL;      /* Data type class ID            */
+
+  hid_t        swathID  = FAIL;               /* HDF5 type Swath ID            */
+
+  hsize_t      *count   = (hsize_t *)NULL;    /* Pointer to count (C order)    */
+  
+  char         *errbuf  = (char *)NULL;       /* error message buffer          */
+  
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  count = (hsize_t *) calloc(1, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_SWatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  ntype = (hid_t *) calloc(1, sizeof(hid_t));
+  if(ntype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for ntype.\n");
+      H5Epush(__FILE__, "HE5_SWatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      return(FAIL);
+    }
+
+
+  swathID = (hid_t)SwathID;
+
+  status = HE5_SWattrinfo(swathID, attrname, ntype, count);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about attribute \"%s\".\n", attrname);
+      H5Epush(__FILE__, "HE5_SWatinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      free(ntype);
+      return(FAIL);
+    }  
+
+  
+  *fortcount  = (long)(*count);
+  *numbertype = (int)(*ntype);
+
+  free(errbuf);
+  free(count);
+  free(ntype);
+
+  ret = (int)status;
+  return(ret);
+}
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWgatinfo                                                    |
+|                                                                             |
+|  DESCRIPTION:  FORTRAN wrapper for SWgrpattrinfo                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  numbertype     int                 attribute HDF numbertype                |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/28/99  A.Muslimov    Changed the type of return value from intn          |
+|                         to herr_t.                                          |
+|  Oct 99   Abe Taaheri   Added for HDF5                                      |
+|  May 00   D.Wynne       Updated to reflect datatype changes                 |
+|  Aug 00   A.Muslimov    Updated to reflect yet another datatype changes     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+|                                                                             |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWgatinfo(int SwathID, char *attrname, int *numbertype, long *fortcount)
+{
+  int	   	  ret     = FAIL;	        /* (int) return status variable   */
+
+  herr_t   	  status  = FAIL;           /* routine return status variable */
+
+  hid_t       *ntype  = (hid_t *)NULL;  /* Data type class ID         */
+
+  hid_t       swathID = FAIL;           /* HDF5 type Swath ID             */
+
+  hsize_t     *count  = (hsize_t *)NULL;/* Pointer to count  (C order)    */
+  
+  char        *errbuf = (char *)NULL;   /* error message buffer           */
+  
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_SWgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+  if( ntype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for ntype.\n");
+      H5Epush(__FILE__, "HE5_SWgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      return(FAIL);
+    }
+
+
+  swathID = (hid_t)SwathID;
+
+  status = HE5_SWgrpattrinfo(swathID, attrname, ntype, count);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about group attribute.\n");
+      H5Epush(__FILE__, "HE5_SWgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      free(ntype);
+      return(FAIL);
+    }
+  
+  *fortcount  = (long)(*count);
+  *numbertype = (int)(*ntype);
+
+  free(errbuf);
+  free(count);
+  free(ntype);
+  
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWgeogatinfo                                                 |
+|                                                                             |
+|  DESCRIPTION:  FORTRAN wrapper for SWgeogrpattrinfo                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  numbertype     int                 attribute HDF numbertype                |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+|                                                                             |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWgeogatinfo(int SwathID, char *attrname, int *numbertype, long *fortcount)
+{
+  int         ret     = FAIL;           /* (int) return status variable   */
+ 
+  herr_t      status  = FAIL;           /* routine return status variable */
+ 
+  hid_t       *ntype  = (hid_t *)NULL;  /* Data type class ID             */
+ 
+  hid_t       swathID = FAIL;           /* HDF5 type Swath ID             */
+ 
+  hsize_t     *count  = (hsize_t *)NULL;/* Pointer to count  (C order)    */
+ 
+  char        *errbuf = (char *)NULL;   /* error message buffer           */
+ 
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWgeogatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_SWgeogatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+ 
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+  if( ntype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for ntype.\n");
+      H5Epush(__FILE__, "HE5_SWgeogatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      return(FAIL);
+    }
+ 
+ 
+  swathID = (hid_t)SwathID;
+ 
+  status = HE5_SWgeogrpattrinfo(swathID, attrname, ntype, count);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about group attribute.\n");
+      H5Epush(__FILE__, "HE5_SWgeogatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      free(ntype);
+      return(FAIL);
+    }
+ 
+  *fortcount  = (long)(*count);
+  *numbertype = (int)(*ntype);
+ 
+  free(errbuf);
+  free(count);
+  free(ntype);
+ 
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqgattrs (FORTRAN wrapper)                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list in "Data Fields" group                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in "Data Fields"   |
+|                                       group.                                |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in "Data Fields" group  |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqgattrs(int SwathID, char *attrnames, long *strbufsize)
+{
+  long            nattr   = FAIL;         /* Number of attributes (return)  */
+
+  hid_t           swathID = FAIL;         /* HDF5 type swath ID             */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+
+  swathID = (hid_t)SwathID;
+  
+  nattr = HE5_SWinqgrpattrs(swathID, attrnames, strbufsize);
+  if ( nattr < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+      H5Epush(__FILE__, "HE5_SWinqgattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  return(nattr);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqgeogattrs (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list in "Geolocation Fields" group.                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in "Geolocation    |
+|                                     Fields" group                           |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in "Geolocation Fields" |
+|                                     group (Comma-separated list)            |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_SWinqgeogattrs(int SwathID, char *attrnames, long *strbufsize)
+{
+  long            nattr   = FAIL;         /* Number of attributes (return)  */
+ 
+  hid_t           swathID = FAIL;         /* HDF5 type swath ID             */
+ 
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+ 
+  swathID = (hid_t)SwathID;
+ 
+  nattr = HE5_SWinqgeogrpattrs(swathID, attrnames, strbufsize);
+  if ( nattr < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+      H5Epush(__FILE__, "HE5_SWinqgeogattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+  return(nattr);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqattrsF     (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in swath struct    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in swath struct         |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqattrsF(int SwathID, char *attrnames, long *strbufsize)
+{
+  long            nattr    = FAIL;  /* Number of attributes (return)  */
+
+  hid_t           swathID  = FAIL;  /* HDF5 type swath ID             */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+
+  swathID = (hid_t)SwathID;
+
+  nattr = HE5_SWinqattrs(swathID, attrnames, strbufsize);
+  if ( nattr < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+      H5Epush(__FILE__, "HE5_SWinqattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  return(nattr);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWlatinfo                                                    |
+|                                                                             |
+|  DESCRIPTION:  FORTRAN wrapper for SWlocattrinfo                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fieldname      char*               field name name                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrname       char*               attribute name                          |
+|  numbertype     int                 attribute HDF numbertype                |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  9/28/99  A.Muslimov    Changed the type of return value from intn          |
+|                         to herr_t.                                          |
+|  Oct 99   Abe Taaheri   Added for HDF5                                      |
+|  May 00   D.Wynne       Updated to reflect datatype changes                 |
+|  Aug 00   A.Muslimov    Updated to reflect yet another datatype changes     |
+|                                                                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+|                                                                             |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWlatinfo(int SwathID, char *fieldname, char *attrname, int *numbertype, long *fortcount)
+{
+  int	   	  ret     = FAIL;	        /* (int) return status variable   */
+
+  herr_t   	  status  = FAIL;           /* routine return status variable */
+
+  hid_t       *ntype  = (hid_t *)NULL;  /* Data type class ID         */
+
+  hid_t       swathID = FAIL;           /* HDF5 type Swath ID             */
+
+  hsize_t     *count  = (hsize_t *)NULL;/* Pointer to count  (C order)    */
+  
+  char        *errbuf = (char *)NULL;   /* error message buffer           */
+
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_SWlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+  if( ntype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for ntype.\n");
+      H5Epush(__FILE__, "HE5_SWlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      return(FAIL);
+    }
+
+  swathID = (hid_t)SwathID;
+  
+  status = HE5_SWlocattrinfo(swathID, fieldname, attrname, ntype, count);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about local attribute.\n");
+      H5Epush(__FILE__, "HE5_SWlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      free(ntype);
+      return(FAIL);
+    }
+  
+  *fortcount  = (long)(*count);
+  *numbertype = (int)(*ntype);
+  
+  free(errbuf);
+  free(count);
+  free(ntype);
+  
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqlattrs     (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list associated with a specified field in the      |
+|                "Data Fields" group.                                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in "Data Fields"   |
+|                                       group.                                |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fieldname      char                field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in "Data Fields" group  |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqlattrs(int SwathID, char *fieldname, char *attrnames, long *strbufsize)
+{
+  long            nattr       = FAIL;     /* Number of attributes   */
+
+  hid_t           swathID     = FAIL;     /* HDF5 type swath ID     */
+    
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */  
+
+  swathID = (hid_t)SwathID;
+
+  nattr = HE5_SWinqlocattrs(swathID, fieldname, attrnames, strbufsize);
+  if ( nattr < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+      H5Epush(__FILE__, "HE5_SWinqlattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+  return (nattr);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWidtype                                                     |
+|                                                                             |
+|  DESCRIPTION: Inquires about geo/data fields in swath                       |
+|               (FORTRAN Wrapper)                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                  return status (0) SUCCEED, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID      int                                                           |
+|  fieldname    char *                                                        |
+|  attrname     char *                                                        |
+|  fieldgroup   int                                                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  Type         int                                                           |
+|  Class        int                                                           |
+|  Order        int                                                           |
+|  size         long                                                          |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 99   D.Wynne       Original Programmer                                 |
+|  Dec 99   A.Muslimov    Changed the status data type from hid_t to int   .  |
+|  Feb 00   A.Muslimov    Added error checking after the function calls.      |
+|  Mar 00   A.Muslimov    Updated to include Group/Local Attributes options.  |
+|  May 00   A.Muslimov    Replaced 'H5T_class_t' type by 'int' data type.     |
+|  Aug 00   A.Muslimov    Updated to reflect most recent data type changes.   |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_SWidtype(int SwathID, char *fieldname, char *attrname, int fieldgroup, int *Type, int *Class, int *Order, long *size)
+{
+  int		   ret      = FAIL;               /* (int) status variable  */
+
+  herr_t	   status   = FAIL;               /* return status variable */
+  
+  size_t	   *tsize   = (size_t *)NULL;     /* data size variable     */ 
+
+  hid_t        *typeID  = (hid_t *)NULL;      /* HDF5 Data type ID      */
+  hid_t        swathID  = FAIL;               /* HDF5 type swath ID     */
+ 
+  H5T_class_t  *classID = (H5T_class_t *)NULL;/*  Data type class ID    */
+  H5T_order_t  *order   = (H5T_order_t *)NULL;/* Byte order of datatype */
+
+  char         *errbuf  = (char *)NULL;       /* error message buffer   */
+
+  
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  typeID = (hid_t *)calloc(1, sizeof(hid_t));
+  if(typeID == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for typeID.\n");
+      H5Epush(__FILE__, "HE5_SWidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  tsize = (size_t *)calloc(1, sizeof(size_t));
+  if(tsize == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tsize.\n");
+      H5Epush(__FILE__, "HE5_SWidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      return(FAIL);
+    }
+
+  classID = (H5T_class_t *)calloc(1, sizeof(H5T_class_t));
+  if(classID == (H5T_class_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for classID.\n");
+      H5Epush(__FILE__, "HE5_SWidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      free(tsize);
+      return(FAIL);
+    }
+
+  order = (H5T_order_t *)calloc(1, sizeof(H5T_order_t));
+  if(order == (H5T_order_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for order.\n");
+      H5Epush(__FILE__, "HE5_SWidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      free(tsize);
+      free(classID);
+      return(FAIL);
+    }
+
+
+  swathID = (hid_t)SwathID;
+
+  /* Get data type information */
+  /* ------------------------- */
+  status = HE5_SWinqdatatype(swathID, fieldname, attrname, fieldgroup, typeID, classID, order, tsize);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about data type.\n");
+      H5Epush(__FILE__, "HE5_SWidtype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      free(tsize);
+      free(classID);
+      free(order);
+      return(FAIL);
+    }
+  
+
+  *Type   = (int)(*typeID);
+  *Class  = (int)(*classID);
+  *Order  = (int)(*order);
+  *size   = (long)(*tsize);
+  
+
+  free(errbuf);
+  free(typeID);
+  free(classID);
+  free(order);
+  free(tsize);
+
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefboxreg     (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Finds swath cross tracks within area of interest and returns  |
+|               region ID                                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  RegionID       int                 Region ID                               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  cornerlon      double   dec deg    Longitude of opposite corners of box    |
+|  cornerlat      double   dec deg    Latitude of opposite corners of box     |
+|  mode           int                 Search mode                             |
+|                                     HDFE_MIDPOINT - Use midpoint of Xtrack  |
+|                                     HDFE_ENDPOINT - Use endpoints of Xtrack |
+|                                     HDFE_ANYPOINT - Use all points of Xtrack|
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWdefboxreg(int SwathID, double  cornerlon[], double cornerlat[], int mode)
+{
+  int             RegionID = FAIL;/* Region ID (return)                     */
+
+  hid_t           swathID  = FAIL;/* HDF5 type swath ID                     */
+  hid_t           regionID = FAIL;/* HDF5 type region ID                    */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error buffer string        */
+
+  swathID = (hid_t)SwathID;
+
+  regionID = HE5_SWdefboxregion(swathID, cornerlon, cornerlat, mode);
+  if (regionID == FAIL)
+    {
+      sprintf(errbuf,"Cannot define box region.\n");
+      H5Epush(__FILE__, "HE5_SWdefboxreg", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  RegionID = (int)regionID;
+  return(RegionID);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefvrtreg                                                  |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper arount HE5_SWdefvrtregion                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  RegionID       int                 Region ID                               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  RegionID       int                 Region ID                               |
+|  vertObj        char                Vertical object to subset               |
+|  range          double              Vertical subsetting range               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Nov 99   Abe Taaheri   Modified for HDF5                                   |
+|  Aug 00   A.Muslimov    Updated to reflect data type changes.               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWdefvrtreg(int SwathID, int RegionID, char *vertObj, double fortrange[])
+{
+  hid_t     swathID   =  FAIL;      /* HDF5 type swath ID     */
+  hid_t     regionID  =  FAIL;      /* HDF5 type region ID    */
+
+  double	range[2]  = {0.,0.};    /* range (C) array        */
+
+  char 	    utlbuf[16];                 /* Utility buffer         */
+  char      errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+  
+  /* Copy first four character of vertObj to utlbuf */
+  /* ---------------------------------------------- */
+  memcpy(utlbuf, vertObj, 4);
+  utlbuf[4] = 0;
+  
+  /* If subsetting on dimension elements convert FORTRAN indices to C */
+  /* ---------------------------------------------------------------- */
+  if (strcmp(utlbuf, "DIM:") == 0)
+    {
+      range[0] = fortrange[0] - 1;
+      range[1] = fortrange[1] - 1;
+    }
+  else
+    {
+      range[0] = fortrange[0];
+      range[1] = fortrange[1];
+    }
+  
+  swathID  = (hid_t)SwathID;
+  regionID = (hid_t)RegionID;
+
+  /* Call HE5_SWdefvrtregion */
+  /* ------------------- */
+  regionID = HE5_SWdefvrtregion(swathID, regionID, vertObj, range);
+  if (regionID == FAIL)
+    {
+      sprintf(errbuf,"Cannot define vertical region.\n");
+      H5Epush(__FILE__, "HE5_SWdefvrtreg", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }  
+
+  
+  RegionID = (int)regionID;
+  return(RegionID);
+}
+      
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWreginfo                                                    |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper around SWregioninfo                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  RegionID       int                 Region ID                               |
+|  fieldname      char                Fieldname                               |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  nunmbertype    int                 field number type                       |
+|  rank           int                 field rank                              |
+|  dims           long                dimensions of field region              |
+|                                     (FORTRAN order)                         |
+|  size           long                size in bytes of field region           |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Nov 99   Abe Taaheri   Modified for HDF5                                   |
+|  Aug 00   A.Muslimov    Updated to reflect data type changes.               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWreginfo(int SwathID, int RegionID, char *fieldname, int *numbertype, int *rank, long dims[], long *size)
+{
+  int          ret      = FAIL;/* (int) Return status variable   */
+  int		   j        = 0;   /* Loop index                     */
+
+  hid_t        swathID  = FAIL;/* HDF5 type swath ID             */
+  hid_t        regionID = FAIL;/* HDF5 type region ID            */
+
+  herr_t	   status   = FAIL;/* routine return status variable */
+  
+  hid_t       *ntype = (hid_t *)NULL;/* number types  */
+  size_t	  *tsize = (size_t *)NULL;
+  
+  hsize_t     swap   = 0;             /* Temporary swap variable */
+  hsize_t     tempdims[HE5_DTSETRANKMAX];
+  
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error buffer string */
+
+  swathID  = (hid_t)SwathID;
+  regionID = (hid_t)RegionID;
+
+  tsize = (size_t *)calloc(1, sizeof(size_t));
+  if (tsize == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tsize.\n");
+      H5Epush(__FILE__, "HE5_SWreginfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+  if (ntype == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for ntype.\n");
+      H5Epush(__FILE__, "HE5_SWreginfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(tsize);
+      return(FAIL);
+    } 
+  
+  /* Initialize tempdims[] array */
+  /* --------------------------- */
+  for (j = 0; j < HE5_DTSETRANKMAX; j++)
+    tempdims[ j ] = 0;
+
+  /* Call SWregioninfo */
+  /* ----------------- */
+  status = HE5_SWregioninfo(swathID, regionID, fieldname, ntype, rank, tempdims, tsize);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about region.\n");
+      H5Epush(__FILE__, "HE5_SWreginfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(tsize);
+      free(ntype);
+      return(FAIL);
+    }  
+  
+  /* Change dimensions to FORTRAN order */
+  /* ---------------------------------- */
+  for (j = 0; j < *rank / 2; j++)
+    {
+      swap = tempdims[*rank - 1 - j];
+      tempdims[*rank - 1 - j] = tempdims[j];
+      tempdims[j] = swap;
+    }
+
+  /* cast dimension sizes */
+  /* -------------------- */
+  for (j = 0; j < *rank; j++)
+    dims[j] = (long)tempdims[j];
+  
+
+  *size       = (long)(*tsize);
+  *numbertype = (int)(*ntype);
+
+  free(tsize);
+  free(ntype);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWextreg    (FORTRAN wrapper)                                |
+|                                                                             |
+|  DESCRIPTION: Retrieves data from specified region.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  RegionID       int                 Region ID                               |
+|  fieldname      char                Fieldname                               |
+|  externalflag   int                 External geolocation fields flag        |
+|                                     HDFE_INTERNAL (0)                       |
+|                                     HDFE_EXTERNAL (1)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  buffer         void                Data buffer containing subsetted region |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov    Updated to reflect data type changes.               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_SWextreg(int SwathID, int RegionID, char *fieldname, int externalflag, void *buffer)
+{
+  int          ret      = FAIL;  /* routine return status variable */
+
+  hid_t        swathID  = FAIL;  /* HDF5 type swath ID             */
+  hid_t        regionID = FAIL;  /* HDF5 type region ID            */
+
+  herr_t	   status   = FAIL;  /* routine return status variable */
+
+  char         errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */
+
+  swathID  = (hid_t)SwathID;
+  regionID = (hid_t)RegionID;
+
+  status = HE5_SWextractregion(swathID, regionID, fieldname, externalflag, buffer);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot extract region data.\n");
+      H5Epush(__FILE__, "HE5_SWextreg", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }  
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdeftmeper    (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION: Finds swath cross tracks observed during time period and      |
+|               returns  period ID                                            |
+|                                                                             |
+|                                                                             |
+|  DESCRIPTION:                                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  PeriodID       int                 Period ID                               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  starttime      double  TAI sec     Start of time period                    |
+|  stoptime       doubel  TAI sec     Stop of time period                     |
+|  mode           int                 Search mode                             |
+|                                     HDFE_MIDPOINT - Use midpoint of Xtrack  |
+|                                     HDFE_ENDPOINT - Use endpoints of Xtrack |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov    Updated to reflect data type changes.               |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWdeftmeper(int SwathID, double starttime, double stoptime, int mode)
+{
+  int             PeriodID = FAIL;            /* Period ID (return)   */
+
+  hid_t           periodID = FAIL;            /* HDF5 type Period ID  */
+  hid_t           swathID  = FAIL;            /* HDF5 type swath ID   */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+
+  swathID = (hid_t)SwathID;
+
+  periodID = HE5_SWdeftimeperiod(swathID, starttime, stoptime, mode);
+  if (periodID == FAIL)
+    {
+      sprintf(errbuf,"Cannot define time period.\n");
+      H5Epush(__FILE__, "HE5_SWdeftmeper", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }   
+    
+  PeriodID = (int)periodID;
+  return(PeriodID);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWperinfo                                                    |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper around SWperiodinfo                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  PeriodID       int                 Period ID                               |
+|  fieldname      char                Fieldname                               |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  nunmbertype    int                 field number type                       |
+|  rank           int                 field rank                              |
+|  dims           long                dimensions of field region              |
+|                                     (FORTRAN order)                         |
+|  size           long                size in bytes of field region           |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Nov 99   Abe Taaheri   Modified for HDF5                                   |
+|  Aug 00   A.Muslimov    Updated to reflect data type changes.               |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWperinfo(int SwathID, int PeriodID, char *fieldname, int *numbertype,int *rank, long dims[], long *size)
+{
+  int		       ret      = SUCCEED;/* routine return status variable  */
+  int		       j = 0;             /* Loop index                      */
+
+  hid_t            swathID  = FAIL;   /* HDF5 type swath ID              */
+  hid_t            periodID = FAIL;   /* HDF5 type period ID             */
+
+  hid_t                *ntype   = (hid_t *)NULL;/* number types          */
+
+  herr_t	       status   = SUCCEED;/* routine return status variable  */
+  
+  size_t	       *tsize   = (size_t *)NULL;
+  
+  hsize_t          swap     = 0;            /* Temporary swap variable    */
+  hsize_t          tempdims[HE5_DTSETRANKMAX];
+  
+  char             errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+
+  HE5_timeflag = 1;
+
+  swathID  = (hid_t)SwathID;
+  periodID = (hid_t)PeriodID;
+
+  tsize = (size_t *)calloc(1, sizeof(size_t));
+  if (tsize == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tsize.\n");
+      H5Epush(__FILE__, "HE5_SWperinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+  if (ntype == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for ntype.\n");
+      H5Epush(__FILE__, "HE5_SWperinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(tsize);
+      return(FAIL);
+    } 
+
+  /* Initialize tempdims[] array */
+  /* --------------------------- */
+  for (j = 0; j < HE5_DTSETRANKMAX; j++)
+    tempdims[ j ] = 0;
+
+  /* Call SWregioninfo */
+  /* ----------------- */
+  status = HE5_SWregioninfo(swathID, periodID, fieldname, ntype, rank, tempdims, tsize);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about region.\n");
+      H5Epush(__FILE__, "HE5_SWperinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(tsize);
+      free(ntype);
+      return(FAIL);
+    }  
+  
+  /* Change dimensions to FORTRAN order */
+  /* ---------------------------------- */
+  for (j = 0; j < *rank / 2; j++)
+    {
+      swap = tempdims[*rank - 1 - j];
+      tempdims[*rank - 1 - j] = tempdims[j];
+      tempdims[j] = swap;
+    }
+
+  for (j = 0; j < *rank; j++)
+    dims[j] = (long)tempdims[j];
+ 
+ 
+  *size       = (long)(*tsize);
+  *numbertype = (int)(*ntype);
+
+  free(tsize);
+  free(ntype);
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdupreg     (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Duplicates a region                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  NewregionID    int                 New region ID                           |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  OldregionID    int                 Old region ID                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======   ============  =================================================  |
+|  Aug  00   A.Muslimov                                                       |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_SWdupreg(int OldregionID)
+{
+  int     NewregionID = FAIL;/* New region ID (return) */
+
+  hid_t   newregionID = FAIL;/* New region ID          */
+  hid_t   oldregionID = FAIL;/* Old region ID          */
+
+
+  oldregionID = (hid_t)OldregionID;
+
+  newregionID = HE5_SWdupregion(oldregionID);
+  if(newregionID == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_SWdupreg", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot duplicate region.");
+      HE5_EHprint("Error: Cannot duplicate region, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  NewregionID = (int)newregionID;
+  return(NewregionID);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWupscene     (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Updates the StartRegion and StopRegion values                 |
+|               for a specified region. This function is for Landsat.         |
+|               The start and stop values must be set to the beginning        |
+|               and the end of a scene, fixed scene subsetting.               |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  RegionID       int                 Region ID                               |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_SWupscene(int SwathID, int RegionID)
+{
+  int             ret      = FAIL;/* routine return status variable  */
+
+  herr_t          status   = FAIL;/* routine return status variable  */
+
+  hid_t           swathID  = FAIL;/* HDF5 type swath ID              */
+  hid_t           regionID = FAIL;/* HDF5 type region ID             */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+
+
+  swathID  = (hid_t)SwathID;
+  regionID = (hid_t)RegionID;
+  
+  status = HE5_SWupdatescene(swathID, regionID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot update scene.\n");
+      H5Epush(__FILE__, "HE5_SWupscene", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWregidx                                                     |
+|                                                                             |
+|  DESCRIPTION: Finds swath cross tracks within area of interest and returns  |
+|               region index and region ID (FORTRAN Wrapper)                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  RegionID       int                 Region ID                               |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  cornerlon      double  dec deg     Longitude of opposite corners of box    |
+|  cornerlat      double  dec deg     Latitude of opposite corners of box     |
+|  mode           int                 Search mode                             |
+|                                     HDFE_MIDPOINT - Use midpoint of Xtrack  |
+|                                     HDFE_ENDPOINT - Use endpoints of Xtrack |
+|                                     HDFE_ANYPOINT - Use all points of Xtrack|
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  geodim         char                geolocation track dimension             |
+|  idxrange       long                indices of region for along track dim.  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 00   D.Wynne       Original Programmer                                 |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWregidx(int SwathID, double cornerlon[], double cornerlat[], int mode, char *geodim, long idxrange[])
+{
+  int		i          = 0;              /* Loop index           */
+  int		RegionID   = SUCCEED;        /* Region ID            */
+
+  hid_t     swathID    = FAIL;           /* HDF5 type swath ID   */
+  hid_t     regionID   = FAIL;           /* HDF5 type region ID  */
+
+  hsize_t	range[2]   = {0, 0};         /* Index range array    */
+  
+  char      errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */
+
+  swathID = (hid_t)SwathID;
+
+  regionID = HE5_SWregionindex(swathID, cornerlon, cornerlat, mode, geodim, range);
+  if (regionID == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the region indices.\n");
+      H5Epush(__FILE__, "HE5_SWregidx", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  
+  for(i = 0; i < 2; i++)
+    idxrange[i] = HE5_EHhsize2long(range[i]);
+
+  
+  RegionID = (int)regionID;
+  return(RegionID);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWextper   (FORTRAN wrapper)                                 |
+|                                                                             |
+|  DESCRIPTION: Retrieves data from specified period.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  PeriodID       int                 Period ID                               |
+|  fieldname      char                Fieldname                               |
+|  externalflag   int                 External geolocation fields flag:       |
+|                                                                             |
+|                                     HDFE_INTERNAL (0)                       |
+|                                     HDFE_EXTERNAL (1)                       |
+|  OUTPUTS:                                                                   |
+|  buffer         void                Data buffer containing subsetted region |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Aug 00  A.Muslimov                                                         |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_SWextper(int SwathID, int PeriodID, char *fieldname, int externalflag, void *buffer)
+{
+  int             ret      = FAIL;        /* return status variable  */
+
+  herr_t          status   = FAIL;        /* return status variable  */
+
+  hid_t           swathID  = FAIL;        /* HDF5 type swath ID      */
+  hid_t           periodID = FAIL;        /* HDF5 type period ID     */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+
+
+  HE5_timeflag = 1;
+  swathID  = (hid_t)SwathID;
+  periodID = (hid_t)PeriodID;
+
+  /* Call SWextractregion routine */
+  /* ---------------------------- */
+  status = HE5_SWextractregion(swathID, periodID, fieldname, externalflag, (char *)buffer);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot extract the period.\n");
+      H5Epush(__FILE__, "HE5_SWextper", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWupimap     (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Updates the map index for a specified region.                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nout           long                return Number of elements in output     |
+|                                     index array if SUCCEED, (-1) FAIL       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  RegionID       int                 Region ID                               |
+|  indexin        long                array of index values                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  indexout       long                array of index values                   |
+|  indicies       long                array of start and stop in region       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWupimap(int SwathID, int RegionID, long indexin[], long indexout[], long indicies[])
+{
+  long        nout     = FAIL;/* # of elements in output array (return)  */
+
+  hid_t       regionID = FAIL;/* HDF5 type region  ID                    */
+  hid_t       swathID  = FAIL;/* HDF5 type swath ID                      */
+
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error buffer                    */
+
+  swathID  = (hid_t)SwathID;
+  regionID = (hid_t)RegionID;
+
+  nout = HE5_SWupdateidxmap(swathID, regionID, indexin, indexout, indicies);
+  if (nout == FAIL)
+    {
+      sprintf(errbuf, "Failed to update index mapping.\n");
+      H5Epush(__FILE__, "HE5_SWupimap", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf );
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  return(nout);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqswathF   (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Returns number and names of swath structures in file          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nSwath         long                Number of swath structures in file      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  filename       char                HDF-EOS filename                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  swathlist      char                List of swath names (comma-separated)   |
+|  strbufsize     long                Length of swathlist                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  July 00  A.Muslimov    Unmasked hdf5 data types.                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqswathF(char *filename, char *swathlist, long *strbufsize)
+{
+  long       nSwath     = FAIL;/* Number of swath structures in file */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */  
+
+  nSwath = HE5_SWinqswath(filename, swathlist, strbufsize);
+  if ( nSwath < 0 )
+    {
+      sprintf(errbuf,"Cannot get information about Swath.");
+      H5Epush(__FILE__, "HE5_SWinqswathF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }								 
+
+  return(nSwath);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWnentriesF    (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION: Returns number of entries and string buffer size              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nEntries       long                Number of entries                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  entrycode      int                 Entry code                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                Length of comma-separated list          |
+|                                     (Does not include null-terminator       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 00   A.Muslimov                                                        |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWnentriesF(int SwathID, int entrycode, long *strbufsize)
+{
+  long            nEntries   = FAIL;       /* Number of entries         */
+
+  hid_t           swathID    = FAIL;       /* HDF5 type swath ID        */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  
+
+  swathID = (hid_t)SwathID;
+
+  nEntries = HE5_SWnentries(swathID, entrycode, strbufsize);
+  if (nEntries < 0)
+    {
+      sprintf(errbuf,"Failed to get number of entries in a swath.");       
+      H5Epush(__FILE__, "HE5_SWnentriesF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return(nEntries);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:     HE5_PRdefineF     (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION:  Defines "Profile" dataset within a specified Swath, under the|
+|                 "Data Fields" group.                                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status (0) SUCCEED (-1)     |
+|                                          FAIL                               |
+|  INPUTS:                                                                    |
+|  SwathID        int                      Swath ID                           |
+|  profilename    char                     Profile/dataset name               |
+|  fortdimlist    char                     Dim. list (comma-separated list)   |
+|                                          FORTRAN dimesion order             |
+|  fortmaxdimlist char                     Max Dim. list (FORTRAN order)      |
+|                                          profile/dataset                    |
+|  ntype          int                      Base datatype ID                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    None                                                                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Aug 00   A.Muslimov    Original development.                               |
+|  Dec 00   A.Muslimov    Updated to add "fortdimlist" and "fortmaxdimlist"   |
+|                          inputs.                                            |
+|  May 01   C.Praderas    Continued development.                              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int  
+HE5_PRdefineF(int SwathID, char *profilename, char *fortdimlist, char *fortmaxdimlist, int ntype)
+{ 
+  int         ret         = FAIL;/* return status variable      */
+
+  herr_t      status      = FAIL;/* return status variable      */
+
+  hid_t       swathID     = FAIL;/* HDF5 type swath ID          */
+  hid_t       dtypeID     = FAIL;/* HDF5 type data type ID      */
+
+  char	      *dimlist    = (char *)NULL; /* Dimension list (C order)  */
+  char	      *maxdimlist = (char *)NULL; /* Max. dimension list (C)   */
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer      */
+
+  swathID = (hid_t)SwathID;
+  dtypeID = HE5_EHconvdatatype(ntype);   
+  if(dtypeID == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_PRdefineF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Cannot convert datatype for FORTRAN wrapper.");
+      HE5_EHprint("Error: Cannot convert datatype for FORTRAN wrapper, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  if(strcmp(fortmaxdimlist,"") == 0)
+    fortmaxdimlist = NULL;
+
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  dimlist = (char *)calloc(strlen(fortdimlist) + 1, sizeof(char));
+  if(dimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for dimlist.\n");
+      H5Epush(__FILE__, "HE5_PRdefineF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Reverse entries in dimension list (FORTRAN -> C) */
+  /* ------------------------------------------------ */
+  status = HE5_EHrevflds(fortdimlist, dimlist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in dimension list.\n");
+      H5Epush(__FILE__, "HE5_PRdefineF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(dimlist);
+      return(FAIL);
+    }
+
+  if (fortmaxdimlist != NULL)
+    {
+      /* Allocate space for C order max. dim. list */
+      /* ----------------------------------------- */
+      maxdimlist = (char *)calloc(strlen(fortmaxdimlist) + 1, sizeof(char));
+      if(maxdimlist == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for maxdimlist.\n");
+	  H5Epush(__FILE__, "HE5_PRdefineF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(dimlist);
+	  return(FAIL);
+	}
+
+
+      /* Reverse entries in dimension list (FORTRAN -> C) */
+      /* ------------------------------------------------ */
+      status = HE5_EHrevflds(fortmaxdimlist, maxdimlist);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot reverse entries in maximum dimension list.\n");
+	  H5Epush(__FILE__, "HE5_PRdefineF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(dimlist);
+	  free(maxdimlist);
+	  return(FAIL);
+	}
+    }
+  else
+    {
+      maxdimlist = NULL;
+    }
+	  
+  /* Define specified profile */
+  /* ------------------------ */
+  status = HE5_PRdefine(swathID, profilename, dimlist, maxdimlist, dtypeID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot define \"%s\" profile.\n", profilename);
+      H5Epush(__FILE__, "HE5_PRdefineF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(dimlist);
+      if (maxdimlist!=NULL) 
+	free(maxdimlist);
+
+      return(FAIL); 
+    }
+
+  free(dimlist);
+  if (maxdimlist != NULL) 
+    free(maxdimlist);
+  
+  ret = (int)status;
+  return (ret);    
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:    HE5_PRwriteF    (FORTRAN  wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Writes data into the "Profile" dataset within a Swath.        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status (0) SUCCEED (-1)     |
+|                                          FAIL                               |
+|  INPUTS:                                                                    |
+|    Swath_ID     int                      Swath ID                           |
+|    profilename  char                     Name of Profile dataset            |
+|    fortstart    long                     start array                        |
+|    fortstride   long                     stride array                       |
+|    fortedge     long                     edge array                         |
+|                                                                             |
+|    buffer       void                     Data buffer                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    None                                                                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Aug 00   A.Muslimov    Original development                                |
+|  Dec 00   A.Muslimov    Updated to add "start", "stride", and "edge"        |
+|                           parameters.                                       |
+|  May 01   C.Praderas    Continued development.                              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_PRwriteF(int SwathID, char *profilename, long fortstart[], long fortstride[], long fortedge[], long size,  long len[], void *buffer)
+{  
+  int         ret     = FAIL;             /* return status variable        */
+  int		  rank    = 0;                /* Profile rank                  */
+  int         i;                          /* Loop index                    */
+  int         nelmnts = 0;                /* Number of elements in Profile */
+                                          /*  field                        */
+  long        begin_offset = 0;           /* Used in storing  to VL buffer */
+  long        end_offset   = 0;           /*           "  "                */
+  long        length       = 0;           /*           "  "                */
+  long        idx          = FAIL;        /* Swath index                   */
+
+  herr_t      status  = FAIL;             /* return status variable        */
+  
+  hid_t       groupID  = FAIL;            /* "Profile Fields" group ID     */
+  hid_t       gid      = FAIL;            /* "SWATHS" group ID             */
+  hid_t       fid      = FAIL;            /* HDF-EOS file ID               */   
+  hid_t       profID   = FAIL;            /* Profile dataset ID            */
+  hid_t       typeID   = FAIL;            /* Dataset type ID               */
+  hid_t       btypeID  = FAIL;            /* Base data type ID             */
+  hid_t       swathID  = FAIL;            /* HDF5 type swath ID            */
+
+  hssize_t    *start  = (hssize_t *)NULL; /* Ptr to start array (C order)  */
+  hsize_t     dims[HE5_DTSETRANKMAX];     /* Profile dimensions            */
+  hsize_t     maxdims[HE5_DTSETRANKMAX];  /* Profile maximum dimensions    */
+  hsize_t     *stride = (hsize_t *)NULL;  /* Ptr to stride array (C order) */
+  hsize_t     *edge   = (hsize_t *)NULL;  /* Ptr to edge array (C order)   */
+
+  size_t      dsize      = 0;             /* Data size variable            */
+  size_t      btype_size = 0;             /* Size of base datatype         */
+
+  char        *buffer_char=NULL;
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer          */
+
+  hvl_t       *profile_buffer;            /*Data buffer for the profile    */
+
+  
+  dsize   = (size_t)size;  
+  swathID = (hid_t)SwathID;
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_PRinfo", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get "Profile Fields" group ID */
+  /* ----------------------------- */
+  groupID = HE5_SWXSwath[idx].prof_id;
+  
+  /* Open specified profile dataset */
+  /* ------------------------------ */
+  profID     = H5Dopen(groupID, profilename);
+  if (profID == FAIL)
+    {
+      sprintf(errbuf,"Cannot open \"%s\" profile.\n", profilename);
+      H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+  
+  /* Get data type ID */
+  /* ---------------- */
+  typeID     = H5Dget_type(profID);
+  if (typeID == FAIL)
+    {
+      sprintf(errbuf,"Cannot get data type ID.\n");
+      H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+
+	  
+  /* Get base data type ID */
+  /* --------------------- */
+  btypeID    = H5Tget_super(typeID);  
+  if (btypeID == FAIL)
+    {
+      sprintf(errbuf,"Cannot get base data type ID.\n");
+      H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+	  
+  /* Get size of base data type */
+  /* -------------------------- */
+  btype_size   = H5Tget_size(btypeID);
+  if (btype_size == FAIL)
+    {
+      sprintf(errbuf,"Cannot get size of base data type.\n");
+      H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+
+  /* Release data type ID */
+  /* -------------------- */
+  status     = H5Tclose(typeID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release data type ID.\n");
+      H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+	  
+  /* Release dataset ID */
+  /* ------------------ */
+  status = H5Dclose(profID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release dataset ID.\n");
+      H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Initialize dims[]/maxdims[] arrays */
+  /* ---------------------------------- */
+  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      dims[ i ]    = 0;
+      maxdims[ i ] = 0;
+    }
+  
+  /* Get profile rank  */
+  /* ----------------- */
+  status = HE5_PRinfo(swathID, profilename, &rank, dims, maxdims, NULL, NULL, NULL);
+  if (status != FAIL)
+    {
+      start = (hssize_t *)calloc(rank, sizeof(hssize_t));
+      if(start == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for start.\n");
+	  H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+        }
+	  
+      stride = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(stride == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for stride.\n");
+	  H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  return(FAIL);
+        }
+
+      edge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(edge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  return(FAIL);
+        }
+ 
+      /* Reverse order of dimensions (FORTRAN -> C) */
+      /* ------------------------------------------ */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i]  = (hssize_t)fortstart[rank - 1 - i];
+	  stride[i] = (hsize_t)fortstride[rank - 1 - i];
+	  edge[i]   = (hsize_t)fortedge[rank - 1 - i];
+        }
+	  
+      /* Determine number of elements in Profile Field */
+      /* --------------------------------------------- */
+      nelmnts = 0;
+      for (i = 0; i < rank; i++)  
+	{
+	  nelmnts = (int)fortedge[i] + nelmnts;      
+	}
+
+      buffer_char  = (char *)calloc(size*btype_size,1);
+      if(buffer_char == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for buffer_char.\n");
+	  H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  return(FAIL);
+        }
+	  
+      memmove(buffer_char, buffer, size*btype_size); 
+	  
+      profile_buffer = (hvl_t *)calloc(nelmnts, sizeof(hvl_t));
+      if(profile_buffer == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for profile_buffer.\n");
+	  H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(buffer_char);
+	  return(FAIL);
+        }
+	  
+      begin_offset = 0;
+      end_offset   = -1;
+      for (i = 0; i < nelmnts; i++)
+	{
+	  profile_buffer[i].p = malloc(len[i]*((long)btype_size));
+		  
+	  begin_offset        = end_offset + 1;
+	  end_offset          = begin_offset + len[i]*((long)btype_size) - 1;
+	  length              = end_offset - begin_offset + 1;
+		  
+	  memmove(profile_buffer[i].p, &buffer_char[begin_offset], length); 
+		  
+	  profile_buffer[i].len  = (size_t)len[i]; 
+		  
+	}
+	  
+      free(buffer_char);
+	  
+	  
+      /* Write data buffer to the profile dataset  */
+      /* ----------------------------------------- */
+      status = HE5_PRwrite(swathID, profilename, start, stride, edge, dsize, profile_buffer);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot write data to \"%s\" profile. \n", profilename);
+	  H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(profile_buffer);	
+	  return(FAIL);
+	}
+	  
+      free(start);
+      free(stride);
+      free(edge);
+      free(profile_buffer);	
+    }
+  else
+    {
+      sprintf(errbuf, "Error calling HE5_PRinfo() from FORTRAN wrapper. \n") ;
+      H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+    }
+
+
+  ret = (int)status;
+  return(ret);    
+}
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:  HE5_PRreadF (FORTRAN wrapper)                                   |
+|                                                                             |
+|  DESCRIPTION:  Reads data from the profile dataset.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status (0) SUCCEED (-1)     |
+|                                          FAIL                               |
+|  INPUTS:                                                                    |
+|   SwathID       int                      Swath ID                           |
+|   profilename   char                     Name of profile/dataset            |
+|   fortstart     long                     start array                        |
+|   fortstride    long                     stride array                       |
+|   fortedge      long                     edge array                         |
+|   len           long                     lengths of each element in the     |
+|                                           profile field                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|   buffer_output void                      Data buffer                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Aug 00   A.Muslimov    Original development                                |
+|  Dec 00   A.Muslimov    Updated to add "start", "stride", and "edge"        |
+|                           parameters.                                       |
+|  May 01   C.Praderas    Continued development.                              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int     
+HE5_PRreadF(int SwathID, char *profilename, long fortstart[], long fortstride[], long fortedge[],long len[], void *buffer_output)
+{
+  int         ret         = FAIL;            /* Status variable       */
+  int         rank        = FAIL;            /* Rank of dataset       */
+  int         i;                             /* Loop index            */        
+
+  long        num_prof_elmnts  = 0;       /* number of elements in profile */
+  long        profile_datasize = 0;       /* Size (in bytes) of Prof Field */
+  long        begin_offset     = 0;       /* Used in storing  to VL buffer */
+  long        end_offset       = 0;       /*           "  "                */
+  long        length           = 0;       /*           "  "                */
+
+  long        idx              = FAIL;    /* Swath index                   */
+
+  herr_t      status   = FAIL;            /* Status variable               */
+
+  hid_t       swathID  = FAIL;            /* HDF5-type swath ID            */
+  hid_t       groupID  = FAIL;            /* "Profile Fields" group ID     */
+  hid_t       gid      = FAIL;            /* "SWATHS" group ID             */
+  hid_t       fid      = FAIL;            /* HDF-EOS file ID               */   
+  hid_t       profID   = FAIL;            /* Profile dataset ID            */
+  hid_t       typeID   = FAIL;            /* Dataset type ID               */
+  hid_t       btypeID  = FAIL;            /* Base data type ID             */
+
+  hssize_t	  *start      = (hssize_t *)NULL;/* Start array (C order)      */
+  hsize_t	  *stride     = (hsize_t *)NULL; /* Stride array (C order)     */
+  hsize_t	  *edge       = (hsize_t *)NULL; /* Edge array (C order)       */
+  hsize_t     dims[HE5_DTSETRANKMAX];        /* Profile dimensions         */
+  hsize_t     maxdims[HE5_DTSETRANKMAX];     /* Profile max.dims           */ 
+
+  size_t      btype_size  = 0;               /* Size of base datatype      */
+  size_t      vltype_size = 0;               /* Size of variable length    */
+
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];   /* Error message buffer       */
+  char        *buffer_char=NULL;
+
+  hvl_t       *buffer;        /*  Buffer to read outt data from profile  */
+  
+  swathID = (hid_t)SwathID;
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_SWchkswid(swathID, "HE5_PRinfo", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for swath ID failed. \n");
+      H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Get "Profile Fields" group ID */
+  /* ----------------------------- */
+  groupID = HE5_SWXSwath[idx].prof_id;
+  
+  /* Open specified profile dataset */
+  /* ------------------------------ */
+  profID     = H5Dopen(groupID, profilename);
+  if (profID == FAIL)
+    {
+      sprintf(errbuf,"Cannot open \"%s\" profile.\n", profilename);
+      H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+
+  /* Get data type ID */
+  /* ---------------- */
+  typeID     = H5Dget_type(profID);
+  if (typeID == FAIL)
+    {
+      sprintf(errbuf,"Cannot get data type ID.\n");
+      H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+  
+  /* Get size of variable length data type (Profile field) */
+  /* ----------------------------------------------------- */
+  vltype_size   = H5Tget_size(typeID);
+  if (vltype_size == FAIL)
+    {
+      sprintf(errbuf,"Cannot get size of variable length data type.\n");
+      H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+	  
+  /* Get base data type ID */
+  /* --------------------- */
+  btypeID    = H5Tget_super(typeID);  
+  if (btypeID == FAIL)
+    {
+      sprintf(errbuf,"Cannot get base data type ID.\n");
+      H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+  
+  /* Get size of base data type */
+  /* -------------------------- */
+  btype_size   = H5Tget_size(btypeID);
+  if (btype_size == FAIL)
+    {
+      sprintf(errbuf,"Cannot get size of base data type.\n");
+      H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    } 
+
+  /* Release data type ID */
+  /* -------------------- */
+  status     = H5Tclose(typeID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release data type ID.\n");
+      H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+	  
+  /* Release dataset ID */
+  /* ------------------ */
+  status = H5Dclose(profID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot release dataset ID.\n");
+      H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+  /* Initialize dims[]/maxdims[] arrays */
+  /* ---------------------------------- */
+  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      dims[ i ]    = 0;
+      maxdims[ i ] = 0;
+    }
+  
+
+  /* Get profile rank  */
+  /* ----------------- */
+  status = HE5_PRinfo(swathID, profilename, &rank, dims, maxdims, NULL, NULL, NULL);
+  if (status != FAIL)
+    {
+      start = (hssize_t *)calloc(rank, sizeof(hssize_t));
+      if(start == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for start.\n");
+	  H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+        }
+	  
+      stride = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(stride == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for stride.\n");
+	  H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  return(FAIL);
+        }
+
+      edge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(edge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  return(FAIL);
+        }
+ 
+      /* Reverse order of dimensions (FORTRAN -> C) */
+      /* ------------------------------------------ */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i]  = (hssize_t)fortstart[rank - 1 - i];
+	  stride[i] = (hsize_t)fortstride[rank - 1 - i];
+	  edge[i]   = (hsize_t)fortedge[rank - 1 - i];
+        }
+
+      /* Allocate space for buffer */
+      /* ------------------------- */
+      buffer = (hvl_t *) calloc(fortedge[0],sizeof(hvl_t));
+      if ( buffer == NULL )
+	{
+	  H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for read buffer.\n");
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Read the data from profile dataset  */
+      /* ----------------------------------- */
+      status = HE5_PRread(swathID, profilename, start, stride, edge, buffer);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot read data from \"%s\" profile. \n", profilename);
+	  H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(buffer);
+	  return(FAIL);
+	}
+	  
+      free(start);
+      free(stride);
+      free(edge);
+	  
+    }
+  else
+    {
+      sprintf(errbuf, "Error calling HE5_PRinfo() from FORTRAN wrapper. \n") ;
+      H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+    }
+  
+
+  /* Calculate the number of elements in the profile field */
+  /* ----------------------------------------------------- */
+  for( i=0; i<rank; i++ )
+    {
+      num_prof_elmnts = num_prof_elmnts + (long)dims[i];
+    }
+  
+  profile_datasize = 0;
+  for( i = 0; i < num_prof_elmnts; i++ )
+    {
+      profile_datasize = profile_datasize + ((long) buffer[i].len)*((long)btype_size);  
+      len[i] = (long) buffer[i].len;  
+    }
+  
+  /* Allocate space */
+  /* -------------- */
+  buffer_char = (char *) calloc(profile_datasize,sizeof(unsigned char)); 
+  if(buffer_char == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for buffer_char.\n");
+      H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(buffer);
+      return(FAIL);
+    }
+  
+  begin_offset = 0;
+  end_offset   = -1;
+  
+  for( i = 0; i < num_prof_elmnts; i++ )
+    {
+      begin_offset        = end_offset + 1;
+      end_offset          = begin_offset + len[i]*((long)btype_size) - 1;
+      length              = end_offset - begin_offset + 1;
+	  
+      memmove(&buffer_char[begin_offset],buffer[i].p,length);
+    }
+  
+  memmove(buffer_output,buffer_char,profile_datasize);
+  
+  status = HE5_PRreclaimspace(swathID, profilename, buffer);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot reclaim the memory space. \n");
+      H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(buffer);
+      free(buffer_char);
+      return(FAIL);
+    }
+
+  /* Release memory */
+  /* -------------- */
+  free(buffer);    
+  free(buffer_char);
+  
+  ret  = (int)status;
+  return(ret);    
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PRinquireF   (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION:  Retrieves number of profiles in a swath                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  nProf          long                     Return number of profiles          |
+|                                          FAIL                               |
+|  INPUTS:                                                                    |
+|    SwathID      int                      swath ID                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    profnames    char                     List of profile names              |
+|    rank[]       int                      Profile/dataset rank array         |
+|    ntype[]      int                      Array of profile base datatype IDs |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  8/30/00  A. Muslimov   Original development                                |
+|  Sep 00   A. Muslimov   Modified to change "Data Fields" onto "PRofile      |
+|                                Fields"                                      |
+|  May 01   C.Praderas    Continued development.                              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long  
+HE5_PRinquireF(int SwathID, char *profnames, int *rank, int *ntype)
+{
+
+  long         nProf    = FAIL;               /* Number of profiles   */
+
+  int          i;                             /* Loop index           */
+
+  H5T_class_t  *dtype   = (H5T_class_t *)NULL;/* Data type class ID   */   
+
+  hid_t        swathID  = FAIL;               /* Swath group ID       */
+
+  char         errbuf[HE5_HDFE_ERRBUFSIZE];   /* Error message buffer */
+
+
+  swathID = (hid_t)SwathID;
+
+  nProf = HE5_PRinquire(swathID, profnames, NULL, NULL);
+  if (nProf == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_PRinquire() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_PRinquireF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtype = (H5T_class_t *)calloc(nProf, sizeof(H5T_class_t));
+  if (dtype == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for dtype. \n");
+      H5Epush(__FILE__, "HE5_PRinquireF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  nProf = HE5_PRinquire(swathID, profnames, rank, dtype);
+  if (nProf == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_PRinquire() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_PRinquireF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  for ( i = 0; i < nProf; i++)
+    ntype[i] = (int)dtype[i];
+
+  free(dtype);
+  return(nProf);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PRinfoF  (FORTRAN wrapper)                                   |
+|                                                                             |
+|  DESCRIPTION:  Retrieves information about specified profile.               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    SwathID      int                      swath ID                           |
+|    profname     char                     Profile name                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    rank[]       int                      Profile/dataset rank array         |
+|    dims[]       long                     dimension size array               |
+|    maxdims[]    long                     max. dimension size array          |
+|    ntype        int                      Pointer to base datatype ID        |
+|    fortdimlist      char                 Dimension list                     |
+|    fortmaxdimlist   char                 Maximum Dimension List             |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  8/30/00  A. Muslimov   Original development                                |
+|  Sep  00  A. Muslimov   Modified to change the group from "Data Fields" to  |
+|                          "HE5_PRofile Fields".                              |
+|  May 01   C.Praderas    Continued development.                              |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int      
+HE5_PRinfoF(int SwathID, char *profname, int *rank, long dims[], long maxdims[], int *ntype, char *fortdimlist, char *fortmaxdimlist)
+{
+  int           ret      = FAIL;    /* Return status variable       */
+  int           j;                  /* Loop index                   */
+        
+  herr_t        status   = FAIL;    /* Return status variable       */
+
+  hid_t         swathID  = FAIL;    /* Swath group ID               */
+ 
+  hid_t         dtype[1] = {FAIL};  /* Data type ID                 */
+
+  hsize_t	    tempdims[HE5_DTSETRANKMAX];   /* Dimension sizes array    */
+  hsize_t	    tempmaxdims[HE5_DTSETRANKMAX];/* Max.Dim. sizes array     */
+  hsize_t 	    swap     = 0;                 /* Temporary dimension size */
+
+  /* Dimension lists in C order */
+  /* -------------------------- */
+  char		    *dimlist    = (char *)NULL;
+  char		    *maxdimlist = (char *)NULL;
+
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];  /* Error message buffer   */
+
+  swathID = (hid_t)SwathID;
+
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  maxdimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  dimlist    = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(dimlist == NULL || maxdimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input list.\n");
+      H5Epush(__FILE__, "HE5_PRinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Initialize tempdims[]/tempmaxdims[] arrays */
+  /* ------------------------------------------ */
+  for ( j = 0; j < HE5_DTSETRANKMAX; j++)
+    {
+      tempdims[ j ]    = 0;
+      tempmaxdims[ j ] = 0;
+    }
+
+
+  /* Get profile info */
+  /* ---------------- */
+  status = HE5_PRinfo(swathID, profname, rank, tempdims, tempmaxdims, dtype, dimlist, maxdimlist);
+  if (status == SUCCEED)
+    {
+      for (j = 0; j < *rank / 2; j++)
+        {
+	  swap = tempdims[*rank - 1 - j];
+	  tempdims[*rank - 1 - j] = tempdims[j];
+	  tempdims[j] = swap;
+
+	  swap = tempmaxdims[*rank - 1 - j];
+	  tempmaxdims[*rank - 1 - j] = tempmaxdims[j];
+	  tempmaxdims[j] = swap;
+        }
+
+      /* change the datatype */
+      /* ------------------- */
+      for (j = 0; j < *rank; j++)
+	{
+	  dims[j]    = (long)tempdims[j];
+	  maxdims[j] = (long)tempmaxdims[j];
+	}
+	  
+      /* Reverse order of dimensions entries in dimension list */
+      /* ----------------------------------------------------- */
+      if(fortdimlist != (char *)NULL)
+	{
+	  status = HE5_EHrevflds(dimlist, fortdimlist);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot reverse entries in dimension list.\n");
+	      H5Epush(__FILE__, "HE5_PRinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(dimlist);
+	      free(maxdimlist);
+	      return(FAIL);
+	    }
+	}
+      if(fortmaxdimlist != (char *)NULL)
+	{
+	  status = HE5_EHrevflds(maxdimlist, fortmaxdimlist);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot reverse entries in maximum dimension list.\n");
+	      H5Epush(__FILE__, "HE5_PRinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(dimlist);
+	      free(maxdimlist);
+	      return(FAIL);
+	    }
+		  
+	}
+    }
+  
+  *ntype = (int)dtype[0];
+
+  free(maxdimlist);
+  free(dimlist);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PRwrgattrF                                                   |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper to write/update "Profile Fields" group        |
+|               attribute in a swath.                                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  attrname       char*               group attribute name                    |
+|  numtype        int                 group attribute HDF numbertype          |
+|  fortcount[]    long                Number of group attribute elements      |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                   It is assumed that fortcout has just one element to agree |
+|                   with EHattr() call.                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04   S.Zhao        Original development                                |
+|  Mar 04   S.Zhao        Modified for a character string attribute.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_PRwrgattrF(int SwathID, char *attrname, int numtype, long fortcount[], void *datbuf)
+{
+  int              ret    = FAIL;            /* (int) return status variable      */
+  int              rank   = 1;               /* Rank variable                     */
+  int              i;                        /* Loop index                        */
+ 
+  herr_t           status     = FAIL;        /* routine return status variable    */
+ 
+  hid_t            swathID    = FAIL;        /* HDF5 type Swath ID                */
+  hid_t            numbertype = FAIL;        /* HDF5 data type ID                 */
+ 
+  hsize_t          *count  = (hsize_t *)NULL;/* Pointer to count array (C order)  */
+ 
+  char             *errbuf = (char *)NULL;   /* error message buffer              */
+  char             *tempbuf = (char *)NULL;  /* temp buffer                       */
+ 
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PRwrgattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get HDF5 data type ID */
+  /* --------------------- */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID.\n");
+      H5Epush(__FILE__, "HE5_PRwrgattrF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+ 
+  count = (hsize_t *)calloc(rank, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_PRwrgattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+ 
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < rank; i++)
+    count[i] = (hsize_t)fortcount[rank - 1 - i];
+ 
+ 
+  swathID = (hid_t)SwathID;
+ 
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of group attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_PRwrgattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n");
+	  H5Epush(__FILE__, "HE5_PRwrgattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+ 
+      status = HE5_PRwritegrpattr(swathID, attrname, numbertype, count, tempbuf);
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write group attribute value.\n");
+          H5Epush(__FILE__, "HE5_PRwrgattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(errbuf);
+          free(count);
+          free(tempbuf);
+          return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    {
+      status = HE5_PRwritegrpattr(swathID, attrname, numbertype, count, datbuf);
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write group attribute value.\n");
+          H5Epush(__FILE__, "HE5_PRwrgattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(errbuf);
+          free(count);
+          return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+    }
+ 
+  ret = (int)status;
+  return(ret);
+}
+ 
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PRrdgattrF    (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from the "Profile Fields" group in a swath.   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04   S.Zhao        Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_PRrdgattrF(int SwathID, char *attrname, void *datbuf)
+{
+  int         ret             = FAIL;   /* (int) return status      */
+ 
+  herr_t      status          = FAIL;   /* return status variable   */
+ 
+  hid_t       swathID         = FAIL;   /* HDF5 type Swath ID       */
+ 
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];  /* Error message buffer */
+ 
+  swathID = (hid_t)SwathID;
+ 
+  status = HE5_PRreadgrpattr(swathID,attrname,datbuf);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot read attribute \"%s\" from the \"Profile Fields\" group.\n", attrname);
+      H5Epush(__FILE__, "HE5_PRrdgattrF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+  ret = (int)status;
+  return(ret);
+}
+ 
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PRgattrinfoF                                                 |
+|                                                                             |
+|  DESCRIPTION:  FORTRAN wrapper for PRgrpattrinfo                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  numbertype     int                 attribute HDF numbertype                |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04   S.Zhao        Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+|                                                                             |
+-----------------------------------------------------------------------------*/
+int
+HE5_PRgattrinfoF(int SwathID, char *attrname, int *numbertype, long *fortcount)
+{
+  int             ret     = FAIL;           /* (int) return status variable   */
+ 
+  herr_t          status  = FAIL;           /* routine return status variable */
+ 
+  hid_t           *ntype  = (hid_t *)NULL;  /* Data type class ID             */
+ 
+  hid_t           swathID = FAIL;           /* HDF5 type Swath ID             */
+ 
+  hsize_t         *count  = (hsize_t *)NULL;/* Pointer to count  (C order)    */
+ 
+  char            *errbuf = (char *)NULL;   /* error message buffer           */
+ 
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_PRgattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_PRgattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+ 
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+  if( ntype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for ntype.\n");
+      H5Epush(__FILE__, "HE5_PRgattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      return(FAIL);
+    }
+ 
+  swathID = (hid_t)SwathID;
+ 
+  status = HE5_PRgrpattrinfo(swathID, attrname, ntype, count);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about group attribute.\n");
+      H5Epush(__FILE__, "HE5_PRgattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      free(ntype);
+      return(FAIL);
+    }
+ 
+  *fortcount  = (long)(*count);
+  *numbertype = (int)(*ntype);
+ 
+  free(errbuf);
+  free(count);
+  free(ntype);
+ 
+  ret = (int)status;
+  return(ret);
+}
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_PRinqgattrsF (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list in "Profile Fields" group                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in "Profile Fields"|
+|                                     group.                                  |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in "Profile Fields"     |
+|                                     group (Comma-separated list)            |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04   S.Zhao        Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_PRinqgattrsF(int SwathID, char *attrnames, long *strbufsize)
+{
+  long            nattr   = FAIL;         /* Number of attributes (return)  */
+ 
+  hid_t           swathID = FAIL;         /* HDF5 type swath ID             */
+ 
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+ 
+  swathID = (hid_t)SwathID;
+ 
+  nattr = HE5_PRinqgrpattrs(swathID, attrnames, strbufsize);
+  if ( nattr < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+      H5Epush(__FILE__, "HE5_PRinqgattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+  return(nattr);
+}
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWsetaliasF    (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION:  Defines alias for a specified field name                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|   SwathID       int                      swath ID                           |
+|   fieldname     char                     Original field name                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|   fortaliaslist char                     Comma separated list of aliases for|
+|                                            the field name                   |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Oct  00  A. Muslimov   Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_SWsetaliasF(int SwathID, char *fieldname, char *fortaliaslist)
+{
+  int      ret        = FAIL;/* (int)Return status variable */
+
+  herr_t   status     = FAIL;/* return status variable      */
+
+  hid_t    swathID    = FAIL;/* HDF5 type swath ID          */
+
+  char     *aliaslist = NULL;/* C-order list of aliases     */
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  swathID = (hid_t)SwathID;
+
+  /* Allocate space for C order alias list */
+  /* ------------------------------------- */
+  aliaslist = (char *)calloc(strlen(fortaliaslist) + 1, sizeof(char));
+  if(aliaslist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for aliaslist.\n");
+      H5Epush(__FILE__, "HE5_SWsetaliasF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Reverse entries in alias list (FORTRAN -> C) */
+  /* -------------------------------------------- */
+  status = HE5_EHrevflds(fortaliaslist, aliaslist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in alias list.\n");
+      H5Epush(__FILE__, "HE5_SWsetaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(aliaslist);
+      return(FAIL);
+    }
+
+
+
+  /* Call SWsetalias() */
+  /* ----------------- */
+  status = HE5_SWsetalias(swathID, fieldname, aliaslist);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Error calling SWsetalias() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_SWsetaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(aliaslist);
+      return(FAIL);
+    }
+
+  free(aliaslist);
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdropaliasF    (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:  Removes the alias for a specified field name                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    SwathID      int                      swath ID                           |
+|    aliasname    char                     alias name to remove               |
+|    fldgroup     int                      Field group flag                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Oct  00  A. Muslimov   Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_SWdropaliasF(int SwathID, int fldgroup, char *aliasname)
+{  
+  int      ret        = FAIL;/* (int)Return status variable */
+
+  herr_t   status     = FAIL;/* return status variable      */
+
+  hid_t    swathID    = FAIL;/* HDF5 type Swath ID          */
+
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  swathID = (hid_t)SwathID;
+  
+  status = HE5_SWdropalias(swathID, fldgroup, aliasname);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling SWdropalias() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWdropaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  ret = (int)status;
+
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqdfldaliasF (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of fields & aliases and string length of|
+|                fields & aliases list in "Data Fields" group                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfldalias      long                Number of fields & aliases in "Data     |
+|                                     Fields"  group.                         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fldalias       char*               Fields & aliases names in "Data Fields" |
+|                                     group (Comma-separated list)            |
+|  strbufsize     long*               Fields & aliases name list string length|
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Mar 03    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_SWinqdfldaliasF(int SwathID, char *fldalias, long *strbufsize)
+{
+  long            nfldalias   = FAIL;     /* Number of fields & aliases (return)  */
+ 
+  hid_t           swathID = FAIL;         /* HDF5 type swath ID             */
+ 
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+ 
+  swathID = (hid_t)SwathID;
+ 
+  nfldalias = HE5_SWinqdfldalias(swathID, fldalias, strbufsize);
+  if ( nfldalias < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the fields & aliases. \n");
+      H5Epush(__FILE__, "HE5_SWinqdfldaliasF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+  return(nfldalias);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqgfldaliasF (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of fields & aliases and string length of|
+|                fields & aliases list in "Geolocation Fields" group          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfldalias      long                Number of fields & aliases in "Geo-     |
+|                                     location Fields"  group.                |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fldalias       char*               Fields & aliases names in "Geolocation  |
+|                                     Fields" group (Comma-separated list)    |
+|  strbufsize     long*               Fields & aliases name list string length|
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 03    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_SWinqgfldaliasF(int SwathID, char *fldalias, long *strbufsize)
+{
+  long            nfldalias   = FAIL;     /* Number of fields & aliases (return)  */
+ 
+  hid_t           swathID = FAIL;         /* HDF5 type swath ID             */
+ 
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+ 
+  swathID = (hid_t)SwathID;
+ 
+  nfldalias = HE5_SWinqgfldalias(swathID, fldalias, strbufsize);
+  if ( nfldalias < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the fields & aliases. \n");
+      H5Epush(__FILE__, "HE5_SWinqgfldaliasF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+  return(nfldalias);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWaliasinfoF    (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:  Retrieves information about field aliases                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    SwathID      int                      swath ID                           |
+|    aliasname    char                     alias name                         |
+|    fldgroup     int                      Field group flag                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    length       int                      Buffer size                        |
+|    buffer       char                     Buffer with original field name    |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Oct  00  A. Muslimov   Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_SWaliasinfoF(int SwathID, int fldgroup, char *aliasname, int *length, char *buffer)
+{
+  int           ret        = FAIL;/* (int) return status variable          */
+      
+  herr_t        status     = FAIL;/* return status variable                */
+
+  hid_t         swathID    = FAIL;/* HDF5 type swath ID                    */
+
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer        */
+
+  swathID = (hid_t)SwathID;
+
+  status = HE5_SWaliasinfo(swathID, fldgroup, aliasname, length, buffer);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling SWaliasinfo() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWaliasinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  ret = (int)status;
+
+  return(ret);  
+
+}
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWfldrenameF   (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION:  Changes the field name                                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    SwathID      int                      swath ID                           |
+|    oldfieldname char                     Original field name                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    newfieldname char                     New field name                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Oct  00  A. Muslimov   Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_SWfldrenameF(int SwathID, char *oldfieldname, char *newfieldname)
+{
+  int      ret        = FAIL;/* (int)Return status variable */
+
+  herr_t   status     = FAIL;/* return status variable      */
+
+  hid_t    swathID    = FAIL;/* HDF5 type swath ID          */
+
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  swathID = (hid_t)SwathID;
+  
+  status = HE5_SWfldrename(swathID, oldfieldname, newfieldname);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling SWfldrename() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWfldrenameF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  ret = (int)status;
+
+  return(ret);  
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefcomchunkF    (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION: Defines compression type and parameters and sets chunking     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 Swath structure ID                      |
+|  compcode       int                 compression code                        |
+|  compparm       int                 compression parameters                  |
+|  rank           int                 rank of a dataset                       |
+|  *dim           long                pointer to the array containing sizes   |
+|                                     of each dimension of a chunk            |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+| 
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Oct 00   A.Muslimov    Original version.                                   |
+|  Jan 01   A.Muslimov    Added proper FORTRAN to C dimension order conversion|
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_SWdefcomchunkF(int SwathID, int compcode, int *compparm, int rank, long *dim)
+{
+  int		ret       = FAIL;           /* return status        */
+  int		j         = 0;              /* Loop index           */
+
+  herr_t	status    = FAIL;           /* return status        */
+
+  hsize_t	*tempdims = (hsize_t *)NULL;/* Temporary variable   */
+
+  hid_t     swathID   = FAIL;           /* HDF5 type swath ID   */
+  
+  char		*errbuf   = (char *)NULL;   /* error message buffer */
+    
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWdefcomchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  tempdims = (hsize_t *)calloc(rank, sizeof(hsize_t));
+  if(tempdims == (hsize_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tempdims.\n");
+      H5Epush(__FILE__, "HE5_SWdefcomchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /* Change from FORTRAN to C dimension order */
+  /* ---------------------------------------- */
+  for (j = 0; j < rank; j++)
+    tempdims[j] = (hsize_t)dim[ rank - 1 - j ];
+
+  swathID = (hid_t)SwathID;
+
+  /* Call HE5_SWdefcomchunk() */
+  /* ------------------------ */
+  status = HE5_SWdefcomchunk(swathID, compcode, compparm, rank, tempdims);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_SWdefcomchunk from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWdefcomchunkF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(tempdims);
+      return(FAIL);
+    }
+
+  free(tempdims);
+  free(errbuf);
+    
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWsetextdataF      (FORTRAN wrapper)                         |
+|                                                                             |
+|  DESCRIPTION: Sets external data files.                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fortfilelist   char*               list of external files (FORTRAN order)  |
+|  offset         long                array of offsets (in bytes) from the    |
+|                                     beginning of the file to the location   |
+|                                     in the file where the data starts       |
+|  size           long                array of sizes (in bytes) reserved in   |
+|                                     the file for the data.                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 01   A.Muslimov    Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_SWsetextdataF(int SwathID, char *fortfilelist, long offset[], long size[])
+{
+  int             ret          = FAIL;           /* return status variable */
+
+  herr_t          status       = FAIL;           /* Return status variable */
+  hid_t           swathID      = FAIL;           /* Swath HDF5 type ID     */
+  
+  off_t           *off         = (off_t *)NULL;  /* Array of data offsets  */
+  
+  long            nentries     = 0;              /* Number of list entries */
+  long            i;                             /* Loop index             */
+  
+  hsize_t         *sz          = (hsize_t *)NULL;/* Array of data sizes    */
+
+  char            *filelist    = (char *)NULL;   /* Files list (C order)   */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];   /* Error message buffer   */
+  
+  /* Allocate space for C order file list */
+  /* ------------------------------------ */
+  filelist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(filelist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input list.\n");
+      H5Epush(__FILE__, "HE5_SWsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Reverse entries in input list */
+  /* ----------------------------- */
+  status = HE5_EHrevflds(fortfilelist, filelist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in file list.\n");
+      H5Epush(__FILE__, "HE5_SWsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      return(FAIL);
+    }
+
+
+  /* Parse the list of entries to get number of files */
+  /* ------------------------------------------------ */
+  nentries = HE5_EHparsestr(filelist, ',', NULL, NULL);
+  if(nentries <= 0)
+    {
+      sprintf(errbuf,"Cannot parse the input list/input list is empty.\n");
+      H5Epush(__FILE__, "HE5_SWsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      return(FAIL);
+    }
+  
+
+  /* Allocate space for offset array */
+  /* ------------------------------- */
+  off = (off_t *)calloc(nentries, sizeof(off_t));
+  if(off == (off_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input offset array.\n");
+      H5Epush(__FILE__, "HE5_SWsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      return(FAIL);
+    }
+
+  /* Allocate space for size array */
+  /* ----------------------------- */
+  sz = (hsize_t *)calloc(nentries, sizeof(hsize_t));
+  if(sz == (hsize_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input size array.\n");
+      H5Epush(__FILE__, "HE5_SWsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      free(off);
+      return(FAIL);
+    }
+
+  /* Copy the elements of input arrays */
+  /* --------------------------------- */
+  for (i = 0; i < nentries; i++)
+    {
+      off[ nentries - 1 - i ] = (off_t)offset[ i ]; 
+      sz[  nentries - 1 - i ]  = (hsize_t)size[ i ];
+    }
+
+
+  swathID = (hid_t)SwathID;
+
+  /* Call the C function */
+  /* ------------------- */
+  status = HE5_SWsetextdata(swathID, filelist, off, sz);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_SWsetextdata from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      free(off);
+      free(sz);
+      return(FAIL);
+    }
+
+  if (filelist != NULL) free(filelist);
+  if (off != NULL) free(off);
+  if (sz != NULL) free(sz);
+  
+  ret = (int)status;
+  return(ret);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWgetextdataF       (FORTRAN wrapper)                        |
+|                                                                             |
+|  DESCRIPTION: Gets external data files information.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfiles         int                 number of external files  SUCCEED,      |
+|                                               (-1) FAIL                     |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fieldname      char*               External field name                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  namelength     long                Length of each name entry               |
+|  fortfilelist   char*               List of file names (FORTRAN order)      |
+|  offset         long                array of offsets (in bytes) from the    |
+|                                     beginning of the file to the location   |
+|                                     in the file where the data starts       |
+|  size           long                array of sizes (in bytes) reserved in   |
+|                                     the file for the data.                  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 01   A.Muslimov    Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_SWgetextdataF(int SwathID, char *fieldname, long namelength, char *fortfilelist, long offset[], long size[])
+{
+  int             nfiles       = FAIL;           /* number of files (return) */
+  int             i;                             /* Loop index               */
+
+  herr_t          status       = FAIL;           /* Return status variable   */
+  hid_t           swathID      = FAIL;           /* Swath HDF5 type ID       */
+  
+  off_t           *off         = (off_t *)NULL;  /* Array of data offsets    */
+
+  hsize_t         *sz          = (hsize_t *)NULL;/* Array of sizes           */
+
+  size_t          nmlen        = 0;              /* Each entry string length */ 
+
+  char            *filelist    = (char *)NULL;   /* Files list (C order)     */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];   /* Error message buffer     */
+  
+  /* Allocate space for C order output file list */
+  /* ------------------------------------------- */
+  filelist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(filelist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for output list.\n");
+      H5Epush(__FILE__, "HE5_SWgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate space for offset array */
+  /* ------------------------------- */
+  off = (off_t *)calloc(HE5_FLDNUMBERMAX , sizeof(off_t));
+  if(off == (off_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input offset array.\n");
+      H5Epush(__FILE__, "HE5_SWgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      return(FAIL);
+    }
+
+  /* Allocate space for size array */
+  /* ----------------------------- */
+  sz = (hsize_t *)calloc(HE5_FLDNUMBERMAX, sizeof(hsize_t));
+  if(sz == (hsize_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input size array.\n");
+      H5Epush(__FILE__, "HE5_SWgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      free(off);
+      return(FAIL);
+    }
+  
+  swathID = (hid_t)SwathID;
+
+  nmlen = (size_t)namelength;
+
+  /* Call the C function */
+  /* ------------------- */
+  nfiles = HE5_SWgetextdata(swathID, fieldname, nmlen, filelist, off, sz);
+  if (nfiles == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_SWgetextdata from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_SWgetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      free(off);
+      free(sz);
+      return(FAIL);
+    }
+
+  /* Reverse entries in output list */
+  /* ----------------------------- */
+  status = HE5_EHrevflds(filelist, fortfilelist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in output file list.\n");
+      H5Epush(__FILE__, "HE5_SWgetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      free(off);
+      free(sz);
+      return(FAIL);
+    }
+  
+  /* Populate the output arrays */
+  /* -------------------------- */
+  for (i = 0; i < nfiles; i++)
+    {
+      offset[ nfiles - 1 - i ] = (long)off[ i ];
+      size[ nfiles - 1 - i ]   = (long)sz[ i ];
+    }
+
+  if (filelist != NULL) free(filelist);
+  if (off != NULL) free(off);
+  if (sz != NULL) free(sz);
+
+  
+  return(nfiles);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWindexinfoF                                                 |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper around SWindexinfo                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  RegionID       int                 Region ID                               |
+|  object         char*               field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  rank           int*                field rank                              |
+|  fortdimlist    char*               field dimension list                    |
+|  fortindices    long*               indices of region for along track dim.  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  June 04   S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWindexinfoF(int RegionID, char *object, int *rank, char *fortdimlist, long *fortindices)
+{
+  int       ret        = FAIL; /* (int) Return status variable   */
+  int       i, j;                        /* Loop index           */
+ 
+  hid_t     regionID   = FAIL;           /* HDF5 type region ID  */
+  herr_t    status     = FAIL; /* routine return status variable */
+ 
+  char      errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */
+  hsize_t   *indices[HE5_DTSETRANKMAX];
+  hsize_t   swap       = 0;              /* Temporary dimension size   */
+ 
+  /* Dimension lists in C order */
+  /* -------------------------- */
+  char      *dimlist   = (char *)NULL;
+ 
+ 
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  dimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(dimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input list.\n");
+      H5Epush(__FILE__, "HE5_SWindexinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      indices[i] = (hsize_t *)malloc(2*sizeof(hsize_t));
+    }
+ 
+  regionID = (hid_t)RegionID;
+ 
+  /* Call SWindexinfo */
+  /* ---------------- */
+  status = HE5_SWindexinfo(regionID, object, rank, dimlist, indices);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about indices.\n");
+      H5Epush(__FILE__, "HE5_SWindexinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(dimlist);
+      for (i = 0; i < HE5_DTSETRANKMAX; i++)
+	{
+	  free(indices[i]);
+	  indices[i] = NULL;
+	}
+      return(FAIL);
+    }
+ 
+  /* Reverse order of dimensions entries in dimension list */
+  /* ----------------------------------------------------- */
+  if(fortdimlist != (char *)NULL)
+    {
+      status = HE5_EHrevflds(dimlist, fortdimlist);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot reverse entries in dimension list.\n");
+	  H5Epush(__FILE__, "HE5_SWindexinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(dimlist);
+	  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+	    {
+	      free(indices[i]);
+	      indices[i] = NULL;
+	    }
+	  return(FAIL);
+	}
+    }
+ 
+  for (j = 0; j < *rank / 2; j++)
+    {
+      for (i = 0; i < 2; i++)
+	{
+	  swap = indices[*rank - 1 - j][i];
+	  indices[*rank - 1 - j][i] = indices[j][i];
+	  indices[j][i] = swap;
+	}
+    }
+ 
+  for (j = 0; j < *rank; j++)
+    {
+      for (i = 0; i < 2; i++)
+	{
+	  fortindices[j*2+i] = (long)indices[j][i];
+	}
+    }
+ 
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      free(indices[i]);
+      indices[i] = NULL;
+    }
+ 
+  free(dimlist);
+  dimlist = NULL;
+ 
+  ret = (int)status;
+  return(ret);
+}
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwrdmeta                                                    |
+|                                                                             |
+|  DESCRIPTION: Defines structural metadata for pre-existing data             |
+|               field within swath structure (FORTRAN)                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fieldname      char                fieldname                               |
+|  fortdimlist    char                Dimension list (comma-separated list)   |
+|                                         FORTRAN dimesion order              |
+|  mvalue         int                 field type                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 05    S. Zhao      Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWwrdmeta(int SwathID, char *fieldname, char *fortdimlist, int mvalue)
+{
+  int       ret        = FAIL;   /* (int) return status variable   */
+  herr_t    status     = FAIL;   /* routine return status variable */
+
+  hid_t     swathID    = FAIL;   /* HDF5 type swath ID             */
+  hid_t     numbertype = FAIL;   /* HDF5 type data type ID         */
+
+  char      *dimlist = (char *)NULL;   /* Dimension list (C order) */
+  char      *errbuf  = (char *)NULL;   /* error message buffer     */
+    
+
+  swathID = (hid_t)SwathID;
+    
+  numbertype = HE5_EHconvdatatype(mvalue);
+  if(numbertype == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_SWwrdmeta", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Cannot convert datatype for FORTRAN wrapper.");
+      HE5_EHprint("Error: Cannot convert datatype for FORTRAN wrapper, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWwrdmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  dimlist = (char *) calloc(strlen(fortdimlist) + 1, sizeof(char));
+  if(dimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for dimlist.\n");
+      H5Epush(__FILE__, "HE5_SWwrdmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Reverse entries in dimension list (FORTRAN -> C) */
+  /* ------------------------------------------------ */
+  status = HE5_EHrevflds(fortdimlist, dimlist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in dimension list.\n");
+      H5Epush(__FILE__, "HE5_SWwrdmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      return(FAIL);
+    }
+
+  /* Call Write Metadata routine */
+  /* --------------------------- */
+  status = HE5_SWwritedatameta(swathID, fieldname, dimlist, numbertype);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot write \"%s\" field metadata.\n", fieldname);
+      H5Epush(__FILE__, "HE5_SWwrdmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      return(FAIL);
+    }
+
+  free(dimlist);
+  free(errbuf);
+
+  ret = (int)status;
+  return (ret);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWwrgmeta                                                    |
+|                                                                             |
+|  DESCRIPTION: Defines structural metadata for pre-existing geolocation      |
+|               field within swath structure (FORTRAN)                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fieldname      char                fieldname                               |
+|  fortdimlist    char                Dimension list (comma-separated list)   |
+|                                         FORTRAN dimesion order              |
+|  mvalue         int                 field type                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 05    S. Zhao      Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWwrgmeta(int SwathID, char *fieldname, char *fortdimlist, int mvalue)
+{
+  int       ret        = FAIL;   /* (int) return status variable   */
+  herr_t    status     = FAIL;   /* routine return status variable */
+
+  hid_t     swathID    = FAIL;   /* HDF5 type swath ID             */
+  hid_t     numbertype = FAIL;   /* HDF5 type data type ID         */
+
+  char      *dimlist = (char *)NULL;   /* Dimension list (C order) */
+  char      *errbuf  = (char *)NULL;   /* error message buffer     */
+
+
+  swathID = (hid_t)SwathID;
+
+  numbertype = HE5_EHconvdatatype(mvalue);
+  if(numbertype == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_SWwrgmeta", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Cannot convert datatype for FORTRAN wrapper.");
+      HE5_EHprint("Error: Cannot convert datatype for FORTRAN wrapper, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_SWwrgmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  dimlist = (char *) calloc(strlen(fortdimlist) + 1, sizeof(char));
+  if(dimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for dimlist.\n");
+      H5Epush(__FILE__, "HE5_SWwrgmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Reverse entries in dimension list (FORTRAN -> C) */
+  /* ------------------------------------------------ */
+  status = HE5_EHrevflds(fortdimlist, dimlist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in dimension list.\n");
+      H5Epush(__FILE__, "HE5_SWwrgmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      return(FAIL);
+    }
+
+  /* Call Write Metadata routine */
+  /* --------------------------- */
+  status = HE5_SWwritegeometa(swathID, fieldname, dimlist, numbertype);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot write \"%s\" field metadata.\n", fieldname);
+      H5Epush(__FILE__, "HE5_SWwrgmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      return(FAIL);
+    }
+
+  free(dimlist);
+  free(errbuf);
+
+  ret = (int)status;
+  return (ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWgetaliaslistF (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of aliases and aliases list in swath    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nalias         long                number of aliases                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  SwathID        int                 swath structure ID                      |
+|  fldgroup       int                 field group flag (geo or data)          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  aliaslist      char*               list of aliases (comma-separated list)  |
+|  strbufsize     long*               length of aliases list                  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 05    S.Zhao       Original development                                |
+|  Dec 05    T.Roegner    NCR 44092 - Added CYGWIN capability                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_SWgetaliaslistF(int SwathID, int fldgroup, char *aliaslist, long *strbufsize)
+{
+  long   nalias  = FAIL;         /* Number of aliases (return)     */
+  hid_t  swathID = FAIL;         /* HDF5 type swath ID             */
+  char   errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+
+
+  swathID = (hid_t)SwathID;
+
+  nalias = HE5_SWgetaliaslist(swathID, fldgroup, aliaslist, strbufsize);
+  if (nalias < 0)
+    {
+      sprintf(errbuf, "Cannot retrieve the aliases. \n");
+      H5Epush(__FILE__, "HE5_SWgetaliaslistF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return(nalias);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWsetdimscaleF (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION: Defines a dimension scale for a fields dimension in a SW      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swID           int                 SW structure ID                         |
+|  fieldname      char                field name                              |
+|  dimname        char                dim name                                |
+|  dim            long                Dimemsion value                         |
+|  numbertype_in  int                 dim scale data type such as DFNT_INT32, |
+|                                     DFNT_FLOAT64, DFNT_FLOAT32, etc.        |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                None                                                         |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWsetdimscaleF(int SwathID, char *fieldname, char *dimname,
+		  long dim, int numbertype_in, void * data)
+{
+  herr_t          status;
+  hid_t           swID;
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+
+
+  swID = (hid_t)SwathID;
+
+  status = HE5_SWsetdimscale(swID, fieldname, dimname,
+			     (hsize_t) dim, (hid_t) numbertype_in, data);
+
+  if (status < 0)
+    {
+      sprintf(errbuf, "Cannot set dimension scale %s for field %s. \n", dimname, fieldname);
+      H5Epush(__FILE__, "HE5_SWsetdimscaleF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return((int)status);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdefdimscaleF (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION: Defines dimension scale for a dimension for all fields in a   |
+|               Swath                                                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swID           int                 SW structure ID                         |
+|  dimname        char                dim name                                |
+|  dim            long                Dimemsion value                         |
+|  numbertype_in  int                 dim scale data type such as DFNT_INT32, |
+|                                     DFNT_FLOAT64, DFNT_FLOAT32, etc.        |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                None                                                         |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jan 14    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWdefdimscaleF(int SwathID, char *dimname,
+		  long dim, int numbertype_in, void * data)
+{
+  herr_t          status;
+  hid_t           swID;
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+
+
+  swID = (hid_t)SwathID;
+
+  status = HE5_SWdefdimscale(swID, dimname,
+			     (hsize_t) dim, (hid_t) numbertype_in, data);
+
+  if (status < 0)
+    {
+      sprintf(errbuf, "Cannot set dimension scale %s for all fields in swath. \n", dimname);
+      H5Epush(__FILE__, "HE5_SWdefdimscaleF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return((int)status);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWgetdimscaleF  (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Get dimension scale for a dimension of a field in a SW        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return databuffsize  SUCCEED, (-1) FAIL |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swID           int                 SWATH structure ID                      |
+|  fieldname      char                field name                              |
+|  dimname        char                dim name                                |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dimsize        long                dimension size                          |
+|  ntype          int                 number type                             |
+|  databuff       void                data buffer for read                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_SWgetdimscaleF(int SwathID, char *fieldname, char *dimname, long *dimsize,
+		   int *ntype, void * databuff)
+{
+  hsize_t         databuffsize =(hsize_t)FAIL; /* Size of buffer            */
+  hid_t           swID         = FAIL;         /* HDF5 type swath ID        */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  hsize_t         ds;
+  hid_t           numtype;
+
+  swID = (hid_t)SwathID;
+
+  databuffsize = HE5_SWgetdimscale(swID, fieldname, dimname, &ds, &numtype,
+				   databuff);
+  *dimsize = (long) ds;
+  *ntype = (int) numtype;
+
+  if ( databuffsize < 0 )
+    {
+      sprintf(errbuf,"Cannot get dimension scale %s for field %s. \n", dimname, fieldname);
+      H5Epush(__FILE__, "HE5_SWgetdimscaleF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+						 
+  return((long)databuffsize);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWreaddscaleattrF (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with a dimension scale field       |
+|               from a SW.                                                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swID           int     None        HDF-EOS type SWATH  ID                  |
+|  fieldname      char                field name                              |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 10   Abe Taaheri   Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_SWreaddscaleattrF(int SwathID, char *fieldname, char *attrname, void *datbuf)
+{
+  herr_t          status         = FAIL;       /* return status             */
+  hid_t           swID           = FAIL;       /* HDF5 type swath ID        */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  
+
+  swID = (hid_t)SwathID;
+
+  status = HE5_SWreaddscaleattr(swID, fieldname, attrname, datbuf);
+  if ( status < 0 )
+    {
+      sprintf(errbuf,"Cannot read attribute %s for dimension scale %s. \n", attrname, fieldname);
+      H5Epush(__FILE__, "HE5_SWreaddscaleattrF", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+						 
+  return((int)status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:  HE5_SWwritedscaleattrF (FORTRAN wrapper)                        |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with a dimension scale    |
+|               field in a SW.                                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swID           int                 SWATH structure ID                      |
+|  fieldname      char*               dimension scale SDS name                |
+|  attrname       char*               attribute name                          |
+|  numtype        int                 attribute datatype ID                   |
+|  count[]        long                Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10   Abe Taaheri   Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_SWwritedscaleattrF(int SwathID, char *fieldname, char *attrname, int numtype, long count[], void *datbuf)
+{
+  herr_t          status         = FAIL;       /* return status             */
+  hid_t           swID           = FAIL;       /* HDF5 type swath ID        */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  hsize_t         fort_count[HE5_FLDNUMBERMAX];
+
+  swID = (hid_t)SwathID;
+
+  fort_count[0] = (hsize_t)count[0];
+  status = HE5_SWwritedscaleattr(swID, fieldname, attrname, (hid_t)numtype, fort_count, datbuf);
+
+  if ( status < 0 )
+    {
+      sprintf(errbuf,"Cannot write attribute %s for dimension scale %s. \n", attrname, fieldname);
+      H5Epush(__FILE__, "HE5_SWwritedscaleattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+						 
+  return((int)status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWdscaleattrinfoF (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about dimension scale attribute         |
+|               (attribute associated with a specified dimension scale field) |
+|                in a SW.                                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swID           int       None      HDF-EOS type SWATH  ID                  |
+|  fieldname      char*               field name                              |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          int                 attribute data type ID                  |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10   Abe Taaheri   Original Development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_SWdscaleattrinfoF(int SwathID, char *fieldname, char *attrname, int *ntype, long *fortcount)
+{
+  herr_t          status         = FAIL;       /* return status             */
+  hid_t           swID           = FAIL;       /* HDF5 type swath ID        */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  hsize_t         *count = (hsize_t *)NULL;    /* C-order count array       */
+  hid_t           *dtype  = (hid_t *)NULL;     /* Data type class ID        */
+
+  swID = (hid_t)SwathID;
+
+  dtype = (hid_t *)calloc(1, sizeof(hid_t));
+  if(dtype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for \"dtype\".\n");
+      H5Epush(__FILE__, "HE5_SWdscaleattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if(count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for \"count\".\n");
+      H5Epush(__FILE__, "HE5_SWdscaleattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(dtype);
+      return(FAIL);
+    }
+
+  count[0] = 0;
+
+  status = HE5_SWdscaleattrinfo(swID, fieldname, attrname, dtype, count);
+  if ( status == FAIL)
+    {
+      sprintf(errbuf, "Cannot retrieve attribute info for the %s dimension scale. \n", fieldname);
+      H5Epush(__FILE__, "HE5_SWdscaleattrinfoF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(count);
+      free(dtype);
+      return(FAIL);
+    }
+  
+  *fortcount = (long)(*count);
+  *ntype     = (int)(*dtype);
+
+  free(count);
+  free(dtype);
+  return((int)status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWinqdscaleattrsF (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list associated with a specified dimension scale   |
+|                in a SW.                                                     |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                number of attributes (-1 if fails)      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swID           int     None        HDF-EOS type SWATH  ID                  |
+|  fieldname      char                dimension scale name                    |
+|  attrnames      char                attribute name(s)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                String length of attribute (in bytes)   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  June 10   Abe Taaheri  Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_SWinqdscaleattrsF(int SwathID, char *fieldname, char *attrnames, long *strbufsize)
+{
+  long            status         = FAIL;       /* return status             */
+  hid_t           swID           = FAIL;       /* HDF5 type swath ID        */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  
+
+  swID = (hid_t)SwathID;
+
+  status = HE5_SWinqdscaleattrs(swID, fieldname, attrnames, strbufsize);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot find the attribute %s for dimension scale %s. \n",attrnames,fieldname);
+      H5Epush(__FILE__, "HE5_SWinqdscaleattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return (status);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_SWflddiminfo                                                 |
+|                                                                             |
+|  DESCRIPTION:  This functions returns dims and maxdims                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  swathID        hid_t   None        HDF-EOS type swath  ID                  |
+|  fieldname      char*               fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  rank           int                 field rank                              |
+|  dims           hsize_t             dimensions of field                     |
+|  maxdims        hsize_t             max dimensions of field                 |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Sep 11   Abe Taaheri   Added support for unlimited dimension adjustment    |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_SWflddiminfo(int SwathID, char *fieldname, int *rank,  hsize_t dims[], hsize_t maxdims[])
+{
+  herr_t      status         = FAIL;      /* return status             */
+  hid_t       swID           = FAIL;      /* HDF5 type swath ID        */
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Buffer for error message  */
+  hid_t       ntype[1] = {FAIL};          /* Field numbertypes         */
+  char	      *dimlist    = (char *)NULL; /* Dimension list in C order */
+  char	      *maxdimlist = (char *)NULL; /* max Dimension list in C order */
+  char        *dimbuf   = (char *)NULL;   /* Dimension buffer          */
+  char        *comma    = (char *)NULL;   /* Pointer to comma          */
+  char        *dimcheck = (char *)NULL;   /* Dimension check buffer    */
+  hsize_t     dimsize   = 0;              /* Dimension size            */
+  int         maxrank     = 0;            /* max dim  rank             */
+  int         i           = 0;            /* Loop index                */
+  int         foundAllDim = 1;            /* found all dimensions flag */
+  int         first       = 1;            /* first entry flag          */
+  char        utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer            */
+
+  swID = (hid_t)SwathID;
+
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  maxdimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  dimlist    = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(dimlist == NULL || maxdimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input list.\n");
+      H5Epush(__FILE__, "HE5_SWflddiminfo", __LINE__, H5E_RESOURCE, 
+	      H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get field info  */
+  /* --------------- */
+  status = HE5_SWfieldinfo(swID, fieldname, rank, dims, ntype, 
+			   dimlist, maxdimlist);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Error calling HE5_SWfieldinfo. \n") ;
+      H5Epush(__FILE__, "HE5_SWflddiminfo", __LINE__, H5E_ARGS, 
+	      H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate space for dimbuf, copy maxdimlist into it, & append comma */
+  /* ------------------------------------------------------------------ */
+  if(maxdimlist != NULL)
+    {
+      dimbuf = (char *) calloc(strlen(maxdimlist) + 64, sizeof(char));
+      if(dimbuf == NULL)
+	{
+	  H5Epush(__FILE__, "HE5_SWflddiminfo", __LINE__, H5E_RESOURCE, 
+		  H5E_NOSPACE, "Cannot allocate memory. \n");
+	  HE5_EHprint("Error: Can not allocate memory, occured", 
+		      __FILE__, __LINE__);
+	  return(FAIL);
+
+	}
+	  
+      /* Copy "maxdimlist" to "dimbuf", & append comma */
+      /* --------------------------------------------- */
+      strcpy(dimbuf, maxdimlist);
+      strcat(dimbuf, ",");
+
+      /* Find comma */
+      /* ---------- */
+      comma = strchr(dimbuf, ',');
+
+      /*
+       * Loop through entries in dimension list to make sure they are
+       *                     defined in swath
+       */
+      while (comma != NULL)
+	{
+	  /* Copy dimension list entry to dimcheck */
+	  /* ------------------------------------- */
+	  dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char));
+	  if(dimcheck == NULL)
+	    {
+	      H5Epush(__FILE__, "HE5_SWflddiminfo", __LINE__, H5E_RESOURCE, 
+		      H5E_NOSPACE, "Cannot allocate memory. \n");
+	      HE5_EHprint("Error: Can not allocate memory, occured", 
+			  __FILE__, __LINE__);
+	      free(dimbuf);
+	      free(dimlist);
+	      free(maxdimlist);
+	      return(FAIL);
+	    }
+	  memmove(dimcheck, dimbuf, comma - dimbuf);
+
+	  /* Get dimension size */
+	  /* ------------------ */
+	  dimsize = HE5_SWdiminfo(swID, dimcheck);
+	  if ( (dimsize > 0) || (dimsize == H5S_UNLIMITED) )
+	    {
+	      maxdims[maxrank] = dimsize;
+	      maxrank++;
+	    }
+	  else
+	    {
+	      /*
+	       * If dimension list entry not found - set error return
+	       * status, append name to utility buffer for error report
+	       */
+	      status = FAIL;
+	      foundAllDim = 0;
+	      if (first == 1)
+		strcpy(utlbuf, dimcheck);
+	      else
+		{
+		  strcat(utlbuf, ",");
+		  strcat(utlbuf, dimcheck);
+		}
+	      first = 0;
+	    }
+
+	  /*
+	   * Go to next dimension entry, find next comma, & free up
+	   * dimcheck buffer
+	   */
+	  memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); 
+	  comma = strchr(dimbuf, ',');
+	  free(dimcheck);
+	}
+
+      free(dimbuf);
+      free(dimlist);
+      free(maxdimlist);
+
+      /* If no dimensions found, report error */
+      /* ------------------------------------ */
+      if (foundAllDim == 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" field. \n",
+		  utlbuf, fieldname);
+	  H5Epush(__FILE__, "HE5_SWflddiminfo", __LINE__, H5E_BTREE, 
+		  H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+
+
+      /* If maxrank !=rank  then report error */
+      /* ------------------------------------ */
+      if ( maxrank != *rank )
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Dimension rank doesn't match Max dimension rank.\n");
+	  H5Epush(__FILE__, "HE5_SWflddiminfo", __LINE__, H5E_ARGS,
+		  H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+    } 
+  /* "maxlist == NULL"  ==> maxdims[]= dims[] */
+  /* ---------------------------------------- */
+  else
+    {
+      for(i = 0; i < *rank; i++ )
+	maxdims[ i ] = dims[ i ];
+    }
+
+  return (status);
+}
+
+#ifndef _gridID_cplusplus
+
+/* HDF types used in FORTRAN bindings */
+ 
+#if defined(DEC_ALPHA) || defined(IRIX) || defined(UNICOS) || defined(LINUX64) || defined(IA64) || defined(MACINTOSH) || defined(MACINTEL) || defined(IBM6000) || defined(CYGWIN)
+ 
+#define INT32  INT
+#define INT32V INTV
+#define PINT32 PINT
+ 
+#else
+ 
+#define INT32  LONG
+#define INT32V LONGV
+#define PINT32 PLONG
+ 
+#endif
+
+
+/* File/Swath access routines */
+
+FCALLSCFUN2(INT, HE5_SWopenF, HE5_SWOPEN, he5_swopen, STRING, INT)
+FCALLSCFUN2(INT, HE5_SWcreateF, HE5_SWCREATE, he5_swcreate, INT, STRING)
+FCALLSCFUN2(INT, HE5_SWattachF, HE5_SWATTACH, he5_swattach, INT, STRING)
+FCALLSCFUN1(INT, HE5_SWdetachF, HE5_SWDETACH, he5_swdetach, INT)
+FCALLSCFUN1(INT, HE5_SWcloseF, HE5_SWCLOSE, he5_swclose, INT)
+
+/* Definition routines */
+
+FCALLSCFUN3(INT, HE5_SWdefdimF, HE5_SWDEFDIM, he5_swdefdim, INT, STRING, LONG)
+FCALLSCFUN5(INT, HE5_SWdefdimmapF, HE5_SWDEFMAP, he5_swdefmap, INT, STRING, STRING, LONG, LONG)
+FCALLSCFUN4(INT, HE5_SWdefidxmapF, HE5_SWDEFIMAP, he5_swdefimap, INT, STRING, STRING, LONGV)
+FCALLSCFUN6(INT, HE5_SWdefgfld, HE5_SWDEFGFLD, he5_swdefgfld, INT, STRING, STRING, STRING, INT, INT)
+FCALLSCFUN6(INT, HE5_SWdefdfld, HE5_SWDEFDFLD, he5_swdefdfld, INT, STRING, STRING, STRING, INT, INT)
+FCALLSCFUN3(INT, HE5_SWdefcompF, HE5_SWDEFCOMP, he5_swdefcomp, INT, INT, PINT)
+FCALLSCFUN3(INT, HE5_SWdefchunkF, HE5_SWDEFCHUNK, he5_swdefchunk, INT, INT, PLONG)
+FCALLSCFUN5(INT, HE5_SWdefcomchunkF, HE5_SWDEFCOMCH, he5_swdefcomch, INT, INT, PINT, INT, PLONG)
+FCALLSCFUN5(LONG, HE5_SWupimap, HE5_SWUPIMAP, he5_swupimap, INT, INT, LONGV, LONGV, LONGV)
+FCALLSCFUN3(INT, HE5_SWfldrenameF, HE5_SWFLDRNM, he5_swfldrnm, INT, STRING, STRING)
+
+/* I/O routines */
+
+FCALLSCFUN6(INT, HE5_SWwrfld, HE5_SWWRFLD, he5_swwrfld, INT, STRING, LONGV, LONGV, LONGV, PVOID)
+FCALLSCFUN8(INT, HE5_SWwrcharfld, HE5_SWWRCHARFLD, he5_swwrcharfld, INT, STRING, INT, INT, LONGV, LONGV, LONGV, PVOID)
+FCALLSCFUN6(INT, HE5_SWrdfld, HE5_SWRDFLD, he5_swrdfld, INT, STRING, LONGV, LONGV, LONGV, PVOID)
+FCALLSCFUN8(INT, HE5_SWrdcharfld, HE5_SWRDCHARFLD, he5_swrdcharfld, INT, STRING, INT, INT, LONGV, LONGV, LONGV, PVOID)
+FCALLSCFUN5(INT, HE5_SWwrattr, HE5_SWWRATTR, he5_swwrattr,INT,STRING,INT,LONGV,PVOID)
+FCALLSCFUN5(INT, HE5_SWwrgattr, HE5_SWWRGATTR, he5_swwrgattr, INT, STRING, INT, LONGV,PVOID)
+FCALLSCFUN5(INT, HE5_SWwrgeogattr, HE5_SWWRGEOGATTR, he5_swwrgeogattr, INT, STRING, INT, LONGV,PVOID)
+FCALLSCFUN6(INT, HE5_SWwrlattr, HE5_SWWRLATTR, he5_swwrlattr, INT, STRING,STRING,INT,LONGV,PVOID)
+FCALLSCFUN3(INT, HE5_SWrdattr, HE5_SWRDATTR, he5_swrdattr, INT, STRING, PVOID)
+FCALLSCFUN3(INT, HE5_SWrdgattr, HE5_SWRDGATTR, he5_swrdgattr,INT,STRING,PVOID)
+FCALLSCFUN3(INT, HE5_SWrdgeogattr, HE5_SWRDGEOGATTR, he5_swrdgeogattr,INT,STRING,PVOID)
+FCALLSCFUN4(INT, HE5_SWrdlattr, HE5_SWRDLATTR, he5_swrdlattr,INT,STRING,STRING,PVOID)
+FCALLSCFUN4(INT, HE5_SWsetfill, HE5_SWSETFILL, he5_swsetfill, INT, STRING, INT, PVOID)
+FCALLSCFUN3(INT, HE5_SWgetfill, HE5_SWGETFILL, he5_swgetfill, INT, STRING, PVOID)
+FCALLSCFUN3(INT, HE5_SWsetaliasF, HE5_SWSETALIAS, he5_swsetalias, INT, STRING, STRING)
+FCALLSCFUN3(INT, HE5_SWdropaliasF, HE5_SWDRPALIAS, he5_swdrpalias, INT, INT, STRING)
+FCALLSCFUN4(INT, HE5_SWwrdmeta, HE5_SWWRDMETA, he5_swwrdmeta, INT, STRING, STRING, INT)
+FCALLSCFUN4(INT, HE5_SWwrgmeta, HE5_SWWRGMETA, he5_swwrgmeta, INT, STRING, STRING, INT)
+
+
+/* Inquiry routines */
+
+FCALLSCFUN3(LONG, HE5_SWinqswathF, HE5_SWINQSWATH, he5_swinqswath, STRING, PSTRING,PLONG)
+FCALLSCFUN3(LONG, HE5_SWnentriesF, HE5_SWNENTRIES, he5_swnentries,INT,INT,PLONG)
+FCALLSCFUN2(LONG, HE5_SWdiminfoF, HE5_SWNDIMINFO, he5_swdiminfo, INT, STRING)
+FCALLSCFUN5(INT, HE5_SWmapinfoF, HE5_SWNMAPINFO, he5_swmapinfo,INT,STRING,STRING,PLONG,PLONG)
+FCALLSCFUN2(INT, HE5_SWgmapinfo, HE5_SWGMAPINFO, he5_swgmapinfo,INT,STRING)
+FCALLSCFUN7(INT, HE5_SWfldinfoF, HE5_SWFLDINFO, he5_swfldinfo,INT,STRING,PINT,LONGV,PINT,PSTRING,PSTRING)
+FCALLSCFUN4(LONG, HE5_SWidxmapinfoF, HE5_SWIMAPINFO, he5_swimapinfo,INT,STRING,STRING,LONGV)
+FCALLSCFUN4(LONG, HE5_SWinqmapsF, HE5_SWINQMAPS, he5_swinqmaps,INT,PSTRING,LONGV,LONGV)
+FCALLSCFUN3(LONG, HE5_SWinqimapsF, HE5_SWINQIMAPS, he5_swinqimaps,INT,PSTRING,LONGV)
+FCALLSCFUN3(LONG, HE5_SWinqdimsF, HE5_SWINQDIMS, he5_swinqdims,INT,PSTRING,LONGV)
+FCALLSCFUN4(LONG, HE5_SWinqgflds, HE5_SWINQGFLDS, he5_swinqgflds, INT,PSTRING, INTV, INTV)
+FCALLSCFUN4(LONG, HE5_SWinqdflds, HE5_SWINQDFLDS, he5_swinqdflds, INT,PSTRING, INTV, INTV)
+FCALLSCFUN4(INT, HE5_SWatinfo, HE5_SWATTRINFO, he5_swattrinfo, INT, STRING, PINT, PLONG)
+FCALLSCFUN4(INT, HE5_SWgatinfo, HE5_SWGATTRINFO, he5_swgattrinfo, INT, STRING, PINT, PLONG)
+FCALLSCFUN4(INT, HE5_SWgeogatinfo, HE5_SWGEOGATTRINFO, he5_swgeogattrinfo, INT, STRING, PINT, PLONG)
+FCALLSCFUN5(INT, HE5_SWlatinfo, HE5_SWLATTRINFO, he5_swlattrinfo, INT, STRING, STRING, PINT, PLONG)
+FCALLSCFUN4(INT, HE5_SWcompinfoF, HE5_SWCOMPINFO, he5_swcompinfo, INT, STRING,PINT, INTV)
+FCALLSCFUN3(LONG, HE5_SWinqattrsF, HE5_SWINQATTRS, he5_swinqattrs,INT,PSTRING,PLONG)
+FCALLSCFUN4(LONG, HE5_SWinqlattrs, HE5_SWINQLATTRS, he5_swinqlattrs,INT,STRING,PSTRING,PLONG)
+FCALLSCFUN3(LONG, HE5_SWinqgattrs, HE5_SWINQGATTRS, he5_swinqgattrs,INT,PSTRING,PLONG)
+FCALLSCFUN3(LONG, HE5_SWinqgeogattrs, HE5_SWINQGEOGATTRS, he5_swinqgeogattrs,INT,PSTRING,PLONG)
+FCALLSCFUN7(INT, HE5_SWreginfo, HE5_SWREGINFO, he5_swreginfo,INT,INT,STRING,PINT,PINT,LONGV,PLONG)
+FCALLSCFUN7(INT, HE5_SWperinfo, HE5_SWPERINFO, he5_swperinfo,INT,INT,STRING,PINT,PINT,LONGV,PLONG)
+FCALLSCFUN8(INT, HE5_SWidtype, HE5_SWIDTYPEF, he5_swidtype, INT,STRING,STRING,INT,PINT,PINT,PINT,PLONG)
+FCALLSCFUN5(INT, HE5_SWaliasinfoF, HE5_SWALIASINFO, he5_swaliasinfo, INT, INT, STRING, PINT, STRING)
+FCALLSCFUN3(LONG, HE5_SWinqdfldaliasF, HE5_SWINQDFLDALIAS, he5_swinqdfldalias,INT,PSTRING,PLONG)
+FCALLSCFUN3(LONG, HE5_SWinqgfldaliasF, HE5_SWINQGFLDALIAS, he5_swinqgfldalias,INT,PSTRING,PLONG)
+FCALLSCFUN4(INT, HE5_SWchunkinfoF, HE5_SWCHUNKINFO, he5_swchunkinfo,INT,STRING,PINT,LONGV)
+FCALLSCFUN4(LONG, HE5_SWgetaliaslistF, HE5_SWGETALIASLIST, he5_swgetaliaslist,INT,INT,PSTRING,PLONG)
+
+
+/* Subsetting routines */
+
+FCALLSCFUN4(INT, HE5_SWdefboxreg, HE5_SWDEFBOXREG, he5_swdefboxreg, INT, DOUBLEV, DOUBLEV, INT)
+FCALLSCFUN4(INT, HE5_SWdefvrtreg, HE5_SWDEFVRTREG, he5_swdefvrtreg,INT,INT,STRING,DOUBLEV)
+FCALLSCFUN5(INT, HE5_SWextreg, HE5_SWEXTREG, he5_swextreg, INT, INT, STRING, INT, PVOID)
+FCALLSCFUN4(INT, HE5_SWdeftmeper, HE5_SWDEFTMEPER, he5_swdeftmeper,INT,DOUBLE,DOUBLE,INT)
+FCALLSCFUN1(INT, HE5_SWdupreg, HE5_SWDUPREG, he5_swdupreg, INT)
+FCALLSCFUN2(INT, HE5_SWupscene, HE5_SWUPSCENE, he5_swupscene,INT, INT)
+FCALLSCFUN6(INT, HE5_SWregidx, HE5_SWREGIDX, he5_swregidx,INT,DOUBLEV,DOUBLEV,INT,PSTRING,LONGV)
+FCALLSCFUN5(INT, HE5_SWextper, HE5_SWEXTPER, he5_swextper,INT,INT,STRING,INT,PVOID)
+FCALLSCFUN5(INT, HE5_SWindexinfoF, HE5_SWINDEXINFOF, he5_swindexinfof,INT,STRING,PINT,PSTRING,PLONG)
+
+
+/* PROFILE INTERFACE */
+
+FCALLSCFUN5(INT, HE5_PRdefineF, HE5_PRDEFINE, he5_prdefine, INT, STRING, STRING, STRING, INT)
+FCALLSCFUN8(INT, HE5_PRwriteF, HE5_PRWRITE, he5_prwrite, INT, STRING, LONGV, LONGV, LONGV, LONG, LONGV, PVOID)
+FCALLSCFUN7(INT, HE5_PRreadF, HE5_PRREAD, he5_prread, INT, STRING, LONGV, LONGV, LONGV, LONGV, PVOID)
+FCALLSCFUN4(LONG, HE5_PRinquireF, HE5_PRINQIRE, he5_prinquire, INT, STRING, PINT, PINT)
+FCALLSCFUN8(INT, HE5_PRinfoF, HE5_PRINFO, he5_prinfo,INT,STRING,PINT,LONGV,LONGV,PINT,PSTRING,PSTRING)
+FCALLSCFUN5(INT, HE5_PRwrgattrF, HE5_PRWRGATTR, he5_prwrgattr, INT, STRING, INT, LONGV,PVOID)
+FCALLSCFUN3(INT, HE5_PRrdgattrF, HE5_PRRDGATTR, he5_prrdgattr,INT,STRING,PVOID)
+FCALLSCFUN4(INT, HE5_PRgattrinfoF, HE5_PRGATTRINFO, he5_prgattrinfo, INT, STRING, PINT, PLONG)
+FCALLSCFUN3(LONG, HE5_PRinqgattrsF, HE5_PRINQGATTRS, he5_prinqgattrs,INT,PSTRING,PLONG)
+
+FCALLSCFUN5(INT, HE5_SWdefdimscaleF, HE5_SWDEFDIMSCALE, he5_swdefdimscale,INT,STRING,LONG,INT,PVOID)
+FCALLSCFUN6(INT, HE5_SWsetdimscaleF, HE5_SWSETDIMSCALE, he5_swsetdimscale,INT,STRING,STRING,LONG,INT,PVOID)
+FCALLSCFUN6(LONG, HE5_SWgetdimscaleF, HE5_SWGETDIMSCALE, he5_swgetdimscale,INT,STRING,STRING,PLONG,PINT,PVOID)
+FCALLSCFUN4(INT, HE5_SWreaddscaleattrF,HE5_SWREADDSCALEATTR, he5_swreaddscaleattr,INT,STRING,STRING,PVOID)
+FCALLSCFUN6(INT, HE5_SWwritedscaleattrF, HE5_SWWRITEDSCALEATTR, he5_swwritedscaleattr,INT,STRING,STRING,INT,LONGV,PVOID)
+FCALLSCFUN5(INT, HE5_SWdscaleattrinfoF, HE5_SWDSCALEATTRINFO, he5_swdscaleattrinfo,INT,STRING,STRING,PINT,PLONG)
+FCALLSCFUN4(INT, HE5_SWinqdscaleattrsF, HE5_SWINQDSCALATTRS, he5_swinqdscaleattrs,INT,STRING,STRING,PLONG)
+
+/* EXTERNAL DATA FILE INTERFACE */
+
+FCALLSCFUN4(INT, HE5_SWsetextdataF, HE5_SWSETXDAT, he5_swsetxdat,INT,STRING,LONGV,LONGV)
+FCALLSCFUN6(INT, HE5_SWgetextdataF, HE5_SWGETXDAT, he5_swgetxdat,INT,STRING,LONG,PSTRING,LONGV,LONGV)
+
+#endif
+
+
+
+
+
+
+
diff --git a/src/TSapi.c b/src/TSapi.c
new file mode 100755
index 0000000..77eb46e
--- /dev/null
+++ b/src/TSapi.c
@@ -0,0 +1,340 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 2001 Emergent IT Inc. and Raytheon Systems Company      |
+ |                                                                          | 
+ |  Permission to use, modify, and distribute this software and its         |
+ |  documentation for any purpose without fee is hereby granted, provided   |
+ |  that the above copyright notice appear in all copies and that both that |
+ |  copyright notice and this permission notice appear in supporting        |
+ |                          documentation.                                  |
+ ----------------------------------------------------------------------------
+ */
+
+#include <HE5_HdfEosDef.h>
+
+#ifdef  _HDFEOS5_THREADSAFE
+
+/* Global Variable definition */
+/* -------------------------- */
+pthread_once_t    HE5_HDFE_TS_FirstInit = PTHREAD_ONCE_INIT;
+
+#endif
+
+/*----------------------------------------------------------------------------
+|  BEGIN_PROLOG                                                              | 
+|                                                                            |
+|  FUNCTION: HE5_TSinitfirst                                                 | 
+|                                                                            | 
+|  DESCRIPTION : This function initializes the mutex, once per run.          |
+|                                                                            |
+|                                                                            |
+|  Return Value    Type     Units     Description                            | 
+|  ============   ======  =========   =====================================  | 
+|                                                                            |
+|  INPUTS:   None                                                            | 
+|                                                                            |
+|                                                                            |
+|  OUTPUTS:                                                                  | 
+|                                                                            |
+|             None                                                           | 
+|                                                                            |
+|  NOTES:                                                                    | 
+|                                                                            |
+|   Date      Programmer    Description                                      | 
+|  ========   ============  ===============================================  | 
+|  08/21/01   A.Muslimov    Original development.                            |
+|  08/27/01   A.Muslimov    Added appropriate error handlings.               |
+|                                                                            |
+|  END_PROLOG                                                                | 
+----------------------------------------------------------------------------*/
+void    
+HE5_TSinitfirst(void)
+{
+#ifdef  _HDFEOS5_THREADSAFE
+
+  herr_t   status = FAIL;
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];
+
+  /* Initialize Global Mutex Variable */
+  /* -------------------------------- */
+  GlobalMutex.MasterThread = (pthread_t *)NULL;
+
+  /* Initialize mutex with default value */
+  /* ----------------------------------- */
+  status = pthread_mutex_init(&GlobalMutex.Lock, NULL);
+  if (status != SUCCEED)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Failed to initialize the mutex.\n");
+	  H5Epush(__FILE__, "HE5_TSinitfirst", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf);
+	}
+
+  /* Initialize condition variable with default attribute */
+  /* ---------------------------------------------------- */
+  status = pthread_cond_init(&GlobalMutex.CondVar, NULL);
+  if (status != SUCCEED)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Failed to initialize the condition variable.\n");
+	  H5Epush(__FILE__, "HE5_TSinitfirst", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf);
+	}
+
+  GlobalMutex.LockCount = 0;
+
+#endif
+}
+
+
+/*----------------------------------------------------------------------------
+|  BEGIN_PROLOG                                                              | 
+|                                                                            |
+|  FUNCTION: HE5_TSmutexlock                                                 | 
+|                                                                            | 
+|  DESCRIPTION : This function locks the mutex.                              |
+|                                                                            |
+|                                                                            |
+|  Return Value    Type     Units     Description                            | 
+|  ============   ======  =========   =====================================  | 
+|  status         herr_t  none        Return status variable                 |
+|                                                                            |
+|  INPUTS:                                                                   | 
+|  Mutex          struct              Input data structure                   |
+|                                                                            |
+|                                                                            |
+|  OUTPUTS:                                                                  | 
+|                                                                            |
+|             None                                                           | 
+|                                                                            |
+|  NOTES:                                                                    | 
+|                                                                            |
+|   Date      Programmer    Description                                      | 
+|  ========   ============  ===============================================  | 
+|  08/21/01   A.Muslimov    Original development.                            |
+|  08/27/01   A.Muslimov    Added appropriate error handlings.               |
+|                                                                            |
+|  END_PROLOG                                                                | 
+----------------------------------------------------------------------------*/
+herr_t   
+HE5_TSmutexlock(HE5_HDFE_MutexStruct *Mutex)
+{
+  herr_t   status = SUCCEED;
+#ifdef  _HDFEOS5_THREADSAFE
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];
+#ifdef  _HDFEOS5_THREADSAFE_DEBUG
+  time_t   lockTime;
+#endif
+
+  status = FAIL;
+
+  /* Initialize the mutex */
+  /* -------------------- */
+  HE5_FIRST_THREAD_INIT
+
+  /* Check the initialization */
+  /* ------------------------ */
+  if (status != SUCCEED)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Failed to initialize the mutex.\n");
+	  H5Epush(__FILE__, "HE5_TSmutexlock", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf);
+	  return(status);
+	}	
+
+#ifdef  _HDFEOS5_THREADSAFE_DEBUG
+  time(&lockTime);
+  printf("Attempt to lock mutex ... Time = %lf \n", (double)lockTime);
+#endif
+
+  /* Lock the mutex */
+  /* -------------- */
+  status = pthread_mutex_lock(&Mutex->Lock);
+  if (status != SUCCEED)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Failed to lock the mutex.\n");
+	  H5Epush(__FILE__, "HE5_TSmutexlock", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf);
+	  return(status);
+	}
+  
+  /* Find out if the mutex is locked and who owns the lock */
+  /* ----------------------------------------------------- */
+  if (Mutex->MasterThread && pthread_equal(pthread_self(), *Mutex->MasterThread)){
+	/* already owned by self -- increment count */
+	/* ---------------------------------------- */
+	Mutex->LockCount++;
+  } else if (!Mutex->MasterThread) {
+	/* No one else has locked it -- set owner and get lock */
+	/* --------------------------------------------------- */
+	Mutex->MasterThread = (pthread_t *)malloc(sizeof(pthread_t));
+	if (Mutex->MasterThread == (pthread_t *)NULL)
+	  {
+		status = FAIL;
+		sprintf(errbuf, "Cannot allocate memory for master thread ID.\n");
+		H5Epush(__FILE__, "HE5_TSmutexlock", __LINE__, H5E_RESOURCE, H5E_BADRANGE, errbuf);
+		return(status);
+	  }
+
+	*Mutex->MasterThread = pthread_self();
+	Mutex->LockCount = 1;
+  } else {
+	/* if already locked by someone else */
+	/* --------------------------------- */
+	for (;;) {
+	  status = pthread_cond_wait(&Mutex->CondVar, &Mutex->Lock);
+	  if (status != SUCCEED)
+		{
+		  status = FAIL;
+		  sprintf(errbuf, "Failed to block the thread on condition variable.\n");
+		  H5Epush(__FILE__, "HE5_TSmutexlock", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf);
+		  return(status);
+		}
+
+	  if (!Mutex->MasterThread) {
+		Mutex->MasterThread = (pthread_t *)malloc(sizeof(pthread_t));
+		if (Mutex->MasterThread == (pthread_t *)NULL)
+		  {
+			status = FAIL;
+			sprintf(errbuf, "Cannot allocate memory for master thread ID.\n");
+			H5Epush(__FILE__, "HE5_TSmutexlock", __LINE__, H5E_RESOURCE, H5E_BADRANGE, errbuf);
+			return(status);
+		  }		
+#ifdef  _HDFEOS5_THREADSAFE_DEBUG
+		time(&lockTime);
+		printf("Locking mutex ... Time = %lf \n", (double)lockTime);
+#endif
+		*Mutex->MasterThread = pthread_self();
+		Mutex->LockCount = 1;
+		break;
+	  }
+	}
+  }
+  
+
+  /* Unlock the mutex */
+  /* ---------------- */
+  status = pthread_mutex_unlock(&Mutex->Lock);
+  if (status != SUCCEED)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Failed to unlock the mutex.\n");
+	  H5Epush(__FILE__, "HE5_TSmutexlock", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf);
+	}
+#ifdef  _HDFEOS5_THREADSAFE_DEBUG
+  time(&lockTime);
+  printf("Locking mutex ... Time = %lf \n", (double)lockTime);
+#endif
+#endif
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------
+|  BEGIN_PROLOG                                                              | 
+|                                                                            |
+|  FUNCTION: HE5_TSmutexunlock                                               | 
+|                                                                            | 
+|  DESCRIPTION : This function unlocks the mutex.                            |
+|                                                                            |
+|                                                                            |
+|  Return Value    Type     Units     Description                            | 
+|  ============   ======  =========   =====================================  |
+|  status         herr_t              Return status variable                 |
+|                                                                            |
+|  INPUTS:                                                                   | 
+|  Mutex          struct              data structure                         |
+|                                                                            |
+|                                                                            |
+|  OUTPUTS:                                                                  | 
+|                                                                            |
+|             None                                                           | 
+|                                                                            |
+|  NOTES:                                                                    | 
+|                                                                            |
+|   Date      Programmer    Description                                      | 
+|  ========   ============  ===============================================  | 
+|  08/21/01   A.Muslimov    Original development.                            |
+|  08/27/01   A.Muslimov    Added appropriate error handlings.               |
+|                                                                            |
+|  END_PROLOG                                                                | 
+----------------------------------------------------------------------------*/
+herr_t   
+HE5_TSmutexunlock(HE5_HDFE_MutexStruct *Mutex)
+{
+  herr_t   status = SUCCEED;
+#ifdef  _HDFEOS5_THREADSAFE
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];
+#ifdef  _HDFEOS5_THREADSAFE_DEBUG
+  time_t   unlockTime;
+#endif  
+
+  status = FAIL;
+
+  /* Lock the mutex */
+  /* -------------- */
+  status = pthread_mutex_lock(&Mutex->Lock);
+  if (status != SUCCEED)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Failed to unlock the mutex.\n");
+	  H5Epush(__FILE__, "HE5_TSmutexunlock", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf);
+	  return(status);
+	}
+  Mutex->LockCount--;
+  
+  if (Mutex->LockCount == 0)
+	{
+	  free(Mutex->MasterThread);
+	  Mutex->MasterThread = NULL;
+	  status = pthread_cond_signal(&Mutex->CondVar);
+	  if (status != SUCCEED)
+		{
+		  status = FAIL;
+		  sprintf(errbuf, "Failed to unblock the thread blocked on a condition variable.\n");
+		  H5Epush(__FILE__, "HE5_TSmutexunlock", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf);
+		  return(status);
+		}
+	}
+
+  /* Unlock the mutex */
+  /* ---------------- */
+  status = pthread_mutex_unlock(&Mutex->Lock);
+  if (status != SUCCEED)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Failed to unlock the mutex.\n");
+	  H5Epush(__FILE__, "HE5_TSmutexunlock", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf);
+	}
+#ifdef  _HDFEOS5_THREADSAFE_DEBUG
+  time(&unlockTime);
+  printf("Unlocking mutex ... Time = %lf \n", (double)unlockTime);
+#endif
+#endif
+  return(status);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/ZAapi.c b/src/ZAapi.c
new file mode 100755
index 0000000..c9733a8
--- /dev/null
+++ b/src/ZAapi.c
@@ -0,0 +1,16954 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 2002  Emergent IT Inc.  and Raytheon Systems Company    |
+ |                                                                          |
+ |  Permission to use, modify, and distribute this software and its         |
+ |  documentation for any purpose without fee is hereby granted, provided   |
+ |  that the above copyright notice appear in all copies and that both that |
+ |  copyright notice and this permission notice appear in supporting        |
+ |                          documentation.                                  |
+ ----------------------------------------------------------------------------
+ */
+
+#include <HE5_HdfEosDef.h>
+
+
+#define HE5_ZAIDOFFSET 671088642
+#define HE5_NZA              200
+ 
+/* ZA Structure External Arrays */
+struct HE5_zaStructure
+{
+  hid_t         fid;                     /* HDF-EOS file ID                  */
+  hid_t         obj_id;                  /* "ZAS" group ID                   */
+  hid_t         za_id;                   /* specified za group ID            */
+  hid_t         data_id;                 /* "Data Fields" group ID           */
+  hid_t         plist;                   /* current dataset creation property*/
+ 
+  int           active;                  /* Flag: file active or not         */
+  int           compcode;                /* compression mode                 */
+  int           compparm[5];             /* compression level                */
+ 
+  HE5_DTSinfo   *ddataset;               /* pointer to Data field info       */
+ 
+  long          nDFLD;                   /* number of data fields            */
+ 
+  char          zaname[HE5_OBJNAMELENMAX];/* za name                         */
+};
+ 
+struct HE5_zaStructure HE5_ZAXZa[HE5_NZA];
+ 
+
+/* INTERNAL FUNCTION PROTOTYPES */
+
+int HE5_szip_can_encode(void );
+static herr_t
+HE5_ZAchkzaid(hid_t zaID, const char *routname, hid_t *fid, hid_t *gid,  long *idx);
+static long
+HE5_ZAinqfield(hid_t zaID, char *datafield, char *fieldlist, int rank[], hid_t ntype[]);
+static size_t
+HE5_ZAfieldsizeID(hid_t zaID, char *fieldname, hid_t *fieldID);
+static herr_t
+HE5_ZAdefinefield(hid_t zaID, char *datafield, const char *fieldname, char *dimlist, char *maxdimlist, hid_t typeID);
+static herr_t
+HE5_ZAwrrdfield(hid_t zaID, char *fieldname, char *code, const hssize_t start[], const hsize_t stride[], const hsize_t count[],  void * datbuf);
+static herr_t
+HE5_ZAfldinfo(hid_t zaID, char *datafield, char *fieldname, int *rank, hsize_t dims[], hid_t ntype[], char *dimlist, char *maxdimlist);
+static int 
+HE5_ZAfldnameinfo(hid_t zaID, char *fieldname, char *fldactualname);
+
+
+/* FORTRAN WRAPPER PROTOTYPES */
+
+
+/* File/ZA access routines */
+
+int
+HE5_ZAopenF(char *filename, int flags);
+int 
+HE5_ZAcreateF(int fileID, char *zaname);
+int 
+HE5_ZAattachF(int fileID, char *zaname);
+int
+HE5_ZAdetachF(int zaID);
+int 
+HE5_ZAcloseF(int fileID);
+
+
+/* Definition routines */
+
+int
+HE5_ZAdefdimF(int zaID,  char *dimname, long dim);
+int 
+HE5_ZAdefineF(int zaID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int numtype);
+int
+HE5_ZAdefchunkF(int zaID, int ndims, long *dim);
+int   
+HE5_ZAdefcompF(int zaID, int compcode,  int *compparm);
+int   
+HE5_ZAdefcomchunkF(int zaID, int compcode, int *compparm, int rank, long *dim);
+int    
+HE5_ZAfldrenameF(int zaID, char *oldfieldname, char *newfieldname);
+
+
+/* I/O routines */
+
+int
+HE5_ZAwriteF(int zaID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *data);
+int
+HE5_ZAwritecharF(int zaID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *data);
+int
+HE5_ZAreadF(int zaID, char *fieldname, long fortstart[],  long fortstride[], long fortedge[], void *buffer);
+int
+HE5_ZAreadcharF(int zaID, char *fieldname, int elemlen, int numelem, long fortstart[],  long fortstride[], long fortedge[], void *buffer);
+int
+HE5_ZAsetfill(int zaID, char *fieldname, int ntype, void *fillval);
+int
+HE5_ZAgetfill(int zaID, char *fieldname, void *fillval);
+int
+HE5_ZAwrattr(int zaID, char *attrname, int ntype, long fortcount[], void * datbuf);
+int
+HE5_ZAwrgattr(int zaID, char *attrname, int ntype, long fortcount[], void *datbuf);
+int
+HE5_ZAwrlattr(int zaID, char *fieldname, char *attrname, int ntype, long fortcount[], void *datbuf);
+int    
+HE5_ZArdattr(int zaID, char *attrname, void *datbuf);
+int    
+HE5_ZArdgattr(int zaID, char *attrname, void *datbuf);
+int    
+HE5_ZArdlattr(int zaID, char *fieldname, char *attrname, void *datbuf);
+int    
+HE5_ZAsetaliasF(int zaID, char *fieldname, char *fortaliaslist);
+int    
+HE5_ZAdropaliasF(int zaID, int fldgroup, char *aliasname);
+
+
+/* Inquiry routines */
+
+long 
+HE5_ZAinqzaF(char *filename, char *zalist, long *strbufsize);
+long 
+HE5_ZAnentriesF(int zaID, int entrycode, long *strbufsize);
+long 
+HE5_ZAdiminfoF(int zaID, char *dimname);
+int
+HE5_ZAinfoF(int zaID, char *fieldname, int *rank, long dims[], int *ntype, char *fortdimlist, char *fortmaxdimlist);
+long
+HE5_ZAinqdimsF(int zaID, char *dimlist, long dims[]);
+long 
+HE5_ZAinquireF(int zaID, char *fieldlist, int rank[], int ntype[]);
+int
+HE5_ZAatinfo(int zaID, char *attrname, int *ntype, long *fortcount);
+int
+HE5_ZAgatinfo(int zaID, char *attrname, int *ntype, long *fortcount);
+int
+HE5_ZAlatinfo(int zaID, char *fieldname, char *attrname, int *ntype, long *fortcount);
+long 
+HE5_ZAinqattrsF(int zaID, char *attrnames, long *strbufsize);
+long 
+HE5_ZAinqgattrs(int zaID, char *attrnames, long *strbufsize);
+long 
+HE5_ZAinqlattrs(int zaID, char *fieldname, char *attrnames, long *strbufsize);
+int 
+HE5_ZAcompinfoF(int zaID, char *fieldname, int *compcode, int compparm[]);
+int   
+HE5_ZAidtype(int zaID, char *fieldname, char *attrname, int fieldgroup, int *Type, int *Class, int *Order, long *size);
+int    
+HE5_ZAaliasinfoF(int zaID, int fldgroup, char *aliasname, int *length, char *buffer);
+long
+HE5_ZAinqfldaliasF(int zaID, char *fldalias, long *strbufsize);
+int
+HE5_ZAchunkinfoF(int zaID, char *fieldname, int *ndims, long dims[]);
+long
+HE5_ZAgetaliaslistF(int zaID, int fldgroup, char *aliaslist, long *strbufsize);
+
+
+/* EXTERNAL DATA FILE INTERFACE */
+ 
+int
+HE5_ZAsetextdataF(int zaID, char *fortfilelist, long offset[], long size[]);
+int
+HE5_ZAgetextdataF(int zaID, char *fieldname, long namelength, char *fortfilelist, long offset[], long size[]);
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAopen                                                       |
+|                                                                             |
+|  DESCRIPTION: Opens or creates HDF-EOS file in order to create, read,       |
+|               or write a ZA.                                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|     fid         hid_t    None       HDF-EOS file ID                         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|     filename    char*    None       File name string                        |
+|     flags       uintn    None       File access code                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|     None                                                                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date       Programmer   Description                                       |
+|  ========   ============  ================================================= |
+|  Jul 02      S.ZHAO       Original development                              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t
+HE5_ZAopen(const char *filename, uintn flags)
+{
+  hid_t     fid      = FAIL;/* hdf5 type file ID      */
+ 
+  char      *errbuf  = NULL;/* Error message buffer   */
+ 
+ 
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAopen", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+ 
+      return(FAIL);
+    }
+ 
+  /* Call HE5_EHopen to open file */
+  /* ---------------------------- */
+  fid = HE5_EHopen(filename,flags, H5P_DEFAULT );
+  if(fid == FAIL)
+    {
+      sprintf(errbuf, "Cannot open the file \"%s\". Check the file name. \n", filename);
+      H5Epush(__FILE__, "HE5_ZAopen", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+  free(errbuf);
+ 
+  return (fid);
+}
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAcreate                                                     |
+|                                                                             |
+|  DESCRIPTION: Creates a new ZA structure and returns ZA ID                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|   zaID          hid_t        None        ZA structure ID                    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|   fid           hid_t        None        HDF-EOS file ID                    |
+|   zaname        const char*  None        za name string                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|   None                                                                      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t
+HE5_ZAcreate(hid_t fid, const char *zaname)
+{
+  hid_t           zaID           = FAIL;  /* return value of ZA ID          */
+  hid_t           HDFfid         = FAIL;  /* HDF-EOS file ID                */
+  hid_t           gid            = FAIL;  /* "HDFEOS" group ID              */
+  hid_t           za_id          = FAIL;  /* HDF-EOS ZA ID                  */
+  hid_t           data_id        = FAIL;  /* "Data Fields" group ID         */
+  hid_t           ZAS_ID         = FAIL;  /* "ZAS" group ID                 */
+  hid_t           i;                      /* Loop index                     */
+ 
+  int             nzaopen        = 0;     /* # of za structures open        */
+ 
+  herr_t          status         = FAIL;  /* routine return status variable */
+ 
+  uintn           access         = 0;     /* Read/Write file access code    */
+ 
+  long            nza            = FAIL;  /* za counter                     */
+ 
+  char            *errbuf =(char *)NULL;  /* Buffer for error message       */
+  char            *utlbuf =(char *)NULL;  /* Utility buffer                 */
+  char            *utlbuf2=(char *)NULL;  /* Utility buffer 2               */
+ 
+  HE5_LOCK;
+  CHECKNAME(zaname);
+ 
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf = (char *)calloc( HE5_HDFE_DIMBUFSIZE, sizeof(char ) ) ;
+  if ( errbuf == NULL )
+    {
+      H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+ 
+  /*
+   * Check HDF-EOS file ID, get  HDFEOS group ID  and
+   * access code
+   */
+  status = HE5_EHchkfid(fid, "HE5_ZAcreate", &HDFfid,  &gid, &access);
+  /* Check file access */
+  /* -------------------------- */
+  if ( access == 0 )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot call HE5_ZAcreate on a file opened read-only.\n");
+      H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for file ID failed.\n");
+      H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+ 
+      return(FAIL);
+    }
+ 
+
+  /* Check zaname for length */
+  /* ----------------------- */
+  if ( strlen(zaname) > HE5_OBJNAMELENMAX)
+    {
+      sprintf(errbuf, "za name \"%s\" must be less than %d characters.\n", zaname, HE5_OBJNAMELENMAX);
+      H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+ 
+      return(FAIL);
+    }
+ 
+ 
+  /* Determine number of zas currently opened */
+  /* ---------------------------------------- */
+  for (i = 0; i < HE5_NZA; i++)
+    nzaopen += HE5_ZAXZa[i].active;
+ 
+  if(nzaopen <  HE5_NZA)
+    {
+ 
+      /* Probe , check if "ZAS" group exists */
+      /* ----------------------------------- */
+      H5E_BEGIN_TRY {
+	ZAS_ID = H5Gopen(gid, "ZAS");
+      }
+      H5E_END_TRY;
+ 
+      if(ZAS_ID == FAIL )
+	{
+	  nza = 0;
+ 
+	  /* Create the "ZAS" group */
+	  /* ---------------------- */
+	  ZAS_ID = H5Gcreate(gid,"ZAS",0);
+	  if(ZAS_ID == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot create the \"ZAS\" group.\n");
+	      H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+ 
+	      return(FAIL);
+	    }
+ 
+	}
+      else
+	{
+	  /* Probe , check if zaname group exist */
+	  /* ----------------------------------- */
+	  H5E_BEGIN_TRY{
+	    za_id = H5Gopen(ZAS_ID, zaname);
+	  }
+	  H5E_END_TRY;
+ 
+	  if( za_id == FAIL )
+	    {
+	      /* Get the number of zas in "ZAS" group */
+	      /* ------------------------------------ */
+	      nza = HE5_EHdatasetcat(fid, "/HDFEOS/ZAS", NULL, NULL);
+	      if (nza == FAIL)
+		{
+		  sprintf(errbuf,"Cannot retrieve the number of zas.\n");
+		  H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  status = H5Gclose(ZAS_ID);
+		  free(errbuf);
+ 
+		  return(FAIL);
+		}
+ 
+	    }
+	  else
+	    {
+	      sprintf(errbuf, "za \"%s\" already exists.\n", zaname);
+	      H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_OHDR, H5E_EXISTS, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      status = H5Gclose(ZAS_ID);
+	      free(errbuf);
+ 
+	      return(FAIL);
+	    }
+ 
+	}
+ 
+ 
+      /* za does not exist */
+      /* ----------------- */
+ 
+ 
+      /* Create zaname group */
+      /* ------------------- */
+      za_id = H5Gcreate( ZAS_ID, zaname, 0);
+      if(za_id == FAIL)
+	{
+	  sprintf(errbuf,"Cannot create the \"%s\" group.\n", zaname);
+	  H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  status = H5Gclose(ZAS_ID);
+	  free(errbuf);
+ 
+	  return(FAIL);
+	}
+ 
+ 
+      /* Create /ZA/zaname/Data Fields group */
+      /* ----------------------------------- */
+      data_id = H5Gcreate( za_id, "Data Fields", 0);
+      if(data_id == FAIL)
+	{
+	  sprintf(errbuf,"Cannot create the \"Data Fields\" group.\n");
+	  H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  status = H5Gclose(ZAS_ID);
+	  free(errbuf);
+ 
+	  return(FAIL);
+	}
+ 
+ 
+      /* Allocate memory for utility buffers */
+      /* ----------------------------------- */
+      utlbuf  = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char ) ) ;
+      if ( utlbuf == NULL )
+	{
+	  H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for utility buffer.\n");
+	  HE5_EHprint("Error: Cannot allocate memory for utility buffer, occured", __FILE__, __LINE__);
+	  status = H5Gclose(ZAS_ID);
+	  free(errbuf);
+ 
+	  return(FAIL);
+	}
+      utlbuf2 = (char *)calloc(HE5_HDFE_UTLBUFSIZE,  sizeof(char ) ) ;
+      if ( utlbuf2 == NULL )
+	{
+	  H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE,"Cannot allocate memory for utility buffer2.\n");
+	  HE5_EHprint("Error: Cannot allocate memory for utility buffer2, occured", __FILE__, __LINE__);
+	  status = H5Gclose(ZAS_ID);
+	  free(errbuf);
+	  free(utlbuf);
+ 
+	  return(FAIL);
+	}
+ 
+ 
+      /* Establish za in "Structural MetaData" Block */
+      /* ------------------------------------------- */
+      sprintf(utlbuf, "%s%li%s%s%s", "\tGROUP=ZA_", nza + 1, "\n\t\tZaName=\"", zaname, "\"\n");
+      strcat(utlbuf, "\t\tGROUP=Dimension\n");
+      strcat(utlbuf, "\t\tEND_GROUP=Dimension\n");
+      strcat(utlbuf, "\t\tGROUP=DimensionMap\n");
+      strcat(utlbuf, "\t\tEND_GROUP=DimensionMap\n");
+      strcat(utlbuf, "\t\tGROUP=IndexDimensionMap\n");
+      strcat(utlbuf, "\t\tEND_GROUP=IndexDimensionMap\n");
+      strcat(utlbuf, "\t\tGROUP=DataField\n");
+      strcat(utlbuf, "\t\tEND_GROUP=DataField\n");
+      sprintf(utlbuf2, "%s%li%s","\tEND_GROUP=ZA_", nza + 1, "\n");
+      strcat(utlbuf, utlbuf2);
+ 
+      /* Insert metadata buffer to the "StructMetadata" */
+      /* ---------------------------------------------- */
+      status = HE5_EHinsertmeta(fid, (char*)zaname, "z", 1004L, utlbuf, NULL);
+      if (status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot insert metadata buffer to \"StructMetadata\".\n");
+	  H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  status = H5Gclose(ZAS_ID);
+	  free(errbuf);
+	  free(utlbuf);
+	  free(utlbuf2);
+ 
+	  return(FAIL);
+	}
+ 
+      /* Release "ZAS" group ID */
+      /* ---------------------- */
+ 
+      status = H5Gclose(ZAS_ID);
+      if(status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the \"ZAS\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  status = H5Gclose(ZAS_ID);
+	  free(utlbuf);
+	  free(utlbuf2);
+	  free(errbuf);
+ 
+	  return(FAIL);
+	}
+ 
+ 
+      /* Assign zaID & Load za and ZAXZa table entries */
+      /* --------------------------------------------- */
+      for (i = 0; i < HE5_NZA; i++)
+	{
+	  if (HE5_ZAXZa[i].active == 0)
+	    {
+	      /*
+	       * Set za_id, Set za entry active, Store root group
+	       * ID, Store sub group IDs, Store HDF-EOS file ID
+	       */
+	      HE5_ZAXZa[i].active                     = 1;
+	      HE5_ZAXZa[i].za_id                      = za_id;
+	      HE5_ZAXZa[i].data_id                    = data_id;
+	      HE5_ZAXZa[i].fid                        = fid;
+	      HE5_ZAXZa[i].obj_id                     = ZAS_ID;
+	      HE5_ZAXZa[i].plist                      = FAIL;
+	      strcpy(HE5_ZAXZa[i].zaname, zaname);
+	      HE5_ZAXZa[i].compcode                   = HE5_HDFE_COMP_NONE;
+	      zaID                                    = i + HE5_ZAIDOFFSET;
+	      break;
+	    }
+	}
+    }
+  else
+    {
+      /* Too many files opened */
+      /* --------------------- */
+      zaID = FAIL;
+      sprintf(errbuf,"\n Illegal attempt to open more than %d zas simultaneously.\n", HE5_NZA);
+      H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_OHDR, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+ 
+  /* Release allocated memory */
+  /* ------------------------ */
+  free(errbuf);
+  free(utlbuf);
+  free(utlbuf2);
+ 
+ COMPLETION:
+ 
+  HE5_UNLOCK;
+  return (zaID);
+}
+ 
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAattach                                                     |
+|                                                                             |
+|  DESCRIPTION:  Attaches to an existing za within the file.                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  zaID           hid_t               ZA structure ID                         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               HDF-EOS file ID                         |
+|  zaname         const char*         ZA structure name                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|             The iteration over the "Data Fields" group has the followings   |
+|             side effect:  it counts as an object (which is supposed to be   |
+|             a dataset) the group "Ragged Arrays". So the external structure |
+|             "ddataset" gets filled with  a fake member and nDFLD gets       |
+|             incremented by one. This shouldn't affect the other interfacing |
+|             routines unless someone tries to  access the datasets in "Data  |
+|             Fields" group directly through their IDs retrieved from external|
+|             "ddataset" structure, or use "nDFLD" data member of to retrieve |
+|             the actual number of data sets (fields).  To avoid potential    |
+|             problems, the dataset counter is decremented by one and the     |
+|             corresponding error checking are inserted to handle this case.  |
+|                                                                             |
+|                                                                             |
+|   Date        Programmer    Description                                     |
+|  =========   ============  ==============================================   |
+|  Jul 02       S.ZHAO        Original development                            |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t
+HE5_ZAattach(hid_t fid, const char *zaname)
+{
+ 
+  hid_t           zaID       = FAIL;/* ZA ID (return value)          */
+  hid_t           i;                /* Loop index                    */
+  hid_t           emptyslot  =  0;  /* Spare za index                */
+ 
+  herr_t          status     = FAIL;/* Return status variable        */
+ 
+  int             nzaopen =  0;     /* # of za structures open       */
+  int             idx        = FAIL;/* return value from an operator */
+ 
+  uintn           acs        = 0;   /* Read/Write file access code   */
+ 
+  hid_t           HDFfid     = FAIL;/* HDF-EOS file ID               */
+  hid_t           datid      = FAIL;/* Dataset ID                    */
+  hid_t           gid        = FAIL;/* "HDFEOS" group ID             */
+  hid_t           data_id    = FAIL;/* "Data Fields" Group ID        */
+  hid_t           za_id      = FAIL;/* za ID                         */
+ 
+ 
+  HE5_OBJINFO     inout;         /* IN/OUT operator data             */
+ 
+  char            *grpname =NULL;/* Ptr to a group  name string      */
+  char            *tmpname =NULL;/* ..... temporary name   ...       */
+  char            *namebuf =NULL;/* ..... temporary buffer name ...  */
+  char            *fldname =NULL;/* ..... temporary field name ...   */
+  char            *comma   =NULL;
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer*/
+ 
+ 
+  HE5_LOCK;
+  CHECKPOINTER(zaname);
+ 
+  /* Check HDF-EOS file ID, get back HDF file ID and access code */
+  /* ----------------------------------------------------------- */
+  status = HE5_EHchkfid(fid, "HE5_ZAattach", &HDFfid, &gid, &acs);
+  if ( status == FAIL )
+    {
+      H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_ARGS, H5E_BADRANGE, "Checking for file ID failed.\n");
+      HE5_EHprint("Error: Checking for file ID failed, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Determine number of zas currently opened */
+  /* ---------------------------------------- */
+  for (i = 0; i < HE5_NZA; i++)
+    nzaopen += HE5_ZAXZa[i].active;
+ 
+  /* Check there is a room for more */
+  /* ------------------------------ */
+  if (nzaopen < HE5_NZA)
+    {
+      /* Search for group "/ZAS/zaname" */
+      /* ============================== */
+      grpname = (char *) calloc( (strlen(zaname)+40), sizeof(char) );
+      if (grpname == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for grpname.\n") ;
+	  H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+ 
+	  return(FAIL);
+	}
+ 
+      strcpy( grpname, "/HDFEOS/ZAS/");
+      strcat( grpname, zaname);
+ 
+      /*
+       * If group with zaname found, open the group, load tables
+       */
+      H5E_BEGIN_TRY{
+	za_id = H5Gopen(HDFfid, grpname);
+      }
+      H5E_END_TRY;
+ 
+      if( za_id == FAIL )
+	{
+	  sprintf(errbuf, "za \"%s\" does not exist within HDF-EOS file.\n",zaname) ;
+	  H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+ 
+	  return(FAIL);
+	}
+ 
+ 
+      /* Attach to "Data Fields" */
+      /* ======================= */
+      data_id = H5Gopen( za_id, "Data Fields");
+      if (data_id == FAIL)
+	{
+	  sprintf(errbuf, "Cannot open the \"Data Fields\" group. \n") ;
+	  H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+ 
+	  return(FAIL);
+	}
+ 
+ 
+      /* Setup External Arrays */
+      /* --------------------- */
+      for (i = 0; i < HE5_NZA; i++)
+	{
+	  /* Find empty entry in array */
+	  /* ------------------------- */
+	  if (HE5_ZAXZa[i].active == 0)
+	    {
+	      /* Set IDs, codes., etc */
+	      /* ==================== */
+	      HE5_ZAXZa[i].active           = 1;
+	      HE5_ZAXZa[i].data_id          = data_id;
+	      HE5_ZAXZa[i].fid              = fid;
+	      HE5_ZAXZa[i].za_id            = za_id;
+	      HE5_ZAXZa[i].plist            = FAIL;
+	      HE5_ZAXZa[i].compcode         = HE5_HDFE_COMP_NONE;
+ 
+	      zaID                          = i + HE5_ZAIDOFFSET;
+	      strcpy(HE5_ZAXZa[i].zaname, zaname);
+	      break;
+	    }
+	}
+      emptyslot = i;
+ 
+      /*  Access za "Data Fields" datasets   */
+      /* ----------------------------------- */
+      tmpname = (char *) calloc( (strlen(grpname)+ 20), sizeof(char));
+      if (tmpname == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for tmpname. \n") ;
+	  H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+ 
+	  return(FAIL);
+	}
+ 
+      strcpy(tmpname,grpname);
+      strcat(tmpname,"/Data Fields");
+ 
+ 
+      /* Get the number of OBJECTS in "Data Fields" group */
+      /* ================================================ */
+      inout.count   = 0;
+      inout.name    = NULL;
+      inout.strsize = 0;
+ 
+      idx = H5Giterate(data_id, tmpname , NULL, HE5_EHobj_info, &inout);
+      if ( idx == FAIL )
+	{
+	  sprintf(errbuf, "Iteration of \"HE5_EHobj_info()\" operation failed. \n") ;
+	  H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  free(tmpname);
+ 
+	  return(FAIL);
+	}
+ 
+      free(tmpname);
+ 
+      /* Set the data members of external structure */
+      /* ========================================== */
+      HE5_ZAXZa[emptyslot].nDFLD = inout.count;
+ 
+      /*------------------------------------------------------*/
+      /* Loop through all data field datasets and open it     */
+      /* Allocate space for namebuf, copy inout.name into it, */
+      /*              and append comma                        */
+      /*------------------------------------------------------*/
+      if( inout.name != NULL && inout.count > 0 )
+	{
+	  /* Allocate memory to ddataset struct */
+	  /* ---------------------------------- */
+	  HE5_ZAXZa[emptyslot].ddataset = (HE5_DTSinfo *)realloc((void *)HE5_ZAXZa[emptyslot].ddataset,(HE5_ZAXZa[emptyslot].nDFLD) * sizeof(HE5_DTSinfo));
+ 
+	  /* Allocate memory to the list of dataset names */
+	  /* -------------------------------------------- */
+	  namebuf = (char *) calloc(strlen(inout.name) + 2, sizeof(char));
+	  if (namebuf == NULL)
+	    {
+	      sprintf(errbuf, "Cannot allocate memory for namebuf. \n") ;
+	      H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(grpname);
+ 
+	      return(FAIL);
+	    }
+ 
+	  strcpy(namebuf, inout.name);
+	  strcat(namebuf, ",");
+ 
+	  /* Find comma */
+	  /* ---------- */
+	  comma = strchr(namebuf, ',');
+ 
+	  i = 0;
+ 
+	  /* Parse the list of dataset names */
+	  /* ------------------------------- */
+	  while (comma != NULL)
+	    {
+	      /* Allocate memory for fldname buffer */
+	      /* ---------------------------------- */
+	      fldname = (char *) calloc(comma - namebuf + 1, sizeof(char));
+	      if (fldname == NULL)
+		{
+		  sprintf(errbuf, "Cannot allocate memory for fldname. \n") ;
+		  H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(grpname);
+		  free(namebuf);
+ 
+		  return(FAIL);
+		}
+ 
+	      /* Copy field list entry to fldname */
+	      /* -------------------------------- */
+	      memmove(fldname, namebuf, comma - namebuf);
+	      fldname[comma-namebuf]=0;
+ 
+	      /* open dataset fldname */
+	      /* -------------------- */
+	      H5E_BEGIN_TRY{
+		datid = H5Dopen(data_id, fldname);
+	      }H5E_END_TRY;
+	      if ( datid == FAIL )
+		{
+		  sprintf(errbuf, "Cannot open the dataset \"%s\". \n",fldname );
+		  H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(grpname);
+		  free(namebuf);
+		  free(fldname);
+ 
+		  return(FAIL);
+		}
+ 
+	      /* allocate memory to the dataset name */
+	      /* ----------------------------------- */
+	      HE5_ZAXZa[emptyslot].ddataset[i].name = (char *)calloc((strlen(fldname)+1), sizeof(char));
+	      if (HE5_ZAXZa[emptyslot].ddataset[i].name == NULL)
+		{
+		  sprintf(errbuf, "Cannot allocate memory for the dataset name. \n") ;
+		  H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(grpname);
+		  free(namebuf);
+		  free(fldname);
+ 
+		  return(FAIL);
+		}
+ 
+	      /* Set the data members of external structure */
+	      /* ========================================== */
+	      HE5_ZAXZa[emptyslot].ddataset[i].ID = datid;
+	      strcpy(HE5_ZAXZa[emptyslot].ddataset[i].name, fldname);
+ 
+ 
+	      /* Go to next field entry, find next comma, ... */
+	      /* ============================================ */
+	      memmove(namebuf, comma + 1, strlen(comma + 1) + 1);
+	      comma = strchr(namebuf, ',');
+	      if (fldname != NULL) free(fldname);
+	      i++;
+ 
+	    }
+ 
+	  if (namebuf != NULL) free(namebuf);
+	  if(inout.name != NULL ) free( inout.name);
+ 
+	} /* end if(inout.name!=NULL) */
+    }
+  else
+    {
+      /* Too many zas opened */
+      /* ------------------- */
+      zaID = FAIL;
+      sprintf(errbuf,"\n Illegal attempt to open more than %d zas simultaneously. \n", HE5_NZA);
+      H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_OHDR, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  free (grpname);
+  return(zaID);
+}
+ 
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAchkzaid                                                    |
+|                                                                             |
+|  DESCRIPTION: Checks for valid zaID and returns file ID and                 |
+|               "HDFEOS" group ID                                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  routname       const char*         Routine name                            |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fid            hid_t*              HDF-EOS file ID                         |
+|  gid            hid_t*              "HDFEOS" Group ID                       |
+|  idx            long*               za index                                |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t
+HE5_ZAchkzaid(hid_t zaID, const char *routname, hid_t *fid, hid_t *gid, long *idx )
+{
+  herr_t            status    = FAIL;/* routine return status variable */
+ 
+  uintn             access    =  0;      /* Read/Write access code         */
+ 
+  hid_t             HDFfid    = FAIL;/* HDF-EOS file ID                */
+  hid_t             idOffset  = HE5_ZAIDOFFSET;
+ 
+  char              message1[] = "Invalid za id: %d in routine \"%s\".  ID must be >= %d and < %d.\n";
+  char              message2[] = "za id %d in routine \"%s\" not active.\n";
+  char              errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */
+ 
+ 
+  /* Check for valid za ID */
+  /* --------------------- */
+  if (zaID < idOffset || zaID >= HE5_NZA + idOffset)
+    {
+      status = FAIL;
+      sprintf(errbuf, message1, zaID, routname, idOffset, HE5_NZA + idOffset);
+      H5Epush(__FILE__, "HE5_ZAchkzaid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  else
+    {
+      /* Check for active za ID */
+      /* ---------------------- */
+      if (HE5_ZAXZa[zaID % idOffset].active == 0)
+        {
+	  status = FAIL;
+	  sprintf(errbuf,  message2, zaID, routname);
+	  H5Epush(__FILE__, "HE5_ZAchkzaid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+      else
+        {
+	  *idx = HE5_EHhid2long(zaID % idOffset);
+	  if (*idx == FAIL)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf,"Cannot set up the za index.\n");
+	      H5Epush(__FILE__, "HE5_ZAchkzaid", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+ 
+	  /* Get HDF file ID &  "HDFEOS" group ID */
+	  /* ------------------------------------ */
+	  *fid   = HE5_ZAXZa[*idx].fid;
+	  status = HE5_EHchkfid(*fid,"", &HDFfid, gid, &access);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf,"Checking for file ID failed.\n");
+	      H5Epush(__FILE__, "HE5_ZAchkzaid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+        }
+    }
+  return (status);
+}
+ 
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdefdim                                                     |
+|                                                                             |
+|  DESCRIPTION: Defines numerical value of dimension                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        Return status  (0) SUCCEED, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  dimname        char*               dimension name                          |
+|  dim            hsize_t             dimension size                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_ZAdefdim(hid_t zaID,  char *dimname, hsize_t dim)
+{
+  herr_t       status    = FAIL;/* routine return status variable  */
+  
+  hid_t        fid       = FAIL;/* HDF-EOS file ID                 */
+  hid_t        gid       = FAIL;/* "HDFEOS" group ID               */
+  
+  long         idx       = FAIL;/* za index                        */
+  
+  char         errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+  
+  HE5_LOCK;
+  CHECKNAME(dimname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAdefdim", &fid, &gid, &idx); 
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for za ID failed.\n");
+      H5Epush(__FILE__, "HE5_ZAdefdim", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Make certain that dim != 0 */
+  /* -------------------------- */
+  if ( dim == 0 )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Invalid (zero) dimension size.\n");
+      H5Epush(__FILE__, "HE5_ZAdefdim", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  
+  /* Write dimension to the dataset "StructMetadata.0" */
+  /* ------------------------------------------------- */
+  status = HE5_EHinsertmeta(fid, HE5_ZAXZa[idx].zaname,"z", 0L, dimname, &dim);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot insert the value for \"%s\" dimension into Metadata.\n", dimname);
+      H5Epush(__FILE__, "HE5_ZAdefdim", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdefdimscale                                                |
+|                                                                             |
+|  DESCRIPTION: Defines dimension scale for all fields that use the given     |
+|               dimesion                                                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  dimname        char                dim name                                |
+|  dimsize        hsize_t             Dimemsion size value                    |
+|  numbertype_in  hid_t               dim scale data type such as DFNT_INT32, |
+|                                     DFNT_FLOAT64, DFNT_FLOAT32, etc.        |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES: This function finds out which field in a ZA has the dimension       |
+|         and sets dimension scale for that field calling HE5_ZAsetdimscale() |
+|         User must detach ZA after creating fields and attach again before   |
+|         calling the routine.                                                |
+|                                                                             |
+|                                                                             |
+|   Date      Programmer    Description                                       |
+|  ========   ============  ===============================================   |
+|  Dec 2013   Abe Taaheri   Original Programmer                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_ZAdefdimscale(hid_t zaID,  char *dimname,
+		  const hsize_t dimsize, hid_t numbertype_in, void * data)
+{
+  herr_t       status    = FAIL;/* routine return status variable  */
+  hid_t        fid       = FAIL;/* HDF-EOS file ID                 */
+  hid_t        gid       = FAIL;/* "HDFEOS" group ID               */
+  long         idx       = FAIL;/* Swath index                     */
+  char         errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+  char         *fieldlist = NULL;
+  long         strbufsize;
+  long         nflds   = FAIL;
+
+  HE5_LOCK;
+  CHECKNAME(dimname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */
+  /* ------------------------------------------------------ */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAdefdimscale", &fid, &gid, &idx); 
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for Za ID failed.\n");
+      H5Epush(__FILE__, "HE5_ZAdefdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Make certain that dimsize != 0 */
+  /* ------------------------------ */
+  if ( dimsize == 0 )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Invalid (zero) dimension size.\n");
+      H5Epush(__FILE__, "HE5_ZAdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+  /* Loop over all fields in the ZA and find out if 
+     field's dimension list  has the dimension name. 
+     If true then set the dimension scale for the dim 
+     in that field
+  */
+
+  /* Inquire Data Fields first*/
+  /* ------------------------ */
+  nflds = HE5_ZAnentries(zaID, HE5_HDFE_NENTDFLD, &strbufsize);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n");
+      H5Epush(__FILE__, "HE5_ZAdefdimscale", __LINE__, 
+	      H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else
+    {
+      fieldlist = (char *) calloc(strbufsize + 1, sizeof(char));
+      if(fieldlist == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory.\n");
+	  H5Epush(__FILE__, "HE5_ZAdefdimscale", __LINE__, 
+		  H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      nflds = HE5_ZAinqfield(zaID, "Data Fields", fieldlist, NULL, NULL);
+      if (nflds == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the list of fields in \"Data Fields\" group. \n");
+	  H5Epush(__FILE__, "HE5_ZAdefdimscale", __LINE__, 
+		  H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(fieldlist);
+	  return(FAIL);
+	}
+
+      if(nflds > 0)
+	{
+	  size_t        fldnmlen[HE5_FLDNUMBERMAX];      /* Array of namelengths */
+	  char          *fldnm[HE5_FLDNUMBERMAX];        /* Array of names       */
+	  char          tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list       */
+	  int           rank     = FAIL;                 /* Rank of dataset      */
+	  hsize_t	tempdims[HE5_DTSETRANKMAX];      /* Dimension sizes array*/
+	  hid_t         dtype[1] = {FAIL};               /* Data type            */
+	  long          ntflds   =  0;                   /* field counter        */
+	  int           i;
+	  char          *tempfield = NULL;
+	  unsigned int  Dimindex;
+
+	  ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen);
+	  if(ntflds != FAIL)
+	    {
+	      for(i = 0; i < ntflds; i++)
+		{
+		  tempfield      = (char *)calloc(fldnmlen[i] + 1, sizeof(char));
+		  memmove(tempfield,fldnm[i],fldnmlen[i]);
+		  tempfield[fldnmlen[i]]='\0';
+
+		  /* for this field see if the dimlist contains dimname */
+		  status = HE5_ZAfldinfo(zaID, "Data Fields", tempfield, &rank, tempdims, 
+					   dtype, tempdimlist, NULL);
+
+		  if (status != SUCCEED)
+		    {
+		      sprintf(errbuf, "Field \"%s\" not found.\n", tempfield);
+		      H5Epush(__FILE__, "HE5_ZAdefdimscale", __LINE__, H5E_ARGS, 
+			      H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(tempfield);
+		      free(fieldlist);
+		      return(FAIL);
+		    }
+
+		  Dimindex = FAIL;
+		  Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ',');
+		  if (Dimindex == FAIL) /* dimension not found */
+		    {
+		      continue; /*dimlist does not contain dim name */
+		    }
+		  else
+		    {
+		      /* call HE5_ZAsetdimscle */
+		      status = HE5_ZAsetdimscale(zaID, (char *)tempfield, 
+						 dimname,
+						 dimsize, 
+						 numbertype_in, 
+						 data);
+		      if ( status == FAIL )
+			{
+			  sprintf(errbuf,"Cannot set dimension scale %s for the field %s. \n", 
+				  dimname, tempfield);
+			  H5Epush(__FILE__, "HE5_ZAdefdimscale", __LINE__, 
+				  H5E_OHDR, H5E_NOTFOUND, errbuf);
+			  HE5_EHprint(errbuf, __FILE__, __LINE__);
+			  free(tempfield);
+			  free(fieldlist);
+			  return(status);
+			}
+		    }
+		}
+	      free(tempfield);
+	      tempfield = NULL;
+	    }
+	}
+      free(fieldlist);
+      fieldlist = NULL;
+    }
+
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAsetdimscale                                                |
+|                                                                             |
+|  DESCRIPTION: Defines a dimension scale for a fields dimension in a ZA      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fieldname      char                field name                              |
+|  dimname        char                Dimension name                          |
+|  dimsize        hsize_t             Dimemsion size value                    |
+|  numbertype_in  hid_t               dim scale data type such as DFNT_INT32, |
+|                                     DFNT_FLOAT64, DFNT_FLOAT32, etc.        |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|             None                                                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_ZAsetdimscale(hid_t zaID, char *fieldname, char *dimname,
+		  const hsize_t dimsize, hid_t numbertype_in, void * data)
+{
+  herr_t         status;
+  hid_t          ntype;
+  hsize_t        dims[HE5_DTSETRANKMAX];
+  int            rankSDS;
+  hid_t          field_ntype[1] = {FAIL};       /* number types       */ 
+  char           dimlist[HE5_HDFE_DIMBUFSIZE];
+  char           maxdimlist[HE5_HDFE_DIMBUFSIZE];
+
+  hid_t          fid    = FAIL; 	       /* HDF-EOS file ID     */
+  hid_t          gid    = FAIL;	               /* "HDFEOS"  group ID  */
+  hid_t          did;
+  hid_t          dsid;
+  hid_t          fspace   = FAIL;              /* File dataspace ID   */
+  unsigned int   Dimindex;
+  hid_t          dsplist  = FAIL;              /* Property list ID     */
+  H5D_layout_t   layout   = H5D_LAYOUT_ERROR;  /* Type of storage      */
+  hid_t          data_space  = FAIL;           /* dataspace ID         */
+  long           idx         = FAIL;           /* Grid index           */
+  char          *errbuf      = (char *)NULL;   /* buffer for error message*/
+  void          *data_buff;
+  int            i, found;
+  int            rankds;
+  hsize_t        dimsds[1];
+
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKNAME(dimname);
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer ", __FILE__, __LINE__);
+      return(FAIL);
+    }
+    
+  /* Convert HDF-EOS5 datatype to HDF5 datatype */
+  if (
+      H5Tequal(numbertype_in, H5T_NATIVE_CHAR)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SHORT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_INT)    == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UINT)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LONG)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LLONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_FLOAT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== SUCCEED ||
+      H5Tequal(numbertype_in, H5T_C_S1) == SUCCEED)
+    {
+      ntype = numbertype_in;
+    }
+  else
+    {
+      ntype = HE5_EHconvdatatype((int) numbertype_in);
+    }
+
+  if(ntype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID for dimscale\n");
+      H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /*
+**********************************************************
+*  Check for proper ZA ID and return HDF-EOS file ID,    * 
+*        "HDFEOS" group ID and ZA index                  *  
+**********************************************************
+*/
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAsetdimscale", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for ZA ID failed.\n");
+      H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  if (status == 0)
+    {
+      /* Check that field exists */
+      /* ----------------------- */
+      status = HE5_ZAinfo(zaID, fieldname, &rankSDS, dims, field_ntype, dimlist, maxdimlist);
+
+      if (status != 0)
+	{
+	  sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__,  H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+      
+      data_buff = data;
+      
+      /* Loop through all datasets in ZA */
+      /* ------------------------------ */
+	for (i = 0; i < HE5_ZAXZa[idx].nDFLD; i++)
+	  {
+	    /* Get dataset name */
+	    if( strcmp(fieldname, HE5_ZAXZa[ idx ].ddataset[ i ].name) == 0 )
+	      {
+		found = 1; 
+		did = HE5_ZAXZa[ idx ].ddataset[ i ].ID;
+		break;
+	      } 
+	  }
+	
+	if(found != 1) /* did not find fieldname */
+	  {
+	    sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname);
+	    H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__,  H5E_ARGS, H5E_BADRANGE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    return(FAIL);
+	  }
+	/* Dimension index */
+
+	Dimindex = FAIL;
+	Dimindex = HE5_EHstrwithin(dimname, dimlist, ',');
+	
+	if (Dimindex == FAIL) /* dimension not found */
+	  {
+	    status = FAIL;
+	    sprintf( errbuf, "Dimname \"%s\" does not exist for field \"%s\".\n", 
+		     dimname, fieldname );
+	    H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    free(errbuf);
+	    return(status);
+	  }
+	
+	/* If dimension found ... */
+	/* Found the dimname; Use its dimid to set Dimension Scale*/
+	
+	/* See if dimscale dataset already exist */
+	
+	dsid = H5Dopen(HE5_ZAXZa[idx].za_id, dimname);
+	if(dsid < 0)
+	  {
+	    /* create Dim Scale dataset */
+	    /* Try to open the " group */
+	    /* =================================== */
+	    
+	    dsplist = H5Pcreate(H5P_DATASET_CREATE);
+	    if(dsplist == FAIL)
+	      {
+		sprintf(errbuf,"Cannot create a new property list.\n");  
+		H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		return(FAIL);
+	      }
+	    /* Get layout information */
+	    /* ---------------------- */		
+	    layout = H5Pget_layout(dsplist);
+	    if(layout == H5D_LAYOUT_ERROR)
+	      {
+		sprintf(errbuf,"Cannot get layout information for the dataset.\n");  
+		H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		return(FAIL);
+	      }
+
+	    rankds = 1;
+	    dimsds[0] = dims[Dimindex];
+
+	    data_space = H5Screate_simple(rankds, dimsds, NULL);
+	    if(data_space == FAIL)
+	      {
+		sprintf(errbuf,"Cannot create dataspace for the dimension scale dataset.\n");  
+		H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		return(FAIL);
+	      }
+	    
+	    dsid = H5Dcreate(HE5_ZAXZa[idx].za_id,dimname,ntype, data_space, dsplist);
+	    
+	    if( dsid == FAIL )
+	      {
+		sprintf(errbuf, "Cannot create dataset for Dimension Scale \"%s\" field. \n", dimname);
+		H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		return(FAIL);
+	      }
+
+	    /* write data_buff to it */
+
+	    /* Get the field space ID */
+	    /* --------------------- */
+	    fspace = H5Dget_space(dsid);
+	    if ( fspace == FAIL)
+	      {
+		sprintf(errbuf, "Cannot get the file data space ID.\n");
+		H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		return(FAIL);
+	      }
+
+	    status = H5Dwrite(dsid, ntype, data_space, fspace,  H5P_DEFAULT, data_buff);
+	    if( status == FAIL )
+	      {
+		sprintf(errbuf,"Cannot write data to the dataset.\n");
+		H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		free(errbuf);
+		return(FAIL);
+	      }  
+	  }
+
+	/* Dataset exist. See if it is Dimension Scale already. If not make it */
+	if ((H5DSis_scale(dsid)) <= 0 )
+	  {
+	    status = H5DSset_scale(dsid, dimname);
+	    if( status < 0)
+	      {
+		status = -1;
+		free(errbuf);
+		goto COMPLETION;
+	      }
+	    
+	    if(H5DSattach_scale(did, dsid, Dimindex) < 0)
+	      {
+		status = -1;
+		free(errbuf);
+		goto COMPLETION;
+	      }
+	  }
+	else
+	  {
+	    if(H5DSattach_scale(did, dsid, Dimindex) < 0)
+	      {
+		status = -1;
+		free(errbuf);
+		goto COMPLETION;
+	      }
+	  }
+   
+	if( H5Dclose(dsid) < 0)
+	  {
+	    status = -1;
+	    free(errbuf);
+	    goto COMPLETION;
+	  }
+    }
+  free(errbuf);
+ COMPLETION:  
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAgetdimscale                                                |
+|                                                                             |
+|  DESCRIPTION: Get dimension scale for a dimension of a field in a ZA        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         long                return databuffsize  SUCCEED, (-1) FAIL |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fieldname      char                field name                              |
+|  dimname        char                dim name                                |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dimsize        hsize_t             dimension size                          |
+|  ntype          hid_t               dtata type of dimension scale           |
+|  databuff       void                data buffer for read                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_ZAgetdimscale(hid_t zaID, char *fieldname, char *dimname, 
+		  hsize_t *dimsize,hid_t *ntype, void * databuff)
+{
+  int             i,j;		                   /* Loop index             */
+  long            status;	                   /* routine return status  */
+  long            idx    = FAIL;                   /* ZA index               */
+  hid_t           fid    = FAIL; 	           /* HDF-EOS file ID        */
+  hid_t           gid    = FAIL;	           /* "HDFEOS"  group ID     */
+  hid_t           did    = FAIL;                   /* dataset ID             */
+  hid_t           dsid   = FAIL;                   /* dimscale dataset ID    */
+  hid_t           dspace = FAIL;                   /* data space ID          */
+  hid_t           mspace = FAIL;                   /* memory data space ID   */
+  hid_t           dtype  = FAIL;                   /* data type ID           */
+  hid_t           mtype  = FAIL;                   /* memory data type ID    */
+  H5T_class_t     classid = H5T_NO_CLASS;          /* Data type class ID     */
+  hsize_t         dimsds[HE5_DTSETRANKMAX];        /* Field dimensions       */
+  char           *errbuf = (char *)NULL;           /* buff for error message */
+  long            size   = 0;                      /* data buffer size(bytes)*/
+  int             rankds;
+  size_t          sd_type_size = 0;	           /* Size of a data type    */
+  unsigned int    Dimindex;
+  int             rankSDS;
+  hid_t           *field_ntype = (hid_t *)NULL;    /* number types           */
+  char            dimlist[HE5_HDFE_DIMBUFSIZE];
+  char            maxdimlist[HE5_HDFE_DIMBUFSIZE];
+  hsize_t         dims[HE5_DTSETRANKMAX];
+  int             found = 0;
+  htri_t          str_is_variable; /* boolean: TRUE if string is variable 
+				      lengeth FALSE if string is fixed length
+				      -1 if error in H5Tis_variavle_str() */
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKNAME(dimname);
+
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /*
+**********************************************************
+*  Check for proper ZA ID and return HDF-EOS file ID,    * 
+*        "HDFEOS" group ID and ZA index                  *  
+**********************************************************
+*/
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAgetdimscale", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for ZA ID failed.\n");
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* See if dimscale dataset exist */
+
+  dsid = H5Dopen(HE5_ZAXZa[idx].za_id, dimname);
+  if(dsid < 0)
+    {
+      status = FAIL;
+      sprintf( errbuf, "Dimension scale dataset \"%s\" does not exist.\n", 
+	       dimname);
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+
+  /* Loop through all datasets in ZA */
+  /* ------------------------------ */
+  for (i = 0; i < HE5_ZAXZa[idx].nDFLD; i++)
+    {
+      /* Get dataset name */
+      if( strcmp(fieldname, HE5_ZAXZa[ idx ].ddataset[ i ].name) == 0 )
+	{
+	  found = 1; 
+	  did = HE5_ZAXZa[ idx ].ddataset[ i ].ID;
+	  break;
+	}
+    }
+  if(found != 1) /* did not find fieldname */
+    {
+      sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__,  H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Check that field exists */
+  /* ----------------------- */
+  status = HE5_ZAinfo(zaID, fieldname, &rankSDS, dims, field_ntype, dimlist, maxdimlist);
+  
+  if (status != 0)
+    {
+      sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__,  H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* find the index of the dimension in the field */
+  Dimindex = FAIL;
+  Dimindex = HE5_EHstrwithin(dimname, dimlist, ',');
+  if (Dimindex == FAIL) /* dimension not found */
+    {
+      status = FAIL;
+      sprintf( errbuf, "Dimname \"%s\" does not exist for field \"%s\".\n", 
+	       dimname, fieldname );
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+
+  /* check that dimname is dimension scale name for the field dimname */
+  status = H5DSis_attached(did, dsid, Dimindex);
+
+  if( status < 0)
+    {
+      status = FAIL;
+      sprintf( errbuf, "Dimname \"%s\" is not dimension scale for a dimension in the field \"%s\".\n", dimname, fieldname );
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+
+  /* OK. dsid is a dimension scale for did. It is time to read Dimension 
+     Scale dataset for output */
+
+  /* get size first ... */
+  /* ------------------ */
+  dtype = H5Dget_type(dsid);
+  if ( dtype == FAIL )
+    {
+      size = 0;
+      sprintf(errbuf, "Cannot get data type ID.\n");
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Get data type size (bytes) */
+  /* -------------------------- */   
+  sd_type_size = H5Tget_size(dtype);
+  if ( sd_type_size == 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve data type size.\n");
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Get data space ID */
+  /* ----------------- */
+  dspace = H5Dget_space( dsid );
+  if (dspace == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the dataspace ID for the \"%s\" dataset.\n", dimname);
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /* Get dataset rank */
+  /* ---------------- */
+  rankds = H5Sget_simple_extent_ndims(dspace);
+  if ( rankds == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the dataset rank for the \"%s\" dataset.\n", dimname);
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /* Get dataset dimension sizes */
+  /* --------------------------- */
+  status = H5Sget_simple_extent_dims(dspace,dimsds, NULL);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the dataset dimension sizes for the \"%s\" dataset.\n", dimname);
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+
+  /*----------------------------------------------------------------------*/
+
+  /* Get data class ID */
+  /* ----------------- */
+  classid       = H5Tget_class(dtype);
+  if (classid == H5T_NO_CLASS)
+    {
+      sprintf(errbuf, "Cannot get the data type class ID for \"%s\" dataset.",
+	      dimname);
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, 
+	      H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (errbuf  != NULL) free(errbuf);
+      return(FAIL);
+    }
+  
+  if (classid == H5T_STRING)
+    {
+      /* HE5T_CHARSTRING has variable length for data fields */
+      str_is_variable = H5Tis_variable_str(dtype);
+      if(str_is_variable == TRUE)
+	{
+	  *ntype = HE5T_CHARSTRING;
+	}
+      else if(str_is_variable == FALSE)
+	{
+	  *ntype = HE5T_NATIVE_CHAR;
+	}
+      else
+	{
+	  sprintf(errbuf, "Failed to see if string field is varaible or fixed length for the \"%s\" field.\n",dimname);
+	  H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, 
+		  H5E_NOTFOUND, errbuf);
+	  
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (errbuf  != NULL) free(errbuf);
+	  return(FAIL);
+	}
+    }
+  else
+    {
+      *ntype = HE5_EHdtype2numtype(dtype);
+      if (*ntype == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the number type for \"%s\" dataset.", 
+		  dimname);
+	  H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, 
+		  H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (errbuf  != NULL) free(errbuf);
+	  return(FAIL);
+	}
+    }
+  /*----------------------------------------------------------------------*/
+
+  status = H5Tclose(dtype);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot release the datatype ID.\n");
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /* Release the dataspace ID */
+  /* ------------------------ */
+  status = H5Sclose(dspace);
+  if ( status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" dataset.\n", dimname);
+      H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+
+  size = (long)dimsds[ 0 ];
+  *dimsize = (hsize_t)size;
+
+  for (j = 1; j < rankds; j++)
+    size *= (long)dimsds[j];
+ 
+  size *= (long)sd_type_size;
+
+  /* If data values are requested ... */
+  /* -------------------------------- */
+  if (databuff != NULL)
+    {
+      /* Create a data space in memory */
+      /* ----------------------------- */ 		
+      mspace = H5Screate_simple(rankds, (const hsize_t *)dimsds, NULL);
+      if ( mspace == FAIL )
+	{
+	  sprintf(errbuf,"Cannot create the data space.\n");
+	  H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATASPACE, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      dspace = H5Dget_space(dsid );
+      if (dspace == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the dataspace ID for the \"%s\" dataset.\n", dimname);
+	  H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+		
+      dtype = H5Dget_type(dsid);
+      if ( dtype == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get the datatype ID.\n");
+	  H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      /* Get the memory data type ID */
+      /* --------------------------- */
+      mtype = HE5_EHdtype2mtype(dtype);
+      if ( mtype == FAIL )
+	{
+	  sprintf(errbuf,"Cannot get the memory data type.\n");
+	  H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      /* Read the selected points into the buffer */
+      /* ---------------------------------------  */
+      status = H5Dread(dsid, mtype, mspace, dspace, H5P_DEFAULT, databuff);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot read out the data from the dataset.\n");
+	  H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+				
+      status = H5Tclose(dtype);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the datatype ID.\n");
+	  H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+		
+      status = H5Sclose(mspace);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the memory data space ID.\n");
+	  H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+		
+      status = H5Sclose(dspace);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf,"Cannot release the file data space ID.\n");
+	  H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+	}
+    }
+
+  free(errbuf);
+ COMPLETION:
+  HE5_UNLOCK;
+  return (size);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAreaddscaleattr                                             |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with a dimension scale field       |
+|               from a ZA.                                                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t   None        HDF-EOS type ZA  ID                     |
+|  fieldname      char                field name                              |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 10   Abe Taaheri   Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t  
+HE5_ZAreaddscaleattr(hid_t zaID, const char *fieldname, const char *attrname, void *datbuf)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+
+  hid_t      ntype         = FAIL;/* hdf5 type data type ID         */
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      fieldID       = FAIL;/* Field-related dataset ID       */
+     
+  long       idx           = FAIL;/* ZA index                       */
+     
+  hsize_t    count[]={0};	  /* array with the number of elements */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer   */
+
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(attrname);
+
+  /*
+**********************************************************
+*  Check for proper ZA ID and return HDF-EOS file ID,    * 
+*        "HDFEOS" group ID and ZA index                  *  
+**********************************************************
+*/
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAreaddscaleattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get field ID */
+      /* ------------ */
+      fieldID = H5Dopen(HE5_ZAXZa[idx].za_id, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAreaddscaleattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+		
+      /* Call EHattr to perform I/O */
+      /* -------------------------- */
+      status = HE5_EHattr(fieldID, attrname, ntype, count, "r", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" field.\n", attrname,fieldname);
+	  H5Epush(__FILE__, "HE5_ZAreaddscaleattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+        
+      /* Release dataset ID */
+      /* ------------------ */
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAreaddscaleattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}			
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:  HE5_ZAwritedscaleattr                                           |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with a dimension scale    |
+|               field in a ZA.                                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fieldname      char*               dimension scale SDS name                |
+|  attrname       char*               attribute name                          |
+|  numtype        hid_t               attribute datatype ID                   |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10   Abe Taaheri   Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_ZAwritedscaleattr(hid_t zaID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t  count[],  void *datbuf)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+  
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      fieldID       = FAIL;/* Field-related dataset ID       */
+  
+  long       idx           = FAIL;/* ZA index                       */
+  
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+  hid_t      ntype;
+  
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+  
+  /* 
+     if numtype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use ntype itself
+  */
+  ntype = HE5_EHconvdatatype(numtype);
+  if(ntype == FAIL)
+    {
+      ntype = numtype;
+    }
+  
+  /*
+**********************************************************
+*  Check for proper ZA ID and return HDF-EOS file ID,    * 
+*        "HDFEOS" group ID and  ZA index                 *  
+**********************************************************
+*/
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAwritedscaleattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      
+      /* Get field ID */
+      /* ------------ */
+      fieldID = H5Dopen(HE5_ZAXZa[idx].za_id, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAwritedscaleattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      
+      /* Call EHattr to perform I/O */
+      /* -------------------------- */
+      status = HE5_EHattr(fieldID, attrname, ntype, count,"w", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write Attribute \"%s\" for the \"%s\" field.\n", attrname, fieldname);
+	  H5Epush(__FILE__, "HE5_ZAwritedscaleattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+      
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAwritedscaleattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+    }
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdscaleattrinfo                                             |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about dimension scale attribute         |
+|               (attribute associated with a specified dimension scale field) |
+|                in a ZA.                                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t     None      HDF-EOS type ZA  ID                     |
+|  fieldname      char*               field name                              |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               attribute data type ID                  |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10   Abe Taaheri   Original Development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_ZAdscaleattrinfo(hid_t zaID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t     status        = FAIL;/* routine return status variable */
+  
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  hid_t      fieldID       = FAIL;/* Field-related dataset ID       */
+  
+  long       idx           = FAIL;/* ZA index                       */
+  
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+  
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(attrname);
+  
+  /*
+**********************************************************
+*  Check for proper ZA ID and return HDF-EOS file ID,    * 
+*        "HDFEOS" group ID and ZA index                  *  
+**********************************************************
+*/
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAdscaleattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get field ID */
+      /* ------------ */
+      fieldID = H5Dopen(HE5_ZAXZa[idx].za_id, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAdscaleattrinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      
+      /* Call EHattrinfo */
+      /* --------------- */
+      if(strcmp(attrname,"REFERENCE_LIST") !=0)/* do not need ntype for 
+						  internal dimension
+						  scale attribute */
+	{
+	  status = HE5_EHattrinfo(fieldID, attrname, ntype, count);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" associated with the \"%s\" field.\n", attrname, fieldname);
+	      H5Epush(__FILE__, "HE5_ZAdscaleattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+	}
+      else
+	{
+	  status = -1;
+	  *ntype = -1;
+	  *count = 0;
+	  sprintf(errbuf,"Will not retrieve information about internal Attribute \"%s\" associated with the dimension scale \"%s\" .\n", attrname, fieldname);
+	  H5Epush(__FILE__, "HE5_ZAdscaleattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAdscaleattrinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+    }
+
+ COMPLETION:
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqdscaleattrs                                             |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list associated with a specified dimension scale   |
+|                in a ZA.                                                     |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                number of attributes (-1 if fails)      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t   None        HDF-EOS type ZA  ID                     |
+|  fieldname      char                dimension scale name                    |
+|  attrnames      char                attribute name(s)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                String length of attribute (in bytes)   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  June 10   Abe Taaheri  Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_ZAinqdscaleattrs(hid_t zaID, const char *fieldname, char *attrnames, long *strbufsize)
+{
+  long       nattr         =  0;  /* Number of attributes (return)  */
+  long       idx           = FAIL;/* Grid index                     */    
+  
+  herr_t     status        = FAIL;/* routine return status variable */
+  
+  hid_t      fid           = FAIL;/* HDF-EOS file ID                */
+  hid_t      gid           = FAIL;/* "HDFEOS" group ID              */
+  
+  char       *dtsname      = NULL;/* Buffer for dataset name        */
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];
+  
+  CHECKPOINTER(fieldname);
+  
+  /*
+**********************************************************
+*  Check for proper ZA ID and return HDF-EOS file ID,  * 
+*        "HDFEOS" group ID and Grid index                *  
+**********************************************************
+*/
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAinqdscaleattrs", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf,"Checking for ZA ID failed.\n" );
+      H5Epush(__FILE__, "HE5_ZAinqdscaleattrs", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtsname = (char *) calloc(HE5_HDFE_NAMBUFSIZE, 1);
+  if( dtsname == NULL)
+    {
+      sprintf(errbuf, "Can not allocate memory.\n");
+      H5Epush(__FILE__, "HE5_ZAinqdscaleattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+	
+  strcpy(dtsname,"/HDFEOS/ZAS/");
+  strcat(dtsname, HE5_ZAXZa[idx].zaname);
+  strcat(dtsname,"/");
+  strcat(dtsname,fieldname);
+
+  nattr = HE5_EHattrcat(fid, dtsname, attrnames, strbufsize);
+	
+  if (dtsname != NULL) free(dtsname);
+    
+ COMPLETION:
+  return(nattr);
+	
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdiminfo                                                    |
+|                                                                             |
+|  DESCRIPTION: Returns size in bytes of named dimension                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  size           hsize_t             size of dimension                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  dimname        char*               dimension name                          |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hsize_t
+HE5_ZAdiminfo(hid_t zaID, char *dimname)
+{
+  hsize_t       size                = 0;   /* Dimension size (return value) */
+ 
+  herr_t        status              = FAIL;/* status variable               */
+ 
+  hid_t         fid                 = FAIL;/* HDF-EOS file ID               */
+  hid_t         gid                 = FAIL;/* "HDFEOS" group ID             */
+ 
+  long          idx                 = FAIL;/* za index                      */
+ 
+  char          *metabuf=(char *)NULL;      /* Ptr to StrucMetadata (SM)    */
+  char          *metaptrs[2]={NULL,NULL};   /* Ptrs to the start/end of SM  */
+  char          utlstr[HE5_HDFE_UTLBUFSIZE];/* Utility string buffer        */
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer         */
+ 
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAdiminfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get pointers to "Dimension" section within SM */
+      /* --------------------------------------------- */
+      metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z", "Dimension", metaptrs);
+ 
+      /* Search for dimension name (surrounded by quotes) */
+      /* ------------------------------------------------ */
+      sprintf(utlstr, "%s%s%s", "\"", dimname, "\"\n");
+      metaptrs[0] = strstr(metaptrs[0], utlstr);
+ 
+      /*
+       * If dimension found within za structure then get dimension value
+       */
+      if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+        {
+	  /* Set "end" ptr at the end of dimension definition entry */
+	  /* ------------------------------------------------------ */
+	  metaptrs[1] = strstr(metaptrs[0], "\t\t\tEND_OBJECT");
+ 
+	  /* Get the value of "Size" entry */
+	  /* ----------------------------- */
+	  status = HE5_EHgetmetavalue(metaptrs, "Size", utlstr);
+	  if (status == SUCCEED)
+	    {
+	      size = atol(utlstr);
+	      if (size == 0)
+		{
+		  sprintf(errbuf, "Returning zero \"Size\" value from Metadata.\n");
+		  H5Epush(__FILE__, "HE5_ZAdiminfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+	    }
+	  else
+            {
+	      sprintf(errbuf, "The \"Size\" string not found in metadata. \n");
+	      H5Epush(__FILE__, "HE5_ZAdiminfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+        }
+      else
+        {
+	  sprintf(errbuf, "The Dimension \"%s\" not found in metadata. \n", dimname);
+	  H5Epush(__FILE__, "HE5_ZAdiminfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }
+ 
+      if (metabuf != NULL) free(metabuf);
+    }
+ 
+  return(size);
+}
+ 
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAcompinfo                                                   |
+|                                                                             |
+|  DESCRIPTION: Retrieves compression information about a field               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        Return status  (0) SUCCEED, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fldname        char*               field name                              |
+|  compcode       int*                compression code                        |
+|  compparm       int                 compression parameters                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_ZAcompinfo(hid_t zaID, char *fldname, int *compcode, int compparm[])
+{
+  herr_t          status   = FAIL;                   /* Return status variable      */
+  herr_t          statmeta = FAIL;                   /* Status variable             */
+
+  int             i;			             /* Loop Index                  */
+  int             nameflag = FAIL;                   /* Name flag (0-alias,1-actual)*/
+  int             fldgroup = FAIL;                   /* Field group flag            */
+
+  hid_t           fid      = FAIL;                   /* HDF-EOS file ID             */
+  hid_t           gid      = FAIL;                   /* "HDFEOS" group ID           */
+
+  long            idx      = FAIL;                   /* za index                    */
+
+  char            fieldname[HE5_HDFE_NAMBUFSIZE];    /* Field name buffer           */ 
+  char            fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual name of a field      */ 
+  char            *metabuf = (char *)NULL;           /* Pntr to StrucMetadata (SM)  */
+  char            *metaptrs[2]={NULL,NULL};          /* Ptrs to the start/end of SM */
+  char            *utlstr = (char *)NULL;            /* Utility string buffer       */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];       /* Error message buffer        */
+  char            *HDFcomp[18] = {"HE5_HDFE_COMP_NONE", "HE5_HDFE_COMP_RLE", "HE5_HDFE_COMP_NBIT", "HE5_HDFE_COMP_SKPHUFF", "HE5_HDFE_COMP_DEFLATE", "HE5_HDFE_COMP_SZIP_CHIP", "HE5_HDFE_COMP_SZIP_K13", "HE5_HDFE_COMP_SZIP_EC", "HE5_HDFE_COMP_SZIP_NN", "HE5_HDFE_COMP_SZIP_K13orEC", "HE5_HDFE_COMP_SZIP_K13orNN", "HE5_HDFE_COMP_SHUF_DEFLATE", "HE5_HDFE_COMP_SHUF_SZIP_CHIP", "HE5_HDFE_COMP_SHUF_SZIP_K13", "HE5_HDFE_COMP_SHUF_SZIP_EC", "HE5_HDFE_COMP_SHUF_SZIP_NN", "HE5_HDFE_COMP_SHUF_SZIP_K1 [...]
+
+
+  CHECKPOINTER(fldname);
+  
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAcompinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Allocate space for utility string */
+      /* --------------------------------- */
+      utlstr = (char *)calloc(HE5_HDFE_DIMBUFSIZE, sizeof(char));
+      if ( utlstr == NULL )
+	{
+	  sprintf( errbuf,"Cannot allocate memory for utility string.\n");
+	  H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  
+	  return(FAIL);
+	}
+
+      /* Call HE5_ZAfldnameinfo() to get actual field name */
+      /* ------------------------------------------------- */
+      nameflag = HE5_ZAfldnameinfo(zaID, fldname, fldactualname);
+      if ( nameflag == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get the actual name of the field.\n");
+	  H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (utlstr != NULL) free(utlstr);
+	  return(FAIL);
+	}
+  
+      /* If fieldname is alias, then change it to the actual name */
+      /* -------------------------------------------------------- */
+      if (nameflag == FALSE)
+	{
+	  strcpy(fieldname,"");
+	  strcpy(fieldname,fldactualname);
+	}
+
+      if (nameflag == TRUE)
+	{
+	  strcpy(fieldname,"");
+	  strcpy(fieldname,fldname);
+	}
+
+      /* Get the field group code */
+      /* ------------------------ */
+      fldgroup = HE5_ZAfldsrch(zaID,fieldname,NULL,NULL,NULL,NULL);
+      if (fldgroup == HE5_HDFE_DATAGROUP)
+	{
+	  /* Get pointers to "DataField" section within SM */
+	  /* --------------------------------------------- */
+	  metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z", "DataField", metaptrs);
+		  
+	  /* Search for field */
+	  /* ---------------- */
+	  sprintf(utlstr, "%s%s%s", "\"", fieldname, "\"\n");
+	  metaptrs[0] = strstr(metaptrs[0], utlstr);
+	  
+	}
+      else
+	{
+	  sprintf(errbuf , "Cannot get the field group code.\n");
+	  H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (metabuf != NULL) free(metabuf);
+	  if (utlstr != NULL) free(utlstr);
+	  return(FAIL);
+	}
+
+	  
+      /* If field found and user wants compression code ... */
+      /* -------------------------------------------------- */
+      if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+	{
+	  if (compcode != NULL)
+	    {
+	      /* Set endptr at end of field's definition entry */
+	      /* --------------------------------------------- */
+	      metaptrs[1] = strstr(metaptrs[0], "\t\t\tEND_OBJECT");
+			  
+	      /* Get compression type */
+	      /* -------------------- */
+	      statmeta = HE5_EHgetmetavalue(metaptrs, "CompressionType", utlstr);
+			  
+	      /*
+	       * Default is no compression if "CompressionType" string not
+	       * in metadata
+	       */
+	      *compcode = HE5_HDFE_COMP_NONE;
+			  
+	      /* If compression code is found ... */
+	      /* -------------------------------- */
+	      if (statmeta == SUCCEED)
+		{
+		  /* Loop through compression types until match */
+		  /* ------------------------------------------ */
+		  for (i = 0; i < 11; i++)
+		    {
+		      if (strcmp(utlstr, HDFcomp[i]) == 0)
+			{
+			  *compcode = i;
+			  break;
+			}
+		    }
+		}
+	    }
+			  
+	  /* If user wants compression parameters ... */
+	  /* ---------------------------------------- */
+	  if (compparm != NULL && compcode != NULL)
+	    {
+	      /* Initialize to zero */
+	      /* ------------------ */
+	      for (i = 0; i < 5; i++)
+		compparm[i] = 0;
+			  
+	      /* Get compression parameters */
+	      /* -------------------------- */
+	      if (*compcode == HE5_HDFE_COMP_NBIT)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "CompressionParams", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "(%d,%d,%d,%d)", &compparm[0], &compparm[1], &compparm[2], &compparm[3]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"\"CompressionParams\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_DEFLATE)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "DeflateLevel", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"DeflateLevel\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SZIP_CHIP)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SZIP_K13)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SZIP_EC)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SZIP_NN)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SZIP_K13orEC)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SZIP_K13orNN)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"
+			       );
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SHUF_DEFLATE)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "DeflateLevel", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"DeflateLevel\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_CHIP)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_EC)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_NN)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13orEC)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+	      else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13orNN)
+		{
+		  statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr);
+		  if (statmeta == SUCCEED)
+		    {
+		      sscanf(utlstr, "%d", &compparm[0]);
+		    }
+		  else
+		    {
+		      status = FAIL;
+		      sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n");
+		      H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		}
+
+	    }
+		  
+	}
+
+
+      if (metabuf != NULL) free(metabuf);
+      if (utlstr != NULL) free(utlstr);
+    }
+
+ COMPLETION:
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAfldnameinfo                                                |
+|                                                                             |
+|  DESCRIPTION: Retrieves actual name of the field                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nameFlag       int     None        return (1) actual name, (0) alias,      |
+|                                                (-1) FAIL                    |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fieldname      char*               name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  actualname     char*               field actual name                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static int
+HE5_ZAfldnameinfo(int zaID, char *fieldname, char *actualname)
+{
+  int         nameFlag       = FAIL;/* Return value of flag            */
+  int         length         = 0;   /* String length                   */
+  int         fldgroup       = FAIL;/* Field group code                */
+
+  hid_t       fid            = FAIL;/* HDF-EOS file ID                 */
+  hid_t       gid            = FAIL;/* "HDFEOS" group ID               */
+  hid_t       groupID        = FAIL;/* data field group ID             */
+
+  long        idx            = FAIL;/* za index                        */
+
+  H5G_stat_t  *statbuf = (H5G_stat_t *)NULL;/* buffer for link info    */
+
+  herr_t      status         = FAIL;/* routine return status variable  */
+
+  char        *namebuf       = NULL;/* Buffer for an actual field name */
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer      */
+   
+  CHECKPOINTER(fieldname); 
+  
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAfldnameinfo", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for za ID failed.\n");
+      H5Epush(__FILE__, "HE5_ZAfldnameinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  statbuf = (H5G_stat_t *)calloc(1, sizeof(H5G_stat_t ));
+
+  /* Try to get information about specified field */
+  /* -------------------------------------------- */
+  H5E_BEGIN_TRY {
+    groupID  = HE5_ZAXZa[idx].data_id;
+    fldgroup = HE5_HDFE_DATAGROUP;
+    status   = H5Gget_objinfo(groupID, fieldname, 0, statbuf);
+  }
+  H5E_END_TRY;
+  if (status == FAIL)
+    {
+      nameFlag = FAIL;
+      sprintf(errbuf, "Cannot find \"%s\" field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAfldnameinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(statbuf);
+      return(nameFlag);
+    }
+  
+  /* If the field name is an alias */
+  /* ----------------------------- */
+  if (statbuf->type == H5G_LINK)
+    nameFlag = FALSE;
+  else
+    nameFlag = TRUE;
+
+  if (nameFlag == FALSE)
+    {	
+      if (actualname != NULL)
+	{
+	  status = HE5_ZAaliasinfo(zaID, fldgroup, fieldname, &length, NULL);
+	  if ( status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot get information about alias \"%s\".\n", fieldname);
+	      H5Epush(__FILE__, "HE5_ZAfldnameinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+		  
+	  namebuf = (char *)calloc(length, sizeof(char));
+	  if ( namebuf == NULL )
+	    {
+	      sprintf(errbuf, "Cannot allocate memory for namebuf.\n");
+	      H5Epush(__FILE__, "HE5_ZAfldnameinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+		 
+	  /* Retrieve information about alias */
+	  /* -------------------------------- */
+	  status = HE5_ZAaliasinfo(zaID, fldgroup, fieldname, &length, namebuf);
+	  if ( status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot get information about alias \"%s\".\n", fieldname);
+	      H5Epush(__FILE__, "HE5_ZAfldnameinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(namebuf);
+	      return(FAIL);
+	    }
+		  
+	  strcpy(actualname,"");
+	  strcpy(actualname,namebuf);  
+	  free(namebuf);
+	}
+    }
+  
+  if (nameFlag == TRUE)
+    {
+      if (actualname != NULL)
+	{
+	  strcpy(actualname,"");
+	  strcpy(actualname, fieldname);
+	}
+    }
+  
+  free(statbuf);
+
+ COMPLETION:  
+  return(nameFlag);
+} 
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAfldinfo                                                    |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about specified ZA structure            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  datafield      char*               data field                              |
+|  za_name        char*               name of a specific ZA data set          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  rank           int*                rank of ZA data set                     |
+|  dims           hsize_t             array of dimension sizes                |
+|  numbertype     hid_t               number type                             |
+|  dimlist        char*               dimension list                          |
+|  maxdimlist     char*               maximum dimension list                  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|  Oct 03    S.ZHAO       Added the H5Tclose(datatype) call.                  |
+|  Jan 04    S.Zhao       Modified to enable a character string dataset.      |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t
+HE5_ZAfldinfo(int zaID, char *datafield, char *za_name, int *rank, hsize_t dims[], hid_t numbertype[], char *dimlist, char *maxdimlist)
+{
+  herr_t     status         = FAIL;/* routine return status variable                  */
+  herr_t     statmeta       = FAIL;/* EHgetmetavalue return status                    */
+  herr_t     Dstatus        = FAIL;/* Status for H5Dclose                             */
+ 
+  hid_t      fid            = FAIL;/* HDF-EOS file ID                                 */
+  hid_t      gid            = FAIL;/* "HDFEOS" group ID                               */
+  hid_t      dspace         = FAIL;/* "fieldname" Dataspace ID                        */
+  hid_t      fieldID        = FAIL;/* "fieldname" Dataset ID                          */
+  hid_t      groupid        = FAIL;/* group ID                                        */
+  hid_t      datasetid      = FAIL;/* dataset ID                                      */
+  hid_t      datatype       = FAIL;/* data type ID                                    */
+ 
+  H5T_class_t  classid = H5T_NO_CLASS;/* data type class ID                           */
+ 
+  long       ndims          = 0;   /* Number of dimensions                            */
+  long       idx            = FAIL;/* Index of a za                                   */
+  long       i              = 0;   /* Loop index                                      */
+ 
+  size_t     slen[HE5_DTSETRANKMAX];            /* Length of each entry in parsed string  */
+ 
+  char       *metabuf       = (char *)NULL;     /* Ptr to structural metadata (SM)        */
+  char       *metaptrs[2]   = {NULL, NULL};     /* Ptrs to the begining and end of SM     */
+  char       utlstr[HE5_HDFE_UTLBUFSIZE];       /* Utility string                         */
+  char       *ptr[HE5_DTSETRANKMAX];            /* String pointers for parsed string      */
+  char       dimstr[HE5_HDFE_DIMBUFSIZE];       /* Individual dimension entry string      */
+  char       maxdimstr[HE5_HDFE_DIMBUFSIZE];    /* Individual max. dimension entry string */
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];       /* Error message buffer                   */
+  htri_t     str_is_variable;                   /* boolean: TRUE if string is variable 
+						   lengeth FALSE if string is fixed length
+						   -1 if error in H5Tis_variavle_str()    */
+ 
+  CHECKPOINTER(datafield);
+  CHECKPOINTER(za_name);
+ 
+  /* Initialize rank to FAIL (error) */
+  /* ------------------------------- */
+  *rank = FAIL;
+ 
+  /* Initialize slen[] array */
+  /* ----------------------- */
+  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+    slen[i] = 0;
+ 
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAfldinfo", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for za ID failed.\n");
+      H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+ 
+  /* Reset status to FAIL */
+  /* -------------------- */
+  status = FAIL;
+ 
+  /* Get pointers to appropriate "Field" section within SM */
+  /* ----------------------------------------------------- */
+  metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z", "DataField", metaptrs);
+ 
+  if ( metabuf == NULL )
+    {
+      status = FAIL;
+      sprintf(errbuf, "Cannot get pointer to  metabuf.\n");
+      H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+ 
+ 
+  sprintf(utlstr, "%s%s%s", "\"", za_name, "\"\n");
+ 
+  metaptrs[0] = strstr(metaptrs[0], utlstr);
+ 
+  /* If field is found in "Data Fields" group */
+  /* ---------------------------------------- */
+  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+    {
+      /* Get DataType string */
+      /* ------------------- */
+      statmeta = HE5_EHgetmetavalue(metaptrs, "DataType", utlstr);
+ 
+      /* Convert to data type class ID */
+      /* ----------------------------- */
+      if (statmeta == SUCCEED)
+        {
+	  groupid = HE5_ZAXZa[idx].data_id;
+ 
+	  /* Open the field dataset */
+	  /* ---------------------- */
+	  datasetid     = H5Dopen(groupid, za_name);
+	  if (datasetid == FAIL)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot open the dataset for the \"%s\" field.\n",za_name);
+	      H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+ 
+	  /* Get the data type ID */
+	  /* -------------------- */
+	  datatype      = H5Dget_type(datasetid);
+	  if (datatype == FAIL)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot get the data type for the \"%s\" field.\n",za_name);
+	      H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+ 
+	  /* Get the data type class ID */
+	  /* -------------------------- */
+	  classid       = H5Tget_class(datatype);
+	  if (classid == H5T_NO_CLASS)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" field.\n",za_name);
+	      H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+ 
+	  if (classid == H5T_STRING)
+	    {
+	      /* HE5T_CHARSTRING has variable length for data fields */
+	      str_is_variable = H5Tis_variable_str(datatype);
+	      if(str_is_variable == TRUE)
+		{
+		  numbertype[0] = HE5T_CHARSTRING;
+		}
+	      else if(str_is_variable == FALSE)
+		{
+		  numbertype[0] = HE5T_NATIVE_CHAR;
+		}
+	      else
+		{
+		  status = FAIL;
+		  sprintf(errbuf, "Failed to see if string field is varaible or fixed length for the \"%s\" field.\n",za_name);
+		  H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+			      
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (metabuf != NULL) free(metabuf);
+		  return(status);
+		}
+			  
+	      /*HE5_ZAgetstringtype(zaID, fieldname,classid);*/
+	      /*numbertype[0] = HE5T_CHARSTRING;*/
+	    }
+	  else
+	    {
+	      numbertype[0] = HE5_EHdtype2numtype(datatype);
+	      if (numbertype[0] == FAIL)
+		{
+		  status = FAIL;
+		  sprintf(errbuf, "Cannot get the number type for the \"%s\" field.\n",za_name);
+		  H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+		  if (metabuf != NULL) free(metabuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+	    }
+ 
+	  /* Release the datatype ID */
+	  /* ----------------------- */
+	  status       = H5Tclose(datatype);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the datatype ID for the \"%s\" field.\n",za_name);
+	      H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+
+	  /* Release the dataset ID */
+	  /* ---------------------- */
+	  Dstatus       = H5Dclose(datasetid);
+	  if (Dstatus == FAIL)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" field.\n",za_name);
+	      H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+        }
+      else
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "The \"DataType\" string not found in metadata. \n");
+	  H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf);
+	  if (metabuf != NULL) free(metabuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }
+ 
+      /* Get "DimList" string, trim off "(" and ")" */
+      /* ------------------------------------------ */
+      statmeta = HE5_EHgetmetavalue(metaptrs, "DimList", utlstr);
+      if (statmeta == SUCCEED)
+        {
+	  memmove(utlstr, utlstr + 1, strlen(utlstr) - 2);
+	  utlstr[strlen(utlstr) - 2] = 0;
+ 
+	  /* Parse trimmed "DimList" string and get rank */
+	  /* ------------------------------------------- */
+	  ndims = HE5_EHparsestr(utlstr, ',', ptr, slen);
+	  *rank = HE5_EHlong2int(ndims);
+	  if (*rank == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot convert from \"long\" to \"int\" data type. \n");
+	      H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+        }
+      else
+        {
+	  status = FAIL;
+	  sprintf(errbuf, "The \"DimList\" string not found in metadata. \n");
+	  H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf);
+	  if (metabuf != NULL) free(metabuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }
+ 
+      /* If "DimList" IS REQUESTED ...  */
+      /* -----------------------------  */
+      if (dimlist != NULL)
+	{
+	  strcpy(dimstr,"");
+	  strcpy(dimlist,"");
+ 
+	  /*
+	   * Copy each entry in DimList and remove leading and trailing quotes.
+	   * Get dimension sizes and concatenate dimension names to dimension list.
+	   */
+	  for (i = 0; i < ndims; i++)
+	    {
+	      memmove(dimstr, ptr[i] + 1, slen[i] - 2);
+	      dimstr[slen[i] - 2] = 0;
+	      if (i > 0)
+		{
+		  strcat(dimlist,",");
+		}
+	      strcat(dimlist, dimstr);
+	    }
+	}
+ 
+ 
+      /* If "MaxdimList" IS REQUESTED  ...      */
+      /* -------------------------------------- */
+      if(maxdimlist != NULL)
+	{
+	  strcpy(utlstr,"");
+	  statmeta = HE5_EHgetmetavalue(metaptrs,"MaxdimList", utlstr);
+	  if (statmeta == SUCCEED)
+	    {
+	      memmove(utlstr, utlstr + 1, strlen(utlstr) - 2);
+	      utlstr[strlen(utlstr) - 2] = 0;
+	      ndims = HE5_EHparsestr(utlstr,',', ptr, slen);
+	    }
+	  else
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "The \"MaxdimList\" string not found in metadata. \n");
+	      H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf);
+	      if (metabuf != NULL) free(metabuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+ 
+	  strcpy(maxdimstr,"");
+	  strcpy(maxdimlist,"");
+ 
+	  for (i = 0; i < ndims; i++)
+	    {
+	      memmove(maxdimstr, ptr[i] + 1, slen[i] - 2);
+	      maxdimstr[slen[i] - 2] = 0;
+	      if (maxdimlist != NULL)
+		{
+		  if (i > 0)
+		    {
+		      strcat(maxdimlist,",");
+		    }
+		  strcat(maxdimlist, maxdimstr);
+		}
+	    }
+	}
+         
+ 
+      /* Get field ID */
+      /* ------------ */
+      HE5_ZAfieldsizeID( zaID, za_name, &fieldID);
+         
+      /* Get the data space ID */
+      /* --------------------- */
+      dspace = H5Dget_space( fieldID );
+      if(dspace == FAIL)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Cannot get the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+	  if (metabuf != NULL) free(metabuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+      /* Get the dataset rank */
+      /* -------------------- */
+      *rank  = H5Sget_simple_extent_ndims(dspace);
+      if( *rank == FAIL)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Cannot get the rank of the dataset.\n");
+	  H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  if (metabuf != NULL) free(metabuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+      /* Get the dataset dimension sizes */
+      /* ------------------------------- */
+      status = H5Sget_simple_extent_dims(dspace, dims, NULL);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the dimension array of the dataset.\n");
+	  H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  if (metabuf != NULL) free(metabuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+      /* Release the data space ID */
+      /* ------------------------- */
+      status = H5Sclose(dspace);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot release the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	  if (metabuf != NULL) free(metabuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+ 
+  if (metabuf != NULL) free(metabuf);
+ 
+ COMPLETION:
+  return(status);
+}
+ 
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinfo                                                       |
+|                                                                             |
+|  DESCRIPTION: Wrapper around HE5_ZAfldinfo                                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  za_name        char*               za name                                 |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  rank           int*                rank of field (# of dims)               |
+|  dims           hsize_t             field dimensions                        |
+|  dtype          hid_t               data type ID                            |
+|  dimlist        char*               field dimension list                    |
+|  maxdimlist     char*               field maximum dimension list            |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date       Programmer    Description                                      |
+|  =========   ============  ================================================ |
+|  Jul 02       S.ZHAO       Original development                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_ZAinfo(hid_t zaID, char *za_name, int *rank, hsize_t dims[], hid_t dtype[], char *dimlist, char *maxdimlist)
+{
+
+  herr_t       status      = FAIL;/* routine return status variable */
+
+  int          nameflag    = FAIL;/* Actual(1)/Alias(0) field name  */   
+
+  hid_t        fid         = FAIL;/* HDF-EOS file ID                */
+  hid_t        gid         = FAIL;/* "HDFEOS" group ID              */
+  
+  long         idx         = FAIL;/* za index                       */
+
+  char         fieldname[HE5_HDFE_NAMBUFSIZE];    /* field name buffer    */
+  char         fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual field name    */  
+  char         errbuf[HE5_HDFE_ERRBUFSIZE];       /* Error message buffer */
+  
+  CHECKPOINTER(za_name);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Call HE5_ZAfldnameinfo() to get actual field name */
+      /* ------------------------------------------------- */
+      nameflag = HE5_ZAfldnameinfo(zaID, za_name, fldactualname);
+      if ( nameflag == FAIL )
+	{
+	  sprintf(errbuf, "Cannot get actual name of the field.\n");
+	  H5Epush(__FILE__, "HE5_ZAinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Name is not alias */
+      /* ----------------- */
+      if (nameflag == TRUE)
+	{
+	  strcpy(fieldname,"");
+	  strcpy(fieldname,za_name);
+	}
+
+      /* Name is alias */
+      /* ------------- */
+      if (nameflag == FALSE)
+	{
+	  strcpy(fieldname,"");
+	  strcpy(fieldname,fldactualname);
+	}
+
+      /* Check for field within Data Fields */
+      /* ---------------------------------- */
+      status = HE5_ZAfldinfo(zaID, "Data Fields", fieldname, rank, dims, dtype, dimlist, maxdimlist);
+
+      /* If not there either then can't be found */
+      /* --------------------------------------- */
+      if (status == FAIL)
+        {
+	  sprintf(errbuf,"Field \"%s\" not found. Check out the field name. \n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+        }	  
+    }
+
+ COMPLETION:  
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdefchunk                                                   |
+|                                                                             |
+|  DESCRIPTION: Defines size of chunk used to store a chunked layout dataset  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  rank           int                 rank of a dataset                       |
+|  dim            const hsize_t*      pointer to the array containing sizes   |
+|                                     of each dimension of a chunk            |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  Date        Programmer    Description                                      |
+|  =========   ============  ==============================================   |
+|  Jul 02       S.ZHAO       Original development                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_ZAdefchunk(hid_t zaID, int rank,  const hsize_t *dim)
+{
+  herr_t          status   = FAIL;/* Return status variable */
+
+  hid_t           fid      = FAIL;/* HDF-EOS file ID        */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID      */
+
+  long            idx      = FAIL;/* za index               */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  HE5_LOCK;
+  CHECKPOINTER(dim);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAdefchunk", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* get the current dataset creation property ID from external array  */
+      /* if current property instance has not been created, then create it */
+      if( HE5_ZAXZa[idx].plist == FAIL){
+	HE5_ZAXZa[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+
+	if (HE5_ZAXZa[idx].plist == FAIL){
+	  sprintf(errbuf, "Cannot create the property list. \n");
+	  H5Epush(__FILE__, "HE5_ZAdefchunk", __LINE__, H5E_PLIST, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+      }
+
+      /* Set layout */
+      /* ---------- */
+      status = H5Pset_layout( HE5_ZAXZa[idx].plist, H5D_CHUNKED);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage. \n");
+	  H5Epush(__FILE__, "HE5_ZAdefchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      /* Set chunking */
+      /* ------------ */
+      status = H5Pset_chunk( HE5_ZAXZa[idx].plist, rank, dim); 
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the sizes of chunks. \n");
+	  H5Epush(__FILE__, "HE5_ZAdefchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdefcomp                                                    |
+|                                                                             |
+|  DESCRIPTION: Defines compression type and parameters                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  compcode       int                 compression code                        |
+|  compparm       int*                compression parameters                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:   Before calling this function, storage must be CHUNKED             |
+|                      Values of compression code                             |
+|                         HDFE_COMP_NONE                  0                   |
+|                         HDFE_COMP_RLE                   1                   |
+|                         HDFE_COMP_NBIT                  2                   |
+|                         HDFE_COMP_SKPHUFF               3                   |
+|                         HDFE_COMP_DEFLATE               4                   |
+|                         HDFE_COMP_SZIP_EC               5                   |
+|                         HDFE_COMP_SZIP_NN               6                   |
+|                         HDFE_COMP_SZIP_K13              7                   |
+|                         HDFE_COMP_SZIP_CHIP             8                   |
+|                         HDFE_COMP_SZIP_K13orEC          9                   |
+|                         HDFE_COMP_SZIP_K13orNN          10                  |
+|                         HDFE_COMP_SHUF_DEFLATE          11                  |
+|                         HDFE_COMP_SHUF_SZIP_CHIP        12                  |
+|                         HDFE_COMP_SHUF_SZIP_K13         13                  |
+|                         HDFE_COMP_SHUF_SZIP_EC          14                  |
+|                         HDFE_COMP_SHUF_SZIP_NN          15                  |
+|                         HDFE_COMP_SHUF_SZIP_K13orEC     16                  |
+|                         HDFE_COMP_SHUF_SZIP_K13orNN     17                  |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|  Aug 03    S.Zhao       Added Szip compression methods.                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_ZAdefcomp(hid_t zaID, int compcode,  int *compparm)
+{
+  herr_t          status   = FAIL; /* routine return status variable   */
+
+  hid_t           fid      = FAIL; /* HDF-EOS file ID                  */
+  hid_t           gid      = FAIL; /* "HDFEOS" group ID                */
+
+  long            idx      = FAIL; /* za index                         */
+
+  H5D_layout_t    layout = H5D_LAYOUT_ERROR; /* Storage layout type    */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+  int             can_encode = 0;        /* szip encoder presence flag     */
+
+  HE5_LOCK;
+  CHECKPOINTER(compparm);
+
+  /* Check if compression code is valid */
+  /* ---------------------------------- */
+  if( compcode != HE5_HDFE_COMP_DEFLATE && compcode != HE5_HDFE_COMP_NONE &&
+      compcode != HE5_HDFE_COMP_SZIP_CHIP && compcode != HE5_HDFE_COMP_SZIP_K13 &&
+      compcode != HE5_HDFE_COMP_SZIP_EC && compcode != HE5_HDFE_COMP_SZIP_NN &&
+      compcode != HE5_HDFE_COMP_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SZIP_K13orNN &&
+      compcode != HE5_HDFE_COMP_SHUF_DEFLATE && compcode != HE5_HDFE_COMP_SHUF_SZIP_CHIP &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_K13 && compcode != HE5_HDFE_COMP_SHUF_SZIP_EC &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_NN && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orEC &&
+      compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orNN )
+    {
+      status = FAIL;
+      sprintf(errbuf,"Invalid/unsupported compression code. \n");
+      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+ 
+  if( compcode == HE5_HDFE_COMP_DEFLATE || compcode == HE5_HDFE_COMP_NONE || compcode == HE5_HDFE_COMP_SHUF_DEFLATE)
+    {
+      /* Check GZIP compression level */
+      /* ---------------------------- */
+      if( compparm[0] < 0 || compparm[0] > 9)
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Invalid GZIP compression level. \n");
+	  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+  else
+    {
+      /* Check SZIP compression block size */
+      /* --------------------------------- */
+      if( compparm[0] != 2 && compparm[0] != 4 && compparm[0] != 6 && compparm[0] != 8 &&
+	  compparm[0] != 10 && compparm[0] != 12 && compparm[0] != 14 && compparm[0] != 16 &&
+	  compparm[0] != 18 && compparm[0] != 20 && compparm[0] != 22 && compparm[0] != 24 &&
+	  compparm[0] != 26 && compparm[0] != 28 && compparm[0] != 30 && compparm[0] != 32)
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Invalid SZIP compression block size. \n");
+	  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+ 
+#ifdef H5_HAVE_FILTER_SZIP
+  can_encode = HE5_szip_can_encode();
+#endif
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAdefcomp", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* If the current property list is not set up */
+      /* ------------------------------------------ */
+      if( HE5_ZAXZa[idx].plist == FAIL)
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Unable to compress, dataset storage layout has not been set to CHUNKED. \n");
+	  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+      else 
+	{
+	  layout = H5Pget_layout(HE5_ZAXZa[idx].plist);
+	  if (layout == H5D_LAYOUT_ERROR)
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Cannot get the layout of the raw data. \n");
+	      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_PLIST, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+		  
+	  if( layout != H5D_CHUNKED )
+	    status =  H5Pset_layout(HE5_ZAXZa[idx].plist, H5D_CHUNKED);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage of the raw data. \n");
+	      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(status);
+	    }
+ 	   
+		  
+	  switch (compcode)
+	    {
+	      /* Set NBIT compression parameters in compression external array */
+	      /* ------------------------------------------------------------- */ 
+	    case HE5_HDFE_COMP_NBIT:
+			  
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+	      HE5_ZAXZa[idx].compparm[1] = compparm[1];
+	      HE5_ZAXZa[idx].compparm[2] = compparm[2];
+	      HE5_ZAXZa[idx].compparm[3] = compparm[3];
+			  
+	      break;
+			  
+	    case HE5_HDFE_COMP_DEFLATE:
+			  
+	      /* ------------------------------------------------- */
+	      /* Set compression method to H5D_COMPRESS_DEFLATE    */
+	      /*       and compression level to "compparm[0]"      */
+	      /* ------------------------------------------------- */
+	      status = H5Pset_deflate(HE5_ZAXZa[idx].plist, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+                         
+	      /* ------------------------------------------------- */
+	      /* Set GZIP compression method and compression       */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_ZAXZa[idx].compcode = compcode;
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+			  
+	      break;
+
+	    case HE5_HDFE_COMP_SZIP_CHIP:
+ 	      
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_CHIP compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+ 
+	      /* ------------------------------------------------- */
+	      /* Set SZIP_CHIP compression method and compression  */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_ZAXZa[idx].compcode = compcode;
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	      break;
+ 
+	    case HE5_HDFE_COMP_SZIP_K13:
+  	      
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+
+	      /* ------------------------------------------------- */
+	      /* Set SZIP_K13 compression method and compression   */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_ZAXZa[idx].compcode = compcode;
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	      break;
+ 
+	    case HE5_HDFE_COMP_SZIP_EC:
+  	      
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+ 
+	      /* ------------------------------------------------- */
+	      /* Set SZIP_EC compression method and compression    */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_ZAXZa[idx].compcode = compcode;
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	      break;
+ 
+	    case HE5_HDFE_COMP_SZIP_NN:
+ 	      
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{ 
+		  status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+ 
+	      /* ------------------------------------------------- */
+	      /* Set SZIP_NN compression method and compression    */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_ZAXZa[idx].compcode = compcode;
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	      break;
+ 
+	    case HE5_HDFE_COMP_SZIP_K13orEC:
+ 	      
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{ 
+		  status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_K13orEC compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+ 
+	      /* ------------------------------------------------- */
+	      /* Set SZIP_K13orEC compression method and           */
+	      /*    compression parameters in external array       */
+	      /* ------------------------------------------------- */
+	      HE5_ZAXZa[idx].compcode = compcode;
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	      break;
+ 
+	    case HE5_HDFE_COMP_SZIP_K13orNN:
+ 	      
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{ 
+		  status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+ 
+	      /* ------------------------------------------------- */
+	      /* Set SZIP_K13orNN compression method and           */
+	      /*    compression parameters in external array       */
+	      /* ------------------------------------------------- */
+	      HE5_ZAXZa[idx].compcode = compcode;
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	      break;
+ 
+	    case HE5_HDFE_COMP_SHUF_DEFLATE:
+                         
+	      status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the shuffling method. \n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+
+	      status = H5Pset_deflate(HE5_ZAXZa[idx].plist, compparm[0]);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+ 
+	      /* ------------------------------------------------- */
+	      /* Set shuffling+GZIP method and compression         */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_ZAXZa[idx].compcode = compcode;
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	      break;
+ 
+	    case HE5_HDFE_COMP_SHUF_SZIP_CHIP:
+ 
+	      status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the shuffling method. \n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+ 	      
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_CHIP compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+ 
+	      /* ------------------------------------------------- */
+	      /* Set shuffling+SZIP_CHIP method and compression    */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_ZAXZa[idx].compcode = compcode;
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	      break;
+ 
+	    case HE5_HDFE_COMP_SHUF_SZIP_K13:
+ 
+	      status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the shuffling method. \n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+ 	      
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+ 
+	      /* ------------------------------------------------- */
+	      /* Set shuffling+SZIP_K13 method and compression     */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_ZAXZa[idx].compcode = compcode;
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	      break;
+ 
+	    case HE5_HDFE_COMP_SHUF_SZIP_EC:
+ 
+	      status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the shuffling method. \n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+ 	      
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+ 
+	      /* ------------------------------------------------- */
+	      /* Set shuffling+SZIP_EC method and compression      */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_ZAXZa[idx].compcode = compcode;
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	      break;
+ 
+	    case HE5_HDFE_COMP_SHUF_SZIP_NN:
+ 
+	      status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the shuffling method. \n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+ 	      
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+ 
+	      /* ------------------------------------------------- */
+	      /* Set shuffling+SZIP_NN method and compression      */
+	      /*    parameters in external array                   */
+	      /* ------------------------------------------------- */
+	      HE5_ZAXZa[idx].compcode = compcode;
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	      break;
+ 
+	    case HE5_HDFE_COMP_SHUF_SZIP_K13orEC:
+ 
+	      status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the shuffling method. \n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+ 	      
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_K13orEC compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+ 
+	      /* ------------------------------------------------- */
+	      /* Set shuffling+SZIP_K13orEC method and             */
+	      /*    compression parameters in external array       */
+	      /* ------------------------------------------------- */
+	      HE5_ZAXZa[idx].compcode = compcode;
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	      break;
+ 
+	    case HE5_HDFE_COMP_SHUF_SZIP_K13orNN:
+ 
+	      status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot set the shuffling method. \n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  return(status);
+		}
+ 	      
+#ifdef H5_HAVE_FILTER_SZIP
+	      if(can_encode == 1)
+		{
+		  status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n");
+		      H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      return(status);
+		    }
+		} 
+	      else
+		{
+		  sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		  H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		}
+#endif
+ 
+	      /* ------------------------------------------------- */
+	      /* Set shuffling+SZIP_K13orNN method and             */
+	      /*    compression parameters in external array       */
+	      /* ------------------------------------------------- */
+	      HE5_ZAXZa[idx].compcode = compcode;
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	      break;
+
+	    case HE5_HDFE_COMP_NONE:
+
+	      HE5_ZAXZa[idx].compparm[0] = compparm[0];
+
+	      break;
+			  
+	    default:
+	      {
+		status = FAIL;
+		sprintf(errbuf, "Invalid compression method \"%d\" . \n", compcode);
+		H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      }
+	      break;
+			  
+	    }
+	}
+	  
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdefcomchunk                                                |
+|                                                                             |
+|  DESCRIPTION: Defines compression type and parameters and sets chunking     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  compcode       int                 compression code                        |
+|  compparm       int*                compression parameters                  |
+|  rank           int                 rank of a dataset                       |
+|  dim            const hsize_t*      pointer to the array containing sizes   |
+|                                     of each dimension of a chunk            |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:   Before calling this function, storage must be CHUNKED             |
+|                      Values of compression code                             |
+|                         HDFE_COMP_NONE                  0                   |
+|                         HDFE_COMP_RLE                   1                   |
+|                         HDFE_COMP_NBIT                  2                   |
+|                         HDFE_COMP_SKPHUFF               3                   |
+|                         HDFE_COMP_DEFLATE               4                   |
+|                         HDFE_COMP_SZIP_EC               5                   |
+|                         HDFE_COMP_SZIP_NN               6                   |
+|                         HDFE_COMP_SZIP_K13              7                   |
+|                         HDFE_COMP_SZIP_CHIP             8                   |
+|                         HDFE_COMP_SZIP_K13orEC          9                   |
+|                         HDFE_COMP_SZIP_K13orNN          10                  |
+|                         HDFE_COMP_SHUF_DEFLATE          11                  |
+|                         HDFE_COMP_SHUF_SZIP_CHIP        12                  |
+|                         HDFE_COMP_SHUF_SZIP_K13         13                  |
+|                         HDFE_COMP_SHUF_SZIP_EC          14                  |
+|                         HDFE_COMP_SHUF_SZIP_NN          15                  |
+|                         HDFE_COMP_SHUF_SZIP_K13orEC     16                  |
+|                         HDFE_COMP_SHUF_SZIP_K13orNN     17                  |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|  Aug 03    S.Zhao       Added Szip compression methods.                     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+  herr_t   
+    HE5_ZAdefcomchunk(hid_t zaID, int compcode, int *compparm, int rank, const hsize_t *dim)
+  {
+    herr_t          status   = FAIL;            /* Return status variable */
+
+    int             i        = 0;               /* Loop index             */
+
+    hid_t           fid      = FAIL;            /* HDF-EOS file ID        */
+    hid_t           gid      = FAIL;            /* "HDFEOS" group ID      */
+
+    hsize_t         dims[HE5_DTSETRANKMAX];     /* Default dim. sizes     */
+
+    long            idx      = FAIL;            /* za index               */
+
+    H5D_layout_t    layout = H5D_LAYOUT_ERROR;  /* Storage layout type    */
+
+    char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+    int             can_encode;        /* szip encoder presence flag     */
+
+    HE5_LOCK;
+    CHECKPOINTER(compparm);
+    CHECKPOINTER(dim);
+
+    /* Check if compression code is valid */
+    /* ---------------------------------- */
+    if( compcode != HE5_HDFE_COMP_DEFLATE && compcode != HE5_HDFE_COMP_NONE &&
+	compcode != HE5_HDFE_COMP_SZIP_CHIP && compcode != HE5_HDFE_COMP_SZIP_K13 &&
+	compcode != HE5_HDFE_COMP_SZIP_EC && compcode != HE5_HDFE_COMP_SZIP_NN &&
+	compcode != HE5_HDFE_COMP_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SZIP_K13orNN &&
+	compcode != HE5_HDFE_COMP_SHUF_DEFLATE && compcode != HE5_HDFE_COMP_SHUF_SZIP_CHIP &&
+	compcode != HE5_HDFE_COMP_SHUF_SZIP_K13 && compcode != HE5_HDFE_COMP_SHUF_SZIP_EC &&
+	compcode != HE5_HDFE_COMP_SHUF_SZIP_NN && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orEC &&
+	compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orNN) 
+      {
+	status = FAIL;
+	sprintf(errbuf, "Invalid/unsupported compression code. \n");
+	H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	HE5_EHprint(errbuf, __FILE__, __LINE__);
+	return(status);
+      }
+ 
+    if( compcode == HE5_HDFE_COMP_DEFLATE || compcode == HE5_HDFE_COMP_NONE || compcode == HE5_HDFE_COMP_SHUF_DEFLATE)
+      {
+	/* Check GZIP compression level */
+	/* ---------------------------- */
+	if( compparm[0] < 0 || compparm[0] > 9)
+	  {
+	    status = FAIL;
+	    sprintf(errbuf,"Invalid GZIP compression level. \n");
+	    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    return(status);
+	  }
+      }
+    else
+      {
+	/* Check SZIP compression block size */
+	/* --------------------------------- */
+	if( compparm[0] != 2 && compparm[0] != 4 && compparm[0] != 6 && compparm[0] != 8 &&
+	    compparm[0] != 10 && compparm[0] != 12 && compparm[0] != 14 && compparm[0] != 16 &&
+	    compparm[0] != 18 && compparm[0] != 20 && compparm[0] != 22 && compparm[0] != 24 &&
+	    compparm[0] != 26 && compparm[0] != 28 && compparm[0] != 30 && compparm[0] != 32)
+	  {
+	    status = FAIL;
+	    sprintf(errbuf,"Invalid SZIP compression block size. \n");
+	    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    return(status);
+	  }
+      }
+
+#ifdef H5_HAVE_FILTER_SZIP
+    can_encode = HE5_szip_can_encode();
+#endif
+
+    /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+    /* --------------------------------------------------- */
+    status = HE5_ZAchkzaid(zaID, "HE5_ZAdefcomchunk", &fid, &gid, &idx);
+    if (status == SUCCEED)
+      {
+	/* Initialize dims[] array */
+	/* ----------------------- */
+	for (i = 0; i < HE5_DTSETRANKMAX; i++)
+	  dims[i] = 0;
+
+	/* get the current dataset creation property ID from external array  */
+	/* ----------------------------------------------------------------- */
+	if(HE5_ZAXZa[idx].plist == FAIL)
+	  {
+	    /* create property list */
+	    /* -------------------- */
+	    HE5_ZAXZa[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+
+	    /* set layout to "H5D_CHUNKED" */
+	    /* --------------------------- */
+	    status = H5Pset_layout(HE5_ZAXZa[idx].plist, H5D_CHUNKED);
+	    if (status == FAIL)
+	      {
+		sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage. \n");
+		H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_STORAGE, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		return(status);
+	      }
+	  }
+	else 
+	  {
+	    /* Get layout of the raw data */
+	    /* -------------------------- */
+	    layout = H5Pget_layout(HE5_ZAXZa[idx].plist);
+	    if (layout == H5D_LAYOUT_ERROR)
+	      {
+		status = FAIL;
+		sprintf(errbuf, "Cannot get the layout of the raw data. \n");
+		H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_STORAGE, H5E_NOTFOUND, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		return(status);
+	      }
+		  
+	    if( layout != H5D_CHUNKED )
+	      {
+			
+		/* set layout to "H5D_CHUNKED" */
+		/* --------------------------- */
+		status = H5Pset_layout( HE5_ZAXZa[idx].plist, H5D_CHUNKED);
+		if (status == FAIL)
+		  {
+		    sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage. \n");
+		    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_STORAGE, H5E_BADVALUE, errbuf);
+		    HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    return(status);
+		  }
+	      }
+	  }
+	  
+	/* set chunking */
+	/* ------------ */
+	if ( rank > 0 && dim != (hsize_t *)NULL)
+	  {
+	    status = H5Pset_chunk(HE5_ZAXZa[idx].plist, rank, dim); 
+	    if (status == FAIL)
+	      {
+		sprintf(errbuf, "Cannot set the sizes of chunks. \n");
+		H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		return(status);
+	      }
+	  }
+	else if ( rank > 0 && dim == (hsize_t *)NULL)
+	  {
+	    /* Set default chunk sizes */
+	    /* ----------------------- */
+	    for (i = 0; i < rank; i++)
+	      dims[ i ] = HE5_CHUNKSIZE;
+		  
+	    status = H5Pset_chunk(HE5_ZAXZa[idx].plist, rank, dims); 
+	    if (status == FAIL)
+	      {
+		sprintf(errbuf, "Cannot set the sizes of chunks. \n");
+		H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		return(status);
+	      }
+	  }
+	else
+	  {
+	    sprintf(errbuf, "Invalid dataset rank,\"%d\" . \n", rank);
+	    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    return(FAIL);
+	  }
+	  
+	  
+	switch (compcode)
+	  {
+	    /* Set NBIT compression parameters in compression external array */
+	    /* ------------------------------------------------------------- */ 
+	  case HE5_HDFE_COMP_NBIT:
+		  
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+	    HE5_ZAXZa[idx].compparm[1] = compparm[1];
+	    HE5_ZAXZa[idx].compparm[2] = compparm[2];
+	    HE5_ZAXZa[idx].compparm[3] = compparm[3];
+		  
+	    break;
+		  
+	  case HE5_HDFE_COMP_DEFLATE:
+		  
+	    /* ------------------------------------------------- */
+	    /* Set compression method to H5D_COMPRESS_DEFLATE    */
+	    /*       and compression level to "compparm[0]"      */
+	    /* ------------------------------------------------- */
+	    status = H5Pset_deflate(HE5_ZAXZa[idx].plist, compparm[0]);
+	    if (status == FAIL)
+	      {
+		sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n");
+		H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		return(status);
+	      }
+ 
+	    /* ------------------------------------------------- */
+	    /* Set GZIP compression method and compression       */
+	    /*    parameters in external array                   */
+	    /* ------------------------------------------------- */
+	    HE5_ZAXZa[idx].compcode = compcode;
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+		  
+	    break;
+
+	  case HE5_HDFE_COMP_SZIP_CHIP:
+ 	      
+#ifdef H5_HAVE_FILTER_SZIP
+	    if(can_encode == 1)
+	      { 
+		status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]);
+		if (status == FAIL)
+		  {
+		    sprintf(errbuf, "Cannot set SZIP_CHIP compresssion method and block size. \n");
+		    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		    HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    return(status);
+		  }
+	      } 
+	    else
+	      {
+		sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      }
+#endif
+ 
+	    /* ------------------------------------------------- */
+	    /* Set SZIP_CHIP compression method and compression  */
+	    /*    parameters in external array                   */
+	    /* ------------------------------------------------- */
+	    HE5_ZAXZa[idx].compcode = compcode;
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	    break;
+ 
+	  case HE5_HDFE_COMP_SZIP_K13:
+ 	      
+#ifdef H5_HAVE_FILTER_SZIP
+	    if(can_encode == 1)
+	      {
+		status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]);
+		if (status == FAIL)
+		  {
+		    sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n");
+		    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		    HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    return(status);
+		  }
+	      } 
+	    else
+	      {
+		sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      }
+#endif
+ 
+	    /* ------------------------------------------------- */
+	    /* Set SZIP_K13 compression method and compression   */
+	    /*    parameters in external array                   */
+	    /* ------------------------------------------------- */
+	    HE5_ZAXZa[idx].compcode = compcode;
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	    break;
+ 
+	  case HE5_HDFE_COMP_SZIP_EC:
+	      
+#ifdef H5_HAVE_FILTER_SZIP
+	    if(can_encode == 1)
+	      { 
+		status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]);
+		if (status == FAIL)
+		  {
+		    sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n");
+		    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		    HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    return(status);
+		  }
+	      } 
+	    else
+	      {
+		sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      }
+#endif
+  
+	    /* ------------------------------------------------- */
+	    /* Set SZIP_EC compression method and compression    */
+	    /*    parameters in external array                   */
+	    /* ------------------------------------------------- */
+	    HE5_ZAXZa[idx].compcode = compcode;
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	    break;
+ 
+	  case HE5_HDFE_COMP_SZIP_NN:
+	      
+#ifdef H5_HAVE_FILTER_SZIP
+	    if(can_encode == 1)
+	      { 
+		status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]);
+		if (status == FAIL)
+		  {
+		    sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n");
+		    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		    HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    return(status);
+		  }
+	      } 
+	    else
+	      {
+		sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      }
+#endif
+  
+	    /* ------------------------------------------------- */
+	    /* Set SZIP_NN compression method and compression    */
+	    /*    parameters in external array                   */
+	    /* ------------------------------------------------- */
+	    HE5_ZAXZa[idx].compcode = compcode;
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	    break;
+ 
+	  case HE5_HDFE_COMP_SZIP_K13orEC:
+	      
+#ifdef H5_HAVE_FILTER_SZIP
+	    if(can_encode == 1)
+	      { 
+		status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]);
+		if (status == FAIL)
+		  {
+		    sprintf(errbuf, "Cannot set SZIP_K13orEC compresssion method and block size. \n");
+		    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		    HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    return(status);
+		  }
+	      } 
+	    else
+	      {
+		sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      }
+#endif
+  
+	    /* ------------------------------------------------- */
+	    /* Set SZIP_K13orEC compression method and           */
+	    /*    compression parameters in external array       */
+	    /* ------------------------------------------------- */
+	    HE5_ZAXZa[idx].compcode = compcode;
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	    break;
+ 
+	  case HE5_HDFE_COMP_SZIP_K13orNN:
+	      
+#ifdef H5_HAVE_FILTER_SZIP
+	    if(can_encode == 1)
+	      { 
+		status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]);
+		if (status == FAIL)
+		  {
+		    sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n");
+		    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		    HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    return(status);
+		  }
+	      } 
+	    else
+	      {
+		sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      }
+#endif
+  
+	    /* ------------------------------------------------- */
+	    /* Set SZIP_K13orNN compression method and           */
+	    /*    compression parameters in external array       */
+	    /* ------------------------------------------------- */
+	    HE5_ZAXZa[idx].compcode = compcode;
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	    break;
+
+	  case HE5_HDFE_COMP_SHUF_DEFLATE:
+                 
+	    status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	    if (status == FAIL)
+	      {
+		sprintf(errbuf, "Cannot set the shuffling method. \n");
+		H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		return(status);
+	      }
+
+	    status = H5Pset_deflate(HE5_ZAXZa[idx].plist, compparm[0]);
+	    if (status == FAIL)
+	      {
+		sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n");
+		H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		return(status);
+	      }
+ 
+	    /* ------------------------------------------------- */
+	    /* Set shuffling+GZIP method and compression         */
+	    /*    parameters in external array                   */
+	    /* ------------------------------------------------- */
+	    HE5_ZAXZa[idx].compcode = compcode;
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	    break;
+ 
+	  case HE5_HDFE_COMP_SHUF_SZIP_CHIP:
+ 
+	    status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	    if (status == FAIL)
+	      {
+		sprintf(errbuf, "Cannot set the shuffling method. \n");
+		H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		return(status);
+	      }
+	      
+#ifdef H5_HAVE_FILTER_SZIP
+	    if(can_encode == 1)
+	      {
+		status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]);
+		if (status == FAIL)
+		  {
+		    sprintf(errbuf, "Cannot set SZIP_CHIP compresssion method and block size. \n");
+		    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		    HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    return(status);
+		  }
+	      } 
+	    else
+	      {
+		sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      }
+#endif
+ 
+	    /* ------------------------------------------------- */
+	    /* Set shuffling+SZIP_CHIP method and compression    */
+	    /*    parameters in external array                   */
+	    /* ------------------------------------------------- */
+	    HE5_ZAXZa[idx].compcode = compcode;
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	    break;
+ 
+	  case HE5_HDFE_COMP_SHUF_SZIP_K13:
+ 
+	    status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	    if (status == FAIL)
+	      {
+		sprintf(errbuf, "Cannot set the shuffling method. \n");
+		H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		return(status);
+	      }
+	      
+#ifdef H5_HAVE_FILTER_SZIP
+	    if(can_encode == 1)
+	      {
+		status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]);
+		if (status == FAIL)
+		  {
+		    sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n");
+		    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		    HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    return(status);
+		  }
+	      } 
+	    else
+	      {
+		sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      }
+#endif
+ 
+	    /* ------------------------------------------------- */
+	    /* Set shuffling+SZIP_K13 method and compression     */
+	    /*    parameters in external array                   */
+	    /* ------------------------------------------------- */
+	    HE5_ZAXZa[idx].compcode = compcode;
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	    break;
+ 
+	  case HE5_HDFE_COMP_SHUF_SZIP_EC:
+ 
+	    status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	    if (status == FAIL)
+	      {
+		sprintf(errbuf, "Cannot set the shuffling method. \n");
+		H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		return(status);
+	      }
+	      
+#ifdef H5_HAVE_FILTER_SZIP
+	    if(can_encode == 1)
+	      {
+		status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]);
+		if (status == FAIL)
+		  {
+		    sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n");
+		    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		    HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    return(status);
+		  }
+	      } 
+	    else
+	      {
+		sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      }
+#endif
+ 
+	    /* ------------------------------------------------- */
+	    /* Set shuffling+SZIP_EC method and compression      */
+	    /*    parameters in external array                   */
+	    /* ------------------------------------------------- */
+	    HE5_ZAXZa[idx].compcode = compcode;
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	    break;
+ 
+	  case HE5_HDFE_COMP_SHUF_SZIP_NN:
+ 
+	    status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	    if (status == FAIL)
+	      {
+		sprintf(errbuf, "Cannot set the shuffling method. \n");
+		H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		return(status);
+	      }
+	      
+#ifdef H5_HAVE_FILTER_SZIP
+	    if(can_encode == 1)
+	      {
+		status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]);
+		if (status == FAIL)
+		  {
+		    sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n");
+		    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		    HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    return(status);
+		  }
+	      } 
+	    else
+	      {
+		sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      }
+#endif
+	      
+	    /* ------------------------------------------------- */
+	    /* Set shuffling+SZIP_NN method and compression      */
+	    /*    parameters in external array                   */
+	    /* ------------------------------------------------- */
+	    HE5_ZAXZa[idx].compcode = compcode;
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	    break;
+ 
+	  case HE5_HDFE_COMP_SHUF_SZIP_K13orEC:
+ 
+	    status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	    if (status == FAIL)
+	      {
+		sprintf(errbuf, "Cannot set the shuffling method. \n");
+		H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		return(status);
+	      }
+	      
+#ifdef H5_HAVE_FILTER_SZIP
+	    if(can_encode == 1)
+	      {
+		status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]);
+		if (status == FAIL)
+		  {
+		    sprintf(errbuf, "Cannot set SZIP_K13orEC compresssion method and block size. \n");
+		    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		    HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    return(status);
+		  }
+	      } 
+	    else
+	      {
+		sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      }
+#endif
+ 
+	    /* ------------------------------------------------- */
+	    /* Set shuffling+SZIP_K13orEC method and             */
+	    /*    compression parameters in external array       */
+	    /* ------------------------------------------------- */
+	    HE5_ZAXZa[idx].compcode = compcode;
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	    break;
+ 
+	  case HE5_HDFE_COMP_SHUF_SZIP_K13orNN:
+ 
+	    status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	    if (status == FAIL)
+	      {
+		sprintf(errbuf, "Cannot set the shuffling method. \n");
+		H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		return(status);
+	      }
+	      
+#ifdef H5_HAVE_FILTER_SZIP
+	    if(can_encode == 1)
+	      {
+		status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]);
+		if (status == FAIL)
+		  {
+		    sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n");
+		    H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		    HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    return(status);
+		  }
+	      } 
+	    else
+	      {
+		sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n");
+		H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      }
+#endif
+	
+	    /* ------------------------------------------------- */
+	    /* Set shuffling+SZIP_K13orNN method and             */
+	    /*    compression parameters in external array       */
+	    /* ------------------------------------------------- */
+	    HE5_ZAXZa[idx].compcode = compcode;
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+ 
+	    break;
+
+	  case HE5_HDFE_COMP_NONE:
+
+	    status = H5Pset_shuffle(HE5_ZAXZa[idx].plist);
+	    if (status == FAIL)
+	      {
+		sprintf(errbuf, "Cannot set the shuffling method. \n");
+		H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+		HE5_EHprint(errbuf, __FILE__, __LINE__);
+		return(status);
+	      }
+
+	    HE5_ZAXZa[idx].compparm[0] = compparm[0];
+
+	    break;
+		  
+	  default:
+	    {
+	      status = FAIL;
+	      sprintf(errbuf, "Invalid (unsupported) compression method \"%d\". \n", compcode);
+	      H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	    }
+	    break;
+		  
+	  }
+      }  
+  COMPLETION:
+    HE5_UNLOCK;
+    return(status);
+  }
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdefinefield                                                |
+|                                                                             |
+|  DESCRIPTION: Defines data field within ZA structure                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  datafield      char*               data field                              |
+|  za_name        const char*         za name                                 |
+|  dimlist        char*               Dimension (comma-separated)list         |
+|  maxdimlist     char*               Maximum Dimension (comma-separated) list|
+|  numbertype     hid_t               field data type ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:  H5S_UNLIMITED is -1, not 0  => unlimited extendiable dimention     |
+|           size = -1.                                                        |
+|          If maxdimlist = NULL, then dimlist string is copied to the         |
+|          maxdimlist string, and corresponding information is written to     |
+|          the metadata section.                                              |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|  Jan 04    S.Zhao       Added to create a character string dataset.         |
+|  Mar 04    S.Zhao       Modified for a character string dataset.            |
+|  Apr 04    S.Zhao       Modified for a character string dataset.            |
+|  May 05    S.Zhao       Added HE5_EHdtype2numtype() function call.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t
+HE5_ZAdefinefield(hid_t zaID, char *datafield, const char *za_name, char *dimlist, char *maxdimlist, hid_t numbertype_in)
+{
+  herr_t          status      = FAIL; /* Return status variable             */
+ 
+  int             i           = 0;    /* Loop index                         */
+  int             foundAllDim = 1;    /* found all dimensions flag          */
+  int             append      = FALSE;/* "Is field appendable?" flag        */
+  int             first       = 1;    /* first entry flag                   */
+  int             compcode    = FAIL; /* Compression code                   */
+  int             rank        = 0;    /* Field rank                         */
+  int             maxrank     = 0;    /* max dim  rank                      */
+ 
+  hid_t           fid        = FAIL;/* HDF-EOS file ID                      */
+  hid_t           gid        = FAIL;/* "HDFEOS" group ID                    */
+  hid_t           data_space = FAIL;/* dataspace ID                         */
+  hid_t           dataset    = FAIL;/* dataset ID                           */
+  hid_t           heos_gid   = FAIL;/* "ZAS" group ID                       */
+  hid_t           ntype      = FAIL;/* Number type ID                       */
+  hid_t           numtype    = FAIL;
+  hid_t           numbertype;
+  hsize_t         metavalue = 0;        /* Metavalue to insert              */
+  hsize_t         dims[HE5_DTSETRANKMAX];   /* Dimension size array         */
+  hsize_t         maxdims[HE5_DTSETRANKMAX];/* Dimension size array         */
+  hsize_t         dimsize   = 0;        /* Dimension size                   */
+  hsize_t         count[]   = { 1 };    /* number of elements to insert     */
+ 
+  long            idx       = FAIL;     /* za index                         */
+ 
+  H5D_layout_t    layout = H5D_LAYOUT_ERROR; /* Storage layout for raw data */
+ 
+  void            *value;
+ 
+  size_t          tsize     = 0;                   /* Size of a datatype in bytes  */
+  int             attr      = 0;                   /* attribute value              */
+ 
+  char            *dimbuf   = (char *)NULL;        /* Dimension buffer             */
+  char            *comma    = (char *)NULL;        /* Pointer to comma             */
+  char            *dimcheck = (char *)NULL;        /* Dimension check buffer       */
+  char            utlbuf[HE5_HDFE_UTLBUFSIZE];     /* Utility buffer               */
+  char            utlbuf2[HE5_HDFE_UTLBUFSIZE];    /* Utility buffer 2             */
+  char            errbuf1[HE5_HDFE_ERRBUFSIZE];    /* Error message buffer 1       */
+  char            errbuf2[HE5_HDFE_ERRBUFSIZE];    /* Error message buffer 2       */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];     /* Error message buffer         */
+  char            maxdimlstbuf[HE5_HDFE_DIMBUFSIZE];
+  char            dimlstbuf[HE5_HDFE_DIMBUFSIZE];
+  char            compparmbuf[HE5_HDFE_DIMBUFSIZE];/* Compression parmeter         */
+  char            *HDFcomp[18] = {"HE5_HDFE_COMP_NONE", "HE5_HDFE_COMP_RLE", "HE5_HDFE_COMP_NBIT", "HE5_HDFE_COMP_SKPHUFF", "HE5_HDFE_COMP_DEFLATE", "HE5_HDFE_COMP_SZIP_CHIP", "HE5_HDFE_COMP_SZIP_K13", "HE5_HDFE_COMP_SZIP_EC", "HE5_HDFE_COMP_SZIP_NN", "HE5_HDFE_COMP_SZIP_K13orEC", "HE5_HDFE_COMP_SZIP_K13orNN", "HE5_HDFE_COMP_SHUF_DEFLATE", "HE5_HDFE_COMP_SHUF_SZIP_CHIP", "HE5_HDFE_COMP_SHUF_SZIP_K13", "HE5_HDFE_COMP_SHUF_SZIP_EC", "HE5_HDFE_COMP_SHUF_SZIP_NN", "HE5_HDFE_COMP_SHUF_SZIP_K1 [...]
+ 
+  CHECKNAME(za_name);
+  CHECKPOINTER(datafield);
+  CHECKPOINTER(dimlist);
+ 
+
+  /* Convert HDF-EOS5 datatype to HDF5 datatype */
+  if (
+      H5Tequal(numbertype_in, H5T_NATIVE_CHAR)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SHORT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_INT)    == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UINT)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LONG)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LLONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_FLOAT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== SUCCEED ||
+      H5Tequal(numbertype_in, H5T_C_S1) == SUCCEED)
+    {
+      numbertype = numbertype_in;
+    }
+  else
+    {
+      numbertype = HE5_EHconvdatatype((int) numbertype_in);
+    }
+
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID for defining field.\n");
+      H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Setup error message strings */
+  /* --------------------------- */
+  strcpy(errbuf1, "HE5_ZAXZDname array too small.\nPlease increase ");
+  strcat(errbuf1, "size of HE5_HDFE_NAMBUFSIZE in \"HE5_HdfEosDef.h\".\n");
+  strcpy(errbuf2, "HE5_ZAXZDdims array too small.\nPlease increase ");
+  strcat(errbuf2, "size of HE5_HDFE_DIMBUFSIZE in \"HE5_HdfEosDef.h\".\n");
+       
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAdefinefield", &fid, &heos_gid, &idx);
+  if(status == FAIL ) return(status);
+       
+  /* initialize dims and maxdims array */
+  /* --------------------------------- */
+  for(i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      dims[i]    = 0;
+      maxdims[i] = 0;
+    }
+ 
+ 
+  /* Allocate space for dimbuf, copy dimlist into it, & append comma */
+  /* --------------------------------------------------------------- */
+  dimbuf = (char *) calloc(strlen(dimlist) + 64, sizeof(char));
+  if(dimbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+      HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /*
+********************************************************************
+*   C H E C K  T H E   C O N T E N T   O F   dimlist  S T R I N G  *
+********************************************************************
+*/
+ 
+  strcpy(dimbuf, dimlist);
+  strcat(dimbuf, ",");
+ 
+  /* Find comma */
+  /* ---------- */
+  comma = strchr(dimbuf, ',');
+       
+  /*
+   * Loop through entries in dimension list to make sure they are
+   * defined in za
+   */
+  while (comma != NULL)
+    {
+      /* Copy dimension list entry to dimcheck */
+      /* ------------------------------------- */
+      dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char));
+      if(dimcheck == NULL)
+	{
+	  H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n");
+	  HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+	  free(dimbuf);
+	  return(FAIL);
+	}
+      memmove(dimcheck, dimbuf, comma - dimbuf);
+ 
+      /* Get dimension size */
+      /* ------------------ */
+      dimsize = HE5_ZAdiminfo(zaID, dimcheck);
+      if (dimsize > 0)
+	{
+	  dims[rank] = dimsize;
+	  rank++;
+	}
+      else
+	{
+	  /*
+	   * If dimension list entry not found - set error return
+	   * status, append name to utility buffer for error report
+	   */
+	  status = FAIL;
+	  foundAllDim = 0;
+	  if (first == 1)
+	    strcpy(utlbuf, dimcheck);
+	  else
+	    {
+	      strcat(utlbuf, ",");
+	      strcat(utlbuf, dimcheck);
+	    }
+	  first = 0;
+	}
+ 
+      /*
+       * Go to next dimension entry, find next comma, & free up
+       * dimcheck buffer
+       */
+      memmove(dimbuf, comma + 1, strlen(comma + 1) + 1);
+      comma = strchr(dimbuf, ',');
+      free(dimcheck);
+ 
+    }
+  free(dimbuf);
+       
+  /* If no dimensions found, report error */
+  /* ------------------------------------ */
+  if (foundAllDim == 0)
+    {
+      status = FAIL;
+      sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" field. \n", utlbuf, za_name);
+      H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return (status);
+    }
+ 
+ 
+  /*
+************************************************************************
+*   C H E C K  T H E   C O N T E N T   O F   maxdimlist   S T R I N G  *
+************************************************************************
+*/
+       
+ 
+  /* Allocate space for dimbuf, copy maxdimlist into it, & append comma */
+  /* ------------------------------------------------------------------ */
+  if(maxdimlist != NULL)
+    {
+      dimbuf = (char *) calloc(strlen(maxdimlist) + 64, sizeof(char));
+      if(dimbuf == NULL)
+	{
+	  H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n");
+	  HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+	  return(FAIL);
+ 
+	}
+ 
+      /* Copy "maxdimlist" to "dimbuf", & append comma */
+      /* --------------------------------------------- */
+      strcpy(dimbuf, maxdimlist);
+      strcat(dimbuf, ",");
+ 
+      /* Find comma */
+      /* ---------- */
+      comma = strchr(dimbuf, ',');
+ 
+      /*
+       * Loop through entries in dimension list to make sure they are
+       *                     defined in za
+       */
+      while (comma != NULL)
+	{
+	  /* Copy dimension list entry to dimcheck */
+	  /* ------------------------------------- */
+	  dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char));
+	  if(dimcheck == NULL)
+	    {
+	      H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n");
+	      HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+	      free(dimbuf);
+	      return(FAIL);
+	    }
+	  memmove(dimcheck, dimbuf, comma - dimbuf);
+ 
+	  /* Get dimension size */
+	  /* ------------------ */
+	  dimsize = HE5_ZAdiminfo(zaID, dimcheck);
+	  if ( (dimsize > 0 && strcmp(dimcheck,"Unlim") != 0 ) || (dimsize == H5S_UNLIMITED && strcmp(dimcheck, "Unlim") == 0 )  )
+	    {
+	      maxdims[maxrank] = dimsize;
+	      maxrank++;
+	    }
+	  else
+	    {
+	      /*
+	       * If dimension list entry not found - set error return
+	       * status, append name to utility buffer for error report
+	       */
+	      status = FAIL;
+	      foundAllDim = 0;
+	      if (first == 1)
+		strcpy(utlbuf, dimcheck);
+	      else
+		{
+		  strcat(utlbuf, ",");
+		  strcat(utlbuf, dimcheck);
+		}
+	      first = 0;
+	    }
+ 
+	  /*
+	   * Go to next dimension entry, find next comma, & free up
+	   * dimcheck buffer
+	   */
+	  memmove(dimbuf, comma + 1, strlen(comma + 1) + 1);
+	  comma = strchr(dimbuf, ',');
+	  free(dimcheck);
+	}
+ 
+      free(dimbuf);
+ 
+      /* If no dimensions found, report error */
+      /* ------------------------------------ */
+      if (foundAllDim == 0)
+	{
+	  status = FAIL;
+	  sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" field. \n", utlbuf, za_name);
+	  H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+ 
+ 
+      /* If maxrank !=rank  then report error */
+      /* ------------------------------------ */
+      if ( maxrank != rank )
+	{
+	  status = FAIL;
+	  sprintf(errbuf,"Dimension rank doesn't match Maximum dimension rank. \n");
+	  H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+    }
+  /* "maxlist == NULL"  ==> maxdims[]= dims[] */
+  /* ---------------------------------------- */
+  else
+    {
+      for(i = 0; i < rank; i++ )
+	maxdims[ i ] = dims[ i ];
+    }
+ 
+ 
+  /* Find out if the dataset dimension is appendable */
+  /* ----------------------------------------------- */
+  for(i = 0; i < rank; i++)
+    {
+      if( dims[i] == maxdims[i] )
+	append = FALSE;
+      else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED))
+	{
+	  append = TRUE;
+	  break;
+	}
+      else
+	{
+	  status = FAIL;
+	  H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADRANGE, "Maximum dimension size is smaller than Dimension size. \n");
+	  HE5_EHprint("Error: Maximum dimension size is smaller than Dimension size, occured", __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+ 
+ 
+  /* Check for valid data type ID ("numbertype") */
+  /* ------------------------------------------- */
+  if (numbertype != HE5T_CHARSTRING)
+    {
+      if (H5Tequal(numbertype, H5T_NATIVE_CHAR)   != SUCCEED &&
+          H5Tequal(numbertype, H5T_NATIVE_SCHAR)  != SUCCEED &&
+          H5Tequal(numbertype, H5T_NATIVE_UCHAR)  != SUCCEED &&
+          H5Tequal(numbertype, H5T_NATIVE_SHORT)  != SUCCEED &&
+          H5Tequal(numbertype, H5T_NATIVE_USHORT) != SUCCEED &&
+          H5Tequal(numbertype, H5T_NATIVE_INT)    != SUCCEED &&
+          H5Tequal(numbertype, H5T_NATIVE_UINT)   != SUCCEED &&
+          H5Tequal(numbertype, H5T_NATIVE_LONG)   != SUCCEED &&
+          H5Tequal(numbertype, H5T_NATIVE_ULONG)  != SUCCEED &&
+          H5Tequal(numbertype, H5T_NATIVE_LLONG)  != SUCCEED &&
+          H5Tequal(numbertype, H5T_NATIVE_ULLONG) != SUCCEED &&
+          H5Tequal(numbertype, H5T_NATIVE_FLOAT)  != SUCCEED &&
+          H5Tequal(numbertype, H5T_NATIVE_DOUBLE) != SUCCEED &&
+          H5Tequal(numbertype, H5T_NATIVE_LDOUBLE)!= SUCCEED &&
+          H5Tequal(numbertype, H5T_C_S1) != SUCCEED
+          )
+        {
+          H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, "Invalid (unsupported) data type. \n");
+          HE5_EHprint("Error: Invalid (unsupported) data type, occured", __FILE__, __LINE__);
+          return(FAIL);
+        }
+    }
+ 
+ 
+  /* Get the field group ID */
+  /*----------------------- */
+  if (strcmp(datafield, "Data Fields") == 0)
+    {
+      gid = HE5_ZAXZa[idx].data_id;
+    }
+  else
+    {
+      sprintf(errbuf,"Invalid (unsupported) field group. \n");
+      H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return (FAIL);
+    }
+ 
+  /* Create dataspace then create dataset */
+  /* ------------------------------------ */
+  if( HE5_ZAXZa[idx].plist == FAIL )
+    {
+      HE5_ZAXZa[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+    }
+ 
+  /* Get dataset layout */
+  /* ------------------ */
+  layout = H5Pget_layout(HE5_ZAXZa[idx].plist);
+  if( layout == H5D_LAYOUT_ERROR)
+    {
+      H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot get dataset layout.\n");
+      HE5_EHprint("Error: Cannot get dataset layout, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  if(append == FALSE)
+    data_space = H5Screate_simple(rank, dims, NULL);
+  else
+    {
+      if( layout == H5D_CHUNKED)
+	data_space = H5Screate_simple(rank, dims, maxdims);
+      else
+	{
+	  status = FAIL;
+	  H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, "Appendable dataset MUST BE CHUNKED first.\n");
+	  HE5_EHprint("Error: Appendable dataset MUST BE CHUNKED first, occured", __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+ 
+  /* Get current compression code */
+  /* ---------------------------- */
+  compcode = HE5_ZAXZa[idx].compcode;
+
+  /* Note: in inquiry routines HE5T_CHARSTRING is distinguished 
+     from HE5T_NATIVE_CHAR for the field data (not attributes) based
+     on whether string has variable or fixed length as set below.
+     The field data of type HE5T_NATIVE_CHAR has fixed length of 1, and
+     the field is array of characters, not strings. However, HE5T_CHARSTRING
+     sets array of vaiable length strings for the field data.
+     Currently HE5_EHattr treats HE5T_NATIVE_CHAR, HE5T_CHARSTRING, and
+     H5T_C_S1 as fixed (any size) for attributes. 
+  */
+  ntype = numbertype;
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_C_S1))
+    {
+      ntype = H5Tcopy(H5T_C_S1);
+      status = H5Tset_size(ntype, H5T_VARIABLE);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the total size for \"%s\" field. \n", za_name);
+	  H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+      /* Create dataset */
+      /* -------------- */
+      dataset = H5Dcreate(gid, za_name, ntype, data_space, HE5_ZAXZa[idx].plist);
+      if (dataset == FAIL)
+        {
+          status = FAIL;
+          sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", za_name);
+          H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(status);
+        }
+ 
+    }
+  else if (numbertype == H5T_NATIVE_CHAR)
+    {
+      ntype = H5Tcopy(H5T_C_S1);
+      status = H5Tset_size(ntype, 1);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot set the total size for \"%s\" field. \n", za_name);
+	  H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+      /* Create dataset */
+      /* -------------- */
+      dataset = H5Dcreate(gid, za_name, ntype, data_space, HE5_ZAXZa[idx].plist);
+      if (dataset == FAIL)
+        {
+          status = FAIL;
+          sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", za_name);
+          H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(status);
+        }
+ 
+    }
+
+  else
+    {
+      /* Create dataset */
+      /* -------------- */
+      dataset = H5Dcreate(gid, za_name, numbertype, data_space, HE5_ZAXZa[idx].plist);
+      if (dataset == FAIL)
+        {
+          status = FAIL;
+          sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", za_name);
+          H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(status);
+        }
+    }
+ 
+  /* Extend the dataset. assure that dataset is at least dims */
+  /* -------------------------------------------------------- */
+  if( append == TRUE)
+    {
+      status = H5Dextend(dataset,dims);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot extend the dataset for \"%s\" field.\n", za_name);
+	  H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+ 
+ 
+  /* load external array */
+  /* ------------------- */
+
+  /* store dataset IDs and dataset name */
+  /* ---------------------------------- */
+  if (HE5_ZAXZa[idx].nDFLD > 0)
+    {
+      /* Allocate memory to ddataset struct */
+      /* ---------------------------------- */
+      HE5_ZAXZa[idx].ddataset = (HE5_DTSinfo *)realloc((void *)HE5_ZAXZa[idx].ddataset,(HE5_ZAXZa[idx].nDFLD + 1) * sizeof(HE5_DTSinfo));
+ 
+    }
+  else
+    {
+      HE5_ZAXZa[idx].ddataset = (HE5_DTSinfo *)calloc(1, sizeof(HE5_DTSinfo));
+      if (HE5_ZAXZa[idx].ddataset == NULL )
+	{
+	  status = FAIL;
+	  H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n");
+	  HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+    }
+ 
+  /* Allocate memory to name */
+  /* ----------------------- */
+  HE5_ZAXZa[idx].ddataset[HE5_ZAXZa[idx].nDFLD].name = (char *)calloc( (strlen(za_name)+1), sizeof(char) );
+  if (HE5_ZAXZa[idx].ddataset[HE5_ZAXZa[idx].nDFLD].name == NULL)
+    {
+      status = FAIL;
+      H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory.\n");
+      HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+      return(status);
+    }
+ 
+  /* load table */
+  /* ---------- */
+  HE5_ZAXZa[idx].ddataset[HE5_ZAXZa[idx].nDFLD].ID = dataset;
+  strcpy(HE5_ZAXZa[idx].ddataset[HE5_ZAXZa[idx].nDFLD].name, za_name);
+  HE5_ZAXZa[idx].nDFLD++;
+ 
+  if ((numbertype != HE5T_CHARSTRING) && (numbertype != H5T_NATIVE_CHAR) && (numbertype != H5T_C_S1))
+    { 
+      /* Get the size of a datatype in bytes */
+      /* ----------------------------------- */
+      tsize = H5Tget_size( numbertype);
+      if( tsize == 0)
+        {
+          sprintf(errbuf, "Cannot get the size of a datatype. \n");
+          H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return (FAIL);
+        }
+ 
+      /* allocate memory for "fill" value */
+      /* -------------------------------- */
+      value = (void *)calloc(1, tsize);
+      if( value == (void *)NULL)
+        {
+          sprintf(errbuf, "Cannot allocate memory for fill value.\n");
+          H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return (FAIL);
+        }
+ 
+      /* Try to retrieve the fill value (in case it's already defined) */
+      /* ------------------------------------------------------------- */
+      H5E_BEGIN_TRY {
+        status = H5Pget_fill_value(HE5_ZAXZa[idx].plist,  numbertype,  value);
+      }
+      H5E_END_TRY;
+       
+      /* Store fill value in the dataset attribute "_FillValue" */
+      /* -----------------------------------------------------  */
+      if( status != FAIL)
+        {
+ 
+          status = HE5_EHattr( dataset, "_FillValue", numbertype, count, "w", value);
+          if( status == FAIL )
+	    {
+	      sprintf(errbuf, "Cannot store fill value in the attribute \"_FillValue\".");
+	      H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(value);
+	      return (status);
+	    }
+ 
+        }
+ 
+      free( value);
+       
+    }
+ 
+  /*
+******************************************************************
+*                  SET   UP  METADATA  STRINGS                   *
+******************************************************************
+*/
+       
+ 
+  /*  set up "DimList" string content */
+  /*  ------------------------------- */
+  strcpy(utlbuf,"");
+  sprintf(utlbuf, "%s%s%s", za_name,":",dimlist);
+ 
+  /* set up "MaxdimList"  string content */
+  /* ----------------------------------- */
+  if ( maxdimlist != NULL)
+    {
+      status = HE5_EHmetalist(maxdimlist,maxdimlstbuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot convert the input \"%s\" list to the metadata list. \n", maxdimlist);
+	  H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+      sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=", maxdimlstbuf);
+      strcat(utlbuf,utlbuf2);
+ 
+    }
+  if (maxdimlist == NULL)
+    {
+      status = HE5_EHmetalist(dimlist,dimlstbuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot convert the input \"%s\" list to the metadata list.\n", dimlist);
+	  H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (status);
+	}
+      sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=", dimlstbuf);
+      strcat(utlbuf,utlbuf2);
+ 
+    }
+ 
+  /* setup "CompressionType" & "CompressionParams" strings content */
+  /* ------------------------------------------------------------- */
+  if (compcode != HE5_HDFE_COMP_NONE)
+    {
+      sprintf(utlbuf2,"%s%s","\n\t\t\t\tCompressionType=", HDFcomp[compcode]);
+ 
+      switch (compcode)
+	{
+	case HE5_HDFE_COMP_NBIT:
+ 
+	  sprintf(compparmbuf,
+		  "%s%d,%d,%d,%d%s",
+		  "\n\t\t\t\tCompressionParams=(",
+		  HE5_ZAXZa[idx].compparm[0],
+		  HE5_ZAXZa[idx].compparm[1],
+		  HE5_ZAXZa[idx].compparm[2],
+		  HE5_ZAXZa[idx].compparm[3], ")");
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+ 
+	case HE5_HDFE_COMP_DEFLATE:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_ZAXZa[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SZIP_CHIP:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SZIP_K13:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SZIP_EC:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SZIP_NN:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SZIP_K13orEC:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SZIP_K13orNN:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	case HE5_HDFE_COMP_SHUF_DEFLATE:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_ZAXZa[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_CHIP:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_K13:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_EC:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_NN:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_K13orEC:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+ 
+	case HE5_HDFE_COMP_SHUF_SZIP_K13orNN:
+ 
+	  sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]);
+	  strcat(utlbuf2, compparmbuf);
+	  break;
+
+	default:
+	  {
+	    sprintf(errbuf,"Compression code \"%d\" is not supported. \n", compcode);
+	    H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  }
+ 
+	  break;
+ 
+ 
+	}
+ 
+      /* Concatanate compression parameters with compression code */
+      /* -------------------------------------------------------- */
+      strcat(utlbuf, utlbuf2);
+    }
+ 
+ 
+  /*
+******************************************************************
+*   Insert metadata information to Structural Metadata section   *
+******************************************************************
+*/
+  numtype = HE5_EHdtype2numtype(numbertype);
+  if (numtype == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number type ID. \n");
+      H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else if (numtype == 0)
+    {
+      metavalue = 0;
+    }
+  else
+    {
+      metavalue = HE5_EHhid2hsize(numtype);
+      if (metavalue == 0)
+	{
+	  sprintf(errbuf, "Cannot convert \"hid_t\" to \"hsize_t\" data type. \n");
+	  H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+
+  status = HE5_EHinsertmeta(fid, HE5_ZAXZa[idx].zaname, "z", 4L, utlbuf, &metavalue);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Cannot insert metadata for \"%s\" field.\n", za_name);
+      H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+ 
+  /* Release data space ID */
+  /* --------------------- */
+  status =  H5Sclose(data_space);
+  if (status == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, "Cannot release the data space ID.\n");
+      HE5_EHprint("Error: Cannot release the data space ID, occured", __FILE__, __LINE__);
+      return(status);
+    }
+ 
+  /* Release property list ID */
+  /* ------------------------ */
+  status = H5Pclose(HE5_ZAXZa[idx].plist);
+  if (status == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_PLIST, H5E_CLOSEERROR, "Cannot release the property list ID.\n");
+      HE5_EHprint("Error: Cannot release the property list ID, occured", __FILE__, __LINE__);
+      return(status);
+    }
+ 
+  /* Reset external array entry for next dataset creation */
+  /* ==================================================== */
+  HE5_ZAXZa[idx].plist    = FAIL;
+  HE5_ZAXZa[idx].compcode = HE5_HDFE_COMP_NONE;
+ 
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_C_S1))
+    {
+      attr = HE5T_CHARSTRING;
+      status = HE5_ZAwritelocattr(zaID, za_name, "ARRAYOFSTRINGS", H5T_NATIVE_INT, count, &attr);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write attribute to the field \"%s\".",za_name) ;
+	  H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+ 
+    }
+ 
+ COMPLETION:
+  return(status);
+}
+ 
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdefine                                                     |
+|                                                                             |
+|  DESCRIPTION: Defines data field within ZA structure (wrapper)              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  za_name        const char*         za name                                 |
+|  dimlist        char*               Dimension (comma-separated)list         |
+|  maxdimlist     char*               Maximum Dimension (comma-separated) list|
+|  dtype          hid_t               field data type ID                      |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_ZAdefine(hid_t zaID, const char *za_name, char *dimlist, char *maxdimlist, hid_t dtype)
+{
+  herr_t            status     = FAIL;          /* routine return status variable */
+ 
+  HE5_LOCK;
+  CHECKNAME(za_name);
+  CHECKPOINTER(dimlist);
+ 
+  /* Call HE5_ZAdefinefield routine  */
+  /* ==============================  */
+  status = HE5_ZAdefinefield(zaID, "Data Fields", za_name, dimlist,maxdimlist,dtype);
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAwritedatameta                                              |
+|                                                                             |
+|  DESCRIPTION: Defines structural metadata for pre-existing data             |
+|               field within za structure                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fieldname      const char*         fieldname                               |
+|  dimlist        char*               Dimension list (comma-separated list)   |
+|  mvalue         hid_t               metavalue to insert                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|  May 05    S.Zhao       Added HE5_EHdtype2numtype() function call.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_ZAwritedatameta(hid_t zaID, const char *fieldname, char *dimlist, hid_t mvalue)
+{
+  herr_t        status     = FAIL;          /* Return status variable */
+
+  hid_t         fid        = FAIL;          /* HDF-EOS file ID        */
+  hid_t         gid        = FAIL;          /* "HDFEOS" group ID      */
+
+  hsize_t       metavalue  =  0;            /* Metavalue to insert    */
+
+  long          idx        = FAIL;          /* za index               */
+
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+  char          utlbuf[HE5_HDFE_DIMBUFSIZE];/* Utility buffer         */
+  hid_t         numtype    = FAIL;          /* Number type ID         */
+
+  HE5_LOCK;
+  CHECKNAME(fieldname);
+  CHECKPOINTER(dimlist);
+ 
+  numtype = HE5_EHdtype2numtype(mvalue);
+  if (numtype == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number type ID. \n");
+      H5Epush(__FILE__, "HE5_ZAwritedatameta", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else if (numtype == 0)
+    {
+      metavalue = 0;
+    }
+  else
+    {
+      /* Convert 'numtype' to 'metavalue' */
+      /* -------------------------------- */
+      metavalue = HE5_EHhid2hsize(numtype);
+      if ( metavalue == 0 )
+	{
+	  sprintf(errbuf, "Cannot convert metadata value. \n");
+	  H5Epush(__FILE__, "HE5_ZAwritedatameta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAwritedatameta", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Setup and write field metadata */
+      /* ------------------------------ */
+      sprintf(utlbuf, "%s%s%s", fieldname, ":", dimlist);
+      status = HE5_EHinsertmeta(gid, HE5_ZAXZa[idx].zaname, "z", 4L, utlbuf, &metavalue);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot insert metadata value. \n");
+	  H5Epush(__FILE__, "HE5_ZAwritedatameta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAwriteattr                                                  |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute in a za.                             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  attrname       const char*         attribute name                          |
+|  numbertype     hid_t               attribute dataset datatype ID           |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void*               I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_ZAwriteattr(hid_t zaID, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf)
+{
+  herr_t     status     = FAIL;          /* Return status variable  */
+
+  hid_t      fid        = FAIL;          /* HDF-EOS file ID         */
+  hid_t      gid        = FAIL;          /* "HDFEOS" group ID       */
+
+  long       idx        = FAIL;          /* za index                */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+  hid_t      numbertype;
+
+  HE5_LOCK;
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+
+  /* 
+     if numtype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use numtype itself
+  */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      numbertype = numtype;
+    }
+  
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAwriteattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Call HE5_EHattr to perform I/O */
+      /* ------------------------------ */
+      status = HE5_EHattr(HE5_ZAXZa[idx].za_id, attrname, numbertype, count,"w", datbuf);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot write the attribute value. \n");
+	  H5Epush(__FILE__, "HE5_ZAwriteattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAreadattr                                                   |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from a za.                                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  attrname       const char*         attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void*               I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_ZAreadattr(hid_t zaID, const char *attrname, void *datbuf)
+{
+  herr_t      status  = FAIL;             /* Return status variable  */
+
+  hid_t       fid     = FAIL;             /* HDF-EOS file ID         */
+  hid_t       gid     = FAIL;             /* "HDFEOS" group ID       */
+  hid_t       ntype   = FAIL;             /* Data type ID            */  
+
+  long        idx     = FAIL;             /* za index                */
+  
+  hsize_t     count[] ={0};               /* Number of elements      */
+
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+
+  HE5_LOCK;
+  CHECKPOINTER(attrname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAreadattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Call HE5_EHattr to perform I/O */
+      /* ------------------------------ */
+      status = HE5_EHattr(HE5_ZAXZa[idx].za_id, attrname, ntype, count,"r", datbuf);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot read the attribute value. \n");
+	  H5Epush(__FILE__, "HE5_ZAreadattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAattrinfo                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns information about a za attribute                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  attrname       const char*         attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t*              Data type ID                            |
+|  count          hsize_t*            Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date       Programmer   Description                                       |
+|  ========   ============  ================================================= |
+|  Jul 02      S.ZHAO       Original development                              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_ZAattrinfo(hid_t zaID, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t        status  = FAIL;             /* Return status variable  */
+
+  hid_t         fid     = FAIL;             /* HDF-EOS file ID         */
+  hid_t         gid     = FAIL;             /* "HDFEOS" group ID       */
+
+  long          idx     = FAIL;             /* za index                */
+
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer    */
+
+  CHECKPOINTER(attrname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get attribute group ID and call HE5_EHattrinfo */
+      /* ---------------------------------------------- */
+      status = HE5_EHattrinfo(HE5_ZAXZa[idx].za_id, attrname, ntype, count);
+      if ( status == FAIL )
+	{
+	  sprintf(errbuf, "Cannot retrieve information about attribute. \n");
+	  H5Epush(__FILE__, "HE5_ZAattrinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+    }
+
+ COMPLETION:
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqattrs                                                   |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about attributes defined in ZA          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in za struct       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char*               Attribute names in za struct            |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long*               Attributes name list string length      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_ZAinqattrs(hid_t zaID, char *attrnames, long *strbufsize)
+{
+  long            nattr    = FAIL;/* Number of attributes (return)    */
+  long            idx      = FAIL;/* za index                         */
+
+  herr_t          status   = FAIL;/* routine return status variable   */
+
+  hid_t           fid      = FAIL;/* HDF-EOS file ID                  */
+  hid_t           gid      = FAIL;/* za group ID                      */
+
+  char            *grpname = (char *)NULL;/* Group name string        */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAinqattrs", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      grpname = (char *)calloc( HE5_HDFE_NAMBUFSIZE, sizeof(char) );
+      if( grpname == NULL)
+        {
+          H5Epush(__FILE__, "HE5_ZAinqattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory");
+          HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      strcpy(grpname,"/HDFEOS/ZAS/");
+      strcat(grpname, HE5_ZAXZa[idx].zaname);
+
+      nattr = HE5_EHattrcat(fid,  grpname, attrnames, strbufsize);
+      if ( nattr == FAIL )
+	{
+	  sprintf(errbuf, "Cannot find the attributes. \n");
+	  H5Epush(__FILE__, "HE5_ZAinqattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	}
+
+      if (grpname != NULL) free(grpname);
+
+    }
+
+  return (nattr);
+}
+
+
+#define REMQUOTE					\
+							\
+  memmove(utlstr, utlstr + 1, strlen(utlstr) - 2);	\
+  utlstr[strlen(utlstr) - 2] = 0;
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqdims                                                    |
+|                                                                             |
+|  DESCRIPTION: Returns dimension names and values defined in ZA structure    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nDim           long                Number of defined dimensions            |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dimlist        char*               Dimension names (comma-separated)       |
+|  dims           hsize_t             Dimension values                        |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_ZAinqdims(hid_t zaID, char *dimlist, hsize_t dims[])
+{
+  herr_t         status    = FAIL;/* routine return status variable      */
+ 
+  hid_t          fid       = FAIL;/* HDF-EOS file ID                     */
+  hid_t          gid       = FAIL;/* "HDFEOS" group ID                   */
+ 
+  long           idx       = FAIL;/* ZA index                         */
+  long           nDim      =  0;  /* Number of dimensions                */
+ 
+  hsize_t        size      =  0;  /* Dimension size                      */
+ 
+  char           *metabuf = (char *)NULL;     /* Pointer to SM           */
+  char           *metaptrs[2]={NULL,NULL};    /* Ptrs to start/end of SM */
+  char           utlstr[HE5_HDFE_UTLBUFSIZE]; /* Utility string          */
+  char           errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer    */
+ 
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and ZA index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAinqdims", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for ZA ID failed.\n");
+      H5Epush(__FILE__, "HE5_ZAinqdims", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* If dimension names or sizes are desired ... */
+  /* ------------------------------------------- */
+  if (dimlist != NULL || dims != NULL)
+    {
+      /* Get pointers to "Dimension" section within SM */
+      /* --------------------------------------------- */
+      metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z", "Dimension", metaptrs);
+ 
+      /* If dimension names are desired then "clear" name buffer */
+      /* ------------------------------------------------------- */
+      if (dimlist != NULL)
+	dimlist[0] = 0;
+ 
+      /* Begin loop through dimension entries in metadata */
+      /* ------------------------------------------------ */
+      while (1)
+	{
+	  /* Search for OBJECT string */
+	  /* ------------------------ */
+	  metaptrs[0] = strstr(metaptrs[0], "\t\tOBJECT=");
+	  /* If found within "Dimension" metadata section ... */
+	  /* ------------------------------------------------ */
+	  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+	    {
+	      /* Get Dimension Name (if desired) */
+	      /* ------------------------------- */
+	      if (dimlist != NULL)
+		{
+		  /* Check 1st for old meta data then new */
+		  /* ------------------------------------ */
+		  HE5_EHgetmetavalue(metaptrs, "OBJECT", utlstr);
+ 
+		  /*
+		   * If OBJECT value begins with double quote then old
+		   * metadata, dimension name is OBJECT value.
+		   * Otherwise search for "DimensionName" string
+		   */
+		  if (utlstr[0] != '"')
+		    {
+		      metaptrs[0] = strstr(metaptrs[0], "\t\t\t\tDimensionName=");
+		      HE5_EHgetmetavalue(metaptrs, "DimensionName", utlstr);
+		    }
+ 
+		  /* Strip off double quotes */
+		  /* ----------------------- */
+		  REMQUOTE
+ 
+		    /* If not first name then add comma delimitor */
+		    /* ------------------------------------------ */
+		    if (nDim > 0)
+		      {
+			strcat(dimlist, ",");
+		      }
+ 
+		  /* Add dimension name to dimension list */
+		  /* ------------------------------------ */
+		  strcat(dimlist, utlstr);
+		}
+ 
+	      /* Get Dimension Size (if desired) */
+	      /* ------------------------------- */
+	      if (dims != NULL)
+		{
+		  HE5_EHgetmetavalue(metaptrs, "Size", utlstr);
+		  size = (hsize_t)atol(utlstr);
+		  dims[ nDim ] = size;
+		}
+	      /* Increment dimension counter */
+	      /* --------------------------- */
+	      nDim++;
+	    }
+	  else
+	    /* No more dimensions found */
+	    /* ------------------------ */
+	    break;
+	}
+ 
+      free(metabuf);
+    }
+ 
+  return(nDim);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqfield                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns fieldnames, ranks and numbertypes defined in ZA.      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nFld           long                Number of data fields in ZA             |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  datafield      char*               data field                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fieldlist      char*               Field names (comma-separated)           |
+|  rank           int                 Array of ranks                          |
+|  numbertype     hid_t               Array of HDF number types               |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|  Oct 03    S.ZHAO       Added the H5Tclose(datatype) call.                  |
+|  Jan 04    S.Zhao       Modified to enable a character string dataset.      |
+|  Mar 04    S.Zhao       Modified for a character string dataset.            |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static long
+HE5_ZAinqfield(hid_t zaID, char *datafield, char *fieldlist, int rank[], hid_t numbertype[])
+{
+  long          nFld       =  0;       /* Return number of mappings  */
+  long          i          =  0;       /* Loop index                 */
+  long          idx        =  FAIL;    /* za index                   */
+  long          ntflds     =  0;       /* field counter              */
+ 
+  herr_t        status     = FAIL;/* routine return status variable  */
+  herr_t        Dstatus    = FAIL;/* Status for H5Dclose             */
+ 
+  hid_t         fid        = FAIL;/* HDF-EOS file ID                 */
+  hid_t         gid        = FAIL;/* "HDFEOS" group ID               */
+  hid_t         datasetid  = FAIL;/* Dataset ID                      */
+  hid_t         datatype   = FAIL;/* Data type ID                    */
+  hid_t         groupid    = FAIL;/* Group ID                        */
+ 
+  H5T_class_t   classid    = H5T_NO_CLASS;   /* Data type class ID   */
+ 
+  size_t        slen[HE5_DTSETRANKMAX];      /* String length array  */
+  size_t        fldnmlen[HE5_FLDNUMBERMAX];  /* Array of namelengths */
+ 
+  char          *fldnm[HE5_FLDNUMBERMAX];    /* Array of names       */
+  char          *metabuf = (char *)NULL;     /* Pntr to SM           */
+  char          *metaptrs[2]={NULL,NULL};    /* Start/end of SM      */
+  char          utlstr[HE5_HDFE_UTLBUFSIZE]; /* Utility string       */
+  char          utlstr2[HE5_HDFE_UTLBUFSIZE];/* Utility string 2     */
+  char          *ptr[HE5_DTSETRANKMAX];      /* String pointer array */
+  char          *tempfield = (char *)NULL;
+  char          errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */
+  htri_t        str_is_variable;             /* boolean: TRUE if 
+						string is variable 
+						lengeth FALSE if 
+						string is fixed length
+						-1 if error in 
+						H5Tis_variavle_str() */
+ 
+  CHECKPOINTER(datafield);
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAinqfield", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for za ID failed.\n");
+      H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Initialize slen[] array */
+  /* ----------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    slen[i] = 0;
+ 
+  /* Initialize fldnmlen[] array */
+  /* --------------------------- */
+  for (i = 0; i < HE5_FLDNUMBERMAX; i++)
+    fldnmlen[i] = 0;
+ 
+ 
+  /* If field names, ranks,  or number types desired ... */
+  /* --------------------------------------------------- */
+  if (fieldlist != NULL || rank != NULL || numbertype != NULL)
+    {
+      /* Get pointers to "DataField" section within SM */
+      /* --------------------------------------------- */
+      metabuf = (char *)HE5_EHmetagroup( fid, HE5_ZAXZa[idx].zaname, "z", "DataField", metaptrs);
+      strcpy(utlstr2, "DataFieldName");
+         
+ 
+      /* If field names are desired then "clear" name buffer */
+      /* --------------------------------------------------- */
+      if (fieldlist != NULL)
+	fieldlist[0] = 0;
+         
+      /* Begin loop through mapping entries in metadata */
+      /* ---------------------------------------------- */
+      while (1)
+	{
+	  /* Search for OBJECT string */
+	  /* ------------------------ */
+	  metaptrs[0] = strstr(metaptrs[0], "\t\tOBJECT=");
+ 
+	  /* If found within "Data" Field metadata section ... */
+	  /* ------------------------------------------------- */
+	  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+	    {
+	      /* Get field names (if desired) */
+	      /* ---------------------------- */
+	      if (fieldlist != NULL)
+		{
+		  /* Check 1st for old meta data then new */
+		  /* ------------------------------------ */
+		  HE5_EHgetmetavalue(metaptrs, "OBJECT", utlstr);
+ 
+		  /*
+		   * If OBJECT value begins with double quote then old
+		   * metadata, field name is OBJECT value. Otherwise
+		   * search for "DataFieldName" string
+		   */
+ 
+		  if (utlstr[0] != '"')
+		    {
+		      strcpy(utlstr, "\t\t\t\t");
+		      strcat(utlstr, utlstr2);
+		      strcat(utlstr, "=");
+		      metaptrs[0] = strstr(metaptrs[0], utlstr);
+		      HE5_EHgetmetavalue(metaptrs, utlstr2, utlstr);
+		    }
+ 
+		  /* Strip off double quotes */
+		  /* ----------------------- */
+		  REMQUOTE
+ 
+		    /* Add to fieldlist */
+		    /* ---------------- */
+		    if (nFld > 0)
+		      strcat(fieldlist, ",");
+ 
+		  strcat(fieldlist, utlstr);
+ 
+		}
+ 
+	      /* If numbertype  are desired then "clear" name buffer */
+	      /* --------------------------------------------------- */
+	      if (numbertype != NULL)
+		{
+		  ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen);
+		  if(ntflds != FAIL)
+		    {
+		      groupid = HE5_ZAXZa[idx].data_id;
+ 
+		      for(i = 0; i < ntflds; i++)
+			{
+			  tempfield      = (char *)calloc(fldnmlen[i] + 1, sizeof(char));
+			  memmove(tempfield,fldnm[i],fldnmlen[i]);
+ 
+			  /* Open the dataset */
+			  /* ---------------- */
+			  datasetid = H5Dopen(groupid, tempfield);
+			  if ( datasetid == FAIL )
+			    {
+			      sprintf(errbuf, "Cannot open the dataset \"%s\". \n", tempfield);
+			      H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+			      return(FAIL);
+			    }
+ 
+			  /* Get the data type */
+			  /* ----------------- */
+			  datatype = H5Dget_type(datasetid);
+			  if ( datatype == FAIL )
+			    {
+			      sprintf(errbuf, "Cannot get the data type ID. \n");
+			      H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+			      return(FAIL);
+			    }
+ 
+			  /* Get the data type class ID */
+			  /* -------------------------- */
+			  classid        = H5Tget_class(datatype);
+			  if ( classid == H5T_NO_CLASS )
+			    {
+			      sprintf(errbuf, "Cannot get the data type class ID. \n");
+			      H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+			      return(FAIL);
+			    }
+ 
+			  if (classid == H5T_STRING)
+			    {
+			      /* HE5T_CHARSTRING has variable length for data fields */
+			      str_is_variable = H5Tis_variable_str(datatype);
+			      if(str_is_variable == TRUE)
+				{
+				  numbertype[i] = HE5T_CHARSTRING;
+				}
+			      else if(str_is_variable == FALSE)
+				{
+				  numbertype[i] = HE5T_NATIVE_CHAR;
+				}
+			      else
+				{
+				  status = FAIL;
+				  sprintf(errbuf, "Failed to see if string field is varaible or fixed length.\n");
+				  H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+							  
+				  HE5_EHprint(errbuf, __FILE__, __LINE__);
+				  if (metabuf != NULL) free(metabuf);
+				  free(tempfield);
+				  return(status);
+				}
+						      
+			      /*HE5_ZAgetstringtype(zaID, fieldname,classid);*/
+			      /*numbertype[i] = HE5T_CHARSTRING;*/
+			    }
+			  else
+			    {
+			      numbertype[i] = HE5_EHdtype2numtype(datatype);
+			      if ( numbertype[i] == FAIL )
+				{
+				  sprintf(errbuf, "Cannot get the number type ID. \n");
+				  H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+				  HE5_EHprint(errbuf, __FILE__, __LINE__);
+				  if (metabuf != NULL) free(metabuf);
+				  free(tempfield);
+				  return(FAIL);
+				}
+			    }
+						  
+			  /* Release the datatype ID */
+			  /* ----------------------- */
+			  status = H5Tclose(datatype);
+			  if ( status == FAIL )
+			    {
+			      sprintf(errbuf, "Cannot close the datatype \"%s\". \n", tempfield);
+			      H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+			      return(FAIL);
+			    }
+ 
+			  /* Release the dataset ID */
+			  /* ---------------------- */
+			  Dstatus        = H5Dclose(datasetid);
+			  if ( Dstatus == FAIL )
+			    {
+			      sprintf(errbuf, "Cannot close the dataset \"%s\". \n", tempfield);
+			      H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+			      HE5_EHprint(errbuf, __FILE__, __LINE__);
+			      if (metabuf != NULL) free(metabuf);
+			      free(tempfield);
+			      return(FAIL);
+			    }
+			  free(tempfield);
+			}
+		    }
+		}
+ 
+ 
+	      /*
+	       * Get Rank (if desired) by counting # of dimensions in
+	       * "DimList" string
+	       */
+	      if (rank != NULL)
+		{
+		  HE5_EHgetmetavalue(metaptrs, "DimList", utlstr);
+		  rank[nFld] = HE5_EHlong2int(HE5_EHparsestr(utlstr, ',', ptr, slen) );
+		  if (rank[nFld] == FAIL )
+		    {
+		      sprintf(errbuf, "Cannot convert data type. \n");
+		      H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      if(metabuf != NULL) free(metabuf);
+		      return(FAIL);
+		    }
+		}
+ 
+	      /* Increment field counter */
+	      /* ----------------------- */
+	      nFld++;
+ 
+	    }
+	  else
+	    /* No more fields found */
+	    /* -------------------- */
+	    break;
+	}
+         
+      if (metabuf != NULL) free(metabuf);
+    }
+ 
+ COMPLETION: 
+  return(nFld);
+}
+ 
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinquire                                                    |
+|                                                                             |
+|  DESCRIPTION: Inquires about data fields in za                              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nflds          long                Number of data fields in za             |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  za_name_list   char*               Field names (comma-separated)           |
+|  rank           int                 Array of ranks                          |
+|  dtype          hid_t               data type ID                            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_ZAinquire(hid_t zaID, char *za_name_list, int rank[], hid_t dtype[])
+{
+  long            nflds   = FAIL;             /* Number of Data fields */
+ 
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+ 
+ 
+  /* Call "HE5_ZAinqfield" routine to get number of fields */
+  /* ----------------------------------------------------- */
+  nflds = HE5_ZAinqfield(zaID, "Data Fields", za_name_list, NULL, NULL);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n");
+      H5Epush(__FILE__, "HE5_ZAinquire", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Call "HE5_ZAinqfield" routine to get other parameters */
+  /* ----------------------------------------------------- */
+  nflds = HE5_ZAinqfield(zaID, "Data Fields", za_name_list, rank, dtype);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Inquiry about fields in \"Data Fields\" group fails. \n");
+      H5Epush(__FILE__, "HE5_ZAinquire", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  return(nflds);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqdatatype                                                |
+|                                                                             |
+|  DESCRIPTION: Inquires about data field in za                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t               return status (0) SUCCEED, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t                                                       |
+|  fieldname      const char*                                                 |
+|  attrname       const char*                                                 |
+|  group          int                 Group flag:                             |
+|                                       ...DATAGROUP - for the field          |
+|                                       ...ATTRGROUP, ...GRPATTRGROUP,        |
+|                                       ...LOCATTRGROUP - for the attribute   |
+|  OUTPUTS:                                                                   |
+|  datatype       hid_t*                                                      |
+|  classid        H5T_class_t*                                                |
+|  order          H5T_order_t*                                                |
+|  size           size_t*                                                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_ZAinqdatatype(hid_t zaID, const char *fieldname, const char *attrname, int group, hid_t *datatype, H5T_class_t *classid, H5T_order_t *order, size_t *size)
+{
+ 
+  herr_t      status     = FAIL;	      /* routine return status */
+
+  int         fldgroup   = FAIL;              /* Field group flag      */
+
+  hid_t       datasetid  = FAIL;	      /* Dataset ID            */
+  hid_t       fid        = FAIL;	      /* HDF-EOS file ID       */
+  hid_t       gid        = FAIL;	      /* "HDFEOS" group ID     */
+  hid_t       attr       = FAIL;	      /* attribute dataset ID  */
+  hid_t       fldgroupID = FAIL;	      /* Field group ID        */
+  hid_t       fieldID    = FAIL;	      /* Field dataset ID      */         
+
+  long        idx        = FAIL;	      /* za index              */
+
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAinqdatatype", &fid, &gid, &idx);
+  if(status == SUCCEED)
+    {
+      if(group == HE5_HDFE_DATAGROUP)
+	fldgroupID = HE5_ZAXZa[idx].data_id;
+      else if(group == HE5_HDFE_ATTRGROUP)
+	fldgroupID = HE5_ZAXZa[idx].za_id;
+      else if(group == HE5_HDFE_GRPATTRGROUP)
+	fldgroupID = HE5_ZAXZa[idx].data_id;
+      else if(group == HE5_HDFE_LOCATTRGROUP)
+	{
+	  /* Get the field group flag */
+	  /* ------------------------ */
+	  fldgroup = HE5_ZAfldsrch(zaID,(char *)fieldname,NULL,NULL,NULL,NULL);
+	  if(fldgroup == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot get the group flag for \"%s\" field.\n",fieldname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+		  
+	  if (fldgroup == HE5_HDFE_DATAGROUP)
+	    fldgroupID = HE5_ZAXZa[idx].data_id;
+
+	}
+      else
+	{
+	  sprintf(errbuf, "Invalid group flag (\"%d\"). \n", group);
+	  H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_BADVALUE , errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+		
+      /* Get data type information for the field */
+      /* --------------------------------------- */
+      if( group == HE5_HDFE_DATAGROUP )
+	{
+	  datasetid = H5Dopen(fldgroupID, fieldname);
+	  if (datasetid == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the dataset for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+			
+	  *datatype = H5Dget_type(datasetid);
+	  if (*datatype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the datatype for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	   
+	      return(FAIL);
+	    }
+
+	  *classid  = H5Tget_class(*datatype);
+	  if (*classid == H5T_NO_CLASS)
+	    {
+	      sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	   
+	      return(FAIL);
+	    }
+
+	  *order    = H5Tget_order(*datatype);
+	  if (*order == H5T_ORDER_ERROR)
+	    {
+	      sprintf(errbuf, "Cannot get the data type order for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+			
+	  if (*classid == H5T_STRING)
+	    {
+	      *size = H5Tget_size(*datatype);
+	    }
+	  else
+	    {
+	      *size     = H5Tget_size(*datatype);
+	      if (*size == 0)
+		{
+		  sprintf(errbuf, "Cannot get the data type size for the \"%s\" field.\n", fieldname);
+		  H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+		  return(FAIL);
+		}
+	    }
+			
+	  status = H5Dclose(datasetid);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" field.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+	}
+      /* Get data type information about global/group attribute */
+      /* ------------------------------------------------------ */
+      else if(group == HE5_HDFE_ATTRGROUP || group == HE5_HDFE_GRPATTRGROUP)
+	{
+	  attr      = H5Aopen_name(fldgroupID, attrname);
+	  if (attr == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	   
+	      return(FAIL);
+	    }
+
+	  *datatype = H5Aget_type(attr);
+	  if (*datatype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the data type for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+			
+	  *classid  = H5Tget_class(*datatype);
+	  if (*classid == H5T_NO_CLASS)
+	    {
+	      sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	   
+	      return(FAIL);
+	    }
+
+	  *order    = H5Tget_order(*datatype);
+	  if (*order == H5T_ORDER_ERROR)
+	    {
+	      sprintf(errbuf, "Cannot get the data type order for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+
+	  if (*classid == H5T_STRING)
+	    {
+	      *size = H5Tget_size(*datatype);
+	    }
+	  else
+	    {
+	      *size     = H5Tget_size(*datatype);
+	      if (*size == 0)
+		{
+		  sprintf(errbuf, "Cannot get the data type size for the \"%s\" attribute.\n", attrname);
+		  H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+		  return(FAIL);
+		}
+	    }
+			
+	  status = H5Aclose(attr);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+			
+	}
+      /* Get data type information for local attribute */
+      /* --------------------------------------------- */
+      else if(group == HE5_HDFE_LOCATTRGROUP)
+	{
+
+	  fieldID = H5Dopen(fldgroupID, fieldname);
+	  if(fieldID == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  attr = H5Aopen_name(fieldID, attrname);
+	  if (attr == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot open the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	   
+	      return(FAIL);
+	    }
+
+	  *datatype = H5Aget_type(attr);
+	  if (*datatype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the data type for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+			
+	  *classid  = H5Tget_class(*datatype);
+	  if (*classid == H5T_NO_CLASS)
+	    {
+	      sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	   
+	      return(FAIL);
+	    }
+
+	  *order    = H5Tget_order(*datatype);
+	  if (*order == H5T_ORDER_ERROR)
+	    {
+	      sprintf(errbuf, "Cannot get the data type order for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+
+	  if (*classid == H5T_STRING)
+	    {
+	      *size = H5Tget_size(*datatype);
+	    }
+	  else
+	    {
+	      *size     = H5Tget_size(*datatype);
+	      if (*size == 0)
+		{
+		  sprintf(errbuf, "Cannot get the data type size for the \"%s\" attribute.\n", attrname);
+		  H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+		  return(FAIL);
+		}
+	    }
+			
+	  status = H5Aclose(attr);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }
+
+	  status = H5Dclose(fieldID);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname);
+	      H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+				
+	      return(FAIL);
+	    }		   
+	}
+    }
+
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAchunkinfo                                                  |
+|                                                                             |
+|  DESCRIPTION: Retrieves chunking information                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t  None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fldname        char*               name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  chunk_rank     int*                rank of a dataset                       |
+|  chunk_dims     hsize_t             the array containing sizes              |
+|                                     of each dimension of a chunk            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|  Date        Programmer    Description                                      |
+|  =========   ============  ==============================================   |
+|  Dec 03      S.Zhao        Original development                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_ZAchunkinfo(hid_t zaID, char *fldname, int *chunk_rank,  hsize_t chunk_dims[])
+{
+  herr_t          status   = FAIL;/* Return status variable */
+ 
+  hid_t           fid      = FAIL;/* HDF-EOS file ID        */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID      */
+  long            idx      = FAIL;/* ZA index               */
+  hid_t           fieldID  = FAIL;/* field dataset ID       */
+  hid_t           plist    = FAIL;/* field dataset property list ID   */
+  hid_t           dspace   = FAIL;/* "fieldname" Dataspace ID         */
+ 
+  int             ndims    = 0;   /* Number of dimensions   */
+ 
+  H5D_layout_t    layout = H5D_LAYOUT_ERROR; /* Storage layout type   */
+ 
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+ 
+ 
+  HE5_LOCK;
+  CHECKPOINTER(fldname);
+ 
+  /* Initialize chunk_rank to FAIL (error) */
+  /* ------------------------------------- */
+  *chunk_rank = FAIL;
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and ZA index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAchunkinfo", &fid, &gid, &idx);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Checking for valid ZA ID failed.\n");
+      H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+ 
+  /* Check out the field group and get field ID */
+  /* ------------------------------------------ */
+  HE5_ZAfldsrch(zaID,fldname,&fieldID,NULL,NULL,NULL);
+  if(fieldID == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the field ID for the \"%s\" field.\n", fldname);
+      H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get the property list ID */
+  /* ------------------------ */
+  plist = H5Dget_create_plist(fieldID);
+  if (plist == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fldname);
+      H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get the data space ID */
+  /* --------------------- */
+  dspace = H5Dget_space(fieldID);
+  if(dspace == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the data space ID for the \"%s\" data field.\n", fldname);
+      H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get the dataset rank */
+  /* -------------------- */
+  ndims  = H5Sget_simple_extent_ndims(dspace);
+  if(ndims == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the rank of the dataset.\n");
+      H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get Layout */
+  /* ---------- */
+  layout = H5Pget_layout(plist);
+  if (layout == H5D_LAYOUT_ERROR)
+    {
+      sprintf(errbuf, "Cannot get the layout of the raw data. \n");
+      H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_PLIST, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  else if (layout == H5D_CHUNKED)
+    {
+      /* Get chunking */
+      /* ------------ */
+      *chunk_rank = H5Pget_chunk(plist, ndims, chunk_dims);
+      if (*chunk_rank == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get the sizes of chunks. \n");
+	  H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+  else
+    {
+      *chunk_rank = 0;
+    }
+ 
+  /* Release property list ID */
+  /* ------------------------ */
+  status = H5Pclose(plist);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release property list ID. \n");
+      H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Release the data space ID */
+  /* ------------------------- */
+  status = H5Sclose(dspace);
+  if( status == FAIL)
+    {
+      sprintf(errbuf, "Cannot release the data space ID.\n");
+      H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAnentries                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns number of entries and string buffer size              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nEntries       long                Number of entries                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  entrycode      int                 Entry code:                             |
+|                                                                             |
+|                                     HE5_HDFE_NENTDIM  (0)                   |
+|                                     HE5_HDFE_NENTMAP  (1)                   |
+|                                     HE5_HDFE_NENTIMAP (2)                   |
+|                                     HE5_HDFE_NENTDFLD (4)                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long*               Length of comma-separated list          |
+|                                     (Does not include null-terminator)      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_ZAnentries(hid_t zaID, int entrycode, long *strbufsize)
+{
+  herr_t          status     = FAIL;/* routine return status variable  */  
+  
+  hid_t           fid        = FAIL;/* HDF-EOS file ID                 */
+  hid_t           gid        = FAIL;/* "HDFEOS" group ID               */
+  
+  long            idx        = FAIL;/* za index                        */
+  long            nEntries   = 0;   /* Number of entries               */
+  long            metaflag   = FAIL;/* Old (0), New (1) metadata flag) */
+  long            nVal       = 0;   /* Number of strings to search for */
+  long            i;                /* Loop index                      */
+  
+  char            *metabuf = (char *)NULL;    /* Ptr to SM             */
+  char            *metaptrs[2]={NULL,NULL};   /* Start/end of SM       */
+  char            utlstr[HE5_HDFE_UTLBUFSIZE];/* Utility string        */
+  char            valName[2][32];             /* Strings to search for */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+  
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAnentries", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Zero out string buffer size */
+      /* --------------------------- */
+      *strbufsize = 0;
+       
+      /*
+       * Get pointer to relevant section within SM and Get names of
+       * metadata strings to inquire about
+       */
+      switch (entrycode)
+        {
+        case HE5_HDFE_NENTDIM:
+	  /* Dimensions */
+	  /* ---------- */
+	  {
+	    metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z", "Dimension", metaptrs);
+	    nVal = 1;
+	    strcpy(&valName[0][0], "DimensionName");
+	  }
+	  break;
+		  
+        case HE5_HDFE_NENTMAP:
+	  /* Dimension Maps */
+	  /* -------------- */
+	  {
+	    metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z", "DimensionMap", metaptrs);
+	    nVal = 1;
+	    strcpy(&valName[0][0], "DataDimension");
+	  }
+	  break;
+
+        case HE5_HDFE_NENTIMAP:
+	  /* Indexed Dimension Maps */
+	  /* ---------------------- */
+	  {
+	    metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z","IndexDimensionMap", metaptrs);
+	    nVal = 1;
+	    strcpy(&valName[0][0], "DataDimension");
+	  }
+	  break;
+		  
+        case HE5_HDFE_NENTDFLD:
+	  /* Data Fields */
+	  /* ----------- */
+	  {
+	    metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z", "DataField", metaptrs);
+	    nVal = 1;
+	    strcpy(&valName[0][0], "DataFieldName");
+	  }
+	  break;
+
+	default:
+	  {
+	    sprintf(errbuf,"Invalid (unsupported) entry code \"%d\". \n", entrycode);       
+	    H5Epush(__FILE__, "HE5_ZAnentries", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf);
+	    HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  }
+	  break;
+        }
+
+	  
+      if ( metabuf == NULL )
+	{
+	  nEntries = FAIL;
+	  sprintf(errbuf,"Cannot get the number of entries. \n");
+	  H5Epush(__FILE__, "HE5_ZAnentries", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(nEntries);
+	}
+	  
+
+
+      /*
+       * Check for presence of 'GROUP="' string If found then old metadata,
+       * search on OBJECT string
+       */
+      metaflag = (strstr(metabuf, "GROUP=\"") == NULL) ? 1 : 0;
+      if (metaflag == 0)
+        {
+	  nVal = 1;
+	  strcpy(&valName[0][0], "\t\tOBJECT");
+        }
+
+      /* Begin loop through entries in metadata */
+      /* -------------------------------------- */
+      while (1)
+        {
+	  /* Search for first string */
+	  /* ----------------------- */
+	  strcpy(utlstr, &valName[0][0]);
+	  strcat(utlstr, "=");
+	  metaptrs[0] = strstr(metaptrs[0], utlstr);
+
+	  /* If found within relevant metadata section ... */
+	  /* --------------------------------------------- */
+	  if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL)
+            {
+	      for (i = 0; i < nVal; i++)
+                {
+		  /*
+		   * Get all string values Don't count quotes
+		   */
+		  status = HE5_EHgetmetavalue(metaptrs, &valName[i][0], utlstr);
+		  if ( status == FAIL )
+		    {
+		      nEntries = FAIL;
+		      sprintf(errbuf,"Cannot get metavalue. \n");
+		      H5Epush(__FILE__, "HE5_ZAnentries", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(metabuf);
+			    
+		      return(nEntries);
+		    }
+
+
+		  *strbufsize += strlen(utlstr) - 2;
+                }
+	      /* Increment number of entries */
+	      /* --------------------------- */
+	      nEntries++;
+
+	      /* Go to end of OBJECT */
+	      /* ------------------- */
+	      metaptrs[0] = strstr(metaptrs[0], "END_OBJECT");
+            }
+	  else
+	    /* No more entries found */
+	    /* --------------------- */
+            {
+	      break;
+            }
+        }
+      if (metabuf != NULL) free(metabuf);
+
+
+      /* Count comma separators & slashes (if mappings) */
+      /* ---------------------------------------------- */
+      if (nEntries > 0)
+        {
+	  *strbufsize += nEntries - 1;
+	  *strbufsize += (nVal - 1) * nEntries;
+        }
+    }
+  
+  return(nEntries);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqza                                                      |
+|                                                                             |
+|  DESCRIPTION: Returns number and names of ZA structures in file             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nZA            long                Number of ZA structures in file         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  filename       const char*         HDF-EOS filename                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  zalist         char*               List of za names (comma-separated)      |
+|  strbufsize     long*               Length of zalist                        |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_ZAinqza(const char *filename, char *zalist, long *strbufsize)
+{
+  long       nZA   = FAIL;            /* Number of zas in file */
+
+  herr_t     status   = FAIL;            /* Return status variable   */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */  
+
+  CHECKPOINTER(filename);
+
+  /* Call "HE5_EHinquire" routine */
+  /* ---------------------------- */
+  nZA = HE5_EHinquire(filename,  "/HDFEOS/ZAS", zalist, strbufsize);
+  if ( nZA == FAIL )
+    {
+      sprintf(errbuf,"Cannot get information about ZA. \n");
+      H5Epush(__FILE__, "HE5_ZAinqza", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }								 
+
+ COMPLETION:
+  return(nZA);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAwrrdfield                                                  |
+|                                                                             |
+|  DESCRIPTION: Writes/Reads fields                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fldname        char*               field name                              |
+|  code           char*               Write/Read code (w/r)                   |
+|  start          hssize_t            start array                             |
+|  stride         hsize_t             stride array                            |
+|  count          hsize_t             count array                             |
+|  datbuf         void                data buffer for read                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                data buffer for write                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|  Jan 04    S.Zhao       Added to write/read a character string dataset.     |
+|  Apr 04    S.Zhao       Modified for a character string dataset.            |
+|  Feb 05    S.Zhao       Replaced the "count" array by the "dims" array if   |
+|                         it was declared larger than the dimension size.     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static herr_t    
+HE5_ZAwrrdfield(hid_t zaID, char *fldname, char *code, const hssize_t start[], const hsize_t stride[], const hsize_t count[],  void *datbuf)
+{    
+  herr_t          status   = FAIL; /* routine return status variable     */    
+
+  int             i;   		   /* Loop index                         */
+  int             startf   =  0;   /* flag (if start is NULL)            */
+  int             countf   =  0;   /* flag (if counf is NULL)            */
+  int             bothf    =  0;   /* flag (if start and count are NULL) */
+  int             append   = FALSE;/* FLAG (if field is appendible)      */
+  int             rank     = FAIL; /* Rank of dataset                    */
+  int             maxrank  =  0;   /* Rank dummy variable                */
+  int             nameflag = FAIL; /* Actual (1)/Alias (0) field name    */
+   
+  hid_t           fid      = FAIL;/* HDF-EOS file ID                     */
+  hid_t           fieldID  = FAIL;/* fieldname Dataset ID                */
+  hid_t           fspace   = FAIL;/* file data space ID                  */
+  hid_t           mid      = FAIL;/* memory data space ID                */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID                   */
+  hid_t           tid      = FAIL;/* datatype ID                         */
+  hid_t           mtype    = FAIL;/* Memory data type ID                 */
+
+  long            idx      = FAIL;/* za index                            */
+  
+  hsize_t         dims[HE5_DTSETRANKMAX];   /* Field dimensions          */
+  hsize_t         maxdims[HE5_DTSETRANKMAX];/* Field maximum dimensions  */
+  hssize_t        *tstart =(hssize_t *)NULL;/* Not NULL "start" value    */
+  hsize_t         *tcount = (hsize_t *)NULL;/* Not NULL "count" value    */
+  hsize_t         *lcount = (hsize_t *)NULL;
+  hsize_t         dimsize = 0;		    /* Field dimension size      */
+  hsize_t         size[HE5_DTSETRANKMAX];   /* Extended dimension size   */
+
+  hid_t           ntype[1]  = {FAIL};       /* Datatype ID               */
+
+  char            *dimbuf   = (char *)NULL;  
+  char            *comma    = (char *)NULL;
+  char            *dimcheck = (char *)NULL;
+  char            fieldname[HE5_HDFE_NAMBUFSIZE];    /* Field name buffer      */
+  char            fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual field name      */     
+  char            maxdimlist[HE5_HDFE_DIMBUFSIZE];   /* Maximum dimension list */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];       /* Error message buffer   */  
+
+  H5T_class_t     classid = H5T_NO_CLASS;            /* data type class ID     */
+
+  int             ibuf;                /* Loop index                        */
+  char            **chardatbuf = NULL; /* string data buffer                */
+  int             maxlen = 0;          /* max length in array of string     */
+  int             strsize = 0;         /* each str length in array of str   */
+  hsize_t         numattr[1];          /* number of attribute elements      */
+  int             mycount = 0;         /* flag                              */
+  long            strbufsize1;         /* string buffer size                */
+  long            strbufsize2;         /* string buffer size                */
+  long            nattr = 0;           /* number of attributes              */
+  char            *attrlist1 = (char *)NULL;/* attribute list               */
+  char            *attrlist2 = (char *)NULL;/* attribute list               */
+  char            *attptr = (char *)NULL;   /* attribute pointer            */
+
+  CHECKNAME(fldname);
+  
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAwrrdfield", &fid, &gid, &idx);  
+  if (status == FAIL) return(status);
+
+  	  
+  /* Call HE5_ZAfldnameinfo() to get actual field name */
+  /* ------------------------------------------------- */
+  nameflag = HE5_ZAfldnameinfo(zaID, fldname, fldactualname);
+  if ( nameflag == FAIL )
+    {
+      sprintf(errbuf, "Cannot get actual name of the field.\n");
+      H5Epush(__FILE__,  "HE5_ZAwrrdfield", __LINE__,H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Name is not alias */
+  /* ----------------- */
+  if (nameflag == TRUE)
+    {
+      strcpy(fieldname,"");
+      strcpy(fieldname,fldname);
+    }
+
+  /* Name is an alias */
+  /* ---------------- */
+  if (nameflag == FALSE)
+    {
+      strcpy(fieldname,"");
+      strcpy(fieldname,fldactualname);
+    }
+
+
+  /* Initialize dims[]/maxdims[]/size[] arrays */
+  /* ----------------------------------------- */
+  for (i = 0; i < HE5_DTSETRANKMAX; i++)
+    {
+      dims[i]    = 0;
+      maxdims[i] = 0;
+      size[i]    = 0;
+    }
+  
+  /* Check whether fieldname is in dataset (multi-dim field) */
+  /* ------------------------------------------------------- */
+  status = HE5_ZAinfo(zaID, fieldname, &rank, dims, ntype, NULL, maxdimlist);
+  if( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot get information about \"%s\" field. \n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+
+  /* Find out if the field is appendable */
+  /* ----------------------------------- */
+  dimbuf = (char *) calloc(strlen(maxdimlist) + 64, sizeof(char));
+  if(dimbuf == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory.\n");
+      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  strcpy(dimbuf,maxdimlist);
+  strcat(dimbuf,",");
+  comma = strchr(dimbuf,',');
+  
+  while(comma != NULL)
+    {
+      dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char));
+      if(dimcheck == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory.\n");
+	  H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(dimbuf);
+	  return(FAIL);
+	}
+      memmove(dimcheck,dimbuf,comma-dimbuf);
+
+      /* Get dimension size */
+      /* ------------------ */
+      dimsize = HE5_ZAdiminfo(zaID, dimcheck);
+      if ( (dimsize > 0 && strcmp(dimcheck,"Unlim") != 0 ) || (dimsize == H5S_UNLIMITED && strcmp(dimcheck,"Unlim") == 0 )  )
+	{
+	  maxdims[maxrank] = dimsize;
+	  maxrank++;
+	}
+      memmove(dimbuf,comma+1,strlen(comma+1)+1);
+      comma = strchr(dimbuf,',');
+      free(dimcheck);
+    }
+
+  free(dimbuf);
+  
+  for(i = 0; i < rank; i++)
+    {
+      if(   dims[i] == maxdims[i] )
+	append = FALSE;
+      else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED))
+	{
+	  append = TRUE;
+	  break;
+	}
+      else
+	{
+	  sprintf(errbuf,"Maximum dimension size is smaller than dimension size.\n");
+	  H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }        
+  
+
+  if(start == NULL)
+    {
+      tstart = (hssize_t *)calloc(rank, sizeof(hssize_t));
+      for(i = 0; i < rank; i++)
+	tstart[ i ] = 0;
+      startf = 1;
+    }
+  if(count == NULL)
+    {
+      tcount = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      for(i = 0; i < rank; i++)
+	tcount[ i ] = dims[ i ];
+      if(startf == 1)
+	bothf = 1;
+      else
+	countf = 1;
+    }
+  else
+    {
+      lcount =  (hsize_t *)calloc(rank, sizeof(hsize_t));
+      for(i = 0; i < rank; i++)
+	{
+	  if(count[ i ] > dims[ i ])
+	    lcount[ i ] = dims[ i ];
+	  else
+	    lcount[ i ] = count[ i ];
+	}
+    }
+  
+  if (append == TRUE)
+    {
+      /* Get the field-related dataset ID */
+      /* -------------------------------- */
+      HE5_ZAfieldsizeID(zaID, fieldname, &fieldID);
+	  
+      if(bothf == 1)
+	status = H5Dextend(fieldID, tcount);
+      else if(startf == 1)
+	status = H5Dextend(fieldID, lcount);
+      else if(countf == 1)
+	status = H5Dextend(fieldID, tcount);
+      else
+	{
+	  for(i = 0; i < rank; i++)
+	    size[ i ] = start[ i ] + lcount[ i ];
+		 
+	  /* Extend the dataset size */
+	  /* ----------------------- */
+	  status = H5Dextend(fieldID, size);
+	}
+
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot extend the dataset. \n");
+	  H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (start == NULL)
+	    {
+	      if (tstart != NULL)
+		free(tstart);
+	    }
+	  if (count == NULL)
+	    {
+	      if (tcount != NULL)
+		free(tcount);
+	    }
+	  if (lcount != NULL)
+	    free(lcount);
+
+	  return(FAIL);
+	}
+    }
+  
+  if (append == FALSE)
+    {   
+      /* Get the field-related dataset ID */
+      /* -------------------------------- */
+      HE5_ZAfieldsizeID(zaID, fieldname, &fieldID);
+    }
+  
+  /* Get the file space ID */
+  /* --------------------- */
+  fspace = H5Dget_space(fieldID );
+  if( fspace == FAIL)
+    {
+      sprintf(errbuf,"Cannot get data space ID. \n");
+      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL) 
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL) 
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+	  
+      return(FAIL);
+    }
+  
+  /* Select the hyperslab */
+  /* -------------------- */
+  if(bothf == 1)
+    status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)tstart,stride,tcount,NULL);
+  else if(startf == 1)
+    status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)tstart,stride,lcount,NULL);
+  else if(countf == 1)
+    status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)start,stride,tcount,NULL);
+  else
+    status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)start,stride,lcount,NULL) ;
+  
+  if( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot select a hyperslab. \n");
+      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL) 
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL) 
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+		
+      return(FAIL);
+    }
+  
+  
+  /* Define memory space */
+  /* =================== */
+  if(countf == 1 || bothf == 1)
+    mid = H5Screate_simple(rank, tcount, NULL);
+  else
+    mid = H5Screate_simple(rank, lcount, NULL);
+  
+  if( mid == FAIL)
+    {
+      sprintf(errbuf,"Cannot create the data space.\n");
+      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASPACE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL) 
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL) 
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+		
+      return(FAIL);
+    }
+  
+  
+  /* Get the data type ID */
+  /* -------------------- */
+  tid = H5Dget_type(fieldID );
+  if( tid == FAIL )
+    {
+      sprintf(errbuf,"Cannot get the data type ID.\n");
+      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL) 
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL) 
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+		
+      return(FAIL);
+    }
+  
+  /* Get the data type class ID */
+  /* -------------------------- */
+  classid = H5Tget_class(tid);
+  if (classid == H5T_NO_CLASS)
+    {
+      sprintf(errbuf,"Cannot get the data type class ID.\n");
+      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      if (start == NULL)
+	{
+	  if (tstart != NULL)
+	    free(tstart);
+	}
+      if (count == NULL)
+	{
+	  if (tcount != NULL)
+	    free(tcount);
+	}
+      if (lcount != NULL)
+	free(lcount);
+ 
+      return(FAIL);
+    }
+  
+  /* Write/read whole data to/from the dataset */
+  /* ========================================= */
+  if( strcmp(code,"w") == 0)
+    {
+      strbufsize1 = 0;
+      nattr = HE5_ZAinqlocattrs(zaID, fieldname, NULL, &strbufsize1);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot retrieve the attributes. \n");
+	  H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (start == NULL)
+	    {
+	      if (tstart != NULL)
+		free(tstart);
+	    }
+	  if (count == NULL)
+	    {
+	      if (tcount != NULL)
+		free(tcount);
+	    }
+	  if (lcount != NULL)
+	    free(lcount);
+ 
+	  return(FAIL);
+ 
+	}
+ 
+      attrlist1 = (char *) calloc(strbufsize1 + 2, sizeof(char));
+      if (attrlist1 == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for attrlist1.\n") ;
+	  H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (start == NULL)
+	    {
+	      if (tstart != NULL)
+		free(tstart);
+	    }
+	  if (count == NULL)
+	    {
+	      if (tcount != NULL)
+		free(tcount);
+	    }
+	  if (lcount != NULL)
+	    free(lcount);
+ 
+	  return(FAIL);
+ 
+	}
+ 
+      nattr = HE5_ZAinqlocattrs(zaID, fieldname, attrlist1, &strbufsize1);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot retrieve the attributes. \n");
+	  H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (attrlist1 != NULL)
+	    {
+	      free(attrlist1);
+	      attrlist1 = NULL;
+	    }
+	  if (start == NULL)
+	    {
+	      if (tstart != NULL)
+		free(tstart);
+	    }
+	  if (count == NULL)
+	    {
+	      if (tcount != NULL)
+		free(tcount);
+	    }
+	  if (lcount != NULL)
+	    free(lcount);
+ 
+	  return(FAIL);
+ 
+	}
+ 
+      attptr = strstr(attrlist1,"ARRAYOFSTRINGS");
+      if ( (classid == H5T_STRING) && (attptr == NULL) )
+	{
+	  status = H5Dwrite(fieldID, tid, mid, fspace,  H5P_DEFAULT, datbuf);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot write data to the dataset.\n");
+	      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(status);
+	    }
+	}
+ 
+      else if ( (classid == H5T_STRING) && (attptr != NULL) )
+	{
+	  strbufsize2 = 0;
+	  nattr = HE5_ZAinqlocattrs(zaID, fieldname, NULL, &strbufsize2);
+	  if ( nattr < 0 )
+	    {
+	      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+	      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(FAIL);
+ 
+	    }
+ 
+	  attrlist2 = (char *) calloc(strbufsize2 + 2, sizeof(char));
+	  if (attrlist2 == NULL)
+	    {
+	      sprintf(errbuf, "Cannot allocate memory for attrlist2.\n") ;
+	      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(FAIL);
+ 
+	    }
+ 
+	  nattr = HE5_ZAinqlocattrs(zaID, fieldname, attrlist2, &strbufsize2);
+	  if ( nattr < 0 )
+	    {
+	      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+	      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (attrlist2 != NULL)
+		{
+		  free(attrlist2);
+		  attrlist2 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(FAIL);
+ 
+	    }
+ 
+	  if ( (nattr == 0) || ((attptr = strstr(attrlist2,"StringLengthAttribute")) == NULL) )
+	    {
+	      chardatbuf = (char **)datbuf;
+	      if (count == NULL) mycount = tcount[0];
+	      if (count != NULL) mycount = *lcount;
+	      for (ibuf = 0; ibuf < mycount; ibuf++)
+		{
+		  if (chardatbuf[ibuf] == NULL)
+		    strsize = 0;
+		  else
+		    strsize = strlen(chardatbuf[ibuf]);
+		  if (strsize > maxlen)
+		    maxlen = strsize;
+ 
+		}
+ 
+	      numattr[0] = 1;
+	      status = HE5_ZAwritelocattr(zaID, fieldname, "StringLengthAttribute", H5T_NATIVE_INT, numattr, &maxlen);
+	      if (status == FAIL)
+		{
+		  sprintf(errbuf, "Cannot write attribute to the field \"%s\".",fieldname) ;
+		  H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if (attrlist1 != NULL)
+		    {
+		      free(attrlist1);
+		      attrlist1 = NULL;
+		    }
+		  if (attrlist2 != NULL)
+		    {
+		      free(attrlist2);
+		      attrlist2 = NULL;
+		    }
+		  if (start == NULL)
+		    {
+		      if (tstart != NULL)
+			free(tstart);
+		    }
+		  if (count == NULL)
+		    {
+		      if (tcount != NULL)
+			free(tcount);
+		    }
+		  if (lcount != NULL)
+		    free(lcount);
+ 
+		  return(status);
+		}
+ 
+	    }
+ 
+	  status = H5Dwrite(fieldID, tid, mid, fspace,  H5P_DEFAULT, datbuf);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot write data to the dataset.\n");
+	      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (attrlist2 != NULL)
+		{
+		  free(attrlist2);
+		  attrlist2 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(status);
+	    }
+	}
+      else
+	{
+	  /* Get memory data type ID */
+	  /* ----------------------- */
+	  mtype  = HE5_EHdtype2mtype(tid);
+	  if( mtype == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot convert to memory data type.\n");
+	      status = FAIL;
+	      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(status);
+	    }
+ 
+	  status = H5Dwrite(fieldID, mtype, mid, fspace, H5P_DEFAULT, datbuf);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot write data to the dataset.\n");
+	      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (attrlist1 != NULL)
+		{
+		  free(attrlist1);
+		  attrlist1 = NULL;
+		}
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(status);
+	    }
+	}
+ 
+      if (attrlist1 != NULL)
+	{
+	  free(attrlist1);
+	  attrlist1 = NULL;
+	}
+      if (attrlist2 != NULL)
+	{
+	  free(attrlist2);
+	  attrlist2 = NULL;
+	}
+ 
+    }
+  else
+    {
+      if (classid == H5T_STRING)
+	{
+	  /* Read the data buffer */
+	  /* -------------------- */
+	  status = H5Dread(fieldID, tid, mid, fspace , H5P_DEFAULT, datbuf);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot read data from the dataset.\n");
+	      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+ 
+	      return(status);
+	    }
+ 
+	}
+      else
+	{
+
+	  /* Get memory data type ID */
+	  /* ----------------------- */
+          mtype  = HE5_EHdtype2mtype(tid);
+	  if( mtype == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot convert to memory data type.\n");
+	      status = FAIL;
+	      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (start == NULL)
+		{
+		  if (tstart != NULL)
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL)
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+		  
+	      return(status);
+	    }
+
+	  /* Read the data buffer */
+	  /* -------------------- */
+	  status = H5Dread(fieldID, mtype, mid, fspace , H5P_DEFAULT, datbuf);
+	  if( status == FAIL )
+	    {
+	      sprintf(errbuf,"Cannot read data from the dataset.\n");
+	      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      if (start == NULL)
+		{
+		  if (tstart != NULL) 
+		    free(tstart);
+		}
+	      if (count == NULL)
+		{
+		  if (tcount != NULL) 
+		    free(tcount);
+		}
+	      if (lcount != NULL)
+		free(lcount);
+			
+	      return(status);
+	    }
+	}
+
+    }
+  
+  if ( count  == NULL)
+    {	
+      if(tcount != NULL) free(tcount);
+    }
+  if( start == NULL)
+    {	
+      if(tstart != NULL) free(tstart);
+    }
+  if (lcount != NULL)
+    free(lcount);
+  
+  /* Release data space ID */
+  /* --------------------- */  
+  status = H5Sclose(mid); 
+  if( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot release memory data space ID.\n");
+      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		
+      return(status);
+    }
+
+  /* Release data space ID */
+  /* --------------------- */   
+  status = H5Sclose(fspace);
+  if( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot release the file data space ID.\n");
+      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		
+      return(status);
+    }
+
+  /* Release data type ID */
+  /* -------------------- */    
+  status = H5Tclose(tid);
+  if( status == FAIL )
+    {
+      sprintf(errbuf,"Cannot release the data type ID.\n");
+      H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  
+      return(status);
+    }
+  
+ COMPLETION:
+  return(status);
+
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAwrite                                                      |
+|                                                                             |
+|  DESCRIPTION: Writes data to field                                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  za_name        char*               za name                                 |
+|  start          hssize_t            start array                             |
+|  stride         hsize_t             stride array                            |
+|  count          hsize_t             count array                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void*               data buffer for write                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_ZAwrite(hid_t zaID, char *za_name, const hssize_t start[], const hsize_t stride[], const hsize_t count[],  void *datbuf)
+{
+  herr_t   status  = FAIL;/* routine return status variable  */
+
+  HE5_LOCK;
+  CHECKNAME(za_name);
+  CHECKPOINTER(datbuf);
+
+  status = HE5_ZAwrrdfield(zaID, za_name, "w", start, stride, count, datbuf);
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAread                                                       |
+|                                                                             |
+|  DESCRIPTION: Reads data from field                                         |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  za_name        char*               za name                                 |
+|  start          hssize_t            start array                             |
+|  stride         hsize_t             stride array                            |
+|  count          hsize_t             count array                             |
+|  datbuf         void*               data buffer for read                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|     None                                                                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_ZAread(hid_t  zaID, char *za_name, const hssize_t start[], const hsize_t stride[], const hsize_t count[],  void *datbuf)
+{
+  
+  herr_t   status  = FAIL;/* routine return status variable    */
+  
+  HE5_LOCK;
+  CHECKPOINTER(za_name);
+  status = HE5_ZAwrrdfield(zaID, za_name, "r", start, stride, count, datbuf);
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAfldsrch                                                    |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about field DATASET                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  fldgroup        int                 Flag representing the group:           |
+|                                      "Data Fields". (-1) FAILS.             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fldname        char                field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fieldID        hid_t                Field dataset ID                       |
+|  rank           int                  dataset Rank                           |
+|  dims           hsize_t              Dimensions of field                    |
+|  typeID         hid_t                Data type ID                           |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_ZAfldsrch(hid_t zaID, char *fldname, hid_t *fieldID, int *rank,  hsize_t dims[], hid_t *typeID)
+{
+  int      fldgroup  = FAIL;       /* Field group flag  (return value)   */
+  int      i;                      /* Loop index                         */
+  int      nameflag  = FAIL;       /* Alias (0) /actual (1) name flag    */
+
+  herr_t   status    = FAIL;       /* routine return status variable     */
+  
+  hid_t    idx       = FAIL;       /* za index                           */
+  hid_t    idOffset  = HE5_ZAIDOFFSET;/* za ID offset                    */
+  hid_t    spaceID   = FAIL;       /* File data space ID                 */
+
+  char     fieldname[HE5_HDFE_NAMBUFSIZE];    /* Buffer for name of a field  */ 
+  char     fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual name of a field      */ 
+  char     fldtype   ='n';             /* Internal group discriminating flag */
+  char     name[HE5_HDFE_NAMBUFSIZE];  /* Field Name buffer                  */
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Buffer for error message           */
+
+
+  CHECKPOINTER(fldname);
+
+  /* Compute "reduced" za ID */
+  /* ----------------------- */
+  idx = zaID % idOffset;
+
+  
+  /* Call HE5_ZAfldnameinfo() to get actual field name */
+  /* ------------------------------------------------- */
+  nameflag = HE5_ZAfldnameinfo(zaID, fldname, fldactualname);
+  if (nameflag == FAIL)
+    {
+      sprintf(errbuf, "Cannot get actual name of the field.\n");
+      H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  if (nameflag == FALSE)
+    {
+      strcpy(fieldname,"");
+      strcpy(fieldname,fldactualname);
+    }
+
+  if (nameflag == TRUE)
+    {
+      strcpy(fieldname,"");
+      strcpy(fieldname,fldname);
+    }
+  
+
+  /* Loop through all data datasets in za */
+  /* ------------------------------------ */
+  for (i = 0; i < HE5_ZAXZa[idx].nDFLD; i++)
+    {
+      /* get dataset name */
+      /* ---------------- */
+      strcpy(name, HE5_ZAXZa[idx].ddataset[i].name);
+      if( strcmp(fieldname, name) == 0 )
+	{
+	  fldtype ='d';
+	  fldgroup   = HE5_HDFE_DATAGROUP;
+	  break;
+	}
+    }
+  
+
+  if (fieldID != NULL)
+    {
+
+      /* Get dataset ID */
+      /* ============== */
+      if( fldtype =='d')
+	*fieldID    = HE5_ZAXZa[idx].ddataset[i].ID;
+      else
+	{
+	  sprintf(errbuf,"Cannot find \"%s\" field in za. Check the spelling.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      /* Get data space ID */
+      /* ----------------- */
+      spaceID  = H5Dget_space(*fieldID);
+      if (spaceID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get the data space ID.\n");
+	  H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      if (rank != NULL)
+	{
+	  /* Get dataset rank */
+	  /* ---------------- */
+	  *rank  = H5Sget_simple_extent_ndims(spaceID);
+	  if (*rank == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot get the dataset rank.\n");
+	      H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	}
+	  
+      if (typeID != NULL || dims != NULL)
+	{
+		  
+	  /* Get data type ID */
+	  /* ---------------- */
+	  *typeID = H5Dget_type(*fieldID);
+	  if (*typeID == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot get the data type ID.\n");
+	      H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+
+	  /* Get dimension sizes */
+	  /* ------------------- */
+	  status      = H5Sget_simple_extent_dims(spaceID, dims, NULL);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot get the data space dimension sizes.\n");
+	      H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+		  
+	  /* Release data type ID */
+	  /* -------------------- */
+	  status = H5Tclose(*typeID);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot release the data type ID.\n");
+	      H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  
+	  /* Release data space ID */
+	  /* --------------------- */
+	  status = H5Sclose(spaceID);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot release the data space ID.\n");
+	      H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+		  
+	}
+	  
+    }
+  
+ COMPLETION:
+  return(fldgroup);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdetach                                                     |
+|                                                                             |
+|  DESCRIPTION: Detachs za structure and performs housekeeping                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_ZAdetach(hid_t zaID)
+{
+  herr_t         status  = FAIL;             /* Return status variable */
+ 
+  long           idx     = FAIL;             /* za index               */
+ 
+  hid_t          fid     = FAIL;             /* HDF-EOS file ID        */
+  hid_t          gid     = FAIL;             /* "HDFEOS" group ID      */
+ 
+  int            k;                          /* Loop indices           */
+ 
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+ 
+  HE5_LOCK;
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAdetach", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+ 
+      /* "Detach" from previously attached "Data Fields" datasets */
+      /* -------------------------------------------------------- */
+      if( HE5_ZAXZa[idx].nDFLD > 0 )
+	{
+	  for (k = 0; k < HE5_ZAXZa[idx].nDFLD; k++)
+	    {
+ 
+	      if ( HE5_ZAXZa[idx].ddataset[k].ID > 0 )
+		{
+		  status = H5Dclose(HE5_ZAXZa[idx].ddataset[k].ID);
+		  if (status == FAIL)
+		    {
+		      sprintf(errbuf, "Cannot release the data dataset ID. \n") ;
+		      H5Epush(__FILE__, "HE5_ZAdetach", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+ 
+		      return(status);
+		    }
+		}
+	      if(HE5_ZAXZa[idx].ddataset[k].name != NULL)
+		free(HE5_ZAXZa[idx].ddataset[k].name);
+ 
+	    }
+	  if (HE5_ZAXZa[idx].ddataset != NULL)
+	    free(HE5_ZAXZa[idx].ddataset);
+	}
+ 
+ 
+      /* Detach from the za groups */
+      /* ------------------------- */
+      if ( HE5_ZAXZa[idx].data_id > 0 )
+	{
+	  status = H5Gclose(HE5_ZAXZa[idx].data_id);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the \"Data Fields\" group ID. \n") ;
+	      H5Epush(__FILE__, "HE5_ZAdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+ 
+	      return(status);
+	    }
+	}
+ 
+ 
+      if ( HE5_ZAXZa[idx].za_id > 0 )
+	{
+	  status = H5Gclose(HE5_ZAXZa[idx].za_id);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the za group ID. \n") ;
+	      H5Epush(__FILE__, "HE5_ZAdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+ 
+	      return(status);
+	    }
+	}
+ 
+ 
+      /* Delete entries from External Arrays */
+      /* ----------------------------------- */
+      HE5_ZAXZa[idx].active       = 0;
+ 
+      HE5_ZAXZa[idx].data_id      = 0;
+ 
+      HE5_ZAXZa[idx].ddataset     = NULL;
+ 
+      HE5_ZAXZa[idx].fid          = 0;
+      HE5_ZAXZa[idx].za_id        = 0;
+      HE5_ZAXZa[idx].obj_id       = 0;
+ 
+      HE5_ZAXZa[idx].nDFLD        = 0;
+ 
+    }
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+ 
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAsetfillvalue                                               |
+|                                                                             |
+|  DESCRIPTION: Sets fill value for the specified field.                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fieldname      char*               field name                              |
+|  numbertype     hid_t               number type                             |
+|  fillval        void*               fill value                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|  Mar 04    S.Zhao       Modified for a character string dataset.            |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_ZAsetfillvalue(hid_t zaID, char *fieldname, hid_t numbertype_in, void *fillval)
+{
+  herr_t          status       = FAIL;/* return status variable       */
+  
+  hid_t           fid          = FAIL;/* HDF-EOS file ID              */
+  hid_t           gid          = FAIL;/* "HDFEOS" group ID            */
+  
+  long            idx          = FAIL;/* za index                     */
+  
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+  hid_t           numbertype;
+
+  HE5_LOCK;
+  CHECKPOINTER(fillval);
+
+
+  /* Convert HDF-EOS5 datatype to HDF5 datatype */
+  if (
+      H5Tequal(numbertype_in, H5T_NATIVE_CHAR)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UCHAR)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_SHORT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_INT)    == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_UINT)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LONG)   == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LLONG)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_FLOAT)  == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == SUCCEED ||
+      H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== SUCCEED ||
+      H5Tequal(numbertype_in, H5T_C_S1) == SUCCEED)
+    {
+      numbertype = numbertype_in;
+    }
+  else
+    {
+      numbertype = HE5_EHconvdatatype((int) numbertype_in);
+    }
+
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID for fillvalue.\n");
+      H5Epush(__FILE__, "HE5_ZAsetfillvalue", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAsetfillvalue", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for valid za ID failed.\n");
+      H5Epush(__FILE__, "HE5_ZAsetfillvalue", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+  /* Get current dataset creation property list */
+  /* ------------------------------------------ */  
+  if( HE5_ZAXZa[idx].plist == FAIL)
+    {
+      HE5_ZAXZa[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+      if (HE5_ZAXZa[idx].plist == FAIL)
+	{
+	  sprintf(errbuf,"Cannot create the dataset property list.\n");
+	  H5Epush(__FILE__, "HE5_ZAsetfillvalue", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+
+  /* Set fill value */
+  /* -------------- */  
+  if ((numbertype != HE5T_CHARSTRING) && (numbertype != H5T_NATIVE_CHAR) && (numbertype != H5T_C_S1))
+    {
+      status = H5Pset_fill_value(HE5_ZAXZa[idx].plist, numbertype, fillval);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot set fill value for \"%s\" field.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAsetfillvalue", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+    }
+
+ 
+ COMPLETION: 
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAgetfillvalue                                               |
+|                                                                             |
+|  DESCRIPTION: Retrieves fill value for a specified field.                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fieldname      char*               field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fillval        void*               fill value                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_ZAgetfillvalue(hid_t zaID, char *fieldname, void *fillval)
+{
+  herr_t          status   = FAIL;/* routine return status variable   */
+
+  hid_t           fid      = FAIL;/* HDF-EOS file ID                  */
+  hid_t           gid      = FAIL;/* "HDFEOS" group ID                */
+  hid_t           fieldID  = FAIL;/* field dataset ID                 */
+  hid_t           tid      = FAIL;/* field dataset data type ID       */
+  hid_t           plist    = FAIL;/* field dataset property list ID   */
+ 
+  long            idx      = FAIL;/* za index                         */
+  
+  hsize_t         count[1] = { 1 };/* number of attribute elements    */
+    
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+    
+
+  HE5_LOCK;
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAgetfillvalue", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for valid za ID failed.\n");
+      H5Epush(__FILE__, "HE5_ZAgetfillvalue", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+  
+  /* Check out the field group and get field ID */
+  /* ------------------------------------------ */
+  HE5_ZAfldsrch(zaID,fieldname,&fieldID,NULL,NULL,NULL);
+  if( fieldID == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the field ID for the \"%s\" field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAgetfillvalue", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+   
+  /* Get the property list ID */
+  /* ------------------------ */
+  plist = H5Dget_create_plist(fieldID);
+  if ( plist == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAgetfillvalue", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+	
+  /* Get the datatype ID */ 
+  /* ------------------- */
+  tid   = H5Dget_type(fieldID);
+  if ( tid == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the data type ID for the \"%s\" data field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAgetfillvalue", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+	
+  /* Read out a fill value from the attribute */
+  /* ---------------------------------------- */ 
+  status = HE5_EHattr(fieldID, "_FillValue", tid, count, "r", fillval); 
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot get fill value for the  \"%s\" field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAgetfillvalue", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+	
+  /* Release data type ID */
+  /* -------------------- */
+  status = H5Tclose(tid);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release data type ID for the \"%s\" dataset.\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAgetfillvalue", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+	
+  /* Release property list ID */
+  /* ------------------------ */
+  status = H5Pclose(plist);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release property list ID for the \"%s\" dataset.\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAgetfillvalue", __LINE__, H5E_PLIST, H5E_CLOSEERROR,errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAclose                                                      |
+|                                                                             |
+|  DESCRIPTION: Closes HDF-EOS file                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  fid            hid_t               File ID                                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_ZAclose(hid_t fid)
+{
+  herr_t   status = FAIL;/* routine return status variable */
+ 
+  /* Call HE5_EHclose to perform file close */
+  /* -------------------------------------- */
+  status = HE5_EHclose(fid);
+ 
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAfieldsizeID                                                |
+|                                                                             |
+|  DESCRIPTION:  Returns the size (in bytes) of field-related data type,      |
+|                otherwise returns 0.                                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  size           size_t              Size of field data type                 |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fieldname      char                fieldname                               |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fieldID        hid_t               field-related dataset ID                |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+static size_t
+HE5_ZAfieldsizeID( hid_t zaID, char *fieldname, hid_t  *fieldID)
+{
+  size_t         size      =  0;             /* Size of field data type  */
+ 
+  herr_t         status    = FAIL;           /* Return status variable   */
+ 
+  int            i;                          /* Loop index               */
+  int            found     =  0;             /* Flag                     */
+ 
+  hid_t          fid       = FAIL;           /* HDF-EOS file ID          */
+  hid_t          gid       = FAIL;           /* "HDFEOS" group ID        */
+  hid_t          dtype     = FAIL;           /* datatype ID              */
+ 
+  long           idx       = FAIL;           /* ZA index                 */
+ 
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* Buffer for error message */
+ 
+  CHECKPOINTER(fieldname);
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and ZA index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAfieldsizeID", &fid, &gid, &idx);
+ 
+  /* Loop through all data fields in ZA */
+  /* ---------------------------------- */
+  for (i = 0; i < HE5_ZAXZa[idx].nDFLD; i++)
+    {
+      if( strcmp(fieldname, HE5_ZAXZa[idx].ddataset[i].name) == 0 )
+	{
+	  /* get dataset ID */
+	  /* -------------- */
+	  *fieldID = HE5_ZAXZa[idx].ddataset[i].ID;
+ 
+	  dtype    = H5Dget_type(*fieldID);
+	  if (dtype == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the dataset data type. \n");
+	      H5Epush(__FILE__, "HE5_ZAfieldsizeID", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(0);
+	    }
+ 
+	  size     = H5Tget_size(dtype);
+	  if (size == 0)
+	    {
+	      sprintf(errbuf, "Cannot get the data type size. \n");
+	      H5Epush(__FILE__, "HE5_ZAfieldsizeID", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(0);
+	    }
+ 
+	  status   = H5Tclose(dtype);
+	  if (status == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot release the data type ID. \n");
+	      H5Epush(__FILE__, "HE5_ZAfieldsizeID", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(0);
+	    }
+	  found = 1;
+	  break;
+	}
+    }
+  if(  found == 0 )
+    {
+      sprintf(errbuf, "field \"%s\" is not in ZA. \n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAfieldsizeID", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+ COMPLETION:
+  return(size);
+}
+
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAwritegrpattr                                               |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with the "Data Fields"    |
+|               group in a za.                                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  attrname       char                attribute name                          |
+|  numbertype     hid_t               attribute dataset datatype ID           |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_ZAwritegrpattr(hid_t zaID, const char *attrname, hid_t numtype, hsize_t  count[], void *datbuf)
+{
+  herr_t     status          = FAIL;     /* Return status variable */
+
+  hid_t      fid             = FAIL;     /* HDF-EOS file ID        */
+  hid_t      gid             = FAIL;     /* "HDFEOS" group ID      */
+  hid_t      DataFieldsGrpID = FAIL;     /* "Data Fields" group ID */
+    
+  long       idx             = FAIL;     /* za index               */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+  hid_t      numbertype;
+
+  HE5_LOCK;
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+
+  /* 
+     if ntype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use ntype itself
+  */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      numbertype = numtype;
+    }
+  
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAwritegrpattr", &fid, &gid, &idx);
+
+  if (status == SUCCEED)
+    {
+      /* Get "Data Fields" group ID and call HE5_EHattr to perform I/O */
+      /* ------------------------------------------------------------- */
+      DataFieldsGrpID = H5Gopen(HE5_ZAXZa[idx].za_id, "Data Fields");
+      if(DataFieldsGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data Fields\" group ID. \n");
+	  H5Epush(__FILE__, "HE5_ZAwritegrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	} 
+
+      status = HE5_EHattr(DataFieldsGrpID, attrname, numbertype, count,"w", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write Attribute \"%s\"to the \"Data Fields\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_ZAwritegrpattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      status = H5Gclose(DataFieldsGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data Fields\" group ID. \n");
+	  H5Epush(__FILE__, "HE5_ZAwritegrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAreadgrpattr                                                |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from the "Data Fields" group in a za.         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_ZAreadgrpattr(hid_t zaID, const char *attrname, void * datbuf)
+{
+  herr_t      status          = FAIL;     /* return status variable   */
+  
+  hid_t       fid             = FAIL;     /* HDF-EOS file ID          */
+  hid_t       gid             = FAIL;     /* "HDFEOS" group ID        */
+  hid_t       ntype           = FAIL;     /* Data type ID             */
+  hid_t       DataFieldsGrpID = FAIL;     /* "Data Fields" group ID   */
+  
+  long        idx             = FAIL;     /* za index                 */
+  
+  hsize_t     count[]         = { 0 };    /* # of attribute elements  */
+  
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */
+  
+
+  HE5_LOCK;
+  CHECKPOINTER(attrname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAreadgrpattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Get "Data Fields"  group ID and call HE5_EHattr to perform I/O */
+      /* -------------------------------------------------------------- */
+      DataFieldsGrpID = H5Gopen(HE5_ZAXZa[idx].za_id, "Data Fields");
+      if(DataFieldsGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_ZAreadgrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+        }
+
+      status = HE5_EHattr(DataFieldsGrpID,attrname,ntype,count,"r", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot read Attribute \"%s\" from the \"Data Fields\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_ZAreadgrpattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+        }
+
+      status = H5Gclose(DataFieldsGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_ZAreadgrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+	
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAgrpattrinfo                                                |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about attributes in "Data Fields" group.|
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  attrname       const char*         attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               data type ID                            |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_ZAgrpattrinfo(hid_t zaID, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t     status          = FAIL;     /* routine return status variable */
+
+  hid_t      fid             = FAIL;     /* HDF-EOS file ID                */
+  hid_t      gid             = FAIL;     /* "HDFEOS" group ID              */
+  hid_t      DataFieldsGrpID = FAIL;     /* "Data Fields" group ID         */
+
+  long       idx             = FAIL;     /* za index                       */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/*  Error message buffer          */
+
+  CHECKPOINTER(attrname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAgrpattrinfo", &fid, &gid, &idx);	
+  if (status == SUCCEED)
+    {
+      /* Get "Data Fields"  group ID and call HE5_EHattrinfo */
+      /* --------------------------------------------------- */
+      DataFieldsGrpID = H5Gopen(HE5_ZAXZa[idx].za_id, "Data Fields");
+      if(DataFieldsGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"Data Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_ZAgrpattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      status = HE5_EHattrinfo(DataFieldsGrpID,attrname,ntype,count);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"Data Fields\" group.\n", attrname);
+	  H5Epush(__FILE__, "HE5_ZAgrpattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}
+
+      status = H5Gclose(DataFieldsGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n");
+	  H5Epush(__FILE__, "HE5_ZAgrpattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(status);
+	}	
+
+
+    }
+  
+ COMPLETION:
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqgrpattrs                                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list in "Data Fields" group                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in "Data Fields"   |
+|                                       group.                                |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in "Data Fields" group  |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_ZAinqgrpattrs(hid_t zaID, char *attrnames, long *strbufsize)
+{
+  long            nattr   = FAIL;          /* Number of attributes (return)  */
+  long            idx     = FAIL;          /* za index                       */
+
+  herr_t          status  = FAIL;          /* Return status variable         */
+
+  hid_t           fid     = FAIL;          /* HDF-EOS file ID                */
+  hid_t           gid     = FAIL;          /* "ZAS" group ID                 */
+    
+  char            *grpname = (char *)NULL; /* Group name string              */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer        */
+
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAinqgrpattrs", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) );
+      if( grpname == NULL)
+        {
+          H5Epush(__FILE__, "HE5_ZAinqgrpattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Can not allocate memory");
+          HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      strcpy(grpname,"/HDFEOS/ZAS/");
+      strcat(grpname, HE5_ZAXZa[idx].zaname);
+      strcat(grpname,"/Data Fields");
+	
+      /* search group with grpname for the number of attributes */
+      /* ------------------------------------------------------ */ 
+      nattr = HE5_EHattrcat(fid,  grpname, attrnames, strbufsize);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot find the attributes. \n");
+	  H5Epush(__FILE__, "HE5_ZAinqgrpattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	}
+
+      if (grpname != NULL) free(grpname);
+    }
+  
+  return (nattr);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAwritelocattr                                               |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with a specified field    |
+|               in a za.                                                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fieldname      char                field name                              |
+|  attrname       char                attribute name                          |
+|  numbertype     hid_t               attribute dataset datatype ID           |
+|  count[]        hsize_t             Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_ZAwritelocattr(hid_t zaID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t  count[], void *datbuf)
+{
+  herr_t     status          =  FAIL;    /* Return status variable */
+
+  int        fldgroup        =  FAIL;    /* Field group flag       */
+  
+  hid_t      fid             =  FAIL;    /* HDF-EOS file ID        */
+  hid_t      gid             =  FAIL;    /* "HDFEOS" group ID      */
+  hid_t      FieldGrpID      =  FAIL;    /* Field group ID         */
+  hid_t      fieldID         =  FAIL;    /* Field dataset ID       */
+  
+  long       idx             =  FAIL;    /* za index               */
+  
+  char       *grpname = (char *)NULL;    /* Group name buffer      */    
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+  hid_t      numbertype;
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKNAME(attrname);
+  CHECKPOINTER(count);
+  CHECKPOINTER(datbuf);
+
+  /* 
+     if ntype is HE5 numbertype, rather than H5 numbertype, then convert
+     it, otherwise use ntype itself
+  */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      numbertype = numtype;
+    }
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAwritelocattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Allocate memory for the group name buffer */
+      /* ----------------------------------------- */
+      grpname = (char *)calloc(64, sizeof(char) );
+      if( grpname == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n");
+          H5Epush(__FILE__, "HE5_ZAwritelocattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      /* Get the field group flag */
+      /* ------------------------ */
+      fldgroup = HE5_ZAfldsrch(zaID,(char *)fieldname,NULL,NULL,NULL,NULL);
+      if(fldgroup == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get the group flag for \"%s\" field.\n",fieldname);
+	  H5Epush(__FILE__, "HE5_ZAwritelocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      if (fldgroup == HE5_HDFE_DATAGROUP)
+	strcpy(grpname,"Data Fields");
+
+
+      /* Get the Field group ID */
+      /* ---------------------- */
+      FieldGrpID = H5Gopen(HE5_ZAXZa[idx].za_id, grpname);
+      if(FieldGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" group.\n", grpname);
+	  H5Epush(__FILE__, "HE5_ZAwritelocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      /* Get field ID and call HE5_EHattr to perform I/O */
+      /* ----------------------------------------------- */
+      fieldID = H5Dopen(FieldGrpID, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAwritelocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      /* Call EHattr() to perform I/O */
+      /* ---------------------------- */
+      status = HE5_EHattr(fieldID, attrname, numbertype, count,"w", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write Attribute \"%s\" for the \"%s\" field.\n", attrname, fieldname);
+	  H5Epush(__FILE__, "HE5_ZAwritelocattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}
+
+      /* Release dataset ID */
+      /* ------------------ */
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAwritelocattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}
+
+      /* Release group ID */
+      /* ---------------- */
+      status = H5Gclose(FieldGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" group ID.\n",grpname);
+	  H5Epush(__FILE__, "HE5_ZAwritelocattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}
+
+      free(grpname);
+    }
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);	
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAreadlocattr                                                |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with a specified field in a za.    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fieldname      char                fieldname                               |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t    
+HE5_ZAreadlocattr(hid_t zaID, const char *fieldname, const char *attrname, void * datbuf)
+{
+  herr_t      status          =  FAIL;    /* return status variable   */
+
+  int         fldgroup        =  FAIL;    /* Field group flag         */
+
+  hid_t       fid             =  FAIL;    /* HDF-EOS file ID          */
+  hid_t       gid             =  FAIL;    /* "HDFEOS" group ID        */
+  hid_t       ntype           =  FAIL;    /* Data type ID             */
+  hid_t       FieldGrpID      =  FAIL;    /* Field group ID           */
+  hid_t       fieldID         =  FAIL;    /* Field dataset ID         */
+  
+  long        idx             =  FAIL;    /* za index                 */
+  
+  hsize_t     count[]         = { 0 };    /* number of elements       */
+  
+  char        *grpname = (char *)NULL;    /* Group name buffer        */
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */
+
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(attrname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAreadlocattr", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Allocate memory for the group name buffer */
+      /* ----------------------------------------- */
+      grpname = (char *)calloc(64, sizeof(char) );
+      if( grpname == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n");
+          H5Epush(__FILE__, "HE5_ZAreadlocattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      /* Get the field group flag */
+      /* ------------------------ */
+      fldgroup = HE5_ZAfldsrch(zaID,(char *)fieldname,NULL,NULL,NULL,NULL);
+      if(fldgroup == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get the group flag for \"%s\" field. \n",fieldname);
+	  H5Epush(__FILE__, "HE5_ZAreadlocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      if (fldgroup == HE5_HDFE_DATAGROUP)
+	strcpy(grpname,"Data Fields");
+
+
+      /* Get Field  group ID  */
+      /* -------------------- */
+      FieldGrpID = H5Gopen(HE5_ZAXZa[idx].za_id, grpname);
+      if(FieldGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" group.\n", grpname);
+	  H5Epush(__FILE__, "HE5_ZAreadlocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      /* Get field ID and call HE5_EHattr to perform I/O */
+      /* ----------------------------------------------- */
+      fieldID = H5Dopen(FieldGrpID, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAreadlocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+        
+      /* Call EHattr() to perform I/O */
+      /* ---------------------------- */
+      status = HE5_EHattr(fieldID,attrname,ntype,count,"r", datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" field.\n", attrname,fieldname);
+	  H5Epush(__FILE__, "HE5_ZAreadlocattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}
+
+      /* Release the dataset ID */
+      /* ---------------------- */
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAreadlocattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}	
+
+      /* Release the group ID */
+      /* -------------------- */
+      status = H5Gclose(FieldGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" group ID.\n", grpname);
+	  H5Epush(__FILE__, "HE5_ZAreadlocattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}
+	
+      free(grpname);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAlocattrinfo                                                |
+|                                                                             |
+|  DESCRIPTION: Retrievs information about attribute associated with a        |
+|                 specified field in the "Data Fields" group.                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fieldname      char*               field name                              |
+|  attrname       const char*         attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          hid_t               data type ID                            |
+|  count          hsize_t             Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t   
+HE5_ZAlocattrinfo(hid_t zaID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count)
+{
+  herr_t     status          =  FAIL;    /* Return status variable */
+  
+  int        fldgroup        =  FAIL;    /* Field group flag       */
+
+  hid_t      fid             =  FAIL;    /* HDF-EOS file ID        */
+  hid_t      gid             =  FAIL;    /* "HDFEOS" group ID      */
+  hid_t      FieldGrpID      =  FAIL;    /* Field group ID         */
+  hid_t      fieldID         =  FAIL;    /* Field dataset ID       */
+
+  long       idx             =  FAIL;    /* za index               */
+  
+  char       *grpname  = (char *)NULL;   /* Group name buffer      */
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+  
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(attrname); 
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */ 
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAlocattrinfo", &fid, &gid, &idx);
+  if (status == SUCCEED)
+    {
+      /* Allocate memory for the group name buffer */
+      /* ----------------------------------------- */
+      grpname = (char *)calloc(64, sizeof(char) );
+      if( grpname == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n");
+          H5Epush(__FILE__, "HE5_ZAlocattrinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      /* Get the field group flag */
+      /* ------------------------ */
+      fldgroup = HE5_ZAfldsrch(zaID,(char *)fieldname,NULL,NULL,NULL,NULL);
+      if(fldgroup == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get the group flag for \"%s\" field. \n",fieldname);
+	  H5Epush(__FILE__, "HE5_ZAlocattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      if (fldgroup == HE5_HDFE_DATAGROUP)
+	strcpy(grpname,"Data Fields");
+
+      /* Get Field  group ID  */
+      /* -------------------  */
+      FieldGrpID = H5Gopen(HE5_ZAXZa[idx].za_id, grpname);
+      if(FieldGrpID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" group.\n", grpname);
+	  H5Epush(__FILE__, "HE5_ZAlocattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      /* Get field ID */
+      /* ------------ */
+      fieldID = H5Dopen(FieldGrpID, fieldname);
+      if(fieldID == FAIL)
+	{
+	  sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAlocattrinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(FAIL);
+	}
+
+      /* Call EHattrinfo() to perform I/O */
+      /* -------------------------------- */
+      status = HE5_EHattrinfo(fieldID,attrname,ntype,count);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"%s\" group.\n", attrname, grpname);
+	  H5Epush(__FILE__, "HE5_ZAlocattrinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}
+
+      /* Release dataset ID */
+      /* ------------------ */
+      status = H5Dclose(fieldID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname);
+	  H5Epush(__FILE__, "HE5_ZAlocattrinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}	
+
+      /* Release group ID */
+      /* ---------------- */
+      status = H5Gclose(FieldGrpID);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot release the field group ID.\n");
+	  H5Epush(__FILE__, "HE5_ZAlocattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  return(status);
+	}	
+	  
+      free(grpname);	  
+    }
+
+ COMPLETION:
+  return (status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqlocattrs                                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list associated with a specified field in the      |
+|                "Data Fields" group.                                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in "Data Fields"   |
+|                                       group.                                |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  fieldname      char                field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in "Data Fields" group  |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_ZAinqlocattrs(hid_t zaID, const char *fieldname, char *attrnames, long *strbufsize)
+{
+  long            nattr       = FAIL;         /* Number of attributes     */
+  long            idx         = FAIL;         /* za index                 */
+
+  herr_t          status      = FAIL;         /* Return status variable   */
+
+  int             fldgroup    =  FAIL;        /* Field group flag         */ 
+
+  hid_t           fid         = FAIL;         /* HDF-EOS file ID          */
+  hid_t           gid         = FAIL;         /* "ZAS" group ID           */
+    
+  char            *dtsname    = (char *)NULL; /* Dataset name string      */
+  char            *grpname    = (char *)NULL; /* Group name buffer        */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */  
+
+  CHECKPOINTER(fieldname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAinqlocattrs", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      /* Allocate memory for the dataset name buffer */
+      /* ------------------------------------------- */
+      dtsname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) );
+      if( dtsname == NULL)
+        {
+	  sprintf(errbuf, "Cannot allocate memory for the dataset name buffer. \n");
+          H5Epush(__FILE__, "HE5_ZAinqlocattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(FAIL);
+        }
+
+      /* Allocate memory for the group name buffer */
+      /* ----------------------------------------- */
+      grpname = (char *)calloc(64, sizeof(char) );
+      if( grpname == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n");
+          H5Epush(__FILE__, "HE5_ZAinqlocattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(dtsname);
+          return(FAIL);
+        }
+
+      /* Get the field group flag */
+      /* ------------------------ */
+      fldgroup = HE5_ZAfldsrch(zaID,(char *)fieldname,NULL,NULL,NULL,NULL);
+      if(fldgroup == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get the group flag for \"%s\" field.\n",fieldname);
+	  H5Epush(__FILE__, "HE5_ZAinqlocattrs", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	  free(dtsname);
+	  return(FAIL);
+	}
+
+      if (fldgroup == HE5_HDFE_DATAGROUP)
+	strcpy(grpname,"/Data Fields/");
+
+      strcpy(dtsname,"/HDFEOS/ZAS/");
+      strcat(dtsname, HE5_ZAXZa[idx].zaname);
+      strcat(dtsname, grpname);
+      strcat(dtsname, fieldname);
+	  
+      /* search group with grpname for the number of attributes */
+      /* ------------------------------------------------------ */ 
+      nattr = HE5_EHattrcat(fid,  dtsname, attrnames, strbufsize);
+      if ( nattr < 0 )
+	{
+	  sprintf(errbuf, "Cannot find the attributes. \n");
+	  H5Epush(__FILE__, "HE5_ZAinqlocattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	}
+
+      if (dtsname != NULL) free(dtsname);
+      if (grpname != NULL) free(grpname);
+    }
+  
+ COMPLETION:
+  return(nattr);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAsetalias                                                   |
+|                                                                             |
+|  DESCRIPTION:  Defines alias for a specified field name                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    zaID         hid_t                    ZA structure ID                    |
+|    fieldname    char                     Original field name                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    aliaslist    char                     List of aliases for the field name |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_ZAsetalias(hid_t zaID, char *fieldname, const char *aliaslist)
+{
+  herr_t   status     = FAIL;          /* return status variable      */
+
+  int      fldgroup   = FAIL;          /* Field group flag            */
+
+  hid_t    fid        = FAIL;          /* HDF-EOS file ID             */
+  hid_t    gid        = FAIL;          /* "ZAS"  group ID             */
+  hid_t    groupID    = FAIL;          /* Field group ID              */
+
+  long     idx        = FAIL;          /* za index                    */
+
+  char     *buf       = NULL;          /* Pointer to temporary buffer */
+  char     *comma     = NULL;          /* Pointer to comma            */
+  char     *aliasname = NULL;          /* Pointer to the alias name   */
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer        */
+
+
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+  CHECKPOINTER(aliaslist);
+
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAsetalias", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for za ID failed. \n");
+      H5Epush(__FILE__, "HE5_ZAsetalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Find out the field group */
+  /* ------------------------ */
+  fldgroup = HE5_ZAfldsrch(zaID,fieldname,NULL,NULL,NULL,NULL);
+
+  if (fldgroup == HE5_HDFE_DATAGROUP)
+    groupID = HE5_ZAXZa[idx].data_id;
+
+  else
+    {	  
+      sprintf(errbuf, "Cannot find \"%s\" field in za. \n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAsetalias", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Allocate memory for temporary buffer */
+  /* ------------------------------------ */
+  buf = (char *)calloc(strlen(aliaslist)+64, sizeof(char));
+  if (buf == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory for \"buf\". \n");
+      H5Epush(__FILE__, "HE5_ZAsetalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+  /* Make a list like "name1,name2,name3," */
+  /* ------------------------------------- */
+  strcpy(buf,aliaslist);
+  strcat(buf,",");
+
+  /* Find first comma and make pointer pointing to it */
+  /* ------------------------------------------------ */
+  comma = strchr(buf, ',');
+  while(comma != NULL)
+    {
+      /* Allocate memory for individual entry */
+      /* ------------------------------------ */
+      aliasname = (char *)calloc(comma-buf+1, sizeof(char));
+      if (aliasname == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for \"aliasname\". \n");
+	  H5Epush(__FILE__, "HE5_ZAsetalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (buf != NULL) free(buf);
+	  return(FAIL);
+	}
+	  
+      /* Pick up an individual entry and put it to the "aliasname" */
+      /* --------------------------------------------------------- */
+      memmove(aliasname,buf,comma-buf);
+  
+      /* Create a symbolic link for a specified object */
+      /* --------------------------------------------- */
+      status = H5Glink(groupID, H5G_LINK_SOFT, fieldname, aliasname);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot create an alias \"%s\" for \"%s\" field. \n", aliasname, fieldname);
+	  H5Epush(__FILE__, "HE5_ZAsetalias", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  if (aliasname != NULL) free(aliasname);
+	  if (buf != NULL) free(buf);
+	  return(FAIL);
+	}
+  
+      /* Go to the next name entry */
+      /* ------------------------- */
+      memmove(buf,comma+1,strlen(comma+1)+1);
+      comma = strchr(buf, ',');
+      if (aliasname != NULL) free(aliasname);
+    }
+  
+  if (buf != NULL) free(buf);
+	  
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdropalias                                                  |
+|                                                                             |
+|  DESCRIPTION:  Removes the alias for a specified field name                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    zaID         hid_t                    ZA structure ID                    |
+|    aliasname    char                     Alias name to remove               |
+|    fldgroup     int                      Field group flag                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_ZAdropalias(hid_t zaID, int fldgroup, const char *aliasname)
+{  
+  herr_t   status     = FAIL;          /* return status variable   */
+
+  hid_t    fid        = FAIL;          /* HDF-EOS file ID          */
+  hid_t    gid        = FAIL;          /* "ZAS"  group ID          */
+  hid_t    groupID    = FAIL;          /* Field group ID           */
+
+  long     idx        = FAIL;          /* za index                 */
+
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */
+
+
+  HE5_LOCK;
+  CHECKPOINTER(aliasname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAdropalias", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for za ID failed. \n");
+      H5Epush(__FILE__, "HE5_ZAdropalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get Group ID */
+  /* ------------ */
+  if (fldgroup == HE5_HDFE_DATAGROUP)
+    groupID = HE5_ZAXZa[idx].data_id;
+  else
+    {	  
+      sprintf(errbuf, "Invalid input group flag. \n");
+      H5Epush(__FILE__, "HE5_ZAdropalias", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Destroy a symbolic link */
+  /* ----------------------- */
+  status = H5Gunlink(groupID, aliasname);
+  if (status == FAIL)
+    {	  
+      sprintf(errbuf, "Cannot remove alias named \"%s\". \n", aliasname);
+      H5Epush(__FILE__, "HE5_ZAdropalias", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqfldalias                                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of fields & aliases and string length of|
+|                fields & aliases list in "Data Fields" group                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfldalias      long                Number of fields & aliases in "Data     |
+|                                     Fields" group.                          |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               za structure ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fldalias       char*               Fields & aliases names in "Data Fields" |
+|                                     group (Comma-separated list)            |
+|  strbufsize     long*               Fields & aliases name list string length|
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 03    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_ZAinqfldalias(hid_t zaID, char *fldalias, long *strbufsize)
+{
+  long            nfldalias   = FAIL;/* Number of fields & aliases (return)  */
+  long            idx     = FAIL;    /* za index                       */
+ 
+  herr_t          status  = FAIL;    /* Return status variable         */
+ 
+  hid_t           fid     = FAIL;    /* HDF-EOS file ID                */
+  hid_t           gid     = FAIL;    /* "ZA" group ID                  */
+ 
+  char            *grpname = (char *)NULL; /* Group name string        */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+ 
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAinqfldalias", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) );
+      if( grpname == NULL)
+	{
+	  H5Epush(__FILE__, "HE5_ZAinqfldalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Can not allocate memory");
+	  HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+	  return(FAIL);
+	}
+ 
+      strcpy(grpname,"/HDFEOS/ZAS/");
+      strcat(grpname, HE5_ZAXZa[idx].zaname);
+      strcat(grpname,"/Data Fields");
+ 
+      /* search group with grpname for the number of fields & aliases */
+      /* ------------------------------------------------------------ */
+      nfldalias = HE5_EHdatasetcat(fid,  grpname, fldalias, strbufsize);
+      if ( nfldalias < 0 )
+	{
+	  sprintf(errbuf, "Cannot find the fields & aliases. \n");
+	  H5Epush(__FILE__, "HE5_ZAinqfldalias", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(grpname);
+	}
+ 
+      if (grpname != NULL) free(grpname);
+    }
+  else
+    {
+      sprintf(errbuf, "Checking for za ID failed. \n");
+      H5Epush(__FILE__, "HE5_ZAinqfldalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  return (nfldalias);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAaliasinfo                                                  |
+|                                                                             |
+|  DESCRIPTION:  Retrieves information about field aliases                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    zaID         hid_t                    ZA structure ID                    |
+|    aliasname    char                     alias name                         |
+|    fldgroup     int                      Field group flag                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    length       int                      Buffer size                        |
+|    buffer       char                     Buffer with original field name    |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_ZAaliasinfo(hid_t zaID, int fldgroup, const char *aliasname, int *length, char *buffer)
+{
+  herr_t        status     = FAIL;               /* return status variable   */
+
+  int           type       = FAIL;               /* type-value of an object  */
+
+  size_t        size       = 0;                  /* Size of the name buffer  */
+
+  hid_t         fid        = FAIL;               /* HDF-EOS file ID          */
+  hid_t         gid        = FAIL;               /* "ZAS"  group ID          */
+  hid_t         groupID    = FAIL;               /* Field group ID           */
+
+  long          idx        = FAIL;               /* za index                 */
+
+  H5G_stat_t    *statbuf   = (H5G_stat_t *)NULL; /* pointer to a structure   */
+
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];     /* Error message buffer     */
+
+  CHECKPOINTER(aliasname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAaliasinfo", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for za ID failed. \n");
+      H5Epush(__FILE__, "HE5_ZAaliasinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  /* Get the group ID */
+  /* ---------------- */
+  if (fldgroup == HE5_HDFE_DATAGROUP)
+    groupID = HE5_ZAXZa[idx].data_id;
+  else
+    {	  
+      sprintf(errbuf, "Invalid input group flag. \n");
+      H5Epush(__FILE__, "HE5_ZAaliasinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  if (buffer == NULL)
+    {
+      /* Get the string length of a "real" name  */
+      /* --------------------------------------  */
+      statbuf = (H5G_stat_t *)calloc(1, sizeof(H5G_stat_t));   
+      if (statbuf == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for \"statbuf\". \n");
+	  H5Epush(__FILE__, "HE5_ZAaliasinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* Get the Object Info */
+      /* ------------------- */
+      status = H5Gget_objinfo(groupID, aliasname, 0, statbuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot get information about \"%s\" alias. \n", aliasname);
+	  H5Epush(__FILE__, "HE5_ZAaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+
+      /* LINK name length with a null terminator */
+      /* --------------------------------------- */
+      size = statbuf->linklen;
+
+      /* Object type (dataset, link, etc) */
+      /* -------------------------------- */
+      type   = statbuf->type;
+  
+      /* Make sure that the object is a LINK */
+      /* ----------------------------------- */
+      if (type != H5G_LINK)
+	{
+	  sprintf(errbuf,"The object named \"%s\" is not a symbolic link.\n", aliasname);
+	  H5Epush(__FILE__, "HE5_ZAaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+	  
+      *length = (int)size;
+	  
+      if ( statbuf != (H5G_stat_t *)NULL ) free(statbuf);
+	  
+    }
+  
+  if (buffer != NULL)
+    {
+      size = (size_t)*length;
+	  
+      /* Get the "real" name by an "alias" */
+      /* --------------------------------- */
+      status = H5Gget_linkval(groupID, aliasname, size, buffer);
+      if (status == FAIL) 
+	{
+	  sprintf(errbuf,"Cannot get the real name for the alias named \"%s\".\n", aliasname);
+	  H5Epush(__FILE__, "HE5_ZAaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return(FAIL);
+	}
+    }
+  
+ COMPLETION:
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAgetaliaslist                                               |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of aliases and the list of aliases in   |
+|                "Data Fields" group                                          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nalias         long                number of aliases in "Data Fields"      |
+|                                     group                                   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               za structure ID                         |
+|  fldgroup       int                 field group flag                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  aliaslist      char*               list of aliases in "Data Fields" group  |
+|                                     (comma-separated list)                  |
+|  strbufsize     long*               length of aliases list                  |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 05    S.Zhao       Original development                                |
+|  Mar 06    Abe Taaheri  Added code to get alias strbufsize only when user   |
+|                         passes aliaslist as NULL pointer                    |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_ZAgetaliaslist(hid_t zaID, int fldgroup, char *aliaslist, long *strbufsize)
+{
+  long            nalias  = FAIL;             /* Number of aliases (return)  */
+  long            idx     = FAIL;             /* za index                    */
+
+  herr_t          status  = FAIL;             /* Return status variable      */
+
+  hid_t           fid     = FAIL;             /* HDF-EOS file ID             */
+  hid_t           gid     = FAIL;             /* "ZAS" group ID              */
+
+  char            *fieldlist = (char *)NULL;  /* List of Data fields         */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer        */
+  long            fldstrbuf = FAIL;           /* Buffer size for Data fields */
+  long            nflds   = FAIL;             /* Number of Data fields       */
+  long            nfldalias = FAIL;           /* Number of fields & aliases  */
+  char            *fldalias = (char *)NULL;   /* List of fields & aliases    */
+  long            fldaliasbuf = FAIL;         /* Buffer size for fields & 
+						 aliases */
+
+  char            *buff   = (char *)NULL;     /* Pointer to temporary buffer */
+  char            *comma  = (char *)NULL;     /* Pointer to comma            */
+  char            *comma1 = (char *)NULL;     /* Pointer to comma            */
+  char            *nameptr = (char *)NULL;    /* Pointer to each name        */
+  char            *tmpbuf  = (char *)NULL;    /* Pointer to temp buffer      */
+  long            nameflag = FAIL;            /* Name flag                   */
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAgetaliaslist", &fid, &gid, &idx);
+  if(status == SUCCEED )
+    {
+      /* If aliaslist and strbufsize desired */
+      /* ----------------------------------- */
+      if (fldgroup == HE5_HDFE_DATAGROUP)    
+        {
+	  
+          /* Call "HE5_ZAnentries" routine to get number of fields */
+          /* ----------------------------------------------------- */
+          nflds = HE5_ZAnentries(zaID, HE5_HDFE_NENTDFLD, &fldstrbuf);
+          if (nflds == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  
+          /* Allocate memory for fields list buffer */
+          /* -------------------------------------- */
+          fieldlist = (char *) calloc(fldstrbuf+6, sizeof(char));
+          if(fieldlist == NULL)
+	    {
+	      sprintf(errbuf,"Cannot allocate memory.\n");
+	      H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, 
+		      H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      return(FAIL);
+	    }
+	  
+          /* Call "HE5_ZAinquire" routine to get the list of Data fields */
+          /* ----------------------------------------------------------- */
+          nflds = HE5_ZAinquire(zaID, fieldlist, NULL, NULL);
+          if (nflds == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the list of fields in \"Data Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      return(FAIL);
+	    }
+	  
+          /* Call "HE5_ZAinqfldalias" routine to get number of fields & 
+	     aliases */
+          /* -------------------------------------------------------- */
+          nfldalias = HE5_ZAinqfldalias(zaID, NULL, &fldaliasbuf);
+          if (nfldalias == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the number of fields & aliases in \"Data Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      return(FAIL);
+	    }
+	  
+          /* Allocate memory for fields & aliases list buffer */
+          /* ------------------------------------------------ */
+          fldalias = (char *) calloc(fldaliasbuf+6, sizeof(char));
+          if(fldalias == NULL)
+	    {
+	      sprintf(errbuf,"Cannot allocate memory.\n");
+	      H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, 
+		      H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      return(FAIL);
+	    }
+	  
+          /* Call "HE5_ZAinqfldalias" routine to get the list of fields & 
+	     aliases */
+          /* ---------------------------------------------------------- */
+          nfldalias = HE5_ZAinqfldalias(zaID, fldalias, &fldaliasbuf);
+          if (nfldalias == FAIL)
+	    {
+	      sprintf(errbuf, "Cannot get the list of fields & aliases in \"Data Fields\" group. \n");
+	      H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, 
+		      H5E_ARGS, H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      free(fldalias);
+	      return(FAIL);
+	    }
+	  
+          *strbufsize = strlen(fldalias) - strlen(fieldlist);
+          if (*strbufsize <= 0)
+	    {
+	      sprintf(errbuf, "Cannot find the aliases.\n");
+	      H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, 
+		      H5E_OHDR, H5E_NOTFOUND, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(fieldlist);
+	      free(fldalias);
+	      return(FAIL);
+	    }
+          else
+	    {
+	      nalias = 0;
+	      
+	      /* Allocate memory for temporary buffer */
+	      /* ------------------------------------ */
+	      buff = (char *)calloc(strlen(fldalias)+6, sizeof(char));
+	      if (buff == NULL)
+		{
+		  sprintf(errbuf, "Cannot allocate memory for \"buff\". \n");
+		  H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, 
+			  H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(fieldlist);
+		  free(fldalias);
+		  return(FAIL);
+		}
+	      
+	      /* Allocate memory for aliases */
+	      /* --------------------------- */
+	      tmpbuf = (char *)calloc(*strbufsize+6, sizeof(char));
+	      if (tmpbuf == NULL)
+		{
+		  sprintf(errbuf, "Cannot allocate memory for \"tmpbuf\". \n");
+		  H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, 
+			  H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  free(fieldlist);
+		  free(fldalias);
+		  free(buff);
+		  return(FAIL);
+		}
+	      
+	      strcpy(buff, fldalias);
+	      strcat(buff, ",");
+	      strcat(fieldlist, ",");
+	      
+	      /* Find first comma and make pointer pointing to it */
+	      /* ------------------------------------------------ */
+	      comma = strchr(buff, ',');
+	      while(comma != NULL)
+		{
+		  /* Allocate memory for individual entry */
+		  /* ------------------------------------ */
+		  nameptr = (char *)calloc(comma-buff+6, sizeof(char));
+		  if (nameptr == NULL)
+		    {
+		      sprintf(errbuf, "Cannot allocate memory for \"nameptr\". \n");
+		      H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, 
+			      H5E_RESOURCE, H5E_NOSPACE, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		      free(fieldlist);
+		      free(fldalias);
+		      free(buff);
+		      free(tmpbuf);
+		      return(FAIL);
+		    }
+		  
+		  /* Pick up an individual entry and put it to the "nameptr" */
+		  /* ------------------------------------------------------- */
+		  memmove(nameptr,buff,comma-buff);
+		  strcat(nameptr, ",");
+		  
+		  nameflag = (strstr(fieldlist,nameptr) == NULL) ? 1 : 0;
+		  if (nameflag == 1)
+		    {
+		      comma1 = strchr(tmpbuf, ',');
+		      if(comma1 == NULL)
+			strcpy(tmpbuf, nameptr);
+		      else
+			strcat(tmpbuf, nameptr);
+		      
+		      nalias++;
+		    }
+		  
+		  memmove(buff,comma+1,strlen(comma+1)+1);
+		  comma = strchr(buff, ',');
+		  
+		  if (nameptr != NULL) free(nameptr);
+		}
+	    }
+	  
+	  if(aliaslist == NULL)/* just return buffersize 
+				  and number of aliases */
+	    {
+	      if(nalias > 0 )
+		{
+		  if (fieldlist != NULL) free(fieldlist);
+		  if (fldalias != NULL) free(fldalias);
+		  if (buff != NULL) free(buff);
+		  if (tmpbuf != NULL) free(tmpbuf);
+		  return (nalias);
+		}
+	      else
+		{
+		  sprintf(errbuf, "Cannot find the aliases.\n");
+		  H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, 
+			  H5E_OHDR, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if(fieldlist != NULL) free(fieldlist);
+		  if(fldalias != NULL) free(fldalias);
+		  if (buff != NULL) free(buff);
+		  if (tmpbuf != NULL) free(tmpbuf);
+		  return(FAIL);
+		}
+	    }
+	  else
+	    {
+	      if(nalias > 0 )
+		{
+		  strncpy(aliaslist, tmpbuf, *strbufsize-1);
+		  aliaslist[*strbufsize-1] = '\0';
+		}
+	      else
+		{
+		  sprintf(errbuf, "Cannot find the aliases.\n");
+		  H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, 
+			  H5E_OHDR, H5E_NOTFOUND, errbuf);
+		  HE5_EHprint(errbuf, __FILE__, __LINE__);
+		  if(fieldlist != NULL) free(fieldlist);
+		  if(fldalias != NULL) free(fldalias);
+		  if (buff != NULL) free(buff);
+		  if (tmpbuf != NULL) free(tmpbuf);
+		  return(FAIL);
+		}
+	    }
+        }
+      else
+        {
+          sprintf(errbuf, "Invalid input field group flag. \n");
+          H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, 
+		  H5E_OHDR, H5E_NOTFOUND, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          return(FAIL);
+        }
+    }
+  else
+    {
+      sprintf(errbuf, "Checking for za ID failed. \n");
+      H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, 
+	      H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  if (fieldlist != NULL) free(fieldlist);
+  if (fldalias != NULL) free(fldalias);
+  if (buff != NULL) free(buff);
+  if (tmpbuf != NULL) free(tmpbuf);
+  
+  return (nalias);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAfldrename                                                  |
+|                                                                             |
+|  DESCRIPTION:  Changes the field name                                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    zaID         hid_t                    ZA structure ID                    |
+|    oldfieldname char                     Original field name                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    newfieldname char                     New field name                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Aug 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_ZAfldrename(hid_t zaID, char *oldfieldname, const char *newfieldname)
+{
+  
+  herr_t   status     = FAIL;          /* Return status variable */
+
+  int      fldgroup   = FAIL;          /* Field group flag       */
+  int      k;                          /* Loop index             */
+
+  hid_t    fid        = FAIL;          /* HDF-EOS file ID        */
+  hid_t    gid        = FAIL;          /* "ZAS"  group ID        */
+  hid_t    groupID    = FAIL;          /* Field group ID         */
+
+  long     idx        = FAIL;          /* za index               */
+
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+
+
+
+  HE5_LOCK;
+  CHECKPOINTER(oldfieldname);
+  CHECKNAME(newfieldname);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAfldrename", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for za ID failed. \n");
+      H5Epush(__FILE__, "HE5_ZAfldrename", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Find out the field group */
+  /* ------------------------ */
+  fldgroup = HE5_ZAfldsrch(zaID,oldfieldname,NULL,NULL,NULL,NULL);
+  if (fldgroup == HE5_HDFE_DATAGROUP)
+    groupID = HE5_ZAXZa[idx].data_id;
+  else
+    {	  
+      sprintf(errbuf, "Error returning field group flag. \n");
+      H5Epush(__FILE__, "HE5_ZAfldrename", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Rename the field */
+  /* ---------------- */
+  status = H5Gmove(groupID, oldfieldname, newfieldname);
+  if (status == FAIL)
+    {	  
+      sprintf(errbuf, "Cannot change the field name from \"%s\" to \"%s\". \n", oldfieldname, newfieldname);
+      H5Epush(__FILE__, "HE5_ZAfldrename", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Update Table */
+  /* ------------ */
+  if (fldgroup == HE5_HDFE_DATAGROUP)
+    {
+      for (k = 0; k < HE5_ZAXZa[idx].nDFLD; k++)
+	{
+	  if (strcmp(HE5_ZAXZa[idx].ddataset[k].name, oldfieldname) == 0 )
+	    strcpy(HE5_ZAXZa[idx].ddataset[k].name, newfieldname);
+	}
+    }
+  
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAmountexternal                                              |
+|                                                                             |
+|  DESCRIPTION:  Mounts external data file onto "Data Fields"                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|    extfID       hid_t                    External file ID                   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    zaID         hid_t                    ZA structure ID                    |
+|    fldgroup     int                      Group flag                         |
+|    extfilename  char                     External File Name                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Aug 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+hid_t 
+HE5_ZAmountexternal(hid_t zaID, int fldgroup, const char *extfilename)
+{
+  
+  hid_t    extfID     = FAIL;           /* External file ID (return)   */
+  hid_t    fid        = FAIL;           /* HDF-EOS file ID             */
+  hid_t    gid        = FAIL;           /* "ZAS"  group ID             */
+  herr_t   status     = FAIL;           /* Return status variable      */
+
+  long     idx        = FAIL;           /* za index                    */
+
+  char     grpname[HE5_HDFE_NAMBUFSIZE];/* Group name buffer           */
+  char     errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer        */
+
+
+  HE5_LOCK; 
+  CHECKNAME(extfilename);
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAmountexternal", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for za ID failed. \n");
+      H5Epush(__FILE__, "HE5_ZAmountexternal", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  strcpy(grpname,"/HDFEOS/ZAS/");
+  strcat(grpname, HE5_ZAXZa[idx].zaname);
+
+  if (fldgroup == HE5_HDFE_DATAGROUP)
+    strcat(grpname,"/Data Fields");
+
+
+  /* Open external data file */
+  /* ----------------------- */
+  extfID = H5Fopen(extfilename, H5F_ACC_RDONLY, H5P_DEFAULT);
+  if ( extfID == FAIL )
+    {
+      sprintf(errbuf, "Cannot open external file named \"%s\". \n", extfilename);
+      H5Epush(__FILE__, "HE5_ZAmountexternal", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+
+  /* Mount external file */
+  /* ------------------- */
+  status = H5Fmount(fid, grpname, extfID, H5P_DEFAULT);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot mount external file onto \"%s\" group. \n", grpname);
+      H5Epush(__FILE__, "HE5_ZAmountexternal", __LINE__, H5E_FILE, H5E_MOUNT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+ COMPLETION:  
+  HE5_UNLOCK;
+  return(extfID);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:     ZAunmount                                                    |
+|                                                                             |
+|  DESCRIPTION:  Unmounts external data file from "Data Fields"               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    zaID         hid_t                    ZA structure ID                    |
+|    fldgroup     int                      Group flag                         |
+|    fileID       hid_t                    ID of file  to be unmounted        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Aug 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t 
+HE5_ZAunmount(hid_t zaID, int fldgroup, hid_t fileID)
+{
+  herr_t   status     = FAIL;           /* Return status variable */
+
+  hid_t    fid        = FAIL;           /* HDF-EOS file ID        */
+  hid_t    gid        = FAIL;           /* "ZAS"  group ID        */
+
+  long     idx        = FAIL;           /* za index               */
+
+  char     grpname[HE5_HDFE_NAMBUFSIZE];/* Group name buffer      */
+  char     errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer   */
+
+
+  HE5_LOCK;
+
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAunmount", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for za ID failed. \n");
+      H5Epush(__FILE__, "HE5_ZAunmount", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  strcpy(grpname,"/HDFEOS/ZAS/");
+  strcat(grpname, HE5_ZAXZa[idx].zaname);
+
+  if (fldgroup == HE5_HDFE_DATAGROUP)
+    strcat(grpname,"/Data Fields");
+
+
+  status = H5Funmount(fid, grpname);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot unmount external file from \"%s\" group. \n", grpname);
+      H5Epush(__FILE__, "HE5_ZAunmount", __LINE__, H5E_FILE, H5E_MOUNT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  status = H5Fclose(fileID);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot close external file. \n");
+      H5Epush(__FILE__, "HE5_ZAunmount", __LINE__, H5E_FILE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAreadexternal                                               |
+|                                                                             |
+|  DESCRIPTION:  Reads external dataset                                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  status         herr_t                   Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    zaID         hid_t                    ZA structure ID                    |
+|    fldgroup     int                      Group flag                         |
+|    fieldname    const char*              Field name to read                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    buffer       void*                    Output data bufer                  |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Aug 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_ZAreadexternal(hid_t zaID, int fldgroup, const char *fieldname, void *buffer)
+{
+  herr_t   status     = FAIL;/* return status variable      */
+ 
+  hid_t    fid        = FAIL;/* HDF-EOS file ID             */
+  hid_t    gid        = FAIL;/* "ZAS"  group ID             */
+  hid_t    groupID    = FAIL;/* Group ID                    */
+  hid_t    datasetID  = FAIL;/* Dataset ID                  */
+  hid_t    typeID     = FAIL;/* File data type ID           */
+  hid_t    mtypeID    = FAIL;/* Memory datatype ID          */
+ 
+  long     idx        = FAIL;/* za index                    */
+ 
+  char     grpname[HE5_HDFE_NAMBUFSIZE];/* Group name buffer    */
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+ 
+ 
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAreadexternal", &fid, &gid, &idx);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Checking for za ID failed. \n");
+      H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  strcpy(grpname,"/HDFEOS/ZAS/");
+  strcat(grpname, HE5_ZAXZa[idx].zaname);
+ 
+  if (fldgroup == HE5_HDFE_DATAGROUP)
+    strcat(grpname,"/Data Fields");
+ 
+ 
+  /* Open the group containing mounted file */
+  /* -------------------------------------- */
+  groupID = H5Gopen(fid, grpname);
+  if ( groupID == FAIL )
+    {
+      sprintf(errbuf, "Cannot open group containing mounted file. \n");
+      H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Open the dataset */
+  /* ---------------- */
+  datasetID = H5Dopen(groupID, fieldname);
+  if ( datasetID == FAIL )
+    {
+      sprintf(errbuf, "Cannot open mounted dataset. \n");
+      H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get the data type ID */
+  /* -------------------- */
+  typeID = H5Dget_type(datasetID);
+  if ( typeID == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the data type ID of  mounted dataset. \n");
+      H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get memory data type ID */
+  /* ----------------------- */
+  mtypeID    = HE5_EHdtype2mtype(typeID);
+  if (mtypeID == FAIL)
+    {
+      sprintf(errbuf, "Cannot convert to memory data type.") ;
+      H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Read the mounted dataset */
+  /* ------------------------ */
+  status = H5Dread(datasetID, mtypeID, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot read mounted data.") ;
+      H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+ 
+  /* Release data type ID */
+  /* -------------------- */
+  status = H5Tclose(typeID);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release data type ID.") ;
+      H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Release dataset ID */
+  /* ------------------ */
+  status = H5Dclose(datasetID);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release dataset ID.") ;
+      H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Release the group ID */
+  /* -------------------- */
+  status = H5Gclose(groupID);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release group ID.") ;
+      H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return(status);
+}
+ 
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAsetextdata                                                 |
+|                                                                             |
+|  DESCRIPTION: Sets external data files.                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               ZA structure ID                         |
+|  filelist       const char*         list of external files                  |
+|  offset         off_t               array of offsets (in bytes) from the    |
+|                                     beginning of the file to the location   |
+|                                     in the file where the data starts       |
+|  size           hsize_t             array of sizes (in bytes) reserved in   |
+|                                     the file for the data.                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+herr_t
+HE5_ZAsetextdata(hid_t zaID, const char *filelist, off_t offset[], hsize_t size[])
+{
+  herr_t          status       = FAIL;        /* return status variable */
+ 
+  int             i;                          /* Loop index             */
+ 
+  hid_t           fid          = FAIL;        /* HDF-EOS file ID        */
+  hid_t           gid          = FAIL;        /* "HDFEOS" group ID      */
+ 
+  long            idx          = FAIL;        /* za index               */
+ 
+  char            *namebuf     = (char *)NULL;/* File list buffer       */
+  char            *filename    = (char *)NULL;/* File name buffer       */
+  char            *comma       = (char *)NULL;/* Pointer to comma       */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+ 
+ 
+  HE5_LOCK;
+  CHECKPOINTER(filelist);
+  CHECKPOINTER(offset);
+  CHECKPOINTER(size);
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAsetextdata", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for valid za ID failed.\n");
+      H5Epush(__FILE__, "HE5_ZAsetextdata", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+ 
+  /* Get current dataset creation property list */
+  /* ------------------------------------------ */
+  if( HE5_ZAXZa[idx].plist == FAIL)
+    HE5_ZAXZa[idx].plist = H5Pcreate(H5P_DATASET_CREATE);
+ 
+ 
+  /* Allocate space for namebuf, copy dimlist into it, & append comma */
+  /* ---------------------------------------------------------------- */
+  namebuf = (char *)calloc(strlen(filelist) + 64, sizeof(char));
+  if(namebuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAsetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory.");
+      HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+ 
+  /*
+********************************************************************
+*   C H E C K  T H E   C O N T E N T   O F  filelist  S T R I N G  *
+********************************************************************
+*/
+ 
+  strcpy(namebuf, filelist);
+  strcat(namebuf, ",");
+ 
+  /* Find comma */
+  /* ---------- */
+  comma = strchr(namebuf, ',');
+ 
+  i = 0;
+ 
+  /* Parse the list of file names */
+  /* ---------------------------- */
+  while (comma != NULL)
+    {
+      /* Allocate memory for filename buffer */
+      /* ----------------------------------- */
+      filename = (char *) calloc(comma - namebuf + 1, sizeof(char));
+      if (filename == NULL)
+	{
+	  sprintf(errbuf, "Cannot allocate memory for filename. \n") ;
+	  H5Epush(__FILE__, "HE5_ZAsetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(namebuf);
+ 
+	  return(FAIL);
+	}
+ 
+      /* Copy file list entry to filename */
+      /* -------------------------------- */
+      memmove(filename, namebuf, comma - namebuf);
+      filename[comma-namebuf] = 0;
+ 
+      /* Set the property list */
+      /* --------------------- */
+      status = H5Pset_external(HE5_ZAXZa[idx].plist, filename, offset[i], size[i]);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot set external dataset property list.\n");
+	  H5Epush(__FILE__, "HE5_ZAsetextdata", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(namebuf);
+	  free(filename);
+	  return(status);
+	}
+ 
+ 
+      /* Go to next file  entry, find next comma, ... */
+      /* ============================================ */
+      memmove(namebuf, comma + 1, strlen(comma + 1) + 1);
+      comma = strchr(namebuf, ',');
+ 
+      if (filename != NULL) free(filename);
+ 
+      i++;
+    }
+ 
+  if (namebuf != NULL) free(namebuf);
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return (status);
+}
+ 
+ 
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAgetextdata                                                 |
+|                                                                             |
+|  DESCRIPTION: Gets external data files information.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfiles         int                 number of external files  SUCCEED,      |
+|                                               (-1) FAIL                     |
+|  INPUTS:                                                                    |
+|  zaID           hid_t               za structure ID                         |
+|  fieldname      char*               External field name                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  namelength     size_t              Length of each name entry               |
+|  filelist       char*               List of file names                      |
+|  offset         off_t               array of offsets (in bytes) from the    |
+|                                     beginning of the file to the location   |
+|                                     in the file where the data starts       |
+|  size           hsize_t             array of sizes (in bytes) reserved in   |
+|                                     the file for the data.                  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_ZAgetextdata(hid_t zaID, char *fieldname, size_t namelength, char *filelist, off_t offset[], hsize_t size[])
+{
+  int             nfiles       = FAIL;        /* Number of ext. files   */
+  int             i;                          /* Loop index             */
+ 
+  size_t          slen         = 0;           /* String length          */
+ 
+  herr_t          status       = FAIL;        /* return status variable */
+ 
+  hid_t           fid          = FAIL;        /* HDF-EOS file ID        */
+  hid_t           gid          = FAIL;        /* "HDFEOS" group ID      */
+  hid_t           fieldID      = FAIL;        /* Data field ID          */
+  hid_t           plist        = FAIL;        /* Property list ID       */
+ 
+  off_t           off          = 0;           /* Offset of data segment */
+ 
+  hsize_t         sz           = 0;           /* Size of data segment   */
+ 
+  long            idx          = FAIL;        /* za index               */
+ 
+  char            *filename    = (char *)NULL;/* File name buffer       */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */
+ 
+ 
+ 
+  HE5_LOCK;
+  CHECKPOINTER(fieldname);
+ 
+  /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */
+  /* --------------------------------------------------- */
+  status = HE5_ZAchkzaid(zaID, "HE5_ZAgetextdata", &fid, &gid, &idx);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Checking for valid za ID failed.\n");
+      H5Epush(__FILE__, "HE5_ZAgetextdata", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(status);
+    }
+ 
+  /* Check out the field group and get field ID */
+  /* ------------------------------------------ */
+  HE5_ZAfldsrch(zaID,fieldname,&fieldID,NULL,NULL,NULL);
+  if( fieldID == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the field ID for the \"%s\" field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAgetextdata", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Get the property list ID */
+  /* ------------------------ */
+  plist = H5Dget_create_plist(fieldID);
+  if ( plist == FAIL )
+    {
+      sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAgetextdata", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Get the number of external files */
+  /* -------------------------------- */
+  nfiles = H5Pget_external_count(plist);
+  if ( nfiles < 0 )
+    {
+      sprintf(errbuf, "Cannot get the number of external files.\n");
+      H5Epush(__FILE__, "HE5_ZAgetextdata", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+ 
+  /* Allocate memory for file name */
+  /* ----------------------------- */
+  filename = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char));
+  if(filename == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAgetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory.");
+      HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  strcpy(filelist,"");
+ 
+  /* Loop through all external files */
+  /* ------------------------------- */
+  for (i = 0; i < nfiles; i++)
+    {
+      strcpy(filename,"");
+ 
+      /* Get the file name, offset, and size */
+      /* ----------------------------------- */
+      status = H5Pget_external(plist, i, namelength, filename, &off, &sz);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot get information about external file.\n");
+	  H5Epush(__FILE__, "HE5_ZAgetextdata", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(filename);
+	  return(FAIL);
+	}
+ 
+      offset[i] = off;
+      size[i]   = sz;
+       
+      strcat(filelist, filename);
+ 
+      /* Append comma */
+      /* ------------ */
+      if (nfiles > 1 && i < nfiles - 1)
+	strcat(filelist,",");
+ 
+    }
+ 
+  slen = strlen(filelist);
+ 
+  filelist[slen] = 0;
+ 
+  if (filename != NULL) free(filename);
+ 
+ 
+  /* Release property list ID */
+  /* ------------------------ */
+  status = H5Pclose(plist);
+  if (status == FAIL )
+    {
+      sprintf(errbuf, "Cannot release property list ID.\n");
+      H5Epush(__FILE__, "HE5_ZAgetextdata", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+ COMPLETION:
+  HE5_UNLOCK;
+  return (nfiles);
+}
+ 
+ 
+
+/* 
+******************************************************************************
+|                                                                            |
+|          F  O  R  T  R  A  N  7 7      W  R  A  P  P  E  R  S              |
+|                                                                            |
+******************************************************************************
+*/
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAopenF (FORTRAN wrapper)                                    |
+|                                                                             |
+|  DESCRIPTION: Opens or creates HDF-EOS file in order to create, read, or    |
+|               write a ZA.                                                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|     FileID      int     None        HDF-EOS file ID                         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|     filename    char*    None       File name string                        |
+|     Flags       int      None       File access code                        |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|     None                                                                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date       Programmer   Description                                       |
+|  ========   ============  ================================================= |
+|  Jul 02      S.ZHAO       Original development                              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_ZAopenF(char *filename, int Flags)
+{
+  hid_t     fid     = FAIL;/* HDF5 file ID          */
+
+  int       FileID  = FAIL;/* hdf-eos file ID       */
+  
+  uintn     flags   = 9999;/* HDF5 file access code */
+
+  char      *errbuf = NULL;/* Error message buffer  */
+
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAopenF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+
+      return(FAIL);
+    }  
+
+  /* Set up the file access flag */
+  /* --------------------------- */
+  if (Flags == HE5F_ACC_RDWR || Flags == HDF5_ACC_RDWR) flags = H5F_ACC_RDWR;
+  else if (Flags == HE5F_ACC_RDONLY || Flags == HDF5_ACC_RDONLY) flags = H5F_ACC_RDONLY;
+  else if (Flags == HE5F_ACC_TRUNC || Flags == HDF5_ACC_CREATE)  flags = H5F_ACC_TRUNC;
+  else
+    {
+      sprintf(errbuf, "File access flag is not supported. \n");
+      H5Epush(__FILE__, "HE5_ZAopenF", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }  
+	
+
+
+  /* Call HE5_EHopen to open file */
+  /* ---------------------------- */
+  fid = HE5_EHopen(filename, flags, H5P_DEFAULT);
+  if(fid == FAIL)
+    {
+      sprintf(errbuf, "Cannot open the file \"%s\". Check the file name. \n", filename);
+      H5Epush(__FILE__, "HE5_ZAopenF", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }  
+
+  free(errbuf);
+
+  FileID = (int)fid;
+  return(FileID);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAcreateF (FORTRAN wrapper)                                  |
+|                                                                             |
+|  DESCRIPTION: Creates a new za structure and returns za ID                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|   zaID          int          None        ZA structure ID                    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|   FileID        int          None        HDF-EOS file ID                    |
+|   zaname        char*        None        za name string                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|   None                                                                      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_ZAcreateF(int FileID, char *zaname)
+{
+  hid_t           zaID           = FAIL;/* return value of za ID           */
+  hid_t           fid            = FAIL;/* HDF-EOS file ID                 */
+
+  int             ZaID           = FAIL;/* int Za ID                       */
+  
+  char            *errbuf =(char *)NULL;/* Buffer for error message        */
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf = (char *)calloc(HE5_HDFE_DIMBUFSIZE, sizeof(char ) ) ;
+  if ( errbuf == NULL )
+    {
+      H5Epush(__FILE__, "HE5_ZAcreateF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+
+  fid = (hid_t)FileID;
+  
+  zaID = HE5_ZAcreate(fid, zaname);
+  if (zaID == FAIL)
+    {
+      sprintf(errbuf,"Cannot create za. \n");
+      H5Epush(__FILE__, "HE5_ZAcreateF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+	
+  ZaID = (int)zaID;	
+  
+  /* Deallocate memory */
+  /* ----------------- */
+  free(errbuf);
+  
+  return(ZaID);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAattachF     (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION:  Attaches to an existing za within the file.                  |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ZaID           int                 ZA structure ID                         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int                 HDF-EOS file ID                         |
+|  zaname         char                ZA structure name                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date        Programmer    Description                                     |
+|  =========   ============  ==============================================   |
+|  Jul 02       S.ZHAO       Original development                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_ZAattachF(int FileID, char *zaname)
+{
+  int             ZaID       = FAIL;/* int za ID (return)            */
+
+  hid_t           zaID       = FAIL;/* za ID (return value)          */ 
+  hid_t           fid        = FAIL;/* HDF-EOS file ID               */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer*/
+
+  fid = (hid_t)FileID;
+
+  zaID = HE5_ZAattach(fid, zaname);
+  if (zaID == FAIL)
+    {
+      sprintf(errbuf,"Cannot attach to the za \"%s\". \n", zaname);
+      H5Epush(__FILE__, "HE5_ZAattachF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  ZaID = (int)zaID;
+
+  return (ZaID);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdetachF  (FORTRAN wrapper)                                 |
+|                                                                             |
+|  DESCRIPTION: Detachs za structure and performs housekeeping                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_ZAdetachF(int ZaID)
+{
+  int            ret     = FAIL;/* int return status              */
+
+  hid_t          zaID    = FAIL;/* HDF-EOS za ID                  */
+  herr_t         status  = FAIL;/* routine return status variable */
+
+  char           errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAdetach(zaID);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot detach from the za. \n");
+      H5Epush(__FILE__, "HE5_ZAdetachF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  ret = (int)status;	
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAcloseF    (FORTRAN wrapper)                                |
+|                                                                             |
+|  DESCRIPTION: Closes HDF-EOS file                                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  FileID         int                 File ID                                 |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_ZAcloseF(int FileID)
+{
+  int      ret    = FAIL;/* int return status variable     */
+
+  hid_t    fid    = FAIL;/* HDF-EOS file ID                */
+
+  herr_t   status = FAIL;/* routine return status variable */
+
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+
+  fid = (hid_t)FileID;
+  status = HE5_ZAclose(fid);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot close the file. \n");
+      H5Epush(__FILE__, "HE5_ZAcloseF", __LINE__, H5E_FILE, H5E_CLOSEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdefdimF                                                    |
+|                                                                             |
+|  DESCRIPTION: Defines numerical value of dimension (FORTRAN wrapper)        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  dimname        char                dimension name                          |
+|  dim            long                dimension size                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAdefdimF(int ZaID, char *dimname, long dim)
+{
+  int       ret       = SUCCEED;/* (int) return status variable  */ 
+
+  hid_t     zaID      = FAIL;   /* HDF5 type za ID               */
+
+  herr_t	status    = SUCCEED;/* HDF5 type return status       */
+ 
+  hsize_t	tdim      = 0;      /* temporary(dimension) variable */
+  
+  char		*errbuf   = (char *)NULL;/* Error message buffer     */
+  
+  
+  errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  
+  tdim    = (hsize_t)dim;	
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAdefdim(zaID, dimname, tdim);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Error calling HE5_ZAdefdim from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_ZAdefdimF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdefineF                                                    |
+|                                                                             |
+|                                                                             |
+|  DESCRIPTION: Defines data field within ZA structure (FORTRAN)              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         herr_t              return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           int                 ZA structure ID                         |
+|  fieldname      char                fieldname                               |
+|  fortdimlist    char                Dimension list (comma-separated list)   |
+|                                         FORTRAN dimesion order              |
+|  fortmaxdimlist char                Max Dimension list (FORTRAN order)      |
+|  numtype        int                 field type                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAdefineF(int zaID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int numtype)
+{
+  int       ret        = SUCCEED;/* (int) return status variable   */  
+
+  herr_t    status     = SUCCEED;/* routine return status variable */
+
+  hid_t     ZaID       = FAIL;   /* HDF5 type za ID                */
+  hid_t	    numbertype = FAIL;   /* HDF5 type data type ID         */
+  
+  char  	*dimlist   = (char *)NULL;/* Dimension list (C order)  */
+  char		*maxdimlist= (char *)NULL;/* Max. dimension list (C)   */
+  char		*errbuf    = (char *)NULL;/* error message buffer      */
+
+  ZaID = (hid_t)zaID;
+
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_ZAdefineF", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, "Cannot convert datatype for FORTRAN wrapper.");
+      HE5_EHprint("Error: Cannot convert datatype for FORTRAN wrapper, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  if(strcmp(fortmaxdimlist,"") == 0)
+    fortmaxdimlist = NULL;
+  
+  
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAdefineF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  dimlist = (char *)calloc(strlen(fortdimlist) + 1, sizeof(char));
+  if(dimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for dimlist.\n");
+      H5Epush(__FILE__, "HE5_ZAdefineF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /* Reverse entries in dimension list (FORTRAN -> C) */
+  /* ------------------------------------------------ */
+  status = HE5_EHrevflds(fortdimlist, dimlist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in dimension list.\n");
+      H5Epush(__FILE__, "HE5_ZAdefineF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      return(FAIL);
+    }
+
+  if (fortmaxdimlist != NULL)
+    {
+      /* Allocate space for C order max. dim. list */
+      /* ----------------------------------------- */
+      maxdimlist = (char *)calloc(strlen(fortmaxdimlist) + 1, sizeof(char));
+      if(maxdimlist == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for maxdimlist.\n");
+	  H5Epush(__FILE__, "HE5_ZAdefineF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(dimlist);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+
+      /* Reverse entries in dimension list (FORTRAN -> C) */
+      /* ------------------------------------------------ */
+      status = HE5_EHrevflds(fortmaxdimlist, maxdimlist);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot reverse entries in maximum dimension list.\n");
+	  H5Epush(__FILE__, "HE5_ZAdefineF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(dimlist);
+	  free(maxdimlist);
+	  return(FAIL);
+	}
+    }
+  else
+    {
+      maxdimlist = NULL;
+    }
+	  
+  
+  /* Call Define Field routine */
+  /* ------------------------- */
+  status = HE5_ZAdefinefield(ZaID, "Data Fields", fieldname, dimlist, maxdimlist, numbertype);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot define \"%s\" field.\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAdefineF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      if (maxdimlist!=NULL) 
+	free(maxdimlist);
+	  
+      return(FAIL);
+    }
+  
+  free(dimlist);
+  if (maxdimlist != NULL) 
+    free(maxdimlist);
+  
+  free(errbuf);
+
+  ret = (int)status;
+  return (ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdefcompF      (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Defines compression type and parameters                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  compcode       int                 compression code                        |
+|  compparm       int                 compression parameters                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:   Before calling this function, storage must be CHUNKED             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_ZAdefcompF(int ZaID, int compcode,  int *compparm)
+{
+  int             ret      = FAIL; /* routine return status variable   */
+
+  herr_t          status   = FAIL; /* routine return status variable   */
+
+  hid_t           zaID     = FAIL; /* HDF5 type  za ID                 */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */
+
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAdefcomp(zaID, compcode, compparm);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling ZAdefcomp() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_ZAdefcompF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret = (int)status;
+  return(ret);
+
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdefchunkF                                                  |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper for ZAdefchunk                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  ndims          int                 rank of a dataset                       |
+|  *dim           long                pointer to the array containing sizes   |
+|                                     of each dimension of a chunk            |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date         Programmer    Description                                    |
+|  =========   ============  ==============================================   |
+|  Jul 02       S.ZHAO       Original development                             |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAdefchunkF(int ZaID, int ndims, long *dim)
+{
+  int		ret       = FAIL;           /* return status        */
+  int		j = 0;                      /* Loop index           */
+
+  herr_t	status    = FAIL;           /* return status        */
+
+  hid_t         zaID      = FAIL;           /* HDF5 type za ID      */
+
+  hsize_t	*tempdims = (hsize_t *)NULL;/* Temporary variable   */
+  
+  char		*errbuf   = (char *)NULL;   /* error message buffer */
+
+  /* Allocate memory for error message buffer */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAdefchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  tempdims = (hsize_t *)calloc(ndims, sizeof(hsize_t));
+  if(tempdims == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tempdims.\n");
+      H5Epush(__FILE__, "HE5_ZAdefchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  
+  /* Change from FORTRAN to C dimension order */
+  /* ---------------------------------------- */
+  for (j = 0; j < ndims; j++)
+    tempdims[j] = (hsize_t)dim[ndims - 1 - j];
+
+
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAdefchunk(zaID, ndims, tempdims);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling ZAdefchunk() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_ZAdefchunkF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(tempdims);
+      return(FAIL);
+    }
+
+  
+  free(tempdims);
+  free(errbuf);
+  
+  ret = (int)status;
+  return(ret);
+ 
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAcompinfoF  (FORTRAN wrapper)                               |
+|                                                                             |
+|  DESCRIPTION: Retrieves compression information about a field               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        Return status  (0) SUCCEED, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fieldname      const char*         Field name                              |
+|  compcode       int*                Compression code                        |
+|  compparm       int                 Compression parameters                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_ZAcompinfoF(int ZaID, char *fieldname, int *compcode, int compparm[])
+{
+  int             ret      = FAIL;        /* Return status variable       */
+
+  herr_t          status   = FAIL;        /* Return status variable       */
+
+  hid_t           zaID     = FAIL;        /* HDF5 type za ID              */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */
+
+
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAcompinfo(zaID, fieldname, compcode, compparm);
+  if (status == FAIL)
+    {
+      sprintf(errbuf , "Compression information for \"%s\" not found.\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAcompinfoF", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAwritecharF                                                 |
+|                                                                             |
+|  DESCRIPTION: Writes data to a character string field (FORTRAN wrapper      |
+|               around ZAwrite)                                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fieldname      char                fieldname                               |
+|  elemlen        int                 each element length in array of string  |
+|  numelem        int                 number of elements in declared buffer   |
+|                                     array                                   |
+|  fortstart      long                start array                             |
+|  fortstride     long                stride array                            |
+|  fortedge       long                edge array                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Feb 04    S.ZHAO       For an array of character string dataset.           |
+|  Jun 04    S.Zhao       Added one more argument (numelem).                  |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAwritecharF(int ZaID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *data)
+{
+  int          ret      = SUCCEED;      /* int return status variable        */
+  int          i;                       /* Loop index                        */
+  int          rank     = 0;            /* Field rank                        */
+ 
+  herr_t       status   = SUCCEED;      /* routine return status variable    */
+ 
+  hid_t        ntype[1] = {FAIL};       /* Field datatype ID                 */
+ 
+  hid_t        zaID     = FAIL;         /* HDF-EOS za ID                     */
+ 
+  hssize_t     *start  = (hssize_t *)NULL;/* Pointer to start array (C order)*/
+ 
+  hsize_t      dims[HE5_DTSETRANKMAX];   /* Field dimensions                 */
+  hsize_t      *stride = (hsize_t *)NULL;/* Pointer to stride array (C order)*/
+  hsize_t      *edge   = (hsize_t *)NULL;/* Pointer to edge array (C order)  */
+ 
+  char         *errbuf = (char *)NULL;   /* error message buffer             */
+  char         **strdatabuf = NULL;      /* string data buffer               */
+  int          nelem = 0;               /* number of elements in array of str*/
+  int          strsize = 0;              /* each str length in array of str  */
+  char         *blankPtr = (char *)NULL; /* pointer to blank character       */
+  char         *tmpString = (char *)NULL;/* pointer to temp string           */
+  int          attr = 0;                 /* attribute value                  */
+  hsize_t      count[1];                 /* number of attribute elements     */
+ 
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAwritecharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  zaID = (hid_t)ZaID;
+ 
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[ i ] = 0;
+ 
+  /* Get field info  */
+  /* --------------- */
+  status = HE5_ZAinfo(zaID, fieldname, &rank, dims, ntype, NULL, NULL);
+  if (status != FAIL)
+    {
+      start = (hssize_t *)calloc(rank, sizeof(hssize_t));
+      if(start == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for start.\n");
+	  H5Epush(__FILE__, "HE5_ZAwritecharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      stride = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(stride == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for stride.\n");
+	  H5Epush(__FILE__, "HE5_ZAwritecharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      edge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(edge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_ZAwritecharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      /* Reverse order of dimensions (FORTRAN -> C) */
+      /* ------------------------------------------ */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i]  = (hssize_t)fortstart[rank - 1 - i];
+	  stride[i] = (hsize_t)fortstride[rank - 1 - i];
+	  edge[i]   = (hsize_t)fortedge[rank - 1 - i];
+        }
+ 
+      strsize = elemlen;
+      nelem = dims[0];
+
+      tmpString = (char *)calloc(sizeof(char),strsize+1);
+      if(tmpString == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for tmpString.\n");
+	  H5Epush(__FILE__, "HE5_ZAwritecharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      strdatabuf = (char **)malloc(nelem*sizeof(char *));
+      for (i = 0; i<nelem; i++)
+	{
+	  strdatabuf[i] = NULL;
+	  strdatabuf[i] = (char *)malloc((strsize+1)*sizeof(char));
+	  strncpy(strdatabuf[i],(char *)data+(strsize*i), strsize);
+	  strdatabuf[i][strsize] = '\0';
+	  strcpy(tmpString,strdatabuf[i]);
+ 
+	  /* Find the first non blank character from the end */
+	  /* ----------------------------------------------- */
+	  blankPtr = tmpString + strsize -1;
+	  while (*blankPtr == ' ')
+	    {
+	      blankPtr--;
+	    }
+ 
+	  /* Turn it into a C string */
+	  /* ----------------------- */
+	  blankPtr++;
+	  *blankPtr = '\0';
+ 
+	  strcpy(strdatabuf[i], tmpString);
+	}
+ 
+      free(tmpString);
+
+      count[0] = 1;
+      attr = strsize;
+      status = HE5_ZAwritelocattr(zaID, fieldname, "StringLengthAttribute", H5T_NATIVE_INT, count, &attr);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write attribute to the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_ZAwritecharF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }
+	  return(FAIL);
+	}
+ 
+      status = HE5_ZAwrrdfield(zaID, fieldname, "w", start, stride, edge, strdatabuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_ZAwritecharF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }
+	  return(FAIL);
+	}
+ 
+      free(start);
+      free(stride);
+      free(edge);
+      free(errbuf);
+      if (strdatabuf != NULL)
+	{
+	  for (i = 0; i<nelem; i++)
+	    {
+	      if (strdatabuf[i] != NULL)
+		{
+		  free (strdatabuf[i]);
+		  strdatabuf[i] = NULL;
+		}
+	    }
+	  free (strdatabuf);
+	  strdatabuf = NULL;
+	}
+
+    }
+  else
+    {
+      sprintf(errbuf, "Error calling HE5_ZAinfo() from FORTRAN wrapper. \n") ;
+      H5Epush(__FILE__, "HE5_ZAwritecharF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+ 
+      free(errbuf);
+    }
+ 
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAwriteF                                                     |
+|                                                                             |
+|  DESCRIPTION: Writes data to field (FORTRAN wrapper around ZAwrite)         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fieldname      char                fieldname                               |
+|  fortstart      long                start array                             |
+|  fortstride     long                stride array                            |
+|  fortedge       long                edge array                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|  Feb 05    S.Zhao       Replaced the "myedge" array by the "dims" array if  |
+|                         it was larger than the dimension size.              |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAwriteF(int ZaID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *data)
+{
+  int             ret      = SUCCEED;    /* int return status variable     */
+  int             i;                     /* Loop index                     */
+  int		  rank     = 0;          /* Field rank                     */
+
+  herr_t          status   = SUCCEED;    /* routine return status variable */
+
+  hid_t  	  ntype[1] = {FAIL};     /* Field datatype ID              */
+ 
+  hid_t           zaID     = FAIL;       /* HDF-EOS za ID                  */
+    
+  hssize_t        *start  = (hssize_t *)NULL;/* Pointer to start array (C order)  */
+
+  hsize_t         dims[HE5_DTSETRANKMAX]; /* Field dimensions              */
+  hsize_t         *stride = (hsize_t *)NULL; /* Pointer to stride array (C order) */
+  hsize_t         *edge   = (hsize_t *)NULL; /* Pointer to edge array (C order)   */
+  
+  char            *errbuf = (char *)NULL; /* error message buffer          */
+  hsize_t         *myedge = (hsize_t *)NULL;
+  
+
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  zaID = (hid_t)ZaID;
+
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[ i ] = 0;
+
+  /* Get field info  */
+  /* --------------- */
+  status = HE5_ZAinfo(zaID, fieldname, &rank, dims, ntype, NULL, NULL);
+  if (status != FAIL)
+    {
+      start = (hssize_t *)calloc(rank, sizeof(hssize_t));
+      if(start == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for start.\n");
+	  H5Epush(__FILE__, "HE5_ZAwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+        }
+
+      stride = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(stride == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for stride.\n");
+	  H5Epush(__FILE__, "HE5_ZAwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(errbuf);
+	  return(FAIL);
+        }
+
+      edge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(edge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_ZAwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      /* Reverse order of dimensions (FORTRAN -> C) */
+      /* ------------------------------------------ */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i]  = (hssize_t)fortstart[rank - 1 - i];
+	  stride[i] = (hsize_t)fortstride[rank - 1 - i];
+	  edge[i]   = (hsize_t)fortedge[rank - 1 - i];
+        }
+
+      myedge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(myedge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_ZAwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+        }
+
+      for (i = 0; i < rank; i++)
+        {
+	  if(edge[i] > dims[i])
+	    myedge[i] = dims[i];
+	  else
+	    myedge[i] = edge[i];
+        }
+
+      status = HE5_ZAwrrdfield(zaID, fieldname, "w", start, stride, myedge, data);
+      if (status == FAIL)
+        {
+	  sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_ZAwriteF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(myedge);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      free(start);
+      free(stride);
+      free(edge);
+      free(myedge);
+      free(errbuf);
+
+    }
+  else
+    {
+      sprintf(errbuf, "Error calling HE5_ZAinfo() from FORTRAN wrapper. \n") ;
+      H5Epush(__FILE__, "HE5_ZAwriteF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      status = FAIL;
+ 
+      free(errbuf);
+    }
+ 
+  ret = (int)status;
+  return(ret);
+}
+
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAwrattr                                                     |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper to write/update attribute in a za.            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  attrname       char*               attribute name                          |
+|  numtype        int                 attribute HDF numbertype                |
+|  fortcount[]    long                number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|  Mar 04    S.Zhao       Modified for a character string attribute.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAwrattr(int ZaID, char *attrname, int numtype, long fortcount[], void * datbuf)
+{
+  int       ret     = FAIL;/* int return status variable                 */
+  int       rank    = 1;   /* Note: It is assumed that fortcout has just */
+			   /* one element to agree with EHattr function  */
+  int		i;             /* Loop index                             */
+
+  hid_t     zaID    = FAIL;/* HDF-EOS za ID                              */
+  hid_t     numbertype = FAIL;/* HDF5 data type ID                       */ 
+
+  herr_t	status     = FAIL;/* routine return status variable          */
+  
+  hsize_t	*count     = (hsize_t *)NULL;/* Pointer to count array (C order)*/
+    
+  char      *errbuf = (char *)NULL;   /* error message buffer            */
+  char      *tempbuf = (char *)NULL;  /* temp buffer                     */
+  
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_ZAwrattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Error calling HE5_EHconvdatatype() from FORTRAN wrapper.");
+      HE5_EHprint("Error: Error calling HE5_EHconvdatatype() from FORTRAN wrapper, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate memory for "count" array */
+  /* --------------------------------- */
+  count = (hsize_t *)calloc(rank, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_ZAwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < rank; i++)
+    {
+      count[i] = (hsize_t)fortcount[rank - 1 - i];
+    }
+  
+  zaID = (hid_t)ZaID;
+
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_ZAwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n");
+	  H5Epush(__FILE__, "HE5_ZAwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+ 
+      /* Call ZAwriteattr() */
+      /* ------------------ */
+      status = HE5_ZAwriteattr(zaID, attrname, numbertype, count, tempbuf);
+      if( status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname);
+          H5Epush(__FILE__, "HE5_ZAwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(count);
+          free(errbuf);
+          free(tempbuf);
+          return(FAIL);
+	}
+ 
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    {
+      /* Call ZAwriteattr() */
+      /* ------------------ */
+      status = HE5_ZAwriteattr(zaID, attrname, numbertype, count, datbuf);
+      if( status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname);
+	  H5Epush(__FILE__, "HE5_ZAwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+          return(FAIL);
+	} 
+      free(count);
+      free(errbuf);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAsetfill  (FORTRAN wrapper)                                 |
+|                                                                             |
+|  DESCRIPTION: Sets fill value for the specified field.                      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fieldname      char*               field name                              |
+|  fillval        void*               fill value                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAsetfill(int ZaID, char *fieldname, int numtype, void *fillval)
+{
+  int          ret        = FAIL;/* int return status variable  */ 
+
+  herr_t       status     = FAIL;/* return status variable      */
+ 
+  hid_t        numbertype = FAIL;/* HDF5 data tyope ID          */
+  hid_t        zaID       = FAIL;/* HDF5 za ID                  */
+
+  char         errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_ZAsetfill", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  zaID = (hid_t)ZaID;
+  status = HE5_ZAsetfillvalue(zaID, fieldname, numbertype, fillval);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot set fill value for the field \"%s\".\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAsetfill", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAgetfill   (FORTRAN wrapper)                                |
+|                                                                             |
+|  DESCRIPTION: Retrieves fill value for a specified field.                   |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fieldname      char*               field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fillval        void*               fill value                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_ZAgetfill(int ZaID, char *fieldname, void *fillval)
+{
+  int             ret      = FAIL;/* routine return status variable   */
+
+  herr_t          status   = FAIL;/* routine return status variable   */
+
+  hid_t           zaID     = FAIL;/* HDF5 type za ID                  */
+    
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAgetfillvalue(zaID, fieldname, fillval);
+  if (status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get fill value for the field \"%s\".\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAgetfill", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret = (int)status;
+  return (ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAreadF                                                      |
+|                                                                             |
+|  DESCRIPTION: Reads data from field (FORTRAN wrapper around ZAread)         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fieldname      char                fieldname                               |
+|  fortstart      long                start array                             |
+|  fortstride     long                stride array                            |
+|  fortedge       long                edge array                              |
+|  buffer         void                data buffer for read                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|     None                                                                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAreadF(int ZaID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *buffer)
+ 
+{
+  int	      ret      = SUCCEED;       /* routine return status variable    */
+  int	      i        = 0;	        /* Loop index                        */
+  int	      rank     = 0;             /* Field rank                        */
+
+  hid_t       ntype[1] = {FAIL};        /* Field data type ID                */
+
+  hid_t       zaID     = FAIL;          /* za HDF5 type  ID                  */
+
+  herr_t      status   = SUCCEED;       /* routine return status variable    */
+    
+  hssize_t    *start  = (hssize_t *)NULL;/* Pointer to start array (C order) */
+  hsize_t     dims[HE5_DTSETRANKMAX];    /* Field dimensions                 */
+  hsize_t     *stride = (hsize_t *)NULL; /* Pointer to stride array (C order)*/
+  hsize_t     *edge   = (hsize_t *)NULL; /* Pointer to edge array (C order)  */
+  
+  char	      *errbuf = (char *)NULL;    /* error message buffer             */
+  
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  zaID = (hid_t)ZaID;
+  
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[ i ] = 0;
+
+  /* Get field info */
+  /* -------------- */
+  status = HE5_ZAinfo(zaID, fieldname, &rank, dims, ntype, NULL,NULL);  
+  if (status != FAIL)
+    {
+      start =  (hssize_t *)calloc(rank, sizeof(hssize_t));
+      if(start == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for start.\n");
+	  H5Epush(__FILE__, "HE5_ZAreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+        }
+      stride = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(stride == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for stride.\n");
+	  H5Epush(__FILE__, "HE5_ZAreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(errbuf);
+	  return(FAIL);
+        }
+      edge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(edge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_ZAreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      /* Reverse order of dimensions (FORTRAN -> C) */
+      /* ------------------------------------------ */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i]  = (hssize_t)fortstart[rank - 1 - i];
+	  stride[i] = (hsize_t)fortstride[rank - 1 - i];
+	  edge[i]   = (hsize_t)fortedge[rank - 1 - i];
+        }
+ 
+
+      /* Read data from the field */
+      /* ------------------------ */
+      status = HE5_ZAwrrdfield(zaID, fieldname, "r", start, stride, edge, buffer);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot read data from the \"%s\" field.",fieldname) ;
+	  H5Epush(__FILE__, "HE5_ZAreadF", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      free(start);
+      free(stride);
+      free(edge);
+      free(errbuf);
+
+    }
+  else
+    {
+      sprintf(errbuf, "Fieldname \"%s\" does not exist.",fieldname) ;
+      H5Epush(__FILE__, "HE5_ZAreadF", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      status = FAIL;
+    }
+  
+
+  ret = (int)status;
+  return(ret);
+}
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAreadcharF                                                  |
+|                                                                             |
+|  DESCRIPTION: Reads data from a character string field (FORTRAN wrapper     |
+|               around ZAread)                                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fieldname      char                fieldname                               |
+|  elemlen        int                 each element length in array of string  |
+|  numelem        int                 number of elements in declared buffer   |
+|                                     array                                   |
+|  fortstart      long                start array                             |
+|  fortstride     long                stride array                            |
+|  fortedge       long                edge array                              |
+|  buffer         void                data buffer for read                    |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|     None                                                                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Apr 04    S.Zhao       For an array of character string dataset.           |
+|  Jun 04   S.Zhao        Added two more arguments (elemlen and numelem).     |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAreadcharF(int ZaID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *buffer)
+ 
+{
+  int         ret      = SUCCEED;     /* routine return status variable      */
+  int         i        = 0;           /* Loop index                          */
+  int         rank     = 0;           /* Field rank                          */
+ 
+  hid_t       ntype[1] = {FAIL};      /* Field data type ID                  */
+ 
+  hid_t       zaID     = FAIL;        /* za HDF5 type  ID                    */
+ 
+  herr_t      status   = SUCCEED;     /* routine return status variable      */
+ 
+  hssize_t    *start  = (hssize_t *)NULL;/* Pointer to start array (C order) */
+  hsize_t     dims[HE5_DTSETRANKMAX];    /* Field dimensions                 */
+  hsize_t     *stride = (hsize_t *)NULL; /* Pointer to stride array (C order)*/
+  hsize_t     *edge   = (hsize_t *)NULL; /* Pointer to edge array (C order)  */
+ 
+  char        *errbuf = (char *)NULL; /* error message buffer                */
+  char        **strdatabuf = NULL;    /* string data buffer                  */
+  int         stlen = 0;              /* whole string array length           */
+  int         nelem = 0;              /* number of elements in array of str  */
+  int         strsize = 0;            /* each str length in array of str     */
+  int         attr = 0;               /* attribute value                     */
+  int         j = 0;                  /* Loop index                          */
+
+  int         num_elem_passed_out;
+  int         numread;
+
+ 
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  zaID = (hid_t)ZaID;
+ 
+  /* Initialize dims[] array */
+  /* ----------------------- */
+  for ( i = 0; i < HE5_DTSETRANKMAX; i++)
+    dims[ i ] = 0;
+ 
+  /* Get field info */
+  /* -------------- */
+  status = HE5_ZAinfo(zaID, fieldname, &rank, dims, ntype, NULL,NULL);
+  if (status != FAIL)
+    {
+      start =  (hssize_t *)calloc(rank, sizeof(hssize_t));
+      if(start == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for start.\n");
+	  H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  return(FAIL);
+        }
+      stride = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(stride == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for stride.\n");
+	  H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(errbuf);
+	  return(FAIL);
+        }
+      edge = (hsize_t *)calloc(rank, sizeof(hsize_t));
+      if(edge == NULL)
+        {
+	  sprintf(errbuf,"Cannot allocate memory for edge.\n");
+	  H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(errbuf);
+	  return(FAIL);
+        }
+ 
+      /* Reverse order of dimensions (FORTRAN -> C) */
+      /* ------------------------------------------ */
+      for (i = 0; i < rank; i++)
+        {
+	  start[i]  = (hssize_t)fortstart[rank - 1 - i];
+	  stride[i] = (hsize_t)fortstride[rank - 1 - i];
+	  edge[i]   = (hsize_t)fortedge[rank - 1 - i];
+        }
+ 
+
+      status = HE5_ZAreadlocattr(zaID, fieldname, "StringLengthAttribute", &attr);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot read attribute from the field \"%s\".",fieldname) ;
+	  H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      if(elemlen < attr )
+	{
+	  sprintf(errbuf, "Element length passed in is not correct. Should be same as in declration");
+	  H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  return(FAIL);
+	}
+
+      strsize = attr;
+      stlen = dims[0] * strsize;
+      nelem = stlen / strsize;
+      strdatabuf = (char **)malloc(nelem*sizeof(char *));
+      for (i = 0; i<nelem; i++)
+	{
+	  strdatabuf[i] = NULL;
+	  strdatabuf[i] = (char *)malloc((strsize+1)*sizeof(char));
+	}
+ 
+      /* Read data from the field */
+      /* ------------------------ */
+      status = HE5_ZAwrrdfield(zaID, fieldname, "r", start, stride, edge, strdatabuf);
+      if (status == FAIL)
+	{
+	  sprintf(errbuf, "Cannot read data from the \"%s\" field.",fieldname) ;
+	  H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }
+	  return(FAIL);
+	}
+      if(numelem == 0)
+	{
+	  sprintf(errbuf, "Number of elements passed in cannot be zero.") ;
+	  H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }
+	  return(FAIL);
+	}
+ 
+      if(edge != NULL)
+	{
+	  numread = edge[0];
+	}
+      else
+	{
+	  numread = (dims[0] - start[0])/stride[0];
+	}
+ 
+      if(numread <= 0)
+	{
+	  sprintf(errbuf, "Number of elements passed in cannot be zero.") ;
+	  H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_DATASET, H5E_READERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(start);
+	  free(stride);
+	  free(edge);
+	  free(errbuf);
+	  if (strdatabuf != NULL)
+	    {
+	      for (i = 0; i<nelem; i++)
+		{
+		  if (strdatabuf[i] != NULL)
+		    {
+		      free (strdatabuf[i]);
+		      strdatabuf[i] = NULL;
+		    }
+		}
+	      free (strdatabuf);
+	      strdatabuf = NULL;
+	    }
+	  return(FAIL);
+	}
+      if(numread <=  numelem)
+	{
+	  num_elem_passed_out = numread;
+	}
+      else
+	{
+	  num_elem_passed_out = numelem;
+	}
+ 
+      stlen = strlen(strdatabuf[0]);
+      strcpy((char *)buffer,strdatabuf[0]);
+      for (j = stlen; j < elemlen; j++)
+	{
+	  strcat((char *)buffer," ");
+	}
+      for (i = 1; i < num_elem_passed_out; i++)
+	{
+	  strcat((char *)buffer,strdatabuf[i]);
+	  stlen = strlen(strdatabuf[i]);
+	  for (j = stlen; j < elemlen; j++)
+	    {
+	      strcat(buffer," ");
+	    }
+	}
+ 
+      free(start);
+      free(stride);
+      free(edge);
+      free(errbuf);
+      if (strdatabuf != NULL)
+	{
+	  for (i = 0; i<nelem; i++)
+	    {
+	      if (strdatabuf[i] != NULL)
+		{
+		  free (strdatabuf[i]);
+		  strdatabuf[i] = NULL;
+		}
+	    }
+	  free (strdatabuf);
+	  strdatabuf = NULL;
+	}       
+ 
+    }
+  else
+    {
+      sprintf(errbuf, "Fieldname \"%s\" does not exist.",fieldname) ;
+      H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      status = FAIL;
+    }
+ 
+ 
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZArdattr  (FORTRAN wrapper)                                  |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from a za.                                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_ZArdattr(int ZaID, char *attrname, void *datbuf)
+{
+  int         ret     = FAIL;/* routine return status variable    */
+
+  herr_t      status  = FAIL;/* routine return status variable    */
+
+  hid_t       zaID    = FAIL;/* HDF-EOS za ID                     */
+
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  zaID = (hid_t)ZaID;
+
+  /* Read the attribute buffer */
+  /* ------------------------- */
+  status = HE5_ZAreadattr(zaID, attrname, datbuf);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot read the attribute value. \n");
+      H5Epush(__FILE__, "HE5_ZArdattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  ret = (int)status;
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZArdgattr     (FORTRAN wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Reads attribute from the "Data Fields" group in a za.         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_ZArdgattr(int ZaID, char *attrname, void *datbuf)
+{
+  int         ret             = FAIL;   /* (int) return status      */
+
+  herr_t      status          = FAIL;   /* return status variable   */
+  
+  hid_t       zaID            = FAIL;   /* HDF5 type za ID          */
+  
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];  /* Error message buffer */
+  
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAreadgrpattr(zaID,attrname,datbuf);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot read Attribute \"%s\" from the \"Data Fields\" group.\n", attrname);
+      H5Epush(__FILE__, "HE5_ZArdgattr", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAwrlattr                                                    |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper to write/update local attribute in a za.      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fieldname      char*               field with local attribute              |
+|  attrname       char*               local attribute name                    |
+|  numtype        int                 local attribute HDF numbertype          |
+|  fortcount[]    long                number of group attribute elements      |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|  Mar 04    S.Zhao       Modified for a character string attribute.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAwrlattr(int ZaID, char *fieldname, char *attrname, int numtype, long fortcount[], void *datbuf)
+{
+  int	       ret  = FAIL; /* routine return status variable               */
+  int 	       rank = 1;    /* Note: It is assumed that fortcout has just   */
+			      /* one element to agree with EHattr function  */
+  int	       i = 0;
+
+  herr_t       status = FAIL;           /* routine return status variable   */
+   
+  hsize_t      *count = (hsize_t *)NULL;/* Pointer to count array (C order) */
+ 
+  hid_t        zaID   = FAIL;           /* za HDF5 type ID                  */ 
+  hid_t        numbertype = FAIL;           /* HDF5 dta type ID             */
+  
+  char        *errbuf = (char *)NULL;   /* error message buffer             */
+  char        *tempbuf = (char *)NULL;  /* temp buffer                      */
+
+
+  /* Get HDF5 type data type ID */
+  /* -------------------------- */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 data type ID.\n");
+      H5Epush(__FILE__, "HE5_ZAwrlattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate memory for error message buffers */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAwrlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  count = (hsize_t *)calloc(rank, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_ZAwrlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < rank; i++)
+    {
+      count[i] = (hsize_t)fortcount[rank - 1 - i];
+    }
+  
+  zaID = (hid_t)ZaID;
+
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of local attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_ZAwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n");
+	  H5Epush(__FILE__, "HE5_ZAwrlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+ 
+      /* Write local attribute buffer */
+      /* ---------------------------- */
+      status = HE5_ZAwritelocattr(zaID, fieldname, attrname, numbertype, count, tempbuf);
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write local attribute value.\n");
+          H5Epush(__FILE__, "HE5_ZAwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(count);
+          free(errbuf);
+          free(tempbuf);
+          return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    {
+      /* Write local attribute buffer */
+      /* ---------------------------- */
+      status = HE5_ZAwritelocattr(zaID, fieldname, attrname, numbertype, count, datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write local attribute value.\n");
+	  H5Epush(__FILE__, "HE5_ZAwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+          return(FAIL);
+	} 
+      free(count);
+      free(errbuf);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZArdlattr    (FORTRAN  wrapper)                              |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with a specified field in a za.    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fieldname      char                fieldname                               |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_ZArdlattr(int ZaID, char *fieldname, char *attrname, void *datbuf)
+{
+  int         ret             =  FAIL;/* return status variable   */
+
+  herr_t      status          =  FAIL;/* return status variable   */
+
+  hid_t       zaID            =  FAIL;/* HDF5 type za  ID         */
+  
+  char        errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAreadlocattr(zaID,fieldname, attrname, datbuf);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" field.\n", attrname,fieldname);
+      H5Epush(__FILE__, "HE5_ZArdlattr", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  ret  = (int)status;
+  return(ret);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqdimsF                                                   |
+|                                                                             |
+|  DESCRIPTION: Returns dimension names and values defined in ZA structure    |
+|               (FORTRAN Wrapper)                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nDim           long                Number of defined dimensions            |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dimlist        char*               Dimension names (comma-separated)       |
+|  dims           long                Dimension values                        |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_ZAinqdimsF(int ZaID, char *dimlist, long dims[])
+{
+  int		i          = 0;   /* Loop index                    */
+  
+  hid_t         zaID       = FAIL;/* HDF5 type za ID               */ 
+ 
+  long		nDim       = FAIL;/* (return) number of dimensions */
+  long		strbufsize = 0;   /* String size variable          */
+  
+  hsize_t	*tdims     = (hsize_t *)NULL;/* Dimension variable */
+
+  char      errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+
+  zaID = (hid_t)ZaID;  
+  
+  nDim = HE5_ZAnentries(zaID, 0, &strbufsize);
+  if(nDim == FAIL)
+    {
+      sprintf(errbuf,"Error calling ZAnentries() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_ZAinqdimsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  tdims = (hsize_t *)calloc(nDim, sizeof(hsize_t));
+  if(tdims == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tdims.\n");
+      H5Epush(__FILE__, "HE5_ZAinqdimsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+
+  nDim = HE5_ZAinqdims(zaID, dimlist, tdims);
+  if(nDim == FAIL)
+    {
+      sprintf(errbuf,"Error calling HE5_ZAinqdims() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_ZAinqdimsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(tdims);
+      return(FAIL);
+    }
+  
+  
+  /* Convert data type */
+  /* ----------------- */
+  for(i = 0; i < nDim; i++)
+    dims[i] = (long)tdims[i];
+  
+
+  free(tdims);
+  
+  return (nDim); 
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinquireF      (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Inquires about data fields in za                              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nflds          long                Number of data fields in za             |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fieldlist      char                Field names (comma-separated)           |
+|  rank           int                 Array of ranks                          |
+|  ntype          int                 data type class ID                      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_ZAinquireF(int ZaID, char *fieldlist, int rank[], int ntype[])
+{
+  long            nflds   = FAIL;               /* Number of Data fields  */
+  long            i;                            /* Looop index            */
+  
+  hid_t           zaID    = FAIL;               /* HDF5 type za ID        */
+
+  hid_t           *dtype  = (hid_t *)NULL;      /* Data type ID           */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];  /* Error message buffer   */
+
+
+  zaID = (hid_t)ZaID;
+
+  /* Call "HE5_ZAinquire" routine to get number of fields */
+  /* ---------------------------------------------------- */
+  nflds = HE5_ZAinquire(zaID, fieldlist, NULL, NULL);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n");
+      H5Epush(__FILE__, "HE5_ZAinquireF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  dtype = (hid_t *)calloc(nflds, sizeof(hid_t));
+  if (dtype == NULL)
+    {
+      sprintf(errbuf, "Cannot allocate memory. \n");
+      H5Epush(__FILE__, "HE5_ZAinquireF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+
+  nflds = HE5_ZAinquire(zaID, fieldlist, rank, dtype);
+  if (nflds == FAIL)
+    {
+      sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n");
+      H5Epush(__FILE__, "HE5_ZAinquireF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(dtype);
+      return(FAIL);
+    }
+
+  for (i = 0; i < nflds; i++)
+    ntype[i] = (int)dtype[i];
+
+
+  free(dtype);
+  return(nflds);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdiminfoF                                                   |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper for ZAdiminfo to retrieve size of specified   |
+|               dimension.                                                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  size           long    None        Size of dimension                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int     None        ZA structure ID                         |
+|  dimname        char*   None        Dimension name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_ZAdiminfoF(int ZaID, char *dimname)
+{
+  long        size    = 0;                 /* dimension size  (return) */
+
+  hid_t       zaID    = FAIL;              /* HDF5 data type ID        */  
+
+  hsize_t     tsize   = 0;                 /* size variable            */
+  
+  char        errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer     */
+
+  zaID = (hid_t)ZaID;
+
+  tsize = HE5_ZAdiminfo(zaID, dimname);
+  if (tsize == 0)
+    {
+      sprintf(errbuf, "Error calling ZAdiminfo() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_ZAdiminfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  size = (long)tsize;
+  
+  return(size);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinfoF                                                      |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper around ZAinfo                                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure id                         |
+|  fieldname      char                name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  rank           long                rank of field (# of dims)               |
+|  dims           long                field dimensions                        |
+|  ntype          int                 field number type                       |
+|  fortdimlist    char                field dimension list (FORTRAN order)    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAinfoF(int ZaID, char *fieldname, int *rank, long dims[], int *ntype, char *fortdimlist, char *fortmaxdimlist)
+{
+  int		   ret      = SUCCEED;    /* routine return status variable */
+  int		   j        = 0;          /* Loop Index                     */
+
+  herr_t	   status   = SUCCEED;    /* routine return status variable */
+
+  hid_t            zaID     = FAIL;       /* HDF5 type data type ID         */   
+  
+  hid_t            dtype[1] = {FAIL};     /* Data type ID                   */
+
+  hsize_t	   tempdims[HE5_DTSETRANKMAX];/* Dimension sizes array      */       
+  hsize_t 	   swap     = 0;              /* Temporary dimension size   */
+
+  char		   *errbuf  = (char *)NULL;   /* error message buffer       */
+ 
+  /* Dimension lists in C order */
+  /* -------------------------- */
+  char		   *dimlist    = (char *)NULL;
+  char		   *maxdimlist = (char *)NULL;
+
+  
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  maxdimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  dimlist    = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(dimlist == NULL || maxdimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input list.\n");
+      H5Epush(__FILE__, "HE5_ZAinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  zaID = (hid_t)ZaID;
+
+  /* Initialize tempdims[] array */
+  /* --------------------------- */
+  for ( j = 0; j < HE5_DTSETRANKMAX; j++)
+    tempdims[ j ] = 0;
+
+  /* Get field info */
+  /* -------------- */
+  status = HE5_ZAinfo(zaID, fieldname, rank, tempdims, dtype, dimlist, maxdimlist);
+  if (status == SUCCEED)
+    {
+      for (j = 0; j < *rank / 2; j++)
+        {
+	  swap = tempdims[*rank - 1 - j];
+	  tempdims[*rank - 1 - j] = tempdims[j];
+	  tempdims[j] = swap;
+        }
+      /* change the datatype */
+      /* ------------------- */
+      for (j = 0; j < *rank; j++)
+	dims[j] = (long)tempdims[j];
+
+      /* Reverse order of dimensions entries in dimension list */
+      /* ----------------------------------------------------- */
+      if(fortdimlist != (char *)NULL)
+	{
+	  status = HE5_EHrevflds(dimlist, fortdimlist);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot reverse entries in dimension list.\n");
+	      H5Epush(__FILE__, "HE5_ZAinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(dimlist);
+	      free(maxdimlist);
+	      return(FAIL);
+	    }
+	}
+      if(fortmaxdimlist != (char *)NULL)
+	{
+	  status = HE5_EHrevflds(maxdimlist, fortmaxdimlist);
+	  if(status == FAIL)
+	    {
+	      sprintf(errbuf,"Cannot reverse entries in maximum dimension list.\n");
+	      H5Epush(__FILE__, "HE5_ZAinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      free(errbuf);
+	      free(dimlist);
+	      free(maxdimlist);
+	      return(FAIL);
+	    }
+		  
+	}
+    }
+
+  *ntype = (int)dtype[0];
+
+  free(maxdimlist);
+  free(dimlist);
+  free(errbuf);
+
+  ret = (int)status;
+  return(ret); 
+}
+  
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAchunkinfoF                                                 |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper for ZAchunkinfo                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fieldname      char*               name of field                           |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ndims          int*                rank of a dataset                       |
+|  dims           long                the array containing sizes              |
+|                                     of each dimension of a chunk            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date         Programmer    Description                                    |
+|   =========    ============  ============================================   |
+|   Dec 03       S.Zhao        Original development                           |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAchunkinfoF(int ZaID, char *fieldname, int *ndims, long dims[])
+{
+  int           ret       = FAIL;           /* return status        */
+  int           j         = 0;              /* Loop index           */
+ 
+  herr_t        status    = FAIL;           /* return status        */
+ 
+  hid_t         zaID      = FAIL;           /* HDF5 type za ID      */
+ 
+  hsize_t       tempdims[HE5_DTSETRANKMAX]; /* Temporary dimension sizes array */
+  hsize_t       swap      = 0;              /* Temporary dimension size   */
+ 
+  char          *errbuf   = (char *)NULL;   /* error message buffer */
+ 
+  /* Allocate memory for error message buffer */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAchunkinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Initialize tempdims[] array */
+  /* --------------------------- */
+  for ( j = 0; j < HE5_DTSETRANKMAX; j++)
+    tempdims[ j ] = 0;
+ 
+  zaID = (hid_t)ZaID;
+ 
+  status = HE5_ZAchunkinfo(zaID, fieldname, ndims, tempdims);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling ZAchunkinfo() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_ZAchunkinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+ 
+  for (j = 0; j < *ndims / 2; j++)
+    {
+      swap = tempdims[*ndims - 1 - j];
+      tempdims[*ndims - 1 - j] = tempdims[j];
+      tempdims[j] = swap;
+    }
+ 
+  for (j = 0; j < *ndims; j++)
+    dims[j] = (long)tempdims[j];
+ 
+  free(errbuf);
+ 
+  ret = (int)status;
+  return(ret);
+ 
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAwrgattr                                                    |
+|                                                                             |
+|  DESCRIPTION: FORTRAN wrapper to write/update group attribute in a za.      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  attrname       char*               group attribute name                    |
+|  numtype        int                 group attribute HDF numbertype          |
+|  fortcount[]    long                number of group attribute elements      |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                   It is assumed that fortcout has just one element to agree |
+|                   with EHattr() call.                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|  Mar 04    S.Zhao       Modified for a character string attribute.          |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAwrgattr(int ZaID, char *attrname, int numtype, long fortcount[], void *datbuf)
+{
+  int          ret    = FAIL;       /* (int) return status variable      */
+  int	       rank   = 1;          /* Rank variable                     */
+  int	       i;                   /* Loop index                        */
+
+  herr_t       status     = FAIL;   /* routine return status variable    */
+  
+  hid_t        zaID       = FAIL;   /* HDF5 type za ID                   */
+  hid_t        numbertype = FAIL;   /* HDF5 data type ID                 */
+             
+  hsize_t      *count  = (hsize_t *)NULL;/* Pointer to count array (C order) */
+  
+  char         *errbuf = (char *)NULL;   /* error message buffer         */
+  char         *tempbuf = (char *)NULL;  /* temp buffer                  */
+  
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Get HDF5 data type ID */
+  /* --------------------- */
+  numbertype = HE5_EHconvdatatype(numtype);
+  if(numbertype == FAIL)
+    {
+      sprintf(errbuf,"Cannot convert to HDF5 type data type ID.\n");
+      H5Epush(__FILE__, "HE5_ZAwrgattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+
+  count = (hsize_t *)calloc(rank, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_ZAwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Reverse order of dimensions (FORTRAN -> C) */
+  /* ------------------------------------------ */
+  for (i = 0; i < rank; i++)
+    count[i] = (hsize_t)fortcount[rank - 1 - i];
+  
+  
+  zaID = (hid_t)ZaID;
+
+  if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1))
+    {
+      if (strlen(datbuf) < count[0])
+	{
+	  sprintf(errbuf,"Size of databuf is less than the number of group attribute elements.\n");
+	  H5Epush(__FILE__, "HE5_ZAwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      /* Allocate memory for temp buffer */
+      /* ------------------------------- */
+      tempbuf = (char * )calloc((count[0]+1), sizeof(char));
+      if(tempbuf == NULL)
+	{
+	  sprintf(errbuf,"Cannot allocate memory for temp buffer.\n");
+	  H5Epush(__FILE__, "HE5_ZAwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(count);
+	  free(errbuf);
+	  return(FAIL);
+	}
+ 
+      strncpy(tempbuf, datbuf, count[0]);
+      tempbuf[count[0]] = '\0';
+ 
+      status = HE5_ZAwritegrpattr(zaID, attrname, numbertype, count, tempbuf);
+      if(status == FAIL)
+	{
+          sprintf(errbuf,"Cannot write group attribute value.\n");
+          H5Epush(__FILE__, "HE5_ZAwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+          HE5_EHprint(errbuf, __FILE__, __LINE__);
+          free(errbuf);
+          free(count);
+          free(tempbuf);
+          return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+      free(tempbuf);
+    }
+  else
+    {
+      status = HE5_ZAwritegrpattr(zaID, attrname, numbertype, count, datbuf);
+      if(status == FAIL)
+	{
+	  sprintf(errbuf,"Cannot write group attribute value.\n");
+	  H5Epush(__FILE__, "HE5_ZAwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  free(errbuf);
+	  free(count);
+	  return(FAIL);
+	}
+      free(count);
+      free(errbuf);
+    }
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAatinfo                                                     |
+|                                                                             |
+|  DESCRIPTION:  FORTRAN wrapper for ZAattrinfo                               |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  numbertype     int                 attribute HDF numbertype                |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+|                                                                             |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAatinfo(int ZaID, char *attrname, int *numbertype, long *fortcount)
+{
+  int              ret      = FAIL;        /* (int) return status variable   */
+
+  herr_t	   status   = FAIL;	   /* return status variable         */
+
+  hid_t            *ntype   = (hid_t *)NULL;/* Data type ID                  */
+
+  hid_t            zaID     = FAIL;         /* HDF5 type za ID               */
+
+  hsize_t          *count   = (hsize_t *)NULL;/* Pointer to count (C order)  */
+  
+  char             *errbuf  = (char *)NULL;   /* error message buffer        */
+  
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  count = (hsize_t *) calloc(1, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_ZAatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  ntype = (hid_t *) calloc(1, sizeof(hid_t));
+  if(ntype == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for ntype.\n");
+      H5Epush(__FILE__, "HE5_ZAatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      return(FAIL);
+    }
+
+
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAattrinfo(zaID, attrname, ntype, count);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about attribute \"%s\".\n", attrname);
+      H5Epush(__FILE__, "HE5_ZAatinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      free(ntype);
+      return(FAIL);
+    }  
+
+  
+  *fortcount  = (long)(*count);
+  *numbertype = (int)(*ntype);
+
+  free(errbuf);
+  free(count);
+  free(ntype);
+
+  ret = (int)status;
+  return(ret);
+}
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAgatinfo                                                    |
+|                                                                             |
+|  DESCRIPTION:  FORTRAN wrapper for ZAgrpattrinfo                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  numbertype     int                 attribute HDF numbertype                |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+|                                                                             |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAgatinfo(int ZaID, char *attrname, int *numbertype, long *fortcount)
+{
+  int	   	  ret     = FAIL;	    /* (int) return status variable   */
+
+  herr_t   	  status  = FAIL;           /* routine return status variable */
+
+  hid_t       *ntype  = (hid_t *)NULL;  /* Data type ID                   */
+
+  hid_t       zaID    = FAIL;           /* HDF5 type za ID                */
+
+  hsize_t     *count  = (hsize_t *)NULL;/* Pointer to count  (C order)    */
+  
+  char        *errbuf = (char *)NULL;   /* error message buffer           */
+  
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_ZAgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+  if( ntype == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for ntype.\n");
+      H5Epush(__FILE__, "HE5_ZAgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      return(FAIL);
+    }
+
+
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAgrpattrinfo(zaID, attrname, ntype, count);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about group attribute.\n");
+      H5Epush(__FILE__, "HE5_ZAgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      free(ntype);
+      return(FAIL);
+    }
+  
+  *fortcount  = (long)(*count);
+  *numbertype = (int)(*ntype);
+
+  free(errbuf);
+  free(count);
+  free(ntype);
+  
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqgattrs (FORTRAN wrapper)                                |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list in "Data Fields" group                        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in "Data Fields"   |
+|                                       group.                                |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in "Data Fields" group  |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_ZAinqgattrs(int ZaID, char *attrnames, long *strbufsize)
+{
+  long            nattr   = FAIL;         /* Number of attributes (return)  */
+
+  hid_t           zaID    = FAIL;         /* HDF5 type za ID                */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+
+  zaID = (hid_t)ZaID;
+  
+  nattr = HE5_ZAinqgrpattrs(zaID, attrnames, strbufsize);
+  if ( nattr < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+      H5Epush(__FILE__, "HE5_ZAinqgattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  return(nattr);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqattrsF     (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about attributes defined in ZA          |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in za struct       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in za struct            |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long HE5_ZAinqattrsF(int ZaID, char *attrnames, long *strbufsize)
+{
+  long            nattr    = FAIL;  /* Number of attributes (return)  */
+
+  hid_t           zaID     = FAIL;  /* HDF5 type za ID                */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */
+
+
+  zaID = (hid_t)ZaID;
+
+  nattr = HE5_ZAinqattrs(zaID, attrnames, strbufsize);
+  if ( nattr < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+      H5Epush(__FILE__, "HE5_ZAinqattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+  
+  return(nattr);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAlatinfo                                                    |
+|                                                                             |
+|  DESCRIPTION:  FORTRAN wrapper for ZAlocattrinfo                            |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fieldname      char*               field name name                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrname       char*               attribute name                          |
+|  numbertype     int                 attribute HDF numbertype                |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+|                                                                             |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAlatinfo(int ZaID, char *fieldname, char *attrname, int *numbertype, long *fortcount)
+{
+  int	   	  ret     = FAIL;	        /* (int) return status variable   */
+
+  herr_t   	  status  = FAIL;           /* routine return status variable */
+
+  hid_t       *ntype  = (hid_t *)NULL;  /* Data type ID                */
+
+  hid_t       zaID    = FAIL;           /* HDF5 type za ID             */
+
+  hsize_t     *count  = (hsize_t *)NULL;/* Pointer to count  (C order)    */
+  
+  char        *errbuf = (char *)NULL;   /* error message buffer           */
+
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if( count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for count.\n");
+      H5Epush(__FILE__, "HE5_ZAlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  ntype = (hid_t *)calloc(1, sizeof(hid_t));
+  if( ntype == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for ntype.\n");
+      H5Epush(__FILE__, "HE5_ZAlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      return(FAIL);
+    }
+
+  zaID = (hid_t)ZaID;
+  
+  status = HE5_ZAlocattrinfo(zaID, fieldname, attrname, ntype, count);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about local attribute.\n");
+      H5Epush(__FILE__, "HE5_ZAlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(count);
+      free(ntype);
+      return(FAIL);
+    }
+  
+  *fortcount  = (long)(*count);
+  *numbertype = (int)(*ntype);
+  
+  free(errbuf);
+  free(count);
+  free(ntype);
+  
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqlattrs     (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list associated with a specified field in the      |
+|                "Data Fields" group.                                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                Number of attributes in "Data Fields"   |
+|                                       group.                                |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fieldname      char                field name                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  attrnames      char                Attribute names in "Data Fields" group  |
+|                                     (Comma-separated list)                  |
+|  strbufsize     long                Attributes name list string length      |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_ZAinqlattrs(int ZaID, char *fieldname, char *attrnames, long *strbufsize)
+{
+  long            nattr       = FAIL;     /* Number of attributes   */
+
+  hid_t           zaID        = FAIL;     /* HDF5 type za ID        */
+    
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer   */  
+
+  zaID = (hid_t)ZaID;
+
+  nattr = HE5_ZAinqlocattrs(zaID, fieldname, attrnames, strbufsize);
+  if ( nattr < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the attributes. \n");
+      H5Epush(__FILE__, "HE5_ZAinqlattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+  return (nattr);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAidtype                                                     |
+|                                                                             |
+|  DESCRIPTION: Inquires about data fields in za (FORTRAN Wrapper)            |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                  return status (0) SUCCEED, (-1) FAIL   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                  ZA structure ID                        |
+|  fieldname      char*                Field name                             |
+|  attrname       char*                Attribute name                         |
+|  fieldgroup     int                  Field group id                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  Type           int*                                                        |
+|  Class          int*                                                        |
+|  Order          int*                                                        |
+|  size           long*                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_ZAidtype(int ZaID, char *fieldname, char *attrname, int fieldgroup, int *Type, int *Class, int *Order, long *size)
+{
+  int		   ret      = FAIL;               /* (int) status variable  */
+
+  herr_t	   status   = FAIL;               /* return status variable */
+  
+  size_t	   *tsize   = (size_t *)NULL;     /* data size variable     */ 
+
+  hid_t        *typeID  = (hid_t *)NULL;      /* HDF5 Data type ID      */
+  hid_t        zaID     = FAIL;               /* HDF5 type za ID        */
+ 
+  H5T_class_t  *classID = (H5T_class_t *)NULL;/*  Data type class ID    */
+  H5T_order_t  *order   = (H5T_order_t *)NULL;/* Byte order of datatype */
+
+  char         *errbuf  = (char *)NULL;       /* error message buffer   */
+
+  
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  typeID = (hid_t *)calloc(1, sizeof(hid_t));
+  if(typeID == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for typeID.\n");
+      H5Epush(__FILE__, "HE5_ZAidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  tsize = (size_t *)calloc(1, sizeof(size_t));
+  if(tsize == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tsize.\n");
+      H5Epush(__FILE__, "HE5_ZAidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      return(FAIL);
+    }
+
+  classID = (H5T_class_t *)calloc(1, sizeof(H5T_class_t));
+  if(classID == (H5T_class_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for classID.\n");
+      H5Epush(__FILE__, "HE5_ZAidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      free(tsize);
+      return(FAIL);
+    }
+
+  order = (H5T_order_t *)calloc(1, sizeof(H5T_order_t));
+  if(order == (H5T_order_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for order.\n");
+      H5Epush(__FILE__, "HE5_ZAidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      free(tsize);
+      free(classID);
+      return(FAIL);
+    }
+
+
+  zaID = (hid_t)ZaID;
+
+  /* Get data type information */
+  /* ------------------------- */
+  status = HE5_ZAinqdatatype(zaID, fieldname, attrname, fieldgroup, typeID, classID, order, tsize);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot get information about data type.\n");
+      H5Epush(__FILE__, "HE5_ZAidtype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(typeID);
+      free(tsize);
+      free(classID);
+      free(order);
+      return(FAIL);
+    }
+  
+
+  *Type   = (int)(*typeID);
+  *Class  = (int)(*classID);
+  *Order  = (int)(*order);
+  *size   = (long)(*tsize);
+  
+
+  free(errbuf);
+  free(typeID);
+  free(classID);
+  free(order);
+  free(tsize);
+
+
+  ret = (int)status;
+  return(ret);
+}
+
+
+      
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqzaF   (FORTRAN wrapper)                                 |
+|                                                                             |
+|  DESCRIPTION: Returns number and names of za structures in file             |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nza            long                Number of ZA structures in file         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  filename       char                HDF-EOS filename                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  zalist         char                List of za names (comma-separated)      |
+|  strbufsize     long                Length of zalist                        |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_ZAinqzaF(char *filename, char *zalist, long *strbufsize)
+{
+  long       nza     = FAIL;/* Number of za structures in file */
+
+  char       errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer     */  
+
+  nza = HE5_ZAinqza(filename, zalist, strbufsize);
+  if ( nza < 0 )
+    {
+      sprintf(errbuf,"Cannot get information about za.");
+      H5Epush(__FILE__, "HE5_ZAinqzaF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }								 
+
+  return(nza);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAnentriesF    (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION: Returns number of entries and string buffer size              |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nEntries       long                Number of entries                       |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  entrycode      int                 Entry code                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                Length of comma-separated list          |
+|                                     (Does not include null-terminator       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_ZAnentriesF(int ZaID, int entrycode, long *strbufsize)
+{
+  long            nEntries   = FAIL;       /* Number of entries         */
+
+  hid_t           zaID       = FAIL;       /* HDF5 type za ID           */
+
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  
+
+  zaID = (hid_t)ZaID;
+
+  nEntries = HE5_ZAnentries(zaID, entrycode, strbufsize);
+  if (nEntries < 0)
+    {
+      sprintf(errbuf,"Failed to get number of entries in a za.");       
+      H5Epush(__FILE__, "HE5_ZAnentriesF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return(nEntries);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAsetaliasF    (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION:  Defines alias for a specified field name                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|   ZaID          int                      ZA structure ID                    |
+|   fieldname     char                     Original field name                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|   fortaliaslist char                     Comma separated list of aliases for|
+|                                            the field name                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_ZAsetaliasF(int ZaID, char *fieldname, char *fortaliaslist)
+{
+  int      ret        = FAIL;/* (int)Return status variable */
+
+  herr_t   status     = FAIL;/* return status variable      */
+
+  hid_t    zaID       = FAIL;/* HDF5 type za ID             */
+
+  char     *aliaslist = NULL;/* C-order list of aliases     */
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  zaID = (hid_t)ZaID;
+
+  /* Allocate space for C order alias list */
+  /* ------------------------------------- */
+  aliaslist = (char *)calloc(strlen(fortaliaslist) + 1, sizeof(char));
+  if(aliaslist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for aliaslist.\n");
+      H5Epush(__FILE__, "HE5_ZAsetaliasF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+  
+  /* Reverse entries in alias list (FORTRAN -> C) */
+  /* -------------------------------------------- */
+  status = HE5_EHrevflds(fortaliaslist, aliaslist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in alias list.\n");
+      H5Epush(__FILE__, "HE5_ZAsetaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(aliaslist);
+      return(FAIL);
+    }
+
+
+
+  /* Call ZAsetalias() */
+  /* ----------------- */
+  status = HE5_ZAsetalias(zaID, fieldname, aliaslist);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Error calling ZAsetalias() from FORTRAN wrapper. \n");
+      H5Epush(__FILE__, "HE5_ZAsetaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(aliaslist);
+      return(FAIL);
+    }
+
+  free(aliaslist);
+
+  ret = (int)status;
+  return(ret);
+}
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdropaliasF    (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:  Removes the alias for a specified field name                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    ZaID         int                      ZA structure ID                    |
+|    aliasname    char                     Alias name to remove               |
+|    fldgroup     int                      Field group flag                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_ZAdropaliasF(int ZaID, int fldgroup, char *aliasname)
+{  
+  int      ret        = FAIL;/* (int)Return status variable */
+
+  herr_t   status     = FAIL;/* return status variable      */
+
+  hid_t    zaID       = FAIL;/* HDF5 type za ID             */
+
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  zaID = (hid_t)ZaID;
+  
+  status = HE5_ZAdropalias(zaID, fldgroup, aliasname);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling ZAdropalias() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_ZAdropaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  ret = (int)status;
+
+  return(ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqfldaliasF (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of fields & aliases and string length of|
+|                fields & aliases list in "Data Fields" group                 |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfldalias      long                Number of fields & aliases in "Data     |
+|                                     Fields"  group.                         |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 za structure ID                         |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  fldalias       char*               Fields & aliases names in "Data Fields" |
+|                                     group (Comma-separated list)            |
+|  strbufsize     long*               Fields & aliases name list string length|
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Mar 03    S.Zhao       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_ZAinqfldaliasF(int ZaID, char *fldalias, long *strbufsize)
+{
+  long            nfldalias   = FAIL;     /* Number of fields & aliases (return)  */
+ 
+  hid_t           zaID = FAIL;            /* HDF5 type za ID                */
+ 
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+ 
+  zaID = (hid_t)ZaID;
+ 
+  nfldalias = HE5_ZAinqfldalias(zaID, fldalias, strbufsize);
+  if ( nfldalias < 0 )
+    {
+      sprintf(errbuf, "Cannot retrieve the fields & aliases. \n");
+      H5Epush(__FILE__, "HE5_ZAinqfldaliasF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+ 
+  return(nfldalias);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAaliasinfoF    (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:  Retrieves information about field aliases                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    ZaID         int                      ZA structure ID                    |
+|    aliasname    char                     alias name                         |
+|    fldgroup     int                      Field group flag                   |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    length       int                      Buffer size                        |
+|    buffer       char                     Buffer with original field name    |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_ZAaliasinfoF(int ZaID, int fldgroup, char *aliasname, int *length, char *buffer)
+{
+  int           ret        = FAIL;/* (int) return status variable          */
+      
+  herr_t        status     = FAIL;/* return status variable                */
+
+  hid_t         zaID       = FAIL;/* HDF5 type za ID                       */
+
+  char          errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer        */
+
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAaliasinfo(zaID, fldgroup, aliasname, length, buffer);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling ZAaliasinfo() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_ZAaliasinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  ret = (int)status;
+
+  return(ret);  
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAfldrenameF   (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION:  Changes the field name                                       |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type        Units       Description                        |
+|  ============   ===========  =========   =================================  |
+|  ret            int                      Return status                      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|    ZaID         int                      ZA structure ID                    |
+|    oldfieldname char                     Original field name                |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|    newfieldname char                     New field name                     |
+|                                                                             |
+|  NOTES:                                                                     |
+|    None                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  =======  ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_ZAfldrenameF(int ZaID, char *oldfieldname, char *newfieldname)
+{
+  int      ret        = FAIL;/* (int)Return status variable */
+
+  herr_t   status     = FAIL;/* return status variable      */
+
+  hid_t    zaID       = FAIL;/* HDF5 type za ID             */
+
+  char     errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer  */
+
+  zaID = (hid_t)ZaID;
+  
+  status = HE5_ZAfldrename(zaID, oldfieldname, newfieldname);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Error calling ZAfldrename() from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_ZAfldrenameF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  ret = (int)status;
+
+  return(ret);  
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdefcomchunkF    (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION: Defines compression type and parameters and sets chunking     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int     None        return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  compcode       int                 compression code                        |
+|  compparm       int                 compression parameters                  |
+|  rank           int                 rank of a dataset                       |
+|  *dim           long                pointer to the array containing sizes   |
+|                                     of each dimension of a chunk            |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int   
+HE5_ZAdefcomchunkF(int ZaID, int compcode, int *compparm, int rank, long *dim)
+{
+  int		ret       = FAIL;           /* return status        */
+  int		j         = 0;              /* Loop index           */
+
+  herr_t	status    = FAIL;           /* return status        */
+
+  hsize_t	*tempdims = (hsize_t *)NULL;/* Temporary variable   */
+
+  hid_t         zaID      = FAIL;           /* HDF5 type za ID      */
+  
+  char		*errbuf   = (char *)NULL;   /* error message buffer */
+    
+  /* Allocate memory for error message buffer */
+  /* ---------------------------------------- */
+  errbuf  = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAdefcomchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  tempdims = (hsize_t *)calloc(rank, sizeof(hsize_t));
+  if(tempdims == (hsize_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for tempdims.\n");
+      H5Epush(__FILE__, "HE5_ZAdefcomchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+  
+  /* Change from FORTRAN to C dimension order */
+  /* ---------------------------------------- */
+  for (j = 0; j < rank; j++)
+    tempdims[j] = (hsize_t)dim[ rank - 1 - j ];
+
+  zaID = (hid_t)ZaID;
+
+  /* Call HE5_ZAdefcomchunk() */
+  /* ------------------------ */
+  status = HE5_ZAdefcomchunk(zaID, compcode, compparm, rank, tempdims);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_ZAdefcomchunk from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_ZAdefcomchunkF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(tempdims);
+      return(FAIL);
+    }
+
+  free(tempdims);
+  free(errbuf);
+    
+  ret = (int)status;
+  return(ret);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAsetextdataF      (FORTRAN wrapper)                         |
+|                                                                             |
+|  DESCRIPTION: Sets external data files.                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  ret            int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fortfilelist   char*               list of external files (FORTRAN order)  |
+|  offset         long                array of offsets (in bytes) from the    |
+|                                     beginning of the file to the location   |
+|                                     in the file where the data starts       |
+|  size           long                array of sizes (in bytes) reserved in   |
+|                                     the file for the data.                  |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAsetextdataF(int ZaID, char *fortfilelist, long offset[], long size[])
+{
+  int             ret          = FAIL;           /* return status variable */
+ 
+  herr_t          status       = FAIL;           /* Return status variable */
+  hid_t           zaID         = FAIL;           /* ZA HDF5 type ID        */
+ 
+  off_t           *off         = (off_t *)NULL;  /* Array of data offsets  */
+ 
+  long            nentries     = 0;              /* Number of list entries */
+  long            i;                             /* Loop index             */
+ 
+  hsize_t         *sz          = (hsize_t *)NULL;/* Array of data sizes    */
+ 
+  char            *filelist    = (char *)NULL;   /* Files list (C order)   */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];   /* Error message buffer   */
+ 
+  /* Allocate space for C order file list */
+  /* ------------------------------------ */
+  filelist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(filelist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input list.\n");
+      H5Epush(__FILE__, "HE5_ZAsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Reverse entries in input list */
+  /* ----------------------------- */
+  status = HE5_EHrevflds(fortfilelist, filelist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in file list.\n");
+      H5Epush(__FILE__, "HE5_ZAsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      return(FAIL);
+    }
+ 
+ 
+  /* Parse the list of entries to get number of files */
+  /* ------------------------------------------------ */
+  nentries = HE5_EHparsestr(filelist, ',', NULL, NULL);
+  if(nentries <= 0)
+    {
+      sprintf(errbuf,"Cannot parse the input list/input list is empty.\n");
+      H5Epush(__FILE__, "HE5_ZAsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      return(FAIL);
+    }
+ 
+ 
+  /* Allocate space for offset array */
+  /* ------------------------------- */
+  off = (off_t *)calloc(nentries, sizeof(off_t));
+  if(off == (off_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input offset array.\n");
+      H5Epush(__FILE__, "HE5_ZAsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      return(FAIL);
+    }
+ 
+  /* Allocate space for size array */
+  /* ----------------------------- */
+  sz = (hsize_t *)calloc(nentries, sizeof(hsize_t));
+  if(sz == (hsize_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input size array.\n");
+      H5Epush(__FILE__, "HE5_ZAsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      free(off);
+      return(FAIL);
+    }
+ 
+  /* Copy the elements of input arrays */
+  /* --------------------------------- */
+  for (i = 0; i < nentries; i++)
+    {
+      off[ nentries - 1 - i ] = (off_t)offset[ i ];
+      sz[  nentries - 1 - i ]  = (hsize_t)size[ i ];
+    }
+ 
+ 
+  zaID = (hid_t)ZaID;
+ 
+  /* Call the C function */
+  /* ------------------- */
+  status = HE5_ZAsetextdata(zaID, filelist, off, sz);
+  if (status == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_ZAsetextdata from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_ZAsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      free(off);
+      free(sz);
+      return(FAIL);
+    }
+ 
+  if (filelist != NULL) free(filelist);
+  if (off != NULL) free(off);
+  if (sz != NULL) free(sz);
+ 
+  ret = (int)status;
+  return(ret);
+}
+ 
+ 
+ 
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAgetextdataF       (FORTRAN wrapper)                        |
+|                                                                             |
+|  DESCRIPTION: Gets external data files information.                         |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nfiles         int                 number of external files  SUCCEED,      |
+|                                               (-1) FAIL                     |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fieldname      char*               External field name                     |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  namelength     long                Length of each name entry               |
+|  fortfilelist   char*               List of file names (FORTRAN order)      |
+|  offset         long                array of offsets (in bytes) from the    |
+|                                     beginning of the file to the location   |
+|                                     in the file where the data starts       |
+|  size           long                array of sizes (in bytes) reserved in   |
+|                                     the file for the data.                  |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Aug 02    S.ZHAO       Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAgetextdataF(int ZaID, char *fieldname, long namelength, char *fortfilelist, long offset[], long size[])
+{
+  int             nfiles       = FAIL;           /* number of files (return) */
+  int             i;                             /* Loop index               */
+ 
+  herr_t          status       = FAIL;           /* Return status variable   */
+  hid_t           zaID         = FAIL;           /* ZA HDF5 type ID          */
+ 
+  off_t           *off         = (off_t *)NULL;  /* Array of data offsets    */
+ 
+  hsize_t         *sz          = (hsize_t *)NULL;/* Array of sizes           */
+ 
+  size_t          nmlen        = 0;              /* Each entry string length */
+ 
+  char            *filelist    = (char *)NULL;   /* Files list (C order)     */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];   /* Error message buffer     */
+ 
+  /* Allocate space for C order output file list */
+  /* ------------------------------------------- */
+  filelist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char));
+  if(filelist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for output list.\n");
+      H5Epush(__FILE__, "HE5_ZAgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+ 
+  /* Allocate space for offset array */
+  /* ------------------------------- */
+  off = (off_t *)calloc(HE5_FLDNUMBERMAX , sizeof(off_t));
+  if(off == (off_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input offset array.\n");
+      H5Epush(__FILE__, "HE5_ZAgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      return(FAIL);
+    }
+ 
+  /* Allocate space for size array */
+  /* ----------------------------- */
+  sz = (hsize_t *)calloc(HE5_FLDNUMBERMAX, sizeof(hsize_t));
+  if(sz == (hsize_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for input size array.\n");
+      H5Epush(__FILE__, "HE5_ZAgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      free(off);
+      return(FAIL);
+    }
+ 
+  zaID = (hid_t)ZaID;
+ 
+  nmlen = (size_t)namelength;
+ 
+  /* Call the C function */
+  /* ------------------- */
+  nfiles = HE5_ZAgetextdata(zaID, fieldname, nmlen, filelist, off, sz);
+  if (nfiles == FAIL)
+    {
+      sprintf(errbuf, "Error calling HE5_ZAgetextdata from FORTRAN wrapper.\n");
+      H5Epush(__FILE__, "HE5_ZAgetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      free(off);
+      free(sz);
+      return(FAIL);
+    }
+ 
+  /* Reverse entries in output list */
+  /* ----------------------------- */
+  status = HE5_EHrevflds(filelist, fortfilelist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in output file list.\n");
+      H5Epush(__FILE__, "HE5_ZAgetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(filelist);
+      free(off);
+      free(sz);
+      return(FAIL);
+    }
+ 
+  /* Populate the output arrays */
+  /* -------------------------- */
+  for (i = 0; i < nfiles; i++)
+    {
+      offset[ nfiles - 1 - i ] = (long)off[ i ];
+      size[ nfiles - 1 - i ]   = (long)sz[ i ];
+    }
+ 
+  if (filelist != NULL) free(filelist);
+  if (off != NULL) free(off);
+  if (sz != NULL) free(sz);
+ 
+ 
+  return(nfiles);
+}
+ 
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAwrdmeta                                                    |
+|                                                                             |
+|  DESCRIPTION: Defines structural metadata for pre-existing data             |
+|               field within ZA structure (FORTRAN)                           |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 ZA structure ID                         |
+|  fieldname      char                fieldname                               |
+|  fortdimlist    char                Dimension list (comma-separated list)   |
+|                                         FORTRAN dimesion order              |
+|  mvalue         int                 field type                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 05    S. Zhao      Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAwrdmeta(int ZaID, char *fieldname, char *fortdimlist, int mvalue)
+{
+  int       ret        = FAIL;   /* (int) return status variable   */
+  herr_t    status     = FAIL;   /* routine return status variable */
+
+  hid_t     zaID       = FAIL;   /* HDF5 type za ID                */
+  hid_t     numbertype = FAIL;   /* HDF5 type data type ID         */
+
+  char      *dimlist = (char *)NULL;   /* Dimension list (C order) */
+  char      *errbuf  = (char *)NULL;   /* error message buffer     */
+
+  zaID = (hid_t)ZaID;
+
+  numbertype = HE5_EHconvdatatype(mvalue);
+  if(numbertype == FAIL)
+    {
+      H5Epush(__FILE__, "HE5_ZAwrdmeta", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Cannot convert datatype for FORTRAN wrapper.");
+      HE5_EHprint("Error: Cannot convert datatype for FORTRAN wrapper, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate memory for error message buffers */
+  /* ----------------------------------------- */
+  errbuf  = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_ZAwrdmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  /* Allocate space for C order dimension list */
+  /* ----------------------------------------- */
+  dimlist = (char *) calloc(strlen(fortdimlist) + 1, sizeof(char));
+  if(dimlist == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for dimlist.\n");
+      H5Epush(__FILE__, "HE5_ZAwrdmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(FAIL);
+    }
+
+  /* Reverse entries in dimension list (FORTRAN -> C) */
+  /* ------------------------------------------------ */
+  status = HE5_EHrevflds(fortdimlist, dimlist);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot reverse entries in dimension list.\n");
+      H5Epush(__FILE__, "HE5_ZAwrdmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      return(FAIL);
+    }
+
+  /* Call Write Metadata routine */
+  /* --------------------------- */
+  status = HE5_ZAwritedatameta(zaID, fieldname, dimlist, numbertype);
+  if(status == FAIL)
+    {
+      sprintf(errbuf,"Cannot write \"%s\" field metadata.\n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAwrdmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      free(dimlist);
+      return(FAIL);
+    }
+
+  free(dimlist);
+  free(errbuf);
+
+  ret = (int)status;
+  return (ret);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAgetaliaslistF (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of aliases and aliases list in "Data    |
+|                Fields" group                                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nalias         long                number of aliases in "Data Fields"      |
+|                                     group                                   |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  ZaID           int                 za structure ID                         |
+|  fldgroup       int                 field group flag                        |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  aliaslist      char*               list of aliases  in "Data Fields" group |
+|                                     (comma-separated list)                  |
+|  strbufsize     long*               length of aliases list                  |
+|                                                                             |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jul 05    S.Zhao       Original development                                |
+|  Dec 05    T.Roegner    NCR 44092 - Added CYGWIN capability                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_ZAgetaliaslistF(int ZaID, int fldgroup, char *aliaslist, long *strbufsize)
+{
+  long            nalias  = FAIL;         /* Number of aliases (return)     */
+  hid_t           zaID    = FAIL;         /* HDF5 type za ID                */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+
+
+  zaID = (hid_t)ZaID;
+
+  nalias = HE5_ZAgetaliaslist(zaID, fldgroup, aliaslist, strbufsize);
+  if (nalias < 0)
+    {
+      sprintf(errbuf, "Cannot retrieve the aliases. \n");
+      H5Epush(__FILE__, "HE5_ZAgetaliaslistF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return(nalias);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAsetdimscaleF (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION: Defines a dimension scale for a fields dimension in a ZA      |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           int                 ZA structure ID                         |
+|  fieldname      char                field name                              |
+|  dimname        char                dim name                                |
+|  dim            long                Dimemsion value                         |
+|  numbertype_in  int                 dim scale data type such as DFNT_INT32, |
+|                                     DFNT_FLOAT64, DFNT_FLOAT32, etc.        |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                None                                                         |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAsetdimscaleF(int ZaID, char *fieldname, char *dimname,
+		  long dim, int numbertype_in, void * data)
+{
+  herr_t          status;
+  hid_t           zaID;
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+
+
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAsetdimscale(zaID, fieldname, dimname,
+			     (hsize_t) dim, (hid_t) numbertype_in, data);
+
+  if (status < 0)
+    {
+      sprintf(errbuf, "Cannot set dimension scale %s for field %s. \n", dimname, fieldname);
+      H5Epush(__FILE__, "HE5_ZAsetdimscaleF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return((int)status);
+
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdefdimscaleF (FORTRAN wrapper)                             |
+|                                                                             |
+|  DESCRIPTION: Defines dimension scale for a dimension for all fields in a ZA|
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           int                 ZA structure ID                         |
+|  dimname        char                dim name                                |
+|  dim            long                Dimemsion value                         |
+|  numbertype_in  int                 dim scale data type such as DFNT_INT32, |
+|                                     DFNT_FLOAT64, DFNT_FLOAT32, etc.        |
+|  data           void                data buffer for write                   |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|                None                                                         |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jan 14    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAdefdimscaleF(int ZaID, char *dimname,
+		  long dim, int numbertype_in, void * data)
+{
+  herr_t          status;
+  hid_t           zaID;
+  char            errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer       */
+
+
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAdefdimscale(zaID, dimname,
+			     (hsize_t) dim, (hid_t) numbertype_in, data);
+
+  if (status < 0)
+    {
+      sprintf(errbuf, "Cannot set dimension scale %s for all fields in ZA. \n", dimname);
+      H5Epush(__FILE__, "HE5_ZAdefdimscaleF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return((int)status);
+
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAgetdimscaleF  (FORTRAN wrapper)                            |
+|                                                                             |
+|  DESCRIPTION: Get dimension scale for a dimension of a field in a ZA        |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return databuffsize  SUCCEED, (-1) FAIL |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           int                 ZA structure ID                         |
+|  fieldname      char                field name                              |
+|  dimname        char                dim name                                |
+|                                                                             |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  dimsize        long                dimension size                          |
+|  ntype          int                 number type                             |
+|  databuff       void                data buffer for read                    |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10    Abe Taaheri  Original Programmer                                 |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long
+HE5_ZAgetdimscaleF(int ZaID, char *fieldname, char *dimname, long *dimsize, 
+		   int *ntype, void * databuff)
+{
+  hsize_t         databuffsize = (hsize_t)FAIL;/* Size of buffer            */
+  hid_t           zaID         = FAIL;         /* HDF5 type za ID           */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  hsize_t         ds;
+  hid_t           numtype;
+
+  zaID = (hid_t)ZaID;
+
+  databuffsize = HE5_ZAgetdimscale(zaID, fieldname, dimname, &ds, &numtype,
+				   databuff);
+  *dimsize = (long) ds;
+  *ntype = (int) numtype;
+
+  if ( databuffsize < 0 )
+    {
+      sprintf(errbuf,"Cannot get dimension scale %s for field %s. \n", dimname, fieldname);
+      H5Epush(__FILE__, "HE5_ZAgetdimscaleF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+						 
+  return((long)databuffsize);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAreaddscaleattrF (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION: Reads attribute associated with a dimension scale field       |
+|               from a ZA.                                                    |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           int     None        HDF-EOS type ZA  ID                     |
+|  fieldname      char                field name                              |
+|  attrname       char                attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  Jun 10   Abe Taaheri   Original development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int
+HE5_ZAreaddscaleattrF(int ZaID, char *fieldname, char *attrname, void *datbuf)
+{
+  herr_t          status         = FAIL;       /* return status             */
+  hid_t           zaID           = FAIL;       /* HDF5 type za ID           */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  
+
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAreaddscaleattr(zaID, fieldname, attrname, datbuf);
+  if ( status < 0 )
+    {
+      sprintf(errbuf,"Cannot read attribute %s for dimension scale %s. \n", attrname, fieldname);
+      H5Epush(__FILE__, "HE5_ZAreaddscaleattrF", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+						 
+  return((int)status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION:  HE5_ZAwritedscaleattrF (FORTRAN wrapper)                        |
+|                                                                             |
+|  DESCRIPTION: Writes/updates attribute associated with a dimension scale    |
+|               field in a ZA.                                                |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           int                 ZA structure ID                         |
+|  fieldname      char*               dimension scale SDS name                |
+|  attrname       char*               attribute name                          |
+|  numtype        int                 attribute datatype ID                   |
+|  count[]        long                Number of attribute elements            |
+|  datbuf         void                I/O buffer                              |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  None                                                                       |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10   Abe Taaheri   Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int    
+HE5_ZAwritedscaleattrF(int ZaID, char *fieldname, char *attrname, int numtype, long count[], void *datbuf)
+{
+  herr_t          status         = FAIL;       /* return status             */
+  hid_t           zaID           = FAIL;       /* HDF5 type za ID           */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  hsize_t         fort_count[HE5_FLDNUMBERMAX];
+
+  zaID = (hid_t)ZaID;
+
+  fort_count[0] = (hsize_t)count[0];
+  status = HE5_ZAwritedscaleattr(zaID, fieldname, attrname, (hid_t)numtype, fort_count, datbuf);
+  if ( status < 0 )
+    {
+      sprintf(errbuf,"Cannot write attribute %s for dimension scale %s. \n", attrname, fieldname);
+      H5Epush(__FILE__, "HE5_ZAwritedscaleattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+						 
+  return((int)status);
+}
+
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAdscaleattrinfoF (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION: Retrieves information about dimension scale attribute         |
+|               (attribute associated with a specified dimension scale field) |
+|                in a ZA.                                                     |
+|                                                                             |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  status         int                 return status (0) SUCCEED, (-1) FAIL    |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           int       None      HDF-EOS type ZA  ID                     |
+|  fieldname      char*               field name                              |
+|  attrname       char*               attribute name                          |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  ntype          int                 attribute data type ID                  |
+|  fortcount      long                Number of attribute elements            |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  May 10   Abe Taaheri   Original Development                                |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+int 
+HE5_ZAdscaleattrinfoF(int ZaID, char *fieldname, char *attrname, int *ntype, long *fortcount)
+{
+  herr_t          status         = FAIL;       /* return status             */
+  hid_t           zaID           = FAIL;       /* HDF5 type za ID           */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  hsize_t         *count = (hsize_t *)NULL;    /* C-order count array       */
+  hid_t           *dtype  = (hid_t *)NULL;     /* Data type class ID        */
+
+  zaID = (hid_t)ZaID;
+
+  dtype = (hid_t *)calloc(1, sizeof(hid_t));
+  if(dtype == (hid_t *)NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for \"dtype\".\n");
+      H5Epush(__FILE__, "HE5_ZAdscaleattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  count = (hsize_t *)calloc(1, sizeof(hsize_t));
+  if(count == NULL)
+    {
+      sprintf(errbuf,"Cannot allocate memory for \"count\".\n");
+      H5Epush(__FILE__, "HE5_ZAdscaleattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(dtype);
+      return(FAIL);
+    }
+
+  count[0] = 0;
+
+  status = HE5_ZAdscaleattrinfo(zaID, fieldname, attrname, dtype, count);
+  if ( status == FAIL)
+    {
+      sprintf(errbuf, "Cannot retrieve attribute info for the %s dimension scale. \n", fieldname);
+      H5Epush(__FILE__, "HE5_ZAdscaleattrinfoF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(count);
+      free(dtype);
+      return(FAIL);
+    }
+  
+  *fortcount = (long)(*count);
+  *ntype     = (int)(*dtype);
+
+  free(count);
+  free(dtype);
+  return((int)status);
+}
+
+
+/*----------------------------------------------------------------------------|
+|  BEGIN_PROLOG                                                               |
+|                                                                             |
+|  FUNCTION: HE5_ZAinqdscaleattrsF (FORTRAN wrapper)                          |
+|                                                                             |
+|  DESCRIPTION:  Retrieves the number of attributes and string length of      |
+|                attribute list associated with a specified dimension scale   |
+|                in a ZA.                                                     |
+|                                                                             |
+|  Return Value    Type     Units     Description                             |
+|  ============   ======  =========   =====================================   |
+|  nattr          long                number of attributes (-1 if fails)      |
+|                                                                             |
+|  INPUTS:                                                                    |
+|  zaID           int     None        HDF-EOS type ZA  ID                     |
+|  fieldname      char                dimension scale name                    |
+|  attrnames      char                attribute name(s)                       |
+|                                                                             |
+|  OUTPUTS:                                                                   |
+|  strbufsize     long                String length of attribute (in bytes)   |
+|                                                                             |
+|  NOTES:                                                                     |
+|                                                                             |
+|  None                                                                       |
+|                                                                             |
+|   Date     Programmer   Description                                         |
+|  ======   ============  =================================================   |
+|  June 10   Abe Taaheri  Original development.                               |
+|                                                                             |
+|  END_PROLOG                                                                 |
+-----------------------------------------------------------------------------*/
+long 
+HE5_ZAinqdscaleattrsF(int ZaID, char *fieldname, char *attrnames, long *strbufsize)
+{
+  long            status         = FAIL;       /* return status             */
+  hid_t           zaID           = FAIL;       /* HDF5 type za ID           */
+  char            errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message  */
+  
+
+  zaID = (hid_t)ZaID;
+
+  status = HE5_ZAinqdscaleattrs(zaID, fieldname, attrnames, strbufsize);
+  if ( status == FAIL )
+    {
+      sprintf(errbuf, "Cannot find the attribute %s for dimension scale %s. \n",attrnames,fieldname);
+      H5Epush(__FILE__, "HE5_ZAinqdscaleattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+    }
+
+  return (status);
+}
+
+
+#ifndef __cplusplus
+
+/* HDF types used in FORTRAN bindings */
+ 
+#if defined(DEC_ALPHA) || defined(IRIX) || defined(UNICOS) || defined(LINUX64) || defined(IA64) || defined(MACINTOSH) || defined(MACINTEL) || defined(IBM6000) || defined(CYGWIN)
+ 
+#define INT32  INT
+#define INT32V INTV
+#define PINT32 PINT
+ 
+#else
+ 
+#define INT32  LONG
+#define INT32V LONGV
+#define PINT32 PLONG
+ 
+#endif
+
+
+
+/* File/ZA access routines */
+
+FCALLSCFUN2(INT, HE5_ZAopenF, HE5_ZAOPEN, he5_zaopen, STRING, INT)
+FCALLSCFUN2(INT, HE5_ZAcreateF, HE5_ZACREATE, he5_zacreate, INT, STRING)
+FCALLSCFUN2(INT, HE5_ZAattachF, HE5_ZAATTACH, he5_zaattach, INT, STRING)
+FCALLSCFUN1(INT, HE5_ZAdetachF, HE5_ZADETACH, he5_zadetach, INT)
+FCALLSCFUN1(INT, HE5_ZAcloseF, HE5_ZACLOSE, he5_zaclose, INT)
+
+/* Definition routines */
+
+FCALLSCFUN3(INT, HE5_ZAdefdimF, HE5_ZADEFDIM, he5_zadefdim, INT, STRING, LONG)
+FCALLSCFUN5(INT, HE5_ZAdefineF, HE5_ZADEFINE, he5_zadefine, INT, STRING, STRING, STRING, INT)
+FCALLSCFUN3(INT, HE5_ZAdefcompF, HE5_ZADEFCOMP, he5_zadefcomp, INT, INT, PINT)
+FCALLSCFUN3(INT, HE5_ZAdefchunkF, HE5_ZADEFCHUNK, he5_zadefchunk, INT, INT, PLONG)
+FCALLSCFUN5(INT, HE5_ZAdefcomchunkF, HE5_ZADEFCOMCH, he5_zadefcomch, INT, INT, PINT, INT, PLONG)
+FCALLSCFUN3(INT, HE5_ZAfldrenameF, HE5_ZAFLDRNM, he5_zafldrnm, INT, STRING, STRING)
+
+/* I/O routines */
+
+FCALLSCFUN6(INT, HE5_ZAwriteF, HE5_ZAWRITE, he5_zawrite, INT, STRING, LONGV, LONGV, LONGV,PVOID)
+FCALLSCFUN8(INT, HE5_ZAwritecharF, HE5_ZAWRITECHAR, he5_zawritechar, INT, STRING, INT, INT, LONGV, LONGV, LONGV,PVOID)
+FCALLSCFUN6(INT, HE5_ZAreadF, HE5_ZAREAD, he5_zaread, INT, STRING, LONGV, LONGV, LONGV, PVOID)
+FCALLSCFUN8(INT, HE5_ZAreadcharF, HE5_ZAREADCHAR, he5_zareadchar, INT, STRING, INT, INT, LONGV, LONGV, LONGV, PVOID)
+FCALLSCFUN5(INT, HE5_ZAwrattr, HE5_ZAWRATTR, he5_zawrattr,INT,STRING,INT,LONGV,PVOID)
+FCALLSCFUN5(INT, HE5_ZAwrgattr, HE5_ZAWRGATTR, he5_zawrgattr, INT, STRING, INT, LONGV,PVOID)
+FCALLSCFUN6(INT, HE5_ZAwrlattr, HE5_ZAWRLATTR, he5_zawrlattr, INT, STRING,STRING,INT,LONGV,PVOID)
+FCALLSCFUN3(INT, HE5_ZArdattr, HE5_ZARDATTR, he5_zardattr, INT, STRING, PVOID)
+FCALLSCFUN3(INT, HE5_ZArdgattr, HE5_ZARDGATTR, he5_zardgattr,INT,STRING,PVOID)
+FCALLSCFUN4(INT, HE5_ZArdlattr, HE5_ZARDLATTR, he5_zardlattr,INT,STRING,STRING,PVOID)
+FCALLSCFUN4(INT, HE5_ZAsetfill, HE5_ZASETFILL, he5_zasetfill, INT, STRING, INT, PVOID)
+FCALLSCFUN3(INT, HE5_ZAgetfill, HE5_ZAGETFILL, he5_zagetfill, INT, STRING, PVOID)
+FCALLSCFUN3(INT, HE5_ZAsetaliasF, HE5_ZASETALIAS, he5_zasetalias, INT, STRING, STRING)
+FCALLSCFUN3(INT, HE5_ZAdropaliasF, HE5_ZADRPALIAS, he5_zadrpalias, INT, INT, STRING)
+FCALLSCFUN4(INT, HE5_ZAwrdmeta, HE5_ZAWRDMETA, he5_zawrdmeta, INT, STRING, STRING, INT)
+
+
+/* Inquiry routines */
+
+FCALLSCFUN3(LONG, HE5_ZAinqzaF, HE5_ZAINQZA, he5_zainqza, STRING, PSTRING,PLONG)
+FCALLSCFUN3(LONG, HE5_ZAnentriesF, HE5_ZANENTRIES, he5_zanentries,INT,INT,PLONG)
+FCALLSCFUN2(LONG, HE5_ZAdiminfoF, HE5_ZANDIMINFO, he5_zadiminfo, INT, STRING)
+FCALLSCFUN7(INT, HE5_ZAinfoF, HE5_ZAINFO, he5_zainfo,INT,STRING,PINT,LONGV,PINT,PSTRING,PSTRING)
+FCALLSCFUN3(LONG, HE5_ZAinqdimsF, HE5_ZAINQDIMS, he5_zainqdims,INT,PSTRING,LONGV)
+FCALLSCFUN4(LONG, HE5_ZAinquireF, HE5_ZAINQUIRE, he5_zainquire, INT,PSTRING, INTV, INTV)
+FCALLSCFUN4(INT, HE5_ZAatinfo, HE5_ZAATTRINFO, he5_zaattrinfo, INT, STRING, PINT, PLONG)
+FCALLSCFUN4(INT, HE5_ZAgatinfo, HE5_ZAGATTRINFO, he5_zagattrinfo, INT, STRING, PINT, PLONG)
+FCALLSCFUN5(INT, HE5_ZAlatinfo, HE5_ZALATTRINFO, he5_zalattrinfo, INT, STRING, STRING, PINT, PLONG)
+FCALLSCFUN4(INT, HE5_ZAcompinfoF, HE5_ZACOMPINFO, he5_zacompinfo, INT, STRING,PINT, INTV)
+FCALLSCFUN3(LONG, HE5_ZAinqattrsF, HE5_ZAINQATTRS, he5_zainqattrs,INT,PSTRING,PLONG)
+FCALLSCFUN4(LONG, HE5_ZAinqlattrs, HE5_ZAINQLATTRS, he5_zainqlattrs,INT,STRING,PSTRING,PLONG)
+FCALLSCFUN3(LONG, HE5_ZAinqgattrs, HE5_ZAINQGATTRS, he5_zainqgattrs,INT,PSTRING,PLONG)
+FCALLSCFUN8(INT, HE5_ZAidtype, HE5_ZAIDYPEF, he5_zaidtype, INT,STRING,STRING,INT,PINT,PINT,PINT,PLONG)
+FCALLSCFUN5(INT, HE5_ZAaliasinfoF, HE5_ZAALIASINFO, he5_zaaliasinfo, INT, INT, STRING, PINT, STRING)
+FCALLSCFUN3(LONG, HE5_ZAinqfldaliasF, HE5_ZAINQFLDALIAS, he5_zainqfldalias,INT,PSTRING,PLONG)
+FCALLSCFUN4(INT, HE5_ZAchunkinfoF, HE5_ZACHUNKINFO, he5_zachunkinfo,INT,STRING,PINT,LONGV)
+FCALLSCFUN4(LONG, HE5_ZAgetaliaslistF, HE5_ZAGETALIASLIST, he5_zagetaliaslist,INT,INT,PSTRING,PLONG)
+
+FCALLSCFUN5(INT, HE5_ZAdefdimscaleF, HE5_ZADEFDIMSCALE, he5_zadefdimscale,INT,STRING,LONG,INT,PVOID)
+FCALLSCFUN6(INT, HE5_ZAsetdimscaleF, HE5_ZASETDIMSCALE, he5_zasetdimscale,INT,STRING,STRING,LONG,INT,PVOID)
+FCALLSCFUN6(LONG, HE5_ZAgetdimscaleF, HE5_ZAGETDIMSCALE, he5_zagetdimscale,INT,STRING,STRING,PLONG,PINT,PVOID)
+FCALLSCFUN4(INT, HE5_ZAreaddscaleattrF,HE5_ZAREADDSCALEATTR, he5_zareaddscaleattr,INT,STRING,STRING,PVOID)
+FCALLSCFUN6(INT, HE5_ZAwritedscaleattrF, HE5_ZAWRITEDSCALEATTR, he5_zawritedscaleattr,INT,STRING,STRING,INT,LONGV,PVOID)
+FCALLSCFUN5(INT, HE5_ZAdscaleattrinfoF, HE5_ZADSCALEATTRINFO, he5_zadscaleattrinfo,INT,STRING,STRING,PINT,PLONG)
+FCALLSCFUN4(INT, HE5_ZAinqdscaleattrsF, HE5_ZAINQDSCALATTRS, he5_zainqdscaleattrs,INT,STRING,STRING,PLONG)
+
+
+/* EXTERNAL DATA FILE INTERFACE */
+ 
+FCALLSCFUN4(INT, HE5_ZAsetextdataF, HE5_ZASETXDAT, he5_zasetxdat,INT,STRING,LONGV,LONGV)
+FCALLSCFUN6(INT, HE5_ZAgetextdataF, HE5_ZAGETXDAT, he5_zagetxdat,INT,STRING,LONG,PSTRING,LONGV,LONGV)
+
+#endif
+
+
+
+
+
+
+
+
diff --git a/src/make_IT/makeDEC4.0r1 b/src/make_IT/makeDEC4.0r1
new file mode 100755
index 0000000..2acdefe
--- /dev/null
+++ b/src/make_IT/makeDEC4.0r1
@@ -0,0 +1,26 @@
+
+# Copyright (C) 1996 Hughes and Applied Research Corporation
+#
+# Permission to use, modify, and distribute this software and its documentation 
+# for any purpose without fee is hereby granted, provided that the above 
+# copyright notice appear in all copies and that both that copyright notice and 
+# this permission notice appear in supporting documentation.
+
+CC = cc -DDEC
+F77 = f77
+
+MACHINE = DEC
+
+INCLUDE = -I/home/hdf/dec/40r1p1/include -I/home/hdf/gctpc/source -I.
+LIBRARY = -L/home/hdf/dec/40r1p1/lib -L.
+
+#GCTP = /home/rgejjaga/gctpc/source/geolibDEC.a
+
+GCTP = /home/hdf/dec/gctpc/source/geolib.a
+LDFLAGS = -lhdfeos ${GCTP} -lmfhdf -ldf -ljpeg -lz -lm
+
+#INCLUDE = -I<Location of HDF include files>
+#LIBRARY = -L<Location of HDF libraries> 
+
+include makeinc
+
diff --git a/src/make_IT/makeHP4.0r1 b/src/make_IT/makeHP4.0r1
new file mode 100755
index 0000000..73c446a
--- /dev/null
+++ b/src/make_IT/makeHP4.0r1
@@ -0,0 +1,24 @@
+
+# Copyright (C) 1996 Hughes and Applied Research Corporation
+#
+# Permission to use, modify, and distribute this software and its documentation 
+# for any purpose without fee is hereby granted, provided that the above 
+# copyright notice appear in all copies and that both that copyright notice and 
+# this permission notice appear in supporting documentation.
+
+CC = c89 -DHP
+F77 = fort77
+
+MACHINE = HP
+
+INCLUDE = -I. -I/home/hdf/hp/40r1p1/include -I/home/hdf/gctpc/source
+LIBRARY = -L. -L/home/hdf/hp/40r1p1/lib
+
+GCTP = /home/rgejjaga/gctpc/source/geolibHP.a
+LDFLAGS = -lhdfeos ${GCTP} -lmfhdf -ldf -ljpeg -lz -lm
+
+
+#INCLUDE = -I<Location of HDF include files>
+#LIBRARY = -L<Location of HDF libraries> 
+
+include makeinc
diff --git a/src/make_IT/makeIBM4.0r1 b/src/make_IT/makeIBM4.0r1
new file mode 100755
index 0000000..a655107
--- /dev/null
+++ b/src/make_IT/makeIBM4.0r1
@@ -0,0 +1,24 @@
+
+# Copyright (C) 1996 Hughes and Applied Research Corporation
+#
+# Permission to use, modify, and distribute this software and its documentation 
+# for any purpose without fee is hereby granted, provided that the above 
+# copyright notice appear in all copies and that both that copyright notice and 
+# this permission notice appear in supporting documentation.
+
+CC = cc -DIBM
+F77 = xlf
+
+MACHINE = IBM
+
+INCLUDE = -I/home/hdf/ibm/40r1p1/include -I/home/hdf/gctpc/source -I.
+LIBRARY = -L. -L/home/hdf/ibm/40r1p1/lib
+
+GCTP = /home/rgejjaga/gctpc/source/geolib${MACHINE}.a
+LDFLAGS = -lhdfeos ${GCTP} -lmfhdf -ldf -ljpeg -lz -lm
+
+#INCLUDE = -I<Location of HDF include files>
+#LIBRARY = -L<Location of HDF libraries>
+
+include makeinc
+
diff --git a/src/make_IT/makeSGI4.0r1 b/src/make_IT/makeSGI4.0r1
new file mode 100755
index 0000000..263153a
--- /dev/null
+++ b/src/make_IT/makeSGI4.0r1
@@ -0,0 +1,24 @@
+
+# Copyright (C) 1996 Hughes and Applied Research Corporation
+#
+# Permission to use, modify, and distribute this software and its documentation 
+# for any purpose without fee is hereby granted, provided that the above 
+# copyright notice appear in all copies and that both that copyright notice and 
+# this permission notice appear in supporting documentation.
+
+CC = cc -DSGI
+F77 = f77
+
+MACHINE = SGI
+
+INCLUDE = -I/home/hdf/sgi/40r1p1/include -I/home/hdf/gctpc/source -I.
+LIBRARY = -L/home/hdf/sgi/40r1p1/lib -L.
+
+GCTP = /home/rgejjaga/gctpc/source/geolibSGI.a
+LDFLAGS = -lhdfeos ${GCTP} -lmfhdf -ldf -ljpeg -lz -lm
+
+
+#INCLUDE = -I<Location of HDF include files>
+#LIBRARY = -L<Location of HDF libraries> 
+
+include makeinc
diff --git a/src/make_IT/makeSUN4.0r1 b/src/make_IT/makeSUN4.0r1
new file mode 100755
index 0000000..62936c8
--- /dev/null
+++ b/src/make_IT/makeSUN4.0r1
@@ -0,0 +1,26 @@
+
+# Copyright (C) 1996 Hughes and Applied Research Corporation
+#
+# Permission to use, modify, and distribute this software and its documentation 
+# for any purpose without fee is hereby granted, provided that the above 
+# copyright notice appear in all copies and that both that copyright notice and 
+# this permission notice appear in supporting documentation.
+
+#CC = cc -DSUN
+CC = gcc -DSUN -g
+F77 = f77
+
+MACHINE = SUN
+
+INCLUDE = -I. -I/home/hdf/sun/40r1p1/include -I/home/hdf/gctpc/source
+LIBRARY = -L. -L/home/hdf/sun/40r1p1/lib
+GCTP = /home/rgejjaga/gctpc/source/geolibSUN.a
+
+LDFLAGS = -lhdfeos ${GCTP} -lmfhdf -ldf -ljpeg -lnsl -lz -lm
+
+
+#INCLUDE = -I<Location of HDF include files>
+#LIBRARY = -L<Location of HDF libraries> 
+
+include makeinc
+
diff --git a/src/make_IT/makeinc b/src/make_IT/makeinc
new file mode 100755
index 0000000..3011f73
--- /dev/null
+++ b/src/make_IT/makeinc
@@ -0,0 +1,145 @@
+
+# Copyright (C) 1996 Hughes and Applied Research Corporation
+# 
+# Permission to use, modify, and distribute this software and its documentation 
+# for any purpose without fee is hereby granted, provided that the above 
+# copyright notice appear in all copies and that both that copyright notice and 
+# this permission notice appear in supporting documentation.
+
+
+EXECBLD = ${CC} $@.o -o $@ ${LIBRARY} ${LDFLAGS}
+EXECBLDF77 = ${F77} $@.o -o $@ ${LIBRARY} ${LDFLAGS}
+
+AR = ar r
+
+.SUFFIXES :
+.SUFFIXES : .o .c .f
+
+.c.o:
+	${CC} ${INCLUDE} -c $<
+
+.f.o:
+	${F77} -c $<
+
+hdfeos: swathlib gridlib pointlib swathflib gridflib pointflib
+
+swathlib: SetupSwath DefineFields WriteFields ReadFields AppendField \
+	InquireSwath SubsetSwath
+
+SetupSwath: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+DefineFields: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+WriteFields: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+ReadFields: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+AppendField: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+InquireSwath: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+SubsetSwath: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+
+
+swathflib: setupswath definefields writefields readfields appendfield \
+	inquireswath subsetswath
+
+setupswath: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+definefields: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+writefields: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+readfields: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+appendfield: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+inquireswath: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+subsetswath: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+
+
+
+gridlib: SetupGrid DefineGDflds WriteGDflds ReadGDflds InquireGrid \
+         SubsetGrid
+
+SetupGrid: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+DefineGDflds: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+WriteGDflds: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+ReadGDflds: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+InquireGrid: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+SubsetGrid: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+
+
+gridflib: setupgrid definegdflds writegdflds readgdflds inquiregrid \
+          subsetgrid
+
+setupgrid: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+definegdflds: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+writegdflds: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+readgdflds: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+inquiregrid: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+subsetgrid: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+
+pointlib: SetupPoint DefineLevels WriteLevels UpdateLevels ReadLevels \
+        SubsetPoint
+ 
+SetupPoint: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+DefineLevels: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+WriteLevels: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+UpdateLevels: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+ReadLevels: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+SubsetPoint: $$@.o he5_linhdfeos.a
+	${EXECBLD}
+
+pointflib: setuppoint definelevels writelevels readlevels updatelevels  \
+        subsetpoint
+ 
+setuppoint: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+definelevels: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+writelevels: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+readlevels: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+updatelevels: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+subsetpoint: $$@.o he5_linhdfeos.a
+	${EXECBLDF77}
+
+
+
+EHapi.o : EHapi.c 
+	${CC} ${INCLUDE} -c EHapi.c -o EHapi.o
+
+SWapi.o : SWapi.c
+	${CC} ${INCLUDE} -c SWapi.c -o SWapi.o
+
+GDapi.o : GDapi.c
+	${CC} ${INCLUDE} -c GDapi.c -o GDapi.o
+
+PTapi.o : PTapi.c
+	${CC} ${INCLUDE} -c PTapi.c -o PTapi.o
+
+he5_linhdfeos.a : EHapi.o SWapi.o GDapi.o PTapi.o
+	${AR} $@ $?
diff --git a/src/make_exclude_list b/src/make_exclude_list
new file mode 100755
index 0000000..3258f6f
--- /dev/null
+++ b/src/make_exclude_list
@@ -0,0 +1,17 @@
+hdfeos5/lib/sun5
+hdfeos5/lib/sun5.8
+hdfeos5/lib/dec
+hdfeos5/lib/hp
+hdfeos5/lib/ibm
+hdfeos5/lib/linux
+hdfeos5/lib/sgi32
+hdfeos5/lib/sgi64
+hdfeos5/lib/irix65
+hdfeos5/make_exclude_list    
+hdfeos5/install
+hdfeos5/testdrivers
+hdfeos5/landsat_test
+hdfeos5/lost+found
+
+
+
diff --git a/testdrivers/CMakeLists.txt b/testdrivers/CMakeLists.txt
new file mode 100644
index 0000000..dfa582e
--- /dev/null
+++ b/testdrivers/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (TESTDRIVERS C CXX)
+
+ADD_SUBDIRECTORY (${TESTDRIVERS_SOURCE_DIR}/swath      ${TESTDRIVERS_BINARY_DIR}/swath)
+ADD_SUBDIRECTORY (${TESTDRIVERS_SOURCE_DIR}/grid       ${TESTDRIVERS_BINARY_DIR}/grid)
+ADD_SUBDIRECTORY (${TESTDRIVERS_SOURCE_DIR}/point      ${TESTDRIVERS_BINARY_DIR}/point)
+ADD_SUBDIRECTORY (${TESTDRIVERS_SOURCE_DIR}/za         ${TESTDRIVERS_BINARY_DIR}/za)
+IF (H5_HAVE_THREADSAFE)
+  ADD_SUBDIRECTORY (${TESTDRIVERS_SOURCE_DIR}/threads    ${TESTDRIVERS_BINARY_DIR}/threads)
+ENDIF (H5_HAVE_THREADSAFE)
diff --git a/testdrivers/Make_Test b/testdrivers/Make_Test
new file mode 100755
index 0000000..39a827e
--- /dev/null
+++ b/testdrivers/Make_Test
@@ -0,0 +1,179 @@
+#-------------------------------------------------------------------------#
+#                                                                         #
+#  COPYRIGHT[copyright mark] 2000, Raytheon System Company, its vendors,  #
+#  and suppliers.  ALL RIGHTS RESERVED.                                   #
+#                                                                         #
+#-------------------------------------------------------------------------#
+#----------------------------------------------------------------------------
+# file:		makefile for HDF-EOS testdrivers
+# 	
+# 
+# author:  Abe Taaheri 
+#
+# history:
+#	04 Jan-2006 AT Initial version
+#       12 Dec 2006 AT Duplicated makefile with different name so that
+#                   we could exclude makefile in testdriver directory
+#                   for avoiding conflict with the automake makfile generation
+#----------------------------------------------------------------------------
+
+# force make to use the 'sh' shell
+SHELL = /bin/ksh
+
+# name of remove utility
+MAKE=$(MAKECMD)
+RM= /bin/rm
+RMFLAGS= -f 
+CFLAGS_SUN= -DSUN5
+FFLAGS_SUN= -DSUN5
+CFLAGS_HP11= -Aa -Ae -DHP9000 -Dunix
+FFLAGS_HP11= -Aa -Ae -DHP9000 -Dunix
+CFLAGS_HP10= -Aa -Ae -DHP9000 -Dunix
+FFLAGS_HP10= -Aa -Ae -DHP9000 -Dunix
+CFLAGS_DEC= -DDEC_ALPHA -Dunix
+FFLAGS_DEC= -DDEC_ALPHA -Dunix
+CFLAGS_IBM= -DIBM6000 -Dunix
+FFLAGS_IBM= -DIBM6000 -Dunix
+CFLAGS_ALL= -D$(HDFSYS)
+FFLAGS_ALL= -D$(HDFSYS)
+CFLAGS_SGIn32= -n32 -mips3 -DIRIX -Dunix
+FFLAGS_SGIn32= -n32 -mips3 -DIRIX -Dunix
+CFLAGS_SGI64= -64 -mips4 -DSGI64 -Dunix 
+FFLAGS_SGI64= -64 -mips4 -DSGI64 -Dunix 
+CFLAGS_IRX65= -64 -mips4 -DSGI64 -Dunix
+FFLAGS_IRX65= -64 -mips4 -DSGI64 -Dunix
+CFLAGS_LINUX= -O2 -ansi -Df2cFortran
+FFLAGS_LINUX= -O2 -ansi -fno-second-underscore
+
+
+CSUNLIB= -lnsl -lsocket
+FSUNLIB= -lnsl -lsocket
+CHP10LIB=
+FHP10LIB=
+CHP11LIB= -lnsl
+FHP11LIB= -lnsl
+CLINUXLIB= 
+FLINUXLIB= 
+CALLLIB=
+FALLLIB=
+
+all: select_brand
+
+select_brand:
+	@if [ $(BRAND) = "sun5.8" ] ; then \
+		CC="cc"; \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_SUN)"; \
+		FFLAGS="$(FFLAGS_SUN)"; \
+		CEXTRAL="$(CSUNLIB)"; \
+		FEXTRAL="$(FSUNLIB)"; \
+	elif [ $(BRAND) = "sun5.9" ] ; then \
+		CC="cc"; \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_SUN)"; \
+		FFLAGS="$(FFLAGS_SUN)"; \
+		CEXTRAL="$(CSUNLIB)"; \
+		FEXTRAL="$(FSUNLIB)"; \
+	elif [ $(BRAND) = "sun5.10" ] ; then \
+		CC="cc"; \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_SUN)"; \
+		FFLAGS="$(FFLAGS_SUN)"; \
+		CEXTRAL="$(CSUNLIB)"; \
+		FEXTRAL="$(FSUNLIB)"; \
+	elif [ $(BRAND) = "hp" ] ; then \
+		CC="cc"; \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_HP10)"; \
+		FFLAGS="$(FFLAGS_HP10)"; \
+		CEXTRAL="$(CHP10LIB)"; \
+		FEXTRAL="$(FHP10LIB)"; \
+	elif [ $(BRAND) = "hp11" ] ; then \
+		CC="cc"; \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_HP11)"; \
+		FFLAGS="$(FFLAGS_HP11)"; \
+		CEXTRAL="$(CHP11LIB)"; \
+		FEXTRAL="$(FHP11LIB)"; \
+	elif [ $(BRAND) = "dec" ] ; then \
+		CC="cc"; \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_ALL)"; \
+		FFLAGS="$(FFLAGS_ALL)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "ibm" ] ; then \
+		CC="cc"; \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_ALL)"; \
+		FFLAGS="$(FFLAGS_ALL)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "irix65" ] ; then \
+		CC="cc"; \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_SGI65)"; \
+		FFLAGS="$(FFLAGS_SGI65)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "linux" ] ; then \
+		CC="gcc -m32"; \
+		F77="g77 -m32"; \
+		CFLAGS="$(CFLAGS_LINUX)"; \
+		FFLAGS="$(FFLAGS_LINUX)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "linux32" ] ; then \
+		CC="gcc -m32"; \
+		F77="g77 -m32"; \
+		CFLAGS="$(CFLAGS_LINUX)"; \
+		FFLAGS="$(FFLAGS_LINUX)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "linux64" ] ; then \
+		CC="gcc"; \
+		F77="g77"; \
+		CFLAGS="$(CFLAGS_LINUX)"; \
+		FFLAGS="$(FFLAGS_LINUX)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "sgi32" ] ; then \
+		CC="cc"; \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_SGIn32)"; \
+		FFLAGS="$(FFLAGS_SGIn32)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "sgi64" ] ; then \
+		CC="cc"; \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_SGI64)"; \
+		FFLAGS="$(FFLAGS_SGI64)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "macintosh" ] ; then \
+		CC="gcc"; \
+		F77="$(F77)"; \
+		CFLAGS="$(CFLAGS_ALL)"; \
+		FFLAGS="$(FFLAGS_ALL)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "macintel" ] ; then \
+		CC="gcc"; \
+		F77="$(F77)"; \
+		CFLAGS="$(CFLAGS_ALL)"; \
+		FFLAGS="$(FFLAGS_ALL)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	else \
+		echo " The brand $(BRAND) is not supported. " ; \
+		echo " Set the env. vriable BRAND to a supported one then make this makefile"; \
+	fi ; \
+	RM="$(RM)";\
+	RMFLAGS="$(RMFLAGS)";\
+	export CC F77 CFLAGS FFLAGS FEXTRAL;\
+	export CEXTRAL RMFLAGS RM;\
+	make -f make.com;
+
+
+
diff --git a/testdrivers/Makefile.am b/testdrivers/Makefile.am
new file mode 100644
index 0000000..5f0d3d4
--- /dev/null
+++ b/testdrivers/Makefile.am
@@ -0,0 +1,13 @@
+# testdrivers top-level Makefile.am
+# The testdrivers directory should be placed in the HDF-EOS5 directory;
+# this file should be located at hdfeos5/testdrivers/Makefile.am
+
+# Include boilerplate definitions (from HDF-EOS5 configuration)
+include $(top_srcdir)/config/include.am
+
+# Only recurse into the threads directory if threads are being used.
+if THREADSAFE_CONDITIONAL
+  SUBDIRS=swath grid point za threads
+else
+  SUBDIRS=swath grid point za
+endif
diff --git a/testdrivers/Makefile.in b/testdrivers/Makefile.in
new file mode 100644
index 0000000..2855889
--- /dev/null
+++ b/testdrivers/Makefile.in
@@ -0,0 +1,476 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+# testdrivers top-level Makefile.am
+# The testdrivers directory should be placed in the HDF-EOS5 directory;
+# this file should be located at hdfeos5/testdrivers/Makefile.am
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/config/include.am
+subdir = testdrivers
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/HE5_config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-exec-recursive install-info-recursive \
+	install-recursive installcheck-recursive installdirs-recursive \
+	pdf-recursive ps-recursive uninstall-info-recursive \
+	uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = swath grid point za threads
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_INCLUDE_CONDITIONAL_FALSE = @INSTALL_INCLUDE_CONDITIONAL_FALSE@
+INSTALL_INCLUDE_CONDITIONAL_TRUE = @INSTALL_INCLUDE_CONDITIONAL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TESTDRIVERS_CONDITIONAL_FALSE = @TESTDRIVERS_CONDITIONAL_FALSE@
+TESTDRIVERS_CONDITIONAL_TRUE = @TESTDRIVERS_CONDITIONAL_TRUE@
+THREADSAFE_CONDITIONAL_FALSE = @THREADSAFE_CONDITIONAL_FALSE@
+THREADSAFE_CONDITIONAL_TRUE = @THREADSAFE_CONDITIONAL_TRUE@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la
+LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
+ at THREADSAFE_CONDITIONAL_FALSE@SUBDIRS = swath grid point za
+
+# Include boilerplate definitions (from HDF-EOS5 configuration)
+
+# Only recurse into the threads directory if threads are being used.
+ at THREADSAFE_CONDITIONAL_TRUE@SUBDIRS = swath grid point za threads
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  testdrivers/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  testdrivers/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(mkdir_p) $(distdir)/../config
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+	clean clean-generic clean-libtool clean-recursive ctags \
+	ctags-recursive distclean distclean-generic distclean-libtool \
+	distclean-recursive distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic maintainer-clean-recursive \
+	mostlyclean mostlyclean-generic mostlyclean-libtool \
+	mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/testdrivers/README b/testdrivers/README
new file mode 100755
index 0000000..d517ec1
--- /dev/null
+++ b/testdrivers/README
@@ -0,0 +1,114 @@
+==============================================================================
+
+FILE:    README
+UPDATED: 06/20/01  A.M.
+         Aug 02    S.Z
+
+==============================================================================
+
+These files are provided as an aid to the user for examples in how to use the
+HDF-EOS library.  The test drivers have been run on every platform supported
+by the Toolkit.  Platforms supported by the Toolkit are listed in the 
+README file located in doc directory.
+
+NOTE:  YOU MUST HAVE ALL OF THE TEXT DATA FILES IN THE SAME DIRECTORY AS YOUR 
+       POINT TEST DRIVERS.  THEY WILL CRASH WITHOUT THEM !
+ 
+       THESE DATA FILES ARE:
+
+							fixedBuoy0.txt
+							fixedBuoy1s.txt
+							floatBuoy1.txt
+							fixedBuoy1.txt
+							floatBuoy0.txt
+							simple.txt
+
+
+
+DRIVER(S)			    PLATFORM(S)
+=========			    ===========
+
+TestSwath.c			    C on all supported platforms
+TestGrid.c
+TestPoint.c
+TestZa.c
+TestProfile.c
+TestAlias.c
+
+testswath32.f			FORTRAN 77 on all supported platforms
+testgrid32.f			FORTRAN 90 on SGI for 32-bit
+testpoint32.f
+testza32.f
+
+testswath64.f			FORTRAN 90 on SGI for 64-bit
+testgrid64.f
+testpoint64.f
+testza64.f
+
+
+COMPILING TEST DRIVERS
+======================
+
+Below are samples of how the test driver can be compilied and linked to create 
+executables.
+
+The HDFSYS flag is set by the user.  The list below gives what it should be
+for each supported platform:
+
+PLATFORM		    HDFSYS FLAG
+========		    ===========
+
+Dec			        DEC_ALPHA
+Sgi			        IRIX
+Sgi Power Chall.	SGI64
+Ibm			        IBM6000
+Sun Solaris 2.5		SUN5
+Hp			        HP9000
+Linux               LINUX
+
+
+==============================================================================
+                              Swath/Point/ZA 
+------------------------------------------------------------------------------
+
+cc -DHDFSYS -o filename.o -I$HDFINC -I$HDFEOS_INC -c filename.c
+cc -DHDFSYS -o filename filename.o -L$HDFLIB -L$HDFEOS_LIB \
+        -lhe5_hdfeos -lhdf5 -lnsl -lm
+
+NOTE: substitute "filename" with the name of a driver, AND THE ORDER OF THE 
+      LIBRARIES IS IMPORTANT. 
+      IN ADDITION: NOTICE THAT WE POINT TO BOTH STANDARD HDF AND HDFEOS 
+      LIBRARIES. 
+      THE "-lnsl" FLAG IS REQUIRED FOR THE SUN PLATFORMS ONLY	
+
+
+==============================================================================
+                                Grid 
+------------------------------------------------------------------------------
+
+cc -DHDFSYS -o filename.o -I$HDFINC -I$HDFEOS_INC -c filename.c
+cc -DHDFSYS -o filename filename.o -L$HDFLIB -L$HDFEOS_LIB \
+        -lhe5_hdfeos -lGctp -lhdf5 -lnsl -lm
+       
+NOTE: ON LINUX PLATFORM YOU ALSO NEED "-lz"
+  
+NOTE: subsitute "filename" with the name of a driver, AND THE ORDER OF THE 
+      LIBRARIES IS IMPORTANT.  
+      IN ADDITION:  NOTICE THAT THE GCTP LIBRARY IS SECOND IN THE LIBRARY 
+      LIST.
+      ALSO: YOU NEED TO POINT TO WHERE THE GEOLIB LIBRARY IS LOCATED ON 
+      YOUR SYSTEM.
+      THE "-lnsl" FLAG IS REQUIRED FOR THE SUN PLATFORMS ONLY
+
+
+==============================================================================
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/grid/CMakeLists.txt b/testdrivers/grid/CMakeLists.txt
new file mode 100644
index 0000000..204cab1
--- /dev/null
+++ b/testdrivers/grid/CMakeLists.txt
@@ -0,0 +1,56 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDFEOS5_TESTDRIVERS_GRID)
+
+ADD_EXECUTABLE (testgrid ${PROJECT_SOURCE_DIR}/TestGrid.c)
+TARGET_NAMING (testgrid ${LIB_TYPE})
+TARGET_LINK_LIBRARIES (testgrid ${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_GCTP_SRC_LIB_TARGET} ${LINK_LIBS})
+
+IF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+  # make test dir
+  FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+
+  IF (HDF5_ENABLE_SZIP_SUPPORT)
+    SET (fort_testdriver_src testgrid_szip)
+  ELSE (HDF5_ENABLE_SZIP_SUPPORT)
+    SET (fort_testdriver_src testgrid)
+  ENDIF (HDF5_ENABLE_SZIP_SUPPORT)
+
+  IF (F2CFORTRAN_32PTR)
+    ADD_EXECUTABLE (testgrid_f ${PROJECT_SOURCE_DIR}/${fort_testdriver_src}32.f)
+  ELSE (F2CFORTRAN_32PTR)
+    ADD_EXECUTABLE (testgrid_f ${PROJECT_SOURCE_DIR}/${fort_testdriver_src}64.f)
+  ENDIF (F2CFORTRAN_32PTR)
+  TARGET_NAMING (testgrid_f ${LIB_TYPE})
+  TARGET_FORTRAN_WIN_PROPERTIES (testgrid_f "")
+  SET_TARGET_PROPERTIES (testgrid_f PROPERTIES LINKER_LANGUAGE Fortran)
+  TARGET_LINK_LIBRARIES (testgrid_f ${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_GCTP_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+  
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+IF (BUILD_TESTING)
+
+  ADD_TEST (NAME GRID_test_c COMMAND $<TARGET_FILE:testgrid>)
+
+  ADD_TEST (NAME GRID_test_c_verbose COMMAND $<TARGET_FILE:testgrid> -v h)
+  SET_TESTS_PROPERTIES (GRID_test_c_verbose PROPERTIES DEPENDS GRID_test_c)
+
+  IF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+    # Remove any output file left over from previous test run
+    ADD_TEST (
+        NAME GRID_test_f-clearall-objects
+        COMMAND    ${CMAKE_COMMAND} -E remove
+            Grid3.hdf Gridc_Test.hdf Gridf_Test.hdf testgridf.txt
+    )
+    SET_TESTS_PROPERTIES (GRID_test_f-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+    SET_TESTS_PROPERTIES (GRID_test_f-clearall-objects PROPERTIES DEPENDS GRID_test_c_verbose)
+
+    ADD_TEST (NAME GRID_test_f COMMAND $<TARGET_FILE:testgrid_f>)
+    SET_TESTS_PROPERTIES (GRID_test_f PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+    SET_TESTS_PROPERTIES (GRID_test_f PROPERTIES DEPENDS GRID_test_f-clearall-objects)
+  ENDIF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+
+ENDIF (BUILD_TESTING)
diff --git a/testdrivers/grid/Makefile.am b/testdrivers/grid/Makefile.am
new file mode 100644
index 0000000..d3b2de3
--- /dev/null
+++ b/testdrivers/grid/Makefile.am
@@ -0,0 +1,58 @@
+# testdrivers/grid Makefile.am
+
+# Boilerplate definitions
+include $(top_srcdir)/config/include.am
+
+# Link against HDF-EOS5 include files and both the HDF-EOS5 and libGCTP
+# libraries
+INCLUDES=-I$(top_srcdir)/include
+LDADD=$(LIBHDFEOS5) $(LIBGCTP)
+
+# Build TestGrid.  Since no sources are listed, build it from TestGrid.c
+check_PROGRAMS = TestGrid
+
+if F2CFORTRAN_CONDITIONAL
+if F2CFORTRAN_32PTR_CONDITIONAL
+check_PROGRAMS += testgrid32
+if SZIP_ENCODER_CONDITIONAL
+testgrid32_SOURCES = testgrid_szip32.f
+else
+testgrid32_SOURCES = testgrid32.f
+endif
+else
+check_PROGRAMS += testgrid64
+if SZIP_ENCODER_CONDITIONAL
+testgrid64_SOURCES = testgrid_szip64.f
+else
+testgrid64_SOURCES = testgrid64.f
+endif
+endif
+endif
+
+# Run TestGrid as a test when the user types 'make check'
+TEST_SEQUENCES=test_c
+VERBOSE_TEST_SEQUENCES=test_c_verbose
+if F2CFORTRAN_CONDITIONAL
+if F2CFORTRAN_32PTR_CONDITIONAL
+TEST_SEQUENCES+=test_32f
+VERBOSE_TEST_SEQUENCES+=test_32f
+else
+TEST_SEQUENCES+=test_64f
+VERBOSE_TEST_SEQUENCES+=test_64f
+endif
+endif
+
+test_c: $(check_PROGRAMS)
+	./TestGrid
+test_c_verbose: $(check_PROGRAMS)
+	./TestGrid -v h
+test_32f: $(check_PROGRAMS)
+	./testgrid32
+test_64f: $(check_PROGRAMS)
+	./testgrid64
+
+check-local: $(TEST_SEQUENCES)
+verbose_check: $(VERBOSE_TEST_SEQUENCES)
+
+.PHONY: $(TEST_SEQUENCES)
+
diff --git a/testdrivers/grid/Makefile.in b/testdrivers/grid/Makefile.in
new file mode 100644
index 0000000..930339b
--- /dev/null
+++ b/testdrivers/grid/Makefile.in
@@ -0,0 +1,524 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+# testdrivers/grid Makefile.am
+SOURCES = TestGrid.c $(testgrid32_SOURCES) $(testgrid64_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/config/include.am
+check_PROGRAMS = TestGrid$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2)
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_1 = testgrid32
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_2 = testgrid64
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_3 = test_32f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_4 = test_32f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_5 = test_64f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_6 = test_64f
+subdir = testdrivers/grid
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/HE5_config.h
+CONFIG_CLEAN_FILES =
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__EXEEXT_1 = testgrid32$(EXEEXT)
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__EXEEXT_2 = testgrid64$(EXEEXT)
+TestGrid_SOURCES = TestGrid.c
+TestGrid_OBJECTS = TestGrid.$(OBJEXT)
+TestGrid_LDADD = $(LDADD)
+am__DEPENDENCIES_1 = $(top_builddir)/src/libhe5_hdfeos.la
+am__DEPENDENCIES_2 = $(top_builddir)/gctp/src/libGctp.la
+TestGrid_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am__testgrid32_SOURCES_DIST = testgrid32.f testgrid_szip32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE at am_testgrid32_OBJECTS = testgrid32.$(OBJEXT)
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE at am_testgrid32_OBJECTS = testgrid_szip32.$(OBJEXT)
+testgrid32_OBJECTS = $(am_testgrid32_OBJECTS)
+testgrid32_LDADD = $(LDADD)
+testgrid32_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am__testgrid64_SOURCES_DIST = testgrid64.f testgrid_szip64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE at am_testgrid64_OBJECTS = testgrid64.$(OBJEXT)
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE at am_testgrid64_OBJECTS = testgrid_szip64.$(OBJEXT)
+testgrid64_OBJECTS = $(am_testgrid64_OBJECTS)
+testgrid64_LDADD = $(LDADD)
+testgrid64_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS)
+LTF77COMPILE = $(LIBTOOL) --mode=compile --tag=F77 $(F77) $(AM_FFLAGS) \
+	$(FFLAGS)
+F77LD = $(F77)
+F77LINK = $(LIBTOOL) --mode=link --tag=F77 $(F77LD) $(AM_FFLAGS) \
+	$(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = TestGrid.c $(testgrid32_SOURCES) $(testgrid64_SOURCES)
+DIST_SOURCES = TestGrid.c $(am__testgrid32_SOURCES_DIST) \
+	$(am__testgrid64_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F2CFORTRAN_32PTR_CONDITIONAL_FALSE = @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@
+F2CFORTRAN_32PTR_CONDITIONAL_TRUE = @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@
+F2CFORTRAN_90_CONDITIONAL_FALSE = @F2CFORTRAN_90_CONDITIONAL_FALSE@
+F2CFORTRAN_90_CONDITIONAL_TRUE = @F2CFORTRAN_90_CONDITIONAL_TRUE@
+F2CFORTRAN_CONDITIONAL_FALSE = @F2CFORTRAN_CONDITIONAL_FALSE@
+F2CFORTRAN_CONDITIONAL_TRUE = @F2CFORTRAN_CONDITIONAL_TRUE@
+F77 = @F77@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_INCLUDE_CONDITIONAL_FALSE = @INSTALL_INCLUDE_CONDITIONAL_FALSE@
+INSTALL_INCLUDE_CONDITIONAL_TRUE = @INSTALL_INCLUDE_CONDITIONAL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SZIP_ENCODER_CONDITIONAL_FALSE = @SZIP_ENCODER_CONDITIONAL_FALSE@
+SZIP_ENCODER_CONDITIONAL_TRUE = @SZIP_ENCODER_CONDITIONAL_TRUE@
+TESTDRIVERS_CONDITIONAL_FALSE = @TESTDRIVERS_CONDITIONAL_FALSE@
+TESTDRIVERS_CONDITIONAL_TRUE = @TESTDRIVERS_CONDITIONAL_TRUE@
+THREADSAFE_CONDITIONAL_FALSE = @THREADSAFE_CONDITIONAL_FALSE@
+THREADSAFE_CONDITIONAL_TRUE = @THREADSAFE_CONDITIONAL_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la
+LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
+
+# Boilerplate definitions
+
+# Link against HDF-EOS5 include files and both the HDF-EOS5 and libGCTP
+# libraries
+INCLUDES = -I$(top_srcdir)/include
+LDADD = $(LIBHDFEOS5) $(LIBGCTP)
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE at testgrid32_SOURCES = testgrid32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE at testgrid32_SOURCES = testgrid_szip32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE at testgrid64_SOURCES = testgrid64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE at testgrid64_SOURCES = testgrid_szip64.f
+
+# Run TestGrid as a test when the user types 'make check'
+TEST_SEQUENCES = test_c $(am__append_3) $(am__append_5)
+VERBOSE_TEST_SEQUENCES = test_c_verbose $(am__append_4) \
+	$(am__append_6)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .f .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  testdrivers/grid/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  testdrivers/grid/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+TestGrid$(EXEEXT): $(TestGrid_OBJECTS) $(TestGrid_DEPENDENCIES) 
+	@rm -f TestGrid$(EXEEXT)
+	$(LINK) $(TestGrid_LDFLAGS) $(TestGrid_OBJECTS) $(TestGrid_LDADD) $(LIBS)
+testgrid32$(EXEEXT): $(testgrid32_OBJECTS) $(testgrid32_DEPENDENCIES) 
+	@rm -f testgrid32$(EXEEXT)
+	$(F77LINK) $(testgrid32_LDFLAGS) $(testgrid32_OBJECTS) $(testgrid32_LDADD) $(LIBS)
+testgrid64$(EXEEXT): $(testgrid64_OBJECTS) $(testgrid64_DEPENDENCIES) 
+	@rm -f testgrid64$(EXEEXT)
+	$(F77LINK) $(testgrid64_LDFLAGS) $(testgrid64_OBJECTS) $(testgrid64_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TestGrid.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+.f.o:
+	$(F77COMPILE) -c -o $@ $<
+
+.f.obj:
+	$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.f.lo:
+	$(LTF77COMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(mkdir_p) $(distdir)/../../config
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+	$(MAKE) $(AM_MAKEFLAGS) check-local
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \
+	clean-checkPROGRAMS clean-generic clean-libtool ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am
+
+
+test_c: $(check_PROGRAMS)
+	./TestGrid
+test_c_verbose: $(check_PROGRAMS)
+	./TestGrid -v h
+test_32f: $(check_PROGRAMS)
+	./testgrid32
+test_64f: $(check_PROGRAMS)
+	./testgrid64
+
+check-local: $(TEST_SEQUENCES)
+verbose_check: $(VERBOSE_TEST_SEQUENCES)
+
+.PHONY: $(TEST_SEQUENCES)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/testdrivers/grid/Makefile.sgi32 b/testdrivers/grid/Makefile.sgi32
new file mode 100644
index 0000000..b27b1ea
--- /dev/null
+++ b/testdrivers/grid/Makefile.sgi32
@@ -0,0 +1,58 @@
+
+COMPILER = cc
+LINKER = cc
+CC = $(COMPILER)
+LD = $(LINKER)
+
+# for SUN
+#CFLAGS =  -g -Xa -DsunFortran -DSUN
+#LFLAGS = -g -Xa -DsunFortran -DSUN
+
+# for sgi32
+CFLAGS =  -g -n32 -xansi -D_POSIX_SOURCE
+LFLAGS = -g -n32 -xansi -D_POSIX_SOURCE
+
+# for sgi64
+#CFLAGS =  -g -64 -xansi -D_POSIX_SOURCE
+#LFLAGS = -g -64 -xansi -D_POSIX_SOURCE
+
+INCLUDE = -I. -I$(HDFEOS5_INC) -I$(HDF5INC) -I$(JPEGINC) -I$(ZLIBINC) -I$(SZIPINC)
+
+
+LIBRARYPATHS = -L$(HDF5LIB) -L$(HDFEOS5_LIB) -L$(JPEGLIB) -L$(ZLIBLIB) -L$(SZIPLIB)
+
+# for SUN
+#LIBRARIES = -lhe5_hdfeos $(HDF5LIB)/libhdf5.a -lGctp -ljpeg -lz -lsz -lpthread -lm -lnsl
+
+# for other platforms
+LIBRARIES = -lhe5_hdfeos $(HDF5LIB)/libhdf5.a -lGctp -ljpeg -lz -lsz -lpthread -lm
+
+OBJECTS = TestGrid.o
+
+
+PROGRAMS = TestGrid
+
+
+all: ${PROGRAMS} cleano
+
+${PROGRAMS}: ${OBJECTS}
+	${CC} ${LFLAGS} -o $@ ${OBJECTS} ${LIBRARYPATHS} ${LIBRARIES}
+
+.c.o: 
+	${CC} ${CFLAGS} -c ${INCLUDE} $<
+
+clean:
+	rm *.o ${PROGRAMS}
+
+cleano:
+	rm *.o
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/grid/TestAlias.c b/testdrivers/grid/TestAlias.c
new file mode 100755
index 0000000..cfa2bbb
--- /dev/null
+++ b/testdrivers/grid/TestAlias.c
@@ -0,0 +1,272 @@
+#include        <HE5_HdfEosDef.h>
+
+#define  FILENAME   "Alias.h5"
+#define  RANK       2
+
+main()
+{
+  herr_t       status = FAIL;
+  
+  int          i, j;
+  int          rank       = FAIL;
+  int          length     = 0;
+  int          attr[1]    = {2000};
+  int          fieldgroup = FAIL;
+
+  H5T_class_t  dtype   = H5T_NO_CLASS; 
+  hid_t        dtype1  = FAIL;
+  H5T_order_t  order   = H5T_ORDER_ERROR;
+
+  long         nattr      = FAIL;
+  long         strbufsize = FAIL; 
+  long         nfldalias     = FAIL;
+  long         nalias = FAIL;
+
+  hid_t        GDid = FAIL, gdfid = FAIL;
+  hid_t        datatype = FAIL;
+  
+  float        out_buffer[ 200 ][ 120 ];
+  float        fillvalue = -777.777;
+  float        out_fillvalue = -1.;
+
+  size_t       size    = 0;
+
+  hssize_t     start[ 3 ];
+  hsize_t      edge[ 3 ];
+  hsize_t      count[3];
+  hsize_t      nelem = 0;
+  hsize_t      dims[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+  
+  char         dimlist[80];
+  char         maxdimlist[80];
+  char         *namebuf, attrlist[80];
+
+  int          zonecode, spherecode;
+ 
+  long         xdim, ydim;
+ 
+  double       projparm[16], uplft[2], lowrgt[2];
+  int          tilerank, compcode = 16;
+  int          compparm[5] = {0, 0, 0, 0, 0};
+  hsize_t      tiledims[8];
+  float        veg[200][120];
+  char         fldalias[80];
+  char         aliaslist[80];
+
+  /* Fill veg array */
+  for (i = 0; i < 200; i++)
+        for (j = 0; j < 120; j++)
+          veg[i][j] = (float)(10+i);
+
+  /* 
+   *****************************************************************************
+   *                 Open/Create the Grid "UTMGrid"                             *
+   *****************************************************************************
+   */
+  
+  gdfid = HE5_GDopen(FILENAME, H5F_ACC_TRUNC);
+  printf("Grid file ID                      = %d\n", gdfid);
+
+  zonecode   = 40;
+  spherecode = 0;
+ 
+  /* Upper Left and Lower Right points in meters */
+  /* ------------------------------------------- */
+  uplft[0]   =   210584.50041;
+  uplft[1]   =  3322395.95445;
+  lowrgt[0]  =  813931.10959;
+  lowrgt[1]  = 2214162.53278;
+ 
+  xdim = 120;
+  ydim = 200;
+ 
+  GDid   = HE5_GDcreate(gdfid, "UTMGrid", xdim, ydim, uplft, lowrgt);
+  printf("Grid ID returned by HE5_GDcreate :                    %d \n", GDid);
+ 
+  status = HE5_GDdefproj(GDid, HE5_GCTP_UTM, zonecode, spherecode, projparm);
+  printf("status returned by HE5_GDdefproj(...\"HE5_GCTP_UTM\"...) :  %d \n", status);
+
+  status = HE5_GDsetfillvalue(GDid, "Vegetation", H5T_NATIVE_FLOAT, &fillvalue);
+  printf("Status returned by HE5_GDsetfillvalue(...,\"Vegetation\",...) : %d \n", status);
+ 
+  /* Define appendable field "Vegetation"  */
+  tilerank    = 2;
+  tiledims[0] = 100;
+  tiledims[1] = 60;
+  compparm[0] = 8;
+
+  status = HE5_GDdeftile(GDid,HE5_HDFE_TILE,tilerank,tiledims);
+  printf("Status returned by HE5_GDdeftile():                %d\n", status);
+
+  status = HE5_GDdefcomp(GDid,compcode, compparm);
+  printf("Status returned by HE5_GDdefcomp():                %d\n", status);
+
+  status = HE5_GDdeffield(GDid, "Vegetation", "YDim,XDim",NULL,H5T_NATIVE_FLOAT, 0);
+  printf("Status returned by HE5_GDdeffield(\"Vegetation\"):   %d\n", status);
+
+  start[0] = 0;
+  start[1] = 0;
+  edge[0]  = 200;   
+  edge[1]  = 120;
+
+  status = HE5_GDwritefield(GDid, "Vegetation", start, NULL, edge, veg);
+  printf("Status returned by HE5_GDwritefield() :    %d \n", status); 
+
+  /* Set aliases for field "Pollution" */
+  /* --------------------------------- */
+  status  = HE5_GDsetalias(GDid,"Vegetation","Temp,Vege,L2gpValue,ZZZ");
+  printf("status returned by HE5_GDsetalias      = %d\n", status);
+
+  strcpy(fldalias,"");
+  nfldalias = HE5_GDinqfldalias(GDid, fldalias, &strbufsize);
+  printf("Number of fields & aliases is: %li\n", nfldalias);
+  printf("Fields & aliases list:            %s \n", fldalias);
+  printf("Length of fields & aliases list:  %li \n", strbufsize);
+
+  strcpy(aliaslist,"");
+  nalias = HE5_GDgetaliaslist(GDid, HE5_HDFE_DATAGROUP, aliaslist, &strbufsize);
+  printf("Number of aliases is: %li\n", nalias);
+  printf("Aliases list:            %s \n", aliaslist);
+  printf("Length of aliases list:  %li \n", strbufsize);
+
+
+  /* Get information about alias "Vege" */
+  /* ---------------------------------- */
+  status = HE5_GDaliasinfo(GDid,  HE5_HDFE_DATAGROUP, "Vege", &length, NULL);
+  if (status == SUCCEED)
+	printf("Name length: %d \n", length);
+  
+  namebuf = (char *)calloc(length, sizeof(char));
+
+  /* Get the actual name of the field "Vege" */
+  /* --------------------------------------- */
+  status = HE5_GDaliasinfo(GDid,  HE5_HDFE_DATAGROUP, "Vege", &length, namebuf);
+  if (status == SUCCEED)
+	printf("Original field name: %s \n", namebuf);
+  
+  free(namebuf);
+
+  /* Remove alias "Temp" from the alias list */
+  /* --------------------------------------- */
+  status  = HE5_GDdropalias(GDid, HE5_HDFE_DATAGROUP, "Temp");
+  printf("status returned by HE5_GDdropalias     = %d\n", status);
+
+  /* Get information about alias  "L2gpValue" */
+  /* ---------------------------------------- */  
+  status = HE5_GDaliasinfo(GDid,  HE5_HDFE_DATAGROUP, "L2gpValue", &length, NULL);
+  if (status == SUCCEED)
+	printf("Name length: %d \n", length);
+  
+
+  namebuf = (char *)calloc(length, sizeof(char));
+
+  /* Get the actual name of the field "L2gpValue" */
+  /* -------------------------------------------- */  
+  status = HE5_GDaliasinfo(GDid, HE5_HDFE_DATAGROUP, "L2gpValue", &length, namebuf);
+  if (status == SUCCEED)
+	printf("Original field name: %s \n", namebuf);
+  
+  free(namebuf);
+
+  edge[0] = 200;
+  edge[1] = 100;
+  
+  /* Read the data from the field calling it by alias */
+  /* ------------------------------------------------ */
+  status  = HE5_GDreadfield(GDid,"L2gpValue", start, NULL, edge, out_buffer);
+  printf("status returned by HE5_GDreadfield     = %d\n", status);
+
+  printf("Data from \"L2gpValue\" field: \n");
+  for ( i = 0; i < 5; i++ )
+	for( j = 0; j < 10; j++ )
+	  printf("%f \n", out_buffer[ i ][ j ]);
+
+  /* Write local attribute to "L2gpValue" */
+  /* ------------------------------------ */
+  count[0] = 1;
+  status = HE5_GDwritelocattr(GDid, "L2gpValue", "LocalAttribute", H5T_NATIVE_INT, count, attr);
+  printf("status returned by HE5_GDwritelocattr  = %d\n", status);
+
+
+  status = HE5_GDdetach(GDid);
+  printf("status returned by HE5_GDdetach        = %d\n", status); 
+
+  GDid = HE5_GDattach(gdfid,"UTMGrid");
+  printf("Grid ID returned by HE5_GDattach      = %d\n", GDid); 
+
+  printf("Local Attributes:\n");
+  nattr = HE5_GDinqlocattrs(GDid, "L2gpValue", NULL, &strbufsize);
+  printf("Number of attributes:      %li \n", nattr);
+  printf("Length of attribute list:  %li \n", strbufsize);
+  strcpy(attrlist,"");
+  nattr = HE5_GDinqlocattrs(GDid, "L2gpValue", attrlist, &strbufsize);
+  printf("Attribute list:            %s \n", attrlist);
+
+  printf("Local Attribute:\n");
+  status = HE5_GDlocattrinfo(GDid,"ZZZ", "LocalAttribute",&dtype1, &nelem);
+  printf("Data type:                 %d\n", dtype1);
+  printf("Number of elements:        %lu \n", (unsigned long)nelem);    
+
+  status = HE5_GDfieldinfo(GDid, "L2gpValue", &rank, dims, &dtype1, dimlist, maxdimlist);
+  printf("Status returned by HE5_GDfieldinfo	= %d\n", status);
+  if (status != FAIL)
+	{
+	  printf("Field rank:                %d \n", rank);
+	  printf("Dimension Sizes: \n");
+	  for ( i = 0; i < rank; i++)
+		{
+		  printf("                           %lu \n", (unsigned long)dims[i]);
+		}
+  
+	  printf("Number type ID:            %d \n", dtype1);  
+	  printf("DimList string:            %s \n", dimlist);
+	  printf("MaxdimList string:         %s \n", maxdimlist);
+	}
+
+  fieldgroup = HE5_HDFE_DATAGROUP;
+  status = HE5_GDinqdatatype(GDid, "ZZZ", NULL, fieldgroup, &datatype, &dtype, &order, &size);
+  printf("status returned by HE5_GDinqdatatype   = %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("Data type ID:              %d \n", datatype);
+	  printf("Data type class ID:        %d \n", dtype);
+	  printf("Byte order:                %d \n", order);
+	  printf("Data size (bytes):         %d \n", (int)size);        
+	}
+
+  status  = HE5_GDcompinfo(GDid,"L2gpValue", &compcode, compparm);
+  printf("status returned by HE5_GDcompinfo      = %d\n", status);
+  if (status != FAIL)
+	{
+	  printf("Compression Information: \n");  
+	  printf("Compression code:          %d \n", compcode);
+	  printf("Compression level:         %d \n", compparm[0]);
+	}
+
+  status = HE5_GDgetfillvalue(GDid,"L2gpValue",&out_fillvalue);
+  printf("status returned by HE5_GDgetfillvalue  = %d\n", status);
+  printf("The fill value:            %f\n", out_fillvalue);
+
+  status = HE5_GDdetach(GDid);
+  printf("status returned by HE5_GDdetach        = %d\n", status); 
+
+  status = HE5_GDclose(gdfid);
+  printf("status returned by HE5_GDclose         = %d\n", status);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/grid/TestGrid.c b/testdrivers/grid/TestGrid.c
new file mode 100755
index 0000000..d0a634f
--- /dev/null
+++ b/testdrivers/grid/TestGrid.c
@@ -0,0 +1,6429 @@
+/*
+ ***********************************************************
+ *       FILENAME: TestGrid.c                              *
+ *                                                         *
+ *       PURPOSE:  To test HDF-EOS v.3 Grid interface      *
+ *                                                         *
+ *       Author:                                           *
+ *           A. Muslimov       /Emergent IT Inc.           *
+ *           Adura Adekunjo    /L3 Comm. EER corp          *
+ *           Shen Zhao         L-3 Comm. GSI               *
+ *                                                         *
+ *       History:                                          *
+ *        August 1999  AM   Initial version                *
+ *        11-Apr-2001  AM   Updated                        *
+ *        02-Dec-2004  AA   Updated with testdrivers for   *
+ *                          some new functions (NCR 41197) *
+ *        April  2005  SZ   Added the EASE grid test case  *
+ *                                                         *
+ *                                                         *
+ ***********************************************************
+ */
+
+#include  <HE5_HdfEosDef.h>
+#include  <tutils.h>
+
+#define BUFSIZE  256
+
+int main(int argc, char *argv[])
+{
+   FILE       *fp;
+
+   herr_t     status        = FAIL;
+
+   hid_t      gdfidc_simple = FAIL;
+   hid_t      GDid_UTM3     = FAIL;
+   hid_t      GDid_UTM      = FAIL;
+   hid_t      GDid_GEO      = FAIL;
+   hid_t      GDid_POLAR_N  = FAIL;
+   hid_t      GDid_POLAR_S  = FAIL;
+   hid_t      GDid_IGOODE   = FAIL;
+   hid_t      GDid_SOM      = FAIL;
+   hid_t      GDid_LAMAZ    = FAIL;
+   hid_t      GDid_HOM      = FAIL;
+   hid_t      GDid_LAMCON   = FAIL;
+   hid_t      GDid_TM       = FAIL;
+   hid_t      GDid_POLY     = FAIL;
+   hid_t      GDid_IS       = FAIL;
+   hid_t      GDid_MERCAT   = FAIL;
+   hid_t      GDid_ALBERS   = FAIL;
+   hid_t      RegionID      = FAIL;
+   hid_t      PeriodID      = FAIL;
+   hid_t      NewRegionID   = FAIL;
+   hid_t      datatype      = FAIL;
+   hid_t       dtype        = FAIL;
+   hid_t      return_val    = FAIL;
+
+   int        i, j;
+   int        Verbosity     = 4;
+   int        errcnt        = 0;
+   int        ZoneCode;
+   int        SphereCode;
+   int        proj_code     = FAIL;
+   int        z_code        = FAIL;
+   int        s_code        = FAIL;
+   int        origin_code   = FAIL;
+   int        pixreg_code   = FAIL;
+   int        fieldgroup    = FAIL;
+
+   int        *rank;
+   int        Rank          = FAIL;
+   int        tilerank, tilecode;
+   int        compcode      = 4;
+   int        compparm[5]   = { 0, 0, 0, 0, 0};
+   int        Attr[4];
+   int        grpattr[3]    = {3,7,11};
+   int        gattrvalOut[3]   = {0,0,0};
+   int        Attr_out[4]   = {-1,-1,-1,-1};
+   int        ndim          = FAIL; 
+   int        nflds         = FAIL;
+
+   hid_t      *ntype1;
+   hid_t      *ntype;
+   H5T_class_t  classid    = H5T_NO_CLASS;
+   H5T_order_t  order      = H5T_ORDER_ERROR;
+
+
+   long       list_size = FAIL;   
+   long        strbufsize      = FAIL;
+   long       *RowVal;
+   long       *ColVal;
+   long       BufSize   = FAIL;
+   long       NumPix;
+   long       index     = 0;
+   long       xdim      = 0;
+   long       ydim      = 0;
+   long       number    = FAIL;
+   
+   float      attr[4] = {1.1,2.2,3.3,4.4}; 
+   float      attrvalOut[4] = { 0, 0, 0, 0};
+   float      fillvalue     = -1.11111;
+   float      fillvalue_inq = -1.111111;
+   float      cnt_UTM       = -799.0;
+   float      cnt_LAMCON    = -134.5;
+   float      cnt_time      = 35232487.2;
+   float      *Buffer_UTM;
+   float      *Buffer_LAMCON;
+   float      *Buffer_mercat;
+   float      *time;
+   float      *DatBuf;
+   float      *VoltDataOut;
+
+   float      veg[200][120];
+   
+   double     uplft[2]      = {0, 0};
+   double     lowrgt[2]     = {0, 0};
+   double     *ProjParm;
+   double     uplft_out[2]  = {-1., -1.};
+   double     lowrgt_out[2] = {-1., -1.};
+   double     *ProjParm_out;   
+   double     CorLon[2];
+   double     CorLat[2];
+   double     StartTime;
+   double     StopTime;
+   double     LonVal[5];
+   double     LatVal[5];
+   double     *DatBuf2;
+   
+   char       *str_buf;
+   char       *str_buf2;
+   char       *ObjNamesPtr;
+
+         
+   hssize_t   start[2]  = { 0, 0 };
+
+   hsize_t    ndims          = 0;  
+   hsize_t    CurrentSize[1] = { 0 };
+   hsize_t    stride[2]      = { 1, 1 };
+   hsize_t    edge[2]        = {1, 1 };
+   hsize_t    dims[8]        = {0, 0, 0, 0, 0, 0, 0, 0 };
+   hsize_t    tiledims[8];
+   hsize_t    count;
+   hsize_t     *CountPtr       = (hsize_t *)NULL;
+   hsize_t    Gsize[1]       = { 3 }; 
+
+   size_t       size       = 0;
+
+   hid_t      GDid_EASE      = FAIL;
+   long       index1         = 0;
+   long       index2         = 0;
+   long       xdim_ease      = 1383; 
+   long       ydim_ease      = 586;
+   float      easecnt        = 2001.0;
+   /*float      easeray[1383][586];
+     float      easeray2[1383][586];*/
+   float	*easeray;
+   float	*easeray2;
+   double     rcord[4], scord[4];
+   int        npnts;
+   long       xdimsize,ydimsize;
+   double     longitude[4], latitude[4];
+ 
+
+
+   /* 
+	********************************************************************************
+	*                 Get comand-line argument (Verbosity)                         *
+	********************************************************************************
+	*/
+   
+   
+   for (i = 1; i < argc; i++)
+	 {
+	   if ((argc > i + 1) && ((HDstrcmp(argv[i], "-verbose") == 0) ||
+								   (HDstrcmp(argv[i], "-v") == 0)))
+		 {
+		   if (argv[i + 1][0] == 'l')
+			 Verbosity = 4;
+		   else if (argv[i + 1][0] == 'm')
+			 Verbosity = 6;
+		   else if (argv[i + 1][0] == 'h')
+			 Verbosity = 10;
+		   else
+			 Verbosity = atoi(argv[i + 1]);
+		 } 
+	 }
+   
+
+
+
+   /* Allocate memory for arrays */   
+   
+   Buffer_UTM     = (float *)calloc( 4800, sizeof(float) );
+   Buffer_LAMCON  = (float *)calloc( 60021, sizeof(float) );
+   Buffer_mercat  = (float *)calloc( 60021, sizeof(float) );
+   time           = (float *)calloc( 4800, sizeof(float) );
+   str_buf        = (char  *)calloc( 256, sizeof(char ) );
+   str_buf2       = (char  *)calloc( 256, sizeof(char ) );
+   
+   
+   ProjParm_out = (double *)calloc( 16, sizeof(double) );
+   for ( i = 0; i < 16; i++)
+	 {
+       ProjParm_out[ i ] = -0.99999;
+	 }
+   
+   ProjParm = (double *)calloc( 16, sizeof(double) );
+   
+   
+   /* Populate arrays */
+   
+   while( index < 4800 ) 
+	 {
+	   Buffer_UTM[ index ] = cnt_UTM;
+	   cnt_UTM += (float)0.4;
+	   index++;
+	 }
+   
+   
+   index = 0;
+   
+   while( index < 60021 ) 
+	 {
+	   Buffer_LAMCON[ index ] = cnt_LAMCON;
+	   cnt_LAMCON += 0.04;
+	   index++;
+	 }
+   
+   index = 0;
+   
+   while( index < 60021 ) 
+	 {
+	   Buffer_mercat[ index ] = cnt_LAMCON;
+	   cnt_LAMCON += 0.2;
+	   index++;
+	 }
+   
+   index = 0;
+   
+   while(index < 4800)
+	 {
+	   time[ index ] = cnt_time;
+	   cnt_time += 70.7;
+	   index++;
+	 }
+   
+   /*   index1 = 0;
+   index2 = 0;
+
+   while(index1 < xdim_ease) {
+      while(index2 < ydim_ease) {
+         easeray[index1][index2] = easecnt;
+         index2++;
+         easecnt = easecnt + 0.2;
+      }
+      index1++;
+      index2 = 0;
+   }
+
+   index1 = 0;
+   index2 = 0;
+
+   while(index1 < xdim_ease) {
+      while(index2 < ydim_ease) {
+         easeray2[index1][index2] = easecnt;
+         index2++;
+         easecnt = easecnt - .9;
+      }
+      index1++;
+      index2 = 0;
+      }*/
+
+   index1=0;
+   index2=0;
+   xdim_ease =1383;
+   ydim_ease = 586;
+
+   easeray =  (float *) malloc(1383 * 586 * sizeof(float));
+
+   for (index1=0; index1<xdim_ease; index1++)
+     {
+       for (index2=0; index2<ydim_ease; index2++)
+	 {
+	   easeray[index1+index2*xdim_ease] = easecnt;
+	   easecnt = easecnt + 0.2;
+	 }
+     }
+
+  easeray2 =  (float *) malloc(1383 * (586 * sizeof(float)));
+
+  for (index1=0; index1<xdim_ease; index1++)
+     {
+       for (index2=0; index2<ydim_ease; index2++)
+	 {
+	   easeray2[index1+index2*xdim_ease] = easecnt;
+	   easecnt = easecnt - 0.9;
+	 }
+     }
+
+
+
+   /* Fill veg array */
+   for (i = 0; i < 200; i++)
+	 for (j = 0; j < 120; j++)
+	   veg[i][j] = (float)(10+i);
+   
+   
+
+   MESSAGE(11,fp = fopen("TestGrid.txt","w"););
+   MESSAGE(4,printf("Testing Grid C interface \n"););
+   MESSAGE(4,printf("=========================\n\n"););
+   MESSAGE(11,fprintf(fp,"Testing Grid C interface \n"););
+   MESSAGE(11,fprintf(fp,"=========================\n\n"););
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_GDopen                             *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDopen... \n"););
+   MESSAGE(4,printf("\t=====================\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDopen... \n"););
+   MESSAGE(11,fprintf(fp,"\t=====================\n"););
+   
+   gdfidc_simple = HE5_GDopen("SimpleGrid.h5", H5F_ACC_TRUNC);
+   if (gdfidc_simple == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); 
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully opened the grid file ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully opened the grid file ****\n"););
+	 }
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_GDcreate                           *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDcreate... \n"););
+   MESSAGE(4,printf("\t=======================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDcreate... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid UTM3 \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid UTM3 \n"););
+   
+   xdim      = 60;
+   ydim      = 80;
+   
+   uplft[0]  = -512740.28306;
+   uplft[1]  = 2733747.62890;
+   
+   lowrgt[0] = -12584.57301;
+   lowrgt[1] = 1946984.64021;
+   
+   
+   GDid_UTM3 = HE5_GDcreate(gdfidc_simple, "UTM3", xdim, ydim, uplft, lowrgt);
+   if (GDid_UTM3 == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid UTM3 ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid UTM3 ****\n"););
+       
+	 }
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid UTM \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid UTM \n"););
+   
+   
+   GDid_UTM = HE5_GDcreate(gdfidc_simple, "UTM", xdim, ydim, uplft, lowrgt);
+   if (GDid_UTM == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid UTM ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid UTM ****\n"););
+       
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid Geo \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid Geo \n"););
+   
+   
+   uplft[0]  = - 126000000.00;
+   uplft[1]  = - 64000000.00;
+   
+   lowrgt[0] = -120000000.00;
+   lowrgt[1] = -72000000.00;
+   
+   GDid_GEO = HE5_GDcreate(gdfidc_simple, "Geo", xdim, ydim, uplft, lowrgt);
+   if (GDid_GEO == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid Geo ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid Geo ****\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tCreating grid EASE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid EASE \n"););
+ 
+
+   xdim = xdim_ease;
+   ydim = ydim_ease;
+
+   uplft[0] = HE5_EHconvAng(-180.0, HE5_HDFE_DEG_DMS);
+   uplft[1] = HE5_EHconvAng(86.72, HE5_HDFE_DEG_DMS);
+
+   lowrgt[0] = HE5_EHconvAng(180.0,HE5_HDFE_DEG_DMS);
+   lowrgt[1] = HE5_EHconvAng(-86.72,HE5_HDFE_DEG_DMS);
+
+
+   GDid_EASE = HE5_GDcreate(gdfidc_simple, "Ease", xdim, ydim, uplft, lowrgt);
+   if (GDid_EASE == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid EASE ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid EASE ****\n"););
+         }
+
+
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid Polar_np \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid Polar_np \n"););
+   
+   
+   xdim      = 360;
+   ydim      = 90;
+   
+   uplft[0]  = -10447125.82759; 
+   uplft[1]  = 10447125.82759;  
+   
+   lowrgt[0] = 10447125.82759;  
+   lowrgt[1] = -10447125.82759; 
+   
+   
+   GDid_POLAR_N = HE5_GDcreate(gdfidc_simple, "Polar_np", xdim, ydim, uplft, lowrgt);
+   if (GDid_POLAR_N == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid Polar_np ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid Polar_np ****\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid Polar_sp \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid Polar_sp \n"););
+   
+   
+   xdim      = 360;
+   ydim      = 90;
+   
+   uplft[0]  = 10447125.82759;
+   uplft[1]  = -10447125.82759;
+   
+   lowrgt[0] = -10447125.82759;
+   lowrgt[1] = 10447125.82759;
+   
+   GDid_POLAR_S = HE5_GDcreate(gdfidc_simple, "Polar_sp", xdim, ydim, uplft, lowrgt);
+   if (GDid_POLAR_S == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid Polar_sp ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid Polar_sp ****\n"););
+	 }
+   
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid IGoode \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid IGoode \n"););
+   
+   xdim      = 120;
+   ydim      = 60;
+   
+   uplft[0]  = -11119487.42844;
+   uplft[1]  = 8673539.24806;
+   
+   lowrgt[0] = 15567282.39984;
+   lowrgt[1] = -8673539.24806;
+   
+   GDid_IGOODE = HE5_GDcreate(gdfidc_simple, "IGoode", xdim, ydim, uplft, lowrgt);
+   if (GDid_IGOODE == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid IGoode ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid IGoode ****\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid SOM \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid SOM \n"););
+   
+   xdim      = 359;
+   ydim      = 321;
+   
+   uplft[0]  = 49844710.48057;
+   uplft[1]  = 884884.39883;
+   
+   lowrgt[0] = 30521379.68485;
+   lowrgt[1] = 1152027.64253;
+   
+   GDid_SOM = HE5_GDcreate(gdfidc_simple, "SOM", xdim, ydim, uplft, lowrgt);
+   if (GDid_SOM == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid SOM ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid SOM ****\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid Lamaz \n"););   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid Lamaz \n"););
+   
+   
+   xdim      = 719;
+   ydim      = 180;
+   
+   uplft[0]  = 0.0000;
+   uplft[1]  = 9009950.36324;
+   
+   lowrgt[0] = 0.0000;
+   lowrgt[1] = -9009950.36324;
+   
+   GDid_LAMAZ = HE5_GDcreate(gdfidc_simple, "Lamaz", xdim, ydim, uplft, lowrgt);
+   if (GDid_LAMAZ == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid Lamaz ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid Lamaz ****\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid hom \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid hom \n"););
+   
+   xdim      = 200;
+   ydim      = 90;
+   
+   uplft[0]  = 3422259.57265;
+   uplft[1]  = 6824822.05796;
+   
+   lowrgt[0] = -17519429.48100;
+   lowrgt[1] = 4994368.88166;
+   
+   GDid_HOM = HE5_GDcreate(gdfidc_simple, "hom", xdim, ydim, uplft, lowrgt);
+   if (GDid_HOM == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid hom ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid hom ****\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid Lamcon \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid Lamcon \n"););
+   
+   
+   xdim      = 351;
+   ydim      = 171;
+   
+   uplft[0]  = -2279109.37671;
+   uplft[1]  = 12358083.24054;
+   
+   lowrgt[0] = -56342817.96247;
+   lowrgt[1] = -24776979.34092;
+   
+   GDid_LAMCON = HE5_GDcreate(gdfidc_simple, "lamcon", xdim, ydim, uplft, lowrgt);
+   if (GDid_LAMCON == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid Lamcon ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid Lamcon ****\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid tm \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid tm \n"););
+   
+   
+   xdim      = 181;
+   ydim      = 171;
+   
+   uplft[0]  = 4855670.77539;
+   uplft[1]  = 9458558.92483;
+   
+   lowrgt[0] = 5201746.43983;
+   lowrgt[1] = -10466077.24942;
+   
+   GDid_TM = HE5_GDcreate(gdfidc_simple, "tm", xdim, ydim, uplft, lowrgt);
+   if (GDid_TM == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid tm ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid tm ****\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid poly \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid poly \n"););
+   
+   xdim      = 161;
+   ydim      = 171;
+   
+   uplft[0]  = -250873.85859;
+   uplft[1]  = 12669051.66767;
+   
+   lowrgt[0] = 850873.85859;
+   lowrgt[1] = -7137259.12615;
+   
+   GDid_POLY = HE5_GDcreate(gdfidc_simple, "poly", xdim, ydim, uplft, lowrgt);
+   if (GDid_POLY == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid poly ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid poly ****\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid IS \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid IS \n"););
+   
+   
+   xdim      = 351;
+   ydim      = 171;
+   
+   uplft[0]  = 1436267.12618;
+   uplft[1]  = 9451564.31420;
+   
+   lowrgt[0] = 1343604.73094;
+   lowrgt[1] = -9451564.31420;
+   
+   GDid_IS = HE5_GDcreate(gdfidc_simple, "is", xdim, ydim, uplft, lowrgt);
+   if (GDid_IS == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid IS ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid IS ****\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid MercatGrid \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid MercatGrid \n"););
+   
+   xdim      = 351;
+   ydim      = 171;
+   
+   uplft[0]  = -14944317.52891;
+   uplft[1]  =  15287878.19573;
+   
+   lowrgt[0] =  14944317.52891;
+   lowrgt[1] = -15287878.19573;
+   
+   GDid_MERCAT = HE5_GDcreate(gdfidc_simple, "MercatGrid", xdim, ydim, uplft, lowrgt);
+   if (GDid_MERCAT == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid MercatGrid ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid MercatGrid ****\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tCreating grid AlbersGrid \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tCreating grid AlbersGrid \n"););
+   
+   xdim      = 351;
+   ydim      = 171;
+   
+   uplft[0]  = -4801368.79521;
+   uplft[1]  = 10158566.00882;
+   
+   lowrgt[0] = -15565960.14252;
+   lowrgt[1] = 3058978.10208;
+   
+   GDid_ALBERS = HE5_GDcreate(gdfidc_simple, "AlbersGrid", xdim, ydim, uplft, lowrgt);
+   if (GDid_ALBERS == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the grid AlbersGrid ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the grid AlbersGrid ****\n"););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDdefproj                           *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDdefproj... \n"););
+   MESSAGE(4,printf("\t========================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDdefproj... \n"););   
+   MESSAGE(11,fprintf(fp,"\t========================\n"););
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tDefining projection for the grid UTM  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining projection for the grid UTM  \n"););
+   
+   ZoneCode   = -13;
+   SphereCode = 0;
+   
+   for (i = 0; i < 16; i++)
+	 {
+       ProjParm[i] = 0.0;
+	 }
+   
+   status = HE5_GDdefproj(GDid_UTM, HE5_GCTP_UTM, ZoneCode, SphereCode, ProjParm);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefproj(GDid_UTM, HE5_GCTP_UTM, ZoneCode, SphereCode, ProjParm);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefproj()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefproj(GDid_UTM, HE5_GCTP_UTM, ZoneCode, SphereCode, ProjParm);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefproj()          %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining projection for the grid Polar_np  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining projection for the grid Polar_np  \n"););
+   
+   
+   SphereCode    = 0;
+   ProjParm[ 5 ] = 40000000.0;
+   
+   status = HE5_GDdefproj(GDid_POLAR_N, HE5_GCTP_PS, 0, SphereCode, ProjParm);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefproj(GDid_POLAR_N, HE5_GCTP_PS, 0, SphereCode, ProjParm);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefproj()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefproj(GDid_POLAR_N, HE5_GCTP_PS, 0, SphereCode, ProjParm);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefproj()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining projection for the grid IGoode  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining projection for the grid IGoode  \n"););
+   
+   for ( i = 0; i < 16; i++)
+	 {
+       ProjParm[ i ] = 0.0 ;
+	 }
+   
+   
+   status = HE5_GDdefproj(GDid_IGOODE, HE5_GCTP_GOOD, 0, 0, ProjParm);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefproj(GDid_IGOODE, HE5_GCTP_GOOD, 0, 0, ProjParm);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefproj()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefproj(GDid_IGOODE, HE5_GCTP_GOOD, 0, 0, ProjParm);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefproj()          %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining projection for the grid Lamaz  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining projection for the grid Lamaz  \n"););
+   
+   
+   status = HE5_GDdefproj(GDid_LAMAZ, HE5_GCTP_LAMAZ, 0, 0, ProjParm);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefproj(GDid_LAMAZ, HE5_GCTP_LAMAZ, 0, 0, ProjParm);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefproj()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefproj(GDid_LAMAZ, HE5_GCTP_LAMAZ, 0, 0, ProjParm);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefproj()          %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n");); 
+   MESSAGE(6,printf("\t\tDefining projection for the grid SOM  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining projection for the grid SOM  \n"););
+   
+   
+   ProjParm[ 2 ]  = 3;
+   ProjParm[ 3 ]  = 150;
+   ProjParm[ 12 ] = 1;
+   
+   
+   status = HE5_GDdefproj(GDid_SOM, HE5_GCTP_SOM, 0, 0, ProjParm);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefproj(GDid_SOM, HE5_GCTP_SOM, 0, 0, ProjParm);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefproj()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefproj(GDid_SOM, HE5_GCTP_SOM, 0, 0, ProjParm);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefproj()          %d\n",status););
+	 }
+   
+
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining projection for the grid Geo  \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\tDefining projection for the grid Geo  \n"););
+   
+   
+   status = HE5_GDdefproj(GDid_GEO, HE5_GCTP_GEO, 0, 0, ProjParm);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefproj(GDid_GEO, HE5_GCTP_GEO, 0, 0, ProjParm);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefproj()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefproj(GDid_GEO, HE5_GCTP_GEO, 0, 0, ProjParm);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefproj()          %d\n",status););
+	 }
+
+
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining projection for the grid EASE  \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining projection for the grid EASE  \n"););
+ 
+ 
+   for ( i = 0; i < 16; i++)
+         {
+       ProjParm[ i ] = 0.0 ;
+         }
+
+   ProjParm[ 5 ]  = 30000000.00;
+ 
+   status = HE5_GDdefproj(GDid_EASE, HE5_GCTP_BCEA, 0, 0, ProjParm);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefproj(GDid_EASE, HE5_GCTP_BCEA, 0, 0, ProjParm);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefproj()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefproj(GDid_EASE, HE5_GCTP_BCEA, 0, 0, ProjParm);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefproj()          %d\n",status););
+         }
+
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining projection for the grid hom  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining projection for the grid hom  \n"););
+   
+   for ( i = 0; i < 16; i++)
+	 {
+       ProjParm[ i ] = 0.0 ;
+	 }
+   
+   ProjParm[ 2 ]   = 0.9996;
+   ProjParm[ 5 ]   = 20000000.00;
+   ProjParm[ 8 ]   = -75000000.00;
+   ProjParm[ 9 ]   = 10000000.00;
+   ProjParm[ 10 ]  = -95000000.00;
+   ProjParm[ 11 ]  = 30000000.00;
+   
+   
+   status = HE5_GDdefproj(GDid_HOM, HE5_GCTP_HOM, 0, 0, ProjParm);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefproj(GDid_HOM, HE5_GCTP_HOM, 0, 0, ProjParm);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefproj()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefproj(GDid_HOM, HE5_GCTP_HOM, 0, 0, ProjParm);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefproj()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining projection for the grid Lamcon  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining projection for the grid Lamcon  \n"););
+   
+   for ( i = 0; i < 16; i++)
+	 {
+       ProjParm[ i ] = 0.0 ;
+	 }
+   
+   ProjParm[ 2 ]   = 20000000.;
+   ProjParm[ 3 ]   = 40000000.;
+   ProjParm[ 4 ]   = -75000000.;
+   
+   status = HE5_GDdefproj(GDid_LAMCON, HE5_GCTP_LAMCC, 0, 0, ProjParm);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefproj(GDid_LAMCON, HE5_GCTP_LAMCC, 0, 0, ProjParm);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefproj()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefproj(GDid_LAMCON, HE5_GCTP_LAMCC, 0, 0, ProjParm);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefproj()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining projection for the grid tm  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining projection for the grid tm  \n"););
+   
+   for ( i = 0; i < 16; i++)
+	 {
+       ProjParm[ i ] = 0.0 ;
+	 }
+   
+   ProjParm[ 2 ]   = 0.9996;
+   ProjParm[ 4 ]   = -75000000.00;
+   ProjParm[ 6 ]   = 5000000.00;
+   
+   status = HE5_GDdefproj(GDid_TM, HE5_GCTP_TM, 0, 0, ProjParm);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefproj(GDid_TM, HE5_GCTP_TM, 0, 0, ProjParm);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefproj()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefproj(GDid_TM, HE5_GCTP_TM, 0, 0, ProjParm);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefproj()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining projection for the grid poly  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining projection for the grid poly  \n"););
+   
+   for ( i = 0; i < 16; i++)
+	 {
+       ProjParm[ i ] = 0.0 ;
+	 }
+   
+   ProjParm[ 4 ]   = 75000000.00;
+   ProjParm[ 5 ]   = -25000000.00;
+   ProjParm[ 6 ]   = 300000.00;
+   
+   status = HE5_GDdefproj(GDid_POLY, HE5_GCTP_POLYC, 0, 0, ProjParm);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefproj(GDid_POLY, HE5_GCTP_POLYC, 0, 0, ProjParm);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefproj()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefproj(GDid_POLY, HE5_GCTP_POLYC, 0, 0, ProjParm);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefproj()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining projection for the grid IS  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining projection for the grid IS \n"););
+   
+   
+   for ( i = 0; i < 16; i++)
+	 {
+       ProjParm[ i ] = 0.0 ;
+	 }
+   
+   ProjParm[ 4 ]   = 0.00;
+   ProjParm[ 5 ]   = 40000000.00;
+   
+   status = HE5_GDdefproj(GDid_IS, HE5_GCTP_ISINUS, 0, 0, ProjParm);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefproj(GDid_IS, HE5_GCTP_ISINUS, 0, 0, ProjParm);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefproj()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefproj(GDid_IS, HE5_GCTP_ISINUS, 0, 0, ProjParm);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefproj()          %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining projection for the grid MercatGrid  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining projection for the grid MercatGrid \n"););
+   
+   
+   for ( i = 0; i < 16; i++)
+	 {
+       ProjParm[ i ] = 0.0 ;
+	 }
+   
+   ProjParm[ 4 ]   = 00000000.00;
+   ProjParm[ 5 ]   = 40000000.00;
+   
+   SphereCode = 0;
+   
+   status = HE5_GDdefproj(GDid_MERCAT, HE5_GCTP_MERCAT, 0, 0, ProjParm);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefproj(GDid_MERCAT, HE5_GCTP_MERCAT, 0, 0, ProjParm);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefproj()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefproj(GDid_MERCAT, HE5_GCTP_MERCAT, 0, 0, ProjParm);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefproj()          %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining projection for the grid AlbersGrid  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining projection for the grid AlbersGrid \n"););
+   
+   
+   for ( i = 0; i < 16; i++)
+	 {
+       ProjParm[ i ] = 0.0 ;
+	 }
+   
+   ProjParm[ 2 ]   = 20000000.00;
+   ProjParm[ 3 ]   = 40000000.00;
+   ProjParm[ 4 ]   = -75000000.00;
+   
+   
+   SphereCode = 0;
+   
+   status = HE5_GDdefproj(GDid_ALBERS, HE5_GCTP_ALBERS, 0, 0, ProjParm);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefproj(GDid_ALBERS, HE5_GCTP_ALBERS, NULL, NULL, ProjParm);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefproj()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefproj(GDid_ALBERS, HE5_GCTP_ALBERS, NULL, NULL, ProjParm);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefproj()          %d\n",status););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDdefpixreg                         *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\tTesting HE5_GDdefpixreg... \n"););
+   MESSAGE(4,printf("\t==========================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDdefpixreg... \n"););   
+   MESSAGE(11,fprintf(fp,"\t==========================\n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tDefining pixel registration for the grid UTM  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel registration for the grid UTM \n"););
+   
+   status = HE5_GDdefpixreg( GDid_UTM, HE5_HDFE_CORNER);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefpixreg(GDid_UTM, HE5_HDFE_CORNER);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefpixreg()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefpixreg(GDid_UTM, HE5_HDFE_CORNER);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefpixreg()          %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel registration for the grid Polar_np \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel registration for the grid Polar_np \n"););
+   
+   status = HE5_GDdefpixreg( GDid_POLAR_N, HE5_HDFE_CORNER);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefpixreg(GDid_POLAR_N, HE5_HDFE_CORNER);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefpixreg()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefpixreg(GDid_POLAR_N, HE5_HDFE_CORNER);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefpixreg()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel registration for the grid IGoode \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel registration for the grid IGoode \n"););
+   
+   status = HE5_GDdefpixreg( GDid_IGOODE, HE5_HDFE_CORNER);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefpixreg(GDid_IGOODE, HE5_HDFE_CORNER);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefpixreg()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefpixreg(GDid_IGOODE, HE5_HDFE_CORNER);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefpixreg()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel registration for the grid SOM  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel registration for the grid SOM \n"););
+   
+   status = HE5_GDdefpixreg( GDid_SOM, HE5_HDFE_CORNER);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefpixreg(GDid_SOM, HE5_HDFE_CORNER);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefpixreg()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefpixreg(GDid_SOM, HE5_HDFE_CORNER);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefpixreg()          %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel registration for the grid Lamcon \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel registration for the grid Lamcon \n"););
+   
+   status = HE5_GDdefpixreg( GDid_LAMCON, HE5_HDFE_CORNER);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefpixreg(GDid_LAMCON, HE5_HDFE_CORNER);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefpixreg()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefpixreg(GDid_LAMCON, HE5_HDFE_CORNER);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefpixreg()          %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel registration for the grid Geo  \n"););  
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel registration for the grid Geo \n"););
+   
+   status = HE5_GDdefpixreg( GDid_GEO, HE5_HDFE_CORNER);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefpixreg(GDid_GEO, HE5_HDFE_CORNER);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefpixreg()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefpixreg(GDid_GEO, HE5_HDFE_CORNER);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefpixreg()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel registration for the grid EASE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel registration for the grid EASE \n"););
+  
+   status = HE5_GDdefpixreg(GDid_EASE, HE5_HDFE_CORNER);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefpixreg(GDid_EASE, HE5_HDFE_CORNER);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefpixreg()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefpixreg(GDid_EASE, HE5_HDFE_CORNER);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefpixreg()          %d\n",status););
+         }
+
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel registration for the grid MercatGrid  \n"););  
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel registration for the grid MercatGrid \n"););
+   
+   status = HE5_GDdefpixreg( GDid_MERCAT, HE5_HDFE_CORNER);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefpixreg(GDid_MERCAT, HE5_HDFE_CORNER);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefpixreg()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefpixreg(GDid_MERCAT, HE5_HDFE_CORNER);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefpixreg()          %d\n",status););
+	 }
+   
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel registration for the grid AlbersGrid  \n"););  
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel registration for the grid AlbersGrid \n"););
+   
+   status = HE5_GDdefpixreg( GDid_ALBERS, HE5_HDFE_CORNER);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefpixreg(GDid_ALBERS, HE5_HDFE_CORNER);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefpixreg()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefpixreg(GDid_ALBERS, HE5_HDFE_CORNER);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefpixreg()          %d\n",status););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDdeforigin                         *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\tTesting HE5_GDdeforigin... \n"););
+   MESSAGE(4,printf("\t==========================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDdeforigin... \n"););   
+   MESSAGE(11,fprintf(fp,"\t==========================\n"););
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tDefining pixel origin for the grid UTM  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel origin for the grid UTM \n"););
+   
+   status = HE5_GDdeforigin(GDid_UTM, HE5_HDFE_GD_UL );
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeforigin(GDid_UTM, HE5_HDFE_GD_UL);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeforigin()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeforigin(GDid_UTM, HE5_HDFE_GD_UL);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeforigin()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel origin for the grid Polar_np  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel origin for the grid Polar_np \n"););
+   
+   status = HE5_GDdeforigin(GDid_POLAR_N, HE5_HDFE_GD_UR );
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeforigin(GDid_POLAR_N, HE5_HDFE_GD_UR);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeforigin()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeforigin(GDid_POLAR_N, HE5_HDFE_GD_UR);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeforigin()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel origin for the grid IGoode  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel origin for the grid IGoode \n"););
+   
+   status = HE5_GDdeforigin(GDid_IGOODE, HE5_HDFE_GD_LL );
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeforigin(GDid_IGOODE, HE5_HDFE_GD_LL);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeforigin()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeforigin(GDid_IGOODE, HE5_HDFE_GD_LL);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeforigin()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel origin for the grid SOM  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel origin for the grid SOM \n"););
+   
+   status = HE5_GDdeforigin(GDid_SOM, HE5_HDFE_GD_LR );
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeforigin(GDid_SOM, HE5_HDFE_GD_LR);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeforigin()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeforigin(GDid_SOM, HE5_HDFE_GD_LR);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeforigin()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel origin for the grid Lamcon \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel origin for the grid Lamcon \n"););
+   
+   status = HE5_GDdeforigin(GDid_LAMCON, HE5_HDFE_GD_UL );
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeforigin(GDid_LAMCON, HE5_HDFE_GD_UL);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeforigin()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeforigin(GDid_LAMCON, HE5_HDFE_GD_UL);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeforigin()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel origin for the grid Geo \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel origin for the grid Geo \n"););
+   
+   status = HE5_GDdeforigin(GDid_GEO, HE5_HDFE_GD_UR );
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeforigin(GDid_GEO, HE5_HDFE_GD_UR);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeforigin()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeforigin(GDid_GEO, HE5_HDFE_GD_UR);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeforigin()          %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel origin for the grid EASE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel origin for the grid EASE \n"););
+  
+   status = HE5_GDdeforigin(GDid_EASE, HE5_HDFE_GD_UL);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {  
+       MESSAGE(4,printf("\n"););  
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeforigin(GDid_EASE, HE5_HDFE_GD_UL);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeforigin()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeforigin(GDid_EASE, HE5_HDFE_GD_UL);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeforigin()          %d\n",status););
+         }
+
+
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel origin for the grid MercatGrid \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel origin for the grid MercatGrid \n"););
+   
+   status = HE5_GDdeforigin(GDid_MERCAT, HE5_HDFE_GD_UR );
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeforigin(GDid_MERCAT, HE5_HDFE_GD_UR);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeforigin()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeforigin(GDid_MERCAT, HE5_HDFE_GD_UR);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeforigin()          %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining pixel origin for the grid AlbersGrid \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining pixel origin for the grid AlbersGrid \n"););
+   
+   status = HE5_GDdeforigin(GDid_ALBERS, HE5_HDFE_GD_UR );
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeforigin(GDid_ALBERS, HE5_HDFE_GD_UR);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeforigin()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeforigin(GDid_ALBERS, HE5_HDFE_GD_UR);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeforigin()          %d\n",status););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDdefdim                            *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\tTesting HE5_GDdefdim... \n"););
+   MESSAGE(4,printf("\t=======================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDdefdim... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tDefining dimensions for the grid UTM  \n"););   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimensions for the grid UTM \n"););
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension \"Conduction\" for the grid UTM  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"Conduction\"  for the grid UTM \n"););
+   
+   
+   status = HE5_GDdefdim(GDid_UTM, "Conduction",25);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefdim(GDid_UTM, \"Conduction\", 25);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefdim()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefdim(GDid_UTM, \"Conduction\", 25);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefdim()          %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension \"Timedim\" for the grid UTM  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"Timedim\"  for the grid UTM \n"););
+   
+   status = HE5_GDdefdim(GDid_UTM, "Timedim",4800);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefdim(GDid_UTM, \"Timedim\", 4800);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefdim()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefdim(GDid_UTM, \"Timedim\", 4800);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefdim()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension \"Hghtdim\" for the grid UTM  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"Hghtdim\"  for the grid UTM \n"););
+   
+   status = HE5_GDdefdim(GDid_UTM, "Hghtdim",80);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefdim(GDid_UTM, \"Hghtdim\", 80);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefdim()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefdim(GDid_UTM, \"Hghtdim\", 80);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefdim()          %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension \"Unlim\" for the grid UTM  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"Unlim\"  for the grid UTM \n"););
+   
+   
+   status = HE5_GDdefdim(GDid_UTM, "Unlim", H5S_UNLIMITED);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefdim(GDid_UTM, \"Unlim\", H5S_UNLIMITED);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefdim()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefdim(GDid_UTM, \"Unlim\", H5S_UNLIMITED);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefdim()          %d\n",status););
+	 }
+   
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension \"Convection\" for the grid Polar_np  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"Convection\"  for the grid Polar_np \n"););
+   
+   status = HE5_GDdefdim(GDid_POLAR_N, "Convection",75);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefdim(GDid_POLAR_N, \"Convection\", 75);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefdim()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefdim(GDid_POLAR_N, \"Convection\", 75);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefdim()          %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension \"Radiant\" for the grid IGoode  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"Radiant\"  for the grid IGoode \n"););
+   
+   status = HE5_GDdefdim(GDid_IGOODE, "Radiant",45);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefdim(GDid_IGOODE, \"Radiant\", 45);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefdim()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefdim(GDid_IGOODE, \"Radiant\", 45);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefdim()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension \"Emission\" for the grid SOM  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"Emission\"  for the grid SOM \n"););
+   
+   
+   status = HE5_GDdefdim(GDid_SOM, "Emission",55);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefdim(GDid_SOM, \"Emission\", 55);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefdim()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefdim(GDid_SOM, \"Emission\", 55);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefdim()          %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension \"Flux\" for the grid Lamaz  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"Flux\"  for the grid Lamaz \n"););
+   
+   status = HE5_GDdefdim(GDid_LAMAZ, "Flux",65);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefdim(GDid_LAMAZ, \"Flux\", 65);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefdim()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefdim(GDid_LAMAZ, \"Flux\", 65);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefdim()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension \"Gradient\" for the grid Geo  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"Gradient\"  for the grid Geo \n"););
+   
+   status = HE5_GDdefdim(GDid_GEO, "Gradient",85);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefdim(GDid_GEO, \"Gradient\", 85); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefdim()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefdim(GDid_GEO, \"Gradient\", 85); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefdim()          %d\n",status););
+	 }   
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension \"Width\" for the grid EASE  \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"Width\"  for the grid EASE \n"););
+  
+   status = HE5_GDdefdim(GDid_EASE, "Width", xdim_ease);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {  
+       MESSAGE(4,printf("\n"););  
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefdim(GDid_EASE, \"Width\", xdim_ease); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefdim()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefdim(GDid_EASE, \"Width\", xdim_ease); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefdim()          %d\n",status););
+         }  
+
+
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension \"VerticalGradient\" for the grid MercatGrid  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"VerticalGradient\"  for the grid MercatGrid \n"););
+   
+   status = HE5_GDdefdim(GDid_MERCAT, "VerticalGradient",85);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefdim(GDid_MERCAT, \"VerticalGradient\", 85); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefdim()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefdim(GDid_MERCAT, \"VerticalGradient\", 85); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefdim()          %d\n",status););
+	 }   
+   
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension \"DammyGradient\" for the grid AlbersGrid  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"DammyGradient\"  for the grid AlbersGrid \n"););
+   
+   status = HE5_GDdefdim(GDid_ALBERS, "DammyGradient",85);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefdim(GDid_ALBERS, \"DammyGradient\", 85); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefdim()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefdim(GDid_ALBERS, \"DammyGradient\", 85); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefdim()          %d\n",status););
+	 }   
+
+    status = HE5_GDdefdim(GDid_UTM, "ExtDim",60);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefdim(GDid_UTM, \"ExtDim\", 60);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefdim()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefdim(GDid_UTM, \"ExtDim\", 60);\n"););
+           MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefdim()          %d\n",status););
+         }
+
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDdetach                            *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\tTesting HE5_GDdetach... \n"););
+   MESSAGE(4,printf("\t=======================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDdetach... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tDetaching from the grid UTM3  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid UTM3  \n"););
+   
+   status = HE5_GDdetach(GDid_UTM3);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid UTM3 **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid UTM3 **\n"););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid UTM  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid UTM \n"););
+   
+   status = HE5_GDdetach(GDid_UTM);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid UTM **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid UTM **\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid Geo  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid Geo \n"););
+   
+   status = HE5_GDdetach(GDid_GEO); 
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid Geo **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid Geo **\n"););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid Polar_np  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid Polar_np \n"););
+   
+   status = HE5_GDdetach(GDid_POLAR_N); 
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid Polar_np **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid Polar_np **\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid Polar_sp  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid Polar_sp \n"););
+   
+   status = HE5_GDdetach(GDid_POLAR_S);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid Polar_sp **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid Polar_sp **\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid IGoode  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid IGoode \n"););
+   
+   status = HE5_GDdetach(GDid_IGOODE); 
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid IGoode **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid IGoode **\n"););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid Som  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid Som \n"););
+   
+   status = HE5_GDdetach(GDid_SOM);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid Som **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid Som **\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid Lamaz  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid Lamaz \n"););
+   
+   status = HE5_GDdetach(GDid_LAMAZ); 
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid Lamaz **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid Lamaz **\n"););
+	 }
+   
+
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid EASE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid EASE \n"););
+  
+   status = HE5_GDdetach(GDid_EASE);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid EASE **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid EASE **\n"););
+         }
+
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid hom  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid hom \n"););
+   
+   status = HE5_GDdetach(GDid_HOM);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid hom **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid hom **\n"););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid Lamcon  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid Lamcon \n"););
+   
+   status = HE5_GDdetach(GDid_LAMCON);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid Lamcon **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid Lamcon **\n"););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid tm  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid tm \n"););
+   
+   status = HE5_GDdetach(GDid_TM);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid tm **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid tm **\n"););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid Poly  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid Poly \n"););
+   
+   status = HE5_GDdetach(GDid_POLY);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid Poly **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid Poly **\n"););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid IS  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid IS \n"););
+   
+   status = HE5_GDdetach(GDid_IS);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid IS **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid IS **\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid MercatGrid \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid MercatGrid \n"););
+   
+   status = HE5_GDdetach(GDid_MERCAT);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid MercatGrid **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid MercatGrid **\n"););
+	 }
+   
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid AlbersGrid \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid AlbersGrid \n"););
+   
+   status = HE5_GDdetach(GDid_ALBERS);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid AlbersGrid **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid AlbersGrid **\n"););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDattach                            *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\tTesting HE5_GDattach... \n"););
+   MESSAGE(4,printf("\t=======================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDattach... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tAttaching to the grid UTM  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tAttaching to the grid UTM  \n"););
+   
+   GDid_UTM  = HE5_GDattach(gdfidc_simple,"UTM"); 
+   if (GDid_UTM == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully attached to the grid UTM **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully attached to the grid UTM **\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tAttaching to the grid EASE  \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tAttaching to the grid EASE  \n"););
+  
+   GDid_EASE  = HE5_GDattach(gdfidc_simple,"Ease");
+   if (GDid_EASE == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t** Successfully attached to the grid EASE **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully attached to the grid EASE **\n"););
+         }
+
+
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tAttaching to the grid MercatGrid  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tAttaching to the grid MercatGrid  \n"););
+   
+   GDid_MERCAT  = HE5_GDattach(gdfidc_simple,"MercatGrid"); 
+   if (GDid_MERCAT == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully attached to the grid MercatGrid **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully attached to the grid MercatGrid **\n"););
+	 }
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tAttaching to the grid AlbersGrid  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tAttaching to the grid AlbersGrid  \n"););
+   
+   GDid_ALBERS  = HE5_GDattach(gdfidc_simple,"AlbersGrid"); 
+   if (GDid_ALBERS == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully attached to the grid AlbersGrid **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully attached to the grid AlbersGrid **\n"););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDsetfillvalue                      *
+	*********************************************************************************
+	*                                                                               *
+	*       NOTE:  This call should always precede the call to GDdeffield()         * 
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDsetfillvalue... \n"););
+   MESSAGE(4,printf("\t============================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDsetfillvalue... \n"););   
+   MESSAGE(11,fprintf(fp,"\t============================= \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tSetting fill value for the field \"Voltage\" in grid UTM  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tSetting fill value for the field \"Voltage\" in grid UTM \n"););
+   
+   status = HE5_GDsetfillvalue(GDid_UTM, "Voltage", H5T_NATIVE_FLOAT, &fillvalue);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDsetfillvalue(GDid_UTM,\"Voltage\",H5T_NATIVE_FLOAT,&fillvalue); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDsetfillvalue()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDsetfillvalue(GDid_UTM,\"Voltage\",H5T_NATIVE_FLOAT,&fillvalue); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDsetfillvalue()          %d\n",status););
+	 } 
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDdeffield                          *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDdeffield... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDdeffield... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tDefining the field \"Voltage\" for the grid UTM \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining the field \"Voltage\" for the grid UTM  \n"););
+   
+   status = HE5_GDdeffield(GDid_UTM,"Voltage","XDim,YDim",NULL,H5T_NATIVE_FLOAT,0);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeffield(GDid_UTM,\"Voltage\",\"XDim,YDim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeffield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeffield(GDid_UTM,\"Voltage\",\"XDim,YDim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeffield()          %d\n",status););
+	 } 
+   
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining the field \"Drift\" for the grid UTM \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\t Defining the field \"Drift\" for the grid UTM\n"););
+   
+   status = HE5_GDdeffield(GDid_UTM,"Drift","XDim,YDim",NULL,H5T_NATIVE_FLOAT,0);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeffield(GDid_UTM,\"Drift\",\"XDim,YDim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeffield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeffield(GDid_UTM,\"Drift\",\"XDim,YDim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeffield()          %d\n",status););
+	 } 
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining the field \"VerticalD\" for the grid MercatGrid \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\t Defining the field \"VerticalD\" for the grid MercatGrid \n"););
+   
+   status = HE5_GDdeffield(GDid_MERCAT,"VerticalD","XDim,YDim",NULL,H5T_NATIVE_FLOAT,0);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeffield(GDid_MERCAT,\"VerticalD\",\"XDim,YDim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeffield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeffield(GDid_MERCAT,\"VerticalD\",\"XDim,YDim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeffield()          %d\n",status););
+	 } 
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining the field \"Intensity\" for the grid EASE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\t Defining the field \"Intensity\" for the grid EASE \n"););
+  
+   status = HE5_GDdeffield(GDid_EASE,"Intensity","XDim,YDim",NULL,H5T_NATIVE_FLOAT,0);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {  
+       MESSAGE(4,printf("\n"););  
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeffield(GDid_EASE,\"Intensity\",\"XDim,YDim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeffield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeffield(GDid_EASE,\"Intensity\",\"XDim,YDim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeffield()          %d\n",status););
+         }
+
+
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining the field \"Intervals\" for the grid EASE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Defining the field \"Intervals\" for the grid EASE \n"););
+ 
+   status = HE5_GDdeffield(GDid_EASE,"Intervals","Width,YDim",NULL,H5T_NATIVE_FLOAT,0);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         { 
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeffield(GDid_EASE,\"Intervals\",\"Width,YDim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeffield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeffield(GDid_EASE,\"Intervals\",\"Width,YDim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeffield()          %d\n",status););
+         }
+
+
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining the field \"MaximumDepth\" for the grid AlbersGrid \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\t Defining the field \"MaximumDepth\" for the grid AlbersGrid \n"););
+   
+   status = HE5_GDdeffield(GDid_ALBERS,"MaximumDepth","XDim,YDim",NULL,H5T_NATIVE_FLOAT,0);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeffield(GDid_ALBERS,\"MaximumDepth\",\"XDim,YDim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeffield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeffield(GDid_ALBERS,\"MaximumDepth\",\"XDim,YDim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeffield()          %d\n",status););
+	 } 
+   
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining the field \"Time\" for the grid UTM \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\t Defining the field \"Time\" for the grid UTM\n"););
+   
+   status = HE5_GDdeffield(GDid_UTM,"Time","Timedim",NULL,H5T_NATIVE_FLOAT,0);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeffield(GDid_UTM,\"Time\",\"Timedim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeffield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeffield(GDid_UTM,\"Drift\",\"Timedim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeffield()          %d\n",status););
+	 } 
+         
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining the external data field \"ExtData\" for the grid UTM \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\t Defining the external data  field \"ExtData\" for the grid UTM\n"););
+  
+   status = HE5_GDdeffield(GDid_UTM,"ExtData","ExtDim",NULL,H5T_NATIVE_FLOAT,0);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+  else
+         {  
+       MESSAGE(4,printf("\n"););  
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeffield(GDid_UTM,\"ExtData\",\"ExtDim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeffield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeffield(GDid_UTM,\"ExtData\",\"ExtDim\",NULL,H5T_NATIVE_FLOAT,0 ); \n"););
+           MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeffield()          %d\n",status););
+         }
+ 
+   
+   /*
+	*********************************************************************************
+	*                             Testing  Appendable field                         *
+	*********************************************************************************
+	*/
+   
+   tilerank    = 2;
+   tiledims[0] = 10;
+   tiledims[1] = 10;
+   compparm[0] = 5;
+   
+   
+   MESSAGE(4,printf("\tTesting HE5_GDdeftile... \n"););
+   MESSAGE(4,printf("\t======================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDdeftile... \n"););   
+   MESSAGE(11,fprintf(fp,"\t======================== \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tDefining tiling for the grid UTM \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining tiling for the grid UTM  \n"););
+   
+   status = HE5_GDdeftile(GDid_UTM, HE5_HDFE_TILE, tilerank, tiledims);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeftile(GDid_UTM, HE5_HDFE_TILE, tilerank, tiledims); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeftile()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeftile(GDid_UTM, HE5_HDFE_TILE, tilerank, tiledims); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeftile()          %d\n",status););
+	 } 
+   
+   
+   
+   MESSAGE(4,printf("\tTesting HE5_GDdefcomp... \n"););
+   MESSAGE(4,printf("\t======================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDdefcomp... \n"););   
+   MESSAGE(11,fprintf(fp,"\t======================== \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tDefining compression for the grid UTM \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining compression for the grid UTM  \n"););
+   
+   status = HE5_GDdefcomp(GDid_UTM, compcode, compparm);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdefcomp(GDid_UTM, compcode, compparm); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdefcomp()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdefcomp(GDid_UTM, compcode, compparm); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdefcomp()          %d\n",status););
+	 } 
+   
+   MESSAGE(4,printf("\tTesting HE5_GDdeffield... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDdeffield... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tDefining appendable field \"Vegetation\" for the grid UTM \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining appendable field \"Vegetation\" for the grid UTM  \n"););
+   
+   status = HE5_GDdeffield(GDid_UTM,"Vegetation","XDim,YDim","Unlim,Unlim",H5T_NATIVE_FLOAT,0);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeffield(GDid_UTM,\"Vegetation\",\"XDim,YDim\",\"Unlim,Unlim\",H5T_NATIVE_FLOAT,0 ); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeffield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeffield(GDid_UTM,\"Voltage\",\"XDim,YDim\",\"Unlim,Unlim\",H5T_NATIVE_FLOAT,0 ); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeffield()          %d\n",status););
+	 } 
+   
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid UTM  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid UTM \n"););
+   
+   status = HE5_GDdetach(GDid_UTM);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid UTM **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid UTM **\n"););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tAttaching to the grid lamcon  \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tAttaching to the grid lamcon  \n"););
+   
+   GDid_LAMCON = HE5_GDattach(gdfidc_simple,"lamcon"); 
+   if (GDid_LAMCON == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully attached to the grid lamcon **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully attached to the grid lamcon **\n"););
+	 }
+   
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining the field \"Bypass\" for the grid lamcon \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\t Defining the field \"Bypass\" for the grid lamcon\n"););
+   
+   status = HE5_GDdeffield(GDid_LAMCON,"Bypass","XDim,YDim",NULL,H5T_NATIVE_FLOAT,0);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDdeffield(GDid_LAMCON,\"Bypass\",\"XDim,YDim\",NULL,H5T_NATIVE_FLOAT,0); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDdeffield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDdeffield(GDid_LAMCON,\"Bypass\",\"XDim,YDim\",NULL,H5T_NATIVE_FLOAT,0); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDdeffield()          %d\n",status););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid Lamcon \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid Lamcon \n"););
+   
+   status = HE5_GDdetach(GDid_LAMCON);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid lamcon **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid lamcon **\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tAttaching to the grid UTM \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tAttaching to the grid UTM \n"););
+   
+   GDid_UTM  = HE5_GDattach(gdfidc_simple,"UTM"); 
+   if (GDid_UTM == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully attached to the grid UTM **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully attached to the grid UTM **\n"););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDwritefield                        *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDwritefield... \n"););
+   MESSAGE(4,printf("\t=========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDwritefield... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tWriting field \"Voltage\" to the grid UTM  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting field \"Voltage\" to the grid UTM  \n"););
+   
+   
+   start[0]  = 0;
+   start[1]  = 0;
+   stride[0] = 1;
+   stride[1] = 1;
+   edge[0]   = 50;
+   edge[1]   = 80;
+   
+   status = HE5_GDwritefield(GDid_UTM, "Voltage", start, stride, edge, Buffer_UTM);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDwritefield(GDid_UTM, \"Voltage\", start, stride, edge, Buffer_UTM); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDwritefield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDwritefield(GDid_UTM, \"Voltage\", start, stride, edge, Buffer_UTM); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDwritefield()          %d\n",status););
+	 } 
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\t Writing field \"Drift\" to the grid UTM \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\t Writing field \"Drift\" to the grid UTM \n"););
+   
+   start[0] = 0;
+   start[1] = 0;
+   
+   stride[0] = 1;
+   stride[1] = 1;
+   
+   edge[0] = 60;
+   edge[1] = 80;
+   
+   status = HE5_GDwritefield(GDid_UTM, "Drift",start, stride, edge, Buffer_UTM);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDwritefield(GDid_UTM, \"Drift\", start, stride, edge, Buffer_UTM); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDwritefield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDwritefield(GDid_UTM, \"Drift\", start, stride, edge, Buffer_UTM); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDwritefield()          %d\n",status););
+	 } 
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\t Writing field \"Intensity\" to the grid EASE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Writing field \"Intensity\" to the grid EASE \n"););
+
+   start[0] = 0;
+   start[1] = 0;
+   stride[0] = 1;
+   stride[1] = 1;
+   edge[0] = 1386;
+   edge[1] = 586;
+  
+   status = HE5_GDwritefield(GDid_EASE, "Intensity", start, stride, edge, easeray);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {  
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDwritefield(GDid_EASE, \"Intensity\", start, stride, edge, easeray); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDwritefield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDwritefield(GDid_EASE, \"Intensity\", start, stride, edge, easeray); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDwritefield()          %d\n",status););
+         }
+
+
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\t Writing field \"Intervals\" to the grid EASE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Writing field \"Intervals\" to the grid EASE \n"););
+
+   free(easeray);
+
+   status = HE5_GDwritefield(GDid_EASE, "Intervals", start, stride, edge, easeray2);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         { 
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDwritefield(GDid_EASE, \"Intervals\", start, stride, edge, easeray2); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDwritefield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDwritefield(GDid_EASE, \"Intervals\", start, stride, edge, easeray2); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDwritefield()          %d\n",status););
+         }
+
+   free(easeray2);
+
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\t Writing field \"VerticalD\" to the grid MercatGrid \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\t Writing field \"VerticalD\" to the grid MercatGrid \n"););
+   
+   start[0] = 0;
+   start[1] = 0;
+   
+   stride[0] = 1;
+   stride[1] = 1;
+   
+   edge[0] = 351;
+   edge[1] = 171;
+   
+   status = HE5_GDwritefield(GDid_MERCAT, "VerticalD", start, stride, edge, Buffer_mercat);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDwritefield(GDid_MERCAT, \"VerticalD\", start, stride, edge, Buffer_mercat); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDwritefield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDwritefield(GDid_MERCAT, \"VerticalD\", start, stride, edge, Buffer_mercat); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDwritefield()          %d\n",status););
+	 } 
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\t Writing field \"MaximumDepth\" to the grid AlbersGrid \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\t Writing field \"MaximumDepth\" to the grid AlbersGrid \n"););
+   
+   start[0] = 0;
+   start[1] = 0;
+   
+   stride[0] = 1;
+   stride[1] = 1;
+   
+   edge[0] = 351;
+   edge[1] = 171;
+   
+   status = HE5_GDwritefield(GDid_ALBERS, "MaximumDepth", start, stride, edge, Buffer_mercat);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDwritefield(GDid_ALBERS, \"MaximumDepth\", start, stride, edge, Buffer_mercat); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDwritefield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDwritefield(GDid_ALBERS, \"MaximumDepth\", start, stride, edge, Buffer_mercat); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDwritefield()          %d\n",status););
+	 } 
+   
+   
+   free(Buffer_mercat);
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\t Writing field \"Time\" to the grid UTM \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\t Writing field \"Time\" to the grid UTM \n"););
+   
+   edge[0] = 60;
+   edge[1] = 80;
+   
+   status = HE5_GDwritefield(GDid_UTM, "Time",start, stride, edge, time);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDwritefield(GDid_UTM, \"Time\", start, stride, edge, time); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDwritefield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDwritefield(GDid_UTM, \"Time\", start, stride, edge, time); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDwritefield()          %d\n",status););
+	 }    
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tWriting appendable field \"Vegetation\" to the grid UTM  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting appendable field \"Vegetation\" to the grid UTM  \n"););
+   
+   
+   edge[0]   = 200;
+   edge[1]   = 120;
+   
+   status = HE5_GDwritefield(GDid_UTM, "Vegetation", start, NULL, edge, veg);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDwritefield(GDid_UTM, \"Vegetation\", start, NULL, edge, veg); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDwritefield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDwritefield(GDid_UTM, \"Vegetation\", start, NULL, edge, veg); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDwritefield()          %d\n",status););
+	 } 
+   
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tAttaching to the grid lamcon  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););    
+   MESSAGE(11,fprintf(fp,"\t\tAttaching to the grid lamcon  \n"););
+   
+   GDid_LAMCON = HE5_GDattach(gdfidc_simple,"lamcon"); 
+   if (GDid_LAMCON == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully attached to the grid lamcon **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully attached to the grid lamcon **\n"););
+	 }
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\t Writing field \"Bypass\" to the grid lamcon \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\t Writing field \"Bypass\" to the grid lamcon \n"););
+   
+   edge[0] = 351;
+   edge[1] = 171;
+   
+   status = HE5_GDwritefield(GDid_LAMCON, "Bypass", start, NULL, edge, Buffer_LAMCON);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDwritefield(GDid_LAMCON, \"Bypass\", start, NULL, edge, Buffer_LAMCON); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDwritefield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDwritefield(GDid_LAMCON, \"Bypass\", start, NULL, edge, Buffer_LAMCON); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDwritefield()          %d\n",status););
+	 } 
+   
+   free(Buffer_UTM);
+   free(Buffer_LAMCON);
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDwriteattr                         *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDwriteattr... \n"););
+   MESSAGE(4,printf("\t========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDwriteattr... \n"););   
+   MESSAGE(11,fprintf(fp,"\t========================== \n"););
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tWriting attribute \"Resistance\" to the grid UTM  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting attribute \"Resistance\" to the grid UTM \n"););
+   
+   CurrentSize[0] = 4 ;
+   
+   Attr[0] = 1;
+   Attr[1] = 2;
+   Attr[2] = 3;
+   Attr[3] = 4;
+   
+   
+   status = HE5_GDwriteattr(GDid_UTM, "Resistance", H5T_NATIVE_INT, CurrentSize,Attr);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDwriteattr(GDid_UTM, \"Resistance\", H5T_NATIVE_INT, CurrentSize, Attr); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDwriteattr()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDwriteattr(GDid_UTM, \"Resistance\", H5T_NATIVE_INT, CurrentSize, Attr);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDwriteattr()          %d\n",status););
+	 }
+   
+  
+/*
+        *********************************************************************************
+        *                             Testing   HE5_GDwritegrpattr                      *
+        ********************************************************************************* 
+  */ 
+
+       MESSAGE(4,printf("\tTesting HE5_GDwritegrpattr... \n"););
+       MESSAGE(4,printf("\t========================== \n"););
+  
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\tTesting HE5_GDwritegrpattr... \n"););
+       MESSAGE(11,fprintf(fp,"\t========================== \n"););
+
+   
+       MESSAGE(6,printf("\n"););
+       MESSAGE(6,printf("\t\tWriting attribute \"GroupAttribute\" to the grid UTM  \n"););
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\t\tWriting attribute \"GroupAttribute\" to the grid UTM \n"););
+
+       status = HE5_GDwritegrpattr(GDid_UTM, "GroupAttribute", H5T_NATIVE_INT, Gsize, grpattr);
+       if (status == FAIL)
+       {
+         MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+         MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+         errcnt++;
+       }
+      else
+      {
+        MESSAGE(4,printf("\n"););
+        MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+        MESSAGE(11,fprintf(fp,"\n"););
+        MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+        MESSAGE(10,printf("\t\tstatus = HE5_GDwritegrpattr(GDid_UTM, \"GroupAttribute\", H5T_NATIVE_INT, CurrentSize, Attr); \n"););
+        MESSAGE(8,printf("\t\tStatus returned by HE5_GDwritegrpattr()           %d\n",status););
+        MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDwritegrpattr(GDid_UTM, \"GroupAtribute\", H5T_NATIVE_INT, CurrentSize, Attr);\n"););
+        MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDwritegrpattr()          %d\n",status););
+     }
+ 
+/*
+        *********************************************************************************
+        *                             Testing   HE5_GDwritelocattr                      *
+        *********************************************************************************
+*/  
+ 
+       MESSAGE(4,printf("\tTesting HE5_GDwritelocattr... \n"););
+       MESSAGE(4,printf("\t========================== \n"););
+ 
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\tTesting HE5_GDwritelocattr... \n"););
+       MESSAGE(11,fprintf(fp,"\t========================== \n"););
+     
+       MESSAGE(6,printf("\n"););
+       MESSAGE(6,printf("\t\tWriting attribute \"LocaAttribute\" to the field \"Vegetation\"  \n"););
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\t\tWriting attribute \"LocalAttribute\" to the \"Vegetation\" \n"););
+      
+       edge[0] = 4; 
+       status = HE5_GDwritelocattr(GDid_UTM, "Vegetation", "LocalAttribute", H5T_NATIVE_FLOAT, edge, attr);
+       if (status == FAIL)
+       {
+         MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+         MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+         errcnt++;
+       }
+      else
+      {
+        MESSAGE(4,printf("\n"););
+        MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+        MESSAGE(11,fprintf(fp,"\n"););
+        MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+        MESSAGE(10,printf("\t\tstatus =HE5_GDwritelocattr(GDid_UTM, \"Vegetation\", \"LocalAttribute\", H5T_NATIVE_FLOAT, edge, attr); \n"););
+        MESSAGE(8,printf("\t\tStatus returned by HE5_GDwritelocattr()         %d\n",status););
+        MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDwritelocattr(GDid_UTM, \"Vegetation\", \"LocalAttribute\", H5T_NATIVE_FLOAT, edge, attr); \n");); 
+        MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDwritelocattr()         %d\n",status););
+
+      }
+
+
+/*	*********************************************************************************
+	*                             Testing   HE5_GDgridinfo                          *
+	*********************************************************************************
+	*/
+   
+         MESSAGE(4,printf("\tTesting HE5_GDgridinfo... \n"););
+         MESSAGE(4,printf("\t========================= \n"););
+   
+         MESSAGE(11,fprintf(fp,"\t\n"););
+         MESSAGE(11,fprintf(fp,"\tTesting HE5_GDgridinfo... \n"););   
+         MESSAGE(11,fprintf(fp,"\t========================= \n"););
+   
+   
+         MESSAGE(6,printf("\n"););   
+         MESSAGE(6,printf("\t\tRetrieving information about the grid UTM \n"););   
+         MESSAGE(11,fprintf(fp,"\t\n"););
+         MESSAGE(11,fprintf(fp,"\t\tRetrieving information about the grid UTM \n"););
+   
+        status = HE5_GDgridinfo(GDid_UTM, &xdim, &ydim, uplft_out, lowrgt_out);
+        if (status == FAIL)
+	 {
+        MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+        MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDgridinfo(GDid_UTM, &xdim, &ydim, uplft_out, lowrgt_out); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDgridinfo()           %d \n",status););
+       MESSAGE(8,printf("\t\t\tX-dimension size is  %li\n", xdim););
+       MESSAGE(8,printf("\t\t\tY-dimension size is  %li\n", ydim););
+       MESSAGE(8,printf("\t\tCoordinates of UL point: %lf,  %lf \n", uplft_out[0], uplft_out[1] ););
+       MESSAGE(8,printf("\t\tCoordinates of LR point: %lf,  %lf \n", lowrgt_out[0], lowrgt_out[1] ););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDgridinfo(GDid_UTM, &xdim, &ydim, uplft_out, lowrgt_out); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDgridinfo()           %d \n",status););
+       MESSAGE(11,fprintf(fp,"\t\t\t X-dimension size is  %li\n", xdim););
+       MESSAGE(11,fprintf(fp,"\t\t\t Y-dimension size is  %li\n", ydim););
+       MESSAGE(11,fprintf(fp,"\t\tCoordinates of UL point: %lf,  %lf \n",  uplft_out[0], uplft_out[1] ););
+       MESSAGE(11,fprintf(fp,"\t\tCoordinates of LR point: %lf,  %lf \n", lowrgt_out[0], lowrgt_out[1] ););
+	 }
+
+     /*
+        *********************************************************************************
+        *                             Testing    HE5_GDgrpattrinfo                         *
+        *********************************************************************************
+        */
+ 
+      MESSAGE(4,printf("\n"););
+      MESSAGE(4,printf("\tTesting HE5_GDgrpattrinfo... \n"););
+      MESSAGE(4,printf("\t=========================\n"););
+ 
+      MESSAGE(11,fprintf(fp,"\n"););
+      MESSAGE(11,fprintf(fp,"\tTesting HE5_GDgrpattrinfo... \n"););
+      MESSAGE(11,fprintf(fp,"\t=========================\n"););
+ 
+      CountPtr        = (hsize_t *)calloc(1, sizeof(hsize_t));
+ 
+      MESSAGE(6,printf("\n"););
+      MESSAGE(6,printf("\t\tRetrieve information about attribute \"GroupAttribute\" \n"););
+      MESSAGE(11,fprintf(fp,"\n"););
+      MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attribute \"GroupAttribute\" \n"););
+ 
+      status=HE5_GDgrpattrinfo(GDid_UTM,"GroupAttribute",&dtype,CountPtr);
+      if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+   { 
+       MESSAGE(4,printf("\n");); 
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_GDgrpattrinfo(GDid_UTM,\"GroupAttribute\",&dtype,CountPtr);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by GDgrpattrinfo %d\n",status););
+       MESSAGE(6,printf("\t\tData type   Number of attribute elements:\n"););
+       MESSAGE(6,printf("\t\t   %d            %d\n", dtype,(int)*CountPtr););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_GDgrpattrinfo(GDid_UTM,\"GroupAttribute\",&dtype,CountPtr);\n"););
+
+       MESSAGE(11,fprintf(fp,"\t\tStaus returned by GDgrpattrinfo %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tData type   Number of attribute elements:\n"););
+       MESSAGE(11,fprintf(fp,"\t\t   %d            %d\n", dtype,(int)*CountPtr););
+         }
+ 
+
+   free(CountPtr);
+
+
+      /*
+        *********************************************************************************
+        *                             Testing    HE5_GDlocattrinfo                      *
+        *********************************************************************************
+        */
+        MESSAGE(4,printf("\n"););
+        MESSAGE(4,printf("\tTesting HE5_GDlocattrinfo... \n"););
+        MESSAGE(4,printf("\t=========================\n"););
+
+        MESSAGE(11,fprintf(fp,"\n"););
+        MESSAGE(11,fprintf(fp,"\tTesting HE5_GDlocattrinfo... \n"););
+        MESSAGE(11,fprintf(fp,"\t=========================\n"););
+
+        CountPtr        = (hsize_t *)calloc(1, sizeof(hsize_t));
+
+        MESSAGE(6,printf("\n"););
+        MESSAGE(6,printf("\t\tRetrieve information about attribute \"LocalAttribute\" \n"););
+        MESSAGE(11,fprintf(fp,"\n"););
+        MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attribute \"LocalAttribute\" \n"););
+
+        status=HE5_GDlocattrinfo(GDid_UTM,"Vegetation", "LocalAttribute",&dtype,CountPtr);
+        if (status == FAIL)
+         {
+        MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+        MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+        errcnt++;
+         }
+   else
+   {
+     MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_GDlocattrinfo(GDid_UTM, \"Vegetation\", \"LocalAttribute\", &dtype,CountPtr);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by GDlocattrinfo %d\n",status););
+       MESSAGE(6,printf("\t\tData type   Number of attribute elements:\n"););
+       MESSAGE(6,printf("\t\t   %d            %d\n", dtype,(int)*CountPtr););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_GDlocattrinfo(GDid_UTM, \"Vegetation\", \"LocalAttribute\",&dtype,CountPtr);\n"););
+
+       MESSAGE(11,fprintf(fp,"\t\tStaus returned by GDlocattrinfo %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tData type   Number of attribute elements:\n"););
+       MESSAGE(11,fprintf(fp,"\t\t   %d            %d\n", dtype,(int)*CountPtr););
+         }
+
+
+   free(CountPtr);
+
+  /*
+         *********************************************************************************
+         *                             Testing   HE5_GDtileinfo                          *
+         *********************************************************************************
+    */
+         MESSAGE(4,printf("\tTesting HE5_GDtileinfo............\n"););
+         MESSAGE(4,printf("\t======================== \n"););
+         MESSAGE(11,fprintf(fp,"\t\n"););
+         MESSAGE(11,fprintf(fp,"\tTesting HE5_GDtileinfo ... \n"););
+         MESSAGE(11,fprintf(fp,"\t======================== \n"););
+         MESSAGE(6,printf("\n"););
+         MESSAGE(6,printf("\t\tRetrieving tiling information about  a specific field in the  grid\n"););
+         MESSAGE(11,fprintf(fp,"\t\n"););
+         MESSAGE(11,fprintf(fp,"\t\t Retrieving information about  a specific field in the  grid\n"););
+
+         status = HE5_GDtileinfo(GDid_UTM, "Vegetation",&tilecode,&tilerank,tiledims);
+         if (status == FAIL)
+         {
+         MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+         MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+         errcnt++;
+         }
+    else
+         {
+         MESSAGE(4,printf("\n"););
+         MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+         MESSAGE(11,fprintf(fp,"\n"););
+         MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+         MESSAGE(10,printf("\t\tstatus = HE5_GDtileinfo(GDid_UTM, \"Vegetation\", &tilecode, &tilerank, tiledims); \n"););
+         MESSAGE(8,printf("\t\tStatus returned by HE5_GDtileinfo()           %d \n",status););
+         MESSAGE(8,printf("\t\t\tVegetation tile code: %d\n", tilecode););
+         MESSAGE(8,printf("\t\t\tVegetation tile rank: %d\n", tilerank););
+         for (i = 0; i < tilerank; i++)
+         
+         MESSAGE(11,printf("\t\tVegetation tile dimension %d: %lu\n",i+1, (unsigned long)tiledims[i]););
+         MESSAGE(11,printf("\t\tStatus returned by HE5_GDtileinfo()           %d \n",status););
+         MESSAGE(11,printf("\t\t\tVegetation tile code: %d\n", tilecode););
+         MESSAGE(11,printf("\t\t\tVegetation tile rank: %d\n", tilerank););
+         for (i = 0; i < tilerank; i++)
+         MESSAGE(11,printf("\t\tVegetation tile dimension %d: %lu\n",i+1, (unsigned long)tiledims[i]););
+         } 
+
+
+
+     /*
+         *********************************************************************************
+         *                             Testing   HE5_GDinqdatatype                       *
+         *********************************************************************************
+    */
+       MESSAGE(4,printf("\tTesting HE5_GDinqdatatype... \n"););
+       MESSAGE(4,printf("\t======================== \n"););
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\tTesting HE5_GDinqdatatype... \n"););
+       MESSAGE(11,fprintf(fp,"\t======================== \n"););
+
+       MESSAGE(6,printf("\n"););
+       MESSAGE(6,printf("\t\tRetrieving information about field data in a grid\n"););
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\t\t Retrieving information about field data in a grid\n"););
+    
+      fieldgroup = HE5_HDFE_DATAGROUP;
+      status = HE5_GDinqdatatype(GDid_UTM, "Vegetation", NULL, fieldgroup, &datatype, &classid, &order, &size);
+      if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+    else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+  /*   MESSAGE(4,printf("\tdatatype:    %d \n", (int)datatype););
+       MESSAGE(4,printf("\tclass ID:    %d \n", (int)classid););
+       MESSAGE(4,printf("\torder:       %d \n", (int)order);); 
+       MESSAGE(4,printf("\tsize:        %d \n", (int)size);); */
+       }
+    
+   fieldgroup = HE5_HDFE_ATTRGROUP;
+   status = HE5_GDinqdatatype(GDid_UTM, NULL, "Resistance", fieldgroup, &datatype, &classid, &order, &size);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+ else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+ /*    MESSAGE(4,printf("\tdatatype:    %d \n", (int)datatype););
+       MESSAGE(4,printf("\tclass ID:    %d \n", (int)classid););
+       MESSAGE(4,printf("\torder:       %d \n", (int)order););
+       MESSAGE(4,printf("\tsize:        %d \n", (int)size);); */
+       }
+  
+   fieldgroup = HE5_HDFE_GRPATTRGROUP;
+   status = HE5_GDinqdatatype(GDid_UTM, NULL, "GroupAttribute", fieldgroup, &datatype, &classid, &order, &size);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+ else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+ /*    MESSAGE(4,printf("\tdatatype:    %d \n", (int)datatype););
+       MESSAGE(4,printf("\tclass ID:    %d \n", (int)classid););
+       MESSAGE(4,printf("\torder:       %d \n", (int)order););
+       MESSAGE(4,printf("\tsize:        %d \n", (int)size);); */
+       }
+
+  fieldgroup = HE5_HDFE_LOCATTRGROUP;
+  status = HE5_GDinqdatatype(GDid_UTM,"Vegetation", "LocalAttribute", fieldgroup, &datatype, &classid, &order, &size);
+  if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+        }
+else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+ /*    MESSAGE(4,printf("\tdatatype:    %d \n", (int)datatype););
+       MESSAGE(4,printf("\tclass ID:    %d \n", (int)classid););
+       MESSAGE(4,printf("\torder:       %d \n", (int)order););
+       MESSAGE(4,printf("\tsize:        %d \n", (int)size);); */
+       }
+
+
+
+
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDinqdims                           *
+	*********************************************************************************
+	*/
+   
+       MESSAGE(4,printf("\tTesting HE5_GDinqdims... \n"););
+       MESSAGE(4,printf("\t======================== \n"););
+   
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\tTesting HE5_GDinqdims... \n"););   
+       MESSAGE(11,fprintf(fp,"\t======================== \n"););
+   
+   
+       MESSAGE(6,printf("\n"););   
+       MESSAGE(6,printf("\t\tRetrieving dimension information for the grid UTM \n"););   
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\t\tRetrieving dimension information for the grid UTM \n"););
+   
+       strcpy(str_buf,"NO ENTRY !");
+   
+       ndim = HE5_GDinqdims(GDid_UTM, str_buf, dims);
+       if (ndim == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tndim = HE5_GDinqdims(GDid_UTM, str_buf, dims); \n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_GDinqdims()           %d\n", ndim););
+       MESSAGE(8,printf("\t\tDimension list (%d):  %s\n", ndim, str_buf););
+
+       MESSAGE(11,fprintf(fp,"\t\tndim = HE5_GDinqdims(GDid_UTM, str_buf, dims);  \n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_GDinqdims()           %d\n",  ndim););
+       MESSAGE(11,fprintf(fp,"\t\tDimension list (%d):  %s\n", ndim, str_buf););
+	 }
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDdiminfo                           *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDdiminfo... \n"););
+   MESSAGE(4,printf("\t======================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDdiminfo... \n"););   
+   MESSAGE(11,fprintf(fp,"\t======================== \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving information about dimension \"Conduction\" in the grid UTM \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving information about dimension \"Conduction\" in the grid UTM\n"););
+   
+   ndims = HE5_GDdiminfo(GDid_UTM, "Conduction");
+   if (ndims == 0)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tndims = HE5_GDdiminfo(GDid_UTM, \"Conduction\");\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_GDdiminfo()           %lu\n", (unsigned long)ndims););
+       MESSAGE(8,printf("\t\t\"Conduction\" defines %lu - element dimension \n", (unsigned long)ndims););
+
+       MESSAGE(11,fprintf(fp,"\t\tndims = HE5_GDdiminfo(GDid_UTM, \"Conduction\"); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_GDdiminfo()           %lu \n",  (unsigned long)ndims););
+       MESSAGE(11,fprintf(fp,"\t\t\"Conduction\" defines %lu - element dimension \n", (unsigned long)ndims););
+	 }
+   
+       MESSAGE(6,printf("\t\n"););
+       MESSAGE(6,printf("\t\n"););
+       MESSAGE(6,printf("\t\tRetrieving information about dimension \"Timedim\" in the grid UTM \n");); 
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\t\n"););     
+       MESSAGE(11,fprintf(fp,"\t\t Retrieving information about dimension \"Timedim\" in the grid UTM\n"););
+   
+       ndims = HE5_GDdiminfo(GDid_UTM, "Timedim");
+       if (ndims == 0)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+        MESSAGE(4,printf("\n"););   
+        MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+        MESSAGE(11,fprintf(fp,"\n"););
+        MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+        MESSAGE(10,printf("\t\tndims = HE5_GDdiminfo(GDid_UTM, \"Timedim\");\n"););
+        MESSAGE(8,printf("\t\tValue returned by HE5_GDdiminfo()           %lu \n", (unsigned long)ndims););
+        MESSAGE(8,printf("\t\t\"Timedim\" defines %lu - element dimension \n", (unsigned long)ndims););
+
+        MESSAGE(11,fprintf(fp,"\t\tndims = HE5_GDdiminfo(GDid_UTM, \"Timedim\"); \n"););
+        MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_GDdiminfo()           %lu \n",(unsigned long)ndims););
+        MESSAGE(11,fprintf(fp,"\t\t\"Timedim\" defines %lu - element dimension \n", (unsigned long)ndims););
+	 }
+ 
+        ndims = HE5_GDdiminfo(GDid_UTM, "ExtDim");
+        if (ndims == 0)
+         {
+        MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+        MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+        errcnt++;
+         }
+   else
+         {  
+        MESSAGE(4,printf("\n"););  
+        MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+        MESSAGE(11,fprintf(fp,"\n"););
+        MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+        MESSAGE(10,printf("\t\tndims = HE5_GDdiminfo(GDid_UTM, \"ExtDim\");\n"););
+        MESSAGE(8,printf("\t\tValue returned by HE5_GDdiminfo()           %lu \n", (unsigned long)ndims););
+        MESSAGE(8,printf("\t\t\"ExtDim\" defines %lu - element dimension \n", (unsigned long)ndims););
+
+        MESSAGE(11,fprintf(fp,"\t\tndims = HE5_GDdiminfo(GDid_UTM, \"ExtDim\"); \n"););
+        MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_GDdiminfo()           %lu \n",(unsigned long)ndims););
+        MESSAGE(11,fprintf(fp,"\t\t\"ExtDim\" defines %lu - element dimension \n", (unsigned long)ndims););
+         }
+
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDprojinfo                          *
+	*********************************************************************************
+	*/
+   
+       MESSAGE(4,printf("\tTesting HE5_GDprojinfo... \n"););
+       MESSAGE(4,printf("\t========================= \n"););
+   
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\tTesting HE5_GDprojinfo... \n"););   
+       MESSAGE(11,fprintf(fp,"\t========================= \n"););
+   
+       MESSAGE(6,printf("\n"););   
+       MESSAGE(6,printf("\t\tRetrieving projection information from the grid UTM \n"););   
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\t\t Retrieving projection information from the grid UTM\n"););
+   
+       status = HE5_GDprojinfo(GDid_UTM, &proj_code, &z_code, &s_code, ProjParm_out);
+       if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus = HE5_GDprojinfo(GDid_UTM, &proj_code, &z_code, &s_code, ProjParm_out); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDprojinfo()           %d\n", status););
+       MESSAGE(8,printf("\t\t\t Projection Code =  %d\n", proj_code););
+       MESSAGE(8,printf("\t\t\t Z Code          =  %d\n", z_code););
+       MESSAGE(8,printf("\t\t\t S Code          =  %d\n", s_code););
+       MESSAGE(8,printf("\t\t\t Projection Parameters: \n"););
+	   for ( i = 0; i < 16; i++ )
+	     {
+		   MESSAGE(8,printf("\t\t\t     Parameter # %d  Value = %lf\n", i + 1, ProjParm_out[i]););
+		 
+	     }
+
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDprojinfo(GDid_UTM, &proj_code, &z_code, &s_code, ProjParm_out); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDprojinfo()           %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\t\t Projection Code =  %d\n", proj_code););
+       MESSAGE(11,fprintf(fp,"\t\t\t Z Code          =  %d\n", z_code););
+       MESSAGE(11,fprintf(fp,"\t\t\t S Code          =  %d\n", s_code););
+       MESSAGE(11,fprintf(fp,"\t\t\t Projection Parameters: \n"););
+	   for ( i = 0; i < 16; i++ )
+	     {
+		   MESSAGE(11,fprintf(fp,"\t\t\t     Parameter # %d  Value = %lf\n", i + 1, ProjParm_out[i]););
+		 
+	     }
+
+
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDorigininfo                        *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDorigininfo... \n"););
+   MESSAGE(4,printf("\t=========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDorigininfo... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving origin code for the grid UTM \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving origin code for the grid UTM\n"););
+   
+   status = HE5_GDorigininfo(GDid_UTM, &origin_code);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus = HE5_GDorigininfo(GDid_UTM, &origin_code);  \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDorigininfo()           %d\n", status););
+       MESSAGE(8,printf("\t\t\t Origin Code =  %d\n", origin_code););
+
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDorigininfo(GDid_UTM, &origin_code); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDorigininfo()           %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\t\t Origin Code =  %d\n", origin_code););
+
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDpixreginfo                        *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDpixreginfo... \n"););
+   MESSAGE(4,printf("\t=========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDpixreginfo... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving pixel registration code for the grid UTM \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving pixel registration code for the grid UTM\n"););
+   
+   status = HE5_GDpixreginfo(GDid_UTM, &pixreg_code);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus = HE5_GDpixreginfo(GDid_UTM, &pixreg_code);  \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDpixreginfo()           %d\n", status););
+       MESSAGE(8,printf("\t\t\tPixel Registration Code =  %d\n", pixreg_code););
+
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDpixreginfo(GDid_UTM, &pixreg_code); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDpixreginfo()           %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\t\tPixel Registration Code =  %d\n", pixreg_code););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDinqfields                         *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDinqfields... \n"););
+   MESSAGE(4,printf("\t========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDinqfields... \n"););   
+   MESSAGE(11,fprintf(fp,"\t========================== \n"););
+   
+   strcpy(str_buf, "NO ENTRY !");
+   ntype1 = (hid_t *)calloc(10, sizeof(hid_t)); 
+   rank = (int *)calloc(8, sizeof(int));
+   for ( i = 0; i < 8; i++)
+	 {
+	   rank[i] = FAIL;
+	 }
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving data fields information for the grid UTM \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving data fields information  for the grid UTM\n"););
+   
+   nflds = HE5_GDinqfields(GDid_UTM, str_buf, rank, ntype1);
+   if (nflds == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tnflds = HE5_GDinqfields(GDid_UTM, str_buf, rank, ntype1); \n"););
+       MESSAGE(8,printf("\t\tValue (# of data fields) returned by HE5_GDinqfields() %d \n", nflds););
+       MESSAGE(8,printf("\t\tList of data fields in the Grid:\n"););
+       MESSAGE(8,printf("\t\t\t%s\n", str_buf););
+       MESSAGE(8,printf("\t\tField data types:\n"););
+
+       for (i = 0; i < nflds; i++)
+		 {
+		   MESSAGE(8,printf("\t\t %d\n", (int)ntype1[i] ););
+		 }
+       MESSAGE(8,printf("\t\tField ranks:\n"););
+
+       for (i = 0; i < nflds; i++)
+		 {
+		   MESSAGE(8,printf("\t\t %d\n", rank[i] ););
+		 }
+
+       MESSAGE(11,fprintf(fp,"\t\tnflds = HE5_GDinqfields(GDid_UTM, str_buf, rank, ntype1); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue (# of data fields) returned by HE5_GDinqfields()        %d\n", nflds););
+       MESSAGE(11,fprintf(fp,"\t\tList of data fields in the Grid:\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t%s\n", str_buf););
+       MESSAGE(11,fprintf(fp,"\t\tField data types:\n"););
+
+       for (i = 0; i < nflds; i++)
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t %d\n", (int)ntype1[i] ););
+		 }
+       MESSAGE(11,fprintf(fp,"\t\tField ranks:\n"););
+
+       for (i = 0; i < nflds; i++)
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t %d\n", rank[i] ););
+		 }
+
+	 }
+   
+   free(rank);
+   free(ntype1);
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDfieldinfo                         *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDfieldinfo... \n"););
+   MESSAGE(4,printf("\t========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDfieldinfo... \n"););   
+   MESSAGE(11,fprintf(fp,"\t========================== \n"););
+   
+   
+   strcpy(str_buf, "NO ENTRY !");
+   ntype1 = (hid_t *)calloc(1, sizeof(hid_t));
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving information about \"Voltage\" field \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving information about \"Voltage\" field \n"););
+   
+   status = HE5_GDfieldinfo(GDid_UTM, "Voltage", &Rank, dims, ntype1, str_buf, NULL);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus = HE5_GDfieldinfo(GDid_UTM, \"Voltage\", &Rank, dims, ntype1, str_buf,NULL);  \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDfieldinfo()           %d\n", status););
+       MESSAGE(8,printf("\t\t\tRank of the field \"Voltage\" :\n"););
+       MESSAGE(8,printf("\t\t\t    %d\n", Rank););
+       MESSAGE(8,printf("\t\t\tDimension list for the field \"Voltage\" : \n"););
+       MESSAGE(8,printf("\t\t\t    %s \n", str_buf););
+       MESSAGE(8,printf("\t\t\tDimensions of the field \"Voltage\" : \n"););
+       for (i = 0; i < Rank; i++ )
+		 {
+		   MESSAGE(8,printf("\t\t\t    %lu \n", (unsigned long)dims[i]););
+		 }
+       MESSAGE(8,printf("\t\t\tData type of the field \"Voltage\" : \n"););
+       MESSAGE(8,printf("\t\t\t    %d \n", (int)ntype1[0]););
+
+
+       
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDfieldinfo(GDid_UTM, \"Voltage\", &Rank, dims, ntype1, str_buf,NULL);  \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDfieldinfo() %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\t\tRank of the field \"Voltage\" :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %d\n", Rank););
+       MESSAGE(11,fprintf(fp,"\t\t\tDimension list for the field \"Voltage\" : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %s \n", str_buf););
+       MESSAGE(11,fprintf(fp,"\t\t\tDimensions of the field \"Voltage\" : \n"););
+       for (i = 0; i < Rank; i++ )
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t\t    %lu \n", (unsigned long)dims[i]););
+		 }
+       MESSAGE(11,fprintf(fp,"\t\t\tData type of the field \"Voltage\" : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %d \n", (int)ntype1[0]););
+
+
+	 }
+   
+   
+   
+   strcpy(str_buf, "NO ENTRY !");
+   Rank = FAIL;
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving information about \"Drift\" field \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving information about \"Drift\" field \n"););
+   
+   status = HE5_GDfieldinfo(GDid_UTM, "Drift", &Rank, dims, ntype1, str_buf, NULL);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus = HE5_GDfieldinfo(GDid_UTM, \"Drift\", &Rank,dims, ntype1, str_buf, NULL);  \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDfieldinfo()           %d\n", status););
+       MESSAGE(8,printf("\t\t\tRank of the field \"Drift\" :\n"););
+       MESSAGE(8,printf("\t\t\t    %d\n", Rank););
+       MESSAGE(8,printf("\t\t\tDimension list for the field \"Drift\" : \n"););
+       MESSAGE(8,printf("\t\t\t    %s \n", str_buf););
+       MESSAGE(8,printf("\t\t\tDimensions of the field \"Drift\" : \n"););
+       for (i = 0; i < Rank; i++ )
+		 {
+		   MESSAGE(8,printf("\t\t\t    %lu \n", (unsigned long)dims[i]););
+		 }
+       MESSAGE(8,printf("\t\t\tData type of the field \"Drift\" : \n"););
+       MESSAGE(8,printf("\t\t\t    %d \n", (int)ntype1[0]););
+
+
+       
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDfieldinfo(GDid_UTM, \"Drift\",&Rank, dims, ntype1, str_buf, NULL);  \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDfieldinfo() %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\t\tRank of the field \"Drift\" :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %d\n", Rank););
+       MESSAGE(11,fprintf(fp,"\t\t\tDimension list for the field \"Drift\" : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %s \n", str_buf););
+       MESSAGE(11,fprintf(fp,"\t\t\tDimensions of the field \"Drift\" : \n"););
+       for (i = 0; i < Rank; i++ )
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t\t    %lu \n", (unsigned long)dims[i]););
+		 }
+       MESSAGE(11,fprintf(fp,"\t\t\tData type of the field \"Drift\" : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %d \n", (int)ntype1[0]););
+	 }
+   
+   
+   
+   
+   strcpy(str_buf, "NO ENTRY !");
+   strcpy(str_buf2, "NO ENTRY !");
+   
+   Rank = FAIL;
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving information about appendable \"Vegetation\" field \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving information about appendable \"Vegetation\" field \n"););
+   
+   status = HE5_GDfieldinfo(GDid_UTM, "Vegetation", &Rank, dims, ntype1, str_buf, str_buf2);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus = HE5_GDfieldinfo(GDid_UTM, \"Vegetation\", &Rank,dims, ntype1, str_buf, str_buf2);  \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDfieldinfo()           %d\n", status););
+       MESSAGE(8,printf("\t\t\tRank of the field \"Vegetation\" :\n"););
+       MESSAGE(8,printf("\t\t\t    %d\n", Rank););
+       MESSAGE(8,printf("\t\t\tDimension list for the field \"Vegetation\" : \n"););
+       MESSAGE(8,printf("\t\t\t    %s \n", str_buf););
+       MESSAGE(8,printf("\t\t\tMaximum Dimension list for the field \"Vegetation\" : \n"););
+       MESSAGE(8,printf("\t\t\t    %s \n", str_buf2););
+       MESSAGE(8,printf("\t\t\tDimensions of the field \"Vegetation\" : \n"););
+       for (i = 0; i < Rank; i++ )
+		 {
+		   MESSAGE(8,printf("\t\t\t    %lu \n", (unsigned long)dims[i]););
+		 }
+       MESSAGE(8,printf("\t\t\tData type of the field \"Vegetation\" : \n"););
+       MESSAGE(8,printf("\t\t\t    %d \n", (int)ntype1[0]););
+       
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDfieldinfo(GDid_UTM, \"Vegetation\",&Rank, dims, ntype1, str_buf, str_buf2);  \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDfieldinfo() %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\t\tRank of the field \"Vegetation\" :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %d\n", Rank););
+       MESSAGE(11,fprintf(fp,"\t\t\tDimension list for the field \"Vegetation\" : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %s \n", str_buf););
+       MESSAGE(11,fprintf(fp,"\t\t\tMaximum Dimension list for the field \"Vegetation\" : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %s \n", str_buf2););
+       MESSAGE(11,fprintf(fp,"\t\t\tDimensions of the field \"Vegetation\" : \n"););
+       for (i = 0; i < Rank; i++ )
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t\t    %lu \n", (unsigned long)dims[i]););
+		 }
+       MESSAGE(11,fprintf(fp,"\t\t\tData type of the field \"Vegetation\" : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %d \n", (int)ntype1[0]););
+	 }
+   
+   
+   free(ntype1);
+   free(str_buf2);
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDnentries                          *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDnentries... \n"););
+   MESSAGE(4,printf("\t========================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDnentries... \n"););   
+   MESSAGE(11,fprintf(fp,"\t========================= \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving number of Dimension entries in the grid UTM \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving number of Dimension entries in the grid UTM\n"););
+   
+   number = HE5_GDnentries(GDid_UTM, HE5_HDFE_NENTDIM, &list_size);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tnumber = HE5_GDnentries(GDid_UTM, HE5_HDFE_NENTDIM, &list_size); \n"););
+       MESSAGE(8,printf("\t\tNumber of Dimension entries in the grid =  %li\n", number););
+       MESSAGE(8,printf("\t\tThe size (in bytes) of dimension list string %li \n", list_size););
+
+       MESSAGE(11,fprintf(fp,"\t\tnumber = HE5_GDnentries(GDid_UTM, HE5_HDFE_NENTDIM, &list_size);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of Dimension entries in the grid =  %li\n", number););
+       MESSAGE(11,fprintf(fp,"\t\tThe size (in bytes) of dimension list string %li \n", list_size););
+
+	 }
+   
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tRetrieving number of Data Field entries in the grid UTM \n"););  
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving number of Data Field entries in the grid UTM\n"););
+   
+   list_size = FAIL;
+   
+   number = HE5_GDnentries(GDid_UTM, HE5_HDFE_NENTDFLD, &list_size);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tnumber = HE5_GDnentries(GDid_UTM, HE5_HDFE_NENTDFLD, &list_size); \n"););
+       MESSAGE(8,printf("\t\tNumber of Data Field entries in the grid =  %li\n", number););
+       MESSAGE(8,printf("\t\tThe size (in bytes) of a field list string %li \n", list_size););
+
+       MESSAGE(11,fprintf(fp,"\t\tnumber = HE5_GDnentries(GDid_UTM, HE5_HDFE_NENTDFLD, &list_size);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of Data Field entries in the grid =  %li\n", number););
+       MESSAGE(11,fprintf(fp,"\t\tThe size (in bytes) of a field list string %li \n", list_size););
+
+	 }
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDinqattrs                          *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDinqattrs... \n"););
+   MESSAGE(4,printf("\t========================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDinqattrs... \n"););   
+   MESSAGE(11,fprintf(fp,"\t========================= \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving information about attributes in the grid UTM \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving information about attributes in the grid UTM\n"););
+   
+   list_size = FAIL;
+   
+   number = HE5_GDinqattrs(GDid_UTM, NULL, &list_size);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tnumber = HE5_GDinqattrs(GDid_UTM, NULL, &list_size); \n"););
+       MESSAGE(8,printf("\t\tNumber of attributes in the grid =  %li\n", number););
+       MESSAGE(8,printf("\t\tThe size (in bytes) of attribute list string %li \n", list_size););
+
+       MESSAGE(11,fprintf(fp,"\t\tnumber = HE5_GDinqattrs(GDid_UTM, NULL, &list_size); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of attributes in the grid =  %li\n", number););
+       MESSAGE(11,fprintf(fp,"\t\tThe size (in bytes) of attribute list string %li \n", list_size););
+
+	 }
+   
+   
+   strcpy(str_buf,"NO ENTRY !");
+   list_size = FAIL;
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tRetrieving more information about attributes in the grid UTM \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving more information about attributes in the grid UTM\n"););
+   
+   number = HE5_GDinqattrs(GDid_UTM, str_buf, &list_size);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tnumber = HE5_GDinqattrs(GDid_UTM, str_buf, &list_size); \n"););
+       MESSAGE(8,printf("\t\tNumber of attributes in the grid =  %li\n", number););
+       MESSAGE(8,printf("\t\tThe list of attributes: %s \n", str_buf););
+       MESSAGE(8,printf("\t\tThe size (in bytes) of attribute list string %li \n", list_size););
+
+       MESSAGE(11,fprintf(fp,"\t\tnumber = HE5_GDinqattrs(GDid_UTM, str_buf, &list_size); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of attributes in the grid =  %li\n", number););
+       MESSAGE(11,fprintf(fp,"\t\tThe list of attributes:  %s \n", str_buf););
+       MESSAGE(11,fprintf(fp,"\t\tThe size (in bytes) of attribute list string %li \n", list_size););
+	 }
+  
+/*
+        *********************************************************************************
+        *                             Testing    HE5_GDinqlocattrs                      *
+        *********************************************************************************
+        */
+        MESSAGE(4,printf("\n"););
+        MESSAGE(4,printf("\tTesting HE5_GDinqlocattrs... \n"););
+        MESSAGE(4,printf("\t========================= \n"););
+
+        MESSAGE(11,fprintf(fp,"\t\n"););
+        MESSAGE(11,fprintf(fp,"\tTesting HE5_GDinqlocattrs... \n"););
+        MESSAGE(11,fprintf(fp,"\t========================= \n"););
+
+        MESSAGE(6,printf("\n"););
+        MESSAGE(6,printf("\t\tRetrieve information about attributes defined in Vegetation field \n"););
+        MESSAGE(11,fprintf(fp,"\n"););
+        MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attributes defined in Vegetation \n"););
+        
+        number = HE5_GDinqlocattrs(GDid_UTM, "Vegetation", NULL, &strbufsize);
+        if (number == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {
+           MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_GDinqlocattrs(GDid_UTM, \"Vegetation\", NULL, &strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_GDinqlocattrs(GDid_UTM, \"Vegetation\", NULL, &strbufsize);\n"););
+       MESSAGE(8,printf("\t\tValue (number of attributes) returned by GDinqlocattrs %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tValue (number of attributes) returned by GDinqlocattrs %li\n",number););
+       MESSAGE(8,printf("\t\tString length of attribute list:     %li\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tString length of attribute list:    %li\n",strbufsize););
+        }
+     
+       MESSAGE(6,printf("\n"););
+       MESSAGE(6,printf("\t\tRetrieve more information about attributes defined in vegetation field \n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\tRetrieve more information about attributes defined in vegetation field \n"););
+       
+       ObjNamesPtr     = (char  *)calloc( BUFSIZE, sizeof(char));
+       number = HE5_GDinqlocattrs(GDid_UTM, "Vegetation", ObjNamesPtr, &strbufsize);
+       if (number == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {
+            MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_GDinqlocattrs(GDid_UTM, Vegetation, ObjNamesPtr, &strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_GDinqlocattrs(GDid_UTM, Vegetation, ObjNamesPtr,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tNumber of attributes returned by GDinqlocattrs   %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of attributes returned by GDinqlocattr   %li\n",number););
+       MESSAGE(8,printf("\t\tAttribute list:\n"););
+       MESSAGE(8,printf("\t\t    %s\n", ObjNamesPtr););
+       MESSAGE(11,fprintf(fp,"\t\tAttribute list: \n"););
+       MESSAGE(11,fprintf(fp,"\t\t    %s\n", ObjNamesPtr););
+       MESSAGE(8,printf("\t\tString length of attribute list:     %li\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tString length of attribute list:      %li\n",strbufsize););
+         }
+  
+   free(ObjNamesPtr);
+   ObjNamesPtr = NULL;
+
+    
+    /*
+        *********************************************************************************
+        *                             Testing    HE5_GDinqgrpattrs                      *
+        *********************************************************************************
+        */
+
+           MESSAGE(4,printf("\n"););
+           MESSAGE(4,printf("\tTesting HE5_GDinqgrpattrs... \n"););
+           MESSAGE(4,printf("\t========================= \n"););
+
+           MESSAGE(11,fprintf(fp,"\t\n"););
+           MESSAGE(11,fprintf(fp,"\tTesting HE5_GDinqgrpattrs... \n"););
+           MESSAGE(11,fprintf(fp,"\t========================= \n"););
+
+           MESSAGE(6,printf("\n"););
+           MESSAGE(6,printf("\t\tRetrieve information about group attributes defined in grid UTM \n"););
+           MESSAGE(11,fprintf(fp,"\n"););
+           MESSAGE(11,fprintf(fp,"\t\tRetrieve information about group attributes defined in grid UTM \n"););
+
+          number = HE5_GDinqgrpattrs(GDid_UTM, NULL, &strbufsize);
+          if (number == FAIL)
+         {
+           MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+           MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+           errcnt++;
+         }
+        else
+        {
+          MESSAGE(4,printf("\n"););
+          MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+          MESSAGE(11,fprintf(fp,"\n"););
+          MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+          MESSAGE(10,printf("\t\tnumber=HE5_GDinqgrpattrs(GDid_UTM, NULL, &strbufsize);\n"););
+          MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_GDinqgrpattrs(GDid_UTM, NULL, &strbufsize);\n"););
+          MESSAGE(8,printf("\t\tValue (number of group attributes) returned by GDingrpqattrs %li\n",number););
+          MESSAGE(11,fprintf(fp,"\t\tValue (number of group attributes) returned by GDinqgrpattrs %li\n",number);)
+          MESSAGE(8,printf("\t\tString length of group attribute list:     %li\n",strbufsize););
+          MESSAGE(11,fprintf(fp,"\t\tString length of group attribute list:    %li\n",strbufsize););
+         }
+
+
+          MESSAGE(6,printf("\n"););
+          MESSAGE(6,printf("\t\tRetrieve more information about group attributes defined in swath INDEX \n"););
+          MESSAGE(11,fprintf(fp,"\n"););
+          MESSAGE(11,fprintf(fp,"\t\tRetrieve more information about group attributes defined in swath INDEX \n"););
+          ObjNamesPtr     = (char  *)calloc( BUFSIZE, sizeof(char));
+          number = HE5_GDinqgrpattrs(GDid_UTM, ObjNamesPtr, &strbufsize);
+          if (number == FAIL)
+         {
+          MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+          MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+          errcnt++;
+         }
+      else
+        {
+          MESSAGE(4,printf("\n"););
+          MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+          MESSAGE(11,fprintf(fp,"\n"););
+          MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+          MESSAGE(10,printf("\t\tnumber=HE5_GDinqgrpattrs(GDid_UTM, ObjNamesPtr, &strbufsize);\n"););
+          MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_GDinqgrpattrs(GDid_UTM, ObjNamesPtr,&strbufsize);\n"););
+          MESSAGE(8,printf("\t\tNumber of attributes returned by GDinqgrpattr    %li\n",number););
+          MESSAGE(11,fprintf(fp,"\t\tNumber of attributes returned by GDinqgrpattr    %li\n",number););
+          MESSAGE(8,printf("\t\tGroup Attribute list:\n"););
+          MESSAGE(8,printf("\t\t    %s\n", ObjNamesPtr););
+          MESSAGE(11,fprintf(fp,"\t\tGroup Attribute list: \n"););
+          MESSAGE(11,fprintf(fp,"\t\t    %s\n", ObjNamesPtr););
+          MESSAGE(8,printf("\t\tString length of Group attribute list:     %li\n",strbufsize););
+          MESSAGE(11,fprintf(fp,"\t\tString length of Group attribute list:      %li\n",strbufsize););
+         }
+
+      free(ObjNamesPtr);
+      ObjNamesPtr = NULL;
+ 
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDattrinfo                          *
+	*********************************************************************************
+	*/
+   
+         MESSAGE(4,printf("\tTesting HE5_GDattrinfo... \n"););
+         MESSAGE(4,printf("\t========================= \n"););
+   
+         MESSAGE(11,fprintf(fp,"\t\n"););
+         MESSAGE(11,fprintf(fp,"\tTesting HE5_GDattrinfo... \n"););   
+         MESSAGE(11,fprintf(fp,"\t========================= \n"););
+   
+   count = 0;
+   ntype = (hid_t *)calloc(1, sizeof(hid_t));   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving information about \"Resistance\" attribute \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving information about \"Resistance\" attribute \n"););
+   
+   status = HE5_GDattrinfo(GDid_UTM, "Resistance", ntype, &count );
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus = HE5_GDattrinfo(GDid_UTM, \"Resistance\", ntype, &count ); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDattrinfo()           %d\n", status););
+       MESSAGE(8,printf("\t\t\tData type of attribute \"Resistance\" :\n"););
+       MESSAGE(8,printf("\t\t\t    %d\n", (int)*ntype););
+       MESSAGE(8,printf("\t\t\tNumber of attribute elements : \n"););
+       MESSAGE(8,printf("\t\t\t    %lu \n", (unsigned long)count););
+
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDattrinfo(GDid_UTM, \"Resistance\", ntype, &count ); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDattrinfo()           %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\t\tData type of attribute \"Resistance\" :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %d\n", (int)*ntype););
+       MESSAGE(11,fprintf(fp,"\t\t\tNumber of attribute elements : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %lu \n", (unsigned long)count););
+
+	 }
+   
+   free(ntype);
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDreadattr                          *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDreadattr... \n"););
+   MESSAGE(4,printf("\t========================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDreadattr... \n"););   
+   MESSAGE(11,fprintf(fp,"\t========================= \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving the values of \"Resistance\" attribute \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving the values of \"Resistance\" attribute \n"););
+   
+   status = HE5_GDreadattr(GDid_UTM, "Resistance", Attr_out);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus = HE5_GDreadattr(GDid_UTM, \"Resistance\", Attr_out); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDreadattr()           %d\n", status););
+       MESSAGE(8,printf("\t\tThe values of attribute \"Resistance\" :\n"););
+       for (i = 0; i < (unsigned long)count; i++)
+		 {
+		   MESSAGE(8,printf("\t\t\t    %d \n", Attr_out[i]););
+		 }
+
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDreadattr(GDid_UTM, \"Resistance\", Attr_out); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDreadattr()           %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tThe values of attribute \"Resistance\" :\n"););
+       for (i = 0; i < (unsigned long)count; i++)
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t\t    %d \n", Attr_out[i]););
+		 }
+       
+	 }
+   
+  
+/*
+        *********************************************************************************
+        *                             Testing   HE5_GDreadfield                        *
+        **********************************************************************************
+        */
+        
+        MESSAGE(4,printf("\tTesting HE5_GDreadfield... \n"););
+        MESSAGE(4,printf("\t=========================== \n"););
+  
+        MESSAGE(11,fprintf(fp,"\t\n"););
+        MESSAGE(11,fprintf(fp,"\tTesting HE5_GDreadfield... \n"););
+        MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+       
+        MESSAGE(6,printf("\n"););
+        MESSAGE(6,printf("\t\tReading field \"Voltage\" from the grid UTM  \n"););
+        MESSAGE(11,fprintf(fp,"\t\n"););
+        MESSAGE(11,fprintf(fp,"\t\treading field \"Voltage\" from the grid UTM  \n"););  
+
+        start[0]  = 0;
+        start[1]  = 0;
+        stride[0] = 1;
+        stride[1] = 1;
+        edge[0]   = 50;
+        edge[1]   = 80;
+
+        VoltDataOut = (float *)calloc( 4800, sizeof(float) );
+        status = HE5_GDreadfield(GDid_UTM,"Voltage", start, stride, edge, VoltDataOut);
+        if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+       else
+       {
+       MESSAGE(4,printf("\n"););  
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_GDreadfield(GDid_UTM,\"Voltage\",start,stride,edge,VoltDataOut);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by GDreadfield %d\n", status ););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_GDreadfield(GDid_UTM,\"Voltage\",start,stride,edge,VoltDataOut);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by GDreadfield %d\n", status ););
+       MESSAGE(11,fprintf(fp,"\t\tFirst five values of \"Voltage\" field read\n"););
+       MESSAGE(11,fprintf(fp,"\t\tFirst five values of \"Voltage\" field read\n");); 
+       MESSAGE(8,printf("\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+         for (i = 0; i < 5; i++)
+          { 
+            MESSAGE(8 ,printf("\t\t %lf \n", VoltDataOut[i]););
+            MESSAGE(11,fprintf(fp,"\t\t       %lf\n", VoltDataOut[i]););
+          }
+       } 
+  
+   free(VoltDataOut);
+   VoltDataOut = NULL; 
+
+/*
+        *********************************************************************************
+        *                             Testing   HE5_GDreadgrpattr                       *
+        *********************************************************************************
+        */
+
+
+     MESSAGE(4,printf("\n"););
+     MESSAGE(4,printf("\tTesting HE5_GDreadgrpattr... \n"););
+     MESSAGE(4,printf("\t=========================\n"););
+     MESSAGE(11,fprintf(fp,"\n"););
+     MESSAGE(11,fprintf(fp,"\tTesting HE5_GDreadgrpattr... \n"););
+     MESSAGE(11,fprintf(fp,"\t=========================\n"););
+     MESSAGE(6,printf("\n"););
+     MESSAGE(6,printf("\t\tReading attribute GroupAttribute from grid UTM \n"););
+     MESSAGE(11,fprintf(fp,"\n"););
+     MESSAGE(11,fprintf(fp,"\t\tReading attribute GroupAttribute from grid UTM \n"););
+   
+   status = HE5_GDreadgrpattr(GDid_UTM,"GroupAttribute", gattrvalOut);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+   {
+      MESSAGE(4,printf("\n"););
+      MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+      MESSAGE(11,fprintf(fp,"\n"););
+      MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+      MESSAGE(10,printf("\t\tstatus = HE5_GDreadgrpattr(SWid_simple,\"GroupAttribute\", gattrvalOut);\n"););
+      MESSAGE(8,printf("\t\tValue returned by GDreadgrpattr for attribute GroupAttribute in grid UTM %d\n",status););
+      MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDreadgrpattr(GDid_UTM,\"GroupAttribute\", gattrvalOut);\n"););
+      MESSAGE(11,fprintf(fp,"\t\tValue returned by GDreadgrpattr for attribute GroupAttribute in grid UTM %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\t Attribute elements read \n"););
+       MESSAGE(8,printf("\t\t Attribute elements read \n"););
+       MESSAGE(8,printf("\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+           for( i = 0; i < 4 ; i++ )
+                 {
+                   MESSAGE(11,fprintf(fp,"\t\t            %d \n", gattrvalOut[ i ] ););
+                   MESSAGE(8,printf("\t\t               %d \n", gattrvalOut[ i ] ););
+                 }
+         }
+
+      /*
+        *********************************************************************************
+        *                             Testing   HE5_GDreadlocattr                       *
+        *********************************************************************************
+        */
+
+
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_GDreadlocattr... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDreadlocattr... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tReading attribute LocalAttribute from Vegetation field \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tReading attribute LocalAttribute from Vegetation field \n"););
+
+   status = HE5_GDreadlocattr(GDid_UTM, "Vegetation", "LocalAttribute", attrvalOut);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+   {
+      MESSAGE(4,printf("\n"););
+      MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+      MESSAGE(11,fprintf(fp,"\n"););
+      MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+      MESSAGE(10,printf("\t\tstatus = HE5_GDreadlocattr(GDid_UTM,\"Vegetation\", \"LocalAttribute\", attrvalOut);\n"););
+      MESSAGE(8,printf("\t\tValue returned by GDreadlocattr for attribute LocalAttribute in field Vegetation %d\n",status););
+      MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDreadlocattr(GDid_UTM,\"Vegetation\", \"LocalAttribute\", attrvalOut);\n"););
+      MESSAGE(11,fprintf(fp,"\t\tValue returned by GDreadlocattr for attribute LocalAttribute in field Vegetation %d\n",status);)
+;
+       MESSAGE(11,fprintf(fp,"\t\t Attribute elements read \n"););
+       MESSAGE(8,printf("\t\t Attribute elements read \n"););
+       MESSAGE(8,printf("\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+           for( i = 0; i < 4 ; i++ )
+                 {
+                   MESSAGE(11,fprintf(fp,"\t\t            %f \n", attrvalOut[ i ] ););
+                    MESSAGE(8,printf("\t\t               %f \n", attrvalOut[ i ] ););
+                 }
+         }
+
+/*
+	*********************************************************************************
+	*                             Testing   HE5_GDgetfillvalue                      *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDgetfillvalue... \n"););
+   MESSAGE(4,printf("\t============================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDgetfillvalue... \n"););   
+   MESSAGE(11,fprintf(fp,"\t============================= \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving the fill value for the \"Voltage\" data field \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving the fill value for the \"Voltage\" data field \n"););
+   
+   status = HE5_GDgetfillvalue(GDid_UTM, "Voltage", &fillvalue_inq);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus = HE5_GDgetfillvalue(GDid_UTM, \"Voltage\", &fillvalue_inq);\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDgetfillvalue()           %d\n", status););
+       MESSAGE(8,printf("\t\tThe fill value for field \"Voltage\" :\n"););
+       MESSAGE(8,printf("\t\t\t      \"%f\" \n", fillvalue_inq ););
+
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDgetfillvalue(GDid_UTM, \"Voltage\", &fillvalue_inq);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDgetfillvalue()           %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tThe fill value for field \"Voltage\" :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t     \"%f\" \n", fillvalue_inq ););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDgetpixels                         *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDgetpixels... \n"););
+   MESSAGE(4,printf("\t========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDgetpixels... \n"););   
+   MESSAGE(11,fprintf(fp,"\t========================== \n"););
+   
+   MESSAGE(6,printf("\t\tRetrieving the pixel rows and columns for specified longitude and latitude pairs  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving the pixel rows and columns for specified longitude and latitude pairs  \n"););
+   
+   LonVal[0] = -130.0;
+   LatVal[0] = 45.5;
+   
+   LonVal[1] = -128.0;
+   LatVal[1] = 44.5;
+   
+   LonVal[2] = -127.0;
+   LatVal[2] = 43.5;
+   
+   LonVal[3] = -126.0;
+   LatVal[3] = 42.5;
+   
+   LonVal[4] = -125.0;
+   LatVal[4] = 41.5;
+   
+   
+   NumPix = 5;
+   
+   RowVal = (long *)calloc(NumPix, sizeof(long));
+   ColVal = (long *)calloc(NumPix, sizeof(long));
+   
+   for (i =0; i < NumPix; i++)
+	 {
+       RowVal[i] = -1;
+       ColVal[i] = -1; 
+	 }
+   
+   
+   status = HE5_GDgetpixels(GDid_LAMCON, NumPix, LonVal, LatVal, RowVal, ColVal);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus = HE5_GDgetpixels(GDid_LAMCON, NumPix, LonVal, LatVal, RowVal, ColVal); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDgetpixels()           %d\n", status););
+       MESSAGE(8,printf("\t\t    Row        Column \n"););
+       for (i = 0; i < NumPix; i++)
+		 {
+		   MESSAGE(8,printf("\t\t    %li         %li \n", RowVal[i], ColVal[i]););
+		 }
+
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDgetpixels(GDid_LAMCON, NumPix, LonVal, LatVal, RowVal, ColVal); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDgetpixels()           %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\t    Row        Column \n"););
+       for (i = 0; i < NumPix; i++)
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t    %li         %li \n", RowVal[i], ColVal[i]););
+		 }
+       
+	 }
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDgetpixvalues                      *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDgetpixvalues... \n"););
+   MESSAGE(4,printf("\t============================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDgetpixvalues... \n"););   
+   MESSAGE(11,fprintf(fp,"\t============================= \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving the pixel values for specified row and column  pairs  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving the pixel values for specified row and column pairs  \n"););
+   
+   
+   NumPix = 3;
+   
+   RowVal[0] = 1;
+   ColVal[0] = 1;
+   
+   RowVal[1] = 1;
+   ColVal[1] = 2;
+   
+   RowVal[2] = 1;
+   ColVal[2] = 3;
+   
+   DatBuf = (float *)calloc(NumPix, sizeof(float));
+   
+   
+   BufSize = HE5_GDgetpixvalues(GDid_LAMCON,NumPix,RowVal,ColVal,"Bypass",NULL);
+   if (BufSize == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tBufSize = HE5_GDgetpixvalues(GDid_LAMCON,NumPix,RowVal,ColVal,\"Bypass\",NULL); \n"););
+       MESSAGE(8,printf("\t\tThe buffer size (in bytes) returned by HE5_GDgetpixvalues(): \n"););
+       MESSAGE(8,printf("\t\t    %li   (bytes)  \n", BufSize););
+
+       MESSAGE(11,fprintf(fp,"\t\tBufSize = HE5_GDgetpixvalues(GDid_LAMCON,NumPix,RowVal,ColVal,\"Bypass\",NULL); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tThe buffer size (in bytes) returned by HE5_GDgetpixvalues(): \n"););
+       MESSAGE(11,fprintf(fp,"\t\t    %li   (bytes)  \n", BufSize););
+
+       MESSAGE(6,printf("\t\n"););
+       MESSAGE(6,printf("\t\n"););
+       MESSAGE(6,printf("\t\tRetrieving the data  \n"););  
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\t\n");); 
+       MESSAGE(11,fprintf(fp,"\t\t Retrieving the data  \n"););
+
+       BufSize = HE5_GDgetpixvalues(GDid_LAMCON,NumPix,RowVal,ColVal,"Bypass",DatBuf);
+       if (BufSize == FAIL)
+		 {
+		   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+		   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+		 }
+       else
+		 {   
+           MESSAGE(4,printf("\n"););   
+		   MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+		   MESSAGE(11,fprintf(fp,"\n"););
+		   MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+		   MESSAGE(10,printf("\t\tBufSize = HE5_GDgetpixvalues(GDid_LAMCON,NumPix,RowVal,ColVal,\"Bypass\",DatBuf);\n"););
+		   MESSAGE(8,printf("\t\tBuffer values returned by HE5_GDgetpixvalues(): \n"););
+		   for (i = 0; i < NumPix; i++)
+			 {
+			   MESSAGE(8,printf("\t\t     %f \n", DatBuf[i]););
+			 }
+
+		   MESSAGE(11,fprintf(fp,"\t\tBufSize = HE5_GDgetpixvalues(GDid_LAMCON,NumPix,RowVal,ColVal,\"Bypass\",DatBuf);\n"););
+		   MESSAGE(11,fprintf(fp,"\t\tBuffer values returned by HE5_GDgetpixvalues(): \n"););
+		   for (i = 0; i < NumPix; i++)
+			 {
+			   MESSAGE(11,fprintf(fp,"\t\t     %f \n", DatBuf[i]););
+			 }
+	    
+		 }
+  
+	 }
+   
+   
+   
+   free(DatBuf);
+   free(RowVal);
+   free(ColVal);
+   
+   
+   /*
+	  -----------------------------------------------------------
+	  |         R E G I O N    S U B S E T T I N G              |
+	  -----------------------------------------------------------
+	  */
+   
+   
+   CorLon[0] = -150.0;
+   CorLon[1] = 120.0;
+   CorLat[0] = 60.0;
+   CorLat[1] = -40.0;
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDdefboxregion                      *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDdefboxregion... \n"););
+   MESSAGE(4,printf("\t============================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDdefboxregion... \n"););   
+   MESSAGE(11,fprintf(fp,"\t============================= \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tDefining the box region for the grid lamcon  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining the box region for the grid lamcon \n"););
+   
+   RegionID = HE5_GDdefboxregion(GDid_LAMCON, CorLon, CorLat);
+   if (RegionID == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tRegionID = HE5_GDdefboxregion(GDid_LAMCON, CorLon, CorLat); \n"););
+       MESSAGE(8,printf("\t\tRegion ID returned by HE5_GDdefboxregion()           %d\n", RegionID););
+
+       MESSAGE(11,fprintf(fp,"\t\tRegionID = HE5_GDdefboxregion(GDid_LAMCON, CorLon, CorLat); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tRegion ID returned by HE5_GDdefboxregion()           %d\n", RegionID););
+	 }
+   
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDregioninfo                        *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDregioninfo... \n"););
+   MESSAGE(4,printf("\t=========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDregioninfo... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving information about defined region  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving information about defined region \n"););
+   
+   Rank = FAIL; list_size = FAIL;
+   ntype1 = (hid_t *)calloc(1, sizeof(hid_t));
+   
+   status = HE5_GDregioninfo(GDid_LAMCON, RegionID, "Bypass", ntype1, &Rank, dims,&list_size, uplft_out, lowrgt_out);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus =   GDregioninfo(GDid_LAMCON, RegionID, \"Bypass\", ntype1, &Rank, dims,&list_size, uplft_out, lowrgt_out); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDregioninfo()           %d\n", status););
+       MESSAGE(8,printf("\t\t\tData type of region \"Bypass\" :\n"););
+       MESSAGE(8,printf("\t\t\t    %i\n", (int)*ntype1););
+       MESSAGE(8,printf("\t\t\tRank of the region :\n"););
+       MESSAGE(8,printf("\t\t\t    %d\n", Rank););
+       MESSAGE(8,printf("\t\t\tSize of the region :\n"););
+       MESSAGE(8,printf("\t\t\t    %li  (bytes)\n", list_size););
+       MESSAGE(8,printf("\t\t\tDimensions of the region : \n"););
+       for (i = 0; i < Rank; i++ )
+		 {
+		   MESSAGE(8,printf("\t\t\t    %lu \n", (unsigned long)dims[i]););
+		 }
+       MESSAGE(8,printf("\t\t\tCoordinates of the UL corner of the region : \n"););
+       MESSAGE(8,printf("\t\t\t    %lf      %lf \n", uplft_out[0], uplft_out[1] ););
+       MESSAGE(8,printf("\t\t\tCoordinates of the LR corner of the region : \n"););
+       MESSAGE(8,printf("\t\t\t    %lf      %lf \n", lowrgt_out[0], lowrgt_out[1] ););
+
+       MESSAGE(11,fprintf(fp,"\t\tstatus =   GDregioninfo(GDid_LAMCON, RegionID, \"Bypass\", ntype1, &Rank, dims,&list_size, uplft_out, lowrgt_out); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDregioninfo()           %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\t\tData type of region \"Bypass\" :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %i\n", (int)*ntype1););
+       MESSAGE(11,fprintf(fp,"\t\t\tRank of the region :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %d\n", Rank););
+       MESSAGE(11,fprintf(fp,"\t\t\tSize of the region :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %li  (bytes)\n", list_size););
+       MESSAGE(11,fprintf(fp,"\t\t\tDimensions of the region : \n"););
+       for (i = 0; i < Rank; i++ )
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t\t    %lu \n", (unsigned long)dims[i]););
+		 }
+       MESSAGE(11,fprintf(fp,"\t\t\tCoordinates of the UL corner of the region : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %lf      %lf \n", uplft_out[0], uplft_out[1] ););
+       MESSAGE(11,fprintf(fp,"\t\t\tCoordinates of the LR corner of the region : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %lf      %lf \n", lowrgt_out[0], lowrgt_out[1] ););
+	 }
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDextractregion                     *
+	*********************************************************************************
+	*/
+   
+          MESSAGE(4,printf("\tTesting HE5_GDextractregion... \n"););
+          MESSAGE(4,printf("\t============================== \n"););
+   
+          MESSAGE(11,fprintf(fp,"\t\n"););
+          MESSAGE(11,fprintf(fp,"\tTesting HE5_GDextractregion... \n"););   
+          MESSAGE(11,fprintf(fp,"\t============================== \n"););
+   
+          MESSAGE(6,printf("\n"););   
+          MESSAGE(6,printf("\t\tRead data into a buffer from a subsetted region  \n"););   
+          MESSAGE(11,fprintf(fp,"\t\n"););
+          MESSAGE(11,fprintf(fp,"\t\tRead data into a buffer from a subsetted region \n"););
+   
+          DatBuf = (float *)malloc(list_size);
+          status = HE5_GDextractregion(GDid_LAMCON, RegionID, "Bypass", DatBuf);
+         if (status == FAIL)
+	 {
+         MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus = HE5_GDextractregion(GDid_LAMCON, RegionID, \"Bypass\", DatBuf); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDextractregion()           %d\n", status););
+       MESSAGE(8,printf("\t\tThe first ten values from region \"Bypass\" are: \n"););
+       for (i = 0; i < 10; i++)
+		 {
+		   MESSAGE(8,printf("\t\t    %f \n", DatBuf[i]););
+		 }
+    
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDextractregion(GDid_LAMCON, RegionID, \"Bypass\", DatBuf); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDextractregion()           %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tThe first ten values from region \"Bypass\" are: \n"););
+       for (i = 0; i < 10; i++)
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t    %f \n", DatBuf[i]););
+		 }
+
+	 }
+   
+   free(DatBuf);
+   free(ntype1);
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDdupregion                         *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDdupregion... \n"););
+   MESSAGE(4,printf("\t========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDdupregion... \n"););   
+   MESSAGE(11,fprintf(fp,"\t========================== \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tDuplicating  the box region \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDuplicating the box region \n"););
+   
+   NewRegionID = HE5_GDdupregion(RegionID);
+   if (NewRegionID == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tNewRegionID = HE5_GDdupregion(RegionID); \n"););
+       MESSAGE(8,printf("\t\tNew region ID returned by HE5_GDdupregion()           %d\n", NewRegionID););
+       MESSAGE(11,fprintf(fp,"\t\tNewRegionID = HE5_GDdupregion(RegionID); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tNew region ID returned by HE5_GDdupregion()           %d\n", NewRegionID););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDdefboxregion                      *
+	*********************************************************************************
+	*/
+   
+   
+   CorLon[ 0 ] = -175.;
+   CorLon[ 1 ] =  175.;
+   CorLat[ 0 ] =   85.;
+   CorLat[ 1 ] =  -85.;
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tDefining the box region for the grid MercatGrid  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining the box region for the grid MercatGrid \n"););
+   
+   RegionID = HE5_GDdefboxregion(GDid_MERCAT, CorLon, CorLat);
+   if (RegionID == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tRegionID = HE5_GDdefboxregion(GDid_MERCAT, CorLon, CorLat); \n"););
+       MESSAGE(8,printf("\t\tRegion ID returned by HE5_GDdefboxregion()           %d\n", RegionID););
+
+       MESSAGE(11,fprintf(fp,"\t\tRegionID = HE5_GDdefboxregion(GDid_MERCAT, CorLon, CorLat); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tRegion ID returned by HE5_GDdefboxregion()           %d\n", RegionID););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDregioninfo                        *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving information about defined region  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving information about defined region \n"););
+   
+   Rank = FAIL;
+   list_size = FAIL;
+   ntype1 = (hid_t *)calloc(1, sizeof(hid_t));
+   
+   status = HE5_GDregioninfo(GDid_MERCAT, RegionID, "VerticalD", ntype1, &Rank, dims,&list_size, uplft_out, lowrgt_out);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus =   GDregioninfo(GDid_MERCAT, RegionID, \"VerticalD\", ntype1, &Rank, dims,&list_size, uplft_out, lowrgt_out); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDregioninfo()           %d\n", status););
+       MESSAGE(8,printf("\t\t\tData type of region \"VerticalD\" :\n"););
+       MESSAGE(8,printf("\t\t\t    %i\n", (int)*ntype1););
+       MESSAGE(8,printf("\t\t\tRank of the region :\n"););
+       MESSAGE(8,printf("\t\t\t    %d\n", Rank););
+       MESSAGE(8,printf("\t\t\tSize of the region :\n"););
+       MESSAGE(8,printf("\t\t\t    %li  (bytes)\n", list_size););
+       MESSAGE(8,printf("\t\t\tDimensions of the region : \n"););
+       for (i = 0; i < Rank; i++ )
+		 {
+		   MESSAGE(8,printf("\t\t\t    %lu \n", (unsigned long)dims[i]););
+		 }
+       MESSAGE(8,printf("\t\t\tCoordinates of the UL corner of the region : \n"););
+       MESSAGE(8,printf("\t\t\t    %lf      %lf \n", uplft_out[0], uplft_out[1] ););
+       MESSAGE(8,printf("\t\t\tCoordinates of the LR corner of the region : \n"););
+       MESSAGE(8,printf("\t\t\t    %lf      %lf \n", lowrgt_out[0], lowrgt_out[1] ););
+
+       MESSAGE(11,fprintf(fp,"\t\tstatus =   GDregioninfo(GDid_MERCAT, RegionID, \"VerticalD\", ntype1, &Rank, dims,&list_size, uplft_out, lowrgt_out); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDregioninfo()           %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\t\tData type of region \"VerticalD\" :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %i\n", (int)*ntype1););
+       MESSAGE(11,fprintf(fp,"\t\t\tRank of the region :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %d\n", Rank););
+       MESSAGE(11,fprintf(fp,"\t\t\tSize of the region :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %li  (bytes)\n", list_size););
+       MESSAGE(11,fprintf(fp,"\t\t\tDimensions of the region : \n"););
+       for (i = 0; i < Rank; i++ )
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t\t    %lu \n", (unsigned long)dims[i]););
+		 }
+       MESSAGE(11,fprintf(fp,"\t\t\tCoordinates of the UL corner of the region : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %lf      %lf \n", uplft_out[0], uplft_out[1] ););
+       MESSAGE(11,fprintf(fp,"\t\t\tCoordinates of the LR corner of the region : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %lf      %lf \n", lowrgt_out[0], lowrgt_out[1] ););
+	 }
+   
+
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDextractregion                     *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRead data into a buffer from a subsetted region  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRead data into a buffer from a subsetted region \n"););
+   
+   DatBuf = (float *)malloc(list_size);
+   status = HE5_GDextractregion(GDid_MERCAT, RegionID, "VerticalD", DatBuf);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus = HE5_GDextractregion(GDid_MERCAT, RegionID, \"VerticalD\", DatBuf); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDextractregion()           %d\n", status););
+       MESSAGE(8,printf("\t\tThe first ten values from region \"VerticalD\" are: \n"););
+       for (i = 0; i < 10; i++)
+		 {
+		   MESSAGE(8,printf("\t\t    %f \n", DatBuf[i]););
+		 }
+    
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDextractregion(GDid_MERCAT, RegionID, \"VerticalD\", DatBuf); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDextractregion()           %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tThe first ten values from region \"VerticalD\" are: \n"););
+       for (i = 0; i < 10; i++)
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t    %f \n", DatBuf[i]););
+		 }
+
+	 }
+   
+   free(DatBuf);
+   free(ntype1);
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDdefboxregion                      *
+	*********************************************************************************
+	*/
+   
+   
+   CorLon[ 0 ] = -175.;
+   CorLon[ 1 ] =  175.;
+   CorLat[ 0 ] =   85.;
+   CorLat[ 1 ] =  -85.;
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tDefining the box region for the grid AlbersGrid  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining the box region for the grid AlbersGrid \n"););
+   
+   RegionID = HE5_GDdefboxregion(GDid_ALBERS, CorLon, CorLat);
+   if (RegionID == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tRegionID = HE5_GDdefboxregion(GDid_ALBERS, CorLon, CorLat); \n"););
+       MESSAGE(8,printf("\t\tRegion ID returned by HE5_GDdefboxregion()           %d\n", RegionID););
+
+       MESSAGE(11,fprintf(fp,"\t\tRegionID = HE5_GDdefboxregion(GDid_ALBERS, CorLon, CorLat); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tRegion ID returned by HE5_GDdefboxregion()           %d\n", RegionID););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDregioninfo                        *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving information about defined region  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving information about defined region \n"););
+   
+   Rank = FAIL;
+   list_size = FAIL;
+   ntype1 = (hid_t *)calloc(1, sizeof(hid_t));
+   
+   status = HE5_GDregioninfo(GDid_ALBERS, RegionID, "MaximumDepth", ntype1, &Rank, dims,&list_size, uplft_out, lowrgt_out);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus =   GDregioninfo(GDid_ALBERS, RegionID, \"MaximumDepth\", ntype1, &Rank, dims,&list_size, uplft_out, lowrgt_out); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDregioninfo()           %d\n", status););
+       MESSAGE(8,printf("\t\t\tData type of region \"MaximumDepth\" :\n"););
+       MESSAGE(8,printf("\t\t\t    %i\n", (int)*ntype1););
+       MESSAGE(8,printf("\t\t\tRank of the region :\n"););
+       MESSAGE(8,printf("\t\t\t    %d\n", Rank););
+       MESSAGE(8,printf("\t\t\tSize of the region :\n"););
+       MESSAGE(8,printf("\t\t\t    %li  (bytes)\n", list_size););
+       MESSAGE(8,printf("\t\t\tDimensions of the region : \n"););
+       for (i = 0; i < Rank; i++ )
+		 {
+		   MESSAGE(8,printf("\t\t\t    %lu \n", (unsigned long)dims[i]););
+		 }
+       MESSAGE(8,printf("\t\t\tCoordinates of the UL corner of the region : \n"););
+       MESSAGE(8,printf("\t\t\t    %lf      %lf \n", uplft_out[0], uplft_out[1] ););
+       MESSAGE(8,printf("\t\t\tCoordinates of the LR corner of the region : \n"););
+       MESSAGE(8,printf("\t\t\t    %lf      %lf \n", lowrgt_out[0], lowrgt_out[1] ););
+
+       MESSAGE(11,fprintf(fp,"\t\tstatus =   GDregioninfo(GDid_ALBERS, RegionID, \"MaximumDepth\", ntype1, &Rank, dims,&list_size, uplft_out, lowrgt_out); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDregioninfo()           %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\t\tData type of region \"MaximumDepth\" :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %i\n", (int)*ntype1););
+       MESSAGE(11,fprintf(fp,"\t\t\tRank of the region :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %d\n", Rank););
+       MESSAGE(11,fprintf(fp,"\t\t\tSize of the region :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %li  (bytes)\n", list_size););
+       MESSAGE(11,fprintf(fp,"\t\t\tDimensions of the region : \n"););
+       for (i = 0; i < Rank; i++ )
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t\t    %lu \n", (unsigned long)dims[i]););
+		 }
+       MESSAGE(11,fprintf(fp,"\t\t\tCoordinates of the UL corner of the region : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %lf      %lf \n", uplft_out[0], uplft_out[1] ););
+       MESSAGE(11,fprintf(fp,"\t\t\tCoordinates of the LR corner of the region : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %lf      %lf \n", lowrgt_out[0], lowrgt_out[1] ););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDextractregion                     *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRead data into a buffer from a subsetted region  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRead data into a buffer from a subsetted region \n"););
+   
+   DatBuf = (float *)malloc(list_size);
+   status = HE5_GDextractregion(GDid_ALBERS, RegionID, "MaximumDepth", DatBuf);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus = HE5_GDextractregion(GDid_ALBERS, RegionID, \"MaximumDepth\", DatBuf); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDextractregion()           %d\n", status););
+       MESSAGE(8,printf("\t\tThe first ten values from region \"MaximumDepth\" are: \n"););
+       for (i = 0; i < 10; i++)
+		 {
+		   MESSAGE(8,printf("\t\t    %f \n", DatBuf[i]););
+		 }
+    
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDextractregion(GDid_ALBERS, RegionID, \"MaximumDepth\", DatBuf); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDextractregion()           %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tThe first ten values from region \"MaximumDepth\" are: \n"););
+       for (i = 0; i < 10; i++)
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t    %f \n", DatBuf[i]););
+		 }
+
+	 }
+   
+   free(DatBuf);
+   free(ntype1);
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDdeftimeperiod                     *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDdeftimeperiod... \n"););
+   MESSAGE(4,printf("\t============================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDdeftimeperiod... \n"););   
+   MESSAGE(11,fprintf(fp,"\t============================== \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tDefining a time period for the grid UTM  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining a time period for the grid UTM \n"););
+   
+   StartTime = 35233000.8;
+   StopTime  = 35435050.9;
+   
+   
+   PeriodID = HE5_GDdeftimeperiod(GDid_UTM, HE5_HDFE_NOPREVSUB, StartTime,StopTime);
+   if (PeriodID == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\t PeriodID = HE5_GDdeftimeperiod(GDid_UTM, HE5_HDFE_NOPREVSUB, StartTime,StopTime);\n"););
+       MESSAGE(8,printf("\t\tPeriod ID returned by HE5_GDdeftimeperiod()           %d\n", PeriodID););
+       MESSAGE(11,fprintf(fp,"\t\t PeriodID = HE5_GDdeftimeperiod(GDid_UTM, HE5_HDFE_NOPREVSUB, StartTime,StopTime);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tPeriod ID returned by HE5_GDdeftimeperiod()           %d\n", PeriodID););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDinterpolate                       *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_GDinterpolate... \n"););
+   MESSAGE(4,printf("\t============================ \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDinterpolate... \n"););   
+   MESSAGE(11,fprintf(fp,"\t============================ \n"););
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tPerforming bilinear interpolation on a grid field  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Performing bilinear interpolation on a grid field\n"););
+   
+   LonVal[0] = -129.5;
+   LatVal[0] =  45.8;
+   
+   LonVal[1] = -128.5;
+   LatVal[1] =  44.8;
+   
+   LonVal[2] = -127.5;
+   LatVal[2] =  43.8;
+   
+   LonVal[3] = -126.5;
+   LatVal[3] =  42.8;
+   
+   LonVal[4] = -125.5;
+   LatVal[4] =  41.8;
+   
+   BufSize = HE5_GDinterpolate(GDid_LAMCON,5,LonVal,LatVal,"Bypass",NULL);
+   if (BufSize == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tBufSize = HE5_GDinterpolate(GDid_LAMCON,5,LonVal,LatVal,\"Bypass\",NULL);\n"););
+       MESSAGE(8,printf("\t\tSize of interpolated data values returned by HE5_GDinterpolate(): \n"););
+       MESSAGE(8,printf("\t\t    %li (bytes) \n", BufSize););
+
+       MESSAGE(11,fprintf(fp,"\t\tBufSize = HE5_GDinterpolate(GDid_LAMCON,5,LonVal,LatVal,\"Bypass\",NULL);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tSize of interpolated data values returned by HE5_GDinterpolate(): \n"););
+       MESSAGE(11,fprintf(fp,"\t\t    %li (bytes) \n", BufSize););
+
+
+	   DatBuf2 = (double *)malloc(BufSize);
+	   for ( i = 0; i < BufSize/sizeof(double); i++)
+		 {
+		   DatBuf2[ i ] = - 1.111111111 ;
+		 }
+
+       MESSAGE(6,printf("\t\n"););
+       MESSAGE(6,printf("\t\n"););
+       MESSAGE(6,printf("\t\tContinue bilinear interpolation on a grid field \n");); 
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\t\n");); 
+       MESSAGE(11,fprintf(fp,"\t\t Continue bilinear interpolation on a grid field\n"););
+
+	   BufSize = HE5_GDinterpolate(GDid_LAMCON,5,LonVal,LatVal,"Bypass",DatBuf2);
+	   if (BufSize == FAIL)
+		 {
+           MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+           MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+		 }
+	   else
+		 {   
+		   MESSAGE(4,printf("\n"););   
+		   MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+		   MESSAGE(11,fprintf(fp,"\n"););
+		   MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+		   MESSAGE(10,printf("\t\tBufSize = HE5_GDinterpolate(GDid_LAMCON,5,LonVal,LatVal,\"Bypass\",DatBuf2);\n"););
+		   MESSAGE(8,printf("\t\tBuffer values returned by HE5_GDinterpolate(): \n"););
+		   for (i = 0; i < BufSize/sizeof(double); i++)
+			 {
+			   MESSAGE(8,printf("\t\t   %lf\n", DatBuf2[i]););
+			 }
+
+		   MESSAGE(11,fprintf(fp,"\t\tBufSize = HE5_GDinterpolate(GDid_LAMCON,5,LonVal,LatVal,\"Bypass\",DatBuf2);\n"););
+		   MESSAGE(11,fprintf(fp,"\t\tBuffer values returned by HE5_GDinterpolate():  \n"););
+		   for (i = 0; i < BufSize/sizeof(double); i++)
+			 {
+			   MESSAGE(11,fprintf(fp,"\t\t   %lf\n", DatBuf2[i]););
+			 }
+		 }
+
+	   free(DatBuf2);
+	 }
+   
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_GDdetach                            *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\tTesting HE5_GDdetach... \n"););
+   MESSAGE(4,printf("\t=======================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDdetach... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid UTM  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid UTM \n"););
+   
+   status = HE5_GDdetach(GDid_UTM);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid UTM **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid UTM **\n"););
+	 }
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tAttaching to the grid UTM  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tAttaching to the grid UTM  \n"););
+   
+   GDid_UTM  = HE5_GDattach(gdfidc_simple,"UTM"); 
+   if (GDid_UTM == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully attached to the grid UTM **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully attached to the grid UTM **\n"););
+	 }
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tWriting appendable field \"Vegetation\" to the grid UTM  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting appendable field \"Vegetation\" to the grid UTM  \n"););
+   
+   
+   start[0]  = 100;
+   start[1]  = 200;
+   
+   edge[0]   = 200;
+   edge[1]   = 120;
+   
+   status = HE5_GDwritefield(GDid_UTM, "Vegetation", start, NULL, edge, veg);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_GDwritefield(GDid_UTM, \"Vegetation\", start, NULL, edge, veg); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDwritefield()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDwritefield(GDid_UTM, \"Vegetation\", start, NULL, edge, veg); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDwritefield()          %d\n",status););
+	 } 
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid UTM  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid UTM \n"););
+   
+   status = HE5_GDdetach(GDid_UTM);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid UTM **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid UTM **\n"););
+	 }
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tAttaching to the grid UTM  \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tAttaching to the grid UTM  \n"););
+   
+   GDid_UTM  = HE5_GDattach(gdfidc_simple,"UTM"); 
+   if (GDid_UTM == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully attached to the grid UTM **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully attached to the grid UTM **\n"););
+	 }
+   ntype1 = (hid_t *)calloc(2, sizeof(hid_t)); 
+   str_buf2  = (char *)calloc(256, sizeof(char));
+   
+   strcpy(str_buf, "NO ENTRY !");
+   strcpy(str_buf2, "NO ENTRY !");
+   
+   Rank = FAIL;
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving information about appendable \"Vegetation\" field \n"););   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving information about appendable \"Vegetation\" field \n"););
+   
+   status = HE5_GDfieldinfo(GDid_UTM, "Vegetation", &Rank, dims, ntype1, str_buf, str_buf2);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus = HE5_GDfieldinfo(GDid_UTM, \"Vegetation\", &Rank,dims, ntype1, str_buf, str_buf2);  \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDfieldinfo()           %d\n", status););
+       MESSAGE(8,printf("\t\t\tRank of the field \"Vegetation\" :\n"););
+       MESSAGE(8,printf("\t\t\t    %d\n", Rank););
+       MESSAGE(8,printf("\t\t\tDimension list for the field \"Vegetation\" : \n"););
+       MESSAGE(8,printf("\t\t\t    %s \n", str_buf););
+       MESSAGE(8,printf("\t\t\tMaximum Dimension list for the field \"Vegetation\" : \n"););
+       MESSAGE(8,printf("\t\t\t    %s \n", str_buf2););
+       MESSAGE(8,printf("\t\t\tDimensions of the field \"Vegetation\" : \n"););
+       for (i = 0; i < Rank; i++ )
+		 {
+		   MESSAGE(8,printf("\t\t\t    %lu \n", (unsigned long)dims[i]););
+		 }
+       MESSAGE(8,printf("\t\t\tData type of the field \"Vegetation\" : \n"););
+       MESSAGE(8,printf("\t\t\t    %d \n", (int)ntype1[0]););
+       
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDfieldinfo(GDid_UTM, \"Vegetation\",&Rank, dims, ntype1, str_buf, str_buf2);  \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDfieldinfo() %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\t\tRank of the field \"Vegetation\" :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %d\n", Rank););
+       MESSAGE(11,fprintf(fp,"\t\t\tDimension list for the field \"Vegetation\" : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %s \n", str_buf););
+       MESSAGE(11,fprintf(fp,"\t\t\tMaximum Dimension list for the field \"Vegetation\" : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %s \n", str_buf2););
+       MESSAGE(11,fprintf(fp,"\t\t\tDimensions of the field \"Vegetation\" : \n"););
+       for (i = 0; i < Rank; i++ )
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t\t    %lu \n", (unsigned long)dims[i]););
+		 }
+       MESSAGE(11,fprintf(fp,"\t\t\tData type of the field \"Vegetation\" : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %d \n", (int)ntype1[0]););
+	 }
+   
+   
+   free(ntype1);
+   free(str_buf2);
+   
+   
+
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDefining the box region for the grid EASE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining the box region for the grid EASE \n"););
+
+   CorLon[ 0 ] = -180.0;
+   CorLon[ 1 ] =  0.0;
+   CorLat[ 0 ] =  86.72;
+   CorLat[ 1 ] =  0.0;
+
+   RegionID = HE5_GDdefboxregion(GDid_EASE, CorLon, CorLat);
+   if (RegionID == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tRegionID = HE5_GDdefboxregion(GDid_EASE, CorLon, CorLat); \n"););
+       MESSAGE(8,printf("\t\tRegion ID returned by HE5_GDdefboxregion()           %d\n", RegionID););
+
+       MESSAGE(11,fprintf(fp,"\t\tRegionID = HE5_GDdefboxregion(GDid_EASE, CorLon, CorLat); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tRegion ID returned by HE5_GDdefboxregion()           %d\n", RegionID););
+         }
+
+
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieving information about defined region  \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\t Retrieving information about defined region \n"););
+
+   Rank = FAIL;
+   list_size = FAIL;
+   ntype1 = (hid_t *)calloc(1, sizeof(hid_t));
+
+   status = HE5_GDregioninfo(GDid_EASE, RegionID, "Intensity", ntype1, &Rank, dims,&list_size, uplft_out, lowrgt_out);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+
+       MESSAGE(10,printf("\t\tstatus =   GDregioninfo(GDid_EASE, RegionID, \"Intensity\", ntype1, &Rank, dims,&list_size, uplft_out, lowrgt_out); \n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_GDregioninfo()           %d\n", status););
+       MESSAGE(8,printf("\t\t\tData type of region \"Intensity\" :\n"););
+       MESSAGE(8,printf("\t\t\t    %i\n", (int)*ntype1););
+       MESSAGE(8,printf("\t\t\tRank of the region :\n"););
+       MESSAGE(8,printf("\t\t\t    %d\n", Rank););
+       MESSAGE(8,printf("\t\t\tSize of the region :\n"););
+       MESSAGE(8,printf("\t\t\t    %li  (bytes)\n", list_size););
+       MESSAGE(8,printf("\t\t\tDimensions of the region : \n"););
+       for (i = 0; i < Rank; i++ )
+                 {
+                   MESSAGE(8,printf("\t\t\t    %lu \n", (unsigned long)dims[i]););
+                 }
+       MESSAGE(8,printf("\t\t\tCoordinates of the UL corner of the region : \n"););
+       MESSAGE(8,printf("\t\t\t    %lf      %lf \n", uplft_out[0], uplft_out[1] ););
+       MESSAGE(8,printf("\t\t\tCoordinates of the LR corner of the region : \n"););
+       MESSAGE(8,printf("\t\t\t    %lf      %lf \n", lowrgt_out[0], lowrgt_out[1] ););
+
+       MESSAGE(11,fprintf(fp,"\t\tstatus =   GDregioninfo(GDid_EASE, RegionID, \"Intensity\", ntype1, &Rank, dims,&list_size, uplft_out, lowrgt_out); \n"););
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_GDregioninfo()           %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\t\tData type of region \"Intensity\" :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %i\n", (int)*ntype1););
+       MESSAGE(11,fprintf(fp,"\t\t\tRank of the region :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %d\n", Rank););
+       MESSAGE(11,fprintf(fp,"\t\t\tSize of the region :\n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %li  (bytes)\n", list_size););
+       MESSAGE(11,fprintf(fp,"\t\t\tDimensions of the region : \n"););
+       for (i = 0; i < Rank; i++ )
+                 {
+                   MESSAGE(11,fprintf(fp,"\t\t\t    %lu \n", (unsigned long)dims[i]););
+                 }
+       MESSAGE(11,fprintf(fp,"\t\t\tCoordinates of the UL corner of the region : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %lf      %lf \n", uplft_out[0], uplft_out[1] ););
+       MESSAGE(11,fprintf(fp,"\t\t\tCoordinates of the LR corner of the region : \n"););
+       MESSAGE(11,fprintf(fp,"\t\t\t    %lf      %lf \n", lowrgt_out[0], lowrgt_out[1] ););
+         }
+
+   free(ntype1);
+
+
+
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid UTM  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid UTM \n"););
+   
+   status = HE5_GDdetach(GDid_UTM);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid UTM **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid UTM **\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid MercatGrid  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid MercatGrid \n"););
+   
+   status = HE5_GDdetach(GDid_MERCAT);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid MercatGrid **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid MercatGrid **\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid AlbersGrid  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid AlbersGrid \n"););
+   
+   status = HE5_GDdetach(GDid_ALBERS);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid AlbersGrid **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid AlbersGrid **\n"););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid EASE  \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n");); 
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid EASE \n"););
+  
+   status = HE5_GDdetach(GDid_EASE);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid EASE **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid EASE **\n"););
+         }
+
+
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDetaching from the grid Lamcon  \n");); 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from the grid Lamcon \n"););
+   
+   status = HE5_GDdetach(GDid_LAMCON);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t** Successfully detached from the grid Lamcon **\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t** Successfully detached from the grid Lamcon **\n"););
+	 }
+   
+   
+/* Test Case -- GDrs2ll */
+
+   uplft[0] = HE5_EHconvAng(-180.0, HE5_HDFE_DEG_DMS);
+   uplft[1] = HE5_EHconvAng(86.72, HE5_HDFE_DEG_DMS);
+   lowrgt[0] = HE5_EHconvAng( 180.0,HE5_HDFE_DEG_DMS);
+   lowrgt[1] = HE5_EHconvAng( -86.72,HE5_HDFE_DEG_DMS);
+   npnts = 4;
+   rcord[0] = 0.;
+   scord[0] = 0.;
+   rcord[1] = 0.;
+   scord[1] = 293.;
+   rcord[2] = 691.5;
+   scord[2] = 0.;
+   rcord[3] = 691.5;
+   scord[3] = 293.;
+   xdimsize = xdim_ease;
+   ydimsize = ydim_ease;
+   MESSAGE(4,printf("\tTesting GDrs2ll for EASE grid... \n"););
+   MESSAGE(4,printf("\t================================ \n"););
+   MESSAGE(11,fprintf(fp,"\f\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting GDrs2ll for EASE grid... \n"););
+   MESSAGE(11,fprintf(fp,"\t================================ \n"););
+   status = HE5_GDrs2ll(HE5_GCTP_BCEA, ProjParm, xdimsize, ydimsize, uplft, lowrgt, npnts, rcord, scord, longitude, latitude, HE5_HDFE_CORNER, HE5_HDFE_GD_UL);
+   if (status == FAIL)
+   {
+      MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+      MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+      errcnt++;
+   }
+   else
+   {
+      MESSAGE(4,printf("\n"););
+      MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+      MESSAGE(11,fprintf(fp,"\n"););
+      MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+      MESSAGE(10,printf("\t\tstatus = HE5_GDrs2ll(HE5_GCTP_BCEA, ProjParm, xdimsize, ydimsize, npnts, scord, rcord, longitude, latitude, HE5_HDFE_CORNER, HE5_HDFE_GD_UL);\n"););
+      MESSAGE(8,printf("\t\tValue returned by HE5_GDrs2ll %d\n\n", status););
+      MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_GDrs2ll(HE5_GCTP_BCEA, ProjParm, xdimsize, ydimsize, npnts, scord, rcord, longitude, latitude, HE5_HDFE_CORNER, HE5_HDFE_GD_UL);\n"););
+      MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_GDrs2ll %d\n\n", status););
+      for(i = 0; i < 4; i++)
+      {
+            
+             MESSAGE(8,printf("\t\tr[%d]=%f s[%d]=%f lon[%d]=%f lat[%d]=%f\n", i, rcord[i], i, scord[i], i, longitude[i], i, latitude[i]););
+             MESSAGE(11,printf("\t\tr[%d]=%f s[%d]=%f lon[%d]=%f lat[%d]=%f\n", i, rcord[i], i, scord[i], i, longitude[i], i, latitude[i]););
+      }
+   }
+
+
+   /* Release allocated memory */
+  
+   free(time);
+  
+   free(str_buf);
+   free(ProjParm_out);
+   free(ProjParm);
+
+
+   MESSAGE(4,printf("\tTesting HE5_GDclose... \n"););
+   MESSAGE(4,printf("\t====================== \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_GDclose... \n"););
+   MESSAGE(11,fprintf(fp,"\t====================== \n"););
+   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tClosing the file SimpleGrid.h5\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tClosing the file SimpleGrid.h5\n"););
+   
+   
+   status = HE5_GDclose(gdfidc_simple);
+   if (status == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\t\tSuccessfully clossed the SimpleGrid.h5 file \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tSuccessfully clossed the SimpleGrid.h5 file \n"););
+	   MESSAGE(4,printf("\n"););
+	   MESSAGE(4,printf("\t ........... End of Testing. \n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t ............. End of Testing. \n"););
+	 }
+   
+   if (errcnt == 0)
+	 {
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\t\t A L L    T E S T S     P A S S E D \n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t A L L    T E S T S     P A S S E D \n"););
+           return_val = 0;
+	 }
+   else
+	 {
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\t\t%d    T E S T S     F A I L E D \n",errcnt););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t%d    T E S T S     F A I L E D \n",errcnt););
+           return_val = 1;
+	 }
+   
+   MESSAGE(11,fclose(fp););
+   return return_val;
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/grid/hdfeos5.inc b/testdrivers/grid/hdfeos5.inc
new file mode 100644
index 0000000..a6af5e8
--- /dev/null
+++ b/testdrivers/grid/hdfeos5.inc
@@ -0,0 +1,411 @@
+! * ==========================================================
+! * File:       hdfeos5.inc
+! * Author:     A. Muslimov, Emergent Technology Services, Inc.
+! * Date:       March 11, 2002
+! * Purpose:    Fortran header file for HDFEOS5 routines
+! * ==========================================================
+! * Contents: 
+! *     HDFEOS5 data type tags
+! *     HDFEOS5 logical constants
+! *     HDFEOS5 file access tags
+! *     HDFEOS5/GCTP library codes   
+! *
+! * ===========================================================
+ 
+!          HDFEOS5  DATA TYPE TAGS 
+!          =======================
+
+           integer   HE5T_NATIVE_INT
+           integer   HE5T_NATIVE_UINT
+           integer   HE5T_NATIVE_SHORT
+           integer   HE5T_NATIVE_USHORT
+           integer   HE5T_NATIVE_SCHAR
+           integer   HE5T_NATIVE_UCHAR
+           integer   HE5T_NATIVE_LONG
+           integer   HE5T_NATIVE_ULONG
+           integer   HE5T_NATIVE_LLONG
+           integer   HE5T_NATIVE_ULLONG
+           integer   HE5T_NATIVE_FLOAT
+           integer   HE5T_NATIVE_REAL
+           integer   HE5T_NATIVE_DOUBLE
+           integer   HE5T_NATIVE_LDOUBLE
+           integer   HE5T_NATIVE_INT8
+           integer   HE5T_NATIVE_UINT8
+           integer   HE5T_NATIVE_INT16
+           integer   HE5T_NATIVE_UINT16
+           integer   HE5T_NATIVE_INT32
+           integer   HE5T_NATIVE_UINT32
+           integer   HE5T_NATIVE_INT64
+           integer   HE5T_NATIVE_UINT64
+           integer   HE5T_NATIVE_B8
+           integer   HE5T_NATIVE_B16
+           integer   HE5T_NATIVE_B32
+           integer   HE5T_NATIVE_B64
+           integer   HE5T_NATIVE_HSIZE
+           integer   HE5T_NATIVE_HERR
+           integer   HE5T_NATIVE_HBOOL
+
+           integer   HE5T_STD_I8BE
+           integer   HE5T_STD_I8LE
+           integer   HE5T_STD_I16BE
+           integer   HE5T_STD_I16LE
+           integer   HE5T_STD_I32BE
+           integer   HE5T_STD_I32LE
+           integer   HE5T_STD_I64BE
+           integer   HE5T_STD_I64LE
+           integer   HE5T_STD_U8BE
+           integer   HE5T_STD_U8LE
+           integer   HE5T_STD_U16BE
+           integer   HE5T_STD_U16LE
+           integer   HE5T_STD_U32BE
+           integer   HE5T_STD_U32LE
+           integer   HE5T_STD_U64BE
+           integer   HE5T_STD_U64LE
+           integer   HE5T_STD_B8BE
+           integer   HE5T_STD_B8LE
+           integer   HE5T_STD_B16BE
+           integer   HE5T_STD_B16LE
+           integer   HE5T_STD_B32BE
+           integer   HE5T_STD_B32LE
+           integer   HE5T_STD_B64BE
+           integer   HE5T_STD_B64LE
+
+           integer   HE5T_IEEE_F32BE                      
+           integer   HE5T_IEEE_F32LE                      
+           integer   HE5T_IEEE_F64BE                      
+           integer   HE5T_IEEE_F64LE                      
+           integer   HE5T_NATIVE_CHAR
+           integer   HE5T_CHARSTRING
+
+           parameter(HE5T_NATIVE_INT      = 0)
+           parameter(HE5T_NATIVE_UINT     = 1)
+           parameter(HE5T_NATIVE_SHORT    = 2)
+           parameter(HE5T_NATIVE_USHORT   = 3)
+           parameter(HE5T_NATIVE_SCHAR    = 4)
+           parameter(HE5T_NATIVE_UCHAR    = 5)
+           parameter(HE5T_NATIVE_LONG     = 6)
+           parameter(HE5T_NATIVE_ULONG    = 7)
+           parameter(HE5T_NATIVE_LLONG    = 8)
+           parameter(HE5T_NATIVE_ULLONG   = 9)
+           parameter(HE5T_NATIVE_FLOAT    =10)
+           parameter(HE5T_NATIVE_REAL     =10)
+           parameter(HE5T_NATIVE_DOUBLE   =11)
+           parameter(HE5T_NATIVE_LDOUBLE  =12)
+           parameter(HE5T_NATIVE_INT8     =13)
+           parameter(HE5T_NATIVE_UINT8    =14)
+           parameter(HE5T_NATIVE_INT16    =15)
+           parameter(HE5T_NATIVE_UINT16   =16)
+           parameter(HE5T_NATIVE_INT32    =17)
+           parameter(HE5T_NATIVE_UINT32   =18)
+           parameter(HE5T_NATIVE_INT64    =19)
+           parameter(HE5T_NATIVE_UINT64   =20)
+           parameter(HE5T_NATIVE_B8       =21)
+           parameter(HE5T_NATIVE_B16      =22)
+           parameter(HE5T_NATIVE_B32      =23)
+           parameter(HE5T_NATIVE_B64      =24)
+           parameter(HE5T_NATIVE_HSIZE    =25)
+           parameter(HE5T_NATIVE_HERR     =26)
+           parameter(HE5T_NATIVE_HBOOL    =27)
+
+           parameter(HE5T_STD_I8BE        =28)
+           parameter(HE5T_STD_I8LE        =29)
+           parameter(HE5T_STD_I16BE       =30)
+           parameter(HE5T_STD_I16LE       =31)
+           parameter(HE5T_STD_I32BE       =32)
+           parameter(HE5T_STD_I32LE       =33)
+           parameter(HE5T_STD_I64BE       =34)
+           parameter(HE5T_STD_I64LE       =35)
+           parameter(HE5T_STD_U8BE        =36)
+           parameter(HE5T_STD_U8LE        =37)
+           parameter(HE5T_STD_U16BE       =38)
+           parameter(HE5T_STD_U16LE       =39)
+           parameter(HE5T_STD_U32BE       =40)
+           parameter(HE5T_STD_U32LE       =41)
+           parameter(HE5T_STD_U64BE       =42)
+           parameter(HE5T_STD_U64LE       =43)
+           parameter(HE5T_STD_B8BE        =44)
+           parameter(HE5T_STD_B8LE        =45)
+           parameter(HE5T_STD_B16BE       =46)
+           parameter(HE5T_STD_B16LE       =47)
+           parameter(HE5T_STD_B32BE       =48)
+           parameter(HE5T_STD_B32LE       =49)
+           parameter(HE5T_STD_B64BE       =50)
+           parameter(HE5T_STD_B64LE       =51)
+
+           parameter(HE5T_IEEE_F32BE      =52)                
+           parameter(HE5T_IEEE_F32LE      =53)                
+           parameter(HE5T_IEEE_F64BE      =54)                
+           parameter(HE5T_IEEE_F64LE      =55)                
+
+           parameter(HE5T_NATIVE_CHAR     =56)                
+           parameter(HE5T_CHARSTRING      =57)
+
+           integer   HE5S_UNLIMITED_F
+           parameter(HE5S_UNLIMITED_F = -1)
+
+
+!          HDFEOS5 FILE ACCESS TAGS 
+!          ========================
+ 
+           integer   HE5F_ACC_RDWR
+           integer   HE5F_ACC_RDONLY
+           integer   HE5F_ACC_TRUNC
+
+           parameter(HE5F_ACC_RDWR   = 100)
+           parameter(HE5F_ACC_RDONLY = 101)
+           parameter(HE5F_ACC_TRUNC  = 102)
+
+!          TOOLKIT FILE ACCESS TAGS 
+!          ========================
+ 
+           integer   HDF4_ACC_RDONLY
+           integer   HDF4_ACC_RDWR
+           integer   HDF4_ACC_CREATE
+
+           integer   HDF5_ACC_RDONLY
+           integer   HDF5_ACC_RDWR
+           integer   HDF5_ACC_CREATE
+
+           parameter(HDF4_ACC_RDONLY = 1)
+           parameter(HDF4_ACC_RDWR   = 3)
+           parameter(HDF4_ACC_CREATE = 4)
+
+           parameter(HDF5_ACC_RDONLY = 11)
+           parameter(HDF5_ACC_RDWR   = 13)
+           parameter(HDF5_ACC_CREATE = 14)
+
+
+!          HDFEOS5  MERGE CODES 
+!          ====================
+
+           integer HE5_HDFE_NOMERGE
+           integer HE5_HDFE_AUTOMERGE
+
+           parameter(HE5_HDFE_NOMERGE   =0)
+           parameter(HE5_HDFE_AUTOMERGE =1)
+ 
+!          HDFEOS5 XXentries CODES 
+!          =======================
+
+           integer HE5_HDFE_NENTDIM
+           integer HE5_HDFE_NENTMAP
+           integer HE5_HDFE_NENTIMAP
+           integer HE5_HDFE_NENTGFLD
+           integer HE5_HDFE_NENTDFLD
+
+           parameter(HE5_HDFE_NENTDIM  =0)
+           parameter(HE5_HDFE_NENTMAP  =1)
+           parameter(HE5_HDFE_NENTIMAP =2)
+           parameter(HE5_HDFE_NENTGFLD =3)
+           parameter(HE5_HDFE_NENTDFLD =4)
+
+!          HDFEOS5 ANGLE CONVERSION CODES 
+!          ==============================
+
+           integer HE5_HDFE_RAD_DEG    
+           integer HE5_HDFE_DEG_RAD    
+           integer HE5_HDFE_DMS_DEG    
+           integer HE5_HDFE_DEG_DMS    
+           integer HE5_HDFE_RAD_DMS    
+           integer HE5_HDFE_DMS_RAD    
+
+           parameter(HE5_HDFE_RAD_DEG =0)
+           parameter(HE5_HDFE_DEG_RAD =1)
+           parameter(HE5_HDFE_DMS_DEG =2)
+           parameter(HE5_HDFE_DEG_DMS =3)
+           parameter(HE5_HDFE_RAD_DMS =4)
+           parameter(HE5_HDFE_DMS_RAD =5)
+
+
+!          HDFEOS5 SWATH SUBSET CODES 
+!          ==========================
+ 
+           integer HE5_HDFE_MIDPOINT 
+           integer HE5_HDFE_ENDPOINT 
+           integer HE5_HDFE_ANYPOINT 
+           integer HE5_HDFE_INTERNAL 
+           integer HE5_HDFE_EXTERNAL 
+           integer HE5_HDFE_NOPREVSUB
+
+           parameter(HE5_HDFE_MIDPOINT  =0) 
+           parameter(HE5_HDFE_ENDPOINT  =1) 
+           parameter(HE5_HDFE_ANYPOINT  =2) 
+           parameter(HE5_HDFE_INTERNAL  =0) 
+           parameter(HE5_HDFE_EXTERNAL  =1) 
+           parameter(HE5_HDFE_NOPREVSUB =-1) 
+
+
+!          HDFEOS5 GRID ORIGIN CODES 
+!          =========================
+
+           integer HE5_HDFE_GD_UL    
+           integer HE5_HDFE_GD_UR    
+           integer HE5_HDFE_GD_LL    
+           integer HE5_HDFE_GD_LR    
+ 
+           parameter(HE5_HDFE_GD_UL  =0) 
+           parameter(HE5_HDFE_GD_UR  =1) 
+           parameter(HE5_HDFE_GD_LL  =2) 
+           parameter(HE5_HDFE_GD_LR  =3) 
+
+
+!          HDFEOS5 PIXEL REGISTRATION CODES 
+!          ================================
+
+           integer HE5_HDFE_CENTER     
+           integer HE5_HDFE_CORNER     
+ 
+           parameter(HE5_HDFE_CENTER  =0)
+           parameter(HE5_HDFE_CORNER  =1)
+
+!          HDFEOS5 GCTP PROJECTION CODES 
+!          =============================
+
+           integer HE5_GCTP_GEO      
+           integer HE5_GCTP_UTM      
+           integer HE5_GCTP_SPCS     
+           integer HE5_GCTP_ALBERS   
+           integer HE5_GCTP_LAMCC     
+           integer HE5_GCTP_MERCAT    
+           integer HE5_GCTP_PS        
+           integer HE5_GCTP_POLYC     
+           integer HE5_GCTP_EQUIDC    
+           integer HE5_GCTP_TM        
+           integer HE5_GCTP_STEREO    
+           integer HE5_GCTP_LAMAZ     
+           integer HE5_GCTP_AZMEQD    
+           integer HE5_GCTP_GNOMON    
+           integer HE5_GCTP_ORTHO     
+           integer HE5_GCTP_GVNSP     
+           integer HE5_GCTP_SNSOID    
+           integer HE5_GCTP_EQRECT    
+           integer HE5_GCTP_MILLER    
+           integer HE5_GCTP_VGRINT    
+           integer HE5_GCTP_HOM       
+           integer HE5_GCTP_ROBIN     
+           integer HE5_GCTP_SOM       
+           integer HE5_GCTP_ALASKA    
+           integer HE5_GCTP_GOOD      
+           integer HE5_GCTP_MOLL      
+           integer HE5_GCTP_IMOLL     
+           integer HE5_GCTP_HAMMER    
+           integer HE5_GCTP_WAGIV     
+           integer HE5_GCTP_WAGVII    
+           integer HE5_GCTP_OBLEQA    
+           integer HE5_GCTP_ISINUS    
+
+           parameter(HE5_GCTP_GEO      =0)
+           parameter(HE5_GCTP_UTM      =1)
+           parameter(HE5_GCTP_SPCS     =2)
+           parameter(HE5_GCTP_ALBERS   =3)
+           parameter(HE5_GCTP_LAMCC    =4)
+           parameter(HE5_GCTP_MERCAT   =5)
+           parameter(HE5_GCTP_PS       =6)
+           parameter(HE5_GCTP_POLYC    =7)
+           parameter(HE5_GCTP_EQUIDC   =8)
+           parameter(HE5_GCTP_TM       =9)
+           parameter(HE5_GCTP_STEREO   =10)
+           parameter(HE5_GCTP_LAMAZ    =11)
+           parameter(HE5_GCTP_AZMEQD   =12)
+           parameter(HE5_GCTP_GNOMON   =13)
+           parameter(HE5_GCTP_ORTHO    =14)
+           parameter(HE5_GCTP_GVNSP    =15)
+           parameter(HE5_GCTP_SNSOID   =16)
+           parameter(HE5_GCTP_EQRECT   =17)
+           parameter(HE5_GCTP_MILLER   =18)
+           parameter(HE5_GCTP_VGRINT   =19)
+           parameter(HE5_GCTP_HOM      =20)
+           parameter(HE5_GCTP_ROBIN    =21)
+           parameter(HE5_GCTP_SOM      =22)
+           parameter(HE5_GCTP_ALASKA   =23)
+           parameter(HE5_GCTP_GOOD     =24)
+           parameter(HE5_GCTP_MOLL     =25)
+           parameter(HE5_GCTP_IMOLL    =26)
+           parameter(HE5_GCTP_HAMMER   =27)
+           parameter(HE5_GCTP_WAGIV    =28)
+           parameter(HE5_GCTP_WAGVII   =29)
+           parameter(HE5_GCTP_OBLEQA   =30)
+           parameter(HE5_GCTP_ISINUS   =99)
+ 
+ 
+!          HDFEOS5 TILIND/COMPRESSION CODES 
+!          ================================
+
+           integer HE5_HDFE_NOTILE       
+           integer HE5_HDFE_TILE         
+           integer HE5_HDFE_COMP_NONE    
+           integer HE5_HDFE_COMP_RLE     
+           integer HE5_HDFE_COMP_NBIT    
+           integer HE5_HDFE_COMP_SKPHUFF 
+           integer HE5_HDFE_COMP_DEFLATE 
+           integer HE5_HDFE_COMP_SZIP_CHIP
+           integer HE5_HDFE_COMP_SZIP_K13
+           integer HE5_HDFE_COMP_SZIP_EC
+           integer HE5_HDFE_COMP_SZIP_NN
+           integer HE5_HDFE_COMP_SZIP_K13orEC
+           integer HE5_HDFE_COMP_SZIP_K13orNN
+           integer HE5_HDFE_COMP_SHUF_DEFLATE
+           integer HE5_HDFE_COMP_SHUF_SZIP_CHIP
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13
+           integer HE5_HDFE_COMP_SHUF_SZIP_EC
+           integer HE5_HDFE_COMP_SHUF_SZIP_NN
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13orEC
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13orNN
+
+           parameter(HE5_HDFE_NOTILE                 =0)
+           parameter(HE5_HDFE_TILE                   =1)
+           parameter(HE5_HDFE_COMP_NONE              =0)
+           parameter(HE5_HDFE_COMP_RLE               =1)
+           parameter(HE5_HDFE_COMP_NBIT              =2)
+           parameter(HE5_HDFE_COMP_SKPHUFF           =3)
+           parameter(HE5_HDFE_COMP_DEFLATE           =4)
+           parameter(HE5_HDFE_COMP_SZIP_CHIP         =5)
+           parameter(HE5_HDFE_COMP_SZIP_K13          =6)
+           parameter(HE5_HDFE_COMP_SZIP_EC           =7)
+           parameter(HE5_HDFE_COMP_SZIP_NN           =8)
+           parameter(HE5_HDFE_COMP_SZIP_K13orEC      =9)
+           parameter(HE5_HDFE_COMP_SZIP_K13orNN      =10)
+           parameter(HE5_HDFE_COMP_SHUF_DEFLATE      =11)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_CHIP    =12)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13     =13)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_EC      =14)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_NN      =15)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orEC =16)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orNN =17)
+ 
+!          HDFEOS5 GROUP CODES 
+!          ===================
+
+           integer HE5_HDFE_GEOGROUP        
+           integer HE5_HDFE_DATAGROUP       
+           integer HE5_HDFE_ATTRGROUP       
+           integer HE5_HDFE_GRPATTRGROUP    
+           integer HE5_HDFE_LOCATTRGROUP    
+           integer HE5_HDFE_PROFGROUP       
+           integer HE5_HDFE_PROFGRPATTRGROUP
+           integer HE5_HDFE_GEOGRPATTRGROUP
+
+           parameter(HE5_HDFE_GEOGROUP       =0)
+           parameter(HE5_HDFE_DATAGROUP      =1)
+           parameter(HE5_HDFE_ATTRGROUP      =2)
+           parameter(HE5_HDFE_GRPATTRGROUP   =3)
+           parameter(HE5_HDFE_LOCATTRGROUP   =4)
+           parameter(HE5_HDFE_PROFGROUP      =5)
+           parameter(HE5_HDFE_PROFGRPATTRGROUP =6)
+           parameter(HE5_HDFE_GEOGRPATTRGROUP =7)
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/grid/hdfeos5_64.inc b/testdrivers/grid/hdfeos5_64.inc
new file mode 100644
index 0000000..cb8be09
--- /dev/null
+++ b/testdrivers/grid/hdfeos5_64.inc
@@ -0,0 +1,16 @@
+! * ==========================================================
+! * File:       hdfeos5_64.inc
+! * Author:     A. Muslimov, Emergent Technology Services, Inc.
+! * Date:       March 19, 2002
+! * Purpose:    Fortran header file for HDFEOS5 routines on 64
+! *              bit platforms
+! * ==========================================================
+! * Contents: 
+! *
+! *
+! * ===========================================================
+ 
+
+           integer*8 HE5S_UNLIMITED_F_64
+
+           parameter(HE5S_UNLIMITED_F_64 = -1)
diff --git a/testdrivers/grid/testgrid32.f b/testdrivers/grid/testgrid32.f
new file mode 100755
index 0000000..c8efbeb
--- /dev/null
+++ b/testdrivers/grid/testgrid32.f
@@ -0,0 +1,2535 @@
+c----------------------------------------------------------------------------
+c     Copyright (C) 2000   Emergent IT Inc. and Raytheon Systems Company    |
+c----------------------------------------------------------------------------
+c testgrid32.f                                                                |
+c In this program we create, define and write a simple grid hdfeos file     |
+c using the grid interface                                                  |
+c----------------------------------------------------------------------------
+
+
+      program       testgrid32
+
+      implicit      none
+ 
+      include       'hdfeos5.inc'
+ 
+      integer       zero
+      integer       rnk(8), numtype(8)
+      integer       zcode, scode, nflds
+      integer       regionid, regionid2
+      integer       dtype, classid, order
+      integer       status, i, ii
+      integer       compparm(5)
+      integer 	    gdfid, gdfid2, gdid_utm, gdid2
+      integer 	    zonecode, pixregcode, orgcode
+      integer	    attr(4), iattr(4), gattr(4), lattr(4)
+      integer 	    spherecode
+      integer	    he5_gdopen, he5_gdcreate
+      integer	    he5_gdclose, he5_gddefproj
+      integer	    he5_gddeftle, he5_gddeffld
+      integer	    he5_gdwrattr, he5_gdwrgattr
+      integer	    he5_gddefcomp, he5_gdinqflds
+      integer	    he5_gdrdfld, he5_gdattrinfo
+      integer	    he5_gdlatinfo, he5_gdrdattr
+      integer	    he5_gdreginfo, he5_gddeftmeper
+      integer	    he5_gddeforigin, he5_gddefpreg
+      integer	    he5_gdgridinfo, he5_gdcompinfo
+      integer	    he5_gdgetpix, he5_gddupreg
+      integer	    he5_gdattach, he5_gddetach
+      integer	    he5_gddefdim, he5_gdinqdatatype
+      integer	    he5_gdsetfill, he5_gdwrfld
+      integer	    he5_gdwrlattr, he5_gdorginfo
+      integer	    he5_gdprojinfo, he5_gdgatinfo
+      integer	    he5_gdrdgattr, he5_gdrdlattr
+      integer	    he5_gddefvrtreg
+      integer	    he5_gdinqdims, he5_gdgetfill
+      integer	    he5_gdfldinfo, he5_gddefboxreg
+      integer	    he5_gdpreginfo, he5_gdextreg
+      integer 	    nt(4), rk(4)
+
+      integer*4 	xdim, ydim
+      integer*4	    he5_gdinqgrid, he5_gddiminfo
+      integer*4	    he5_gdinqattrs, he5_gdinqgattrs
+      integer*4	    he5_gdgetpixval, he5_gdinterpolate
+      integer*4	    he5_gdnentries, he5_gdinqlattrs
+      integer*4     index1
+      integer*4  	index2
+      integer*4	    dimsizes(2)
+      integer*4 	tiledims(2), tilecords(2)
+      integer*4 	ntype, count
+      integer*4 	rowval(5), colval(5)
+      integer*4 	lat(40,50)
+      integer*4 	latcnt
+      integer*4 	lon(40,50)
+      integer*4 	loncnt
+      integer*4 	lstatus, n, one
+      integer*4 	size
+      integer*4     start(2)
+      integer*4     stride(2)
+      integer*4     edge(2)
+      integer*4     start1d, stride1d, edge1d
+      integer*4 	periodid
+      integer*4     strbufsize, pcode
+      integer*4     xdimsize, ydimsize
+      integer*4	    dims(32)
+      
+      real		    fillvalue, ifillv
+
+      real*4		fldval(5)
+      real*4		ray3(250)
+      real*4		utmray(60,80), georay(60,80)
+      real*4		utmhght(80)
+      real*4		hghtinit
+      real*4		utmcnt, geocnt
+      real*4		raycnt, ray3cnt
+      real*4		tempray(60,80)
+      real*4		datbuf(4800)
+
+      real*8		starttime, stoptime
+      real*8		range(2)
+      real*8		projparm(16), pparm(16)
+      real*8		uplft(2), lowrgt(2)
+      real*8		iuplft(2), ilrgt(2)
+      real*8		interval(5,2)
+      real*8		lonval(5), latval(5)
+      real*8		upleftpt(2), lowrtpt(2),corlon(2),corlat(2)
+      real*8		utmtmeray(4800)
+      real*8		tmeinit
+
+      character*80	grdnames, dimname, fldlist, attrlist
+      character*80	compcodestring, maxdimname
+      
+      index1      = 0
+      index2      = 0
+      dimsizes(1) = 40
+      dimsizes(2) = 100
+      compparm(1) = 6 
+      compparm(2) = 0
+      compparm(3) = 0
+      compparm(4) = 0
+      compparm(5) = 0
+      fillvalue   = 1996.0
+      raycnt      = -799.0
+      ray3cnt     = -19.5
+      attr(1)     = 11
+      attr(2)     = 33
+      attr(3)     = 55
+      attr(4)     = 77
+      utmcnt      = -799.0
+      geocnt      = 2001.0
+      hghtinit    = 323.0
+      tmeinit     = 35232487.2d0
+      starttime   = 35233000.8d0
+      stoptime    = 35435050.9d0
+      range(1)    = 352.8d0
+      range(2)    = 400.9d0
+      lonval(1)   = -122.0d0
+      latval(1)   = -68.0d0
+      lonval(2)   = -122.5d0
+      latval(2)   = -68.0d0
+      lonval(3)   = -123.0d0
+      latval(3)   = -68.0d0
+      lonval(4)   = -123.5d0
+      latval(4)   = -68.0d0
+      lonval(5)   = -124.0d0
+      latval(5)   = -68.0d0
+      tiledims(1) = 16
+      tiledims(2) = 15
+      tilecords(1)= 0
+      tilecords(2)= 0
+      latcnt      = 38.0
+      loncnt      = 78.0
+      one         = 1
+      zero        = 0
+c
+c This section of the program just fills some arrays with data that we will
+c use later in the program
+c
+      do 70 index1=1,60
+         do 80 index2=1,80
+            utmray(index2,index1) = utmcnt
+            georay(index2,index1) = geocnt
+            utmcnt = utmcnt + .4
+            geocnt = geocnt + .2
+   80   continue
+   70 continue
+  
+      
+      do 30 index1=1,250
+            ray3(index1) = ray3cnt
+            ray3cnt = ray3cnt + .1
+   30 continue
+      
+      do 32 index1=1,80
+            utmhght(index1) = hghtinit
+            hghtinit = hghtinit + 2.75
+   32 continue
+
+      do 34 index1=1,4800
+            utmtmeray(index1) = tmeinit
+            tmeinit = tmeinit + 70.7
+   34 continue
+
+      do 50 index1=1,50
+         do 60 index2=1,40      
+            lat(index2,index1) = latcnt
+            lon(index2,index1) = loncnt
+            loncnt = loncnt - 0.1
+   60    continue
+         latcnt = latcnt + 0.1
+         loncnt = 78.0
+   50 continue
+
+  230 format('********Error unexpected**********')
+  231 format('********Error Expected************')
+  240 format('***********Passed Test*********')
+
+
+      open(unit=10,file='testgridf_hdfeos5.txt',status="UNKNOWN")
+
+      write(*,*)'Testing Grid FORTRAN 77 interface '
+      write(*,*)'=================================='
+      write(10,*)'Testing Grid FORTRAN 77 interface '
+      write(10,*)'=================================='
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdopen
+c
+      write(10,*)'Testing gdopen... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdopen... '
+      write(*,*)'=================='
+      gdfid2 = he5_gdopen("grid2.he5",HE5F_ACC_TRUNC)
+      if (gdfid2 .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdfid2 = he5_gdopen(grid2.he5",HE5F_ACC_TRUNC)'
+         write(10,*)'Value returned by he5_gdopen ', gdfid2
+         write(*,*)'gdfid2 = he5_gdopen(grid2.he5",HE5F_ACC_TRUNC)'
+         write(*,*)'Value returned by he5_gdopen ', gdfid2
+      endif
+      write(*,*)' '
+      write(10,*)' '
+
+      gdfid = he5_gdopen('grid.he5',HE5F_ACC_TRUNC)
+      if (gdfid .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'Opening file grid.he5'
+         write(10,*)'Opening file grid.he5'
+         write(10,*) 'gdfid = he5_gdopen("grid.he5",HE5F_ACC_TRUNC)'
+         write(10,*) 'File id returned from he5_gdopen ', gdfid
+         write(*,*) 'gdfid = he5_gdopen("grid.he5",HE5F_ACC_TRUNC)'
+         write(*,*) 'File id returned from he5_gdopen ', gdfid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- gdcreate
+c
+      write(10,27)
+      write(10,*)'Testing gdcreate... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdcreate... '
+      write(*,*)'=================='
+
+      xdim = 60
+      ydim = 80
+      uplft(1)  = 353299.39125d0
+      uplft(2)  = -7100284.64348d0
+      lowrgt(1) = 603434.52148d0
+      lowrgt(2) = -7991341.17870d0
+
+
+      gdid2 = he5_gdcreate(gdfid2, 'UTMGrid2', xdim, 
+     1ydim, uplft, lowrgt)
+      if (gdid2 .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*) 'Create UTMGrid2'
+         write(*,*)'gdid2 = he5_gdcreate(gdfid2, "UTMGrid2", 
+     1xdim, ydim, uplft, lowrgt)'
+         write(10,*) 'Value returned by he5_gdcreate ', gdid2
+         write(*,*) 'Create UTMGrid2'
+         write(10,*)'gdid2 = he5_gdcreate(gdfid2, "UTMGrid2", 
+     1xdim, ydim, uplft, lowrgt)'
+         write(*,*) 'Value returned by he5_gdcreate ', gdid2
+      endif
+      
+    
+      gdid_utm = he5_gdcreate(gdfid, 'UTMGrid', xdim, 
+     1ydim, uplft, lowrgt)
+      if (gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Creating UTMGrid'
+         write(*,*)'Creating UTMGrid'
+         write(*,*)'gdid_utm=he5_gdcreate(gdfid,"UTMGrid",
+     1xdim,ydim,uplft,lowrgt)'
+         write(10,*)'gdid_utm=he5_gdcreate(gdfid,"UTMGrid",
+     1xdim,ydim,uplft,lowrgt)'
+         write(10,*)'UTM grid id returned from he5_gdcreate ', 
+     1gdid_utm
+         write(*,*)'UTM grid id returned from he5_gdcreate ', 
+     1gdid_utm
+      endif 
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddefproj
+c
+      write(10,27)
+      write(10,*)'Testing gddefproj... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddefproj... '
+      write(*,*)'=================='
+
+      zonecode = 10
+      spherecode = 0
+
+      do 120 index1=1,16
+         projparm(index1)=0
+ 120  continue
+  
+      status = he5_gddefproj(gdid_utm,HE5_GCTP_UTM,zonecode,
+     1spherecode,projparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Defining UTM projection'
+         write(*,*)'Defining UTM projection'
+         write(*,*)'status=he5_gddefproj(gdid_utm,HE5_GCTP_UTM,
+     1zonecode,spherecode, projparm)'
+         write(10,*)'status=he5_gddefproj(gdid_utm,HE5_GCTP_UTM,
+     1zonecode,spherecode, projparm)'
+         write(10,*)'Returned value from he5_gddefproj ', status
+         write(*,*)'Returned value from he5_gddefproj ', status
+      endif 
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefproj(gdid2,HE5_GCTP_UTM,zonecode,
+     1spherecode,projparm)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Defining UTM'
+         write(10,*)'status = he5_gddefproj(gdid2,HE5_GCTP_UTM,
+     1zonecode,spherecode,projparm)'
+         write(10,*)'Value returned by he5_gddefproj ', status
+         write(*,*)'Defining UTM'
+         write(*,*)'status = he5_gddefproj(gdid2,HE5_GCTP_UTM,
+     1zonecode,spherecode,projparm)'
+         write(*,*)'Value returned by he5_gddefproj ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- gddefpreg
+c
+      write(10,27)
+      write(10,*)'Testing gddefpreg... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddefpreg... '
+      write(*,*)'=================='
+      status = he5_gddefpreg(gdid_utm, HE5_HDFE_CORNER)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddefpreg(gdid_utm, 
+     1HE5_HDFE_CORNER)'
+         write(10,*)'status = he5_gddefpreg(gdid_utm, 
+     1HE5_HDFE_CORNER)'
+         write(10,*)'Returned from he5_gddefpreg ', status
+         write(*,*)'Returned from he5_gddefpreg ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddeforigin
+c
+      write(10,27)
+      write(10,*)'Testing gddeforigin... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddeforigin... '
+      write(*,*)'=================='
+      status = he5_gddeforigin(gdid_utm, HE5_HDFE_GD_UL)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddeforigin(gdid_utm, 
+     1HE5_HDFE_GD_UL)'
+         write(*,*)'Value of status from he5_gddeforigin ',
+     1status
+         write(10,*)'status = he5_gddeforigin(gdid_utm, 
+     1HE5_HDFE_GD_UL)'
+         write(10,*)'Value of status from he5_gddeforigin ',
+     1status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddefdim
+c
+      write(10,27)
+      write(10,*)'Testing gddefdim... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddefdim... '
+      write(*,*)'=================='
+      status = he5_gddefdim(gdid2, 'TestDim1', 40)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid2, "TestDim1", 40)'
+         write(10,*)'Value returned by he5_gddefdim ', status
+         write(*,*)'status = he5_gddefdim(gdid2, "TestDim1", 40)'
+         write(*,*)'Value returned by he5_gddefdim ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefdim(gdid2, 'TestDim2', 25)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid2, "TestDim2", 25)'
+         write(10,*)'Value returned by he5_gddefdim ', status
+         write(*,*)'status = he5_gddefdim(gdid2, "TestDim2", 25)'
+         write(*,*)'Value returned by he5_gddefdim ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      status = he5_gddefdim(gdid_utm, 'Conduction', 250)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status=he5_gddefdim(gdid_utm,"Conduction",250)'
+         write(10,*)'Returned value from he5_gddefdim ',status
+         write(*,*)'status=he5_gddefdim(gdid_utm,"Conduction",250)'
+         write(*,*)'Returned value from he5_gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefdim(gdid_utm,'Timedim',4800)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid_utm,"Timedim",4800)'
+         write(10,*)'Status returned by call to he5_gddefdim ',status
+         write(*,*)'status = he5_gddefdim(gdid_utm,"Timedim",4800)'
+         write(*,*)'Status returned by call to he5_gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefdim(gdid_utm,'Hghtdim',80)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status = he5_gddefdim(gdid_utm,"Hghtdim",80)'
+        write(10,*)'Status returned by call to he5_gddefdim ',status
+        write(*,*)'status = he5_gddefdim(gdid_utm,"Hghtdim",80)'
+        write(*,*)'Status returned by call to he5_gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefdim(gdid_utm,'Convection',60)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define dimension Convection '
+        write(10,*)'status = he5_gddefdim(gdid_utm,"Convection",60)'
+        write(10,*)'Status returned by call to he5_gddefdim ',status
+        write(*,*)'Define dimension Convection '
+        write(*,*)'status = he5_gddefdim(gdid_utm,"Convection",60)'
+        write(*,*)'Status returned by call to he5_gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddetach
+c
+      write(10,27)
+      write(10,*)'Testing gddetach... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddetach... '
+      write(*,*)'=================='
+      status = he5_gddetach(gdid2)
+      if(status .lt. zero) then
+         write(*,231)
+         write(10,231)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid2)'
+         write(10,*)'Value returned by he5_gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid2)'
+         write(*,*)'Value returned by he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned value from he5_gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Returned value from he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+ 
+c Test Case -- gdattach
+c
+      write(10,27)
+      write(10,*)'Testing gdattach... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdattach... '
+      write(*,*)'=================='
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if(gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(10,*)'Handle returned from he5_gdattach ', gdid_utm
+         write(*,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(*,*)'Handle returned from he5_gdattach ', gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid2 = he5_gdattach(gdfid2, 'UTMGrid2')
+      if(gdid2 .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid2 = he5_gdattach(gdfid2, "UTMGrid2")'
+         write(10,*)'Value returned by he5_gdattach ', gdid2
+         write(*,*)'gdid2 = he5_gdattach(gdfid2, "UTMGrid2")'
+         write(*,*)'Value returned by he5_gdattach ', gdid2
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddeffld
+c
+      write(10,27)
+      write(10,*)'Testing gddeffld... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddeffld... '
+      write(*,*)'=================='
+      status=he5_gddeffld(gdid2,"tempfield","TestDim2,TestDim1","",
+     1HE5T_NATIVE_FLOAT, HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,231)
+         write(10,231)
+        
+      else 
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "tempfield"'
+        write(10,*)'status=he5_gddeffld(gdid2,"tempfield",
+     1"TestDim2,TestDim1","",HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)'
+        write(10,*)'Value returned by he5_gddeffld ', status
+        write(*,*)'Define: "tempfield"'
+        write(*,*)'status=he5_gddeffld(gdid2,"tempfield",
+     1"TestDim2,TestDim1","",HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)'
+        write(*,*)'Value returned by he5_gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid_utm,'Time','Timedim',"",
+     1HE5T_NATIVE_DOUBLE, HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+        write(10,*)' Define field Time'
+        write(10,*)'status=he5_gddeffld(gdid_utm,"Time","Timedim","",
+     1HE5T_NATIVE_DOUBLE,HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to he5_gddeffld ',status
+        write(*,*)' Define field Time'
+        write(*,*)'status=he5_gddeffld(gdid_utm,"Time","Timedim","",
+     1HE5T_NATIVE_DOUBLE,HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to he5_gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid_utm,'Height','Hghtdim',"",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+        write(10,*)' Define field Height'
+        write(10,*)'status=he5_gddeffld(gdid_utm,"Height","Hghtdim","",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to he5_gddeffld ',status
+        write(*,*)' Define field Height'
+        write(*,*)'status=he5_gddeffld(gdid_utm,"Height","Hghtdim","",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to he5_gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddeftle
+c
+      write(10,27)
+      write(10,*)'Testing gddeftle... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddeftle... '
+      write(*,*)'=================='
+
+      status = he5_gddeftle(gdid_utm,HE5_HDFE_TILE,2,tiledims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define tiling dimensions '
+        write(10,*)'status = he5_gddeftle(gdid_utm,
+     1HE5_HDFE_TILE,2,tiledims)'
+        write(10,*)'Status returned by call to he5_gddeftle ',status
+        write(*,*)'Status returned by call to he5_gddeftle ',status
+        write(*,*)'status = he5_gddeftle(gdid_utm,
+     1HE5_HDFE_TILE,2,tiledims)'
+        write(*,*)'Define tiling dimensions '
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid_utm,'SideB','YDim,Convection',"",
+     1HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define field that will be tiled '
+        write(10,*)'status=he5_gddeffld(gdid_utm,"SideB",
+     1"YDim,Convection","",HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to he5_gddeffld ',status
+        write(*,*)'Define field that will be tiled '
+        write(*,*)'status=he5_gddeffld(gdid_utm,"SideB",
+     1"YDim,Convection","",HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to he5_gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then 
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned value from he5_gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Returned value from he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if (gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdattach(gdfid,"UTMGrid")'
+         write(10,*)'Returned value from he5_gdattach ', status
+         write(*,*)'status = he5_gddetach(gdfid,"UTMGrid")'
+         write(*,*)'Returned value from he5_gdattach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid_utm,'Grounding','Conduction',"",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Define: "Grounding"'                  
+         write(10,*)'status=he5_gddeffld(gdid_utm,"Grounding",
+     1"Conduction","",HE5T_NATIVE_FLOAT,HDF_NOMERGE)'
+         write(10,*)'Value returned by he5_gddeffld ', status
+         write(*,*)'Define: "Grounding"'                  
+         write(*,*)'status=he5_gddeffld(gdid_utm,"Grounding",
+     1"Conduction","",HE5T_NATIVE_FLOAT,HDF_NOMERGE)'
+         write(*,*)'Value returned by he5_gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddefcomp
+c
+      write(10,27)
+      write(10,*)'Testing gddefcomp... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddefcomp... '
+      write(*,*)'=================='
+
+      tiledims(1) = 16
+      tiledims(2) = 15
+      status = he5_gddeftle(gdid_utm,HE5_HDFE_TILE,2,tiledims)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'Setup Tiling dimensions '
+         write(*,*)'Required when using compression'
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefcomp(gdid_utm,
+     1HE5_HDFE_COMP_DEFLATE, compparm)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Setup compression mode'
+        write(10,*)'status = he5_gddefcomp(gdid_utm,
+     1HE5_HDFE_COMP_DEFLATE,compparm)'
+        write(10,*)'Status returned by call to he5_gddefcomp ',status
+        write(*,*)'Setup compression mode'
+        write(*,*)'status = he5_gddefcomp(gdid_utm,
+     1HE5_HDFE_COMP_DEFLATE, compparm)'
+        write(*,*)'Status returned by call to he5_gddefcomp ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddeffld(gdid_utm,"Voltage","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "Voltage"'
+        write(10,*)'status = he5_gddeffld(gdid_utm,"Voltage",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)'
+        write(10,*)'Value returned from he5_gddeffld ', status
+        write(*,*)'Define: "Voltage"'
+        write(*,*)'status = he5_gddeffld(gdid_utm,"Voltage",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)'
+        write(*,*)'Value returned from he5_gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdsetfill
+c
+      write(10,27)
+      write(10,*)'Testing gdsetfill... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdsetfill... '
+      write(*,*)'=================='
+
+      status = he5_gdsetfill(gdid_utm, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Testing gdsetfill'
+         write(10,*)'status = he5_gdsetfill(gdid_utm, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(10,*)'Returned from he5_gdsetfill ', status
+         write(*,*)'Testing gdsetfill'
+         write(*,*)'status = he5_gdsetfill(gdid_utm, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(*,*)'Returned from he5_gdsetfill ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid_utm,"Drift","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "Drift"'      
+        write(10,*)'status=he5_gddeffld(gdid_utm,"Drift",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(10,*)'Value returned from he5_gddeffld ', status
+        write(*,*)'Define: "Drift"'      
+        write(*,*)'status=he5_gddeffld(gdid_utm,"Drift",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(*,*)'Value returned from he5_gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid_utm,"Impedance","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Define: "Impedance"'            
+         write(10,*)'status=he5_gddeffld(gdid_utm,"Impedance",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+         write(10,*)'Value returned from he5_gddeffld ', status
+         write(*,*)'Define: "Impedance"'            
+         write(*,*)'status=he5_gddeffld(gdid_utm,"Impedance",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+         write(*,*)'Value returned from he5_gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      status = he5_gddetach(gdid_utm)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned value from he5_gddetach ', status
+         write(*,*)'Returned value from he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if(gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(10,*)'Handle returned from he5_gdattach ', gdid_utm
+         write(*,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(*,*)'Handle returned from he5_gdattach ', gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdwrfld
+c
+      write(10,27)
+      write(10,*)'Testing gdwrfld... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdwrfld... '
+      write(*,*)'=================='
+
+      start(1) = 0
+      start(2) = 0
+      stride(1) = 1
+      stride(2) = 1
+      edge(1) = 80
+      edge(2) = 60
+      
+      status = he5_gdwrfld(gdid_utm, "Voltage", start, stride, 
+     1edge, utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Voltage '
+        write(10,*)'status=he5_gdwrfld(gdid_utm,"Voltage",start,
+     1stride,edge,utmray)'
+        write(10,*)'Status returned by he5_gdwrfield ', status
+        write(*,*)'Write to field Voltage '
+        write(*,*)'status=he5_gdwrfld(gdid_utm,"Voltage",start,
+     1stride,edge,utmray)'
+        write(*,*)'Status returned by he5_gdwrfield ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      start(1) = 10
+      start(2) = 10
+      edge(1) = 10
+      edge(2) = 10
+      status = he5_gdwrfld(gdid_utm, 'Drift', start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Drift '
+        write(10,*)'status = he5_gdwrfld(gdid_utm,"Drift",start,
+     1stride,edge,utmray)'
+        write(10,*)'Status returned from he5_gdwrfld ', status
+        write(*,*)'Write to field Drift '
+        write(*,*)'status = he5_gdwrfld(gdid_utm,"Drift",start,
+     1stride,edge,utmray)'
+        write(*,*)'Status returned from he5_gdwrfld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start(1) = 0
+      start(2) = 0
+      edge(1) = 80
+      edge(2) = 60
+      status = he5_gdwrfld(gdid_utm, 'Impedance', start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Impedance '
+        write(10,*)'status=he5_gdwrfld(gdid_utm,"Impedance",start,
+     1stride,edge,utmray)'
+        write(10,*)'Returned from he5_gdwrfld ', status
+        write(*,*)'Write to field Impedance '
+        write(*,*)'status=he5_gdwrfld(gdid_utm,"Impedance",start,
+     1stride,edge,utmray)'
+        write(*,*)'Returned from he5_gdwrfld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=4800
+      status=he5_gdwrfld(gdid_utm,'Time',start1d,stride1d,
+     1edge1d,utmtmeray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Time '
+        write(10,*)'status=he5_gdwrfld(gdid_utm,"Time",start1d,
+     1stride1d,edge1d,utmtmeray)'
+        write(10,*)'Status returned by call to he5_gdwrfld ',status
+        write(*,*)'Write to field Time '
+        write(*,*)'status=he5_gdwrfld(gdid_utm,"Time",start1d,
+     1stride1d,edge1d,utmtmeray)'
+        write(*,*)'Status returned by call to he5_gdwrfld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=80
+      status=he5_gdwrfld(gdid_utm,'Height',start1d,stride1d,
+     1edge1d,utmhght)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Height '
+        write(10,*)'status=he5_gdwrfld(gdid_utm,"Height",start1d,
+     1stride1d,edge1d,utmhght)'
+        write(10,*)'Status returned by call to he5_gdwrfld ',status
+        write(*,*)'Write to field Height '
+        write(*,*)'status=he5_gdwrfld(gdid_utm,"Height",start1d,
+     1stride1d,edge1d,utmhght)'
+        write(*,*)'Status returned by call to he5_gdwrfld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=250
+      status=he5_gdwrfld(gdid_utm,'Grounding',start1d,stride1d,
+     1edge1d,ray3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Grounding '
+        write(10,*)'status=he5_gdwrfld(gdid_utm,"Grounding",start1d,
+     1stride1d,edge1d,ray3)'
+        write(10,*)'Value returned by he5_gdwrfld ', status
+        write(*,*)'Write to field Grounding '
+        write(*,*)'status=he5_gdwrfld(gdid_utm,"Grounding",start1d,
+     1stride1d,edge1d,ray3)'
+        write(*,*)'Value returned by he5_gdwrfld ', status
+      endif
+        write(10,*)' '
+        write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Value of status returned by he5_gddetach ',
+     1status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Value of status returned by he5_gddetach ',
+     1status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(10,*)'Grid id returned by he5_gdattach ',gdid_utm
+         write(*,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(*,*)'Grid id returned by he5_gdattach ',gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdwrattr
+c
+      write(10,27)
+      write(10,*)'Testing gdwrattr... Global attribute '
+      write(10,*)'==================================== '
+      write(*,*)'Testing gdwrattr... Global attribute '
+      write(*,*)'==================================== '
+
+      status = he5_gdwrattr(gdid_utm, 'Resistance', 
+     1HE5T_NATIVE_INT, 4, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status=he5_gdwrattr(gdid_utm,"Resistance",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from he5_gdwrattr ', status
+         write(*,*)'status=he5_gdwrattr(gdid_utm,"Resistance",
+     1HE5T_NATIVE_FLOAT, 4, attr)'
+         write(*,*)'Returned from he5_gdwrattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdwrgattr
+c
+      write(10,27)
+      write(10,*)'Testing gdwrgattr... Group attribute '
+      write(10,*)'==================================== '
+      write(*,*)'Testing gdwrgattr... Group attribute '
+      write(*,*)'==================================== '
+
+      attr(1) = 22
+      attr(2) = 44
+      attr(3) = 66
+      attr(4) = 88
+      status = he5_gdwrgattr(gdid_utm, 'group', 
+     1HE5T_NATIVE_INT, 4, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status=he5_gdwrgattr(gdid_utm,"group",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from he5_gdwrgattr ', status
+         write(*,*)'status=he5_gdwrgattr(gdid_utm,"group",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(*,*)'Returned from he5_gdwrgattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdwrlattr
+c
+      write(10,27)
+      write(10,*)'Testing gdwrlattr... Local attribute '
+      write(10,*)'==================================== '
+      write(*,*)'Testing gdwrlattr... Local attribute '
+      write(*,*)'==================================== '
+
+      attr(1) = 12
+      attr(2) = 34
+      attr(3) = 56
+      attr(4) = 78
+      status = he5_gdwrlattr(gdid_utm,"Grounding", "local", 
+     1HE5T_NATIVE_INT, 4, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status=he5_gdwrlattr(gdid_utm,"Grounding",
+     1"local",HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from he5_gdwrlattr ', status
+         write(*,*)'status=he5_gdwrlattr(gdid_utm,"Grounding",
+     1"local",HE5T_NATIVE_INT, 4, attr)'
+         write(*,*)'Returned from he5_gdwrlattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned from he5_gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Returned from he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid2)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid2)'
+         write(10,*)'Value returned by he5_gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid2)'
+         write(*,*)'Value returned by he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdclose
+c
+      write(10,27)
+      write(10,*)'Testing gdclose... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdclose... '
+      write(*,*)'=================='
+
+      status = he5_gdclose(gdfid2)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdclose(gdfid2)'
+         write(10,*)'Value returned by he5_gdclose ', status
+         write(*,*)'status = he5_gdclose(gdfid2)'
+         write(*,*)'Value returned by he5_gdclose ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdclose(gdfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdclose(gdfid)'
+         write(10,*)'Returned from he5_gdclose ', status
+         write(*,*)'status = he5_gdclose(gdfid)'
+         write(*,*)'Returned from he5_gdclose ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      
+      gdfid = he5_gdopen('grid.he5',HE5F_ACC_RDWR)
+      if (gdfid .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)'
+         write(10,*)'gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Grid file id returned by he5_gdopen ',gdfid
+         write(10,*)'Grid file id returned by he5_gdopen ',gdfid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if (gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(10,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(*,*)'Grid id returned by he5_gdattach ',gdid_utm
+         write(10,*)'Grid id returned by he5_gdattach ',gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdinqgrid
+c
+      write(10,27)
+      write(10,*)'Testing gdinqgrid... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdinqgrid... '
+      write(*,*)'=================='
+
+      lstatus = he5_gdinqgrid('grid.he5',grdnames,strbufsize)
+      if (lstatus .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus=he5_gdinqgrid("grid.he5",
+     1grdnames,strbufsize)'
+         write(*,*)'Names of grids ',grdnames
+         write(*,*)'Number of grids ',lstatus
+         write(*,*)'Size of names of grids ',strbufsize
+         write(10,*)'lstatus=he5_gdinqgrid("grid.he5",
+     1grdnames,strbufsize)'
+         write(10,*)'Names of grids ',grdnames
+         write(10,*)'Number of grids ',lstatus
+         write(10,*)'Size of names of grids ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdorginfo
+c
+      write(10,27)
+      write(10,*)'Testing gdorginfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdorginfo... '
+      write(*,*)'=================='
+
+      status = he5_gdorginfo(gdid_utm, orgcode)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus = he5_gdorginfo(gdid_utm, orgcode)'
+         write(10,*)'lstatus = he5_gdorginfo(gdid_utm, orgcode)'
+         write(*,*)'Value returned by he5_gdorginfo ',status
+         write(10,*)'Value returned by he5_gdorginfo ',status
+         write(*,*)'Origin code value ',orgcode
+         write(10,*)'Origin code value ',orgcode
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdpreginfo
+c
+      write(10,27)
+      write(10,*)'Testing gdpreginfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdpreginfo... '
+      write(*,*)'=================='
+
+      status = he5_gdpreginfo(gdid_utm, pixregcode)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdpreginfo(gdid_utm, pixregcode)'
+         write(10,*)'status = he5_gdpreginfo(gdid_utm, pixregcode)'
+         write(*,*)'Value returned by he5_gdpreginfo ',status
+         write(10,*)'Value returned by he5_gdpreginfo ',status
+         write(*,*)'Pixel reg code ',pixregcode
+         write(10,*)'Pixel reg code ',pixregcode
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdinqdims
+c
+      write(10,27)
+      write(10,*)'Testing gdinqdims... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdinqdims... '
+      write(*,*)'=================='
+
+      status = he5_gdinqdims(gdid_utm, dimname, dims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdinqdims(gdid_utm, dimname, dims)'
+         write(*,*)'Number of dimensions ',status
+         write(*,*)'Dimensions in grid UTM ',dimname
+         write(*,*)'Size of dimensions '
+         write(10,*)'status = he5_gdinqdims(gdid_utm, dimname, dims)'
+         write(10,*)'Number of dimensions ',status
+         write(10,*)'Dimensions in grid UTM ',dimname
+         write(10,*)'Size of dimensions '
+         do 130 i=1,status
+            write(*,*)' ',dims(i)
+            write(10,*)' ',dims(i)
+ 130     continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddiminfo
+c
+      write(10,27)
+      write(10,*)'Testing gddiminfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddiminfo... '
+      write(*,*)'=================='
+
+      lstatus = he5_gddiminfo(gdid_utm, 'Conduction')
+      if (lstatus .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus = he5_gddiminfo(gdid_utm, "Conduction")'
+         write(*,*)'Size of dimension Conduction ',lstatus
+         write(10,*)'lstatus = he5_gddiminfo(gdid_utm, "Conduction")'
+         write(10,*)'Size of dimension Conduction ',lstatus
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdgridinfo
+c
+      write(10,27)
+      write(10,*)'Testing gdgridinfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdgridinfo... '
+      write(*,*)'=================='
+
+      status=he5_gdgridinfo(gdid_utm,xdimsize,ydimsize,
+     1upleftpt,lowrtpt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status=he5_gdgridinfo(gdid_utm,xdimsize,
+     1ydimsize,upleftpt,lowrtpt)'
+         write(*,*)'Status returned by he5_gdgridinfo ',status
+         write(*,11)'X dim size ',xdimsize, ' Y dim size ',ydimsize
+         write(*,12)'Upper left pt ',upleftpt(1),' ',upleftpt(2)
+         write(*,12)'Lower right pt ',lowrtpt(1),' ',lowrtpt(2)
+         write(10,*)'status=he5_gdgridinfo(gdid_utm,xdimsize,
+     1ydimsize,upleftpt,lowrtpt)'
+         write(10,*)'Value returned by he5_gdgridinfo ',status
+         write(10,*)'X dim size ',xdimsize, ' Y dim size ',ydimsize
+         write(10,*)'Upper left pt ',upleftpt(1),upleftpt(2)
+         write(10,*)'Lower right pt ',lowrtpt(1),lowrtpt(2)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+   11 format(a,i2,a,i2)
+   12 format(a,f14.5,a,f14.5)
+
+c Test Case -- gdprojinfo
+c
+      write(10,27)
+      write(10,*)'Testing gdprojinfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdprojinfo... '
+      write(*,*)'=================='
+
+      status = he5_gdprojinfo(gdid_utm,pcode,zcode,scode,pparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status=he5_gdprojinfo(gdid_utm,pcode,zcode,
+     1scode,pparm)'
+         write(*,*)'Status returned by he5_gdprojinfo ',status
+         write(*,*)'Projection code ',pcode, ' Zone code ',zcode
+         write(*,*)'Sphere code ',scode
+         write(10,*)'status=he5_gdprojinfo(gdid_utm,pcode,zcode,
+     1scode,pparm)'
+         write(10,*)'Value returned by he5_gdprojinfo ',status
+         write(10,*)'Projection code ',pcode, ' Zone code ',zcode
+         write(10,*)'Sphere code ',scode
+         do 140 i=1,16
+            write(*,55)' ',pparm(i)
+            write(10,55)' ',pparm(i)
+ 140     continue
+      endif
+   55 format(a,f5.2)
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdcompinfo
+c
+      write(10,27)
+      write(10,*)'Testing gdcompinfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdcompinfo... '
+      write(*,*)'=================='
+
+      status = he5_gdcompinfo(gdid_utm,'Voltage',
+     1compcodestring,compparm)
+      if (status .lt. zero) then
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status=he5_gdcompinfo(gdid_utm,"Voltage",
+     1compcode,compparm)'
+        write(10,*)'Compression info for field Voltage'
+        write(10,*)'Comp code ',compcodestring
+        write(10,*)'Compression parameters ',compparm
+        write(*,*)'status=he5_gdcompinfo(gdid_utm,"Voltage",
+     1compcode,compparm)'
+        write(*,*)'Compression info for field Voltage'
+        write(*,*)'Comp code ',compcodestring
+        write(*,*)'Compression parameters ',compparm
+      endif
+
+c Test Case -- gdinqflds
+c
+      write(10,27)
+      write(10,*)'Testing gdinqflds... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdinqflds... '
+      write(*,*)'=================='
+
+      nflds = he5_gdinqflds(gdid_utm,fldlist,rnk,numtype)
+      if (nflds .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'nflds = he5_gdinqflds(gdid_utm,fldlist,
+     1rnk,numtype)'
+         write(*,*)'Number of fields ',nflds
+         write(10,*)'nflds = he5_gdinqflds(gdid_utm,fldlist,
+     1rnk,numtype)'
+         write(10,*)'Number of fields ',nflds
+         if (nflds .ne. 0) then
+            write(*,*)'Fields ',fldlist
+            write(10,*)'Fields ',fldlist
+            do 150 i=1,nflds
+               write(*,*)'Rank and type ',rnk(i), ' ', numtype(i)
+               write(10,*)'Rank and type ',rnk(i), ' ', numtype(i)
+  150       continue
+         endif
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdfldinfo
+c
+      write(10,27)
+      write(10,*)'Testing gdfldinfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdfldinfo... '
+      write(*,*)'=================='
+
+      status=he5_gdfldinfo(gdid_utm,'Drift',rnk,dims,numtype,
+     1dimname,maxdimname)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status=he5_gdfldinfo(gdid_utm,"Drift",rnk,dims, 
+     1numtype, dimname, maxdimname)'
+         write(*,*)'Value returned by he5_gdfldinfo for field 
+     1Drift ',status
+         write(*,*)'Drift rank ',rnk(1)
+         write(*,*)'Dimensions  ',dims(1),' ',dims(2)
+         write(*,*)'Number type of field ',numtype(1)
+         write(*,*)'Dimension names ',dimname
+         write(10,*)'status=he5_gdfldinfo(gdid_utm,"Drift",rnk,dims, 
+     1numtype, dimname, maxdimname)'
+
+         write(10,*)'Value returned by he5_gdfldinfo for field 
+     1Drift ',status
+         write(10,*)'Drift rank ',rnk(1)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdrdfld
+c
+      write(10,27)
+      write(10,*)'Testing gdrdfld... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdrdfld... '
+      write(*,*)'=================='
+
+      start(1) = 0
+      start(2) = 0
+      stride(1) = 1
+      stride(2) = 1
+      edge(1) = 80
+      edge(2) = 60
+      status = he5_gdrdfld(gdid_utm,'Drift',start,stride,edge,
+     1tempray)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdrdfld(gdid_utm,"Drift",start,
+     1stride,edge,tempray)'
+         write(*,*)'Value returned by he5_gdrdfld ',status
+         write(10,*)'status = he5_gdrdfld(gdid_utm,"Drift",start,
+     1stride,edge,tempray)'
+         write(10,*)'Value returned by he5_gdrdfld ',status
+         do 65 ii=1,6
+           do 66 i=1,5
+              write(10,*)'Field value at ',ii,' ',i,'  ',tempray(ii,i)
+              write(*,*)'Field value at ',ii,' ',i,'  ',tempray(ii,i)
+   66      continue
+   65   continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdnentries
+c
+      write(10,27)
+      write(10,*)'Testing gdnentries... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdnentries... '
+      write(*,*)'=================='
+
+      n = he5_gdnentries(gdid_utm, HE5_HDFE_NENTDIM, strbufsize)
+      if (n .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'n = he5_gdnentries(gdid_utm,
+     1HE5_HDFE_NENTDIM, strbufsize)'
+         write(*,*)'Number of dimensions ', n
+         write(*,*)'Size of Dimension string ',strbufsize
+         write(10,*)'n = he5_gdnentries(gdid_utm, 
+     1HE5_HDFE_NENTDIM, strbufsize)'
+         write(10,*)'Number of dimensions ', n
+         write(10,*)'Size of Dimension string ',strbufsize
+      endif
+
+      n = he5_gdnentries(gdid_utm,HE5_HDFE_NENTDFLD,strbufsize)
+      if (n .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'n = he5_gdnentries(gdid_utm,HE5_HDFE_NENTDFLD,
+     1strbufsize)'
+         write(*,*)'Number of data fields ',n
+         write(*,*)'Size of Field string ',strbufsize
+         write(10,*)'n = he5_gdnentries(gdid_utm,HE5_HDFE_NENTDFLD,
+     1strbufsize)'
+         write(10,*)'Number of data fields ',n
+         write(10,*)'Size of Field string ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdattrinfo
+c
+      write(10,27)
+      write(10,*)'Testing gdattrinfo, Global attribute'
+      write(10,*)'===================================='
+      write(*,*)'Testing gdattrinfo, Global attribute'
+      write(*,*)'===================================='
+
+      status = he5_gdattrinfo(gdid_utm,'Resistance',ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status=he5_gdattrinfo(gdid_utm,"Resistance",
+     1ntype,count)'
+         write(*,*)'Value returned by he5_gdattrinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status=he5_gdattrinfo(gdid_utm,"Resistance",
+     1ntype,count)'
+         write(10,*)'Value returned by he5_gdattrinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdgatinfo
+c
+      write(10,27)
+      write(10,*)'Testing gdgatinfo, Group attribute'
+      write(10,*)'===================================='
+      write(*,*)'Testing gdgatinfo, Group attribute'
+      write(*,*)'===================================='
+
+      status = he5_gdgatinfo(gdid_utm,'group',ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdgatinfo(gdid_utm,"group",
+     1ntype,count)'
+         write(*,*)'Value returned by he5_gdgatinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdgatinfo(gdid_utm,"group",
+     1ntype,count)'
+         write(10,*)'Value returned by he5_gdgatinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdlatinfo
+c
+      write(10,27)
+      write(10,*)'Testing gdlatinfo, Local attribute'
+      write(10,*)'===================================='
+      write(*,*)'Testing gdlatinfo, Local attribute'
+      write(*,*)'===================================='
+
+      status = he5_gdlatinfo(gdid_utm,"Grounding","local",ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdlatinfo(gdid_utm,"Grounding",
+     1"local",ntype,count)'
+         write(*,*)'Value returned by he5_gdlatinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdlatinfo(gdid_utm,"Grounding",
+     1"local",ntype,count)'
+         write(10,*)'Value returned by he5_gdgatinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdrdattr
+c
+      write(10,27)
+      write(10,*)'Testing gdrdattr, Global attribute'
+      write(10,*)'=================================='
+      write(*,*)'Testing gdrdattr, Global attribute'
+      write(*,*)'=================================='
+
+      status = he5_gdrdattr(gdid_utm,'Resistance',iattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdattr(gdid_utm,"Resistance",iattr)'
+        write(*,*)'Value returned by he5_gdrdattr ',status
+        write(10,*)'status = he5_gdrdattr(gdid_utm,"Resistance",iattr)'
+        write(10,*)'Value returned by he5_gdrdattr ',status
+        do 67 i=1,count
+           write(10,*)'Attribute value  ',iattr(i)
+           write(*,*)'Attribute value   ',iattr(i)
+   67   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+  
+c Test Case -- gdrdgattr
+c
+      write(10,27)
+      write(10,*)'Testing gdrdgattr, Group attribute '
+      write(10,*)'=================================='
+      write(*,*)'Testing gdrdgattr, Group attribute'
+      write(*,*)'================================='
+
+      status = he5_gdrdgattr(gdid_utm,'group',gattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdgattr(gdid_utm,"group",gattr)'
+        write(*,*)'Value returned by he5_gdrdgattr ',status
+        write(10,*)'status = he5_gdrdgattr(gdid_utm,"group",gattr)'
+        write(10,*)'Value returned by he5_gdrdgattr ',status
+        do 68 i=1,count
+           write(10,*)'Attribute value  ',gattr(i)
+           write(*,*)'Attribute value   ',gattr(i)
+   68   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+  
+c Test Case -- gdinqdatatype
+c
+      write(10,27)
+      write(10,*)'Testing gdinqdatatype '
+      write(10,*)'====================='
+      write(*,*)'Testing gdinqdatatype'
+      write(*,*)'====================='
+
+      status = he5_gdinqdatatype(gdid_utm,"Grounding","local",
+     1HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+         write(*,*)'status = he5_gdinqdatatype(gdid_utm,"Grounding",
+     1"local",HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)'
+         write(*,*)'Data type of attribute ',dtype
+         write(*,*)'Class id of attribute ',classid
+         write(*,*)'Order of attribute ',order
+         write(*,*)'Size of attribute ',size
+         write(10,*)'status =he5_gdinqdatatype(gdid_utm,"Grounding",
+     1"local",HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)'
+         write(10,*)'Data type of attribute ',dtype
+         write(10,*)'Class id of attribute ',classid
+         write(10,*)'Order of attribute ',order
+         write(10,*)'Size of attribute ',size
+      endif
+      write(10,*)' '
+      write(*,*)' '
+c Test Case -- gdrdlattr
+c
+      write(10,27)
+      write(10,*)'Testing gdrdlattr, Local attribute '
+      write(10,*)'=================================='
+      write(*,*)'Testing gdrdlattr, Local attribute'
+      write(*,*)'================================='
+
+      status = he5_gdrdlattr(gdid_utm,"Grounding","local",lattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status=he5_gdrdlattr(gdid_utm,"Grounding",
+     1"local",lattr)'
+        write(*,*)'Value returned by he5_gdrdlattr ',status
+        write(10,*)'status=he5_gdrdlattr(gdid_utm,"Grounding",
+     1"local",lattr)'
+        write(10,*)'Value returned by he5_gdrdlattr ',status
+        do 69 i=1,count
+           write(10,*)'Attribute value  ',lattr(i)
+           write(*,*)'Attribute value   ',lattr(i)
+   69   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+  
+c Test Case -- gdinqattrs
+c
+      write(10,27)
+      write(10,*)'Testing gdinqattrs, Global attribute'
+      write(10,*)'===================================='
+      write(*,*)'Testing gdinqattrs, Global attribute'
+      write(*,*)'===================================='
+
+      lstatus = he5_gdinqattrs(gdid_utm, attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqattrs(gdid_utm, 
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by he5_gdinqattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqattrs(gdid_utm, 
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by he5_gdinqattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdinqgattrs
+c
+      write(10,27)
+      write(10,*)'Testing gdinqgattrs, Group attribute'
+      write(10,*)'===================================='
+      write(*,*)'Testing gdinqgattrs, Group attribute'
+      write(*,*)'===================================='
+
+      lstatus = he5_gdinqgattrs(gdid_utm, attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqgattrs(gdid_utm, 
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by he5_gdinqgattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqgattrs(gdid_utm,
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by he5_gdinqgattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdinqlattrs
+c
+      write(10,27)
+      write(10,*)'Testing gdinqlattrs, Local attribute'
+      write(10,*)'===================================='
+      write(*,*)'Testing gdinqlattrs, Local attribute'
+      write(*,*)'===================================='
+
+      lstatus = he5_gdinqlattrs(gdid_utm,"Grounding",
+     1attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqlattrs(gdid_utm,"Grounding",
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by he5_gdinqlattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqlattrs(gdid_utm,"Grounding",
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by he5_gdinqlattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdgetfill
+c
+      write(10,27)
+      write(10,*)'Testing gdgetfill... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdgetfill... '
+      write(*,*)'=================='
+
+      status = he5_gdgetfill(gdid_utm,'Drift',ifillv)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdgetfill(gdid_utm,"Drift",ifillv)'
+         write(*,*)'Value returned by he5_gdgetfill ',status
+         write(*,*)'Fill value ',ifillv
+         write(10,*)'status = he5_gdgetfill(gdid_utm,"Drift",ifillv)'
+         write(10,*)'Value returned by he5_gdgetfill ',status
+         write(10,*)'Fill value ',ifillv
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddefboxreg
+c
+      write(10,27)
+      write(10,*)'Testing gddefboxreg... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddefboxreg... '
+      write(*,*)'=================='
+
+      corlon(1)=-126.0
+      corlon(2)=-121.5
+      corlat(1)=-70.0
+      corlat(2)=-65.0
+
+      regionid = he5_gddefboxreg(gdid_utm,corlon,corlat)
+      if (regionid .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'regionid = he5_gddefboxreg(gdid_utm,corlon,corlat)'
+         write(*,*)'Region id returned by he5_gddefboxreg ',regionid
+         write(10,*)'regionid = he5_gddefboxreg(gdid_utm,corlon,corlat)'
+         write(10,*)'Region id returned by he5_gddefboxreg ',regionid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdreginfo
+c
+      write(10,27)
+      write(10,*)'Testing gdreginfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdreginfo... '
+      write(*,*)'=================='
+      status = he5_gdreginfo(gdid_utm,regionid,"Impedance",nt,rk,
+     1dims,size,iuplft,ilrgt)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdreginfo(gdid_utm,regionid,
+     1"Impedance",nt,rk,dims,size,iuplft,ilrgt)'
+         write(*,*)'Value returned by he5_gdreginfo ',status
+         write(*,*)'Number type of region ',nt
+         write(*,*)'Rank of region ',rk
+         write(*,*)'Size of region ',size
+         write(*,11)'Dimensions of region',dims(1),' ',dims(2)
+         write(*,12)'Upper left point of region ',
+     1iuplft(1),' ',iuplft(2)
+         write(*,12)'Lower right point of region ',ilrgt(1),' ',ilrgt(2)
+         write(10,*)'status = he5_gdreginfo(gdid_utm,regionid,
+     1"Impedance",nt,rk,dims,size,iuplft,ilrgt)'
+         write(10,*)'Value returned by he5_gdreginfo ',status
+         write(10,*)'Number type of region ',nt
+         write(10,*)'Rank of region ',rk
+         write(10,*)'Size of region ',size
+         write(10,11)'Dimensions of region',dims(1),' ',dims(2)
+         write(10,12)'Upper left point of region ',
+     1iuplft(1),' ',iuplft(2)
+         write(10,12)'Lower right point of region ',
+     1ilrgt(1),' ',ilrgt(2)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdextreg
+c
+      write(10,27)
+      write(10,*)'Testing gdextreg... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdextreg... '
+      write(*,*)'=================='
+
+      status = he5_gdextreg(gdid_utm,regionid,'Impedance',datbuf)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+
+         write(*,*)'status=he5_gdextreg(gdid_utm,regionid,
+     1"Impedance",datbuf)'
+         write(*,*)'Value returned by he5_gdextreg ',status
+         write(10,*)'status=he5_gdextreg(gdid_utm,
+     1regionid,"Impedance",datbuf)'
+         write(10,*)'Value returned by he5_gdextreg ',status
+         do 175 i=100,150
+            write(*,*)'Value of region ',datbuf(i)
+            write(10,*)'Value of region ',datbuf(i)
+  175    continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddeftmeper
+c
+      write(10,27)
+      write(10,*)'Testing gddeftmeper... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddeftmeper... '
+      write(*,*)'=================='
+
+      periodid = he5_gddeftmeper(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,starttime,stoptime)
+      if (periodid .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'periodid = he5_gddeftmeper(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,starttime,stoptime)'
+        write(10,*)'Define a time period '
+        write(10,*)'Period id returned by he5_gddeftmeper ',periodid
+        write(*,*)'periodid = he5_gddeftmeper(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,starttime,stoptime)'
+        write(*,*)'Define a time period '
+        write(*,*)'Period id returned by he5_gddeftmeper ',periodid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddefvrtreg
+c
+      write(10,27)
+      write(10,*)'Testing gddefvrtreg... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddefvrtreg... '
+      write(*,*)'=================='
+
+      regionid = he5_gddefvrtreg(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,'Height',range)
+      if (regionid .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+
+        write(10,*)'regionid = he5_gddefvrtreg(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,"Height",range)'
+        write(10,*)'Define a vertical region '
+        write(10,*)'Region id returned by he5_gddefvrtreg ',regionid
+        write(*,*)'regionid = he5_gddefvrtreg(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,"Height",range)'
+        write(*,*)'Define a vertical region '
+        write(*,*)'Region id returned by he5_gddefvrtreg ',regionid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddupreg
+c
+      write(10,27)
+      write(10,*)'Testing gddupreg... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddupreg... '
+      write(*,*)'=================='
+
+      regionid2 = he5_gddupreg(regionid)
+      if (regionid2 .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'regionid2 = he5_gddupreg(regionid)'
+        write(10,*)'Generate a new region id '
+        write(10,*)'New region id ',regionid2
+        write(*,*)'regionid2 = he5_gddupreg(regionid)'
+        write(*,*)'Generate a new region id '
+        write(*,*)'New region id ',regionid2
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdgetpix
+c
+      write(10,27)
+      write(10,*)'Testing gdgetpix... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdgetpix... '
+      write(*,*)'=================='
+
+      status = he5_gdgetpix(gdid_utm,5,lonval,latval,rowval,colval)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+
+        write(10,*)'status=he5_gdgetpix(gdid_utm,5,lonval,
+     1latval,rowval,colval)'
+        write(10,*)'Retrieve pixel row. column values '
+        write(*,*)'status = he5_gdgetpix(gdid_utm,5,lonval,latval,
+     1rowval,colval)'
+        write(*,*)'Retrieve pixel row. column values '
+        do 37 i=1,5
+           write(10,5)'Pixel position lon lat ',lonval(i),' ',
+     1latval(i),' ','Row Column ',rowval(i),' ',colval(i) 
+           write(*,5)'Pixel position lon lat ',lonval(i),' ',
+     1latval(i),' ','Row Column ',rowval(i),' ',colval(i) 
+   37   continue
+      endif
+    5 format(a,f6.1,a,f6.1,a,a,i2,a,i2)
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdgetpixval
+c
+      write(10,27)
+      write(10,*)'Testing gdgetpixval... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdgetpixval... '
+      write(*,*)'=================='
+
+      lstatus = he5_gdgetpixval(gdid_utm,5,rowval,
+     1colval,"Voltage",fldval)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'lstatus = he5_gdgetpixval(gdid_utm,5,rowval,colval,
+     1"Voltage",fldval)'
+        write(10,*)'Retrieve pixel values for specific locations '
+        write(*,*)'lstatus = he5_gdgetpixval(gdid_utm,5,rowval,colval,
+     1"Voltage",fldval)'
+        write(*,*)'Retrieve pixel values for specific locations '
+        do 42 i=1,5
+           write(10,17)'Row Col ',rowval(i),' ',colval(i),' ',
+     1'Pixel Value ',fldval(i)
+           write(*,17)'Row Col ',rowval(i),' ',colval(i),' ',
+     1'Pixel Value ',fldval(i)
+   42   continue
+      endif
+   17 format(a8,i2,a1,i2,a1,a12,f9.3)
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- gdinterpolate
+c
+      write(10,27)
+      write(10,*)'Testing gdinterpolate... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdinterpolate... '
+      write(*,*)'=================='
+
+      lstatus=he5_gdinterpolate(gdid_utm,5,lonval,latval,
+     1'Voltage',interval)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'lstatus=he5_gdinterpolate(gdid_utm,5,lonval,latval,
+     1"Voltage",interval)'
+        write(10,*)'Interpolate 5 values for field Voltage '
+        write(*,*)'lstatus=he5_gdinterpolate(gdid_utm,5,lonval,latval,
+     1"Voltage",interval)'
+        write(*,*)'Interpolate 5 values for field Voltage '
+        write(*,*)'Status returned by call to he5_gdinterpolate ',
+     1lstatus
+        do 38 index1=1,5
+           write(*,4)'Interpolated value ',interval(index1,1)
+           write(10,4)'Interpolated value ',interval(index1,1)
+   38   continue
+      endif
+    4 format(a,f9.3)
+      write(10,*)' '
+      write(*,*)' '
+
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Value returned by he5_gddetach ',status
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Value returned by he5_gddetach ',status
+      endif
+
+      status = he5_gdclose(gdfid)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdclose(gdfid)'
+         write(*,*)'Returned from he5_gdclose ', status
+         write(10,*)'status = he5_gdclose(gdfid)'
+         write(10,*)'Returned from he5_gdclose ', status
+      endif
+
+      close(unit=10)
+  27  format('
')
+      stop
+      end
+
+
+
+
+
+
diff --git a/testdrivers/grid/testgrid64.f b/testdrivers/grid/testgrid64.f
new file mode 100755
index 0000000..556633b
--- /dev/null
+++ b/testdrivers/grid/testgrid64.f
@@ -0,0 +1,2560 @@
+c----------------------------------------------------------------------------
+c     Copyright (C) 2000   Emergent IT Inc. and Raytheon Systems Company    |
+c----------------------------------------------------------------------------
+c testgrid64.f                                                              |
+c In this program we create, define and write a simple grid hdfeos file     |
+c using the grid interface                                                  |
+c----------------------------------------------------------------------------
+
+      program       testgrid64
+
+      implicit      none
+ 
+      include       'hdfeos5.inc'
+
+      integer   	status, i, ii
+      integer		compparm(5)
+      integer 	    gdfid, gdfid2, gdid_utm, gdid2
+      integer 	    zonecode, pixregcode, orgcode
+      integer	    attr(4), iattr(4), gattr(4), lattr(4)
+      integer 	    spherecode, zero
+      integer		regionid, regionid2
+      integer	    dtype, classid, order
+      integer	    he5_gdopen, he5_gdcreate
+      integer       he5_gdattach, he5_gddetach
+      integer	    he5_gdclose, he5_gddefproj
+      integer       he5_gddefdim, he5_gdinqdatatype
+      integer	    he5_gddeftle, he5_gddeffld
+      integer       he5_gdsetfill, he5_gdwrfld
+      integer	    he5_gdwrattr, he5_gdwrgattr
+      integer       he5_gdwrlattr, he5_gdorginfo
+      integer	    he5_gddefcomp, he5_gdinqflds
+      integer       he5_gdprojinfo
+      integer	    he5_gdrdfld, he5_gdattrinfo
+      integer       he5_gdgatinfo
+      integer       he5_gdlatinfo, he5_gdrdattr
+      integer       he5_gdrdgattr, he5_gdrdlattr
+      integer	    he5_gdreginfo, he5_gddeftmeper
+      integer       he5_gddefvrtreg
+      integer	    he5_gddeforigin, he5_gddefpreg
+      integer       he5_gdinqdims, he5_gdgetfill
+      integer	    he5_gdgridinfo, he5_gdcompinfo
+      integer       he5_gdfldinfo, he5_gddefboxreg
+      integer	    he5_gdgetpix, he5_gddupreg
+      integer       he5_gdpreginfo, he5_gdextreg
+      integer		rnk(8), numtype(8)
+      integer		zcode, scode, nflds
+
+      integer*4	    ntype
+      integer*4		nt, rk
+      integer*4		periodid
+      integer*4		lstatus, n, one      
+      integer*4		index1
+      integer*4		index2
+      integer*4		dimsizes(2)
+      integer*4		lat(40,50)
+      integer*4		latcnt
+      integer*4		lon(40,50)
+      integer*4		loncnt
+      integer*4	    he5_gdinqgrid, he5_gddiminfo
+      integer*4     he5_gdnentries
+      integer*4	    he5_gdinqattrs, he5_gdinqgattrs
+      integer*4     he5_gdinqlattrs
+      integer*4	    pcode
+
+      integer*8	    xdim, ydim
+      integer*8	    testdim1, testdim2, hghtdim, conduction
+      integer*8	    timedim, convection, setcount(1)
+      integer*8 	start(2)
+      integer*8 	stride(2)
+      integer*8 	edge(2)
+      integer*8 	start1d, stride1d, edge1d
+      integer*8		tiledims(2)
+      integer*8	    count, nlonlat
+      integer*8	    size
+      integer*8		rowval(5), colval(5)
+      integer*8	    xdimsize, ydimsize
+      integer*8	    he5_gdgetpixval, he5_gdinterpolate
+      integer*8	    strbufsize
+      integer*8		dims(8)
+
+      real		    fillvalue, ifillv
+
+      real*4		ray3(250)
+      real*4		utmray(60,80), georay(60,80)
+      real*4		utmhght(80)
+      real*4		hghtinit
+      real*4		utmcnt, geocnt
+      real*4		raycnt, ray3cnt
+      real*4		tempray(60,80)
+      real*4		datbuf(4800)
+      real*4		fldval(5)
+      
+      real*8		starttime, stoptime
+      real*8		range(2)
+      real*8		projparm(16), pparm(16)
+      real*8		uplft(2), lowrgt(2)
+      real*8		iuplft(2), ilrgt(2)
+      real*8		interval(5,2)
+      real*8		lonval(5), latval(5)
+      real*8		utmtmeray(4800)
+      real*8		tmeinit
+      real*8		upleftpt(2), lowrtpt(2),corlon(2),corlat(2)
+
+      character*80	grdnames, dimname, fldlist, attrlist
+      character*80	compcodestring, maxdimname
+      
+
+      index1 = 0
+      index2 = 0
+      dimsizes(1) = 40
+      dimsizes(2) = 100
+      compparm(1) = 0
+      compparm(2) = 0
+      compparm(3) = 0
+      compparm(4) = 0
+      compparm(5) = 0
+      fillvalue = 1996.0
+      raycnt = -799.0
+      ray3cnt = -19.5
+      attr(1) = 11
+      attr(2) = 33
+      attr(3) = 55
+      attr(4) = 77
+      utmcnt=-799.0
+      geocnt=2001.0
+      hghtinit = 323.0
+      tmeinit = 35232487.2d0
+      starttime = 35233000.8d0
+      stoptime = 35435050.9d0
+      range(1) = 352.8d0
+      range(2) = 400.9d0
+      lonval(1) = -122.0d0
+      latval(1) = -68.0d0
+      lonval(2) = -122.5d0
+      latval(2) = -68.0d0
+      lonval(3) = -123.0d0
+      latval(3) = -68.0d0
+      lonval(4) = -123.5d0
+      latval(4) = -68.0d0
+      lonval(5) = -124.0d0
+      latval(5) = -68.0d0
+      tiledims(1) = 16
+      tiledims(2) = 15
+
+      latcnt = 38.0
+      loncnt = 78.0
+      zero = 0
+      one = 1
+      
+c
+c This section of the program just fills some arrays with data that we will
+c use later in the program
+c
+      do 70 index1=1,60
+         do 80 index2=1,80
+            utmray(index2,index1) = utmcnt
+            georay(index2,index1) = geocnt
+            utmcnt = utmcnt + .4
+            geocnt = geocnt + .2
+   80   continue
+   70 continue
+  
+      
+      do 30 index1=1,250
+            ray3(index1) = ray3cnt
+            ray3cnt = ray3cnt + .1
+   30 continue
+      
+      do 32 index1=1,80
+            utmhght(index1) = hghtinit
+            hghtinit = hghtinit + 2.75
+   32 continue
+
+      do 34 index1=1,4800
+            utmtmeray(index1) = tmeinit
+            tmeinit = tmeinit + 70.7
+   34 continue
+
+      do 50 index1=1,50
+         do 60 index2=1,40      
+            lat(index2,index1) = latcnt
+            lon(index2,index1) = loncnt
+            loncnt = loncnt - 0.1
+   60    continue
+         latcnt = latcnt + 0.1
+         loncnt = 78.0
+   50 continue
+
+  230 format('********Error unexpected**********')
+  231 format('********Error Expected************')
+  240 format('***********Passed Test*********')
+
+
+      open(unit=10,file='testgrid.txt', status = "UNKNOWN")
+
+      write(*,*)'Testing Grid FORTRAN 77 interface '
+      write(*,*)'=================================='
+      write(10,*)'Testing Grid FORTRAN 77 interface '
+      write(10,*)'=================================='
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdopen
+c
+      write(10,*)'Testing he5_gdopen... '
+      write(10,*)'======================'
+      write(*,*)'Testing he5_gdopen... '
+      write(*,*)'======================'
+      gdfid2 = he5_gdopen("grid2.he5",HE5F_ACC_TRUNC)
+      if (gdfid2 .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdfid2 = he5_gdopen("grid2.he5",HE5F_ACC_TRUNC)'
+         write(10,*)'Value returned by gdopen ', gdfid2
+         write(*,*)'gdfid2 = he5_gdopen("grid2.he5",HE5F_ACC_TRUNC)'
+         write(*,*)'Value returned by gdopen ', gdfid2
+      endif
+      write(*,*)' '
+      write(10,*)' '
+
+      gdfid = he5_gdopen('grid.he5',HE5F_ACC_TRUNC)
+      if (gdfid .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'Opening file grid.he5'
+         write(10,*)'Opening file grid.he5'
+         write(10,*) 'gdfid = he5_gdopen("grid.he5",HE5F_ACC_TRUNC)'
+         write(10,*) 'File id returned from gdopen ', gdfid
+         write(*,*) 'gdfid = he5_gdopen("grid.he5",HE5F_ACC_TRUNC)'
+         write(*,*) 'File id returned from gdopen ', gdfid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- he5_gdcreate
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdcreate... '
+      write(10,*)'========================'
+      write(*,*)'Testing he5_gdcreate... '
+      write(*,*)'========================'
+
+      xdim      = 60
+      ydim      = 80
+      uplft(1)  = 353299.39125d0
+      uplft(2)  = -7100284.64348d0
+      lowrgt(1) = 603434.52148d0
+      lowrgt(2) = -7991341.17870d0
+
+
+      gdid2 = he5_gdcreate(gdfid2, 'UTMGrid2', 
+     1xdim, ydim, uplft, lowrgt)
+      if (gdid2 .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*) 'Create UTMGrid2'
+         write(*,*)'gdid2 = he5_gdcreate(gdfid2, "UTMGrid2", 
+     1xdim, ydim, uplft, lowrgt)'
+         write(10,*) 'Value returned by gdcreate ', gdid2
+         write(*,*) 'Create UTMGrid2'
+         write(10,*)'gdid2 = he5_gdcreate(gdfid2, "UTMGrid2",
+     1xdim, ydim, uplft, lowrgt)'
+         write(*,*) 'Value returned by gdcreate ', gdid2
+      endif
+      
+    
+      gdid_utm = he5_gdcreate(gdfid, 'UTMGrid', xdim, ydim, 
+     1uplft, lowrgt)
+      if (gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Creating UTMGrid'
+         write(*,*)'Creating UTMGrid'
+         write(*,*)'gdid_utm= he5_gdcreate(gdfid,"UTMGrid",xdim,
+     1ydim,uplft,lowrgt)'
+         write(10,*)'gdid_utm= he5_gdcreate(gdfid,"UTMGrid",xdim,
+     1ydim,uplft,lowrgt)'
+         write(10,*)'UTM grid id returned from gdcreate ',gdid_utm
+         write(*,*)'UTM grid id returned from gdcreate ',gdid_utm
+      endif 
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddefproj
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddefproj... '
+      write(10,*)'========================'
+      write(*,*)'Testing he5_gddefproj... '
+      write(*,*)'========================'
+
+      zonecode = 10
+      spherecode = 0
+
+      do 120 index1=1,16
+         projparm(index1)=0
+ 120  continue
+  
+      status = he5_gddefproj(gdid_utm,HE5_GCTP_UTM,zonecode,
+     1spherecode,projparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Defining UTM projection'
+         write(*,*)'Defining UTM projection'
+         write(*,*)'status= he5_gddefproj(gdid_utm,HE5_GCTP_UTM,
+     1zonecode,spherecode, projparm)'
+         write(10,*)'status= he5_gddefproj(gdid_utm,HE5_GCTP_UTM,
+     1zonecode,spherecode, projparm)'
+         write(10,*)'Returned value from gddefproj ', status
+         write(*,*)'Returned value from gddefproj ', status
+      endif 
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefproj(gdid2,HE5_GCTP_UTM,zonecode,
+     1spherecode,projparm)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Defining UTM'
+         write(10,*)'status = he5_gddefproj(gdid2,HE5_GCTP_UTM,
+     1zonecode,spherecode,projparm)'
+         write(10,*)'Value returned by gddefproj ', status
+         write(*,*)'Defining UTM'
+         write(*,*)'status = he5_gddefproj(gdid2,HE5_GCTP_UTM,
+     1zonecode,spherecode,projparm)'
+         write(*,*)'Value returned by gddefproj ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- he5_gddefpreg
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddefpreg... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddefpreg... '
+      write(*,*)'=========================='
+      status = he5_gddefpreg(gdid_utm, HE5_HDFE_CORNER)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddefpreg(gdid_utm, 
+     1HE5_HDFE_CORNER)'
+         write(10,*)'status = he5_gddefpreg(gdid_utm, 
+     1HE5_HDFE_CORNER)'
+         write(10,*)'Returned from gddefpreg ', status
+         write(*,*)'Returned from gddefpreg ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddeforigin
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddeforigin... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddeforigin... '
+      write(*,*)'=========================='
+      status = he5_gddeforigin(gdid_utm,HE5_HDFE_GD_UL)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddeforigin(gdid_utm,
+     1HE5_HDFE_GD_UL)'
+         write(*,*)'Value of status from gddeforigin ',status
+         write(10,*)'status = he5_gddeforigin(gdid_utm,
+     1HE5_HDFE_GD_UL)'
+         write(10,*)'Value of status from gddeforigin ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddefdim
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddefdim... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddefdim... '
+      write(*,*)'=========================='
+      testdim1 = 40
+      status = he5_gddefdim(gdid2,'TestDim1',testdim1)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid2,"TestDim1",40)'
+         write(10,*)'Value returned by gddefdim ', status
+         write(*,*)'status = he5_gddefdim(gdid2,"TestDim1",40)'
+         write(*,*)'Value returned by gddefdim ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      testdim2 = 25
+      status = he5_gddefdim(gdid2, 'TestDim2', testdim2)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid2,"TestDim2",25)'
+         write(10,*)'Value returned by gddefdim ', status
+         write(*,*)'status = he5_gddefdim(gdid2,"TestDim2",25)'
+         write(*,*)'Value returned by gddefdim ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      conduction = 250
+      status = he5_gddefdim(gdid_utm, 'Conduction', conduction)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid_utm,
+     1"Conduction",250)'
+         write(10,*)'Returned value from gddefdim ', status
+         write(*,*)'status = he5_gddefdim(gdid_utm, 
+     1"Conduction", 250)'
+         write(*,*)'Returned value from gddefdim ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      timedim = 4800
+      status = he5_gddefdim(gdid_utm,'Timedim',timedim)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid_utm,
+     1"Timedim",4800)'
+         write(10,*)'Status returned by call to gddefdim ',status
+         write(*,*)'status = he5_gddefdim(gdid_utm,
+     1"Timedim",4800)'
+         write(*,*)'Status returned by call to gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      hghtdim = 80
+      status = he5_gddefdim(gdid_utm,'Hghtdim',hghtdim)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status = he5_gddefdim(gdid_utm,"Hghtdim",80)'
+        write(10,*)'Status returned by call to gddefdim ',status
+        write(*,*)'status = he5_gddefdim(gdid_utm,"Hghtdim",80)'
+        write(*,*)'Status returned by call to gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      convection = 60
+      status = he5_gddefdim(gdid_utm,'Convection',convection)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define dimension Convection '
+        write(10,*)'status = he5_gddefdim(gdid_utm,
+     1"Convection",60)'
+        write(10,*)'Status returned by call to gddefdim ',status
+        write(*,*)'Define dimension Convection '
+        write(*,*)'status = he5_gddefdim(gdid_utm,
+     1"Convection",60)'
+        write(*,*)'Status returned by call to gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddetach
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddetach... '
+      write(10,*)'======================='
+      write(*,*)'Testing he5_gddetach... '
+      write(*,*)'======================='
+      status = he5_gddetach(gdid2)
+      if(status .lt. zero) then
+         write(*,231)
+         write(10,231)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid2)'
+         write(10,*)'Value returned by gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid2)'
+         write(*,*)'Value returned by gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned value from gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Returned value from gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+ 
+c Test Case -- he5_gdattach
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdattach... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdattach... '
+      write(*,*)'=========================='
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if(gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid_utm=he5_gdattach(gdfid,"UTMGrid")'
+         write(10,*)'Handle returned from gdattach ',gdid_utm
+         write(*,*)'gdid_utm=he5_gdattach(gdfid,"UTMGrid")'
+         write(*,*)'Handle returned from gdattach ',gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid2 = he5_gdattach(gdfid2, 'UTMGrid2')
+      if(gdid2 .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid2=he5_gdattach(gdfid2, "UTMGrid2")'
+         write(10,*)'Value returned by gdattach ', gdid2
+         write(*,*)'gdid2=he5_gdattach(gdfid2, "UTMGrid2")'
+         write(*,*)'Value returned by gdattach ', gdid2
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddeffld
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddeffld... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddeffld... '
+      write(*,*)'=========================='
+
+      status= he5_gddeffld(gdid2,"tempfield","TestDim2,TestDim1",
+     1" ",HE5T_NATIVE_FLOAT, HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,231)
+         write(10,231)
+        
+      else 
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "tempfield"'
+        write(10,*)'status= he5_gddeffld(gdid2,"tempfield",
+     1"TestDim2,TestDim1"," ",HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)'
+        write(10,*)'Value returned by gddeffld ', status
+        write(*,*)'Define: "tempfield"'
+        write(*,*)'status= he5_gddeffld(gdid2,"tempfield",
+     1"TestDim2,TestDim1","",HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)'
+        write(*,*)'Value returned by gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid_utm,'Time','Timedim'," ",
+     1HE5T_NATIVE_DOUBLE, HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+        write(10,*)' Define field Time'
+        write(10,*)'status= he5_gddeffld(gdid_utm,"Time","Timedim",
+     1"",HE5T_NATIVE_DOUBLE, HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to gddeffld ',status
+        write(*,*)' Define field Time'
+        write(*,*)'status= he5_gddeffld(gdid_utm,"Time","Timedim",
+     1"",HE5T_NATIVE_DOUBLE, HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid_utm,'Height','Hghtdim'," ", 
+     1HE5T_NATIVE_FLOAT, HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+        write(10,*)' Define field Height'
+        write(10,*)'status= he5_gddeffld(gdid_utm,"Height",
+     1"Hghtdim","",HE5T_NATIVE_FLOAT, HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to gddeffld ',status
+        write(*,*)' Define field Height'
+        write(*,*)'status= he5_gddeffld(gdid_utm,"Height","Hghtdim",
+     1"",HE5T_NATIVE_FLOAT, HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddeftle
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddeftle... '
+      write(10,*)'======================='
+      write(*,*)'Testing he5_gddeftle... '
+      write(*,*)'======================='
+
+      status = he5_gddeftle(gdid_utm,HE5_HDFE_TILE,2,tiledims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define tiling dimensions '
+        write(10,*)'status = he5_gddeftle(gdid_utm,
+     1HE5_HDFE_TILE,2,tiledims)'
+        write(10,*)'Status returned by call to gddeftle ',status
+        write(*,*)'Status returned by call to gddeftle ',status
+        write(*,*)'status = he5_gddeftle(gdid_utm,
+     1HE5_HDFE_TILE,2,tiledims)'
+        write(*,*)'Define tiling dimensions '
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid_utm,'SideB','YDim,Convection',
+     1" ",HE5T_NATIVE_INT, HE5_HDFE_NOMERGE)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define field that will be tiled '
+        write(10,*)'status= he5_gddeffld(gdid_utm,"SideB",
+     1"YDim,Convection"," ",HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to gddeffld ',status
+        write(*,*)'Define field that will be tiled '
+        write(*,*)'status= he5_gddeffld(gdid_utm,"SideB",
+     1"YDim,Convection","",HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then 
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned value from gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Returned value from gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if (gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdattach(gdfid,"UTMGrid")'
+         write(10,*)'Returned value from gdattach ', status
+         write(*,*)'status = he5_gddetach(gdfid,"UTMGrid")'
+         write(*,*)'Returned value from gdattach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid_utm,'Grounding','Conduction',
+     1" ",HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Define: "Grounding"'                  
+         write(10,*)'status= he5_gddeffld(gdid_utm,"Grounding",
+     1"Conduction","",HE5T_NATIVE_FLOAT,HE5_HDF_NOMERGE)'
+         write(10,*)'Value returned by gddeffld ', status
+         write(*,*)'Define: "Grounding"'                  
+         write(*,*)'status= he5_gddeffld(gdid_utm,"Grounding",
+     1"Conduction","",HE5T_NATIVE_FLOAT,HE5_HDF_NOMERGE)'
+         write(*,*)'Value returned by gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddefcomp
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddefcomp... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddefcomp... '
+      write(*,*)'=========================='
+
+      tiledims(1) = 16
+      tiledims(2) = 15
+      status = he5_gddeftle(gdid_utm,HE5_HDFE_TILE,2,tiledims)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'Setup Tiling dimensions '
+         write(*,*)'Required when using compression'
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefcomp(gdid_utm,HE5_HDFE_COMP_DEFLATE, compparm)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Setup compression mode'
+        write(10,*)'status = he5_gddefcomp(gdid_utm,
+     1HE5_HDFE_COMP_DEFLATE, compparm)'
+        write(10,*)'Status returned by call to gddefcomp ',status
+        write(*,*)'Setup compression mode'
+        write(*,*)'status = he5_gddefcomp(gdid_utm,
+     1HE5_HDFE_COMP_DEFLATE, compparm)'
+        write(*,*)'Status returned by call to gddefcomp ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid_utm,"Voltage","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT,0)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "Voltage"'
+        write(10,*)'status = he5_gddeffld(gdid_utm,"Voltage",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(10,*)'Value returned from gddeffld ', status
+        write(*,*)'Define: "Voltage"'
+        write(*,*)'status = he5_gddeffld(gdid_utm,"Voltage",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(*,*)'Value returned from gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdsetfill
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdsetfill... '
+      write(10,*)'========================'
+      write(*,*)'Testing he5_gdsetfill... '
+      write(*,*)'========================='
+
+      status = he5_gdsetfill(gdid_utm, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Testing he5_gdsetfill'
+         write(10,*)'status = he5_gdsetfill(gdid_utm, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(10,*)'Returned from gdsetfill ', status
+         write(*,*)'Testing he5_gdsetfill'
+         write(*,*)'status = he5_gdsetfill(gdid_utm, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(*,*)'Returned from gdsetfill ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid_utm,"Drift","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "Drift"'      
+        write(10,*)'status= he5_gddeffld(gdid_utm,"Drift","YDim,XDim",
+     1"",HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)'
+        write(10,*)'Value returned from gddeffld ', status
+        write(*,*)'Define: "Drift"'      
+        write(*,*)'status= he5_gddeffld(gdid_utm,"Drift","YDim,XDim",
+     1"",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(*,*)'Value returned from gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid_utm,'Impedance','YDim,XDim'," ",
+     1HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Define: "Impedance"'            
+         write(10,*)'status= he5_gddeffld(gdid_utm,"Impedance",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+         write(10,*)'Value returned from gddeffld ', status
+         write(*,*)'Define: "Impedance"'            
+         write(*,*)'status= he5_gddeffld(gdid_utm,"Impedance",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+         write(*,*)'Value returned from gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      status = he5_gddetach(gdid_utm)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned value from gddetach ', status
+         write(*,*)'Returned value from gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if(gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(10,*)'Handle returned from gdattach ', gdid_utm
+         write(*,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(*,*)'Handle returned from gdattach ',gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdwrfld
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdwrfld... '
+      write(10,*)'======================'
+      write(*,*)'Testing he5_gdwrfld... '
+      write(*,*)'======================'
+
+      start(1) = 0
+      start(2) = 0
+      stride(1) = 1
+      stride(2) = 1
+      edge(1) = 80
+      edge(2) = 60
+      
+      status = he5_gdwrfld(gdid_utm,"Voltage",start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Voltage '
+        write(10,*)'status= he5_gdwrfld(gdid_utm,"Voltage",start,
+     1stride,edge,utmray)'
+        write(10,*)'Status returned by gdwrfield ', status
+        write(*,*)'Write to field Voltage '
+        write(*,*)'status= he5_gdwrfld(gdid_utm,"Voltage",start,
+     1stride,edge,utmray)'
+        write(*,*)'Status returned by gdwrfield ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      start(1) = 10
+      start(2) = 10
+      edge(1) = 10
+      edge(2) = 10
+      status=he5_gdwrfld(gdid_utm,'Drift',start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Drift '
+        write(10,*)'status=he5_gdwrfld(gdid_utm,"Drift",start,
+     1stride,edge,utmray)'
+        write(10,*)'Status returned from gdwrfld ', status
+        write(*,*)'Write to field Drift '
+        write(*,*)'status = he5_gdwrfld(gdid_utm,"Drift",start,
+     1stride,edge,utmray)'
+        write(*,*)'Status returned from gdwrfld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start(1) = 0
+      start(2) = 0
+      edge(1) = 80
+      edge(2) = 60
+      status = he5_gdwrfld(gdid_utm, 'Impedance', start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Impedance '
+        write(10,*)'status= he5_gdwrfld(gdid_utm,"Impedance",start,
+     1stride,edge,utmray)'
+        write(10,*)'Returned from gdwrfld ', status
+        write(*,*)'Write to field Impedance '
+        write(*,*)'status= he5_gdwrfld(gdid_utm,"Impedance",start,
+     1stride,edge,utmray)'
+        write(*,*)'Returned from gdwrfld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=4800
+      status= he5_gdwrfld(gdid_utm,'Time',start1d,stride1d,
+     1edge1d,utmtmeray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Time '
+        write(10,*)'status= he5_gdwrfld(gdid_utm,"Time",start1d,
+     1stride1d,edge1d,utmtmeray)'
+        write(10,*)'Status returned by call to gdwrfld ',status
+        write(*,*)'Write to field Time '
+        write(*,*)'status= he5_gdwrfld(gdid_utm,"Time",start1d,stride1d,
+     1edge1d,utmtmeray)'
+        write(*,*)'Status returned by call to gdwrfld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=80
+      status= he5_gdwrfld(gdid_utm,'Height',start1d,stride1d,
+     1edge1d,utmhght)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Height '
+        write(10,*)'status= he5_gdwrfld(gdid_utm,"Height",start1d,
+     1stride1d,edge1d,utmhght)'
+        write(10,*)'Status returned by call to gdwrfld ',status
+        write(*,*)'Write to field Height '
+        write(*,*)'status= he5_gdwrfld(gdid_utm,"Height",start1d,
+     1stride1d,edge1d,utmhght)'
+        write(*,*)'Status returned by call to gdwrfld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=250
+      status= he5_gdwrfld(gdid_utm,'Grounding',start1d,
+     1stride1d,edge1d,ray3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Grounding '
+        write(10,*)'status= he5_gdwrfld(gdid_utm,"Grounding",start1d,
+     1stride1d,edge1d,ray3)'
+        write(10,*)'Value returned by gdwrfld ', status
+        write(*,*)'Write to field Grounding '
+        write(*,*)'status= he5_gdwrfld(gdid_utm,"Grounding",start1d,
+     1stride1d,edge1d,ray3)'
+        write(*,*)'Value returned by gdwrfld ', status
+      endif
+        write(10,*)' '
+        write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Value of status returned by gddetach ',status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Value of status returned by gddetach ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(10,*)'Grid id returned by gdattach ',gdid_utm
+         write(*,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(*,*)'Grid id returned by gdattach ',gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdwrattr
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdwrattr... Global attribute '
+      write(10,*)'==================================== '
+      write(*,*)'Testing he5_gdwrattr... Global attribute '
+      write(*,*)'==================================== '
+
+      setcount(1) = 4
+      status = he5_gdwrattr(gdid_utm, 'Resistance', HE5T_NATIVE_INT, 
+     1setcount, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status= he5_gdwrattr(gdid_utm,"Resistance",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from gdwrattr ', status
+         write(*,*)'status= he5_gdwrattr(gdid_utm,"Resistance",
+     1HE5T_NATIVE_FLOAT, 4, attr)'
+         write(*,*)'Returned from gdwrattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdwrgattr
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdwrgattr... Group attribute '
+      write(10,*)'==================================== '
+      write(*,*)'Testing he5_gdwrgattr... Group attribute '
+      write(*,*)'==================================== '
+
+      attr(1) = 22
+      attr(2) = 44
+      attr(3) = 66
+      attr(4) = 88
+      status = he5_gdwrgattr(gdid_utm, 'group', HE5T_NATIVE_INT, 
+     1setcount, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status= he5_gdwrgattr(gdid_utm,"group",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from gdwrgattr ', status
+         write(*,*)'status= he5_gdwrgattr(gdid_utm,"group",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(*,*)'Returned from gdwrgattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdwrlattr
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdwrlattr... Local attribute '
+      write(10,*)'======================================== '
+      write(*,*)'Testing he5_gdwrlattr... Local attribute '
+      write(*,*)'======================================== '
+
+      attr(1) = 12
+      attr(2) = 34
+      attr(3) = 56
+      attr(4) = 78
+      status = he5_gdwrlattr(gdid_utm,"Grounding", "local", 
+     1HE5T_NATIVE_INT,setcount, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status= he5_gdwrlattr(gdid_utm,"Grounding",
+     1"local",HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from gdwrlattr ', status
+         write(*,*)'status= he5_gdwrlattr(gdid_utm,"Grounding",
+     1"local",HE5T_NATIVE_INT, 4, attr)'
+         write(*,*)'Returned from gdwrlattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned from gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Returned from gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid2)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid2)'
+         write(10,*)'Value returned by gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid2)'
+         write(*,*)'Value returned by gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdclose
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdclose... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdclose... '
+      write(*,*)'=========================='
+
+      status = he5_gdclose(gdfid2)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdclose(gdfid2)'
+         write(10,*)'Value returned by gdclose ', status
+         write(*,*)'status = he5_gdclose(gdfid2)'
+         write(*,*)'Value returned by gdclose ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdclose(gdfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdclose(gdfid)'
+         write(10,*)'Returned from gdclose ', status
+         write(*,*)'status = he5_gdclose(gdfid)'
+         write(*,*)'Returned from gdclose ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      
+      gdfid = he5_gdopen('grid.he5',HE5F_ACC_RDWR)
+      if (gdfid .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)'
+         write(10,*)'gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Grid file id returned by gdopen ',gdfid
+         write(10,*)'Grid file id returned by gdopen ',gdfid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if (gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(10,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(*,*)'Grid id returned by gdattach ',gdid_utm
+         write(10,*)'Grid id returned by gdattach ',gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdinqgrid
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinqgrid... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdinqgrid... '
+      write(*,*)'=========================='
+
+      lstatus = he5_gdinqgrid('grid.he5',grdnames,strbufsize)
+      if (lstatus .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus = he5_gdinqgrid("grid.he5",grdnames,
+     1strbufsize)'
+         write(*,*)'Names of grids ',grdnames
+         write(*,*)'Number of grids ',lstatus
+         write(*,*)'Size of names of grids ',strbufsize
+         write(10,*)'lstatus = he5_gdinqgrid("grid.he5",grdnames,
+     1strbufsize)'
+         write(10,*)'Names of grids ',grdnames
+         write(10,*)'Number of grids ',lstatus
+         write(10,*)'Size of names of grids ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdorginfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdorginfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdorginfo... '
+      write(*,*)'=========================='
+
+      status = he5_gdorginfo(gdid_utm, orgcode)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus = he5_gdorginfo(gdid_utm, orgcode)'
+         write(10,*)'lstatus = he5_gdorginfo(gdid_utm, orgcode)'
+         write(*,*)'Value returned by gdorginfo ',status
+         write(10,*)'Value returned by gdorginfo ',status
+         write(*,*)'Origin code value ',orgcode
+         write(10,*)'Origin code value ',orgcode
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdpreginfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdpreginfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdpreginfo... '
+      write(*,*)'=========================='
+
+      status = he5_gdpreginfo(gdid_utm, pixregcode)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdpreginfo(gdid_utm, pixregcode)'
+         write(10,*)'status = he5_gdpreginfo(gdid_utm, pixregcode)'
+         write(*,*)'Value returned by gdpreginfo ',status
+         write(10,*)'Value returned by gdpreginfo ',status
+         write(*,*)'Pixel reg code ',pixregcode
+         write(10,*)'Pixel reg code ',pixregcode
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdinqdims
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinqdims... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdinqdims... '
+      write(*,*)'=========================='
+
+      status = he5_gdinqdims(gdid_utm, dimname, dims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdinqdims(gdid_utm, dimname, dims)'
+         write(*,*)'Number of dimensions ',status
+         write(*,*)'Dimensions in grid UTM ',dimname
+         write(*,*)'Size of dimensions '
+         write(10,*)'status = he5_gdinqdims(gdid_utm, dimname, dims)'
+         write(10,*)'Number of dimensions ',status
+         write(10,*)'Dimensions in grid UTM ',dimname
+         write(10,*)'Size of dimensions '
+         do 130 i=1,status
+            write(*,*)' ',dims(i)
+            write(10,*)' ',dims(i)
+ 130     continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddiminfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddiminfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddiminfo... '
+      write(*,*)'=========================='
+
+      lstatus = he5_gddiminfo(gdid_utm, 'Conduction')
+      if (lstatus .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus=he5_gddiminfo(gdid_utm,"Conduction")'
+         write(*,*)'Size of dimension Conduction ',lstatus
+         write(10,*)'lstatus=he5_gddiminfo(gdid_utm,"Conduction")'
+         write(10,*)'Size of dimension Conduction ',lstatus
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdgridinfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdgridinfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdgridinfo... '
+      write(*,*)'=========================='
+
+      status= he5_gdgridinfo(gdid_utm,xdimsize,ydimsize,
+     1upleftpt,lowrtpt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status= he5_gdgridinfo(gdid_utm,xdimsize,
+     1ydimsize,upleftpt,lowrtpt)'
+         write(*,*)'Status returned by gdgridinfo ',status
+         write(*,11)'X dim size ',xdimsize, ' Y dim size ',ydimsize
+         write(*,12)'Upper left pt ',upleftpt(1),' ',upleftpt(2)
+         write(*,12)'Lower right pt ',lowrtpt(1),' ',lowrtpt(2)
+         write(10,*)'status= he5_gdgridinfo(gdid_utm,xdimsize,
+     1ydimsize,upleftpt,lowrtpt)'
+         write(10,*)'Value returned by gdgridinfo ',status
+         write(10,*)'X dim size ',xdimsize, ' Y dim size ',ydimsize
+         write(10,*)'Upper left pt ',upleftpt(1),upleftpt(2)
+         write(10,*)'Lower right pt ',lowrtpt(1),lowrtpt(2)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+   11 format(a,i2,a,i2)
+   12 format(a,f14.5,a,f14.5)
+
+c Test Case -- he5_gdprojinfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdprojinfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdprojinfo... '
+      write(*,*)'=========================='
+
+      status = he5_gdprojinfo(gdid_utm,pcode,zcode,scode,pparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdprojinfo(gdid_utm,pcode,
+     1zcode,scode,pparm)'
+         write(*,*)'Status returned by gdprojinfo ',status
+         write(*,*)'Projection code ',pcode, ' Zone code ',zcode
+         write(*,*)'Sphere code ',scode
+         write(10,*)'status = he5_gdprojinfo(gdid_utm,pcode,
+     1zcode,scode,pparm)'
+         write(10,*)'Value returned by gdprojinfo ',status
+         write(10,*)'Projection code ',pcode, ' Zone code ',zcode
+         write(10,*)'Sphere code ',scode
+         do 140 i=1,16
+            write(*,55)' ',pparm(i)
+            write(10,55)' ',pparm(i)
+ 140     continue
+      endif
+   55 format(a,f5.2)
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdcompinfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdcompinfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdcompinfo... '
+      write(*,*)'=========================='
+
+      status = he5_gdcompinfo(gdid_utm,'Voltage',
+     1compcodestring,compparm)
+      if (status .lt. zero) then
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status = he5_gdcompinfo(gdid_utm,"Voltage",
+     1compcode,compparm)'
+        write(10,*)'Compression info for field Voltage'
+        write(10,*)'Comp code ',compcodestring
+        write(10,*)'Compression parameters ',compparm
+        write(*,*)'status = he5_gdcompinfo(gdid_utm,"Voltage",
+     1compcode,compparm)'
+        write(*,*)'Compression info for field Voltage'
+        write(*,*)'Comp code ',compcodestring
+        write(*,*)'Compression parameters ',compparm
+      endif
+
+c Test Case -- he5_gdinqflds
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinqflds... '
+      write(10,*)'========================'
+      write(*,*)'Testing he5_gdinqflds... '
+      write(*,*)'========================'
+
+      nflds = he5_gdinqflds(gdid_utm,fldlist,rnk,numtype)
+      if (nflds .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'nflds = he5_gdinqflds(gdid_utm,
+     1fldlist,rnk,numtype)'
+         write(*,*)'Number of fields ',nflds
+         write(10,*)'nflds = he5_gdinqflds(gdid_utm,
+     1fldlist,rnk,numtype)'
+         write(10,*)'Number of fields ',nflds
+         if (nflds .ne. 0) then
+            write(*,*)'Fields ',fldlist
+            write(10,*)'Fields ',fldlist
+            do 150 i=1,nflds
+               write(*,*)'Rank and type ',rnk(i), ' ',numtype(i)
+               write(10,*)'Rank and type ',rnk(i), ' ',numtype(i)
+  150       continue
+         endif
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdfldinfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdfldinfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdfldinfo... '
+      write(*,*)'=========================='
+
+      status = he5_gdfldinfo(gdid_utm, 'Drift', rnk, dims, 
+     1numtype, dimname, maxdimname)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdfldinfo(gdid_utm, "Drift", 
+     1rnk, dims, numtype, dimname, maxdimname)'
+         write(*,*)'Value returned by gdfldinfo for field Drift ',
+     1status
+         write(*,*)'Drift rank ',rnk(1)
+         write(*,*)'Dimensions  ',dims(1),' ',dims(2)
+         write(*,*)'Number type of field ',numtype(1)
+         write(*,*)'Dimension names ',dimname
+         write(10,*)'status = he5_gdfldinfo(gdid_utm, "Drift",
+     1rnk, dims, numtype, dimname, maxdimname)'
+         write(10,*)'Value returned by gdfldinfo for field Drift ',
+     1status
+         write(10,*)'Drift rank ',rnk(1)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdrdfld
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdrdfld... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdrdfld... '
+      write(*,*)'=========================='
+
+      start(1) = 0
+      start(2) = 0
+      stride(1) = 1
+      stride(2) = 1
+      edge(1) = 80
+      edge(2) = 60
+      status = he5_gdrdfld(gdid_utm,'Drift',start,stride,edge,tempray)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdrdfld(gdid_utm,"Drift",
+     1start,stride,edge,tempray)'
+         write(*,*)'Value returned by gdrdfld ',status
+         write(10,*)'status = he5_gdrdfld(gdid_utm,"Drift",
+     1start,stride,edge,tempray)'
+         write(10,*)'Value returned by gdrdfld ',status
+         do 65 ii=1,6
+           do 66 i=1,5
+              write(10,*)'Field value at ',ii,' ',i,'  ',
+     1tempray(ii,i)
+              write(*,*)'Field value at ',ii,' ',i,'  ',
+     1tempray(ii,i)
+   66      continue
+   65   continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdnentries
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdnentries... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdnentries... '
+      write(*,*)'=========================='
+
+      n=he5_gdnentries(gdid_utm,HE5_HDFE_NENTDIM,strbufsize)
+      if (n .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'n = he5_gdnentries(gdid_utm, 
+     1HE5_HDFE_NENTDIM, strbufsize)'
+         write(*,*)'Number of dimensions ', n
+         write(*,*)'Size of Dimension string ',strbufsize
+         write(10,*)'n = he5_gdnentries(gdid_utm, 
+     1HE5_HDFE_NENTDIM, strbufsize)'
+         write(10,*)'Number of dimensions ', n
+         write(10,*)'Size of Dimension string ',strbufsize
+      endif
+
+      n = he5_gdnentries(gdid_utm,HE5_HDFE_NENTDFLD,strbufsize)
+      if (n .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'n = he5_gdnentries(gdid_utm,
+     1HE5_HDFE_NENTDFLD,strbufsize)'
+         write(*,*)'Number of data fields ',n
+         write(*,*)'Size of Field string ',strbufsize
+         write(10,*)'n = he5_gdnentries(gdid_utm,
+     1HDFE_NENTDFLD,strbufsize)'
+         write(10,*)'Number of data fields ',n
+         write(10,*)'Size of Field string ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdattrinfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdattrinfo, Global attribute'
+      write(10,*)'============================================'
+      write(*,*)'Testing he5_gdattrinfo, Global attribute'
+      write(*,*)'============================================'
+
+      status = he5_gdattrinfo(gdid_utm,'Resistance',ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdattrinfo(gdid_utm,"Resistance",
+     1ntype,count)'
+         write(*,*)'Value returned by gdattrinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdattrinfo(gdid_utm,"Resistance",
+     1ntype,count)'
+         write(10,*)'Value returned by gdattrinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdgatinfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdgatinfo, Group attribute'
+      write(10,*)'============================================'
+      write(*,*)'Testing he5_gdgatinfo, Group attribute'
+      write(*,*)'============================================'
+
+      status = he5_gdgatinfo(gdid_utm,'group',ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdgatinfo(gdid_utm,"group",
+     1ntype,count)'
+         write(*,*)'Value returned by gdgatinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdgatinfo(gdid_utm,"group",
+     1ntype,count)'
+         write(10,*)'Value returned by gdgatinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdlatinfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdlatinfo, Local attribute'
+      write(10,*)'======================================'
+      write(*,*)'Testing he5_gdlatinfo, Local attribute'
+      write(*,*)'======================================'
+
+      status = he5_gdlatinfo(gdid_utm,"Grounding","local",
+     1ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdlatinfo(gdid_utm,"Grounding",
+     1"local",ntype,count)'
+         write(*,*)'Value returned by gdlatinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdlatinfo(gdid_utm,"Grounding",
+     1"local",ntype,count)'
+         write(10,*)'Value returned by gdgatinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdrdattr
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdrdattr, Global attribute'
+      write(10,*)'======================================'
+      write(*,*)'Testing he5_gdrdattr, Global attribute'
+      write(*,*)'======================================'
+
+      status = he5_gdrdattr(gdid_utm,'Resistance',iattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdattr(gdid_utm,"Resistance",
+     1iattr)'
+        write(*,*)'Value returned by gdrdattr ',status
+        write(10,*)'status = he5_gdrdattr(gdid_utm,"Resistance",
+     1iattr)'
+        write(10,*)'Value returned by gdrdattr ',status
+        do 67 i=1,count
+           write(10,*)'Attribute value  ',iattr(i)
+           write(*,*)'Attribute value   ',iattr(i)
+   67   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+  
+c Test Case -- he5_gdrdgattr
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdrdgattr, Group attribute '
+      write(10,*)'======================================'
+      write(*,*)'Testing he5_gdrdgattr, Group attribute'
+      write(*,*)'======================================'
+
+      status = he5_gdrdgattr(gdid_utm,'group',gattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdgattr(gdid_utm,"group",
+     1gattr)'
+        write(*,*)'Value returned by gdrdgattr ',status
+        write(10,*)'status = he5_gdrdgattr(gdid_utm,"group",
+     1gattr)'
+        write(10,*)'Value returned by gdrdgattr ',status
+        do 68 i=1,count
+           write(10,*)'Attribute value  ',gattr(i)
+           write(*,*)'Attribute value   ',gattr(i)
+   68   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+  
+c Test Case -- he5_gdinqdatatype
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinqdatatype '
+      write(10,*)'============================='
+      write(*,*)'Testing he5_gdinqdatatype'
+      write(*,*)'============================='
+
+      status = he5_gdinqdatatype(gdid_utm,"Grounding","local",
+     1HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+         write(*,*)'status = he5_gdinqdatatype(gdid_utm,"Grounding",
+     1"local",HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)'
+         write(*,*)'Data type of attribute ',dtype
+         write(*,*)'Class id of attribute ',classid
+         write(*,*)'Order of attribute ',order
+         write(*,*)'Size of attribute ',size
+         write(10,*)'status = he5_gdinqdatatype(gdid_utm,"Grounding",
+     1"local", HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)'
+         write(10,*)'Data type of attribute ',dtype
+         write(10,*)'Class id of attribute ',classid
+         write(10,*)'Order of attribute ',order
+         write(10,*)'Size of attribute ',size
+      endif
+      write(10,*)' '
+      write(*,*)' '
+c Test Case -- he5_gdrdlattr
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdrdlattr, Local attribute '
+      write(10,*)'======================================'
+      write(*,*)'Testing he5_gdrdlattr, Local attribute'
+      write(*,*)'======================================'
+
+      status = he5_gdrdlattr(gdid_utm,'Grounding',
+     1'local',lattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdlattr(gdid_utm,"Grounding",
+     1"local",lattr)'
+        write(*,*)'Value returned by gdrdlattr ',status
+        write(10,*)'status = he5_gdrdlattr(gdid_utm,"Grounding",
+     1"local",lattr)'
+        write(10,*)'Value returned by gdrdlattr ',status
+        do 69 i=1,count
+           write(10,*)'Attribute value  ',lattr(i)
+           write(*,*)'Attribute value   ',lattr(i)
+   69   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+  
+c Test Case -- he5_gdinqattrs
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinqattrs, Global attribute'
+      write(10,*)'========================================'
+      write(*,*)'Testing he5_gdinqattrs, Global attribute'
+      write(*,*)'========================================'
+
+      lstatus = he5_gdinqattrs(gdid_utm, attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqattrs(gdid_utm, 
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by gdinqattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqattrs(gdid_utm, 
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by gdinqattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdinqgattrs
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinqgattrs, Group attribute'
+      write(10,*)'============================================'
+      write(*,*)'Testing he5_gdinqgattrs, Group attribute'
+      write(*,*)'============================================'
+
+      lstatus = he5_gdinqgattrs(gdid_utm,attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqgattrs(gdid_utm, 
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by gdinqgattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqgattrs(gdid_utm,
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by gdinqgattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdinqlattrs
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinqlattrs, Local attribute'
+      write(10,*)'========================================'
+      write(*,*)'Testing he5_gdinqlattrs, Local attribute'
+      write(*,*)'========================================'
+
+      lstatus = he5_gdinqlattrs(gdid_utm,"Grounding",attrlist,
+     1strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqlattrs(gdid_utm,"Grounding",
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by gdinqlattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqlattrs(gdid_utm,"Grounding",
+     1attrlist, strbufsize)'
+        write(10,*)'Value returned by gdinqlattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdgetfill
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdgetfill... '
+      write(10,*)'======================='
+      write(*,*)'Testing he5_gdgetfill... '
+      write(*,*)'========================'
+
+      status = he5_gdgetfill(gdid_utm,'Drift',ifillv)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdgetfill(gdid_utm,"Drift",
+     1ifillv)'
+         write(*,*)'Value returned by gdgetfill ',status
+         write(*,*)'Fill value ',ifillv
+         write(10,*)'status = he5_gdgetfill(gdid_utm,"Drift",
+     1ifillv)'
+         write(10,*)'Value returned by gdgetfill ',status
+         write(10,*)'Fill value ',ifillv
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddefboxreg
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddefboxreg... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddefboxreg... '
+      write(*,*)'=========================='
+
+      corlon(1)=-126.0
+      corlon(2)=-121.5
+      corlat(1)=-70.0
+      corlat(2)=-65.0
+
+      regionid = he5_gddefboxreg(gdid_utm,corlon,corlat)
+      if (regionid .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'regionid = he5_gddefboxreg(gdid_utm,
+     1corlon,corlat)'
+         write(*,*)'Region id returned by gddefboxreg ',regionid
+         write(10,*)'regionid = he5_gddefboxreg(gdid_utm,
+     1corlon,corlat)'
+         write(10,*)'Region id returned by gddefboxreg ',regionid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdreginfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdreginfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdreginfo... '
+      write(*,*)'=========================='
+
+      status = he5_gdreginfo(gdid_utm,regionid,'Impedance',nt,rk,
+     1dims,size,iuplft,ilrgt)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdreginfo(gdid_utm,regionid,
+     1"Impedance",nt, rk,dims,size,iuplft,ilrgt)'
+         write(*,*)'Value returned by gdreginfo ',status
+         write(*,*)'Number type of region ',nt
+         write(*,*)'Rank of region ',rk
+         write(*,*)'Size of region ',size
+         write(*,11)'Dimensions of region ',dims(1),' ',dims(2)
+         write(*,12)'Upper left point of region ',iuplft(1),' ',
+     1iuplft(2)
+         write(*,12)'Lower right point of region ',ilrgt(1),' ',
+     1ilrgt(2)
+         write(10,*)'status = he5_gdreginfo(gdid_utm,regionid,
+     1"Impedance",nt,rk,dims,size,iuplft,ilrgt)'
+         write(10,*)'Value returned by gdreginfo ',status
+         write(10,*)'Number type of region ',nt
+         write(10,*)'Rank of region ',rk
+         write(10,*)'Size of region ',size
+         write(10,11)'Dimensions of region ',dims(1),' ',dims(2)
+         write(10,12)'Upper left point of region ',iuplft(1),' ',
+     1iuplft(2)
+         write(10,12)'Lower right point of region ',ilrgt(1),' ',
+     1ilrgt(2)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdextreg
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdextreg... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdextreg... '
+      write(*,*)'=========================='
+
+      status = he5_gdextreg(gdid_utm,regionid,'Impedance',datbuf)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdextreg(gdid_utm,regionid,
+     1"Impedance",datbuf)'
+         write(*,*)'Value returned by gdextreg ',status
+         write(10,*)'status = he5_gdextreg(gdid_utm,regionid,
+     1"Impedance",datbuf)'
+         write(10,*)'Value returned by gdextreg ',status
+         do 175 i=100,150
+            write(*,*)'Value of region ',datbuf(i)
+            write(10,*)'Value of region ',datbuf(i)
+  175    continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddeftmeper
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddeftmeper... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddeftmeper... '
+      write(*,*)'=========================='
+
+      periodid = he5_gddeftmeper(gdid_utm,HE5_HDFE_NOPREVSUB,
+     1starttime,stoptime)
+      if (periodid .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'periodid = he5_gddeftmeper(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,starttime,stoptime)'
+        write(10,*)'Define a time period '
+        write(10,*)'Period id returned by gddeftmeper ',periodid
+        write(*,*)'periodid = he5_gddeftmeper(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,starttime,stoptime)'
+        write(*,*)'Define a time period '
+        write(*,*)'Period id returned by gddeftmeper ',periodid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddefvrtreg
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddefvrtreg... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddefvrtreg... '
+      write(*,*)'=========================='
+
+      regionid = he5_gddefvrtreg(gdid_utm,HE5_HDFE_NOPREVSUB,
+     1'Height',range)
+      if (regionid .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'regionid = he5_gddefvrtreg(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,"Height",range)'
+        write(10,*)'Define a vertical region '
+        write(10,*)'Region id returned by gddefvrtreg ',regionid
+        write(*,*)'regionid = he5_gddefvrtreg(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,"Height",range)'
+        write(*,*)'Define a vertical region '
+        write(*,*)'Region id returned by gddefvrtreg ',regionid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddupreg
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddupreg... '
+      write(10,*)'======================='
+      write(*,*)'Testing he5_gddupreg... '
+      write(*,*)'======================='
+
+      regionid2 = he5_gddupreg(regionid)
+      if (regionid2 .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'regionid2 = he5_gddupreg(regionid)'
+        write(10,*)'Generate a new region id '
+        write(10,*)'New region id ',regionid2
+        write(*,*)'regionid2 = he5_gddupreg(regionid)'
+        write(*,*)'Generate a new region id '
+        write(*,*)'New region id ',regionid2
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdgetpix
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdgetpix... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdgetpix... '
+      write(*,*)'=========================='
+
+      nlonlat = 5
+      status= he5_gdgetpix(gdid_utm,nlonlat,lonval,
+     1latval,rowval,colval)             
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status = he5_gdgetpix(gdid_utm,5,lonval,
+     1latval,rowval,colval)'
+        write(10,*)'Retrieve pixel row. column values '
+        write(*,*)'status = he5_gdgetpix(gdid_utm,5,lonval,latval,
+     1rowval,colval)'
+        write(*,*)'Retrieve pixel row. column values '
+        do 37 i=1,5
+           write(10,5)'Pixel position lon lat ',lonval(i),' ',
+     1latval(i),' ','Row Column ',rowval(i),' ',colval(i) 
+           write(*,5)'Pixel position lon lat ',lonval(i),' ',
+     1latval(i),' ','Row Column ',rowval(i),' ',colval(i) 
+   37   continue
+      endif
+    5 format(a,f6.1,a,f6.1,a,a,i2,a,i2)
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdgetpixval
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdgetpixval... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdgetpixval... '
+      write(*,*)'=========================='
+
+      nlonlat = 5
+      size= he5_gdgetpixval(gdid_utm,nlonlat,rowval,colval,
+     1"Voltage",fldval)
+      if (size .le. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'lstatus = he5_gdgetpixval(gdid_utm,5,rowval,
+     1colval,"Voltage",fldval)'
+        write(10,*)'Retrieve pixel values for specific locations '
+        write(*,*)'lstatus = he5_gdgetpixval(gdid_utm,5,rowval,
+     1colval,"Voltage",fldval)'
+        write(*,*)'Retrieve pixel values for specific locations '
+        do i=1,5
+           write(10,17)'Row Col ',rowval(i),' ',colval(i),' ',
+     1'Pixel Value ',fldval(i)
+           write(*,17)'Row Col ',rowval(i),' ',colval(i),' ',
+     1'Pixel Value ',fldval(i)
+        enddo
+      endif
+   17 format(a8,i2,a1,i2,a1,a12,f9.3)
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- he5_gdinterpolate
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinterpolate... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdinterpolate... '
+      write(*,*)'=========================='
+
+      nlonlat = 5
+      size= he5_gdinterpolate(gdid_utm,nlonlat,lonval,latval,
+     1'Voltage',interval)
+      if (size .le. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'lstatus= he5_gdinterpolate(gdid_utm,5,lonval,
+     1latval,"Voltage",interval)'
+        write(10,*)'Interpolate 5 values for field Voltage '
+        write(*,*)'lstatus= he5_gdinterpolate(gdid_utm,5,lonval,
+     1latval,"Voltage",interval)'
+        write(*,*)'Interpolate 5 values for field Voltage '
+        write(*,*)'Status returned by call to gdinterpolate ',lstatus
+        do i=1,5
+           write(*,4)'Interpolated value ',interval(i,1)
+           write(10,4)'Interpolated value ',interval(i,1)
+        enddo
+      endif
+    4 format(a,f9.3)
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Value returned by gddetach ',status
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Value returned by gddetach ',status
+      endif
+
+      status = he5_gdclose(gdfid)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdclose(gdfid)'
+         write(*,*)'Returned from gdclose ', status
+         write(10,*)'status = he5_gdclose(gdfid)'
+         write(10,*)'Returned from gdclose ', status
+      endif
+
+      close(unit=10)
+ 27   format(' ')
+      stop
+      end
+
+
+
+
+
+
+
+
diff --git a/testdrivers/grid/testgrid_szip32.f b/testdrivers/grid/testgrid_szip32.f
new file mode 100755
index 0000000..ebcdb94
--- /dev/null
+++ b/testdrivers/grid/testgrid_szip32.f
@@ -0,0 +1,4240 @@
+c----------------------------------------------------------------------------
+c     Copyright (C) 2000   Emergent IT Inc. and Raytheon Systems Company    |
+c----------------------------------------------------------------------------
+c testgrid32.f                                                                |
+c In this program we create, define and write a simple grid hdfeos file     |
+c using the grid interface                                                  |
+c----------------------------------------------------------------------------
+
+
+      program       testgrid32
+
+      implicit      none
+ 
+      include       'hdfeos5.inc'
+ 
+      integer       zero
+      integer       rnk(8), numtype(8)
+      integer       zcode, scode, nflds
+      integer       regionid, regionid2, regionid3, regionid4
+      integer       dtype, classid, order
+      integer       status, i, ii
+      integer       compparm(5)
+      integer 	    gdfid, gdfid2, gdfid3, gdid_utm, gdid2, gdid3
+      integer 	    zonecode, pixregcode, orgcode
+      integer	    attr(4), iattr(4), gattr(4), lattr(4)
+      integer 	    spherecode
+      integer	    he5_gdopen, he5_gdcreate
+      integer	    he5_gdclose, he5_gddefproj
+      integer	    he5_gddeftle, he5_gddeffld
+      integer	    he5_gdwrattr, he5_gdwrgattr
+      integer	    he5_gddefcomp, he5_gdinqflds
+      integer	    he5_gdrdfld, he5_gdattrinfo
+      integer	    he5_gdlatinfo, he5_gdrdattr
+      integer	    he5_gdreginfo, he5_gddeftmeper
+      integer	    he5_gddeforigin, he5_gddefpreg
+      integer	    he5_gdgridinfo, he5_gdcompinfo
+      integer	    he5_gdgetpix, he5_gddupreg
+      integer	    he5_gdattach, he5_gddetach
+      integer	    he5_gddefdim, he5_gdinqdatatype
+      integer	    he5_gdsetfill, he5_gdwrfld
+      integer	    he5_gdwrlattr, he5_gdorginfo
+      integer	    he5_gdprojinfo, he5_gdgatinfo
+      integer	    he5_gdrdgattr, he5_gdrdlattr
+      integer	    he5_gddefvrtreg
+      integer	    he5_gdinqdims, he5_gdgetfill
+      integer	    he5_gdfldinfo, he5_gddefboxreg
+      integer	    he5_gdpreginfo, he5_gdextreg
+      integer 	    nt(4), rk(4)
+
+      integer*4 	xdim, ydim
+      integer*4	    he5_gdinqgrid, he5_gddiminfo
+      integer*4	    he5_gdinqattrs, he5_gdinqgattrs
+      integer*4	    he5_gdgetpixval, he5_gdinterpolate
+      integer*4	    he5_gdnentries, he5_gdinqlattrs
+      integer*4     index1
+      integer*4  	index2
+      integer*4	    dimsizes(2)
+      integer*4 	tiledims(2), tilecords(2)
+      integer*4 	ntype, count
+      integer*4 	rowval(5), colval(5)
+      integer*4 	lat(40,50)
+      integer*4 	latcnt
+      integer*4 	lon(40,50)
+      integer*4 	loncnt
+      integer*4 	lstatus, n, one
+      integer*4 	size
+      integer*4     start(2)
+      integer*4     stride(2)
+      integer*4     edge(2)
+      integer*4     start1d, stride1d, edge1d
+      integer*4 	periodid
+      integer*4     strbufsize, pcode
+      integer*4     xdimsize, ydimsize
+      integer*4	    dims(32)
+      
+      real		    fillvalue, ifillv
+
+      real*4		fldval(5)
+      real*4		ray3(250)
+      real*4		utmray(60,80), georay(60,80)
+      real*4		utmhght(80)
+      real*4		hghtinit
+      real*4		utmcnt, geocnt
+      real*4		raycnt, ray3cnt
+      real*4		tempray(60,80)
+      real*4		datbuf(4800)
+
+      real*8		starttime, stoptime
+      real*8		range(2)
+      real*8		projparm(16), pparm(16)
+      real*8		uplft(2), lowrgt(2)
+      real*8		iuplft(2), ilrgt(2)
+      real*8		interval(5,2)
+      real*8		lonval(5), latval(5)
+      real*8		upleftpt(2), lowrtpt(2),corlon(2),corlat(2)
+      real*8		utmtmeray(4800)
+      real*8		tmeinit
+
+      character*80	grdnames, dimname, fldlist, attrlist
+      character*80	compcodestring, maxdimname
+      
+      index1      = 0
+      index2      = 0
+      dimsizes(1) = 40
+      dimsizes(2) = 100
+      compparm(1) = 6 
+      compparm(2) = 0
+      compparm(3) = 0
+      compparm(4) = 0
+      compparm(5) = 0
+      fillvalue   = 1996.0
+      raycnt      = -799.0
+      ray3cnt     = -19.5
+      attr(1)     = 11
+      attr(2)     = 33
+      attr(3)     = 55
+      attr(4)     = 77
+      utmcnt      = -799.0
+      geocnt      = 2001.0
+      hghtinit    = 323.0
+      tmeinit     = 35232487.2d0
+      starttime   = 35233000.8d0
+      stoptime    = 35435050.9d0
+      range(1)    = 352.8d0
+      range(2)    = 400.9d0
+      lonval(1)   = -122.0d0
+      latval(1)   = -68.0d0
+      lonval(2)   = -122.5d0
+      latval(2)   = -68.0d0
+      lonval(3)   = -123.0d0
+      latval(3)   = -68.0d0
+      lonval(4)   = -123.5d0
+      latval(4)   = -68.0d0
+      lonval(5)   = -124.0d0
+      latval(5)   = -68.0d0
+      tiledims(1) = 16
+      tiledims(2) = 15
+      tilecords(1)= 0
+      tilecords(2)= 0
+      latcnt      = 38.0
+      loncnt      = 78.0
+      one         = 1
+      zero        = 0
+c
+c This section of the program just fills some arrays with data that we will
+c use later in the program
+c
+      do 70 index1=1,60
+         do 80 index2=1,80
+            utmray(index2,index1) = utmcnt
+            georay(index2,index1) = geocnt
+            utmcnt = utmcnt + .4
+            geocnt = geocnt + .2
+   80   continue
+   70 continue
+  
+      
+      do 30 index1=1,250
+            ray3(index1) = ray3cnt
+            ray3cnt = ray3cnt + .1
+   30 continue
+      
+      do 32 index1=1,80
+            utmhght(index1) = hghtinit
+            hghtinit = hghtinit + 2.75
+   32 continue
+
+      do 34 index1=1,4800
+            utmtmeray(index1) = tmeinit
+            tmeinit = tmeinit + 70.7
+   34 continue
+
+      do 50 index1=1,50
+         do 60 index2=1,40      
+            lat(index2,index1) = latcnt
+            lon(index2,index1) = loncnt
+            loncnt = loncnt - 0.1
+   60    continue
+         latcnt = latcnt + 0.1
+         loncnt = 78.0
+   50 continue
+
+  230 format('********Error unexpected**********')
+  231 format('********Error Expected************')
+  240 format('***********Passed Test*********')
+
+
+      open(unit=10,file='testgridf_hdfeos5.txt',status="UNKNOWN")
+
+      write(*,*)'Testing Grid FORTRAN 77 interface '
+      write(*,*)'=================================='
+      write(10,*)'Testing Grid FORTRAN 77 interface '
+      write(10,*)'=================================='
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdopen
+c
+      write(10,*)'Testing gdopen... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdopen... '
+      write(*,*)'=================='
+      gdfid2 = he5_gdopen("grid2.he5",HE5F_ACC_TRUNC)
+      if (gdfid2 .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdfid2 = he5_gdopen(grid2.he5",HE5F_ACC_TRUNC)'
+         write(10,*)'Value returned by he5_gdopen ', gdfid2
+         write(*,*)'gdfid2 = he5_gdopen(grid2.he5",HE5F_ACC_TRUNC)'
+         write(*,*)'Value returned by he5_gdopen ', gdfid2
+      endif
+      write(*,*)' '
+      write(10,*)' '
+
+      gdfid3 = he5_gdopen("grid3.he5",HE5F_ACC_TRUNC)
+      if (gdfid3 .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdfid3 = he5_gdopen(grid3.he5",HE5F_ACC_TRUNC)'
+         write(10,*)'Value returned by he5_gdopen ', gdfid3
+         write(*,*)'gdfid3 = he5_gdopen(grid3.he5",HE5F_ACC_TRUNC)'
+         write(*,*)'Value returned by he5_gdopen ', gdfid3
+      endif
+      write(*,*)' '
+      write(10,*)' '
+
+      gdfid = he5_gdopen('grid.he5',HE5F_ACC_TRUNC)
+      if (gdfid .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'Opening file grid.he5'
+         write(10,*)'Opening file grid.he5'
+         write(10,*) 'gdfid = he5_gdopen("grid.he5",HE5F_ACC_TRUNC)'
+         write(10,*) 'File id returned from he5_gdopen ', gdfid
+         write(*,*) 'gdfid = he5_gdopen("grid.he5",HE5F_ACC_TRUNC)'
+         write(*,*) 'File id returned from he5_gdopen ', gdfid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- gdcreate
+c
+      write(10,27)
+      write(10,*)'Testing gdcreate... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdcreate... '
+      write(*,*)'=================='
+
+      xdim = 60
+      ydim = 80
+      uplft(1)  = 353299.39125d0
+      uplft(2)  = -7100284.64348d0
+      lowrgt(1) = 603434.52148d0
+      lowrgt(2) = -7991341.17870d0
+
+
+      gdid2 = he5_gdcreate(gdfid2, 'UTMGrid2', xdim, 
+     1ydim, uplft, lowrgt)
+      if (gdid2 .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*) 'Create UTMGrid2'
+         write(*,*)'gdid2 = he5_gdcreate(gdfid2, "UTMGrid2", 
+     1xdim, ydim, uplft, lowrgt)'
+         write(10,*) 'Value returned by he5_gdcreate ', gdid2
+         write(*,*) 'Create UTMGrid2'
+         write(10,*)'gdid2 = he5_gdcreate(gdfid2, "UTMGrid2", 
+     1xdim, ydim, uplft, lowrgt)'
+         write(*,*) 'Value returned by he5_gdcreate ', gdid2
+      endif
+      
+      gdid3 = he5_gdcreate(gdfid3, 'UTMGrid3', xdim, 
+     1ydim, uplft, lowrgt)
+      if (gdid3 .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*) 'Create UTMGrid3'
+         write(*,*)'gdid3 = he5_gdcreate(gdfid3, "UTMGrid3", 
+     1xdim, ydim, uplft, lowrgt)'
+         write(10,*) 'Value returned by he5_gdcreate ', gdid3
+         write(*,*) 'Create UTMGrid3'
+         write(10,*)'gdid3 = he5_gdcreate(gdfid3, "UTMGrid3", 
+     1xdim, ydim, uplft, lowrgt)'
+         write(*,*) 'Value returned by he5_gdcreate ', gdid3
+      endif
+    
+      gdid_utm = he5_gdcreate(gdfid, 'UTMGrid', xdim, 
+     1ydim, uplft, lowrgt)
+      if (gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Creating UTMGrid'
+         write(*,*)'Creating UTMGrid'
+         write(*,*)'gdid_utm=he5_gdcreate(gdfid,"UTMGrid",
+     1xdim,ydim,uplft,lowrgt)'
+         write(10,*)'gdid_utm=he5_gdcreate(gdfid,"UTMGrid",
+     1xdim,ydim,uplft,lowrgt)'
+         write(10,*)'UTM grid id returned from he5_gdcreate ', 
+     1gdid_utm
+         write(*,*)'UTM grid id returned from he5_gdcreate ', 
+     1gdid_utm
+      endif 
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddefproj
+c
+      write(10,27)
+      write(10,*)'Testing gddefproj... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddefproj... '
+      write(*,*)'=================='
+
+      zonecode = 10
+      spherecode = 0
+
+      do 120 index1=1,16
+         projparm(index1)=0
+ 120  continue
+  
+      status = he5_gddefproj(gdid_utm,HE5_GCTP_UTM,zonecode,
+     1spherecode,projparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Defining UTM projection'
+         write(*,*)'Defining UTM projection'
+         write(*,*)'status=he5_gddefproj(gdid_utm,HE5_GCTP_UTM,
+     1zonecode,spherecode, projparm)'
+         write(10,*)'status=he5_gddefproj(gdid_utm,HE5_GCTP_UTM,
+     1zonecode,spherecode, projparm)'
+         write(10,*)'Returned value from he5_gddefproj ', status
+         write(*,*)'Returned value from he5_gddefproj ', status
+      endif 
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefproj(gdid3,HE5_GCTP_UTM,zonecode,
+     1spherecode,projparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Defining UTM projection'
+         write(*,*)'Defining UTM projection'
+         write(*,*)'status=he5_gddefproj(gdid3,HE5_GCTP_UTM,
+     1zonecode,spherecode, projparm)'
+         write(10,*)'status=he5_gddefproj(gdid3,HE5_GCTP_UTM,
+     1zonecode,spherecode, projparm)'
+         write(10,*)'Returned value from he5_gddefproj ', status
+         write(*,*)'Returned value from he5_gddefproj ', status
+      endif 
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefproj(gdid2,HE5_GCTP_UTM,zonecode,
+     1spherecode,projparm)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Defining UTM'
+         write(10,*)'status = he5_gddefproj(gdid2,HE5_GCTP_UTM,
+     1zonecode,spherecode,projparm)'
+         write(10,*)'Value returned by he5_gddefproj ', status
+         write(*,*)'Defining UTM'
+         write(*,*)'status = he5_gddefproj(gdid2,HE5_GCTP_UTM,
+     1zonecode,spherecode,projparm)'
+         write(*,*)'Value returned by he5_gddefproj ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- gddefpreg
+c
+      write(10,27)
+      write(10,*)'Testing gddefpreg... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddefpreg... '
+      write(*,*)'=================='
+      status = he5_gddefpreg(gdid_utm, HE5_HDFE_CORNER)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddefpreg(gdid_utm, 
+     1HE5_HDFE_CORNER)'
+         write(10,*)'status = he5_gddefpreg(gdid_utm, 
+     1HE5_HDFE_CORNER)'
+         write(10,*)'Returned from he5_gddefpreg ', status
+         write(*,*)'Returned from he5_gddefpreg ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefpreg(gdid3, HE5_HDFE_CORNER)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddefpreg(gdid3, 
+     1HE5_HDFE_CORNER)'
+         write(10,*)'status = he5_gddefpreg(gdid3, 
+     1HE5_HDFE_CORNER)'
+         write(10,*)'Returned from he5_gddefpreg ', status
+         write(*,*)'Returned from he5_gddefpreg ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddeforigin
+c
+      write(10,27)
+      write(10,*)'Testing gddeforigin... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddeforigin... '
+      write(*,*)'=================='
+      status = he5_gddeforigin(gdid_utm, HE5_HDFE_GD_UL)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddeforigin(gdid_utm, 
+     1HE5_HDFE_GD_UL)'
+         write(*,*)'Value of status from he5_gddeforigin ',
+     1status
+         write(10,*)'status = he5_gddeforigin(gdid_utm, 
+     1HE5_HDFE_GD_UL)'
+         write(10,*)'Value of status from he5_gddeforigin ',
+     1status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddeforigin(gdid3, HE5_HDFE_GD_UL)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddeforigin(gdid3, 
+     1HE5_HDFE_GD_UL)'
+         write(*,*)'Value of status from he5_gddeforigin ',
+     1status
+         write(10,*)'status = he5_gddeforigin(gdid3, 
+     1HE5_HDFE_GD_UL)'
+         write(10,*)'Value of status from he5_gddeforigin ',
+     1status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddefdim
+c
+      write(10,27)
+      write(10,*)'Testing gddefdim... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddefdim... '
+      write(*,*)'=================='
+      status = he5_gddefdim(gdid2, 'TestDim1', 40)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid2, "TestDim1", 40)'
+         write(10,*)'Value returned by he5_gddefdim ', status
+         write(*,*)'status = he5_gddefdim(gdid2, "TestDim1", 40)'
+         write(*,*)'Value returned by he5_gddefdim ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefdim(gdid2, 'TestDim2', 25)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid2, "TestDim2", 25)'
+         write(10,*)'Value returned by he5_gddefdim ', status
+         write(*,*)'status = he5_gddefdim(gdid2, "TestDim2", 25)'
+         write(*,*)'Value returned by he5_gddefdim ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      status = he5_gddefdim(gdid_utm, 'Conduction', 250)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status=he5_gddefdim(gdid_utm,"Conduction",250)'
+         write(10,*)'Returned value from he5_gddefdim ',status
+         write(*,*)'status=he5_gddefdim(gdid_utm,"Conduction",250)'
+         write(*,*)'Returned value from he5_gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefdim(gdid_utm,'Timedim',4800)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid_utm,"Timedim",4800)'
+         write(10,*)'Status returned by call to he5_gddefdim ',status
+         write(*,*)'status = he5_gddefdim(gdid_utm,"Timedim",4800)'
+         write(*,*)'Status returned by call to he5_gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefdim(gdid_utm,'Hghtdim',80)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status = he5_gddefdim(gdid_utm,"Hghtdim",80)'
+        write(10,*)'Status returned by call to he5_gddefdim ',status
+        write(*,*)'status = he5_gddefdim(gdid_utm,"Hghtdim",80)'
+        write(*,*)'Status returned by call to he5_gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefdim(gdid_utm,'Convection',60)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define dimension Convection '
+        write(10,*)'status = he5_gddefdim(gdid_utm,"Convection",60)'
+        write(10,*)'Status returned by call to he5_gddefdim ',status
+        write(*,*)'Define dimension Convection '
+        write(*,*)'status = he5_gddefdim(gdid_utm,"Convection",60)'
+        write(*,*)'Status returned by call to he5_gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefdim(gdid3, 'Conduction', 250)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status=he5_gddefdim(gdid3,"Conduction",250)'
+         write(10,*)'Returned value from he5_gddefdim ',status
+         write(*,*)'status=he5_gddefdim(gdid3,"Conduction",250)'
+         write(*,*)'Returned value from he5_gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefdim(gdid3,'Timedim',4800)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid3,"Timedim",4800)'
+         write(10,*)'Status returned by call to he5_gddefdim ',status
+         write(*,*)'status = he5_gddefdim(gdid3,"Timedim",4800)'
+         write(*,*)'Status returned by call to he5_gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefdim(gdid3,'Hghtdim',80)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status = he5_gddefdim(gdid3,"Hghtdim",80)'
+        write(10,*)'Status returned by call to he5_gddefdim ',status
+        write(*,*)'status = he5_gddefdim(gdid3,"Hghtdim",80)'
+        write(*,*)'Status returned by call to he5_gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefdim(gdid3,'Convection',60)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define dimension Convection '
+        write(10,*)'status = he5_gddefdim(gdid3,"Convection",60)'
+        write(10,*)'Status returned by call to he5_gddefdim ',status
+        write(*,*)'Define dimension Convection '
+        write(*,*)'status = he5_gddefdim(gdid3,"Convection",60)'
+        write(*,*)'Status returned by call to he5_gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddetach
+c
+      write(10,27)
+      write(10,*)'Testing gddetach... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddetach... '
+      write(*,*)'=================='
+      status = he5_gddetach(gdid2)
+      if(status .lt. zero) then
+         write(*,231)
+         write(10,231)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid2)'
+         write(10,*)'Value returned by he5_gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid2)'
+         write(*,*)'Value returned by he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned value from he5_gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Returned value from he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid3)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid3)'
+         write(10,*)'Returned value from he5_gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid3)'
+         write(*,*)'Returned value from he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+ 
+c Test Case -- gdattach
+c
+      write(10,27)
+      write(10,*)'Testing gdattach... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdattach... '
+      write(*,*)'=================='
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if(gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(10,*)'Handle returned from he5_gdattach ', gdid_utm
+         write(*,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(*,*)'Handle returned from he5_gdattach ', gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid3 = he5_gdattach(gdfid3, 'UTMGrid3')
+      if(gdid3 .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid3 = he5_gdattach(gdfid3, "UTMGrid3")'
+         write(10,*)'Handle returned from he5_gdattach ', gdid3
+         write(*,*)'gdid3 = he5_gdattach(gdfid3, "UTMGrid3")'
+         write(*,*)'Handle returned from he5_gdattach ', gdid3
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid2 = he5_gdattach(gdfid2, 'UTMGrid2')
+      if(gdid2 .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid2 = he5_gdattach(gdfid2, "UTMGrid2")'
+         write(10,*)'Value returned by he5_gdattach ', gdid2
+         write(*,*)'gdid2 = he5_gdattach(gdfid2, "UTMGrid2")'
+         write(*,*)'Value returned by he5_gdattach ', gdid2
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddeffld
+c
+      write(10,27)
+      write(10,*)'Testing gddeffld... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddeffld... '
+      write(*,*)'=================='
+      status=he5_gddeffld(gdid2,"tempfield","TestDim2,TestDim1","",
+     1HE5T_NATIVE_FLOAT, HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,231)
+         write(10,231)
+        
+      else 
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "tempfield"'
+        write(10,*)'status=he5_gddeffld(gdid2,"tempfield",
+     1"TestDim2,TestDim1","",HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)'
+        write(10,*)'Value returned by he5_gddeffld ', status
+        write(*,*)'Define: "tempfield"'
+        write(*,*)'status=he5_gddeffld(gdid2,"tempfield",
+     1"TestDim2,TestDim1","",HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)'
+        write(*,*)'Value returned by he5_gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid_utm,'Time','Timedim',"",
+     1HE5T_NATIVE_DOUBLE, HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+        write(10,*)' Define field Time'
+        write(10,*)'status=he5_gddeffld(gdid_utm,"Time","Timedim","",
+     1HE5T_NATIVE_DOUBLE,HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to he5_gddeffld ',status
+        write(*,*)' Define field Time'
+        write(*,*)'status=he5_gddeffld(gdid_utm,"Time","Timedim","",
+     1HE5T_NATIVE_DOUBLE,HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to he5_gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid_utm,'Height','Hghtdim',"",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+        write(10,*)' Define field Height'
+        write(10,*)'status=he5_gddeffld(gdid_utm,"Height","Hghtdim","",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to he5_gddeffld ',status
+        write(*,*)' Define field Height'
+        write(*,*)'status=he5_gddeffld(gdid_utm,"Height","Hghtdim","",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to he5_gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid3,'Time','Timedim',"",
+     1HE5T_NATIVE_DOUBLE, HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+        write(10,*)' Define field Time'
+        write(10,*)'status=he5_gddeffld(gdid3,"Time","Timedim","",
+     1HE5T_NATIVE_DOUBLE,HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to he5_gddeffld ',status
+        write(*,*)' Define field Time'
+        write(*,*)'status=he5_gddeffld(gdid3,"Time","Timedim","",
+     1HE5T_NATIVE_DOUBLE,HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to he5_gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid3,'Height','Hghtdim',"",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+        write(10,*)' Define field Height'
+        write(10,*)'status=he5_gddeffld(gdid3,"Height","Hghtdim","",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to he5_gddeffld ',status
+        write(*,*)' Define field Height'
+        write(*,*)'status=he5_gddeffld(gdid3,"Height","Hghtdim","",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to he5_gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddeftle
+c
+      write(10,27)
+      write(10,*)'Testing gddeftle... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddeftle... '
+      write(*,*)'=================='
+
+      status = he5_gddeftle(gdid_utm,HE5_HDFE_TILE,2,tiledims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define tiling dimensions '
+        write(10,*)'status = he5_gddeftle(gdid_utm,
+     1HE5_HDFE_TILE,2,tiledims)'
+        write(10,*)'Status returned by call to he5_gddeftle ',status
+        write(*,*)'Status returned by call to he5_gddeftle ',status
+        write(*,*)'status = he5_gddeftle(gdid_utm,
+     1HE5_HDFE_TILE,2,tiledims)'
+        write(*,*)'Define tiling dimensions '
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid_utm,'SideB','YDim,Convection',"",
+     1HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define field that will be tiled '
+        write(10,*)'status=he5_gddeffld(gdid_utm,"SideB",
+     1"YDim,Convection","",HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to he5_gddeffld ',status
+        write(*,*)'Define field that will be tiled '
+        write(*,*)'status=he5_gddeffld(gdid_utm,"SideB",
+     1"YDim,Convection","",HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to he5_gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then 
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned value from he5_gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Returned value from he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if (gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdattach(gdfid,"UTMGrid")'
+         write(10,*)'Returned value from he5_gdattach ', status
+         write(*,*)'status = he5_gddetach(gdfid,"UTMGrid")'
+         write(*,*)'Returned value from he5_gdattach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid_utm,'Grounding','Conduction',"",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Define: "Grounding"'                  
+         write(10,*)'status=he5_gddeffld(gdid_utm,"Grounding",
+     1"Conduction","",HE5T_NATIVE_FLOAT,HDF_NOMERGE)'
+         write(10,*)'Value returned by he5_gddeffld ', status
+         write(*,*)'Define: "Grounding"'                  
+         write(*,*)'status=he5_gddeffld(gdid_utm,"Grounding",
+     1"Conduction","",HE5T_NATIVE_FLOAT,HDF_NOMERGE)'
+         write(*,*)'Value returned by he5_gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddeftle(gdid3,HE5_HDFE_TILE,2,tiledims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define tiling dimensions '
+        write(10,*)'status = he5_gddeftle(gdid3,
+     1HE5_HDFE_TILE,2,tiledims)'
+        write(10,*)'Status returned by call to he5_gddeftle ',status
+        write(*,*)'Status returned by call to he5_gddeftle ',status
+        write(*,*)'status = he5_gddeftle(gdid3,
+     1HE5_HDFE_TILE,2,tiledims)'
+        write(*,*)'Define tiling dimensions '
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid3,'SideB','YDim,Convection',"",
+     1HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define field that will be tiled '
+        write(10,*)'status=he5_gddeffld(gdid3,"SideB",
+     1"YDim,Convection","",HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to he5_gddeffld ',status
+        write(*,*)'Define field that will be tiled '
+        write(*,*)'status=he5_gddeffld(gdid3,"SideB",
+     1"YDim,Convection","",HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to he5_gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid3)
+      if (status .lt. zero) then 
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid3)'
+         write(10,*)'Returned value from he5_gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid3)'
+         write(*,*)'Returned value from he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid3 = he5_gdattach(gdfid3, 'UTMGrid3')
+      if (gdid3 .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdattach(gdfid3,"UTMGrid3")'
+         write(10,*)'Returned value from he5_gdattach ', status
+         write(*,*)'status = he5_gddetach(gdfid3,"UTMGrid3")'
+         write(*,*)'Returned value from he5_gdattach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid3,'Grounding','Conduction',"",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Define: "Grounding"'                  
+         write(10,*)'status=he5_gddeffld(gdid3,"Grounding",
+     1"Conduction","",HE5T_NATIVE_FLOAT,HDF_NOMERGE)'
+         write(10,*)'Value returned by he5_gddeffld ', status
+         write(*,*)'Define: "Grounding"'                  
+         write(*,*)'status=he5_gddeffld(gdid3,"Grounding",
+     1"Conduction","",HE5T_NATIVE_FLOAT,HDF_NOMERGE)'
+         write(*,*)'Value returned by he5_gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddefcomp
+c
+      write(10,27)
+      write(10,*)'Testing gddefcomp... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddefcomp... '
+      write(*,*)'=================='
+
+      tiledims(1) = 16
+      tiledims(2) = 15
+      status = he5_gddeftle(gdid_utm,HE5_HDFE_TILE,2,tiledims)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'Setup Tiling dimensions '
+         write(*,*)'Required when using compression'
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefcomp(gdid_utm,
+     1HE5_HDFE_COMP_DEFLATE, compparm)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Setup compression mode'
+        write(10,*)'status = he5_gddefcomp(gdid_utm,
+     1HE5_HDFE_COMP_DEFLATE,compparm)'
+        write(10,*)'Status returned by call to he5_gddefcomp ',status
+        write(*,*)'Setup compression mode'
+        write(*,*)'status = he5_gddefcomp(gdid_utm,
+     1HE5_HDFE_COMP_DEFLATE, compparm)'
+        write(*,*)'Status returned by call to he5_gddefcomp ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddeffld(gdid_utm,"Voltage","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "Voltage"'
+        write(10,*)'status = he5_gddeffld(gdid_utm,"Voltage",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)'
+        write(10,*)'Value returned from he5_gddeffld ', status
+        write(*,*)'Define: "Voltage"'
+        write(*,*)'status = he5_gddeffld(gdid_utm,"Voltage",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)'
+        write(*,*)'Value returned from he5_gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddeftle(gdid3,HE5_HDFE_TILE,2,tiledims)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'Setup Tiling dimensions '
+         write(*,*)'Required when using compression'
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefcomp(gdid3,
+     1HE5_HDFE_COMP_SHUF_SZIP_K13orEC, compparm)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Setup compression mode'
+        write(10,*)'status = he5_gddefcomp(gdid3,
+     1HE5_HDFE_COMP_SHUF_SZIP_K13orEC,compparm)'
+        write(10,*)'Status returned by call to he5_gddefcomp ',status
+        write(*,*)'Setup compression mode'
+        write(*,*)'status = he5_gddefcomp(gdid3,
+     1HE5_HDFE_COMP_SHUF_SZIP_K13orEC,compparm)'
+        write(*,*)'Status returned by call to he5_gddefcomp ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddeffld(gdid3,"Voltage","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "Voltage"'
+        write(10,*)'status = he5_gddeffld(gdid3,"Voltage",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)'
+        write(10,*)'Value returned from he5_gddeffld ', status
+        write(*,*)'Define: "Voltage"'
+        write(*,*)'status = he5_gddeffld(gdid3,"Voltage",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)'
+        write(*,*)'Value returned from he5_gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdsetfill
+c
+      write(10,27)
+      write(10,*)'Testing gdsetfill... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdsetfill... '
+      write(*,*)'=================='
+
+      status = he5_gdsetfill(gdid_utm, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Testing gdsetfill'
+         write(10,*)'status = he5_gdsetfill(gdid_utm, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(10,*)'Returned from he5_gdsetfill ', status
+         write(*,*)'Testing gdsetfill'
+         write(*,*)'status = he5_gdsetfill(gdid_utm, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(*,*)'Returned from he5_gdsetfill ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid_utm,"Drift","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "Drift"'      
+        write(10,*)'status=he5_gddeffld(gdid_utm,"Drift",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(10,*)'Value returned from he5_gddeffld ', status
+        write(*,*)'Define: "Drift"'      
+        write(*,*)'status=he5_gddeffld(gdid_utm,"Drift",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(*,*)'Value returned from he5_gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid_utm,"Impedance","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Define: "Impedance"'            
+         write(10,*)'status=he5_gddeffld(gdid_utm,"Impedance",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+         write(10,*)'Value returned from he5_gddeffld ', status
+         write(*,*)'Define: "Impedance"'            
+         write(*,*)'status=he5_gddeffld(gdid_utm,"Impedance",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+         write(*,*)'Value returned from he5_gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      status = he5_gddetach(gdid_utm)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned value from he5_gddetach ', status
+         write(*,*)'Returned value from he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if(gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(10,*)'Handle returned from he5_gdattach ', gdid_utm
+         write(*,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(*,*)'Handle returned from he5_gdattach ', gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdsetfill(gdid3, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Testing gdsetfill'
+         write(10,*)'status = he5_gdsetfill(gdid3, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(10,*)'Returned from he5_gdsetfill ', status
+         write(*,*)'Testing gdsetfill'
+         write(*,*)'status = he5_gdsetfill(gdid3, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(*,*)'Returned from he5_gdsetfill ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid3,"Drift","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "Drift"'      
+        write(10,*)'status=he5_gddeffld(gdid3,"Drift",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(10,*)'Value returned from he5_gddeffld ', status
+        write(*,*)'Define: "Drift"'      
+        write(*,*)'status=he5_gddeffld(gdid3,"Drift",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(*,*)'Value returned from he5_gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gddeffld(gdid3,"Impedance","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Define: "Impedance"'            
+         write(10,*)'status=he5_gddeffld(gdid3,"Impedance",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+         write(10,*)'Value returned from he5_gddeffld ', status
+         write(*,*)'Define: "Impedance"'            
+         write(*,*)'status=he5_gddeffld(gdid3,"Impedance",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+         write(*,*)'Value returned from he5_gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      status = he5_gddetach(gdid3)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid3)'
+         write(*,*)'status = he5_gddetach(gdid3)'
+         write(10,*)'Returned value from he5_gddetach ', status
+         write(*,*)'Returned value from he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid3 = he5_gdattach(gdfid3, 'UTMGrid3')
+      if(gdid3 .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid3 = he5_gdattach(gdfid, "UTMGrid3")'
+         write(10,*)'Handle returned from he5_gdattach ', gdid3
+         write(*,*)'gdid3 = he5_gdattach(gdfid, "UTMGrid3")'
+         write(*,*)'Handle returned from he5_gdattach ', gdid3
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdwrfld
+c
+      write(10,27)
+      write(10,*)'Testing gdwrfld... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdwrfld... '
+      write(*,*)'=================='
+
+      start(1) = 0
+      start(2) = 0
+      stride(1) = 1
+      stride(2) = 1
+      edge(1) = 80
+      edge(2) = 60
+      
+      status = he5_gdwrfld(gdid_utm, "Voltage", start, stride, 
+     1edge, utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Voltage '
+        write(10,*)'status=he5_gdwrfld(gdid_utm,"Voltage",start,
+     1stride,edge,utmray)'
+        write(10,*)'Status returned by he5_gdwrfield ', status
+        write(*,*)'Write to field Voltage '
+        write(*,*)'status=he5_gdwrfld(gdid_utm,"Voltage",start,
+     1stride,edge,utmray)'
+        write(*,*)'Status returned by he5_gdwrfield ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      start(1) = 10
+      start(2) = 10
+      edge(1) = 10
+      edge(2) = 10
+      status = he5_gdwrfld(gdid_utm, 'Drift', start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Drift '
+        write(10,*)'status = he5_gdwrfld(gdid_utm,"Drift",start,
+     1stride,edge,utmray)'
+        write(10,*)'Status returned from he5_gdwrfld ', status
+        write(*,*)'Write to field Drift '
+        write(*,*)'status = he5_gdwrfld(gdid_utm,"Drift",start,
+     1stride,edge,utmray)'
+        write(*,*)'Status returned from he5_gdwrfld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start(1) = 0
+      start(2) = 0
+      edge(1) = 80
+      edge(2) = 60
+      status = he5_gdwrfld(gdid_utm, 'Impedance', start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Impedance '
+        write(10,*)'status=he5_gdwrfld(gdid_utm,"Impedance",start,
+     1stride,edge,utmray)'
+        write(10,*)'Returned from he5_gdwrfld ', status
+        write(*,*)'Write to field Impedance '
+        write(*,*)'status=he5_gdwrfld(gdid_utm,"Impedance",start,
+     1stride,edge,utmray)'
+        write(*,*)'Returned from he5_gdwrfld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=4800
+      status=he5_gdwrfld(gdid_utm,'Time',start1d,stride1d,
+     1edge1d,utmtmeray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Time '
+        write(10,*)'status=he5_gdwrfld(gdid_utm,"Time",start1d,
+     1stride1d,edge1d,utmtmeray)'
+        write(10,*)'Status returned by call to he5_gdwrfld ',status
+        write(*,*)'Write to field Time '
+        write(*,*)'status=he5_gdwrfld(gdid_utm,"Time",start1d,
+     1stride1d,edge1d,utmtmeray)'
+        write(*,*)'Status returned by call to he5_gdwrfld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=80
+      status=he5_gdwrfld(gdid_utm,'Height',start1d,stride1d,
+     1edge1d,utmhght)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Height '
+        write(10,*)'status=he5_gdwrfld(gdid_utm,"Height",start1d,
+     1stride1d,edge1d,utmhght)'
+        write(10,*)'Status returned by call to he5_gdwrfld ',status
+        write(*,*)'Write to field Height '
+        write(*,*)'status=he5_gdwrfld(gdid_utm,"Height",start1d,
+     1stride1d,edge1d,utmhght)'
+        write(*,*)'Status returned by call to he5_gdwrfld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=250
+      status=he5_gdwrfld(gdid_utm,'Grounding',start1d,stride1d,
+     1edge1d,ray3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Grounding '
+        write(10,*)'status=he5_gdwrfld(gdid_utm,"Grounding",start1d,
+     1stride1d,edge1d,ray3)'
+        write(10,*)'Value returned by he5_gdwrfld ', status
+        write(*,*)'Write to field Grounding '
+        write(*,*)'status=he5_gdwrfld(gdid_utm,"Grounding",start1d,
+     1stride1d,edge1d,ray3)'
+        write(*,*)'Value returned by he5_gdwrfld ', status
+      endif
+        write(10,*)' '
+        write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Value of status returned by he5_gddetach ',
+     1status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Value of status returned by he5_gddetach ',
+     1status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(10,*)'Grid id returned by he5_gdattach ',gdid_utm
+         write(*,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(*,*)'Grid id returned by he5_gdattach ',gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start(1) = 0
+      start(2) = 0
+      stride(1) = 1
+      stride(2) = 1
+      edge(1) = 80
+      edge(2) = 60
+      
+      status = he5_gdwrfld(gdid3, "Voltage", start, stride, 
+     1edge, utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Voltage '
+        write(10,*)'status=he5_gdwrfld(gdid3,"Voltage",start,
+     1stride,edge,utmray)'
+        write(10,*)'Status returned by he5_gdwrfield ', status
+        write(*,*)'Write to field Voltage '
+        write(*,*)'status=he5_gdwrfld(gdid3,"Voltage",start,
+     1stride,edge,utmray)'
+        write(*,*)'Status returned by he5_gdwrfield ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      start(1) = 10
+      start(2) = 10
+      edge(1) = 10
+      edge(2) = 10
+      status = he5_gdwrfld(gdid3, 'Drift', start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Drift '
+        write(10,*)'status = he5_gdwrfld(gdid3,"Drift",start,
+     1stride,edge,utmray)'
+        write(10,*)'Status returned from he5_gdwrfld ', status
+        write(*,*)'Write to field Drift '
+        write(*,*)'status = he5_gdwrfld(gdid3,"Drift",start,
+     1stride,edge,utmray)'
+        write(*,*)'Status returned from he5_gdwrfld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start(1) = 0
+      start(2) = 0
+      edge(1) = 80
+      edge(2) = 60
+      status = he5_gdwrfld(gdid3, 'Impedance', start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Impedance '
+        write(10,*)'status=he5_gdwrfld(gdid3,"Impedance",start,
+     1stride,edge,utmray)'
+        write(10,*)'Returned from he5_gdwrfld ', status
+        write(*,*)'Write to field Impedance '
+        write(*,*)'status=he5_gdwrfld(gdid3,"Impedance",start,
+     1stride,edge,utmray)'
+        write(*,*)'Returned from he5_gdwrfld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=4800
+      status=he5_gdwrfld(gdid3,'Time',start1d,stride1d,
+     1edge1d,utmtmeray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Time '
+        write(10,*)'status=he5_gdwrfld(gdid3,"Time",start1d,
+     1stride1d,edge1d,utmtmeray)'
+        write(10,*)'Status returned by call to he5_gdwrfld ',status
+        write(*,*)'Write to field Time '
+        write(*,*)'status=he5_gdwrfld(gdid3,"Time",start1d,
+     1stride1d,edge1d,utmtmeray)'
+        write(*,*)'Status returned by call to he5_gdwrfld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=80
+      status=he5_gdwrfld(gdid3,'Height',start1d,stride1d,
+     1edge1d,utmhght)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Height '
+        write(10,*)'status=he5_gdwrfld(gdid3,"Height",start1d,
+     1stride1d,edge1d,utmhght)'
+        write(10,*)'Status returned by call to he5_gdwrfld ',status
+        write(*,*)'Write to field Height '
+        write(*,*)'status=he5_gdwrfld(gdid3,"Height",start1d,
+     1stride1d,edge1d,utmhght)'
+        write(*,*)'Status returned by call to he5_gdwrfld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=250
+      status=he5_gdwrfld(gdid3,'Grounding',start1d,stride1d,
+     1edge1d,ray3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Grounding '
+        write(10,*)'status=he5_gdwrfld(gdid3,"Grounding",start1d,
+     1stride1d,edge1d,ray3)'
+        write(10,*)'Value returned by he5_gdwrfld ', status
+        write(*,*)'Write to field Grounding '
+        write(*,*)'status=he5_gdwrfld(gdid3,"Grounding",start1d,
+     1stride1d,edge1d,ray3)'
+        write(*,*)'Value returned by he5_gdwrfld ', status
+      endif
+        write(10,*)' '
+        write(*,*)' '
+
+      status = he5_gddetach(gdid3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid3)'
+         write(10,*)'Value of status returned by he5_gddetach ',
+     1status
+         write(*,*)'status = he5_gddetach(gdid3)'
+         write(*,*)'Value of status returned by he5_gddetach ',
+     1status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid3 = he5_gdattach(gdfid3, 'UTMGrid3')
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid3 = he5_gdattach(gdfid, "UTMGrid3")'
+         write(10,*)'Grid id returned by he5_gdattach ',gdid3
+         write(*,*)'gdid3 = he5_gdattach(gdfid, "UTMGrid3")'
+         write(*,*)'Grid id returned by he5_gdattach ',gdid3
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdwrattr
+c
+      write(10,27)
+      write(10,*)'Testing gdwrattr... Global attribute '
+      write(10,*)'==================================== '
+      write(*,*)'Testing gdwrattr... Global attribute '
+      write(*,*)'==================================== '
+
+      status = he5_gdwrattr(gdid_utm, 'Resistance', 
+     1HE5T_NATIVE_INT, 4, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status=he5_gdwrattr(gdid_utm,"Resistance",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from he5_gdwrattr ', status
+         write(*,*)'status=he5_gdwrattr(gdid_utm,"Resistance",
+     1HE5T_NATIVE_FLOAT, 4, attr)'
+         write(*,*)'Returned from he5_gdwrattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdwrattr(gdid3, 'Resistance', 
+     1HE5T_NATIVE_INT, 4, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status=he5_gdwrattr(gdid3,"Resistance",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from he5_gdwrattr ', status
+         write(*,*)'status=he5_gdwrattr(gdid3,"Resistance",
+     1HE5T_NATIVE_FLOAT, 4, attr)'
+         write(*,*)'Returned from he5_gdwrattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdwrgattr
+c
+      write(10,27)
+      write(10,*)'Testing gdwrgattr... Group attribute '
+      write(10,*)'==================================== '
+      write(*,*)'Testing gdwrgattr... Group attribute '
+      write(*,*)'==================================== '
+
+      attr(1) = 22
+      attr(2) = 44
+      attr(3) = 66
+      attr(4) = 88
+      status = he5_gdwrgattr(gdid_utm, 'group', 
+     1HE5T_NATIVE_INT, 4, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status=he5_gdwrgattr(gdid_utm,"group",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from he5_gdwrgattr ', status
+         write(*,*)'status=he5_gdwrgattr(gdid_utm,"group",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(*,*)'Returned from he5_gdwrgattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      attr(1) = 22
+      attr(2) = 44
+      attr(3) = 66
+      attr(4) = 88
+      status = he5_gdwrgattr(gdid3, 'group', 
+     1HE5T_NATIVE_INT, 4, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status=he5_gdwrgattr(gdid3,"group",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from he5_gdwrgattr ', status
+         write(*,*)'status=he5_gdwrgattr(gdid3,"group",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(*,*)'Returned from he5_gdwrgattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdwrlattr
+c
+      write(10,27)
+      write(10,*)'Testing gdwrlattr... Local attribute '
+      write(10,*)'==================================== '
+      write(*,*)'Testing gdwrlattr... Local attribute '
+      write(*,*)'==================================== '
+
+      attr(1) = 12
+      attr(2) = 34
+      attr(3) = 56
+      attr(4) = 78
+      status = he5_gdwrlattr(gdid_utm,"Grounding", "local", 
+     1HE5T_NATIVE_INT, 4, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status=he5_gdwrlattr(gdid_utm,"Grounding",
+     1"local",HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from he5_gdwrlattr ', status
+         write(*,*)'status=he5_gdwrlattr(gdid_utm,"Grounding",
+     1"local",HE5T_NATIVE_INT, 4, attr)'
+         write(*,*)'Returned from he5_gdwrlattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned from he5_gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Returned from he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdwrlattr(gdid3,"Grounding", "local", 
+     1HE5T_NATIVE_INT, 4, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status=he5_gdwrlattr(gdid3,"Grounding",
+     1"local",HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from he5_gdwrlattr ', status
+         write(*,*)'status=he5_gdwrlattr(gdid3,"Grounding",
+     1"local",HE5T_NATIVE_INT, 4, attr)'
+         write(*,*)'Returned from he5_gdwrlattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid3)'
+         write(10,*)'Returned from he5_gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid3)'
+         write(*,*)'Returned from he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid2)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid2)'
+         write(10,*)'Value returned by he5_gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid2)'
+         write(*,*)'Value returned by he5_gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdclose
+c
+      write(10,27)
+      write(10,*)'Testing gdclose... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdclose... '
+      write(*,*)'=================='
+
+      status = he5_gdclose(gdfid2)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdclose(gdfid2)'
+         write(10,*)'Value returned by he5_gdclose ', status
+         write(*,*)'status = he5_gdclose(gdfid2)'
+         write(*,*)'Value returned by he5_gdclose ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdclose(gdfid3)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdclose(gdfid3)'
+         write(10,*)'Value returned by he5_gdclose ', status
+         write(*,*)'status = he5_gdclose(gdfid3)'
+         write(*,*)'Value returned by he5_gdclose ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdclose(gdfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdclose(gdfid)'
+         write(10,*)'Returned from he5_gdclose ', status
+         write(*,*)'status = he5_gdclose(gdfid)'
+         write(*,*)'Returned from he5_gdclose ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      
+      gdfid = he5_gdopen('grid.he5',HE5F_ACC_RDWR)
+      if (gdfid .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)'
+         write(10,*)'gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Grid file id returned by he5_gdopen ',gdfid
+         write(10,*)'Grid file id returned by he5_gdopen ',gdfid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if (gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(10,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(*,*)'Grid id returned by he5_gdattach ',gdid_utm
+         write(10,*)'Grid id returned by he5_gdattach ',gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdfid3 = he5_gdopen('grid3.he5',HE5F_ACC_RDWR)
+      if (gdfid3 .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'gdfid3 = he5_gdopen("grid3.he5",HE5F_ACC_RDWR)'
+         write(10,*)'gdfid3 = he5_gdopen("grid3.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Grid file id returned by he5_gdopen ',gdfid
+         write(10,*)'Grid file id returned by he5_gdopen ',gdfid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid3 = he5_gdattach(gdfid3, 'UTMGrid3')
+      if (gdid3 .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'gdid3 = he5_gdattach(gdfid3, "UTMGrid3")'
+         write(10,*)'gdid3 = he5_gdattach(gdfid, "UTMGrid3")'
+         write(*,*)'Grid id returned by he5_gdattach ',gdid3
+         write(10,*)'Grid id returned by he5_gdattach ',gdid3
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdinqgrid
+c
+      write(10,27)
+      write(10,*)'Testing gdinqgrid... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdinqgrid... '
+      write(*,*)'=================='
+
+      lstatus = he5_gdinqgrid('grid.he5',grdnames,strbufsize)
+      if (lstatus .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus=he5_gdinqgrid("grid.he5",
+     1grdnames,strbufsize)'
+         write(*,*)'Names of grids ',grdnames
+         write(*,*)'Number of grids ',lstatus
+         write(*,*)'Size of names of grids ',strbufsize
+         write(10,*)'lstatus=he5_gdinqgrid("grid.he5",
+     1grdnames,strbufsize)'
+         write(10,*)'Names of grids ',grdnames
+         write(10,*)'Number of grids ',lstatus
+         write(10,*)'Size of names of grids ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      lstatus = he5_gdinqgrid('grid3.he5',grdnames,strbufsize)
+      if (lstatus .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus=he5_gdinqgrid("grid3.he5",
+     1grdnames,strbufsize)'
+         write(*,*)'Names of grids ',grdnames
+         write(*,*)'Number of grids ',lstatus
+         write(*,*)'Size of names of grids ',strbufsize
+         write(10,*)'lstatus=he5_gdinqgrid("grid3.he5",
+     1grdnames,strbufsize)'
+         write(10,*)'Names of grids ',grdnames
+         write(10,*)'Number of grids ',lstatus
+         write(10,*)'Size of names of grids ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdorginfo
+c
+      write(10,27)
+      write(10,*)'Testing gdorginfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdorginfo... '
+      write(*,*)'=================='
+
+      status = he5_gdorginfo(gdid_utm, orgcode)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus = he5_gdorginfo(gdid_utm, orgcode)'
+         write(10,*)'lstatus = he5_gdorginfo(gdid_utm, orgcode)'
+         write(*,*)'Value returned by he5_gdorginfo ',status
+         write(10,*)'Value returned by he5_gdorginfo ',status
+         write(*,*)'Origin code value ',orgcode
+         write(10,*)'Origin code value ',orgcode
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdorginfo(gdid3, orgcode)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus = he5_gdorginfo(gdid3, orgcode)'
+         write(10,*)'lstatus = he5_gdorginfo(gdid3, orgcode)'
+         write(*,*)'Value returned by he5_gdorginfo ',status
+         write(10,*)'Value returned by he5_gdorginfo ',status
+         write(*,*)'Origin code value ',orgcode
+         write(10,*)'Origin code value ',orgcode
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdpreginfo
+c
+      write(10,27)
+      write(10,*)'Testing gdpreginfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdpreginfo... '
+      write(*,*)'=================='
+
+      status = he5_gdpreginfo(gdid_utm, pixregcode)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdpreginfo(gdid_utm, pixregcode)'
+         write(10,*)'status = he5_gdpreginfo(gdid_utm, pixregcode)'
+         write(*,*)'Value returned by he5_gdpreginfo ',status
+         write(10,*)'Value returned by he5_gdpreginfo ',status
+         write(*,*)'Pixel reg code ',pixregcode
+         write(10,*)'Pixel reg code ',pixregcode
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdpreginfo(gdid3, pixregcode)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdpreginfo(gdid3, pixregcode)'
+         write(10,*)'status = he5_gdpreginfo(gdid3, pixregcode)'
+         write(*,*)'Value returned by he5_gdpreginfo ',status
+         write(10,*)'Value returned by he5_gdpreginfo ',status
+         write(*,*)'Pixel reg code ',pixregcode
+         write(10,*)'Pixel reg code ',pixregcode
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdinqdims
+c
+      write(10,27)
+      write(10,*)'Testing gdinqdims... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdinqdims... '
+      write(*,*)'=================='
+
+      status = he5_gdinqdims(gdid_utm, dimname, dims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdinqdims(gdid_utm, dimname, dims)'
+         write(*,*)'Number of dimensions ',status
+         write(*,*)'Dimensions in grid UTM ',dimname
+         write(*,*)'Size of dimensions '
+         write(10,*)'status = he5_gdinqdims(gdid_utm, dimname, dims)'
+         write(10,*)'Number of dimensions ',status
+         write(10,*)'Dimensions in grid UTM ',dimname
+         write(10,*)'Size of dimensions '
+         do 130 i=1,status
+            write(*,*)' ',dims(i)
+            write(10,*)' ',dims(i)
+ 130     continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdinqdims(gdid3, dimname, dims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdinqdims(gdid3, dimname, dims)'
+         write(*,*)'Number of dimensions ',status
+         write(*,*)'Dimensions in grid UTM ',dimname
+         write(*,*)'Size of dimensions '
+         write(10,*)'status = he5_gdinqdims(gdid3, dimname, dims)'
+         write(10,*)'Number of dimensions ',status
+         write(10,*)'Dimensions in grid UTM ',dimname
+         write(10,*)'Size of dimensions '
+         do 131 i=1,status
+            write(*,*)' ',dims(i)
+            write(10,*)' ',dims(i)
+ 131     continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddiminfo
+c
+      write(10,27)
+      write(10,*)'Testing gddiminfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddiminfo... '
+      write(*,*)'=================='
+
+      lstatus = he5_gddiminfo(gdid_utm, 'Conduction')
+      if (lstatus .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus = he5_gddiminfo(gdid_utm, "Conduction")'
+         write(*,*)'Size of dimension Conduction ',lstatus
+         write(10,*)'lstatus = he5_gddiminfo(gdid_utm, "Conduction")'
+         write(10,*)'Size of dimension Conduction ',lstatus
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      lstatus = he5_gddiminfo(gdid3, 'Conduction')
+      if (lstatus .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus = he5_gddiminfo(gdid3, "Conduction")'
+         write(*,*)'Size of dimension Conduction ',lstatus
+         write(10,*)'lstatus = he5_gddiminfo(gdid3, "Conduction")'
+         write(10,*)'Size of dimension Conduction ',lstatus
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdgridinfo
+c
+      write(10,27)
+      write(10,*)'Testing gdgridinfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdgridinfo... '
+      write(*,*)'=================='
+
+      status=he5_gdgridinfo(gdid_utm,xdimsize,ydimsize,
+     1upleftpt,lowrtpt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status=he5_gdgridinfo(gdid_utm,xdimsize,
+     1ydimsize,upleftpt,lowrtpt)'
+         write(*,*)'Status returned by he5_gdgridinfo ',status
+         write(*,11)'X dim size ',xdimsize, ' Y dim size ',ydimsize
+         write(*,12)'Upper left pt ',upleftpt(1),' ',upleftpt(2)
+         write(*,12)'Lower right pt ',lowrtpt(1),' ',lowrtpt(2)
+         write(10,*)'status=he5_gdgridinfo(gdid_utm,xdimsize,
+     1ydimsize,upleftpt,lowrtpt)'
+         write(10,*)'Value returned by he5_gdgridinfo ',status
+         write(10,*)'X dim size ',xdimsize, ' Y dim size ',ydimsize
+         write(10,*)'Upper left pt ',upleftpt(1),upleftpt(2)
+         write(10,*)'Lower right pt ',lowrtpt(1),lowrtpt(2)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+   11 format(a,i2,a,i2)
+   12 format(a,f14.5,a,f14.5)
+
+      status=he5_gdgridinfo(gdid3,xdimsize,ydimsize,
+     1upleftpt,lowrtpt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status=he5_gdgridinfo(gdid3,xdimsize,
+     1ydimsize,upleftpt,lowrtpt)'
+         write(*,*)'Status returned by he5_gdgridinfo ',status
+         write(*,11)'X dim size ',xdimsize, ' Y dim size ',ydimsize
+         write(*,12)'Upper left pt ',upleftpt(1),' ',upleftpt(2)
+         write(*,12)'Lower right pt ',lowrtpt(1),' ',lowrtpt(2)
+         write(10,*)'status=he5_gdgridinfo(gdid3,xdimsize,
+     1ydimsize,upleftpt,lowrtpt)'
+         write(10,*)'Value returned by he5_gdgridinfo ',status
+         write(10,*)'X dim size ',xdimsize, ' Y dim size ',ydimsize
+         write(10,*)'Upper left pt ',upleftpt(1),upleftpt(2)
+         write(10,*)'Lower right pt ',lowrtpt(1),lowrtpt(2)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdprojinfo
+c
+      write(10,27)
+      write(10,*)'Testing gdprojinfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdprojinfo... '
+      write(*,*)'=================='
+
+      status = he5_gdprojinfo(gdid_utm,pcode,zcode,scode,pparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status=he5_gdprojinfo(gdid_utm,pcode,zcode,
+     1scode,pparm)'
+         write(*,*)'Status returned by he5_gdprojinfo ',status
+         write(*,*)'Projection code ',pcode, ' Zone code ',zcode
+         write(*,*)'Sphere code ',scode
+         write(10,*)'status=he5_gdprojinfo(gdid_utm,pcode,zcode,
+     1scode,pparm)'
+         write(10,*)'Value returned by he5_gdprojinfo ',status
+         write(10,*)'Projection code ',pcode, ' Zone code ',zcode
+         write(10,*)'Sphere code ',scode
+         do 140 i=1,16
+            write(*,55)' ',pparm(i)
+            write(10,55)' ',pparm(i)
+ 140     continue
+      endif
+   55 format(a,f5.2)
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdprojinfo(gdid3,pcode,zcode,scode,pparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status=he5_gdprojinfo(gdid3,pcode,zcode,
+     1scode,pparm)'
+         write(*,*)'Status returned by he5_gdprojinfo ',status
+         write(*,*)'Projection code ',pcode, ' Zone code ',zcode
+         write(*,*)'Sphere code ',scode
+         write(10,*)'status=he5_gdprojinfo(gdid3,pcode,zcode,
+     1scode,pparm)'
+         write(10,*)'Value returned by he5_gdprojinfo ',status
+         write(10,*)'Projection code ',pcode, ' Zone code ',zcode
+         write(10,*)'Sphere code ',scode
+         do 141 i=1,16
+            write(*,55)' ',pparm(i)
+            write(10,55)' ',pparm(i)
+ 141     continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdcompinfo
+c
+      write(10,27)
+      write(10,*)'Testing gdcompinfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdcompinfo... '
+      write(*,*)'=================='
+
+      status = he5_gdcompinfo(gdid_utm,'Voltage',
+     1compcodestring,compparm)
+      if (status .lt. zero) then
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status=he5_gdcompinfo(gdid_utm,"Voltage",
+     1compcode,compparm)'
+        write(10,*)'Compression info for field Voltage'
+        write(10,*)'Comp code ',compcodestring
+        write(10,*)'Compression parameters ',compparm
+        write(*,*)'status=he5_gdcompinfo(gdid_utm,"Voltage",
+     1compcode,compparm)'
+        write(*,*)'Compression info for field Voltage'
+        write(*,*)'Comp code ',compcodestring
+        write(*,*)'Compression parameters ',compparm
+      endif
+
+      status = he5_gdcompinfo(gdid3,'Voltage',
+     1compcodestring,compparm)
+      if (status .lt. zero) then
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status=he5_gdcompinfo(gdid3,"Voltage",
+     1compcode,compparm)'
+        write(10,*)'Compression info for field Voltage'
+        write(10,*)'Comp code ',compcodestring
+        write(10,*)'Compression parameters ',compparm
+        write(*,*)'status=he5_gdcompinfo(gdid3,"Voltage",
+     1compcode,compparm)'
+        write(*,*)'Compression info for field Voltage'
+        write(*,*)'Comp code ',compcodestring
+        write(*,*)'Compression parameters ',compparm
+      endif
+
+c Test Case -- gdinqflds
+c
+      write(10,27)
+      write(10,*)'Testing gdinqflds... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdinqflds... '
+      write(*,*)'=================='
+
+      nflds = he5_gdinqflds(gdid_utm,fldlist,rnk,numtype)
+      if (nflds .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'nflds = he5_gdinqflds(gdid_utm,fldlist,
+     1rnk,numtype)'
+         write(*,*)'Number of fields ',nflds
+         write(10,*)'nflds = he5_gdinqflds(gdid_utm,fldlist,
+     1rnk,numtype)'
+         write(10,*)'Number of fields ',nflds
+         if (nflds .ne. 0) then
+            write(*,*)'Fields ',fldlist
+            write(10,*)'Fields ',fldlist
+            do 150 i=1,nflds
+               write(*,*)'Rank and type ',rnk(i), ' ', numtype(i)
+               write(10,*)'Rank and type ',rnk(i), ' ', numtype(i)
+  150       continue
+         endif
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      nflds = he5_gdinqflds(gdid3,fldlist,rnk,numtype)
+      if (nflds .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'nflds = he5_gdinqflds(gdid3,fldlist,
+     1rnk,numtype)'
+         write(*,*)'Number of fields ',nflds
+         write(10,*)'nflds = he5_gdinqflds(gdid3,fldlist,
+     1rnk,numtype)'
+         write(10,*)'Number of fields ',nflds
+         if (nflds .ne. 0) then
+            write(*,*)'Fields ',fldlist
+            write(10,*)'Fields ',fldlist
+            do 151 i=1,nflds
+               write(*,*)'Rank and type ',rnk(i), ' ', numtype(i)
+               write(10,*)'Rank and type ',rnk(i), ' ', numtype(i)
+  151       continue
+         endif
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdfldinfo
+c
+      write(10,27)
+      write(10,*)'Testing gdfldinfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdfldinfo... '
+      write(*,*)'=================='
+
+      status=he5_gdfldinfo(gdid_utm,'Drift',rnk,dims,numtype,
+     1dimname,maxdimname)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status=he5_gdfldinfo(gdid_utm,"Drift",rnk,dims, 
+     1numtype, dimname, maxdimname)'
+         write(*,*)'Value returned by he5_gdfldinfo for field 
+     1Drift ',status
+         write(*,*)'Drift rank ',rnk(1)
+         write(*,*)'Dimensions  ',dims(1),' ',dims(2)
+         write(*,*)'Number type of field ',numtype(1)
+         write(*,*)'Dimension names ',dimname
+         write(10,*)'status=he5_gdfldinfo(gdid_utm,"Drift",rnk,dims, 
+     1numtype, dimname, maxdimname)'
+
+         write(10,*)'Value returned by he5_gdfldinfo for field 
+     1Drift ',status
+         write(10,*)'Drift rank ',rnk(1)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status=he5_gdfldinfo(gdid3,'Drift',rnk,dims,numtype,
+     1dimname,maxdimname)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status=he5_gdfldinfo(gdid3,"Drift",rnk,dims, 
+     1numtype, dimname, maxdimname)'
+         write(*,*)'Value returned by he5_gdfldinfo for field 
+     1Drift ',status
+         write(*,*)'Drift rank ',rnk(1)
+         write(*,*)'Dimensions  ',dims(1),' ',dims(2)
+         write(*,*)'Number type of field ',numtype(1)
+         write(*,*)'Dimension names ',dimname
+         write(10,*)'status=he5_gdfldinfo(gdid3,"Drift",rnk,dims, 
+     1numtype, dimname, maxdimname)'
+
+         write(10,*)'Value returned by he5_gdfldinfo for field 
+     1Drift ',status
+         write(10,*)'Drift rank ',rnk(1)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdrdfld
+c
+      write(10,27)
+      write(10,*)'Testing gdrdfld... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdrdfld... '
+      write(*,*)'=================='
+
+      start(1) = 0
+      start(2) = 0
+      stride(1) = 1
+      stride(2) = 1
+      edge(1) = 80
+      edge(2) = 60
+      status = he5_gdrdfld(gdid_utm,'Drift',start,stride,edge,
+     1tempray)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdrdfld(gdid_utm,"Drift",start,
+     1stride,edge,tempray)'
+         write(*,*)'Value returned by he5_gdrdfld ',status
+         write(10,*)'status = he5_gdrdfld(gdid_utm,"Drift",start,
+     1stride,edge,tempray)'
+         write(10,*)'Value returned by he5_gdrdfld ',status
+         do 65 ii=1,6
+           do 66 i=1,5
+              write(10,*)'Field value at ',ii,' ',i,'  ',tempray(ii,i)
+              write(*,*)'Field value at ',ii,' ',i,'  ',tempray(ii,i)
+   66      continue
+   65   continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdrdfld(gdid3,'Drift',start,stride,edge,
+     1tempray)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdrdfld(gdid3,"Drift",start,
+     1stride,edge,tempray)'
+         write(*,*)'Value returned by he5_gdrdfld ',status
+         write(10,*)'status = he5_gdrdfld(gdid3,"Drift",start,
+     1stride,edge,tempray)'
+         write(10,*)'Value returned by he5_gdrdfld ',status
+         do 75 ii=1,6
+           do 76 i=1,5
+              write(10,*)'Field value at ',ii,' ',i,'  ',tempray(ii,i)
+              write(*,*)'Field value at ',ii,' ',i,'  ',tempray(ii,i)
+   76      continue
+   75   continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- gdnentries
+c
+      write(10,27)
+      write(10,*)'Testing gdnentries... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdnentries... '
+      write(*,*)'=================='
+
+      n = he5_gdnentries(gdid_utm, HE5_HDFE_NENTDIM, strbufsize)
+      if (n .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'n = he5_gdnentries(gdid_utm,
+     1HE5_HDFE_NENTDIM, strbufsize)'
+         write(*,*)'Number of dimensions ', n
+         write(*,*)'Size of Dimension string ',strbufsize
+         write(10,*)'n = he5_gdnentries(gdid_utm, 
+     1HE5_HDFE_NENTDIM, strbufsize)'
+         write(10,*)'Number of dimensions ', n
+         write(10,*)'Size of Dimension string ',strbufsize
+      endif
+
+      n = he5_gdnentries(gdid_utm,HE5_HDFE_NENTDFLD,strbufsize)
+      if (n .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'n = he5_gdnentries(gdid_utm,HE5_HDFE_NENTDFLD,
+     1strbufsize)'
+         write(*,*)'Number of data fields ',n
+         write(*,*)'Size of Field string ',strbufsize
+         write(10,*)'n = he5_gdnentries(gdid_utm,HE5_HDFE_NENTDFLD,
+     1strbufsize)'
+         write(10,*)'Number of data fields ',n
+         write(10,*)'Size of Field string ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      n = he5_gdnentries(gdid3, HE5_HDFE_NENTDIM, strbufsize)
+      if (n .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'n = he5_gdnentries(gdid3,
+     1HE5_HDFE_NENTDIM, strbufsize)'
+         write(*,*)'Number of dimensions ', n
+         write(*,*)'Size of Dimension string ',strbufsize
+         write(10,*)'n = he5_gdnentries(gdid3, 
+     1HE5_HDFE_NENTDIM, strbufsize)'
+         write(10,*)'Number of dimensions ', n
+         write(10,*)'Size of Dimension string ',strbufsize
+      endif
+
+      n = he5_gdnentries(gdid3,HE5_HDFE_NENTDFLD,strbufsize)
+      if (n .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'n = he5_gdnentries(gdid3,HE5_HDFE_NENTDFLD,
+     1strbufsize)'
+         write(*,*)'Number of data fields ',n
+         write(*,*)'Size of Field string ',strbufsize
+         write(10,*)'n = he5_gdnentries(gdid3,HE5_HDFE_NENTDFLD,
+     1strbufsize)'
+         write(10,*)'Number of data fields ',n
+         write(10,*)'Size of Field string ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdattrinfo
+c
+      write(10,27)
+      write(10,*)'Testing gdattrinfo, Global attribute'
+      write(10,*)'===================================='
+      write(*,*)'Testing gdattrinfo, Global attribute'
+      write(*,*)'===================================='
+
+      status = he5_gdattrinfo(gdid_utm,'Resistance',ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status=he5_gdattrinfo(gdid_utm,"Resistance",
+     1ntype,count)'
+         write(*,*)'Value returned by he5_gdattrinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status=he5_gdattrinfo(gdid_utm,"Resistance",
+     1ntype,count)'
+         write(10,*)'Value returned by he5_gdattrinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdattrinfo(gdid3,'Resistance',ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status=he5_gdattrinfo(gdid3,"Resistance",
+     1ntype,count)'
+         write(*,*)'Value returned by he5_gdattrinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status=he5_gdattrinfo(gdid3,"Resistance",
+     1ntype,count)'
+         write(10,*)'Value returned by he5_gdattrinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdgatinfo
+c
+      write(10,27)
+      write(10,*)'Testing gdgatinfo, Group attribute'
+      write(10,*)'===================================='
+      write(*,*)'Testing gdgatinfo, Group attribute'
+      write(*,*)'===================================='
+
+      status = he5_gdgatinfo(gdid_utm,'group',ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdgatinfo(gdid_utm,"group",
+     1ntype,count)'
+         write(*,*)'Value returned by he5_gdgatinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdgatinfo(gdid_utm,"group",
+     1ntype,count)'
+         write(10,*)'Value returned by he5_gdgatinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdgatinfo(gdid3,'group',ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdgatinfo(gdid3,"group",
+     1ntype,count)'
+         write(*,*)'Value returned by he5_gdgatinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdgatinfo(gdid3,"group",
+     1ntype,count)'
+         write(10,*)'Value returned by he5_gdgatinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdlatinfo
+c
+      write(10,27)
+      write(10,*)'Testing gdlatinfo, Local attribute'
+      write(10,*)'===================================='
+      write(*,*)'Testing gdlatinfo, Local attribute'
+      write(*,*)'===================================='
+
+      status = he5_gdlatinfo(gdid_utm,"Grounding","local",ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdlatinfo(gdid_utm,"Grounding",
+     1"local",ntype,count)'
+         write(*,*)'Value returned by he5_gdlatinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdlatinfo(gdid_utm,"Grounding",
+     1"local",ntype,count)'
+         write(10,*)'Value returned by he5_gdgatinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdlatinfo(gdid3,"Grounding","local",ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdlatinfo(gdid3,"Grounding",
+     1"local",ntype,count)'
+         write(*,*)'Value returned by he5_gdlatinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdlatinfo(gdid3,"Grounding",
+     1"local",ntype,count)'
+         write(10,*)'Value returned by he5_gdgatinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdrdattr
+c
+      write(10,27)
+      write(10,*)'Testing gdrdattr, Global attribute'
+      write(10,*)'=================================='
+      write(*,*)'Testing gdrdattr, Global attribute'
+      write(*,*)'=================================='
+
+      status = he5_gdrdattr(gdid_utm,'Resistance',iattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdattr(gdid_utm,"Resistance",iattr)'
+        write(*,*)'Value returned by he5_gdrdattr ',status
+        write(10,*)'status = he5_gdrdattr(gdid_utm,"Resistance",iattr)'
+        write(10,*)'Value returned by he5_gdrdattr ',status
+        do 67 i=1,count
+           write(10,*)'Attribute value  ',iattr(i)
+           write(*,*)'Attribute value   ',iattr(i)
+   67   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdrdattr(gdid3,'Resistance',iattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdattr(gdid3,"Resistance",iattr)'
+        write(*,*)'Value returned by he5_gdrdattr ',status
+        write(10,*)'status = he5_gdrdattr(gdid3,"Resistance",iattr)'
+        write(10,*)'Value returned by he5_gdrdattr ',status
+        do 77 i=1,count
+           write(10,*)'Attribute value  ',iattr(i)
+           write(*,*)'Attribute value   ',iattr(i)
+   77   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+  
+c Test Case -- gdrdgattr
+c
+      write(10,27)
+      write(10,*)'Testing gdrdgattr, Group attribute '
+      write(10,*)'=================================='
+      write(*,*)'Testing gdrdgattr, Group attribute'
+      write(*,*)'================================='
+
+      status = he5_gdrdgattr(gdid_utm,'group',gattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdgattr(gdid_utm,"group",gattr)'
+        write(*,*)'Value returned by he5_gdrdgattr ',status
+        write(10,*)'status = he5_gdrdgattr(gdid_utm,"group",gattr)'
+        write(10,*)'Value returned by he5_gdrdgattr ',status
+        do 68 i=1,count
+           write(10,*)'Attribute value  ',gattr(i)
+           write(*,*)'Attribute value   ',gattr(i)
+   68   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+  
+      status = he5_gdrdgattr(gdid3,'group',gattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdgattr(gdid3,"group",gattr)'
+        write(*,*)'Value returned by he5_gdrdgattr ',status
+        write(10,*)'status = he5_gdrdgattr(gdid3,"group",gattr)'
+        write(10,*)'Value returned by he5_gdrdgattr ',status
+        do 78 i=1,count
+           write(10,*)'Attribute value  ',gattr(i)
+           write(*,*)'Attribute value   ',gattr(i)
+   78   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+  
+c Test Case -- gdinqdatatype
+c
+      write(10,27)
+      write(10,*)'Testing gdinqdatatype '
+      write(10,*)'====================='
+      write(*,*)'Testing gdinqdatatype'
+      write(*,*)'====================='
+
+      status = he5_gdinqdatatype(gdid_utm,"Grounding","local",
+     1HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+         write(*,*)'status = he5_gdinqdatatype(gdid_utm,"Grounding",
+     1"local",HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)'
+         write(*,*)'Data type of attribute ',dtype
+         write(*,*)'Class id of attribute ',classid
+         write(*,*)'Order of attribute ',order
+         write(*,*)'Size of attribute ',size
+         write(10,*)'status =he5_gdinqdatatype(gdid_utm,"Grounding",
+     1"local",HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)'
+         write(10,*)'Data type of attribute ',dtype
+         write(10,*)'Class id of attribute ',classid
+         write(10,*)'Order of attribute ',order
+         write(10,*)'Size of attribute ',size
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdinqdatatype(gdid3,"Grounding","local",
+     1HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+         write(*,*)'status = he5_gdinqdatatype(gdid3,"Grounding",
+     1"local",HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)'
+         write(*,*)'Data type of attribute ',dtype
+         write(*,*)'Class id of attribute ',classid
+         write(*,*)'Order of attribute ',order
+         write(*,*)'Size of attribute ',size
+         write(10,*)'status =he5_gdinqdatatype(gdid3,"Grounding",
+     1"local",HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)'
+         write(10,*)'Data type of attribute ',dtype
+         write(10,*)'Class id of attribute ',classid
+         write(10,*)'Order of attribute ',order
+         write(10,*)'Size of attribute ',size
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdrdlattr
+c
+      write(10,27)
+      write(10,*)'Testing gdrdlattr, Local attribute '
+      write(10,*)'=================================='
+      write(*,*)'Testing gdrdlattr, Local attribute'
+      write(*,*)'================================='
+
+      status = he5_gdrdlattr(gdid_utm,"Grounding","local",lattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status=he5_gdrdlattr(gdid_utm,"Grounding",
+     1"local",lattr)'
+        write(*,*)'Value returned by he5_gdrdlattr ',status
+        write(10,*)'status=he5_gdrdlattr(gdid_utm,"Grounding",
+     1"local",lattr)'
+        write(10,*)'Value returned by he5_gdrdlattr ',status
+        do 69 i=1,count
+           write(10,*)'Attribute value  ',lattr(i)
+           write(*,*)'Attribute value   ',lattr(i)
+   69   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdrdlattr(gdid3,"Grounding","local",lattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status=he5_gdrdlattr(gdid3,"Grounding",
+     1"local",lattr)'
+        write(*,*)'Value returned by he5_gdrdlattr ',status
+        write(10,*)'status=he5_gdrdlattr(gdid3,"Grounding",
+     1"local",lattr)'
+        write(10,*)'Value returned by he5_gdrdlattr ',status
+        do 79 i=1,count
+           write(10,*)'Attribute value  ',lattr(i)
+           write(*,*)'Attribute value   ',lattr(i)
+   79   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+  
+c Test Case -- gdinqattrs
+c
+      write(10,27)
+      write(10,*)'Testing gdinqattrs, Global attribute'
+      write(10,*)'===================================='
+      write(*,*)'Testing gdinqattrs, Global attribute'
+      write(*,*)'===================================='
+
+      lstatus = he5_gdinqattrs(gdid_utm, attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqattrs(gdid_utm, 
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by he5_gdinqattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqattrs(gdid_utm, 
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by he5_gdinqattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      lstatus = he5_gdinqattrs(gdid3, attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqattrs(gdid3, 
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by he5_gdinqattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqattrs(gdid3, 
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by he5_gdinqattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdinqgattrs
+c
+      write(10,27)
+      write(10,*)'Testing gdinqgattrs, Group attribute'
+      write(10,*)'===================================='
+      write(*,*)'Testing gdinqgattrs, Group attribute'
+      write(*,*)'===================================='
+
+      lstatus = he5_gdinqgattrs(gdid_utm, attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqgattrs(gdid_utm, 
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by he5_gdinqgattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqgattrs(gdid_utm,
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by he5_gdinqgattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      lstatus = he5_gdinqgattrs(gdid3, attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqgattrs(gdid3, 
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by he5_gdinqgattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqgattrs(gdid3,
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by he5_gdinqgattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdinqlattrs
+c
+      write(10,27)
+      write(10,*)'Testing gdinqlattrs, Local attribute'
+      write(10,*)'===================================='
+      write(*,*)'Testing gdinqlattrs, Local attribute'
+      write(*,*)'===================================='
+
+      lstatus = he5_gdinqlattrs(gdid_utm,"Grounding",
+     1attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqlattrs(gdid_utm,"Grounding",
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by he5_gdinqlattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqlattrs(gdid_utm,"Grounding",
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by he5_gdinqlattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      lstatus = he5_gdinqlattrs(gdid3,"Grounding",
+     1attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqlattrs(gdid3,"Grounding",
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by he5_gdinqlattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqlattrs(gdid3,"Grounding",
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by he5_gdinqlattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdgetfill
+c
+      write(10,27)
+      write(10,*)'Testing gdgetfill... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdgetfill... '
+      write(*,*)'=================='
+
+      status = he5_gdgetfill(gdid_utm,'Drift',ifillv)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdgetfill(gdid_utm,"Drift",ifillv)'
+         write(*,*)'Value returned by he5_gdgetfill ',status
+         write(*,*)'Fill value ',ifillv
+         write(10,*)'status = he5_gdgetfill(gdid_utm,"Drift",ifillv)'
+         write(10,*)'Value returned by he5_gdgetfill ',status
+         write(10,*)'Fill value ',ifillv
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdgetfill(gdid3,'Drift',ifillv)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdgetfill(gdid3,"Drift",ifillv)'
+         write(*,*)'Value returned by he5_gdgetfill ',status
+         write(*,*)'Fill value ',ifillv
+         write(10,*)'status = he5_gdgetfill(gdid3,"Drift",ifillv)'
+         write(10,*)'Value returned by he5_gdgetfill ',status
+         write(10,*)'Fill value ',ifillv
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddefboxreg
+c
+      write(10,27)
+      write(10,*)'Testing gddefboxreg... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddefboxreg... '
+      write(*,*)'=================='
+
+      corlon(1)=-126.0
+      corlon(2)=-121.5
+      corlat(1)=-70.0
+      corlat(2)=-65.0
+
+      regionid = he5_gddefboxreg(gdid_utm,corlon,corlat)
+      if (regionid .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'regionid = he5_gddefboxreg(gdid_utm,corlon,corlat)'
+         write(*,*)'Region id returned by he5_gddefboxreg ',regionid
+         write(10,*)'regionid = he5_gddefboxreg(gdid_utm,corlon,corlat)'
+         write(10,*)'Region id returned by he5_gddefboxreg ',regionid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      regionid3 = he5_gddefboxreg(gdid3,corlon,corlat)
+      if (regionid3 .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'regionid3 = he5_gddefboxreg(gdid3,corlon,corlat)'
+         write(*,*)'Region id returned by he5_gddefboxreg ',regionid3
+         write(10,*)'regionid3 = he5_gddefboxreg(gdid3,corlon,corlat)'
+         write(10,*)'Region id returned by he5_gddefboxreg ',regionid3
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- gdreginfo
+c
+      write(10,27)
+      write(10,*)'Testing gdreginfo... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdreginfo... '
+      write(*,*)'=================='
+      status = he5_gdreginfo(gdid_utm,regionid,"Impedance",nt,rk,
+     1dims,size,iuplft,ilrgt)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdreginfo(gdid_utm,regionid,
+     1"Impedance",nt,rk,dims,size,iuplft,ilrgt)'
+         write(*,*)'Value returned by he5_gdreginfo ',status
+         write(*,*)'Number type of region ',nt
+         write(*,*)'Rank of region ',rk
+         write(*,*)'Size of region ',size
+         write(*,11)'Dimensions of region',dims(1),' ',dims(2)
+         write(*,12)'Upper left point of region ',
+     1iuplft(1),' ',iuplft(2)
+         write(*,12)'Lower right point of region ',ilrgt(1),' ',ilrgt(2)
+         write(10,*)'status = he5_gdreginfo(gdid_utm,regionid,
+     1"Impedance",nt,rk,dims,size,iuplft,ilrgt)'
+         write(10,*)'Value returned by he5_gdreginfo ',status
+         write(10,*)'Number type of region ',nt
+         write(10,*)'Rank of region ',rk
+         write(10,*)'Size of region ',size
+         write(10,11)'Dimensions of region',dims(1),' ',dims(2)
+         write(10,12)'Upper left point of region ',
+     1iuplft(1),' ',iuplft(2)
+         write(10,12)'Lower right point of region ',
+     1ilrgt(1),' ',ilrgt(2)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdreginfo(gdid3,regionid3,"Impedance",nt,rk,
+     1dims,size,iuplft,ilrgt)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdreginfo(gdid3,regionid3,"Impedance",
+     1nt,rk,dims,size,iuplft,ilrgt)'
+         write(*,*)'Value returned by he5_gdreginfo ',status
+         write(*,*)'Number type of region ',nt
+         write(*,*)'Rank of region ',rk
+         write(*,*)'Size of region ',size
+         write(*,11)'Dimensions of region',dims(1),' ',dims(2)
+         write(*,12)'Upper left point of region ',
+     1iuplft(1),' ',iuplft(2)
+         write(*,12)'Lower right point of region ',ilrgt(1),' ',ilrgt(2)
+         write(10,*)'status = he5_gdreginfo(gdid3,regionid3,
+     1"Impedance",nt,rk,dims,size,iuplft,ilrgt)'
+         write(10,*)'Value returned by he5_gdreginfo ',status
+         write(10,*)'Number type of region ',nt
+         write(10,*)'Rank of region ',rk
+         write(10,*)'Size of region ',size
+         write(10,11)'Dimensions of region',dims(1),' ',dims(2)
+         write(10,12)'Upper left point of region ',
+     1iuplft(1),' ',iuplft(2)
+         write(10,12)'Lower right point of region ',
+     1ilrgt(1),' ',ilrgt(2)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdextreg
+c
+      write(10,27)
+      write(10,*)'Testing gdextreg... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdextreg... '
+      write(*,*)'=================='
+
+      status = he5_gdextreg(gdid_utm,regionid,'Impedance',datbuf)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+
+         write(*,*)'status=he5_gdextreg(gdid_utm,regionid,
+     1"Impedance",datbuf)'
+         write(*,*)'Value returned by he5_gdextreg ',status
+         write(10,*)'status=he5_gdextreg(gdid_utm,
+     1regionid,"Impedance",datbuf)'
+         write(10,*)'Value returned by he5_gdextreg ',status
+         do 175 i=100,150
+            write(*,*)'Value of region ',datbuf(i)
+            write(10,*)'Value of region ',datbuf(i)
+  175    continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdextreg(gdid3,regionid3,'Impedance',datbuf)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+
+         write(*,*)'status=he5_gdextreg(gdid3,regionid3,
+     1"Impedance",datbuf)'
+         write(*,*)'Value returned by he5_gdextreg ',status
+         write(10,*)'status=he5_gdextreg(gdid3,
+     1regionid,"Impedance",datbuf)'
+         write(10,*)'Value returned by he5_gdextreg ',status
+         do 185 i=100,150
+            write(*,*)'Value of region ',datbuf(i)
+            write(10,*)'Value of region ',datbuf(i)
+  185    continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddeftmeper
+c
+      write(10,27)
+      write(10,*)'Testing gddeftmeper... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddeftmeper... '
+      write(*,*)'=================='
+
+      periodid = he5_gddeftmeper(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,starttime,stoptime)
+      if (periodid .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'periodid = he5_gddeftmeper(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,starttime,stoptime)'
+        write(10,*)'Define a time period '
+        write(10,*)'Period id returned by he5_gddeftmeper ',periodid
+        write(*,*)'periodid = he5_gddeftmeper(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,starttime,stoptime)'
+        write(*,*)'Define a time period '
+        write(*,*)'Period id returned by he5_gddeftmeper ',periodid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      periodid = he5_gddeftmeper(gdid3,
+     1HE5_HDFE_NOPREVSUB,starttime,stoptime)
+      if (periodid .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'periodid = he5_gddeftmeper(gdid3,HE5_HDFE_NOPREVSUB,
+     1starttime,stoptime)'
+        write(10,*)'Define a time period '
+        write(10,*)'Period id returned by he5_gddeftmeper ',periodid
+        write(*,*)'periodid = he5_gddeftmeper(gdid3,HE5_HDFE_NOPREVSUB,
+     1starttime,stoptime)'
+        write(*,*)'Define a time period '
+        write(*,*)'Period id returned by he5_gddeftmeper ',periodid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddefvrtreg
+c
+      write(10,27)
+      write(10,*)'Testing gddefvrtreg... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddefvrtreg... '
+      write(*,*)'=================='
+
+      regionid = he5_gddefvrtreg(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,'Height',range)
+      if (regionid .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+
+        write(10,*)'regionid = he5_gddefvrtreg(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,"Height",range)'
+        write(10,*)'Define a vertical region '
+        write(10,*)'Region id returned by he5_gddefvrtreg ',regionid
+        write(*,*)'regionid = he5_gddefvrtreg(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,"Height",range)'
+        write(*,*)'Define a vertical region '
+        write(*,*)'Region id returned by he5_gddefvrtreg ',regionid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      regionid3 = he5_gddefvrtreg(gdid3,
+     1HE5_HDFE_NOPREVSUB,'Height',range)
+      if (regionid3 .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+
+        write(10,*)'regionid3 = he5_gddefvrtreg(gdid3,
+     1HE5_HDFE_NOPREVSUB,"Height",range)'
+        write(10,*)'Define a vertical region '
+        write(10,*)'Region id returned by he5_gddefvrtreg ',regionid3
+        write(*,*)'regionid3 = he5_gddefvrtreg(gdid3,
+     1HE5_HDFE_NOPREVSUB,"Height",range)'
+        write(*,*)'Define a vertical region '
+        write(*,*)'Region id returned by he5_gddefvrtreg ',regionid3
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gddupreg
+c
+      write(10,27)
+      write(10,*)'Testing gddupreg... '
+      write(10,*)'=================='
+      write(*,*)'Testing gddupreg... '
+      write(*,*)'=================='
+
+      regionid2 = he5_gddupreg(regionid)
+      if (regionid2 .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'regionid2 = he5_gddupreg(regionid)'
+        write(10,*)'Generate a new region id '
+        write(10,*)'New region id ',regionid2
+        write(*,*)'regionid2 = he5_gddupreg(regionid)'
+        write(*,*)'Generate a new region id '
+        write(*,*)'New region id ',regionid2
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      regionid4 = he5_gddupreg(regionid3)
+      if (regionid4 .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'regionid4 = he5_gddupreg(regionid3)'
+        write(10,*)'Generate a new region id '
+        write(10,*)'New region id ',regionid4
+        write(*,*)'regionid4 = he5_gddupreg(regionid3)'
+        write(*,*)'Generate a new region id '
+        write(*,*)'New region id ',regionid4
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdgetpix
+c
+      write(10,27)
+      write(10,*)'Testing gdgetpix... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdgetpix... '
+      write(*,*)'=================='
+
+      status = he5_gdgetpix(gdid_utm,5,lonval,latval,rowval,colval)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+
+        write(10,*)'status=he5_gdgetpix(gdid_utm,5,lonval,
+     1latval,rowval,colval)'
+        write(10,*)'Retrieve pixel row. column values '
+        write(*,*)'status = he5_gdgetpix(gdid_utm,5,lonval,latval,
+     1rowval,colval)'
+        write(*,*)'Retrieve pixel row. column values '
+        do 37 i=1,5
+           write(10,5)'Pixel position lon lat ',lonval(i),' ',
+     1latval(i),' ','Row Column ',rowval(i),' ',colval(i) 
+           write(*,5)'Pixel position lon lat ',lonval(i),' ',
+     1latval(i),' ','Row Column ',rowval(i),' ',colval(i) 
+   37   continue
+      endif
+    5 format(a,f6.1,a,f6.1,a,a,i2,a,i2)
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdgetpix(gdid3,5,lonval,latval,rowval,colval)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+
+        write(10,*)'status=he5_gdgetpix(gdid3,5,lonval,
+     1latval,rowval,colval)'
+        write(10,*)'Retrieve pixel row. column values '
+        write(*,*)'status = he5_gdgetpix(gdid3,5,lonval,latval,
+     1rowval,colval)'
+        write(*,*)'Retrieve pixel row. column values '
+        do 47 i=1,5
+           write(10,5)'Pixel position lon lat ',lonval(i),' ',
+     1latval(i),' ','Row Column ',rowval(i),' ',colval(i) 
+           write(*,5)'Pixel position lon lat ',lonval(i),' ',
+     1latval(i),' ','Row Column ',rowval(i),' ',colval(i) 
+   47   continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdgetpixval
+c
+      write(10,27)
+      write(10,*)'Testing gdgetpixval... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdgetpixval... '
+      write(*,*)'=================='
+
+      lstatus = he5_gdgetpixval(gdid_utm,5,rowval,
+     1colval,"Voltage",fldval)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'lstatus = he5_gdgetpixval(gdid_utm,5,rowval,colval,
+     1"Voltage",fldval)'
+        write(10,*)'Retrieve pixel values for specific locations '
+        write(*,*)'lstatus = he5_gdgetpixval(gdid_utm,5,rowval,colval,
+     1"Voltage",fldval)'
+        write(*,*)'Retrieve pixel values for specific locations '
+        do 42 i=1,5
+           write(10,17)'Row Col ',rowval(i),' ',colval(i),' ',
+     1'Pixel Value ',fldval(i)
+           write(*,17)'Row Col ',rowval(i),' ',colval(i),' ',
+     1'Pixel Value ',fldval(i)
+   42   continue
+      endif
+   17 format(a8,i2,a1,i2,a1,a12,f9.3)
+      write(10,*)' '
+      write(*,*)' '
+
+      lstatus = he5_gdgetpixval(gdid3,5,rowval,
+     1colval,"Voltage",fldval)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'lstatus = he5_gdgetpixval(gdid3,5,rowval,colval,
+     1"Voltage",fldval)'
+        write(10,*)'Retrieve pixel values for specific locations '
+        write(*,*)'lstatus = he5_gdgetpixval(gdid3,5,rowval,colval,
+     1"Voltage",fldval)'
+        write(*,*)'Retrieve pixel values for specific locations '
+        do 52 i=1,5
+           write(10,17)'Row Col ',rowval(i),' ',colval(i),' ',
+     1'Pixel Value ',fldval(i)
+           write(*,17)'Row Col ',rowval(i),' ',colval(i),' ',
+     1'Pixel Value ',fldval(i)
+   52   continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- gdinterpolate
+c
+      write(10,27)
+      write(10,*)'Testing gdinterpolate... '
+      write(10,*)'=================='
+      write(*,*)'Testing gdinterpolate... '
+      write(*,*)'=================='
+
+      lstatus=he5_gdinterpolate(gdid_utm,5,lonval,latval,
+     1'Voltage',interval)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'lstatus=he5_gdinterpolate(gdid_utm,5,lonval,latval,
+     1"Voltage",interval)'
+        write(10,*)'Interpolate 5 values for field Voltage '
+        write(*,*)'lstatus=he5_gdinterpolate(gdid_utm,5,lonval,latval,
+     1"Voltage",interval)'
+        write(*,*)'Interpolate 5 values for field Voltage '
+        write(*,*)'Status returned by call to he5_gdinterpolate ',
+     1lstatus
+        do 38 index1=1,5
+           write(*,4)'Interpolated value ',interval(index1,1)
+           write(10,4)'Interpolated value ',interval(index1,1)
+   38   continue
+      endif
+    4 format(a,f9.3)
+      write(10,*)' '
+      write(*,*)' '
+
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Value returned by he5_gddetach ',status
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Value returned by he5_gddetach ',status
+      endif
+
+      lstatus=he5_gdinterpolate(gdid3,5,lonval,latval,
+     1'Voltage',interval)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'lstatus=he5_gdinterpolate(gdid3,5,lonval,latval,
+     1"Voltage",interval)'
+        write(10,*)'Interpolate 5 values for field Voltage '
+        write(*,*)'lstatus=he5_gdinterpolate(gdid3,5,lonval,latval,
+     1"Voltage",interval)'
+        write(*,*)'Interpolate 5 values for field Voltage '
+        write(*,*)'Status returned by call to he5_gdinterpolate ',
+     1lstatus
+        do 48 index1=1,5
+           write(*,4)'Interpolated value ',interval(index1,1)
+           write(10,4)'Interpolated value ',interval(index1,1)
+   48   continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      status = he5_gddetach(gdid3)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddetach(gdid3)'
+         write(*,*)'Value returned by he5_gddetach ',status
+         write(10,*)'status = he5_gddetach(gdid3)'
+         write(10,*)'Value returned by he5_gddetach ',status
+      endif
+
+      status = he5_gdclose(gdfid)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdclose(gdfid)'
+         write(*,*)'Returned from he5_gdclose ', status
+         write(10,*)'status = he5_gdclose(gdfid)'
+         write(10,*)'Returned from he5_gdclose ', status
+      endif
+
+      status = he5_gdclose(gdfid3)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdclose(gdfid3)'
+         write(*,*)'Returned from he5_gdclose ', status
+         write(10,*)'status = he5_gdclose(gdfid3)'
+         write(10,*)'Returned from he5_gdclose ', status
+      endif
+
+      close(unit=10)
+  27  format('
')
+      stop
+      end
+
+
+
+
+
+
diff --git a/testdrivers/grid/testgrid_szip64.f b/testdrivers/grid/testgrid_szip64.f
new file mode 100755
index 0000000..f15ddd6
--- /dev/null
+++ b/testdrivers/grid/testgrid_szip64.f
@@ -0,0 +1,4284 @@
+c----------------------------------------------------------------------------
+c     Copyright (C) 2000   Emergent IT Inc. and Raytheon Systems Company    |
+c----------------------------------------------------------------------------
+c testgrid64.f                                                              |
+c In this program we create, define and write a simple grid hdfeos file     |
+c using the grid interface                                                  |
+c----------------------------------------------------------------------------
+
+      program       testgrid64
+
+      implicit      none
+ 
+      include       'hdfeos5.inc'
+
+      integer   	status, i, ii
+      integer		compparm(5)
+      integer 	    gdfid, gdfid2, gdfid3, gdid_utm, gdid2, gdid3
+      integer 	    zonecode, pixregcode, orgcode
+      integer	    attr(4), iattr(4), gattr(4), lattr(4)
+      integer 	    spherecode, zero
+      integer		regionid, regionid2, regionid3, regionid4
+      integer	    dtype, classid, order
+      integer	    he5_gdopen, he5_gdcreate
+      integer       he5_gdattach, he5_gddetach
+      integer	    he5_gdclose, he5_gddefproj
+      integer       he5_gddefdim, he5_gdinqdatatype
+      integer	    he5_gddeftle, he5_gddeffld
+      integer       he5_gdsetfill, he5_gdwrfld
+      integer	    he5_gdwrattr, he5_gdwrgattr
+      integer       he5_gdwrlattr, he5_gdorginfo
+      integer	    he5_gddefcomp, he5_gdinqflds
+      integer       he5_gdprojinfo
+      integer	    he5_gdrdfld, he5_gdattrinfo
+      integer       he5_gdgatinfo
+      integer       he5_gdlatinfo, he5_gdrdattr
+      integer       he5_gdrdgattr, he5_gdrdlattr
+      integer	    he5_gdreginfo, he5_gddeftmeper
+      integer       he5_gddefvrtreg
+      integer	    he5_gddeforigin, he5_gddefpreg
+      integer       he5_gdinqdims, he5_gdgetfill
+      integer	    he5_gdgridinfo, he5_gdcompinfo
+      integer       he5_gdfldinfo, he5_gddefboxreg
+      integer	    he5_gdgetpix, he5_gddupreg
+      integer       he5_gdpreginfo, he5_gdextreg
+      integer		rnk(8), numtype(8)
+      integer		zcode, scode, nflds
+
+      integer*4	    ntype
+      integer*4		nt, rk
+      integer*4		periodid
+      integer*4		lstatus, n, one      
+      integer*4		index1
+      integer*4		index2
+      integer*4		dimsizes(2)
+      integer*4		lat(40,50)
+      integer*4		latcnt
+      integer*4		lon(40,50)
+      integer*4		loncnt
+      integer*4	    he5_gdinqgrid, he5_gddiminfo
+      integer*4     he5_gdnentries
+      integer*4	    he5_gdinqattrs, he5_gdinqgattrs
+      integer*4     he5_gdinqlattrs
+      integer*4	    pcode
+
+      integer*8	    xdim, ydim
+      integer*8	    testdim1, testdim2, hghtdim, conduction
+      integer*8	    timedim, convection, setcount(1)
+      integer*8 	start(2)
+      integer*8 	stride(2)
+      integer*8 	edge(2)
+      integer*8 	start1d, stride1d, edge1d
+      integer*8		tiledims(2)
+      integer*8	    count, nlonlat
+      integer*8	    size
+      integer*8		rowval(5), colval(5)
+      integer*8	    xdimsize, ydimsize
+      integer*8	    he5_gdgetpixval, he5_gdinterpolate
+      integer*8	    strbufsize
+      integer*8		dims(8)
+
+      real		    fillvalue, ifillv
+
+      real*4		ray3(250)
+      real*4		utmray(60,80), georay(60,80)
+      real*4		utmhght(80)
+      real*4		hghtinit
+      real*4		utmcnt, geocnt
+      real*4		raycnt, ray3cnt
+      real*4		tempray(60,80)
+      real*4		datbuf(4800)
+      real*4		fldval(5)
+      
+      real*8		starttime, stoptime
+      real*8		range(2)
+      real*8		projparm(16), pparm(16)
+      real*8		uplft(2), lowrgt(2)
+      real*8		iuplft(2), ilrgt(2)
+      real*8		interval(5,2)
+      real*8		lonval(5), latval(5)
+      real*8		utmtmeray(4800)
+      real*8		tmeinit
+      real*8		upleftpt(2), lowrtpt(2),corlon(2),corlat(2)
+
+      character*80	grdnames, dimname, fldlist, attrlist
+      character*80	compcodestring, maxdimname
+      
+
+      index1 = 0
+      index2 = 0
+      dimsizes(1) = 40
+      dimsizes(2) = 100
+      compparm(1) = 6
+      compparm(2) = 0
+      compparm(3) = 0
+      compparm(4) = 0
+      compparm(5) = 0
+      fillvalue = 1996.0
+      raycnt = -799.0
+      ray3cnt = -19.5
+      attr(1) = 11
+      attr(2) = 33
+      attr(3) = 55
+      attr(4) = 77
+      utmcnt=-799.0
+      geocnt=2001.0
+      hghtinit = 323.0
+      tmeinit = 35232487.2d0
+      starttime = 35233000.8d0
+      stoptime = 35435050.9d0
+      range(1) = 352.8d0
+      range(2) = 400.9d0
+      lonval(1) = -122.0d0
+      latval(1) = -68.0d0
+      lonval(2) = -122.5d0
+      latval(2) = -68.0d0
+      lonval(3) = -123.0d0
+      latval(3) = -68.0d0
+      lonval(4) = -123.5d0
+      latval(4) = -68.0d0
+      lonval(5) = -124.0d0
+      latval(5) = -68.0d0
+      tiledims(1) = 16
+      tiledims(2) = 15
+
+      latcnt = 38.0
+      loncnt = 78.0
+      zero = 0
+      one = 1
+      
+c
+c This section of the program just fills some arrays with data that we will
+c use later in the program
+c
+      do 70 index1=1,60
+         do 80 index2=1,80
+            utmray(index2,index1) = utmcnt
+            georay(index2,index1) = geocnt
+            utmcnt = utmcnt + .4
+            geocnt = geocnt + .2
+   80   continue
+   70 continue
+  
+      
+      do 30 index1=1,250
+            ray3(index1) = ray3cnt
+            ray3cnt = ray3cnt + .1
+   30 continue
+      
+      do 32 index1=1,80
+            utmhght(index1) = hghtinit
+            hghtinit = hghtinit + 2.75
+   32 continue
+
+      do 34 index1=1,4800
+            utmtmeray(index1) = tmeinit
+            tmeinit = tmeinit + 70.7
+   34 continue
+
+      do 50 index1=1,50
+         do 60 index2=1,40      
+            lat(index2,index1) = latcnt
+            lon(index2,index1) = loncnt
+            loncnt = loncnt - 0.1
+   60    continue
+         latcnt = latcnt + 0.1
+         loncnt = 78.0
+   50 continue
+
+  230 format('********Error unexpected**********')
+  231 format('********Error Expected************')
+  240 format('***********Passed Test*********')
+
+
+      open(unit=10,file='testgrid.txt', status = "UNKNOWN")
+
+      write(*,*)'Testing Grid FORTRAN 77 interface '
+      write(*,*)'=================================='
+      write(10,*)'Testing Grid FORTRAN 77 interface '
+      write(10,*)'=================================='
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdopen
+c
+      write(10,*)'Testing he5_gdopen... '
+      write(10,*)'======================'
+      write(*,*)'Testing he5_gdopen... '
+      write(*,*)'======================'
+      gdfid2 = he5_gdopen("grid2.he5",HE5F_ACC_TRUNC)
+      if (gdfid2 .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdfid2 = he5_gdopen("grid2.he5",HE5F_ACC_TRUNC)'
+         write(10,*)'Value returned by gdopen ', gdfid2
+         write(*,*)'gdfid2 = he5_gdopen("grid2.he5",HE5F_ACC_TRUNC)'
+         write(*,*)'Value returned by gdopen ', gdfid2
+      endif
+      write(*,*)' '
+      write(10,*)' '
+
+      gdfid3 = he5_gdopen("grid3.he5",HE5F_ACC_TRUNC)
+      if (gdfid3 .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdfid3 = he5_gdopen("grid3.he5",HE5F_ACC_TRUNC)'
+         write(10,*)'Value returned by gdopen ', gdfid3
+         write(*,*)'gdfid3 = he5_gdopen("grid3.he5",HE5F_ACC_TRUNC)'
+         write(*,*)'Value returned by gdopen ', gdfid3
+      endif
+      write(*,*)' '
+      write(10,*)' '
+
+      gdfid = he5_gdopen('grid.he5',HE5F_ACC_TRUNC)
+      if (gdfid .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'Opening file grid.he5'
+         write(10,*)'Opening file grid.he5'
+         write(10,*) 'gdfid = he5_gdopen("grid.he5",HE5F_ACC_TRUNC)'
+         write(10,*) 'File id returned from gdopen ', gdfid
+         write(*,*) 'gdfid = he5_gdopen("grid.he5",HE5F_ACC_TRUNC)'
+         write(*,*) 'File id returned from gdopen ', gdfid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- he5_gdcreate
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdcreate... '
+      write(10,*)'========================'
+      write(*,*)'Testing he5_gdcreate... '
+      write(*,*)'========================'
+
+      xdim      = 60
+      ydim      = 80
+      uplft(1)  = 353299.39125d0
+      uplft(2)  = -7100284.64348d0
+      lowrgt(1) = 603434.52148d0
+      lowrgt(2) = -7991341.17870d0
+
+
+      gdid2 = he5_gdcreate(gdfid2, 'UTMGrid2', 
+     1xdim, ydim, uplft, lowrgt)
+      if (gdid2 .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*) 'Create UTMGrid2'
+         write(*,*)'gdid2 = he5_gdcreate(gdfid2, "UTMGrid2", 
+     1xdim, ydim, uplft, lowrgt)'
+         write(10,*) 'Value returned by gdcreate ', gdid2
+         write(*,*) 'Create UTMGrid2'
+         write(10,*)'gdid2 = he5_gdcreate(gdfid2, "UTMGrid2",
+     1xdim, ydim, uplft, lowrgt)'
+         write(*,*) 'Value returned by gdcreate ', gdid2
+      endif
+
+      gdid3 = he5_gdcreate(gdfid3, 'UTMGrid3', 
+     1xdim, ydim, uplft, lowrgt)
+      if (gdid3 .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*) 'Create UTMGrid3'
+         write(*,*)'gdid3 = he5_gdcreate(gdfid3, "UTMGrid3", 
+     1xdim, ydim, uplft, lowrgt)'
+         write(10,*) 'Value returned by gdcreate ', gdid3
+         write(*,*) 'Create UTMGrid3'
+         write(10,*)'gdid3 = he5_gdcreate(gdfid3, "UTMGrid3",
+     1xdim, ydim, uplft, lowrgt)'
+         write(*,*) 'Value returned by gdcreate ', gdid3
+      endif
+      
+      
+    
+      gdid_utm = he5_gdcreate(gdfid, 'UTMGrid', xdim, ydim, 
+     1uplft, lowrgt)
+      if (gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Creating UTMGrid'
+         write(*,*)'Creating UTMGrid'
+         write(*,*)'gdid_utm= he5_gdcreate(gdfid,"UTMGrid",xdim,
+     1ydim,uplft,lowrgt)'
+         write(10,*)'gdid_utm= he5_gdcreate(gdfid,"UTMGrid",xdim,
+     1ydim,uplft,lowrgt)'
+         write(10,*)'UTM grid id returned from gdcreate ',gdid_utm
+         write(*,*)'UTM grid id returned from gdcreate ',gdid_utm
+      endif 
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddefproj
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddefproj... '
+      write(10,*)'========================'
+      write(*,*)'Testing he5_gddefproj... '
+      write(*,*)'========================'
+
+      zonecode = 10
+      spherecode = 0
+
+      do 120 index1=1,16
+         projparm(index1)=0
+ 120  continue
+  
+      status = he5_gddefproj(gdid_utm,HE5_GCTP_UTM,zonecode,
+     1spherecode,projparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Defining UTM projection'
+         write(*,*)'Defining UTM projection'
+         write(*,*)'status= he5_gddefproj(gdid_utm,HE5_GCTP_UTM,
+     1zonecode,spherecode, projparm)'
+         write(10,*)'status= he5_gddefproj(gdid_utm,HE5_GCTP_UTM,
+     1zonecode,spherecode, projparm)'
+         write(10,*)'Returned value from gddefproj ', status
+         write(*,*)'Returned value from gddefproj ', status
+      endif 
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefproj(gdid3,HE5_GCTP_UTM,zonecode,
+     1spherecode,projparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Defining UTM projection'
+         write(*,*)'Defining UTM projection'
+         write(*,*)'status= he5_gddefproj(gdid3,HE5_GCTP_UTM,
+     1zonecode,spherecode, projparm)'
+         write(10,*)'status= he5_gddefproj(gdid3,HE5_GCTP_UTM,
+     1zonecode,spherecode, projparm)'
+         write(10,*)'Returned value from gddefproj ', status
+         write(*,*)'Returned value from gddefproj ', status
+      endif 
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefproj(gdid2,HE5_GCTP_UTM,zonecode,
+     1spherecode,projparm)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Defining UTM'
+         write(10,*)'status = he5_gddefproj(gdid2,HE5_GCTP_UTM,
+     1zonecode,spherecode,projparm)'
+         write(10,*)'Value returned by gddefproj ', status
+         write(*,*)'Defining UTM'
+         write(*,*)'status = he5_gddefproj(gdid2,HE5_GCTP_UTM,
+     1zonecode,spherecode,projparm)'
+         write(*,*)'Value returned by gddefproj ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- he5_gddefpreg
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddefpreg... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddefpreg... '
+      write(*,*)'=========================='
+      status = he5_gddefpreg(gdid_utm, HE5_HDFE_CORNER)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddefpreg(gdid_utm, 
+     1HE5_HDFE_CORNER)'
+         write(10,*)'status = he5_gddefpreg(gdid_utm, 
+     1HE5_HDFE_CORNER)'
+         write(10,*)'Returned from gddefpreg ', status
+         write(*,*)'Returned from gddefpreg ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefpreg(gdid3, HE5_HDFE_CORNER)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddefpreg(gdid3, 
+     1HE5_HDFE_CORNER)'
+         write(10,*)'status = he5_gddefpreg(gdid3, 
+     1HE5_HDFE_CORNER)'
+         write(10,*)'Returned from gddefpreg ', status
+         write(*,*)'Returned from gddefpreg ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddeforigin
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddeforigin... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddeforigin... '
+      write(*,*)'=========================='
+      status = he5_gddeforigin(gdid_utm,HE5_HDFE_GD_UL)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddeforigin(gdid_utm,
+     1HE5_HDFE_GD_UL)'
+         write(*,*)'Value of status from gddeforigin ',status
+         write(10,*)'status = he5_gddeforigin(gdid_utm,
+     1HE5_HDFE_GD_UL)'
+         write(10,*)'Value of status from gddeforigin ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddeforigin(gdid3,HE5_HDFE_GD_UL)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddeforigin(gdid3,
+     1HE5_HDFE_GD_UL)'
+         write(*,*)'Value of status from gddeforigin ',status
+         write(10,*)'status = he5_gddeforigin(gdid3,
+     1HE5_HDFE_GD_UL)'
+         write(10,*)'Value of status from gddeforigin ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddefdim
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddefdim... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddefdim... '
+      write(*,*)'=========================='
+      testdim1 = 40
+      status = he5_gddefdim(gdid2,'TestDim1',testdim1)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid2,"TestDim1",40)'
+         write(10,*)'Value returned by gddefdim ', status
+         write(*,*)'status = he5_gddefdim(gdid2,"TestDim1",40)'
+         write(*,*)'Value returned by gddefdim ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      testdim2 = 25
+      status = he5_gddefdim(gdid2, 'TestDim2', testdim2)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid2,"TestDim2",25)'
+         write(10,*)'Value returned by gddefdim ', status
+         write(*,*)'status = he5_gddefdim(gdid2,"TestDim2",25)'
+         write(*,*)'Value returned by gddefdim ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      conduction = 250
+      status = he5_gddefdim(gdid_utm, 'Conduction', conduction)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid_utm,
+     1"Conduction",250)'
+         write(10,*)'Returned value from gddefdim ', status
+         write(*,*)'status = he5_gddefdim(gdid_utm, 
+     1"Conduction", 250)'
+         write(*,*)'Returned value from gddefdim ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      timedim = 4800
+      status = he5_gddefdim(gdid_utm,'Timedim',timedim)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid_utm,
+     1"Timedim",4800)'
+         write(10,*)'Status returned by call to gddefdim ',status
+         write(*,*)'status = he5_gddefdim(gdid_utm,
+     1"Timedim",4800)'
+         write(*,*)'Status returned by call to gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      hghtdim = 80
+      status = he5_gddefdim(gdid_utm,'Hghtdim',hghtdim)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status = he5_gddefdim(gdid_utm,"Hghtdim",80)'
+        write(10,*)'Status returned by call to gddefdim ',status
+        write(*,*)'status = he5_gddefdim(gdid_utm,"Hghtdim",80)'
+        write(*,*)'Status returned by call to gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      convection = 60
+      status = he5_gddefdim(gdid_utm,'Convection',convection)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define dimension Convection '
+        write(10,*)'status = he5_gddefdim(gdid_utm,
+     1"Convection",60)'
+        write(10,*)'Status returned by call to gddefdim ',status
+        write(*,*)'Define dimension Convection '
+        write(*,*)'status = he5_gddefdim(gdid_utm,
+     1"Convection",60)'
+        write(*,*)'Status returned by call to gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      conduction = 250
+      status = he5_gddefdim(gdid3, 'Conduction', conduction)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid3,
+     1"Conduction",250)'
+         write(10,*)'Returned value from gddefdim ', status
+         write(*,*)'status = he5_gddefdim(gdid3, 
+     1"Conduction", 250)'
+         write(*,*)'Returned value from gddefdim ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      timedim = 4800
+      status = he5_gddefdim(gdid3,'Timedim',timedim)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddefdim(gdid3,
+     1"Timedim",4800)'
+         write(10,*)'Status returned by call to gddefdim ',status
+         write(*,*)'status = he5_gddefdim(gdid3,
+     1"Timedim",4800)'
+         write(*,*)'Status returned by call to gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      hghtdim = 80
+      status = he5_gddefdim(gdid3,'Hghtdim',hghtdim)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status = he5_gddefdim(gdid3,"Hghtdim",80)'
+        write(10,*)'Status returned by call to gddefdim ',status
+        write(*,*)'status = he5_gddefdim(gdid3,"Hghtdim",80)'
+        write(*,*)'Status returned by call to gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      convection = 60
+      status = he5_gddefdim(gdid3,'Convection',convection)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define dimension Convection '
+        write(10,*)'status = he5_gddefdim(gdid3,
+     1"Convection",60)'
+        write(10,*)'Status returned by call to gddefdim ',status
+        write(*,*)'Define dimension Convection '
+        write(*,*)'status = he5_gddefdim(gdid3,
+     1"Convection",60)'
+        write(*,*)'Status returned by call to gddefdim ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddetach
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddetach... '
+      write(10,*)'======================='
+      write(*,*)'Testing he5_gddetach... '
+      write(*,*)'======================='
+      status = he5_gddetach(gdid2)
+      if(status .lt. zero) then
+         write(*,231)
+         write(10,231)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid2)'
+         write(10,*)'Value returned by gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid2)'
+         write(*,*)'Value returned by gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned value from gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Returned value from gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+ 
+      status = he5_gddetach(gdid3)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid3)'
+         write(10,*)'Returned value from gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid3)'
+         write(*,*)'Returned value from gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+ 
+c Test Case -- he5_gdattach
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdattach... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdattach... '
+      write(*,*)'=========================='
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if(gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid_utm=he5_gdattach(gdfid,"UTMGrid")'
+         write(10,*)'Handle returned from gdattach ',gdid_utm
+         write(*,*)'gdid_utm=he5_gdattach(gdfid,"UTMGrid")'
+         write(*,*)'Handle returned from gdattach ',gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid2 = he5_gdattach(gdfid2, 'UTMGrid2')
+      if(gdid2 .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid2=he5_gdattach(gdfid2, "UTMGrid2")'
+         write(10,*)'Value returned by gdattach ', gdid2
+         write(*,*)'gdid2=he5_gdattach(gdfid2, "UTMGrid2")'
+         write(*,*)'Value returned by gdattach ', gdid2
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid3 = he5_gdattach(gdfid3, 'UTMGrid3')
+      if(gdid3 .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid3=he5_gdattach(gdfid3, "UTMGrid3")'
+         write(10,*)'Value returned by gdattach ', gdid3
+         write(*,*)'gdid3=he5_gdattach(gdfid3, "UTMGrid3")'
+         write(*,*)'Value returned by gdattach ', gdid3
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddeffld
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddeffld... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddeffld... '
+      write(*,*)'=========================='
+
+      status= he5_gddeffld(gdid2,"tempfield","TestDim2,TestDim1",
+     1" ",HE5T_NATIVE_FLOAT, HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,231)
+         write(10,231)
+        
+      else 
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "tempfield"'
+        write(10,*)'status= he5_gddeffld(gdid2,"tempfield",
+     1"TestDim2,TestDim1"," ",HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)'
+        write(10,*)'Value returned by gddeffld ', status
+        write(*,*)'Define: "tempfield"'
+        write(*,*)'status= he5_gddeffld(gdid2,"tempfield",
+     1"TestDim2,TestDim1","",HE5T_NATIVE_FLOAT,HE5_HDFE_NOMERGE)'
+        write(*,*)'Value returned by gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid_utm,'Time','Timedim'," ",
+     1HE5T_NATIVE_DOUBLE, HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+        write(10,*)' Define field Time'
+        write(10,*)'status= he5_gddeffld(gdid_utm,"Time","Timedim",
+     1"",HE5T_NATIVE_DOUBLE, HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to gddeffld ',status
+        write(*,*)' Define field Time'
+        write(*,*)'status= he5_gddeffld(gdid_utm,"Time","Timedim",
+     1"",HE5T_NATIVE_DOUBLE, HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid_utm,'Height','Hghtdim'," ", 
+     1HE5T_NATIVE_FLOAT, HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+        write(10,*)' Define field Height'
+        write(10,*)'status= he5_gddeffld(gdid_utm,"Height",
+     1"Hghtdim","",HE5T_NATIVE_FLOAT, HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to gddeffld ',status
+        write(*,*)' Define field Height'
+        write(*,*)'status= he5_gddeffld(gdid_utm,"Height","Hghtdim",
+     1"",HE5T_NATIVE_FLOAT, HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid3,'Time','Timedim'," ",
+     1HE5T_NATIVE_DOUBLE, HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+        write(10,*)' Define field Time'
+        write(10,*)'status= he5_gddeffld(gdid3,"Time","Timedim",
+     1"",HE5T_NATIVE_DOUBLE, HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to gddeffld ',status
+        write(*,*)' Define field Time'
+        write(*,*)'status= he5_gddeffld(gdid3,"Time","Timedim",
+     1"",HE5T_NATIVE_DOUBLE, HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid3,'Height','Hghtdim'," ", 
+     1HE5T_NATIVE_FLOAT, HE5_HDFE_NOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+        write(10,*)' Define field Height'
+        write(10,*)'status= he5_gddeffld(gdid3,"Height",
+     1"Hghtdim","",HE5T_NATIVE_FLOAT, HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to gddeffld ',status
+        write(*,*)' Define field Height'
+        write(*,*)'status= he5_gddeffld(gdid3,"Height","Hghtdim",
+     1"",HE5T_NATIVE_FLOAT, HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- he5_gddeftle
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddeftle... '
+      write(10,*)'======================='
+      write(*,*)'Testing he5_gddeftle... '
+      write(*,*)'======================='
+
+      status = he5_gddeftle(gdid_utm,HE5_HDFE_TILE,2,tiledims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define tiling dimensions '
+        write(10,*)'status = he5_gddeftle(gdid_utm,
+     1HE5_HDFE_TILE,2,tiledims)'
+        write(10,*)'Status returned by call to gddeftle ',status
+        write(*,*)'Status returned by call to gddeftle ',status
+        write(*,*)'status = he5_gddeftle(gdid_utm,
+     1HE5_HDFE_TILE,2,tiledims)'
+        write(*,*)'Define tiling dimensions '
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid_utm,'SideB','YDim,Convection',
+     1" ",HE5T_NATIVE_INT, HE5_HDFE_NOMERGE)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define field that will be tiled '
+        write(10,*)'status= he5_gddeffld(gdid_utm,"SideB",
+     1"YDim,Convection"," ",HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to gddeffld ',status
+        write(*,*)'Define field that will be tiled '
+        write(*,*)'status= he5_gddeffld(gdid_utm,"SideB",
+     1"YDim,Convection","",HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then 
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned value from gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Returned value from gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if (gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdattach(gdfid,"UTMGrid")'
+         write(10,*)'Returned value from gdattach ', status
+         write(*,*)'status = he5_gddetach(gdfid,"UTMGrid")'
+         write(*,*)'Returned value from gdattach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid_utm,'Grounding','Conduction',
+     1" ",HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Define: "Grounding"'                  
+         write(10,*)'status= he5_gddeffld(gdid_utm,"Grounding",
+     1"Conduction","",HE5T_NATIVE_FLOAT,HE5_HDF_NOMERGE)'
+         write(10,*)'Value returned by gddeffld ', status
+         write(*,*)'Define: "Grounding"'                  
+         write(*,*)'status= he5_gddeffld(gdid_utm,"Grounding",
+     1"Conduction","",HE5T_NATIVE_FLOAT,HE5_HDF_NOMERGE)'
+         write(*,*)'Value returned by gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddeftle(gdid3,HE5_HDFE_TILE,2,tiledims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define tiling dimensions '
+        write(10,*)'status = he5_gddeftle(gdid3,
+     1HE5_HDFE_TILE,2,tiledims)'
+        write(10,*)'Status returned by call to gddeftle ',status
+        write(*,*)'Status returned by call to gddeftle ',status
+        write(*,*)'status = he5_gddeftle(gdid3,
+     1HE5_HDFE_TILE,2,tiledims)'
+        write(*,*)'Define tiling dimensions '
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid3,'SideB','YDim,Convection',
+     1" ",HE5T_NATIVE_INT, HE5_HDFE_NOMERGE)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define field that will be tiled '
+        write(10,*)'status= he5_gddeffld(gdid3,"SideB",
+     1"YDim,Convection"," ",HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)'
+        write(10,*)'Status returned by call to gddeffld ',status
+        write(*,*)'Define field that will be tiled '
+        write(*,*)'status= he5_gddeffld(gdid3,"SideB",
+     1"YDim,Convection","",HE5T_NATIVE_INT,HE5_HDFE_NOMERGE)'
+        write(*,*)'Status returned by call to gddeffld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid3)
+      if (status .lt. zero) then 
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid3)'
+         write(10,*)'Returned value from gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid3)'
+         write(*,*)'Returned value from gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid3 = he5_gdattach(gdfid3, 'UTMGrid3')
+      if (gdid3 .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdattach(gdfid3,"UTMGrid3")'
+         write(10,*)'Returned value from gdattach ', status
+         write(*,*)'status = he5_gddetach(gdfid3,"UTMGrid3")'
+         write(*,*)'Returned value from gdattach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid3,'Grounding','Conduction',
+     1" ",HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Define: "Grounding"'                  
+         write(10,*)'status= he5_gddeffld(gdid3,"Grounding",
+     1"Conduction","",HE5T_NATIVE_FLOAT,HE5_HDF_NOMERGE)'
+         write(10,*)'Value returned by gddeffld ', status
+         write(*,*)'Define: "Grounding"'                  
+         write(*,*)'status= he5_gddeffld(gdid3,"Grounding",
+     1"Conduction","",HE5T_NATIVE_FLOAT,HE5_HDF_NOMERGE)'
+         write(*,*)'Value returned by gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddefcomp
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddefcomp... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddefcomp... '
+      write(*,*)'=========================='
+
+      tiledims(1) = 16
+      tiledims(2) = 15
+      status = he5_gddeftle(gdid_utm,HE5_HDFE_TILE,2,tiledims)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'Setup Tiling dimensions '
+         write(*,*)'Required when using compression'
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefcomp(gdid_utm,HE5_HDFE_COMP_DEFLATE, compparm)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Setup compression mode'
+        write(10,*)'status = he5_gddefcomp(gdid_utm,
+     1HE5_HDFE_COMP_DEFLATE, compparm)'
+        write(10,*)'Status returned by call to gddefcomp ',status
+        write(*,*)'Setup compression mode'
+        write(*,*)'status = he5_gddefcomp(gdid_utm,
+     1HE5_HDFE_COMP_DEFLATE, compparm)'
+        write(*,*)'Status returned by call to gddefcomp ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid_utm,"Voltage","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT,0)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "Voltage"'
+        write(10,*)'status = he5_gddeffld(gdid_utm,"Voltage",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(10,*)'Value returned from gddeffld ', status
+        write(*,*)'Define: "Voltage"'
+        write(*,*)'status = he5_gddeffld(gdid_utm,"Voltage",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(*,*)'Value returned from gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddeftle(gdid3,HE5_HDFE_TILE,2,tiledims)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'Setup Tiling dimensions '
+         write(*,*)'Required when using compression'
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddefcomp(gdid3,
+     1HE5_HDFE_COMP_SHUF_SZIP_K13orEC, compparm)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Setup compression mode'
+        write(10,*)'status = he5_gddefcomp(gdid3,
+     1HE5_HDFE_COMP_SHUF_SZIP_K13orEC,compparm)'
+        write(10,*)'Status returned by call to gddefcomp ',status
+        write(*,*)'Setup compression mode'
+        write(*,*)'status = he5_gddefcomp(gdid3,
+     1HE5_HDFE_COMP_SHUF_SZIP_K13orEC,compparm)'
+        write(*,*)'Status returned by call to gddefcomp ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid3,"Voltage","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT,0)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "Voltage"'
+        write(10,*)'status = he5_gddeffld(gdid3,"Voltage",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(10,*)'Value returned from gddeffld ', status
+        write(*,*)'Define: "Voltage"'
+        write(*,*)'status = he5_gddeffld(gdid3,"Voltage",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(*,*)'Value returned from gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdsetfill
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdsetfill... '
+      write(10,*)'========================'
+      write(*,*)'Testing he5_gdsetfill... '
+      write(*,*)'========================='
+
+      status = he5_gdsetfill(gdid_utm, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Testing he5_gdsetfill'
+         write(10,*)'status = he5_gdsetfill(gdid_utm, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(10,*)'Returned from gdsetfill ', status
+         write(*,*)'Testing he5_gdsetfill'
+         write(*,*)'status = he5_gdsetfill(gdid_utm, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(*,*)'Returned from gdsetfill ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid_utm,"Drift","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "Drift"'      
+        write(10,*)'status= he5_gddeffld(gdid_utm,"Drift","YDim,XDim",
+     1"",HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)'
+        write(10,*)'Value returned from gddeffld ', status
+        write(*,*)'Define: "Drift"'      
+        write(*,*)'status= he5_gddeffld(gdid_utm,"Drift","YDim,XDim",
+     1"",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(*,*)'Value returned from gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid_utm,'Impedance','YDim,XDim'," ",
+     1HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Define: "Impedance"'            
+         write(10,*)'status= he5_gddeffld(gdid_utm,"Impedance",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+         write(10,*)'Value returned from gddeffld ', status
+         write(*,*)'Define: "Impedance"'            
+         write(*,*)'status= he5_gddeffld(gdid_utm,"Impedance",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+         write(*,*)'Value returned from gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      status = he5_gddetach(gdid_utm)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned value from gddetach ', status
+         write(*,*)'Returned value from gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if(gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(10,*)'Handle returned from gdattach ', gdid_utm
+         write(*,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(*,*)'Handle returned from gdattach ',gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdsetfill(gdid3, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Testing he5_gdsetfill'
+         write(10,*)'status = he5_gdsetfill(gdid3, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(10,*)'Returned from gdsetfill ', status
+         write(*,*)'Testing he5_gdsetfill'
+         write(*,*)'status = he5_gdsetfill(gdid3, "Drift", 
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(*,*)'Returned from gdsetfill ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid3,"Drift","YDim,XDim"," ",
+     1HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Define: "Drift"'      
+        write(10,*)'status= he5_gddeffld(gdid3,"Drift","YDim,XDim",
+     1"",HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)'
+        write(10,*)'Value returned from gddeffld ', status
+        write(*,*)'Define: "Drift"'      
+        write(*,*)'status= he5_gddeffld(gdid3,"Drift","YDim,XDim",
+     1"",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+        write(*,*)'Value returned from gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gddeffld(gdid3,'Impedance','YDim,XDim'," ",
+     1HE5T_NATIVE_FLOAT, HE5_HDFE_AUTOMERGE)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'Define: "Impedance"'            
+         write(10,*)'status= he5_gddeffld(gdid3,"Impedance",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+         write(10,*)'Value returned from gddeffld ', status
+         write(*,*)'Define: "Impedance"'            
+         write(*,*)'status= he5_gddeffld(gdid3,"Impedance",
+     1"YDim,XDim","",HE5T_NATIVE_FLOAT,HE5_HDFE_AUTOMERGE)'
+         write(*,*)'Value returned from gddeffld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      status = he5_gddetach(gdid3)
+      if(status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid3)'
+         write(*,*)'status = he5_gddetach(gdid3)'
+         write(10,*)'Returned value from gddetach ', status
+         write(*,*)'Returned value from gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid3 = he5_gdattach(gdfid3, 'UTMGrid3')
+      if(gdid3 .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid3 = he5_gdattach(gdfid3, "UTMGrid3")'
+         write(10,*)'Handle returned from gdattach ', gdid3
+         write(*,*)'gdid3 = he5_gdattach(gdfid3, "UTMGrid3")'
+         write(*,*)'Handle returned from gdattach ',gdid3
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- he5_gdwrfld
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdwrfld... '
+      write(10,*)'======================'
+      write(*,*)'Testing he5_gdwrfld... '
+      write(*,*)'======================'
+
+      start(1) = 0
+      start(2) = 0
+      stride(1) = 1
+      stride(2) = 1
+      edge(1) = 80
+      edge(2) = 60
+      
+      status = he5_gdwrfld(gdid_utm,"Voltage",start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Voltage '
+        write(10,*)'status= he5_gdwrfld(gdid_utm,"Voltage",start,
+     1stride,edge,utmray)'
+        write(10,*)'Status returned by gdwrfield ', status
+        write(*,*)'Write to field Voltage '
+        write(*,*)'status= he5_gdwrfld(gdid_utm,"Voltage",start,
+     1stride,edge,utmray)'
+        write(*,*)'Status returned by gdwrfield ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      start(1) = 10
+      start(2) = 10
+      edge(1) = 10
+      edge(2) = 10
+      status=he5_gdwrfld(gdid_utm,'Drift',start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Drift '
+        write(10,*)'status=he5_gdwrfld(gdid_utm,"Drift",start,
+     1stride,edge,utmray)'
+        write(10,*)'Status returned from gdwrfld ', status
+        write(*,*)'Write to field Drift '
+        write(*,*)'status = he5_gdwrfld(gdid_utm,"Drift",start,
+     1stride,edge,utmray)'
+        write(*,*)'Status returned from gdwrfld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start(1) = 0
+      start(2) = 0
+      edge(1) = 80
+      edge(2) = 60
+      status = he5_gdwrfld(gdid_utm, 'Impedance', start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Impedance '
+        write(10,*)'status= he5_gdwrfld(gdid_utm,"Impedance",start,
+     1stride,edge,utmray)'
+        write(10,*)'Returned from gdwrfld ', status
+        write(*,*)'Write to field Impedance '
+        write(*,*)'status= he5_gdwrfld(gdid_utm,"Impedance",start,
+     1stride,edge,utmray)'
+        write(*,*)'Returned from gdwrfld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=4800
+      status= he5_gdwrfld(gdid_utm,'Time',start1d,stride1d,
+     1edge1d,utmtmeray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Time '
+        write(10,*)'status= he5_gdwrfld(gdid_utm,"Time",start1d,
+     1stride1d,edge1d,utmtmeray)'
+        write(10,*)'Status returned by call to gdwrfld ',status
+        write(*,*)'Write to field Time '
+        write(*,*)'status= he5_gdwrfld(gdid_utm,"Time",start1d,stride1d,
+     1edge1d,utmtmeray)'
+        write(*,*)'Status returned by call to gdwrfld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=80
+      status= he5_gdwrfld(gdid_utm,'Height',start1d,stride1d,
+     1edge1d,utmhght)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Height '
+        write(10,*)'status= he5_gdwrfld(gdid_utm,"Height",start1d,
+     1stride1d,edge1d,utmhght)'
+        write(10,*)'Status returned by call to gdwrfld ',status
+        write(*,*)'Write to field Height '
+        write(*,*)'status= he5_gdwrfld(gdid_utm,"Height",start1d,
+     1stride1d,edge1d,utmhght)'
+        write(*,*)'Status returned by call to gdwrfld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=250
+      status= he5_gdwrfld(gdid_utm,'Grounding',start1d,
+     1stride1d,edge1d,ray3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Grounding '
+        write(10,*)'status= he5_gdwrfld(gdid_utm,"Grounding",start1d,
+     1stride1d,edge1d,ray3)'
+        write(10,*)'Value returned by gdwrfld ', status
+        write(*,*)'Write to field Grounding '
+        write(*,*)'status= he5_gdwrfld(gdid_utm,"Grounding",start1d,
+     1stride1d,edge1d,ray3)'
+        write(*,*)'Value returned by gdwrfld ', status
+      endif
+        write(10,*)' '
+        write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Value of status returned by gddetach ',status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Value of status returned by gddetach ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(10,*)'Grid id returned by gdattach ',gdid_utm
+         write(*,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(*,*)'Grid id returned by gdattach ',gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start(1) = 0
+      start(2) = 0
+      stride(1) = 1
+      stride(2) = 1
+      edge(1) = 80
+      edge(2) = 60
+      
+      status = he5_gdwrfld(gdid3,"Voltage",start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Voltage '
+        write(10,*)'status= he5_gdwrfld(gdid3,"Voltage",start,
+     1stride,edge,utmray)'
+        write(10,*)'Status returned by gdwrfield ', status
+        write(*,*)'Write to field Voltage '
+        write(*,*)'status= he5_gdwrfld(gdid3,"Voltage",start,
+     1stride,edge,utmray)'
+        write(*,*)'Status returned by gdwrfield ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      start(1) = 10
+      start(2) = 10
+      edge(1) = 10
+      edge(2) = 10
+      status=he5_gdwrfld(gdid3,'Drift',start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Drift '
+        write(10,*)'status=he5_gdwrfld(gdid3,"Drift",start,
+     1stride,edge,utmray)'
+        write(10,*)'Status returned from gdwrfld ', status
+        write(*,*)'Write to field Drift '
+        write(*,*)'status = he5_gdwrfld(gdid3,"Drift",start,
+     1stride,edge,utmray)'
+        write(*,*)'Status returned from gdwrfld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start(1) = 0
+      start(2) = 0
+      edge(1) = 80
+      edge(2) = 60
+      status = he5_gdwrfld(gdid3, 'Impedance', start,stride,
+     1edge,utmray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Impedance '
+        write(10,*)'status= he5_gdwrfld(gdid3,"Impedance",start,
+     1stride,edge,utmray)'
+        write(10,*)'Returned from gdwrfld ', status
+        write(*,*)'Write to field Impedance '
+        write(*,*)'status= he5_gdwrfld(gdid3,"Impedance",start,
+     1stride,edge,utmray)'
+        write(*,*)'Returned from gdwrfld ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=4800
+      status= he5_gdwrfld(gdid3,'Time',start1d,stride1d,
+     1edge1d,utmtmeray)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Time '
+        write(10,*)'status= he5_gdwrfld(gdid3,"Time",start1d,
+     1stride1d,edge1d,utmtmeray)'
+        write(10,*)'Status returned by call to gdwrfld ',status
+        write(*,*)'Write to field Time '
+        write(*,*)'status= he5_gdwrfld(gdid3,"Time",start1d,stride1d,
+     1edge1d,utmtmeray)'
+        write(*,*)'Status returned by call to gdwrfld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=80
+      status= he5_gdwrfld(gdid3,'Height',start1d,stride1d,
+     1edge1d,utmhght)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Height '
+        write(10,*)'status= he5_gdwrfld(gdid3,"Height",start1d,
+     1stride1d,edge1d,utmhght)'
+        write(10,*)'Status returned by call to gdwrfld ',status
+        write(*,*)'Write to field Height '
+        write(*,*)'status= he5_gdwrfld(gdid3,"Height",start1d,
+     1stride1d,edge1d,utmhght)'
+        write(*,*)'Status returned by call to gdwrfld ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      start1d=0
+      stride1d=1
+      edge1d=250
+      status= he5_gdwrfld(gdid3,'Grounding',start1d,
+     1stride1d,edge1d,ray3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'Write to field Grounding '
+        write(10,*)'status= he5_gdwrfld(gdid3,"Grounding",start1d,
+     1stride1d,edge1d,ray3)'
+        write(10,*)'Value returned by gdwrfld ', status
+        write(*,*)'Write to field Grounding '
+        write(*,*)'status= he5_gdwrfld(gdid3,"Grounding",start1d,
+     1stride1d,edge1d,ray3)'
+        write(*,*)'Value returned by gdwrfld ', status
+      endif
+        write(10,*)' '
+        write(*,*)' '
+
+      status = he5_gddetach(gdid3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid3)'
+         write(10,*)'Value of status returned by gddetach ',status
+         write(*,*)'status = he5_gddetach(gdid3)'
+         write(*,*)'Value of status returned by gddetach ',status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid3 = he5_gdattach(gdfid3, 'UTMGrid3')
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'gdid3 = he5_gdattach(gdfid3, "UTMGrid3")'
+         write(10,*)'Grid id returned by gdattach ',gdid3
+         write(*,*)'gdid3 = he5_gdattach(gdfid3, "UTMGrid3")'
+         write(*,*)'Grid id returned by gdattach ',gdid3
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- he5_gdwrattr
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdwrattr... Global attribute '
+      write(10,*)'==================================== '
+      write(*,*)'Testing he5_gdwrattr... Global attribute '
+      write(*,*)'==================================== '
+
+      setcount(1) = 4
+      status = he5_gdwrattr(gdid_utm, 'Resistance', HE5T_NATIVE_INT, 
+     1setcount, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status= he5_gdwrattr(gdid_utm,"Resistance",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from gdwrattr ', status
+         write(*,*)'status= he5_gdwrattr(gdid_utm,"Resistance",
+     1HE5T_NATIVE_FLOAT, 4, attr)'
+         write(*,*)'Returned from gdwrattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      setcount(1) = 4
+      status = he5_gdwrattr(gdid3, 'Resistance', HE5T_NATIVE_INT, 
+     1setcount, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status= he5_gdwrattr(gdid3,"Resistance",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from gdwrattr ', status
+         write(*,*)'status= he5_gdwrattr(gdid3,"Resistance",
+     1HE5T_NATIVE_FLOAT, 4, attr)'
+         write(*,*)'Returned from gdwrattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdwrgattr
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdwrgattr... Group attribute '
+      write(10,*)'==================================== '
+      write(*,*)'Testing he5_gdwrgattr... Group attribute '
+      write(*,*)'==================================== '
+
+      attr(1) = 22
+      attr(2) = 44
+      attr(3) = 66
+      attr(4) = 88
+      status = he5_gdwrgattr(gdid_utm, 'group', HE5T_NATIVE_INT, 
+     1setcount, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status= he5_gdwrgattr(gdid_utm,"group",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from gdwrgattr ', status
+         write(*,*)'status= he5_gdwrgattr(gdid_utm,"group",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(*,*)'Returned from gdwrgattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdwrgattr(gdid3, 'group', HE5T_NATIVE_INT, 
+     1setcount, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status= he5_gdwrgattr(gdid3,"group",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from gdwrgattr ', status
+         write(*,*)'status= he5_gdwrgattr(gdid3,"group",
+     1HE5T_NATIVE_INT, 4, attr)'
+         write(*,*)'Returned from gdwrgattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdwrlattr
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdwrlattr... Local attribute '
+      write(10,*)'======================================== '
+      write(*,*)'Testing he5_gdwrlattr... Local attribute '
+      write(*,*)'======================================== '
+
+      attr(1) = 12
+      attr(2) = 34
+      attr(3) = 56
+      attr(4) = 78
+      status = he5_gdwrlattr(gdid_utm,"Grounding", "local", 
+     1HE5T_NATIVE_INT,setcount, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status= he5_gdwrlattr(gdid_utm,"Grounding",
+     1"local",HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from gdwrlattr ', status
+         write(*,*)'status= he5_gdwrlattr(gdid_utm,"Grounding",
+     1"local",HE5T_NATIVE_INT, 4, attr)'
+         write(*,*)'Returned from gdwrlattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Returned from gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Returned from gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdwrlattr(gdid3,"Grounding", "local", 
+     1HE5T_NATIVE_INT,setcount, attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status= he5_gdwrlattr(gdid3,"Grounding",
+     1"local",HE5T_NATIVE_INT, 4, attr)'
+         write(10,*)'Returned from gdwrlattr ', status
+         write(*,*)'status= he5_gdwrlattr(gdid3,"Grounding",
+     1"local",HE5T_NATIVE_INT, 4, attr)'
+         write(*,*)'Returned from gdwrlattr ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid3)'
+         write(10,*)'Returned from gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid3)'
+         write(*,*)'Returned from gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      status = he5_gddetach(gdid2)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gddetach(gdid2)'
+         write(10,*)'Value returned by gddetach ', status
+         write(*,*)'status = he5_gddetach(gdid2)'
+         write(*,*)'Value returned by gddetach ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdclose
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdclose... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdclose... '
+      write(*,*)'=========================='
+
+      status = he5_gdclose(gdfid2)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdclose(gdfid2)'
+         write(10,*)'Value returned by gdclose ', status
+         write(*,*)'status = he5_gdclose(gdfid2)'
+         write(*,*)'Value returned by gdclose ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdclose(gdfid3)
+      if (status .lt. zero) then
+         write(*,231)
+         write(10,231)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdclose(gdfid3)'
+         write(10,*)'Value returned by gdclose ', status
+         write(*,*)'status = he5_gdclose(gdfid3)'
+         write(*,*)'Value returned by gdclose ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdclose(gdfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(10,*)'status = he5_gdclose(gdfid)'
+         write(10,*)'Returned from gdclose ', status
+         write(*,*)'status = he5_gdclose(gdfid)'
+         write(*,*)'Returned from gdclose ', status
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      
+      gdfid = he5_gdopen('grid.he5',HE5F_ACC_RDWR)
+      if (gdfid .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)'
+         write(10,*)'gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Grid file id returned by gdopen ',gdfid
+         write(10,*)'Grid file id returned by gdopen ',gdfid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdid_utm = he5_gdattach(gdfid, 'UTMGrid')
+      if (gdid_utm .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(10,*)'gdid_utm = he5_gdattach(gdfid, "UTMGrid")'
+         write(*,*)'Grid id returned by gdattach ',gdid_utm
+         write(10,*)'Grid id returned by gdattach ',gdid_utm
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      gdfid3 = he5_gdopen('grid3.he5',HE5F_ACC_RDWR)
+      if (gdfid3 .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'gdfid3 = he5_gdopen("grid3.he5",HE5F_ACC_RDWR)'
+         write(10,*)'gdfid3 = he5_gdopen("grid3.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Grid file id returned by gdopen ',gdfid3
+         write(10,*)'Grid file id returned by gdopen ',gdfid3
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+      gdid3 = he5_gdattach(gdfid3, 'UTMGrid3')
+      if (gdid3 .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'gdid3 = he5_gdattach(gdfid3, "UTMGrid3")'
+         write(10,*)'gdid3 = he5_gdattach(gdfid3, "UTMGrid3")'
+         write(*,*)'Grid id returned by gdattach ',gdid3
+         write(10,*)'Grid id returned by gdattach ',gdid3
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdinqgrid
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinqgrid... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdinqgrid... '
+      write(*,*)'=========================='
+
+      lstatus = he5_gdinqgrid('grid.he5',grdnames,strbufsize)
+      if (lstatus .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus = he5_gdinqgrid("grid.he5",grdnames,
+     1strbufsize)'
+         write(*,*)'Names of grids ',grdnames
+         write(*,*)'Number of grids ',lstatus
+         write(*,*)'Size of names of grids ',strbufsize
+         write(10,*)'lstatus = he5_gdinqgrid("grid.he5",grdnames,
+     1strbufsize)'
+         write(10,*)'Names of grids ',grdnames
+         write(10,*)'Number of grids ',lstatus
+         write(10,*)'Size of names of grids ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      lstatus = he5_gdinqgrid('grid3.he5',grdnames,strbufsize)
+      if (lstatus .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus = he5_gdinqgrid("grid3.he5",grdnames,
+     1strbufsize)'
+         write(*,*)'Names of grids ',grdnames
+         write(*,*)'Number of grids ',lstatus
+         write(*,*)'Size of names of grids ',strbufsize
+         write(10,*)'lstatus = he5_gdinqgrid("grid3.he5",grdnames,
+     1strbufsize)'
+         write(10,*)'Names of grids ',grdnames
+         write(10,*)'Number of grids ',lstatus
+         write(10,*)'Size of names of grids ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdorginfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdorginfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdorginfo... '
+      write(*,*)'=========================='
+
+      status = he5_gdorginfo(gdid_utm, orgcode)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus = he5_gdorginfo(gdid_utm, orgcode)'
+         write(10,*)'lstatus = he5_gdorginfo(gdid_utm, orgcode)'
+         write(*,*)'Value returned by gdorginfo ',status
+         write(10,*)'Value returned by gdorginfo ',status
+         write(*,*)'Origin code value ',orgcode
+         write(10,*)'Origin code value ',orgcode
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdorginfo(gdid3, orgcode)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus = he5_gdorginfo(gdid3, orgcode)'
+         write(10,*)'lstatus = he5_gdorginfo(gdid3, orgcode)'
+         write(*,*)'Value returned by gdorginfo ',status
+         write(10,*)'Value returned by gdorginfo ',status
+         write(*,*)'Origin code value ',orgcode
+         write(10,*)'Origin code value ',orgcode
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdpreginfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdpreginfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdpreginfo... '
+      write(*,*)'=========================='
+
+      status = he5_gdpreginfo(gdid_utm, pixregcode)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdpreginfo(gdid_utm, pixregcode)'
+         write(10,*)'status = he5_gdpreginfo(gdid_utm, pixregcode)'
+         write(*,*)'Value returned by gdpreginfo ',status
+         write(10,*)'Value returned by gdpreginfo ',status
+         write(*,*)'Pixel reg code ',pixregcode
+         write(10,*)'Pixel reg code ',pixregcode
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdpreginfo(gdid3, pixregcode)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdpreginfo(gdid3, pixregcode)'
+         write(10,*)'status = he5_gdpreginfo(gdid3, pixregcode)'
+         write(*,*)'Value returned by gdpreginfo ',status
+         write(10,*)'Value returned by gdpreginfo ',status
+         write(*,*)'Pixel reg code ',pixregcode
+         write(10,*)'Pixel reg code ',pixregcode
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdinqdims
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinqdims... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdinqdims... '
+      write(*,*)'=========================='
+
+      status = he5_gdinqdims(gdid_utm, dimname, dims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdinqdims(gdid_utm, dimname, dims)'
+         write(*,*)'Number of dimensions ',status
+         write(*,*)'Dimensions in grid UTM ',dimname
+         write(*,*)'Size of dimensions '
+         write(10,*)'status = he5_gdinqdims(gdid_utm, dimname, dims)'
+         write(10,*)'Number of dimensions ',status
+         write(10,*)'Dimensions in grid UTM ',dimname
+         write(10,*)'Size of dimensions '
+         do 130 i=1,status
+            write(*,*)' ',dims(i)
+            write(10,*)' ',dims(i)
+ 130     continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdinqdims(gdid3, dimname, dims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdinqdims(gdid3, dimname, dims)'
+         write(*,*)'Number of dimensions ',status
+         write(*,*)'Dimensions in grid UTM ',dimname
+         write(*,*)'Size of dimensions '
+         write(10,*)'status = he5_gdinqdims(gdid3, dimname, dims)'
+         write(10,*)'Number of dimensions ',status
+         write(10,*)'Dimensions in grid UTM ',dimname
+         write(10,*)'Size of dimensions '
+         do 131 i=1,status
+            write(*,*)' ',dims(i)
+            write(10,*)' ',dims(i)
+ 131     continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddiminfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddiminfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddiminfo... '
+      write(*,*)'=========================='
+
+      lstatus = he5_gddiminfo(gdid_utm, 'Conduction')
+      if (lstatus .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus=he5_gddiminfo(gdid_utm,"Conduction")'
+         write(*,*)'Size of dimension Conduction ',lstatus
+         write(10,*)'lstatus=he5_gddiminfo(gdid_utm,"Conduction")'
+         write(10,*)'Size of dimension Conduction ',lstatus
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      lstatus = he5_gddiminfo(gdid3, 'Conduction')
+      if (lstatus .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'lstatus=he5_gddiminfo(gdid3,"Conduction")'
+         write(*,*)'Size of dimension Conduction ',lstatus
+         write(10,*)'lstatus=he5_gddiminfo(gdid3,"Conduction")'
+         write(10,*)'Size of dimension Conduction ',lstatus
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdgridinfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdgridinfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdgridinfo... '
+      write(*,*)'=========================='
+
+      status= he5_gdgridinfo(gdid_utm,xdimsize,ydimsize,
+     1upleftpt,lowrtpt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status= he5_gdgridinfo(gdid_utm,xdimsize,
+     1ydimsize,upleftpt,lowrtpt)'
+         write(*,*)'Status returned by gdgridinfo ',status
+         write(*,11)'X dim size ',xdimsize, ' Y dim size ',ydimsize
+         write(*,12)'Upper left pt ',upleftpt(1),' ',upleftpt(2)
+         write(*,12)'Lower right pt ',lowrtpt(1),' ',lowrtpt(2)
+         write(10,*)'status= he5_gdgridinfo(gdid_utm,xdimsize,
+     1ydimsize,upleftpt,lowrtpt)'
+         write(10,*)'Value returned by gdgridinfo ',status
+         write(10,*)'X dim size ',xdimsize, ' Y dim size ',ydimsize
+         write(10,*)'Upper left pt ',upleftpt(1),upleftpt(2)
+         write(10,*)'Lower right pt ',lowrtpt(1),lowrtpt(2)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+   11 format(a,i2,a,i2)
+   12 format(a,f14.5,a,f14.5)
+
+      status= he5_gdgridinfo(gdid3,xdimsize,ydimsize,
+     1upleftpt,lowrtpt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status= he5_gdgridinfo(gdid3,xdimsize,
+     1ydimsize,upleftpt,lowrtpt)'
+         write(*,*)'Status returned by gdgridinfo ',status
+         write(*,11)'X dim size ',xdimsize, ' Y dim size ',ydimsize
+         write(*,12)'Upper left pt ',upleftpt(1),' ',upleftpt(2)
+         write(*,12)'Lower right pt ',lowrtpt(1),' ',lowrtpt(2)
+         write(10,*)'status= he5_gdgridinfo(gdid3,xdimsize,
+     1ydimsize,upleftpt,lowrtpt)'
+         write(10,*)'Value returned by gdgridinfo ',status
+         write(10,*)'X dim size ',xdimsize, ' Y dim size ',ydimsize
+         write(10,*)'Upper left pt ',upleftpt(1),upleftpt(2)
+         write(10,*)'Lower right pt ',lowrtpt(1),lowrtpt(2)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdprojinfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdprojinfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdprojinfo... '
+      write(*,*)'=========================='
+
+      status = he5_gdprojinfo(gdid_utm,pcode,zcode,scode,pparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdprojinfo(gdid_utm,pcode,
+     1zcode,scode,pparm)'
+         write(*,*)'Status returned by gdprojinfo ',status
+         write(*,*)'Projection code ',pcode, ' Zone code ',zcode
+         write(*,*)'Sphere code ',scode
+         write(10,*)'status = he5_gdprojinfo(gdid_utm,pcode,
+     1zcode,scode,pparm)'
+         write(10,*)'Value returned by gdprojinfo ',status
+         write(10,*)'Projection code ',pcode, ' Zone code ',zcode
+         write(10,*)'Sphere code ',scode
+         do 140 i=1,16
+            write(*,55)' ',pparm(i)
+            write(10,55)' ',pparm(i)
+ 140     continue
+      endif
+   55 format(a,f5.2)
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdprojinfo(gdid3,pcode,zcode,scode,pparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(10,230)
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdprojinfo(gdid3,pcode,
+     1zcode,scode,pparm)'
+         write(*,*)'Status returned by gdprojinfo ',status
+         write(*,*)'Projection code ',pcode, ' Zone code ',zcode
+         write(*,*)'Sphere code ',scode
+         write(10,*)'status = he5_gdprojinfo(gdid3,pcode,
+     1zcode,scode,pparm)'
+         write(10,*)'Value returned by gdprojinfo ',status
+         write(10,*)'Projection code ',pcode, ' Zone code ',zcode
+         write(10,*)'Sphere code ',scode
+         do 141 i=1,16
+            write(*,55)' ',pparm(i)
+            write(10,55)' ',pparm(i)
+ 141     continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdcompinfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdcompinfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdcompinfo... '
+      write(*,*)'=========================='
+
+      status = he5_gdcompinfo(gdid_utm,'Voltage',
+     1compcodestring,compparm)
+      if (status .lt. zero) then
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status = he5_gdcompinfo(gdid_utm,"Voltage",
+     1compcode,compparm)'
+        write(10,*)'Compression info for field Voltage'
+        write(10,*)'Comp code ',compcodestring
+        write(10,*)'Compression parameters ',compparm
+        write(*,*)'status = he5_gdcompinfo(gdid_utm,"Voltage",
+     1compcode,compparm)'
+        write(*,*)'Compression info for field Voltage'
+        write(*,*)'Comp code ',compcodestring
+        write(*,*)'Compression parameters ',compparm
+      endif
+
+      status = he5_gdcompinfo(gdid3,'Voltage',
+     1compcodestring,compparm)
+      if (status .lt. zero) then
+         
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status = he5_gdcompinfo(gdid3,"Voltage",
+     1compcode,compparm)'
+        write(10,*)'Compression info for field Voltage'
+        write(10,*)'Comp code ',compcodestring
+        write(10,*)'Compression parameters ',compparm
+        write(*,*)'status = he5_gdcompinfo(gdid3,"Voltage",
+     1compcode,compparm)'
+        write(*,*)'Compression info for field Voltage'
+        write(*,*)'Comp code ',compcodestring
+        write(*,*)'Compression parameters ',compparm
+      endif
+
+c Test Case -- he5_gdinqflds
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinqflds... '
+      write(10,*)'========================'
+      write(*,*)'Testing he5_gdinqflds... '
+      write(*,*)'========================'
+
+      nflds = he5_gdinqflds(gdid_utm,fldlist,rnk,numtype)
+      if (nflds .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'nflds = he5_gdinqflds(gdid_utm,
+     1fldlist,rnk,numtype)'
+         write(*,*)'Number of fields ',nflds
+         write(10,*)'nflds = he5_gdinqflds(gdid_utm,
+     1fldlist,rnk,numtype)'
+         write(10,*)'Number of fields ',nflds
+         if (nflds .ne. 0) then
+            write(*,*)'Fields ',fldlist
+            write(10,*)'Fields ',fldlist
+            do 150 i=1,nflds
+               write(*,*)'Rank and type ',rnk(i), ' ',numtype(i)
+               write(10,*)'Rank and type ',rnk(i), ' ',numtype(i)
+  150       continue
+         endif
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      nflds = he5_gdinqflds(gdid3,fldlist,rnk,numtype)
+      if (nflds .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'nflds = he5_gdinqflds(gdid3,
+     1fldlist,rnk,numtype)'
+         write(*,*)'Number of fields ',nflds
+         write(10,*)'nflds = he5_gdinqflds(gdid3,
+     1fldlist,rnk,numtype)'
+         write(10,*)'Number of fields ',nflds
+         if (nflds .ne. 0) then
+            write(*,*)'Fields ',fldlist
+            write(10,*)'Fields ',fldlist
+            do 151 i=1,nflds
+               write(*,*)'Rank and type ',rnk(i), ' ',numtype(i)
+               write(10,*)'Rank and type ',rnk(i), ' ',numtype(i)
+  151       continue
+         endif
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdfldinfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdfldinfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdfldinfo... '
+      write(*,*)'=========================='
+
+      status = he5_gdfldinfo(gdid_utm, 'Drift', rnk, dims, 
+     1numtype, dimname, maxdimname)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdfldinfo(gdid_utm, "Drift", 
+     1rnk, dims, numtype, dimname, maxdimname)'
+         write(*,*)'Value returned by gdfldinfo for field Drift ',
+     1status
+         write(*,*)'Drift rank ',rnk(1)
+         write(*,*)'Dimensions  ',dims(1),' ',dims(2)
+         write(*,*)'Number type of field ',numtype(1)
+         write(*,*)'Dimension names ',dimname
+         write(10,*)'status = he5_gdfldinfo(gdid_utm, "Drift",
+     1rnk, dims, numtype, dimname, maxdimname)'
+         write(10,*)'Value returned by gdfldinfo for field Drift ',
+     1status
+         write(10,*)'Drift rank ',rnk(1)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdfldinfo(gdid3, 'Drift', rnk, dims, 
+     1numtype, dimname, maxdimname)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdfldinfo(gdid3, "Drift", 
+     1rnk, dims, numtype, dimname, maxdimname)'
+         write(*,*)'Value returned by gdfldinfo for field Drift ',
+     1status
+         write(*,*)'Drift rank ',rnk(1)
+         write(*,*)'Dimensions  ',dims(1),' ',dims(2)
+         write(*,*)'Number type of field ',numtype(1)
+         write(*,*)'Dimension names ',dimname
+         write(10,*)'status = he5_gdfldinfo(gdid3, "Drift",
+     1rnk, dims, numtype, dimname, maxdimname)'
+         write(10,*)'Value returned by gdfldinfo for field Drift ',
+     1status
+         write(10,*)'Drift rank ',rnk(1)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdrdfld
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdrdfld... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdrdfld... '
+      write(*,*)'=========================='
+
+      start(1) = 0
+      start(2) = 0
+      stride(1) = 1
+      stride(2) = 1
+      edge(1) = 80
+      edge(2) = 60
+      status = he5_gdrdfld(gdid_utm,'Drift',start,stride,edge,tempray)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdrdfld(gdid_utm,"Drift",
+     1start,stride,edge,tempray)'
+         write(*,*)'Value returned by gdrdfld ',status
+         write(10,*)'status = he5_gdrdfld(gdid_utm,"Drift",
+     1start,stride,edge,tempray)'
+         write(10,*)'Value returned by gdrdfld ',status
+         do 65 ii=1,6
+           do 66 i=1,5
+              write(10,*)'Field value at ',ii,' ',i,'  ',
+     1tempray(ii,i)
+              write(*,*)'Field value at ',ii,' ',i,'  ',
+     1tempray(ii,i)
+   66      continue
+   65   continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdrdfld(gdid3,'Drift',start,stride,edge,tempray)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdrdfld(gdid3,"Drift",
+     1start,stride,edge,tempray)'
+         write(*,*)'Value returned by gdrdfld ',status
+         write(10,*)'status = he5_gdrdfld(gdid3,"Drift",
+     1start,stride,edge,tempray)'
+         write(10,*)'Value returned by gdrdfld ',status
+         do 75 ii=1,6
+           do 76 i=1,5
+              write(10,*)'Field value at ',ii,' ',i,'  ',
+     1tempray(ii,i)
+              write(*,*)'Field value at ',ii,' ',i,'  ',
+     1tempray(ii,i)
+   76      continue
+   75   continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- he5_gdnentries
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdnentries... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdnentries... '
+      write(*,*)'=========================='
+
+      n=he5_gdnentries(gdid_utm,HE5_HDFE_NENTDIM,strbufsize)
+      if (n .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'n = he5_gdnentries(gdid_utm, 
+     1HE5_HDFE_NENTDIM, strbufsize)'
+         write(*,*)'Number of dimensions ', n
+         write(*,*)'Size of Dimension string ',strbufsize
+         write(10,*)'n = he5_gdnentries(gdid_utm, 
+     1HE5_HDFE_NENTDIM, strbufsize)'
+         write(10,*)'Number of dimensions ', n
+         write(10,*)'Size of Dimension string ',strbufsize
+      endif
+
+      n = he5_gdnentries(gdid_utm,HE5_HDFE_NENTDFLD,strbufsize)
+      if (n .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'n = he5_gdnentries(gdid_utm,
+     1HE5_HDFE_NENTDFLD,strbufsize)'
+         write(*,*)'Number of data fields ',n
+         write(*,*)'Size of Field string ',strbufsize
+         write(10,*)'n = he5_gdnentries(gdid_utm,
+     1HDFE_NENTDFLD,strbufsize)'
+         write(10,*)'Number of data fields ',n
+         write(10,*)'Size of Field string ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      n=he5_gdnentries(gdid3,HE5_HDFE_NENTDIM,strbufsize)
+      if (n .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'n = he5_gdnentries(gdid3, 
+     1HE5_HDFE_NENTDIM, strbufsize)'
+         write(*,*)'Number of dimensions ', n
+         write(*,*)'Size of Dimension string ',strbufsize
+         write(10,*)'n = he5_gdnentries(gdid3, 
+     1HE5_HDFE_NENTDIM, strbufsize)'
+         write(10,*)'Number of dimensions ', n
+         write(10,*)'Size of Dimension string ',strbufsize
+      endif
+
+      n = he5_gdnentries(gdid3,HE5_HDFE_NENTDFLD,strbufsize)
+      if (n .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'n = he5_gdnentries(gdid3,
+     1HE5_HDFE_NENTDFLD,strbufsize)'
+         write(*,*)'Number of data fields ',n
+         write(*,*)'Size of Field string ',strbufsize
+         write(10,*)'n = he5_gdnentries(gdid3,
+     1HDFE_NENTDFLD,strbufsize)'
+         write(10,*)'Number of data fields ',n
+         write(10,*)'Size of Field string ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdattrinfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdattrinfo, Global attribute'
+      write(10,*)'============================================'
+      write(*,*)'Testing he5_gdattrinfo, Global attribute'
+      write(*,*)'============================================'
+
+      status = he5_gdattrinfo(gdid_utm,'Resistance',ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdattrinfo(gdid_utm,"Resistance",
+     1ntype,count)'
+         write(*,*)'Value returned by gdattrinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdattrinfo(gdid_utm,"Resistance",
+     1ntype,count)'
+         write(10,*)'Value returned by gdattrinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdattrinfo(gdid3,'Resistance',ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdattrinfo(gdid3,"Resistance",
+     1ntype,count)'
+         write(*,*)'Value returned by gdattrinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdattrinfo(gdid3,"Resistance",
+     1ntype,count)'
+         write(10,*)'Value returned by gdattrinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- he5_gdgatinfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdgatinfo, Group attribute'
+      write(10,*)'============================================'
+      write(*,*)'Testing he5_gdgatinfo, Group attribute'
+      write(*,*)'============================================'
+
+      status = he5_gdgatinfo(gdid_utm,'group',ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdgatinfo(gdid_utm,"group",
+     1ntype,count)'
+         write(*,*)'Value returned by gdgatinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdgatinfo(gdid_utm,"group",
+     1ntype,count)'
+         write(10,*)'Value returned by gdgatinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdgatinfo(gdid3,'group',ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdgatinfo(gdid3,"group",
+     1ntype,count)'
+         write(*,*)'Value returned by gdgatinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdgatinfo(gdid3,"group",
+     1ntype,count)'
+         write(10,*)'Value returned by gdgatinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdlatinfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdlatinfo, Local attribute'
+      write(10,*)'======================================'
+      write(*,*)'Testing he5_gdlatinfo, Local attribute'
+      write(*,*)'======================================'
+
+      status = he5_gdlatinfo(gdid_utm,"Grounding","local",
+     1ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdlatinfo(gdid_utm,"Grounding",
+     1"local",ntype,count)'
+         write(*,*)'Value returned by gdlatinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdlatinfo(gdid_utm,"Grounding",
+     1"local",ntype,count)'
+         write(10,*)'Value returned by gdgatinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdlatinfo(gdid3,"Grounding","local",
+     1ntype,count)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdlatinfo(gdid3,"Grounding",
+     1"local",ntype,count)'
+         write(*,*)'Value returned by gdlatinfo ',status
+         write(*,*)'Number type of attribute ',ntype
+         write(*,*)'Number of total bytes in attribute ',count
+         write(10,*)'status = he5_gdlatinfo(gdid3,"Grounding",
+     1"local",ntype,count)'
+         write(10,*)'Value returned by gdgatinfo ',status
+         write(10,*)'Number type of attribute ',ntype
+         write(10,*)'Number of total bytes in attribute ',count
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdrdattr
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdrdattr, Global attribute'
+      write(10,*)'======================================'
+      write(*,*)'Testing he5_gdrdattr, Global attribute'
+      write(*,*)'======================================'
+
+      status = he5_gdrdattr(gdid_utm,'Resistance',iattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdattr(gdid_utm,"Resistance",
+     1iattr)'
+        write(*,*)'Value returned by gdrdattr ',status
+        write(10,*)'status = he5_gdrdattr(gdid_utm,"Resistance",
+     1iattr)'
+        write(10,*)'Value returned by gdrdattr ',status
+        do 67 i=1,count
+           write(10,*)'Attribute value  ',iattr(i)
+           write(*,*)'Attribute value   ',iattr(i)
+   67   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdrdattr(gdid3,'Resistance',iattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdattr(gdid3,"Resistance",
+     1iattr)'
+        write(*,*)'Value returned by gdrdattr ',status
+        write(10,*)'status = he5_gdrdattr(gdid3,"Resistance",
+     1iattr)'
+        write(10,*)'Value returned by gdrdattr ',status
+        do 77 i=1,count
+           write(10,*)'Attribute value  ',iattr(i)
+           write(*,*)'Attribute value   ',iattr(i)
+   77   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+  
+c Test Case -- he5_gdrdgattr
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdrdgattr, Group attribute '
+      write(10,*)'======================================'
+      write(*,*)'Testing he5_gdrdgattr, Group attribute'
+      write(*,*)'======================================'
+
+      status = he5_gdrdgattr(gdid_utm,'group',gattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdgattr(gdid_utm,"group",
+     1gattr)'
+        write(*,*)'Value returned by gdrdgattr ',status
+        write(10,*)'status = he5_gdrdgattr(gdid_utm,"group",
+     1gattr)'
+        write(10,*)'Value returned by gdrdgattr ',status
+        do 68 i=1,count
+           write(10,*)'Attribute value  ',gattr(i)
+           write(*,*)'Attribute value   ',gattr(i)
+   68   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdrdgattr(gdid3,'group',gattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdgattr(gdid3,"group",
+     1gattr)'
+        write(*,*)'Value returned by gdrdgattr ',status
+        write(10,*)'status = he5_gdrdgattr(gdid3,"group",
+     1gattr)'
+        write(10,*)'Value returned by gdrdgattr ',status
+        do 78 i=1,count
+           write(10,*)'Attribute value  ',gattr(i)
+           write(*,*)'Attribute value   ',gattr(i)
+   78   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+  
+c Test Case -- he5_gdinqdatatype
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinqdatatype '
+      write(10,*)'============================='
+      write(*,*)'Testing he5_gdinqdatatype'
+      write(*,*)'============================='
+
+      status = he5_gdinqdatatype(gdid_utm,"Grounding","local",
+     1HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+         write(*,*)'status = he5_gdinqdatatype(gdid_utm,"Grounding",
+     1"local",HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)'
+         write(*,*)'Data type of attribute ',dtype
+         write(*,*)'Class id of attribute ',classid
+         write(*,*)'Order of attribute ',order
+         write(*,*)'Size of attribute ',size
+         write(10,*)'status = he5_gdinqdatatype(gdid_utm,"Grounding",
+     1"local", HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)'
+         write(10,*)'Data type of attribute ',dtype
+         write(10,*)'Class id of attribute ',classid
+         write(10,*)'Order of attribute ',order
+         write(10,*)'Size of attribute ',size
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdinqdatatype(gdid3,"Grounding","local",
+     1HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+        write(*,*)' '
+        write(*,240)
+        write(10,*)' '
+        write(10,240)
+         write(*,*)'status = he5_gdinqdatatype(gdid3,"Grounding",
+     1"local",HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)'
+         write(*,*)'Data type of attribute ',dtype
+         write(*,*)'Class id of attribute ',classid
+         write(*,*)'Order of attribute ',order
+         write(*,*)'Size of attribute ',size
+         write(10,*)'status = he5_gdinqdatatype(gdid3,"Grounding",
+     1"local", HE5_HDFE_LOCATTRGROUP,dtype,classid,order,size)'
+         write(10,*)'Data type of attribute ',dtype
+         write(10,*)'Class id of attribute ',classid
+         write(10,*)'Order of attribute ',order
+         write(10,*)'Size of attribute ',size
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdrdlattr
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdrdlattr, Local attribute '
+      write(10,*)'======================================'
+      write(*,*)'Testing he5_gdrdlattr, Local attribute'
+      write(*,*)'======================================'
+
+      status = he5_gdrdlattr(gdid_utm,'Grounding',
+     1'local',lattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdlattr(gdid_utm,"Grounding",
+     1"local",lattr)'
+        write(*,*)'Value returned by gdrdlattr ',status
+        write(10,*)'status = he5_gdrdlattr(gdid_utm,"Grounding",
+     1"local",lattr)'
+        write(10,*)'Value returned by gdrdlattr ',status
+        do 69 i=1,count
+           write(10,*)'Attribute value  ',lattr(i)
+           write(*,*)'Attribute value   ',lattr(i)
+   69   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+  
+      status = he5_gdrdlattr(gdid3,'Grounding',
+     1'local',lattr)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'status = he5_gdrdlattr(gdid3,"Grounding",
+     1"local",lattr)'
+        write(*,*)'Value returned by gdrdlattr ',status
+        write(10,*)'status = he5_gdrdlattr(gdid3,"Grounding",
+     1"local",lattr)'
+        write(10,*)'Value returned by gdrdlattr ',status
+        do 79 i=1,count
+           write(10,*)'Attribute value  ',lattr(i)
+           write(*,*)'Attribute value   ',lattr(i)
+   79   continue
+        
+      endif
+      write(10,*)' '
+      write(*,*)' '
+  
+c Test Case -- he5_gdinqattrs
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinqattrs, Global attribute'
+      write(10,*)'========================================'
+      write(*,*)'Testing he5_gdinqattrs, Global attribute'
+      write(*,*)'========================================'
+
+      lstatus = he5_gdinqattrs(gdid_utm, attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqattrs(gdid_utm, 
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by gdinqattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqattrs(gdid_utm, 
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by gdinqattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      lstatus = he5_gdinqattrs(gdid3, attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqattrs(gdid3, 
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by gdinqattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqattrs(gdid3, 
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by gdinqattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdinqgattrs
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinqgattrs, Group attribute'
+      write(10,*)'============================================'
+      write(*,*)'Testing he5_gdinqgattrs, Group attribute'
+      write(*,*)'============================================'
+
+      lstatus = he5_gdinqgattrs(gdid_utm,attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqgattrs(gdid_utm, 
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by gdinqgattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqgattrs(gdid_utm,
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by gdinqgattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      lstatus = he5_gdinqgattrs(gdid3,attrlist,strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqgattrs(gdid3, 
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by gdinqgattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqgattrs(gdid3,
+     1attrlist,strbufsize)'
+        write(10,*)'Value returned by gdinqgattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- he5_gdinqlattrs
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinqlattrs, Local attribute'
+      write(10,*)'========================================'
+      write(*,*)'Testing he5_gdinqlattrs, Local attribute'
+      write(*,*)'========================================'
+
+      lstatus = he5_gdinqlattrs(gdid_utm,"Grounding",attrlist,
+     1strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqlattrs(gdid_utm,"Grounding",
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by gdinqlattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqlattrs(gdid_utm,"Grounding",
+     1attrlist, strbufsize)'
+        write(10,*)'Value returned by gdinqlattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      lstatus = he5_gdinqlattrs(gdid3,"Grounding",attrlist,
+     1strbufsize)
+      if (lstatus .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(*,*)'lstatus = he5_gdinqlattrs(gdid3,"Grounding",
+     1attrlist,strbufsize)'
+        write(*,*)'Value returned by gdinqlattrs ',lstatus
+        write(*,*)'List of attributes ',attrlist
+        write(*,*)'Length of attrlist in bytes ',strbufsize
+        write(10,*)'lstatus = he5_gdinqlattrs(gdid3,"Grounding",
+     1attrlist, strbufsize)'
+        write(10,*)'Value returned by gdinqlattrs ',lstatus
+        write(10,*)'List of attributes ',attrlist
+        write(10,*)'Length of attrlist in bytes ',strbufsize
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdgetfill
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdgetfill... '
+      write(10,*)'======================='
+      write(*,*)'Testing he5_gdgetfill... '
+      write(*,*)'========================'
+
+      status = he5_gdgetfill(gdid_utm,'Drift',ifillv)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdgetfill(gdid_utm,"Drift",
+     1ifillv)'
+         write(*,*)'Value returned by gdgetfill ',status
+         write(*,*)'Fill value ',ifillv
+         write(10,*)'status = he5_gdgetfill(gdid_utm,"Drift",
+     1ifillv)'
+         write(10,*)'Value returned by gdgetfill ',status
+         write(10,*)'Fill value ',ifillv
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdgetfill(gdid3,'Drift',ifillv)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdgetfill(gdid3,"Drift",
+     1ifillv)'
+         write(*,*)'Value returned by gdgetfill ',status
+         write(*,*)'Fill value ',ifillv
+         write(10,*)'status = he5_gdgetfill(gdid3,"Drift",
+     1ifillv)'
+         write(10,*)'Value returned by gdgetfill ',status
+         write(10,*)'Fill value ',ifillv
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddefboxreg
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddefboxreg... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddefboxreg... '
+      write(*,*)'=========================='
+
+      corlon(1)=-126.0
+      corlon(2)=-121.5
+      corlat(1)=-70.0
+      corlat(2)=-65.0
+
+      regionid = he5_gddefboxreg(gdid_utm,corlon,corlat)
+      if (regionid .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'regionid = he5_gddefboxreg(gdid_utm,
+     1corlon,corlat)'
+         write(*,*)'Region id returned by gddefboxreg ',regionid
+         write(10,*)'regionid = he5_gddefboxreg(gdid_utm,
+     1corlon,corlat)'
+         write(10,*)'Region id returned by gddefboxreg ',regionid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      regionid3 = he5_gddefboxreg(gdid3,corlon,corlat)
+      if (regionid3 .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'regionid3 = he5_gddefboxreg(gdid3,
+     1corlon,corlat)'
+         write(*,*)'Region id returned by gddefboxreg ',regionid3
+         write(10,*)'regionid3 = he5_gddefboxreg(gdid3,
+     1corlon,corlat)'
+         write(10,*)'Region id returned by gddefboxreg ',regionid3
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdreginfo
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdreginfo... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdreginfo... '
+      write(*,*)'=========================='
+
+      status = he5_gdreginfo(gdid_utm,regionid,'Impedance',nt,rk,
+     1dims,size,iuplft,ilrgt)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdreginfo(gdid_utm,regionid,
+     1"Impedance",nt, rk,dims,size,iuplft,ilrgt)'
+         write(*,*)'Value returned by gdreginfo ',status
+         write(*,*)'Number type of region ',nt
+         write(*,*)'Rank of region ',rk
+         write(*,*)'Size of region ',size
+         write(*,11)'Dimensions of region ',dims(1),' ',dims(2)
+         write(*,12)'Upper left point of region ',iuplft(1),' ',
+     1iuplft(2)
+         write(*,12)'Lower right point of region ',ilrgt(1),' ',
+     1ilrgt(2)
+         write(10,*)'status = he5_gdreginfo(gdid_utm,regionid,
+     1"Impedance",nt,rk,dims,size,iuplft,ilrgt)'
+         write(10,*)'Value returned by gdreginfo ',status
+         write(10,*)'Number type of region ',nt
+         write(10,*)'Rank of region ',rk
+         write(10,*)'Size of region ',size
+         write(10,11)'Dimensions of region ',dims(1),' ',dims(2)
+         write(10,12)'Upper left point of region ',iuplft(1),' ',
+     1iuplft(2)
+         write(10,12)'Lower right point of region ',ilrgt(1),' ',
+     1ilrgt(2)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdreginfo(gdid3,regionid3,'Impedance',nt,rk,
+     1dims,size,iuplft,ilrgt)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdreginfo(gdid3,regionid3,
+     1"Impedance",nt, rk,dims,size,iuplft,ilrgt)'
+         write(*,*)'Value returned by gdreginfo ',status
+         write(*,*)'Number type of region ',nt
+         write(*,*)'Rank of region ',rk
+         write(*,*)'Size of region ',size
+         write(*,11)'Dimensions of region ',dims(1),' ',dims(2)
+         write(*,12)'Upper left point of region ',iuplft(1),' ',
+     1iuplft(2)
+         write(*,12)'Lower right point of region ',ilrgt(1),' ',
+     1ilrgt(2)
+         write(10,*)'status = he5_gdreginfo(gdid3,regionid3,
+     1"Impedance",nt,rk,dims,size,iuplft,ilrgt)'
+         write(10,*)'Value returned by gdreginfo ',status
+         write(10,*)'Number type of region ',nt
+         write(10,*)'Rank of region ',rk
+         write(10,*)'Size of region ',size
+         write(10,11)'Dimensions of region ',dims(1),' ',dims(2)
+         write(10,12)'Upper left point of region ',iuplft(1),' ',
+     1iuplft(2)
+         write(10,12)'Lower right point of region ',ilrgt(1),' ',
+     1ilrgt(2)
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdextreg
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdextreg... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdextreg... '
+      write(*,*)'=========================='
+
+      status = he5_gdextreg(gdid_utm,regionid,'Impedance',datbuf)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdextreg(gdid_utm,regionid,
+     1"Impedance",datbuf)'
+         write(*,*)'Value returned by gdextreg ',status
+         write(10,*)'status = he5_gdextreg(gdid_utm,regionid,
+     1"Impedance",datbuf)'
+         write(10,*)'Value returned by gdextreg ',status
+         do 175 i=100,150
+            write(*,*)'Value of region ',datbuf(i)
+            write(10,*)'Value of region ',datbuf(i)
+  175    continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gdextreg(gdid3,regionid3,'Impedance',datbuf)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdextreg(gdid3,regionid3,
+     1"Impedance",datbuf)'
+         write(*,*)'Value returned by gdextreg ',status
+         write(10,*)'status = he5_gdextreg(gdid3,regionid3,
+     1"Impedance",datbuf)'
+         write(10,*)'Value returned by gdextreg ',status
+         do 176 i=100,150
+            write(*,*)'Value of region ',datbuf(i)
+            write(10,*)'Value of region ',datbuf(i)
+  176    continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddeftmeper
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddeftmeper... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddeftmeper... '
+      write(*,*)'=========================='
+
+      periodid = he5_gddeftmeper(gdid_utm,HE5_HDFE_NOPREVSUB,
+     1starttime,stoptime)
+      if (periodid .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'periodid = he5_gddeftmeper(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,starttime,stoptime)'
+        write(10,*)'Define a time period '
+        write(10,*)'Period id returned by gddeftmeper ',periodid
+        write(*,*)'periodid = he5_gddeftmeper(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,starttime,stoptime)'
+        write(*,*)'Define a time period '
+        write(*,*)'Period id returned by gddeftmeper ',periodid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      periodid = he5_gddeftmeper(gdid3,HE5_HDFE_NOPREVSUB,
+     1starttime,stoptime)
+      if (periodid .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'periodid = he5_gddeftmeper(gdid3,
+     1HE5_HDFE_NOPREVSUB,starttime,stoptime)'
+        write(10,*)'Define a time period '
+        write(10,*)'Period id returned by gddeftmeper ',periodid
+        write(*,*)'periodid = he5_gddeftmeper(gdid3,
+     1HE5_HDFE_NOPREVSUB,starttime,stoptime)'
+        write(*,*)'Define a time period '
+        write(*,*)'Period id returned by gddeftmeper ',periodid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddefvrtreg
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddefvrtreg... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gddefvrtreg... '
+      write(*,*)'=========================='
+
+      regionid = he5_gddefvrtreg(gdid_utm,HE5_HDFE_NOPREVSUB,
+     1'Height',range)
+      if (regionid .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'regionid = he5_gddefvrtreg(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,"Height",range)'
+        write(10,*)'Define a vertical region '
+        write(10,*)'Region id returned by gddefvrtreg ',regionid
+        write(*,*)'regionid = he5_gddefvrtreg(gdid_utm,
+     1HE5_HDFE_NOPREVSUB,"Height",range)'
+        write(*,*)'Define a vertical region '
+        write(*,*)'Region id returned by gddefvrtreg ',regionid
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      regionid3 = he5_gddefvrtreg(gdid3,HE5_HDFE_NOPREVSUB,
+     1'Height',range)
+      if (regionid3 .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'regionid3 = he5_gddefvrtreg(gdid3,
+     1HE5_HDFE_NOPREVSUB,"Height",range)'
+        write(10,*)'Define a vertical region '
+        write(10,*)'Region id returned by gddefvrtreg ',regionid3
+        write(*,*)'regionid3 = he5_gddefvrtreg(gdid3,
+     1HE5_HDFE_NOPREVSUB,"Height",range)'
+        write(*,*)'Define a vertical region '
+        write(*,*)'Region id returned by gddefvrtreg ',regionid3
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gddupreg
+c
+      write(10,27)
+      write(10,*)'Testing he5_gddupreg... '
+      write(10,*)'======================='
+      write(*,*)'Testing he5_gddupreg... '
+      write(*,*)'======================='
+
+      regionid2 = he5_gddupreg(regionid)
+      if (regionid2 .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'regionid2 = he5_gddupreg(regionid)'
+        write(10,*)'Generate a new region id '
+        write(10,*)'New region id ',regionid2
+        write(*,*)'regionid2 = he5_gddupreg(regionid)'
+        write(*,*)'Generate a new region id '
+        write(*,*)'New region id ',regionid2
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      regionid4 = he5_gddupreg(regionid3)
+      if (regionid4 .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'regionid4 = he5_gddupreg(regionid3)'
+        write(10,*)'Generate a new region id '
+        write(10,*)'New region id ',regionid4
+        write(*,*)'regionid4 = he5_gddupreg(regionid3)'
+        write(*,*)'Generate a new region id '
+        write(*,*)'New region id ',regionid4
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+
+c Test Case -- he5_gdgetpix
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdgetpix... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdgetpix... '
+      write(*,*)'=========================='
+
+      nlonlat = 5
+      status= he5_gdgetpix(gdid_utm,nlonlat,lonval,
+     1latval,rowval,colval)             
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status = he5_gdgetpix(gdid_utm,5,lonval,
+     1latval,rowval,colval)'
+        write(10,*)'Retrieve pixel row. column values '
+        write(*,*)'status = he5_gdgetpix(gdid_utm,5,lonval,latval,
+     1rowval,colval)'
+        write(*,*)'Retrieve pixel row. column values '
+        do 37 i=1,5
+           write(10,5)'Pixel position lon lat ',lonval(i),' ',
+     1latval(i),' ','Row Column ',rowval(i),' ',colval(i) 
+           write(*,5)'Pixel position lon lat ',lonval(i),' ',
+     1latval(i),' ','Row Column ',rowval(i),' ',colval(i) 
+   37   continue
+      endif
+    5 format(a,f6.1,a,f6.1,a,a,i2,a,i2)
+      write(10,*)' '
+      write(*,*)' '
+
+      status= he5_gdgetpix(gdid3,nlonlat,lonval,
+     1latval,rowval,colval)             
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'status = he5_gdgetpix(gdid3,5,lonval,
+     1latval,rowval,colval)'
+        write(10,*)'Retrieve pixel row. column values '
+        write(*,*)'status = he5_gdgetpix(gdid3,5,lonval,latval,
+     1rowval,colval)'
+        write(*,*)'Retrieve pixel row. column values '
+        do 47 i=1,5
+           write(10,5)'Pixel position lon lat ',lonval(i),' ',
+     1latval(i),' ','Row Column ',rowval(i),' ',colval(i) 
+           write(*,5)'Pixel position lon lat ',lonval(i),' ',
+     1latval(i),' ','Row Column ',rowval(i),' ',colval(i) 
+   47   continue
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdgetpixval
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdgetpixval... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdgetpixval... '
+      write(*,*)'=========================='
+
+      nlonlat = 5
+      size= he5_gdgetpixval(gdid_utm,nlonlat,rowval,colval,
+     1"Voltage",fldval)
+      if (size .le. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'lstatus = he5_gdgetpixval(gdid_utm,5,rowval,
+     1colval,"Voltage",fldval)'
+        write(10,*)'Retrieve pixel values for specific locations '
+        write(*,*)'lstatus = he5_gdgetpixval(gdid_utm,5,rowval,
+     1colval,"Voltage",fldval)'
+        write(*,*)'Retrieve pixel values for specific locations '
+        do i=1,5
+           write(10,17)'Row Col ',rowval(i),' ',colval(i),' ',
+     1'Pixel Value ',fldval(i)
+           write(*,17)'Row Col ',rowval(i),' ',colval(i),' ',
+     1'Pixel Value ',fldval(i)
+        enddo
+      endif
+   17 format(a8,i2,a1,i2,a1,a12,f9.3)
+      write(10,*)' '
+      write(*,*)' '
+
+      size= he5_gdgetpixval(gdid3,nlonlat,rowval,colval,
+     1"Voltage",fldval)
+      if (size .le. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'lstatus = he5_gdgetpixval(gdid3,5,rowval,
+     1colval,"Voltage",fldval)'
+        write(10,*)'Retrieve pixel values for specific locations '
+        write(*,*)'lstatus = he5_gdgetpixval(gdid3,5,rowval,
+     1colval,"Voltage",fldval)'
+        write(*,*)'Retrieve pixel values for specific locations '
+        do i=1,5
+           write(10,17)'Row Col ',rowval(i),' ',colval(i),' ',
+     1'Pixel Value ',fldval(i)
+           write(*,17)'Row Col ',rowval(i),' ',colval(i),' ',
+     1'Pixel Value ',fldval(i)
+        enddo
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+c Test Case -- he5_gdinterpolate
+c
+      write(10,27)
+      write(10,*)'Testing he5_gdinterpolate... '
+      write(10,*)'=========================='
+      write(*,*)'Testing he5_gdinterpolate... '
+      write(*,*)'=========================='
+
+      nlonlat = 5
+      size= he5_gdinterpolate(gdid_utm,nlonlat,lonval,latval,
+     1'Voltage',interval)
+      if (size .le. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'lstatus= he5_gdinterpolate(gdid_utm,5,lonval,
+     1latval,"Voltage",interval)'
+        write(10,*)'Interpolate 5 values for field Voltage '
+        write(*,*)'lstatus= he5_gdinterpolate(gdid_utm,5,lonval,
+     1latval,"Voltage",interval)'
+        write(*,*)'Interpolate 5 values for field Voltage '
+        write(*,*)'Status returned by call to gdinterpolate ',lstatus
+        do i=1,5
+           write(*,4)'Interpolated value ',interval(i,1)
+           write(10,4)'Interpolated value ',interval(i,1)
+        enddo
+      endif
+    4 format(a,f9.3)
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid_utm)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddetach(gdid_utm)'
+         write(*,*)'Value returned by gddetach ',status
+         write(10,*)'status = he5_gddetach(gdid_utm)'
+         write(10,*)'Value returned by gddetach ',status
+      endif
+
+      size= he5_gdinterpolate(gdid3,nlonlat,lonval,latval,
+     1'Voltage',interval)
+      if (size .le. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+        write(10,*)'lstatus= he5_gdinterpolate(gdid3,5,lonval,
+     1latval,"Voltage",interval)'
+        write(10,*)'Interpolate 5 values for field Voltage '
+        write(*,*)'lstatus= he5_gdinterpolate(gdid3,5,lonval,
+     1latval,"Voltage",interval)'
+        write(*,*)'Interpolate 5 values for field Voltage '
+        write(*,*)'Status returned by call to gdinterpolate ',lstatus
+        do i=1,5
+           write(*,4)'Interpolated value ',interval(i,1)
+           write(10,4)'Interpolated value ',interval(i,1)
+        enddo
+      endif
+      write(10,*)' '
+      write(*,*)' '
+
+      status = he5_gddetach(gdid3)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gddetach(gdid3)'
+         write(*,*)'Value returned by gddetach ',status
+         write(10,*)'status = he5_gddetach(gdid3)'
+         write(10,*)'Value returned by gddetach ',status
+      endif
+
+      status = he5_gdclose(gdfid)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdclose(gdfid)'
+         write(*,*)'Returned from gdclose ', status
+         write(10,*)'status = he5_gdclose(gdfid)'
+         write(10,*)'Returned from gdclose ', status
+      endif
+
+      status = he5_gdclose(gdfid3)
+      if (status .lt. zero) then
+        write(10,*)'**********Error unexpected***********'
+        write(*,*)'**********Error unexpected***********'
+        
+      else
+         write(*,*)' '
+         write(*,240)
+         write(10,*)' '
+         write(10,240)
+         write(*,*)'status = he5_gdclose(gdfid3)'
+         write(*,*)'Returned from gdclose ', status
+         write(10,*)'status = he5_gdclose(gdfid3)'
+         write(10,*)'Returned from gdclose ', status
+      endif
+
+      close(unit=10)
+ 27   format(' ')
+      stop
+      end
+
+
+
+
+
+
+
+
diff --git a/testdrivers/grid/tutils.h b/testdrivers/grid/tutils.h
new file mode 100755
index 0000000..72e8033
--- /dev/null
+++ b/testdrivers/grid/tutils.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+ * NCSA HDF                                                                 *
+ * Software Development Group                                               *
+ * National Center for Supercomputing Applications                          *
+ * University of Illinois at Urbana-Champaign                               *
+ * 605 E. Springfield, Champaign IL 61820                                   *
+ *                                                                          *
+ * For conditions of distribution and use, see the accompanying             *
+ * hdf/COPYING file.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/* tutils.h,v 1.12 1995/10/05 16:17:28 koziol Exp */
+
+#ifndef _TUTILS_H
+#define _TUTILS_H
+
+/* Define these for use in all the tests */
+#ifndef TESTMASTER
+extern
+#endif
+int         num_errs
+#ifdef TESTMASTER
+= 0
+#endif
+,           Verbosity
+#ifdef TESTMASTER
+= 0
+#endif
+           ;
+
+#ifdef TEST_PC
+#define FAR far
+#else
+#ifndef FAR
+#define FAR     /* */
+#endif /* FAR */
+#endif /* TEST_PC */
+
+/* Use %ld to print the value because long could cover most cases. */
+/* Used to make certain a return value _is_not_ a value */
+#define CHECK(ret, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s returned %ld \n",where,(int)__LINE__,__FILE__,(long)ret);\
+if(ret == val) {printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", where, (long)ret, (int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+/* Used to make certain a return value _is_ a value */
+#define VERIFY(x, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s had value %ld \n",where,(int)__LINE__,__FILE__,(long)x);\
+if(x != val) {printf("*** UNEXPECTED VALUE from %s is %ld at line %4d in %s\n", where, (long)x,(int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+#define RESULT(a) \
+do { \
+if (Verbosity>8) printf("   Call to HDF routine: %15s at line %4d in %s returned %ld \n",a,(int)__LINE__,__FILE__,(long)ret); \
+if (Verbosity>9) HEprint(stdout,0); \
+if(ret == FAIL) {printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", a, (long)ret,(int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+#define MESSAGE(v,a) {if (Verbosity>=v) {a}}
+
+#endif /* _TUTILS_H */
diff --git a/testdrivers/make.com b/testdrivers/make.com
new file mode 100644
index 0000000..029145c
--- /dev/null
+++ b/testdrivers/make.com
@@ -0,0 +1,75 @@
+INCDIR = -I$(HDFINC) -I$(HDF5INC) -I$(HDFEOS5_INC)
+LIBDIR = -L$(HDFLIB) -L$(HDF5LIB) -L$(HDFEOS5_LIB) -lhe5_hdfeos -lGctp $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a -ljpeg -lz $(SZIPLIB)/libsz.a -lm -ldl
+
+default all:
+	@if [ $(BRAND) = "sgi64" ] || [ $(BRAND) = "linux64" ] ; then \
+	echo " "; echo " "; \
+	echo " ---- Making *.c and *.f testdrivers in swath directory ----"; \
+	cd swath; \
+	$(CC) $(CFLAGS) -o TestSwath.o $(INCDIR) -c TestSwath.c; \
+	$(CC) $(CFLAGS) -o TestSwath_c TestSwath.o $(LIBDIR) $(CEXTRAL); \
+	$(CC) $(CFLAGS) -o TestProfile.o $(INCDIR) -c TestProfile.c; \
+	$(CC) $(CFLAGS) -o TestProfile_c TestProfile.o $(LIBDIR) $(CEXTRAL); \
+	$(RM) $(RMFLAGS) *.o; \
+	$(F77) $(FFLAGS) -o testswath64.o $(INCDIR) -c testswath64.f; \
+	$(F77) $(FFLAGS) -o testswath64_f testswath64.o $(LIBDIR) $(FEXTRAL); \
+	$(RM) $(RMFLAGS) *.o; echo " "; echo " "; \
+	echo " ---- Making *.c and *.f testdrivers in grid directory ----"; \
+	cd ../grid; $(CC) $(CFLAGS) -o TestGrid.o $(INCDIR) -c TestGrid.c; \
+	$(CC) $(CFLAGS) -o TestGrid_c TestGrid.o $(LIBDIR) $(CEXTRAL); \
+	$(RM) $(RMFLAGS) *.o; \
+	$(F77) $(FFLAGS) -o testgrid64.o $(INCDIR) -c testgrid64.f; \
+	$(F77) $(FFLAGS) -o testgrid64_f testgrid64.o $(LIBDIR) $(FEXTRAL); \
+	$(RM) $(RMFLAGS) *.o; echo " "; echo " "; \
+	echo " ---- Making *.c and *.f testdrivers in point directory ----"; \
+	cd ../point; $(CC) $(CFLAGS) -o TestPoint.o $(INCDIR) -c TestPoint.c; \
+	$(CC) $(CFLAGS) -o TestPoint_c TestPoint.o $(LIBDIR) $(CEXTRAL); \
+	$(RM) $(RMFLAGS) *.o; \
+	$(F77) $(FFLAGS) -o testpoint64.o $(INCDIR) -c testpoint64.f; \
+	$(F77) $(FFLAGS) -o testpoint64_f testpoint64.o $(LIBDIR) $(FEXTRAL); \
+	$(RM) $(RMFLAGS) *.o;echo " "; echo " "; \
+	echo " ---- Making *.c and *.f testdrivers in za directory ----"; \
+	cd ../za; $(CC) $(CFLAGS) -o TestZa.o $(INCDIR) -c TestZa.c; \
+	$(CC) $(CFLAGS) -o TestAlias.o $(INCDIR) -c TestAlias.c; \
+	$(CC) $(CFLAGS) -o TestZa_c TestZa.o $(LIBDIR) $(CEXTRAL); \
+	$(CC) $(CFLAGS) -o TestAlias_c TestAlias.o $(LIBDIR) $(CEXTRAL); \
+	$(RM) $(RMFLAGS) *.o; \
+	$(F77) $(FFLAGS) -o testza64.o $(INCDIR) -c testza64.f; \
+	$(F77) $(FFLAGS) -o testza64_f testza64.o $(LIBDIR) $(FEXTRAL); \
+	$(RM) $(RMFLAGS) *.o; \
+	else \
+	echo " "; echo " "; \
+	echo " ---- Making *.c and *.f testdrivers in swath directory ----"; \
+	cd swath; \
+	$(CC) $(CFLAGS) -o TestSwath.o $(INCDIR) -c TestSwath.c; \
+	$(CC) $(CFLAGS) -o TestSwath_c TestSwath.o $(LIBDIR) $(CEXTRAL); \
+	$(CC) $(CFLAGS) -o TestProfile.o $(INCDIR) -c TestProfile.c; \
+	$(CC) $(CFLAGS) -o TestProfile_c TestProfile.o $(LIBDIR) $(CEXTRAL); \
+	$(RM) $(RMFLAGS) *.o; \
+	$(F77) $(FFLAGS) -o testswath32.o $(INCDIR) -c testswath32.f; \
+	$(F77) $(FFLAGS) -o testswath32_f testswath32.o $(LIBDIR) $(FEXTRAL); \
+	$(RM) $(RMFLAGS) *.o; echo " "; echo " "; \
+	echo " ---- Making *.c and *.f testdrivers in grid directory ----"; \
+	cd ../grid; $(CC) $(CFLAGS) -o TestGrid.o $(INCDIR) -c TestGrid.c; \
+	$(CC) $(CFLAGS) -o TestGrid_c TestGrid.o $(LIBDIR) $(CEXTRAL); \
+	$(RM) $(RMFLAGS) *.o; \
+	$(F77) $(FFLAGS) -o testgrid32.o $(INCDIR) -c testgrid32.f; \
+	$(F77) $(FFLAGS) -o testgrid32_f testgrid32.o $(LIBDIR) $(FEXTRAL); \
+	$(RM) $(RMFLAGS) *.o; echo " "; echo " "; \
+	echo " ---- Making *.c and *.f testdrivers in point directory ----"; \
+	cd ../point; $(CC) $(CFLAGS) -o TestPoint.o $(INCDIR) -c TestPoint.c; \
+	$(CC) $(CFLAGS) -o TestPoint_c TestPoint.o $(LIBDIR) $(CEXTRAL); \
+	$(RM) $(RMFLAGS) *.o; \
+	$(F77) $(FFLAGS) -o testpoint32.o $(INCDIR) -c testpoint32.f; \
+	$(F77) $(FFLAGS) -o testpoint32_f testpoint32.o $(LIBDIR) $(FEXTRAL); \
+	$(RM) $(RMFLAGS) *.o;echo " "; echo " "; \
+	echo " ---- Making *.c and *.f testdrivers in za directory ----"; \
+	cd ../za; $(CC) $(CFLAGS) -o TestZa.o $(INCDIR) -c TestZa.c; \
+	$(CC) $(CFLAGS) -o TestAlias.o $(INCDIR) -c TestAlias.c; \
+	$(CC) $(CFLAGS) -o TestZa_c TestZa.o $(LIBDIR) $(CEXTRAL); \
+	$(CC) $(CFLAGS) -o TestAlias_c TestAlias.o $(LIBDIR) $(CEXTRAL); \
+	$(RM) $(RMFLAGS) *.o; \
+	$(F77) $(FFLAGS) -o testza32.o $(INCDIR) -c testza32.f; \
+	$(F77) $(FFLAGS) -o testza32_f testza32.o $(LIBDIR) $(FEXTRAL); \
+	$(RM) $(RMFLAGS) *.o; \
+	fi ; 
diff --git a/testdrivers/point/CMakeLists.txt b/testdrivers/point/CMakeLists.txt
new file mode 100644
index 0000000..d4988f4
--- /dev/null
+++ b/testdrivers/point/CMakeLists.txt
@@ -0,0 +1,64 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDFEOS5_TESTDRIVERS_POINT)
+
+ADD_EXECUTABLE (testpoint ${PROJECT_SOURCE_DIR}/TestPoint.c)
+TARGET_NAMING (testpoint ${LIB_TYPE})
+TARGET_LINK_LIBRARIES (testpoint ${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_GCTP_SRC_LIB_TARGET} ${LINK_LIBS})
+
+IF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+  # make test dir
+  FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+
+  IF (F2CFORTRAN_32PTR)
+    ADD_EXECUTABLE (testpoint_f ${PROJECT_SOURCE_DIR}/testpoint32.f)
+  ELSE (F2CFORTRAN_32PTR)
+    ADD_EXECUTABLE (testpoint_f ${PROJECT_SOURCE_DIR}/testpoint64.f)
+  ENDIF (F2CFORTRAN_32PTR)
+  TARGET_NAMING (testpoint_f ${LIB_TYPE})
+  TARGET_FORTRAN_WIN_PROPERTIES (testpoint_f "")
+  SET_TARGET_PROPERTIES (testpoint_f PROPERTIES LINKER_LANGUAGE Fortran)
+  TARGET_LINK_LIBRARIES (testpoint_f ${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_GCTP_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  SET (POINT_REFERENCE_FILES
+    fixedBuoy0.txt
+    fixedBuoy1.txt
+    fixedBuoy1s.txt
+    floatBuoy0.txt
+    floatBuoy1.txt
+    simple.txt
+  )
+
+  FOREACH (out_file ${POINT_REFERENCE_FILES})
+    SET (outdest "${PROJECT_BINARY_DIR}/fortran/${out_file}")
+    #MESSAGE (STATUS " Translating ${out_file}")
+    ADD_CUSTOM_COMMAND (
+        TARGET     testpoint_f
+        POST_BUILD
+        COMMAND    ${XLATE_UTILITY}
+        ARGS       ${PROJECT_SOURCE_DIR}/${out_file} ${outdest}
+    )
+  ENDFOREACH (out_file ${POINT_REFERENCE_FILES})
+ENDIF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+  
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+IF (BUILD_TESTING)
+
+  ADD_TEST (NAME POINT_test_c COMMAND $<TARGET_FILE:testpoint>)
+  SET_TESTS_PROPERTIES (POINT_test_c PROPERTIES ENVIRONMENT "srcdir=${PROJECT_SOURCE_DIR}")
+
+  ADD_TEST (NAME POINT_test_c_verbose COMMAND $<TARGET_FILE:testpoint> -v h)
+  SET_TESTS_PROPERTIES (POINT_test_c_verbose PROPERTIES ENVIRONMENT "srcdir=${PROJECT_SOURCE_DIR}")
+  SET_TESTS_PROPERTIES (POINT_test_c_verbose PROPERTIES DEPENDS POINT_test_c)
+
+  IF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+    ADD_TEST (NAME POINT_test_f COMMAND $<TARGET_FILE:testpoint_f>)
+    SET_TESTS_PROPERTIES (POINT_test_f PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+    SET_TESTS_PROPERTIES (POINT_test_f PROPERTIES ENVIRONMENT "srcdir=${PROJECT_SOURCE_DIR}")
+    SET_TESTS_PROPERTIES (POINT_test_f PROPERTIES DEPENDS POINT_test_c_verbose)
+  ENDIF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+
+ENDIF (BUILD_TESTING)
diff --git a/testdrivers/point/Makefile.am b/testdrivers/point/Makefile.am
new file mode 100644
index 0000000..c474437
--- /dev/null
+++ b/testdrivers/point/Makefile.am
@@ -0,0 +1,49 @@
+# testdrivers/point Makefile.am
+
+# Boilerplate definitions
+include $(top_srcdir)/config/include.am
+
+# Link against HDF-EOS5 and libGCTP
+INCLUDES=-I$(top_srcdir)/include
+LDADD=$(LIBHDFEOS5) $(LIBGCTP)
+
+# Build TestPoint from TestPoint.c
+check_PROGRAMS = TestPoint
+
+if F2CFORTRAN_CONDITIONAL
+if F2CFORTRAN_32PTR_CONDITIONAL
+check_PROGRAMS += testpoint32
+testpoint32_SOURCES = testpoint32.f
+else
+check_PROGRAMS += testpoint64
+testpoint64_SOURCES = testpoint64.f
+endif
+endif
+
+# Run TestPoint as a test when the user types 'make check'
+TEST_SEQUENCES=test_c
+VERBOSE_TEST_SEQUENCES=test_c_verbose
+if F2CFORTRAN_CONDITIONAL
+if F2CFORTRAN_32PTR_CONDITIONAL
+TEST_SEQUENCES+=test_32f
+VERBOSE_TEST_SEQUENCES+=test_32f
+else
+TEST_SEQUENCES+=test_64f
+VERBOSE_TEST_SEQUENCES+=test_64f
+endif
+endif
+
+test_c: $(check_PROGRAMS)
+	./TestPoint
+test_c_verbose: $(check_PROGRAMS)
+	./TestPoint -v h
+test_32f: $(check_PROGRAMS)
+	./testpoint32
+test_64f: $(check_PROGRAMS)
+	./testpoint64
+
+check-local: $(TEST_SEQUENCES)
+verbose_check: $(VERBOSE_TEST_SEQUENCES)
+
+.PHONY: $(TEST_SEQUENCES)
+
diff --git a/testdrivers/point/Makefile.in b/testdrivers/point/Makefile.in
new file mode 100644
index 0000000..2c04575
--- /dev/null
+++ b/testdrivers/point/Makefile.in
@@ -0,0 +1,519 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+# testdrivers/point Makefile.am
+SOURCES = TestPoint.c $(testpoint32_SOURCES) $(testpoint64_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/config/include.am
+check_PROGRAMS = TestPoint$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2)
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_1 = testpoint32
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_2 = testpoint64
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_3 = test_32f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_4 = test_32f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_5 = test_64f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_6 = test_64f
+subdir = testdrivers/point
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/HE5_config.h
+CONFIG_CLEAN_FILES =
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__EXEEXT_1 = testpoint32$(EXEEXT)
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__EXEEXT_2 = testpoint64$(EXEEXT)
+TestPoint_SOURCES = TestPoint.c
+TestPoint_OBJECTS = TestPoint.$(OBJEXT)
+TestPoint_LDADD = $(LDADD)
+am__DEPENDENCIES_1 = $(top_builddir)/src/libhe5_hdfeos.la
+am__DEPENDENCIES_2 = $(top_builddir)/gctp/src/libGctp.la
+TestPoint_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am__testpoint32_SOURCES_DIST = testpoint32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_testpoint32_OBJECTS = testpoint32.$(OBJEXT)
+testpoint32_OBJECTS = $(am_testpoint32_OBJECTS)
+testpoint32_LDADD = $(LDADD)
+testpoint32_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am__testpoint64_SOURCES_DIST = testpoint64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_testpoint64_OBJECTS = testpoint64.$(OBJEXT)
+testpoint64_OBJECTS = $(am_testpoint64_OBJECTS)
+testpoint64_LDADD = $(LDADD)
+testpoint64_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS)
+LTF77COMPILE = $(LIBTOOL) --mode=compile --tag=F77 $(F77) $(AM_FFLAGS) \
+	$(FFLAGS)
+F77LD = $(F77)
+F77LINK = $(LIBTOOL) --mode=link --tag=F77 $(F77LD) $(AM_FFLAGS) \
+	$(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = TestPoint.c $(testpoint32_SOURCES) $(testpoint64_SOURCES)
+DIST_SOURCES = TestPoint.c $(am__testpoint32_SOURCES_DIST) \
+	$(am__testpoint64_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F2CFORTRAN_32PTR_CONDITIONAL_FALSE = @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@
+F2CFORTRAN_32PTR_CONDITIONAL_TRUE = @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@
+F2CFORTRAN_90_CONDITIONAL_FALSE = @F2CFORTRAN_90_CONDITIONAL_FALSE@
+F2CFORTRAN_90_CONDITIONAL_TRUE = @F2CFORTRAN_90_CONDITIONAL_TRUE@
+F2CFORTRAN_CONDITIONAL_FALSE = @F2CFORTRAN_CONDITIONAL_FALSE@
+F2CFORTRAN_CONDITIONAL_TRUE = @F2CFORTRAN_CONDITIONAL_TRUE@
+F77 = @F77@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_INCLUDE_CONDITIONAL_FALSE = @INSTALL_INCLUDE_CONDITIONAL_FALSE@
+INSTALL_INCLUDE_CONDITIONAL_TRUE = @INSTALL_INCLUDE_CONDITIONAL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SZIP_ENCODER_CONDITIONAL_FALSE = @SZIP_ENCODER_CONDITIONAL_FALSE@
+SZIP_ENCODER_CONDITIONAL_TRUE = @SZIP_ENCODER_CONDITIONAL_TRUE@
+TESTDRIVERS_CONDITIONAL_FALSE = @TESTDRIVERS_CONDITIONAL_FALSE@
+TESTDRIVERS_CONDITIONAL_TRUE = @TESTDRIVERS_CONDITIONAL_TRUE@
+THREADSAFE_CONDITIONAL_FALSE = @THREADSAFE_CONDITIONAL_FALSE@
+THREADSAFE_CONDITIONAL_TRUE = @THREADSAFE_CONDITIONAL_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la
+LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
+
+# Boilerplate definitions
+
+# Link against HDF-EOS5 and libGCTP
+INCLUDES = -I$(top_srcdir)/include
+LDADD = $(LIBHDFEOS5) $(LIBGCTP)
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at testpoint32_SOURCES = testpoint32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at testpoint64_SOURCES = testpoint64.f
+
+# Run TestPoint as a test when the user types 'make check'
+TEST_SEQUENCES = test_c $(am__append_3) $(am__append_5)
+VERBOSE_TEST_SEQUENCES = test_c_verbose $(am__append_4) \
+	$(am__append_6)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .f .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  testdrivers/point/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  testdrivers/point/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+TestPoint$(EXEEXT): $(TestPoint_OBJECTS) $(TestPoint_DEPENDENCIES) 
+	@rm -f TestPoint$(EXEEXT)
+	$(LINK) $(TestPoint_LDFLAGS) $(TestPoint_OBJECTS) $(TestPoint_LDADD) $(LIBS)
+testpoint32$(EXEEXT): $(testpoint32_OBJECTS) $(testpoint32_DEPENDENCIES) 
+	@rm -f testpoint32$(EXEEXT)
+	$(F77LINK) $(testpoint32_LDFLAGS) $(testpoint32_OBJECTS) $(testpoint32_LDADD) $(LIBS)
+testpoint64$(EXEEXT): $(testpoint64_OBJECTS) $(testpoint64_DEPENDENCIES) 
+	@rm -f testpoint64$(EXEEXT)
+	$(F77LINK) $(testpoint64_LDFLAGS) $(testpoint64_OBJECTS) $(testpoint64_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TestPoint.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+.f.o:
+	$(F77COMPILE) -c -o $@ $<
+
+.f.obj:
+	$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.f.lo:
+	$(LTF77COMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(mkdir_p) $(distdir)/../../config
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+	$(MAKE) $(AM_MAKEFLAGS) check-local
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \
+	clean-checkPROGRAMS clean-generic clean-libtool ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am
+
+
+test_c: $(check_PROGRAMS)
+	./TestPoint
+test_c_verbose: $(check_PROGRAMS)
+	./TestPoint -v h
+test_32f: $(check_PROGRAMS)
+	./testpoint32
+test_64f: $(check_PROGRAMS)
+	./testpoint64
+
+check-local: $(TEST_SEQUENCES)
+verbose_check: $(VERBOSE_TEST_SEQUENCES)
+
+.PHONY: $(TEST_SEQUENCES)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/testdrivers/point/Makefile.sgi32 b/testdrivers/point/Makefile.sgi32
new file mode 100644
index 0000000..e2fda2f
--- /dev/null
+++ b/testdrivers/point/Makefile.sgi32
@@ -0,0 +1,59 @@
+
+COMPILER = cc
+LINKER = cc
+CC = $(COMPILER)
+LD = $(LINKER)
+
+# for SUN
+#CFLAGS =  -g -Xa -DsunFortran -DSUN
+#LFLAGS = -g -Xa -DsunFortran -DSUN
+
+# for sgi32
+CFLAGS =  -g -n32 -xansi -D_POSIX_SOURCE
+LFLAGS = -g -n32 -xansi -D_POSIX_SOURCE
+
+# for sgi64
+#CFLAGS =  -g -64 -xansi -D_POSIX_SOURCE
+#LFLAGS = -g -64 -xansi -D_POSIX_SOURCE
+
+INCLUDE = -I. -I$(HDFEOS5_INC) -I$(HDF5INC) -I$(JPEGINC) -I$(ZLIBINC) -I$(SZIPINC)
+
+
+LIBRARYPATHS = -L$(HDF5LIB) -L$(HDFEOS5_LIB) -L$(JPEGLIB) -L$(ZLIBLIB) -L$(SZIPLIB)
+
+# for SUN
+#LIBRARIES = -lhe5_hdfeos $(HDF5LIB)/libhdf5.a -lGctp -ljpeg -lz -lsz -lpthread -lm -lnsl
+
+# for other platforms
+LIBRARIES = -lhe5_hdfeos $(HDF5LIB)/libhdf5.a -lGctp -ljpeg -lz -lsz -lpthread -lm
+
+OBJECTS = TestPoint.o
+
+
+PROGRAMS = TestPoint
+
+
+all: ${PROGRAMS} cleano
+
+${PROGRAMS}: ${OBJECTS}
+	${CC} ${LFLAGS} -o $@ ${OBJECTS} ${LIBRARYPATHS} ${LIBRARIES}
+
+.c.o: 
+	${CC} ${CFLAGS} -c ${INCLUDE} $<
+
+clean:
+	rm *.o ${PROGRAMS}
+
+cleano:
+	rm *.o
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/point/TestPoint.c b/testdrivers/point/TestPoint.c
new file mode 100755
index 0000000..cea4549
--- /dev/null
+++ b/testdrivers/point/TestPoint.c
@@ -0,0 +1,2862 @@
+/*
+ *********************************************************
+ *       FILE:     TestPoint.c                           *                     
+ *       PURPOSE:  To test HDF-EOS v.5.1 Point interface *              
+ *       Author:   A. Muslimov, Emergent IT Inc.         * 
+ *       Date:     June 2001                             *  
+ *********************************************************  
+ */
+
+
+#include <HE5_HdfEosDef.h>
+#include <tutils.h>
+
+#define NAMEBUF_SIZE 100
+
+/* Set up namebuf value in case the input file is in
+ * a different directory and "srcdir" is set in the
+ * environment.
+ */
+static void setup_namebuf(char *namebuf, char *filename)
+{
+  char * srcdir;
+
+  srcdir = getenv("srcdir");
+  if(srcdir != NULL && (strlen(srcdir) + strlen(filename) + 2) <= NAMEBUF_SIZE)
+  {
+    strcpy(namebuf, srcdir);
+    strcat(namebuf, "/");
+    strcat(namebuf, filename);
+  }
+  else
+  {
+    strcpy(namebuf, filename);
+  }
+}
+
+int main(int argc, char *argv[])
+{
+
+  FILE            *fp;
+  FILE            *fp_in;
+
+  herr_t          status    = FAIL;   
+
+  hid_t           ptfid     = FAIL;
+  hid_t           PTid1     = FAIL;
+  hid_t           PTid2     = FAIL;
+  hid_t           PTid3     = FAIL; 
+  hid_t           datatype  = FAIL; 
+
+  int	          CLLoop;
+  int             Verbosity = 4;
+  int             errcnt    = 0;
+  int             i, j;
+  int             n;
+  int             date;
+  int             wgt;
+  int             IntAttr    = 9999;
+  int             attr       = 9999;
+  int             attr1[ 5 ] = { 1, 2, 3, 4, 5};
+  int             attr2[ 5 ] = { 10, 20, 30, 40, 50};
+  int             nflds      = FAIL;
+  int             fieldgroup = FAIL;
+  int             return_val = FAIL;
+
+  long            nattr      = FAIL;
+  long            strbufsize = FAIL;
+ 
+  H5T_class_t     classid    = H5T_NO_CLASS;    
+  H5T_order_t     order      = H5T_ORDER_ERROR;
+   
+  typedef struct
+	{
+	  double      time;
+	  float       concentr[4];
+	  char        spec[8];
+	  
+	} InputData1;
+  
+  typedef struct
+	{
+	  char        label[8];
+	  double      lon;
+	  double      lat;
+	  int         date;
+	  char        id[8];
+	} InputData2;
+  
+  typedef struct
+	{
+	  double      time;
+	  float       rain;
+	  float       temp;
+	  char        id[8];
+	} InputData3;
+  
+  
+  typedef struct
+	{
+	  char        label[10];
+	  int         date;
+	  int         weight;
+	  char        id[8];
+	} InputData4;
+
+
+  typedef struct
+	{
+	  double      time;
+	  double      lon;
+	  double      lat;
+	  float       rain;
+	  float       temp;
+	  char        id[8];
+	} InputData5;   
+
+  typedef struct {
+	double   time;
+	float    con[4];
+	char     spec[8];
+  } Sensor;
+
+  hsize_t         count[8];
+  hsize_t         nrecs = 0;
+  hsize_t         nrec  = 1;
+
+  hssize_t        recs[32];
+      
+  size_t          datasize = 0;
+  size_t          size     = 0;
+  
+  float           conc[4];
+  float           rain;
+  float           temp;
+  float           flt = -7.5;
+ 
+  double          time;
+  double          lon;
+  double          lat;
+ 
+  char            spc[8];
+  char            desc[16];
+  char            id[ 2 ];   
+
+  HE5_CmpDTSinfo  level;
+  HE5_CmpDTSinfo  inInfo;
+  HE5_CmpDTSinfo  inInfo2;
+  HE5_CmpDTSinfo  *dtsinfo;
+  
+  InputData1      datbuf_1[20];
+  InputData2      datbuf_2[5];
+  InputData3      datbuf_3[25];
+  InputData4      datbuf_4[5];
+  InputData5      datbuf_5[30];
+
+  InputData1      buf_1;  
+  Sensor          s[50];
+  double          s1[50];
+
+  char            namebuf[NAMEBUF_SIZE];
+
+  
+  /* 
+   ********************************************************************************
+   *                 Get comand-line argument (Verbosity)                         *
+   ********************************************************************************
+   */
+  
+  
+  for (CLLoop = 1; CLLoop < argc; CLLoop++)
+	{
+	  if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-verbose") == 0) || (HDstrcmp(argv[CLLoop], "-v") == 0)))
+		{
+		  if (argv[CLLoop + 1][0] == 'l')
+			Verbosity = 4;
+		  else if (argv[CLLoop + 1][0] == 'm')
+			Verbosity = 6;
+		  else if (argv[CLLoop + 1][0] == 'h')
+			Verbosity = 10;
+		  else
+			Verbosity = atoi(argv[CLLoop + 1]);
+		} 
+	}
+  
+   
+  setup_namebuf(namebuf, "TestPoint.txt");
+  MESSAGE(11,fp=fopen(namebuf,"w"););
+  
+  MESSAGE(4,printf("Testing Point C interface \n"););
+  MESSAGE(4,printf("========================= \n\n"););
+  MESSAGE(11,fprintf(fp,"Testing Point C interface \n"););
+  MESSAGE(11,fprintf(fp,"========================= \n\n"););
+   
+  
+  /*
+   *********************************************************************************
+   *                             Testing    PTopen                                 *
+   *********************************************************************************
+   */
+
+  MESSAGE(4,printf("\n"););  
+  MESSAGE(4,printf("\tTesting HE5_PTopen... \n"););
+  MESSAGE(4,printf("\t===================== \n"););
+
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTopen... \n"););
+  MESSAGE(11,fprintf(fp,"\t===================== \n"););
+  
+  ptfid = HE5_PTopen("SimplePoint.h5", H5F_ACC_TRUNC);
+  if (ptfid == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\t\t*** Successfully opened the point file ****\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t*** Successfully opened the point file ****\n"););
+	}
+   
+  
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTcreate                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\n"););
+  MESSAGE(4,printf("\tTesting HE5_PTcreate... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTcreate... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tCreating point \"Simple Point\"  \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tCreating point \"Simple Point\" \n"););
+  
+  PTid1 = HE5_PTcreate(ptfid, "Simple Point");
+  if (PTid1 == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\t\t*** Successfully created the point \"Simple Point\" ****\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the point \"Simple Point\" ****\n"););
+	}
+  
+
+  
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTcreate                           *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\n"););
+  MESSAGE(4,printf("\tTesting HE5_PTcreate... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTcreate... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tCreating point \"FixedBuoy Point\"  \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tCreating point \"FixedBuoy Point\" \n"););
+  
+  PTid2 = HE5_PTcreate(ptfid, "FixedBuoy Point");
+  if (PTid2 == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\t\t*** Successfully created the point \"FixedBuoy Point\" ****\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the point \"FixedBuoy Point\" ****\n"););
+	}
+  
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTcreate                           *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\n"););
+  MESSAGE(4,printf("\tTesting HE5_PTcreate... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTcreate... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tCreating point \"FloatBuoy Point\"  \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tCreating point \"FloatBuoy Point\" \n"););
+
+  PTid3 = HE5_PTcreate(ptfid, "FloatBuoy Point"); 
+  if (PTid3 == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\t\t*** Successfully created the point \"FloatBuoy Point\" ****\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the point \"FloatBuoy Point\" ****\n"););
+	}
+    
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdetach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdetach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tDetaching from the  point \"Simple Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDetaching from the  point \"Simple Point\" \n"););
+  
+  status = HE5_PTdetach(PTid1);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach()          %d\n",status););
+	}
+
+   
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdetach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdetach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tDetaching from the  point \"FixedBuoy Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDetaching from the  point \"FixedBuoy Point\" \n"););
+  
+  status = HE5_PTdetach(PTid2);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach()          %d\n",status););
+	}
+  
+
+   
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdetach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdetach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tDetaching from the  point \"FloatBuoy Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDetaching from the  point \"FloatBuoy Point\" \n"););
+  
+  status = HE5_PTdetach(PTid3);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach()          %d\n",status););
+	}
+  
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTattach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTattach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+  MESSAGE(6,printf("\t\tAttaching to the  point \"Simple Point\" \n"););   
+   MESSAGE(11,fprintf(fp,"\t\tAttaching to the  point \"Simple Point\"  \n"););
+   
+  PTid1 = HE5_PTattach(ptfid, "Simple Point"); 
+  if (PTid1 == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n"););
+	  MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid1););
+	  MESSAGE(11,fprintf(fp,"\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid1) ;);
+	}
+
+  
+  dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo));
+  
+  /* Set up level data structure */
+  /* --------------------------- */
+  dtsinfo->nfields = 3;
+  
+  dtsinfo->rank[0] = 1;
+  dtsinfo->rank[1] = 1;
+  dtsinfo->rank[2] = 1;
+  
+  dtsinfo->offset[0] = HOFFSET(InputData1, time);
+  dtsinfo->offset[1] = HOFFSET(InputData1, concentr);
+  dtsinfo->offset[2] = HOFFSET(InputData1, spec);
+  
+  dtsinfo->dtype[0] = H5T_NATIVE_DOUBLE;
+  dtsinfo->dtype[1] = H5T_NATIVE_FLOAT;
+  dtsinfo->dtype[2] = H5T_NATIVE_CHAR;
+  
+  dtsinfo->array[0] = 0;
+  dtsinfo->array[1] = 1;
+  dtsinfo->array[2] = 1;
+  
+  for (i = 0; i < 3; i++)
+	dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char));
+  
+  strcpy(dtsinfo->fieldname[0],"Time");
+  strcpy(dtsinfo->fieldname[1],"Concentration");
+  strcpy(dtsinfo->fieldname[2],"Species");
+  
+  dtsinfo->dims[0][0] = 1;
+  dtsinfo->dims[1][0] = 4;
+  dtsinfo->dims[2][0] = 8;
+  
+  dtsinfo->datasize = (size_t)sizeof(InputData1);
+  
+  
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdeflevel                             *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdeflevel... \n"););
+  MESSAGE(4,printf("\t========================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdeflevel... \n"););   
+  MESSAGE(11,fprintf(fp,"\t========================= \n"););
+  
+  MESSAGE(6,printf("\t\tDefining level \"Sensor\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDefining level \"Sensor\" \n"););
+  status = HE5_PTdeflevel(PTid1, "Sensor", dtsinfo);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdeflevel();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdeflevel()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdeflevel();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdeflevel()          %d\n",status););
+	}
+  
+  for (i = 0; i < 3; i++)
+	{
+	  free(dtsinfo->fieldname[i]);
+	  dtsinfo->fieldname[i] = NULL;
+	}  
+  free(dtsinfo);
+  
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdetach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdetach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tDetaching from the  point \"Simple Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDetaching from the  point \"Simple Point\" \n"););
+  
+  status = HE5_PTdetach(PTid1);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach()          %d\n",status););
+	}
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTattach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTattach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+  MESSAGE(6,printf("\t\tAttaching to the  point \"FixedBuoy Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tAttaching to the  point \"FixedBuoy Point\"  \n"););
+   
+  PTid2 = HE5_PTattach(ptfid, "FixedBuoy Point"); 
+  if (PTid2 == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n"););
+	  MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid2););
+	  MESSAGE(11,fprintf(fp,"\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid2) ;);
+	}
+
+  dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo));
+  
+  /* Set up level data struvcture */
+  /* ---------------------------- */
+  dtsinfo->nfields = 5;
+  
+  dtsinfo->rank[0] = 1;
+  dtsinfo->rank[1] = 1;
+  dtsinfo->rank[2] = 1;
+  dtsinfo->rank[3] = 1;
+  dtsinfo->rank[4] = 1;
+  dtsinfo->array[0] = 1;
+  dtsinfo->array[1] = 0;
+  dtsinfo->array[2] = 0;
+  dtsinfo->array[3] = 0;
+  dtsinfo->array[4] = 1;
+  
+  dtsinfo->offset[0] = HOFFSET(InputData2, label);
+  dtsinfo->offset[1] = HOFFSET(InputData2, lon);
+  dtsinfo->offset[2] = HOFFSET(InputData2, lat);
+  dtsinfo->offset[3] = HOFFSET(InputData2, date);
+  dtsinfo->offset[4] = HOFFSET(InputData2, id);
+  
+  dtsinfo->dtype[0] = H5T_NATIVE_CHAR;
+  dtsinfo->dtype[1] = H5T_NATIVE_DOUBLE;
+  dtsinfo->dtype[2] = H5T_NATIVE_DOUBLE;
+  dtsinfo->dtype[3] = H5T_NATIVE_INT;
+  dtsinfo->dtype[4] = H5T_NATIVE_CHAR;
+ 
+  for (i = 0; i < 5; i++)
+	dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char));
+  
+  strcpy(dtsinfo->fieldname[0],"Label");
+  strcpy(dtsinfo->fieldname[1],"Longitude");
+  strcpy(dtsinfo->fieldname[2],"Latitude");
+  strcpy(dtsinfo->fieldname[3],"DeployDate");
+  strcpy(dtsinfo->fieldname[4],"ID");
+  
+  dtsinfo->dims[0][0] = 8;
+  dtsinfo->dims[1][0] = 1;
+  dtsinfo->dims[2][0] = 1;
+  dtsinfo->dims[3][0] = 1;
+  dtsinfo->dims[4][0] = 8;
+  
+  dtsinfo->datasize = (size_t)sizeof(InputData2);
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdeflevel                             *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdeflevel... \n"););
+  MESSAGE(4,printf("\t========================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdeflevel... \n"););   
+  MESSAGE(11,fprintf(fp,"\t========================= \n"););
+  
+  MESSAGE(6,printf("\t\tDefining level \"Desc-Loc\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDefining level \"Desc-Loc\" \n"););
+  status = HE5_PTdeflevel(PTid2, "Desc-Loc", dtsinfo);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdeflevel();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdeflevel()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdeflevel();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdeflevel()          %d\n",status););
+	}
+  
+  
+  for (i = 0; i < 5; i++)
+	free(dtsinfo->fieldname[i]);
+  
+  free(dtsinfo);
+  
+  dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo));
+  
+  /* Set up level data structure */
+  /* --------------------------- */
+  dtsinfo->nfields = 4;
+  
+  dtsinfo->rank[0] = 1;
+  dtsinfo->rank[1] = 1;
+  dtsinfo->rank[2] = 1;
+  dtsinfo->rank[3] = 1;
+  
+  dtsinfo->array[0] = 0;
+  dtsinfo->array[1] = 0;
+  dtsinfo->array[2] = 0;
+  dtsinfo->array[3] = 1;
+  
+  dtsinfo->offset[0] = HOFFSET(InputData3, time);
+  dtsinfo->offset[1] = HOFFSET(InputData3, rain);
+  dtsinfo->offset[2] = HOFFSET(InputData3, temp);
+  dtsinfo->offset[3] = HOFFSET(InputData3, id);
+
+  dtsinfo->dtype[0] = H5T_NATIVE_DOUBLE;
+  dtsinfo->dtype[1] = H5T_NATIVE_FLOAT;
+  dtsinfo->dtype[2] = H5T_NATIVE_FLOAT;
+  dtsinfo->dtype[3] = H5T_NATIVE_CHAR;
+  
+  for (i = 0; i < 4; i++)
+	dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char));
+  
+  strcpy(dtsinfo->fieldname[0],"Time");
+  strcpy(dtsinfo->fieldname[1],"Rainfall");
+  strcpy(dtsinfo->fieldname[2],"Temperature");
+  strcpy(dtsinfo->fieldname[3],"ID");
+  
+  dtsinfo->dims[0][0] = 1;
+  dtsinfo->dims[1][0] = 1;
+  dtsinfo->dims[2][0] = 1;
+  dtsinfo->dims[3][0] = 8;
+  
+  dtsinfo->datasize = (size_t)sizeof(InputData3);
+  
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdeflevel                             *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdeflevel... \n"););
+  MESSAGE(4,printf("\t========================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdeflevel... \n"););   
+  MESSAGE(11,fprintf(fp,"\t========================= \n"););
+  
+  MESSAGE(6,printf("\t\tDefining level \"Observations\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDefining level \"Observations\" \n"););
+  status = HE5_PTdeflevel(PTid2, "Observations", dtsinfo);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdeflevel();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdeflevel()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdeflevel();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdeflevel()          %d\n",status););
+	}
+
+  for (i = 0; i < 4; i++)
+	free(dtsinfo->fieldname[i]);
+  
+  free(dtsinfo);
+  
+  
+  /*
+   *********************************************************************************
+   *                           Testing  HE5_PTdeflinkage                           *
+   *********************************************************************************
+   */
+   
+  MESSAGE(4,printf("\tTesting HE5_PTdeflinkage... \n"););
+  MESSAGE(4,printf("\t=========================== \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdeflinkage... \n"););   
+  MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+  
+  MESSAGE(6,printf("\t\tDefining linkage between levels \"Desc-Loc\" and \"Observations\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDefining linkage between levels \"Desc-Loc\" and \"Observations\" \n"););
+  
+  status = HE5_PTdeflinkage(PTid2, "Desc-Loc", "Observations", "ID");
+  if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_PTdeflinkage();\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_PTdeflinkage()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdeflinkage();\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdeflinkage()          %d\n",status););
+	 }
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdetach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdetach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tDetaching from the  point \"FixedBuoy Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDetaching from the  point \"FixedBuoy Point\" \n"););
+  
+  status = HE5_PTdetach(PTid2);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach()          %d\n",status););
+	}
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTattach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTattach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+  MESSAGE(6,printf("\t\tAttaching to the  point \"FloatBuoy Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tAttaching to the  point \"FloatBuoy Point\"  \n"););
+   
+  PTid3 = HE5_PTattach(ptfid, "FloatBuoy Point"); 
+  if (PTid3 == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tPTid3 = HE5_PTattach(ptfid, \"FloatBuoy Point\");\n"););
+	  MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid3););
+	  MESSAGE(11,fprintf(fp,"\t\tPTid3 = HE5_PTattach(ptfid, \"FloatBuoy Point\");\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid3) ;);
+	}
+
+
+  dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo));
+  
+  /* Set up level data structure */
+  /* --------------------------- */
+  dtsinfo->nfields = 4;
+  
+  dtsinfo->rank[0] = 1;
+  dtsinfo->rank[1] = 1;
+  dtsinfo->rank[2] = 1;
+  dtsinfo->rank[3] = 1;
+  
+  dtsinfo->array[0] = 1;
+  dtsinfo->array[1] = 0;
+  dtsinfo->array[2] = 0;
+  dtsinfo->array[3] = 1;
+  
+  dtsinfo->offset[0] = HOFFSET(InputData4, label);
+  dtsinfo->offset[1] = HOFFSET(InputData4, date);
+  dtsinfo->offset[2] = HOFFSET(InputData4, weight);
+  dtsinfo->offset[3] = HOFFSET(InputData4, id);
+  
+  dtsinfo->dtype[0] = H5T_NATIVE_CHAR;
+  dtsinfo->dtype[1] = H5T_NATIVE_INT;
+  dtsinfo->dtype[2] = H5T_NATIVE_INT;
+  dtsinfo->dtype[3] = H5T_NATIVE_CHAR;
+  
+  for (i = 0; i < 4; i++)
+	dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char));
+  
+  strcpy(dtsinfo->fieldname[0],"Label");
+  strcpy(dtsinfo->fieldname[1],"DeployDate");
+  strcpy(dtsinfo->fieldname[2],"Weight");
+  strcpy(dtsinfo->fieldname[3],"ID");
+  
+  dtsinfo->dims[0][0] = 8;
+  dtsinfo->dims[1][0] = 1;
+  dtsinfo->dims[2][0] = 1;
+  dtsinfo->dims[3][0] = 8;
+
+  dtsinfo->datasize = (size_t)sizeof(InputData4);
+  
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdeflevel                             *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdeflevel... \n"););
+  MESSAGE(4,printf("\t========================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdeflevel... \n"););   
+  MESSAGE(11,fprintf(fp,"\t========================= \n"););
+  
+  MESSAGE(6,printf("\t\tDefining level \"Description\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDefining level \"Description\" \n"););
+  status = HE5_PTdeflevel(PTid3, "Description", dtsinfo);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdeflevel();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdeflevel()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdeflevel();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdeflevel()          %d\n",status););
+	}
+
+  for (i = 0; i < 4; i++)
+	free(dtsinfo->fieldname[i]);
+  
+  free(dtsinfo);
+  
+  
+  dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo));
+  
+  /* Set up level data structure */
+  /* --------------------------- */
+  dtsinfo->nfields = 6;
+  
+  dtsinfo->rank[0] = 1;
+  dtsinfo->rank[1] = 1;
+  dtsinfo->rank[2] = 1;
+  dtsinfo->rank[3] = 1;
+  dtsinfo->rank[4] = 1;
+  dtsinfo->rank[5] = 1;
+  
+  dtsinfo->array[0] = 0;
+  dtsinfo->array[1] = 0;
+  dtsinfo->array[2] = 0;
+  dtsinfo->array[3] = 0;
+  dtsinfo->array[4] = 0;
+  dtsinfo->array[5] = 1;
+ 
+  dtsinfo->offset[0] = HOFFSET(InputData5, time);
+  dtsinfo->offset[1] = HOFFSET(InputData5, lon);
+  dtsinfo->offset[2] = HOFFSET(InputData5, lat);
+  dtsinfo->offset[3] = HOFFSET(InputData5, rain);
+  dtsinfo->offset[4] = HOFFSET(InputData5, temp);
+  dtsinfo->offset[5] = HOFFSET(InputData5, id);
+  
+  dtsinfo->dtype[0] = H5T_NATIVE_DOUBLE;
+  dtsinfo->dtype[1] = H5T_NATIVE_DOUBLE;
+  dtsinfo->dtype[2] = H5T_NATIVE_DOUBLE;
+  dtsinfo->dtype[3] = H5T_NATIVE_FLOAT;
+  dtsinfo->dtype[4] = H5T_NATIVE_FLOAT;
+  dtsinfo->dtype[5] = H5T_NATIVE_CHAR;
+  for (i = 0; i < 6; i++)
+	dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char));
+  
+  strcpy(dtsinfo->fieldname[0],"Time");
+  strcpy(dtsinfo->fieldname[1],"Longitude");
+  strcpy(dtsinfo->fieldname[2],"Latitude");
+  strcpy(dtsinfo->fieldname[3],"Rainfall");
+  strcpy(dtsinfo->fieldname[4],"Temperature");
+  strcpy(dtsinfo->fieldname[5],"ID");
+  
+  dtsinfo->dims[0][0] = 1;
+  dtsinfo->dims[1][0] = 1;
+  dtsinfo->dims[2][0] = 1;
+  dtsinfo->dims[3][0] = 1;
+  dtsinfo->dims[4][0] = 1;
+  dtsinfo->dims[5][0] = 8;
+  
+  dtsinfo->datasize = (size_t)sizeof(InputData5);
+  
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdeflevel                             *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdeflevel... \n"););
+  MESSAGE(4,printf("\t========================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdeflevel... \n"););   
+  MESSAGE(11,fprintf(fp,"\t========================= \n"););
+  
+  MESSAGE(6,printf("\t\tDefining level \"Measurements\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDefining level \"Measurements\" \n"););
+  status = HE5_PTdeflevel(PTid3, "Measurements", dtsinfo);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdeflevel();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdeflevel()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdeflevel();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdeflevel()          %d\n",status););
+	}
+
+  for (i = 0; i < 6; i++)
+	free(dtsinfo->fieldname[i]);      
+  
+  free(dtsinfo);
+  
+
+
+  
+  /*
+   *********************************************************************************
+   *                           Testing  HE5_PTdeflinkage                           *
+   *********************************************************************************
+   */
+   
+  MESSAGE(4,printf("\tTesting HE5_PTdeflinkage... \n"););
+  MESSAGE(4,printf("\t=========================== \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdeflinkage... \n"););   
+  MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+  
+  MESSAGE(6,printf("\t\tDefining linkage between levels \"Description\" and \"Measurements\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDefining linkage between levels \"Description\" and \"Measurements\" \n"););
+  
+  status = HE5_PTdeflinkage(PTid3, "Description", "Measurements", "ID");
+  if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_PTdeflinkage();\n"););
+       MESSAGE(8,printf("\t\tStatus returned by HE5_PTdeflinkage()           %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdeflinkage();\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdeflinkage()          %d\n",status););
+	 }
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdetach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdetach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tDetaching from the  point \"FloatBuoy Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDetaching from the  point \"FloatBuoy Point\" \n"););
+  
+  status = HE5_PTdetach(PTid3);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach()          %d\n",status););
+	}
+
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTattach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTattach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+  MESSAGE(6,printf("\t\tAttaching to the  point \"Simple Point\" \n"););   
+   MESSAGE(11,fprintf(fp,"\t\tAttaching to the  point \"Simple Point\"  \n"););
+   
+  PTid1 = HE5_PTattach(ptfid, "Simple Point"); 
+  if (PTid1 == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n"););
+	  MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid1););
+	  MESSAGE(11,fprintf(fp,"\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid1) ;);
+	}
+
+
+  setup_namebuf(namebuf, "simple.txt");
+  fp_in = fopen(namebuf, "r");
+    
+  n = 0;
+  while(fscanf(fp_in, "%lf %f %f %f %f %s", &time, &conc[0], &conc[1], &conc[2], &conc[3], spc) != -1)
+    {
+	  datbuf_1[n].time    = time;
+	  datbuf_1[n].concentr[0] = conc[0];
+	  datbuf_1[n].concentr[1] = conc[1];
+	  datbuf_1[n].concentr[2] = conc[2];
+	  datbuf_1[n].concentr[3] = conc[3];
+	  memmove(datbuf_1[n].spec, spc, sizeof(char)*strlen(spc));
+	  datbuf_1[n].spec[strlen(spc)] = 0;
+	  n++;
+    }
+  
+  fclose(fp_in);
+    
+  datasize = (size_t)sizeof(InputData1);
+  count[0] = n;
+ 
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTwritelevel                       *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTwritelevel... \n"););
+  MESSAGE(4,printf("\t=========================== \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwritelevel... \n"););   
+  MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+  
+  MESSAGE(6,printf("\n"););  
+  MESSAGE(6,printf("\t\tWriting records to the  point \"Simple Point\" level 0 \n"););   
+  
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tWriting records to the  point \"Simple Point\" level 0 \n"););
+   
+  status = HE5_PTwritelevel(PTid1, 0, count, &datasize, datbuf_1);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTwritelevel();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTwritelevel()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwritelevel();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwritelevel()          %d\n",status););
+	}
+   
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdetach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdetach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tDetaching from the  point \"Simple Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDetaching from the  point \"Simple Point\" \n"););
+  
+  status = HE5_PTdetach(PTid1);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach()          %d\n",status););
+	}
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTattach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTattach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+  MESSAGE(6,printf("\t\tAttaching to the  point \"FixedBuoy Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tAttaching to the  point \"FixedBuoy Point\"  \n"););
+  
+  PTid2 = HE5_PTattach(ptfid, "FixedBuoy Point"); 
+  if (PTid2 == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n"););
+	  MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid2););
+	  MESSAGE(11,fprintf(fp,"\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid2) ;);
+	}
+  
+  setup_namebuf(namebuf, "fixedBuoy0.txt");
+  fp_in = fopen(namebuf, "r");
+  
+  n = 0;
+  while(fscanf(fp_in, "%s %lf %lf %d  %s", desc, &lon, &lat, &date, id) != -1)
+    {
+	  strcpy(datbuf_2[n].label, desc);
+	  datbuf_2[n].lon     = lon;
+	  datbuf_2[n].lat     = lat;
+	  datbuf_2[n].date    = date;
+	  memmove(datbuf_2[n].id, id, sizeof(char)*strlen(id));
+	  datbuf_2[n].id[strlen(id)] = 0;
+	  n++;
+    }
+  
+  fclose(fp_in);
+    
+  datasize = (size_t)sizeof(InputData2);
+  count[0] = n;
+
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTwritelevel                       *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTwritelevel... \n"););
+  MESSAGE(4,printf("\t=========================== \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwritelevel... \n"););   
+  MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+  
+  MESSAGE(6,printf("\n"););  
+  MESSAGE(6,printf("\t\tWriting records to the  point \"FixedBuoy Point\" level 0 \n"););   
+  
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tWriting records to the  point \"FixedBuoy Point\" level 0 \n"););
+   
+  status = HE5_PTwritelevel(PTid2, 0, count, &datasize, datbuf_2);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTwritelevel();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTwritelevel()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwritelevel();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwritelevel()          %d\n",status););
+	}
+   
+
+  setup_namebuf(namebuf, "fixedBuoy1.txt");
+  fp_in = fopen(namebuf, "r");
+  
+  n = 0;
+  while(fscanf(fp_in, "%lf %f %f %s", &time, &rain, &temp, id) != -1)
+    {
+	  datbuf_3[n].time = time;
+	  datbuf_3[n].rain = rain;
+	  datbuf_3[n].temp = temp;
+	  memmove(datbuf_3[n].id, id, sizeof(char)*strlen(id));
+	  datbuf_3[n].id[strlen(id)] = 0;
+	  n++;
+    }
+  
+  fclose(fp_in);
+  
+  datasize = (size_t)sizeof(InputData3);
+  count[0] = n;
+  
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTwritelevel                       *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTwritelevel... \n"););
+  MESSAGE(4,printf("\t=========================== \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwritelevel... \n"););   
+  MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+  
+  MESSAGE(6,printf("\n"););  
+  MESSAGE(6,printf("\t\tWriting records to the  point \"FixedBuoy Point\" level 1 \n"););   
+  
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tWriting records to the  point \"FixedBuoy Point\" level 1 \n"););
+   
+  status = HE5_PTwritelevel(PTid2, 1, count, &datasize, datbuf_3);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTwritelevel();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTwritelevel()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwritelevel();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwritelevel()          %d\n",status););
+	}
+
+
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTwriteattr                        *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTwriteattr... \n"););
+  MESSAGE(4,printf("\t========================== \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwriteattr... \n"););   
+  MESSAGE(11,fprintf(fp,"\t========================== \n"););
+  
+  MESSAGE(6,printf("\n"););  
+  MESSAGE(6,printf("\t\tWriting attribute to the  point \"FixedBuoy Point\" \n"););   
+  
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tWriting attribute to the  point \"FixedBuoy Point\" \n"););
+   
+  count[0] = 1;
+  status = HE5_PTwriteattr(PTid2, "GlobalAttr_Integer", H5T_NATIVE_INT, count, &IntAttr);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTwriteattr();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTwriteattr()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwriteattr();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwriteattr()          %d\n",status););
+	}
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTwriteattr                        *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTwriteattr... \n"););
+  MESSAGE(4,printf("\t========================== \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwriteattr... \n"););   
+  MESSAGE(11,fprintf(fp,"\t========================== \n"););
+  
+  MESSAGE(6,printf("\n"););  
+  MESSAGE(6,printf("\t\tWriting attribute to the  point \"FixedBuoy Point\" \n"););   
+  
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tWriting attribute to the  point \"FixedBuoy Point\" \n"););
+   
+  count[0] = 1;
+  status = HE5_PTwriteattr(PTid2, "GlobalAttribute_int", H5T_NATIVE_INT, count, &attr);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTwriteattr();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTwriteattr()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwriteattr();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwriteattr()          %d\n",status););
+	}
+
+
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTwritegrpattr                     *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTwritegrpattr... \n"););
+  MESSAGE(4,printf("\t============================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwritegrpattr... \n"););   
+  MESSAGE(11,fprintf(fp,"\t============================= \n"););
+  
+  MESSAGE(6,printf("\n"););  
+  MESSAGE(6,printf("\t\tWriting group attribute to the  point \"FixedBuoy Point\" \n"););   
+  
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tWriting group attribute to the  point \"FixedBuoy Point\" \n"););
+   
+  count[0] = 5;
+  status = HE5_PTwritegrpattr(PTid2, "GroupAttribute", H5T_NATIVE_INT, count, attr1);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTwritegrpattr();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTwritegrpattr()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwritegrpattr();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwritegrpattr()          %d\n",status););
+	}
+
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTwritelocattr                     *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTwritelocattr... \n"););
+  MESSAGE(4,printf("\t============================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwritelocattr... \n"););   
+  MESSAGE(11,fprintf(fp,"\t============================= \n"););
+  
+  MESSAGE(6,printf("\n"););  
+  MESSAGE(6,printf("\t\tWriting local attribute to the  point \"FixedBuoy Point\" \n"););   
+  
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tWriting local attribute to the  point \"FixedBuoy Point\" \n"););
+   
+  status = HE5_PTwritelocattr(PTid2, "Observations", "LocalAttribute", H5T_NATIVE_INT, count, attr2);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTwritelocattr();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTwritelocattr()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwritelocattr();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwritelocattr()          %d\n",status););
+	}
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdetach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdetach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tDetaching from the  point \"FixedBuoy Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDetaching from the  point \"FixedBuoy Point\" \n"););
+  
+  status = HE5_PTdetach(PTid2);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach()          %d\n",status););
+	}
+
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTattach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTattach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+  MESSAGE(6,printf("\t\tAttaching to the  point \"FloatBuoy Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tAttaching to the  point \"FloatBuoy Point\"  \n"););
+   
+  PTid3 = HE5_PTattach(ptfid, "FloatBuoy Point"); 
+  if (PTid3 == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tPTid3 = HE5_PTattach(ptfid, \"FloatBuoy Point\");\n"););
+	  MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid3););
+	  MESSAGE(11,fprintf(fp,"\t\tPTid3 = HE5_PTattach(ptfid, \"FloatBuoy Point\");\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid3) ;);
+	}
+
+  setup_namebuf(namebuf, "floatBuoy0.txt");
+  fp_in = fopen(namebuf, "r");
+ 
+  n = 0;
+  while(fscanf(fp_in, "%s %d %d %s", desc, &date, &wgt, id) != -1)
+    {
+	  strcpy(datbuf_4[n].label, desc);
+	  datbuf_4[n].date   = date;
+	  datbuf_4[n].weight = wgt;
+	  memmove(datbuf_4[n].id, id, sizeof(char)*strlen(id));
+      datbuf_4[n].id[strlen(id)] = 0;
+	  n++;
+    }
+
+  fclose(fp_in);
+  
+  datasize = (size_t)sizeof(InputData4);
+
+
+  count[0] = n;
+
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTwritelevel                       *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTwritelevel... \n"););
+  MESSAGE(4,printf("\t=========================== \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwritelevel... \n"););   
+  MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+  
+  MESSAGE(6,printf("\n"););  
+  MESSAGE(6,printf("\t\tWriting records to the  point \"FloatBuoy Point\" level 0 \n"););   
+  
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tWriting records to the  point \"FloatBuoy Point\" level 0 \n"););
+   
+  status = HE5_PTwritelevel(PTid3, 0, count, &datasize, datbuf_4);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTwritelevel();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTwritelevel()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwritelevel();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwritelevel()          %d\n",status););
+	}
+
+
+  setup_namebuf(namebuf, "floatBuoy1.txt");
+  fp_in = fopen(namebuf, "r");
+ 
+  n = 0;
+  while(fscanf(fp_in, "%lf %lf %lf %f %f %s", &time, &lon, &lat, &rain, &temp, id) != -1)
+    {
+	  datbuf_5[n].time = time;
+	  datbuf_5[n].lon  = lon;
+	  datbuf_5[n].lat  = lat;
+	  datbuf_5[n].rain = rain;
+	  datbuf_5[n].temp = temp;
+	  memmove(datbuf_5[n].id, id,sizeof(char)*strlen(id));
+      datbuf_5[n].id[strlen(id)] = 0;
+	  n++;
+    }
+
+  fclose(fp_in);
+ 
+  datasize = (size_t)sizeof(InputData5);
+  count[0] = n; 
+
+
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTwritelevel                       *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTwritelevel... \n"););
+  MESSAGE(4,printf("\t=========================== \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwritelevel... \n"););   
+  MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+  
+  MESSAGE(6,printf("\n"););  
+  MESSAGE(6,printf("\t\tWriting records to the  point \"FloatBuoy Point\" level 1 \n"););   
+  
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tWriting records to the  point \"FloatBuoy Point\" level 1 \n"););
+   
+  status = HE5_PTwritelevel(PTid3, 1, count, &datasize, datbuf_5);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTwritelevel();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTwritelevel()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwritelevel();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwritelevel()          %d\n",status););
+	}
+
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTwriteattr                        *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTwriteattr... \n"););
+  MESSAGE(4,printf("\t========================== \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwriteattr... \n"););   
+  MESSAGE(11,fprintf(fp,"\t========================== \n"););
+  
+  MESSAGE(6,printf("\n"););  
+  MESSAGE(6,printf("\t\tWriting attribute to the  point \"FloatBuoy Point\" \n"););   
+  
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tWriting attribute to the  point \"FloatBuoy Point\" \n"););
+   
+  count[0] = 1;
+  status = HE5_PTwriteattr(PTid3, "GlobalAttr", H5T_NATIVE_FLOAT, count, &flt);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTwriteattr();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTwriteattr()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwriteattr();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwriteattr()          %d\n",status););
+	}
+
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTwriteattr                        *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTwriteattr... \n"););
+  MESSAGE(4,printf("\t========================== \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwriteattr... \n"););   
+  MESSAGE(11,fprintf(fp,"\t========================== \n"););
+  
+  MESSAGE(6,printf("\n"););  
+  MESSAGE(6,printf("\t\tWriting attribute to the  point \"FloatBuoy Point\" \n"););   
+  
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tWriting attribute to the  point \"FloatBuoy Point\" \n"););
+   
+  count[0] = 1;
+  status = HE5_PTwriteattr(PTid3, "GlobalAttribute_float", H5T_NATIVE_FLOAT, count, &flt);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTwriteattr();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTwriteattr()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwriteattr();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwriteattr()          %d\n",status););
+	}
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdetach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdetach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tDetaching from the  point \"FloatBuoy Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDetaching from the  point \"FloatBuoy Point\" \n"););
+  
+  status = HE5_PTdetach(PTid3);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach()          %d\n",status););
+	}
+  
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTclose                            *
+   *********************************************************************************
+   */
+
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_PTclose... \n"););
+   MESSAGE(4,printf("\t====================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_PTclose... \n"););
+   MESSAGE(11,fprintf(fp,"\t====================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tClosing the file \"SimplePoint.h5\" \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tClosing the file \"SimplePoint.h5\" \n"););
+   
+   status = HE5_PTclose(ptfid);
+   if (status == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+	   errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\t\tSuccessfully clossed the \"SimplePoint.h5\" file \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tSuccessfully clossed the \"SimplePoint.h5\" file \n"););
+	 }
+   
+
+  /*
+   *********************************************************************************
+   *                          Testing   HE5_PTopen                                 *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTopen... \n"););
+  MESSAGE(4,printf("\t===================== \n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTopen... \n"););
+  MESSAGE(11,fprintf(fp,"\t===================== \n"););  
+  ptfid = HE5_PTopen("SimplePoint.h5",H5F_ACC_RDWR);
+  if (ptfid == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\t\t*** Successfully re-opened the point file ****\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t*** Successfully re-opened the point file ****\n"););
+	}
+  
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTattach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTattach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+  MESSAGE(6,printf("\t\tAttaching to the  point \"Simple Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tAttaching to the  point \"Simple Point\"  \n"););
+   
+  PTid1 = HE5_PTattach(ptfid, "Simple Point"); 
+  if (PTid1 == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n"););
+	  MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid1););
+	  MESSAGE(11,fprintf(fp,"\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid1) ;);
+	}
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTlevelinfo                            *
+   *********************************************************************************
+   */
+  
+   MESSAGE(4,printf("\tTesting HE5_PTlevelinfo... \n"););
+   MESSAGE(4,printf("\t========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_PTlevelinfo... \n"););   
+   MESSAGE(11,fprintf(fp,"\t========================== \n"););
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tRetrieving level information  for point \"Simple Point\" \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieving level information  for point \"Simple Point\" \n"););
+   
+
+   status = HE5_PTlevelinfo(PTid1, 0, &level);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+       errcnt++;
+	 }
+   else
+	 {
+	   nflds = level.nfields;
+
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\t status = HE5_PTlevelinfo();\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_PTlevelinfo()           %d\n", status););
+       MESSAGE(8,printf("\t\tNumber of fields in level:           %d\n", nflds););
+	   for (i = 0; i < nflds; i++)
+		 {
+		   MESSAGE(8,printf("Field name:                  %s \n", level.fieldname[i]););
+		   MESSAGE(8,printf("Field rank:                  %d \n", level.rank[i]););
+		   MESSAGE(8,printf("Field type ID:               %d \n", level.dtype[i]););
+		   for (j = 0; j < level.rank[i]; j++)
+			 MESSAGE(8,printf("Field dims:                  %d \n", (int)level.dims[i][j]););
+		   MESSAGE(8,printf("Field class:                 %d \n", level.dclass[i]););
+		 }
+
+	   MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTlevelinfo(); \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_PTlevelinfo()            %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of fields in level:           %d\n", nflds););
+	   for (i = 0; i < nflds; i++)
+		 {
+		   MESSAGE(11,fprintf(fp,"Field name:                  %s \n", level.fieldname[i]););
+		   MESSAGE(11,fprintf(fp,"Field rank:                  %d \n", level.rank[i]););
+		   MESSAGE(11,fprintf(fp,"Field type ID:               %d \n", level.dtype[i]););
+		   for (j = 0; j < level.rank[i]; j++)
+			 MESSAGE(11,fprintf(fp,"Field dims:                  %d \n", (int)level.dims[i][j]););
+		   MESSAGE(11,fprintf(fp,"Field class:                 %d \n", level.dclass[i]););
+		 }
+	 }
+  
+  
+  
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTnrecs                            *
+   *********************************************************************************
+   */
+   
+  MESSAGE(4,printf("\tTesting HE5_PTnrecs... \n"););
+  MESSAGE(4,printf("\t====================== \n"););
+   
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTnrecs... \n"););   
+  MESSAGE(11,fprintf(fp,"\t====================== \n"););
+  MESSAGE(6,printf("\n"););   
+  MESSAGE(6,printf("\t\tRetrieving number of records in level 0 in point \"Simple Point\' \n"););
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tRetrieving number of records in level 0 in  point \"Simple Point\" \n"););
+   
+  nrecs = HE5_PTnrecs(PTid1, 0);
+  if (nrecs == 0)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tnrecs = HE5_PTnrecs();\n"););
+	  MESSAGE(8,printf("\t\tNumber of records returned by HE5_PTnrecs():   %lu \n",(unsigned long)nrecs););
+	  MESSAGE(11,fprintf(fp,"\t\tnrecs = HE5_PTnrecs();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tNumber of records returned by HE5_PTnrecs():   %lu \n", (unsigned long)nrecs););
+	}
+  
+  datasize          = (size_t)sizeof(Sensor);
+  inInfo.nfields    = nflds;
+  inInfo.datasize   = (size_t)sizeof(Sensor);
+  inInfo.rank[0]    = 1;
+  inInfo.rank[1]    = 1;
+  inInfo.rank[2]    = 1;  
+  inInfo.offset[0]  = HOFFSET(Sensor, time);
+  inInfo.offset[1]  = HOFFSET(Sensor, con);
+  inInfo.offset[2]  = HOFFSET(Sensor, spec); 
+  inInfo.dtype[0]   = H5T_NATIVE_DOUBLE;
+  inInfo.dtype[1]   = H5T_NATIVE_FLOAT;
+  inInfo.dtype[2]   = H5T_NATIVE_CHAR;
+  inInfo.dclass[0]  = H5T_NO_CLASS;
+  inInfo.dclass[1]  = H5T_NO_CLASS;
+  inInfo.dclass[2]  = H5T_NO_CLASS;
+  inInfo.dims[0][0] = 1;
+  inInfo.dims[1][0] = 4;
+  inInfo.dims[2][0] = 8;
+  inInfo.array[0]   = 0;
+  inInfo.array[1]   = 1;
+  inInfo.array[2]   = 1;
+  
+  for( i = 0; i < nflds; i++)
+	{
+	  inInfo.fieldname[i] = (char *)calloc(64, sizeof(char));
+	  strcpy(inInfo.fieldname[i], level.fieldname[i]);
+	}
+ 
+
+
+  /*
+   *********************************************************************************
+   *                             Testing  HE5_PTreadlevel                          *
+   *********************************************************************************
+   */
+   
+  MESSAGE(4,printf("\tTesting HE5_PTreadlevel... \n"););
+  MESSAGE(4,printf("\t========================== \n"););
+   
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTreadlevel... \n"););   
+  MESSAGE(11,fprintf(fp,"\t========================== \n"););
+  MESSAGE(6,printf("\n"););   
+  MESSAGE(6,printf("\t\tRetrieving field values for point \"Simple Point\" \n"););
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tRetrieving field values for point \"Simple Point\" \n"););
+  
+  status = HE5_PTreadlevel(PTid1, 0, &inInfo, &datasize, s);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTreadlevel();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTreadlevel()           %d\n", status););
+	  MESSAGE(8,printf("\n"););
+	  for (i = 0; i < nrecs; i++)
+		{
+		  MESSAGE(8,printf("%lf  %f  %f  %f  %f  %s\n", s[i].time, s[i].con[0], s[i].con[1],s[i].con[2], s[i].con[3], s[i].spec););
+		  MESSAGE(11,fprintf(fp,"%lf  %f  %f  %f  %f  %s\n", s[i].time, s[i].con[0], s[i].con[1],s[i].con[2], s[i].con[3], s[i].spec););
+		}
+	}
+
+  for (i = 0; i < nflds; i++)
+	if (inInfo.fieldname[i] != NULL) free(inInfo.fieldname[i]);
+  
+  datasize           = (size_t)sizeof(double);
+  inInfo2.nfields    = 1;
+  inInfo2.datasize   = (size_t)sizeof(double);
+  inInfo2.rank[0]    = 1;
+  inInfo2.offset[0]  = 0;
+  inInfo2.dtype[0]   = H5T_NATIVE_DOUBLE;
+  inInfo2.dclass[0]  = H5T_FLOAT;
+  inInfo2.dims[0][0] = 1;
+  inInfo2.array[0]   = 0;
+ 
+  inInfo2.fieldname[0] = (char *)calloc(64, sizeof(char));
+  strcpy(inInfo2.fieldname[0], level.fieldname[0]);
+ 
+
+
+  /*
+   *********************************************************************************
+   *                             Testing  HE5_PTreadlevel                          *
+   *********************************************************************************
+   */
+   
+  MESSAGE(4,printf("\tTesting HE5_PTreadlevel... \n"););
+  MESSAGE(4,printf("\t========================== \n"););
+   
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTreadlevel... \n"););   
+  MESSAGE(11,fprintf(fp,"\t========================== \n"););
+  MESSAGE(6,printf("\n"););   
+  MESSAGE(6,printf("\t\tRetrieving field values for point \"Simple Point\" \n"););
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tRetrieving field values for point \"Simple Point\" \n"););
+  
+  status = HE5_PTreadlevel(PTid1, 0, &inInfo2, &datasize, s1);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTreadlevel();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTreadlevel()           %d\n", status););
+	  MESSAGE(8,printf("\n"););
+	  for (i = 0; i < nrecs; i++)
+		{
+		  MESSAGE(8,printf("%lf \n", s1[i]););
+		  MESSAGE(11,fprintf(fp,"%lf \n", s1[i]););
+		}
+	}
+
+  if (inInfo2.fieldname[0] != NULL) 
+	free(inInfo2.fieldname[0]);
+  
+  for (i = 0; i < nflds; i++)
+	if(level.fieldname[i] != NULL) free(level.fieldname[i]);
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdetach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdetach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tDetaching from the  point \"Simple Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDetaching from the  point \"Simple Point\" \n"););
+  
+  status = HE5_PTdetach(PTid1);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach()          %d\n",status););
+	}
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTattach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTattach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+  MESSAGE(6,printf("\t\tAttaching to the  point \"FixedBuoy Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tAttaching to the  point \"FixedBuoy Point\"  \n"););
+   
+  PTid2 = HE5_PTattach(ptfid, "FixedBuoy Point"); 
+  if (PTid2 == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n"););
+	  MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid2););
+	  MESSAGE(11,fprintf(fp,"\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid2) ;);
+	}
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTinqattrs                             *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTinqattrs... \n"););
+  MESSAGE(4,printf("\t========================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTinqattrs... \n"););   
+  MESSAGE(11,fprintf(fp,"\t========================= \n"););
+  MESSAGE(6,printf("\n"););   
+  MESSAGE(6,printf("\t\tRetrieving the number of attributes in the point \"FixedBuoy Point\".\n"););
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tRetrieving the number of attributes in the  point \"FixedBuoy Point\".\n"););
+  
+  nattr  = HE5_PTinqattrs(PTid2, NULL, &strbufsize);
+  if (nattr < 0)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(8,printf("\t\tnattr = HE5_PTinqattrs();\n"););
+	  MESSAGE(8,printf("\t\tNumber of attributes returned by HE5_PTinqattrs():     %li\n", nattr););
+	  MESSAGE(8,printf("\t\tString length of the attribute list:     %li\n", strbufsize););
+	  MESSAGE(11,fprintf(fp,"\t\tnattr = HE5_PTinqattrs();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tNumber of attributes returned by HE5_PTinqattrs():    %li\n", nattr););
+	  MESSAGE(11,fprintf(fp,"\t\tString length of the attribute list:     %li\n", strbufsize););
+	}
+
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTreadattr                         *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTreadattr... \n"););
+  MESSAGE(4,printf("\t========================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTreadattr... \n"););   
+  MESSAGE(11,fprintf(fp,"\t========================= \n"););
+  
+  MESSAGE(6,printf("\n"););  
+  MESSAGE(6,printf("\t\tReading value of the attribute \"GlobalAttr_Integer\" in the point \"FixedBuoy Point\" \n"););   
+  
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tReading value of the attribute \"GlobalAttr_Integer\" in the point \"FixedBuoy Point\" \n"););
+   
+  status = HE5_PTreadattr(PTid2, "GlobalAttr_Integer", &IntAttr);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTreadattr();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTreadattr()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTreadattr();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTreadattr()        %d\n",status););
+	  MESSAGE(8,printf("\n"););
+	  MESSAGE(8,printf("\t\t   Attribute value reads\n"););
+	  MESSAGE(8,printf("\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t  Attribute value reads\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(8,printf("\t\t        %d\n", IntAttr););
+	  MESSAGE(11,fprintf(fp,"\t\t       %d\n", IntAttr););
+	}
+  
+  
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdetach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdetach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tDetaching from the  point \"FixedBuoy Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDetaching from the  point \"FixedBuoy Point\" \n"););
+  
+  status = HE5_PTdetach(PTid2);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach()          %d\n",status););
+	}
+ 
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTclose                            *
+   *********************************************************************************
+   */
+
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_PTclose... \n"););
+   MESSAGE(4,printf("\t====================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_PTclose... \n"););
+   MESSAGE(11,fprintf(fp,"\t====================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tClosing the file \"SimplePoint.h5\" \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tClosing the file \"SimplePoint.h5\" \n"););
+   
+   status = HE5_PTclose(ptfid);
+   if (status == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+	   errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\t\tSuccessfully clossed the \"SimplePoint.h5\" file \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tSuccessfully clossed the \"SimplePoint.h5\" file \n"););
+	 }
+   
+
+  /*
+   *********************************************************************************
+   *                          Testing   HE5_PTopen                                 *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTopen... \n"););
+  MESSAGE(4,printf("\t===================== \n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTopen... \n"););
+  MESSAGE(11,fprintf(fp,"\t===================== \n"););  
+  ptfid = HE5_PTopen("SimplePoint.h5",H5F_ACC_RDWR);
+  if (ptfid == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\t\t*** Successfully re-opened the point file ****\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t*** Successfully re-opened the point file ****\n"););
+	}
+  
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTattach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTattach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+  MESSAGE(6,printf("\t\tAttaching to the  point \"Simple Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tAttaching to the  point \"Simple Point\"  \n"););
+   
+  PTid1 = HE5_PTattach(ptfid, "Simple Point"); 
+  if (PTid1 == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n"););
+	  MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid1););
+	  MESSAGE(11,fprintf(fp,"\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid1) ;);
+	}
+
+
+  /*
+   *********************************************************************************
+   *                        Testing    HE5_PTupdatelevel                           *
+   *********************************************************************************
+   */
+   
+  MESSAGE(4,printf("\tTesting HE5_PTupdatelevel... \n"););
+  MESSAGE(4,printf("\t============================ \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTupdatelevel... \n"););   
+  MESSAGE(11,fprintf(fp,"\t============================ \n"););
+  MESSAGE(6,printf("\n"););   
+  MESSAGE(6,printf("\t\tUpdating level \"Concentration\" in  point \"Simple Point\" \n"););
+  MESSAGE(11,fprintf(fp,"\n"););
+  MESSAGE(11,fprintf(fp,"\t\tUpdating level \"Concentration\" in  point \"Simple Point\" \n"););
+
+  recs[0]           = 0;
+  buf_1.time        = 13131313.0; 
+  buf_1.concentr[0] = 1.11;
+  buf_1.concentr[1] = 2.22;
+  buf_1.concentr[2] = 3.33;
+  buf_1.concentr[3] = 4.44;
+  strcpy(buf_1.spec,"AM");
+
+  status = HE5_PTupdatelevel(PTid1, 0, "Concentration", nrec, recs, &buf_1);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTupdatelevel();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTupdatelevel()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTupdatelevel();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTupdatelevel()          %d\n",status););
+	}
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdetach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdetach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tDetaching from the  point \"Simple Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDetaching from the  point \"Simple Point\" \n"););
+  
+  status = HE5_PTdetach(PTid1);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach()          %d\n",status););
+	}
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTattach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTattach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+  MESSAGE(6,printf("\t\tAttaching to the  point \"FixedBuoy Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tAttaching to the  point \"FixedBuoy Point\"  \n"););
+   
+  PTid2 = HE5_PTattach(ptfid, "FixedBuoy Point"); 
+  if (PTid2 == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n"););
+	  MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid2););
+	  MESSAGE(11,fprintf(fp,"\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach()           %d\n",PTid2) ;);
+	}
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTinqdatatype                          *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTinqdatatype... \n"););
+  MESSAGE(4,printf("\t============================ \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTinqdatatype... \n"););   
+  MESSAGE(11,fprintf(fp,"\t============================ \n"););
+   
+  MESSAGE(6,printf("\t\tInquiring datatype information for \"Observations\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tInquiring datatype information for \"Observations\"  \n"););
+   
+  fieldgroup = HE5_HDFE_DATAGROUP;
+  
+  status = HE5_PTinqdatatype(PTid2, "Observations", NULL, fieldgroup, &datatype, &classid, &order, &size);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTinqdatatype();\n"););
+	  MESSAGE(8,printf("\t\tThe status returned by HE5_PTinqdatatype()           %d\n",status););
+      MESSAGE(8,printf("\tdatatype:    %d \n", (int)datatype););
+      MESSAGE(8,printf("\tclass ID:    %d \n", (int)classid););
+      MESSAGE(8,printf("\tsize:        %d \n", (int)size););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTinqdatatype();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tThe status returned by HE5_PTinqdatatype()           %d\n",status) ;);
+      MESSAGE(11,fprintf(fp,"\tdatatype:    %d \n", (int)datatype););
+      MESSAGE(11,fprintf(fp,"\tclass ID:    %d \n", (int)classid););
+      MESSAGE(11,fprintf(fp,"\tsize:        %d \n", (int)size););
+	}
+ 
+  fieldgroup = HE5_HDFE_ATTRGROUP;
+  status = HE5_PTinqdatatype(PTid2, NULL, "GlobalAttribute_int", fieldgroup, &datatype, &classid, &order, &size);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTinqdatatype();\n"););
+	  MESSAGE(8,printf("\t\tThe status returned by HE5_PTinqdatatype()           %d\n",status););
+      MESSAGE(8,printf("\tdatatype:    %d \n", (int)datatype););
+      MESSAGE(8,printf("\tclass ID:    %d \n", (int)classid););
+      MESSAGE(8,printf("\torder:       %d \n", (int)order););
+      MESSAGE(8,printf("\tsize:        %d \n", (int)size););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTinqdatatype();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tThe status returned by HE5_PTinqdatatype()           %d\n",status) ;);
+      MESSAGE(11,fprintf(fp,"\tdatatype:    %d \n", (int)datatype););
+      MESSAGE(11,fprintf(fp,"\tclass ID:    %d \n", (int)classid););
+      MESSAGE(11,fprintf(fp,"\torder:       %d \n", (int)order););
+      MESSAGE(11,fprintf(fp,"\tsize:        %d \n", (int)size););
+	}
+
+  fieldgroup = HE5_HDFE_GRPATTRGROUP;
+  status = HE5_PTinqdatatype(PTid2, NULL, "GroupAttribute", fieldgroup, &datatype, &classid, &order, &size);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTinqdatatype();\n"););
+	  MESSAGE(8,printf("\t\tThe status returned by HE5_PTinqdatatype()           %d\n",status););
+      MESSAGE(8,printf("\tdatatype:    %d \n", (int)datatype););
+      MESSAGE(8,printf("\tclass ID:    %d \n", (int)classid););
+      MESSAGE(8,printf("\torder:       %d \n", (int)order););
+      MESSAGE(8,printf("\tsize:        %d \n", (int)size););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTinqdatatype();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tThe status returned by HE5_PTinqdatatype()           %d\n",status) ;);
+      MESSAGE(11,fprintf(fp,"\tdatatype:    %d \n", (int)datatype););
+      MESSAGE(11,fprintf(fp,"\tclass ID:    %d \n", (int)classid););
+      MESSAGE(11,fprintf(fp,"\torder:       %d \n", (int)order););
+      MESSAGE(11,fprintf(fp,"\tsize:        %d \n", (int)size););
+	}
+
+ 
+  fieldgroup = HE5_HDFE_LOCATTRGROUP;
+  status = HE5_PTinqdatatype(PTid2, "Observations", "LocalAttribute", fieldgroup, &datatype, &classid, &order, &size);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTinqdatatype();\n"););
+	  MESSAGE(8,printf("\t\tThe status returned by HE5_PTinqdatatype()           %d\n",status););
+      MESSAGE(8,printf("\tdatatype:    %d \n", (int)datatype););
+      MESSAGE(8,printf("\tclass ID:    %d \n", (int)classid););
+      MESSAGE(8,printf("\torder:       %d \n", (int)order););
+      MESSAGE(8,printf("\tsize:        %d \n", (int)size););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTinqdatatype();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tThe status returned by HE5_PTinqdatatype()           %d\n",status) ;);
+      MESSAGE(11,fprintf(fp,"\tdatatype:    %d \n", (int)datatype););
+      MESSAGE(11,fprintf(fp,"\tclass ID:    %d \n", (int)classid););
+      MESSAGE(11,fprintf(fp,"\torder:       %d \n", (int)order););
+      MESSAGE(11,fprintf(fp,"\tsize:        %d \n", (int)size););
+	}
+
+
+  /*
+   *********************************************************************************
+   *                         Testing    HE5_PTdetach                               *
+   *********************************************************************************
+   */
+  
+  MESSAGE(4,printf("\tTesting HE5_PTdetach... \n"););
+  MESSAGE(4,printf("\t======================= \n"););
+  
+  MESSAGE(11,fprintf(fp,"\t\n"););
+  MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n"););   
+  MESSAGE(11,fprintf(fp,"\t======================= \n"););
+  
+  MESSAGE(6,printf("\t\tDetaching from the  point \"FixedBuoy Point\" \n"););   
+  MESSAGE(11,fprintf(fp,"\t\tDetaching from the  point \"FixedBuoy Point\" \n"););
+  
+  status = HE5_PTdetach(PTid2);
+  if (status == FAIL)
+	{
+	  MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	  errcnt++;
+	}
+  else
+	{
+	  MESSAGE(4,printf("\n"););   
+	  MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	  MESSAGE(11,fprintf(fp,"\n"););
+	  MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	  MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach()           %d\n",status););
+	  MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n"););
+	  MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach()          %d\n",status););
+	}
+  
+
+
+
+  /*
+   *********************************************************************************
+   *                             Testing    HE5_PTclose                            *
+   *********************************************************************************
+   */
+
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_PTclose... \n"););
+   MESSAGE(4,printf("\t====================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_PTclose... \n"););
+   MESSAGE(11,fprintf(fp,"\t====================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tClosing the file \"SimplePoint.h5\" \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tClosing the file \"SimplePoint.h5\" \n"););
+   
+   status = HE5_PTclose(ptfid);
+   if (status == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+	   errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\t\tSuccessfully clossed the SimplePoint.h5 file \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tSuccessfully clossed the SimplePoint.h5 file \n"););
+	   MESSAGE(4,printf("\n"););
+	   MESSAGE(4,printf("\t ........... End of Testing. \n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t ............. End of Testing. \n"););
+	 }
+   
+   if (errcnt == 0)
+	 {
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\t\t A L L    T E S T S     P A S S E D \n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t A L L    T E S T S     P A S S E D \n"););
+           return_val = 0;
+	 }
+   else
+	 {
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\t\t%d    T E S T S     F A I L E D \n",errcnt););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t%d    T E S T S     F A I L E D \n",errcnt););
+           return_val = 1;
+	 }
+   
+  MESSAGE(11,fclose(fp););
+  return return_val;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/point/fixedBuoy0.txt b/testdrivers/point/fixedBuoy0.txt
new file mode 100755
index 0000000..2bd764a
--- /dev/null
+++ b/testdrivers/point/fixedBuoy0.txt
@@ -0,0 +1,3 @@
+Pacific  -140.2520148  -10.3024294 891218 P
+Atlantic  -54.8270879   43.1362228 900228 A 
+Indian     71.7147412    7.4254709 900912 I  
diff --git a/testdrivers/point/fixedBuoy1.txt b/testdrivers/point/fixedBuoy1.txt
new file mode 100755
index 0000000..ee1eee2
--- /dev/null
+++ b/testdrivers/point/fixedBuoy1.txt
@@ -0,0 +1,20 @@
+   83422000.0     1.1   21.63   P
+   83555918.7     0.7   24.21   A
+   83726878.2     2.7   23.83   P
+   83842994.7     4.3   22.63   P
+   84013712.3     0.7   20.35   A
+   84063571.3     2.8   20.84   P
+   84245234.1     1.7   24.52   I
+   84251741.0     1.4   20.98   I
+   84412971.8     3.6   20.41   A
+   84419483.0     1.8   22.01   P
+   84452408.0     3.4   23.20   P
+   84623981.3     4.0   23.91   I
+   84655020.8     3.2   21.79   A
+   84736992.5     4.6   23.61   P
+   84835587.2     3.6   20.38   A
+   84915081.1     5.1   20.10   P
+   84970587.0     1.1   24.63   P
+   85058206.4     1.3   22.98   I
+   85076367.6     2.7   22.62   P
+   85111729.5     1.0   22.01   P
diff --git a/testdrivers/point/fixedBuoy1s.txt b/testdrivers/point/fixedBuoy1s.txt
new file mode 100755
index 0000000..0e679a4
--- /dev/null
+++ b/testdrivers/point/fixedBuoy1s.txt
@@ -0,0 +1,20 @@
+   83555918.7     0.7   24.21   A
+   84013712.3     0.7   20.35   A
+   84412971.8     3.6   20.41   A
+   84655020.8     3.2   21.79   A
+   84835587.2     3.6   20.38   A
+   84245234.1     1.7   24.52   I
+   84251741.0     1.4   20.98   I
+   84623981.3     4.0   23.91   I
+   85058206.4     1.3   22.98   I
+   83422000.0     1.1   21.63   P
+   83726878.2     2.7   23.83   P
+   83842994.7     4.3   22.63   P
+   84063571.3     2.8   20.84   P
+   84419483.0     1.8   22.01   P
+   84452408.0     3.4   23.20   P
+   84736992.5     4.6   23.61   P
+   84915081.1     5.1   20.10   P
+   84970587.0     1.1   24.63   P
+   85076367.6     2.7   22.62   P
+   85111729.5     1.0   22.01   P
diff --git a/testdrivers/point/floatBuoy0.txt b/testdrivers/point/floatBuoy0.txt
new file mode 100755
index 0000000..e370dcf
--- /dev/null
+++ b/testdrivers/point/floatBuoy0.txt
@@ -0,0 +1,3 @@
+Pacific   901023   1200  P
+Atlantic  890419   2550  A
+Indian    900605    800  I
diff --git a/testdrivers/point/floatBuoy1.txt b/testdrivers/point/floatBuoy1.txt
new file mode 100755
index 0000000..0c17bd1
--- /dev/null
+++ b/testdrivers/point/floatBuoy1.txt
@@ -0,0 +1,25 @@
+   34532000.0   -56.795451    46.929101     3.5   22.74   A
+   34655930.8   -51.144523    39.393151     0.3   22.25   A
+   34761777.4    73.005232     4.068124     3.9   22.60   I
+   34924857.4   -51.289537    47.272357     0.6   24.23   A
+   35010197.1  -137.896588   -10.438813     3.1   23.24   P
+   35113965.3    70.943919     4.989471     3.7   21.05   I
+   35146430.0  -141.334164    -8.035026     0.9   23.16   P
+   35180802.9   -51.291848    47.940175     4.6   21.68   A
+   35286334.7  -141.921518    -9.133087     1.1   20.25   P
+   35359789.3  -139.960931   -11.797505     1.8   24.37   P
+   35510873.5   -56.995840    44.141150     3.7   23.12   A
+   35583198.0    73.083084    10.349487     3.0   24.63   I
+   35741969.4  -138.607937   -10.352329     4.3   24.05   P
+   35811504.6   -52.535794    38.967934     1.1   23.50   A
+   35890062.6    71.995167     6.438556     1.5   23.14   I
+   36015258.2   -51.100562    39.280490     1.9   20.31   A
+   36176650.2  -141.603094   -10.410025     2.9   21.33   P
+   36292709.9   -53.052534    44.477106     2.1   23.65   A
+   36307577.3   -53.937608    38.710016     5.0   20.06   A
+   36384294.9   -55.381183    41.246119     4.0   23.34   A
+   36576747.4  -141.588561    -9.158308     0.5   20.79   P
+   36725342.2   -51.199441    38.061798     2.4   20.01   A
+   36758333.4  -138.998487    -8.706307     0.3   22.07   P
+   36841499.9    72.256089     8.036737     3.9   24.41   I
+   37021357.5  -139.961167   -11.094212     0.6   23.02   P
diff --git a/testdrivers/point/hdfeos5.inc b/testdrivers/point/hdfeos5.inc
new file mode 100644
index 0000000..a6af5e8
--- /dev/null
+++ b/testdrivers/point/hdfeos5.inc
@@ -0,0 +1,411 @@
+! * ==========================================================
+! * File:       hdfeos5.inc
+! * Author:     A. Muslimov, Emergent Technology Services, Inc.
+! * Date:       March 11, 2002
+! * Purpose:    Fortran header file for HDFEOS5 routines
+! * ==========================================================
+! * Contents: 
+! *     HDFEOS5 data type tags
+! *     HDFEOS5 logical constants
+! *     HDFEOS5 file access tags
+! *     HDFEOS5/GCTP library codes   
+! *
+! * ===========================================================
+ 
+!          HDFEOS5  DATA TYPE TAGS 
+!          =======================
+
+           integer   HE5T_NATIVE_INT
+           integer   HE5T_NATIVE_UINT
+           integer   HE5T_NATIVE_SHORT
+           integer   HE5T_NATIVE_USHORT
+           integer   HE5T_NATIVE_SCHAR
+           integer   HE5T_NATIVE_UCHAR
+           integer   HE5T_NATIVE_LONG
+           integer   HE5T_NATIVE_ULONG
+           integer   HE5T_NATIVE_LLONG
+           integer   HE5T_NATIVE_ULLONG
+           integer   HE5T_NATIVE_FLOAT
+           integer   HE5T_NATIVE_REAL
+           integer   HE5T_NATIVE_DOUBLE
+           integer   HE5T_NATIVE_LDOUBLE
+           integer   HE5T_NATIVE_INT8
+           integer   HE5T_NATIVE_UINT8
+           integer   HE5T_NATIVE_INT16
+           integer   HE5T_NATIVE_UINT16
+           integer   HE5T_NATIVE_INT32
+           integer   HE5T_NATIVE_UINT32
+           integer   HE5T_NATIVE_INT64
+           integer   HE5T_NATIVE_UINT64
+           integer   HE5T_NATIVE_B8
+           integer   HE5T_NATIVE_B16
+           integer   HE5T_NATIVE_B32
+           integer   HE5T_NATIVE_B64
+           integer   HE5T_NATIVE_HSIZE
+           integer   HE5T_NATIVE_HERR
+           integer   HE5T_NATIVE_HBOOL
+
+           integer   HE5T_STD_I8BE
+           integer   HE5T_STD_I8LE
+           integer   HE5T_STD_I16BE
+           integer   HE5T_STD_I16LE
+           integer   HE5T_STD_I32BE
+           integer   HE5T_STD_I32LE
+           integer   HE5T_STD_I64BE
+           integer   HE5T_STD_I64LE
+           integer   HE5T_STD_U8BE
+           integer   HE5T_STD_U8LE
+           integer   HE5T_STD_U16BE
+           integer   HE5T_STD_U16LE
+           integer   HE5T_STD_U32BE
+           integer   HE5T_STD_U32LE
+           integer   HE5T_STD_U64BE
+           integer   HE5T_STD_U64LE
+           integer   HE5T_STD_B8BE
+           integer   HE5T_STD_B8LE
+           integer   HE5T_STD_B16BE
+           integer   HE5T_STD_B16LE
+           integer   HE5T_STD_B32BE
+           integer   HE5T_STD_B32LE
+           integer   HE5T_STD_B64BE
+           integer   HE5T_STD_B64LE
+
+           integer   HE5T_IEEE_F32BE                      
+           integer   HE5T_IEEE_F32LE                      
+           integer   HE5T_IEEE_F64BE                      
+           integer   HE5T_IEEE_F64LE                      
+           integer   HE5T_NATIVE_CHAR
+           integer   HE5T_CHARSTRING
+
+           parameter(HE5T_NATIVE_INT      = 0)
+           parameter(HE5T_NATIVE_UINT     = 1)
+           parameter(HE5T_NATIVE_SHORT    = 2)
+           parameter(HE5T_NATIVE_USHORT   = 3)
+           parameter(HE5T_NATIVE_SCHAR    = 4)
+           parameter(HE5T_NATIVE_UCHAR    = 5)
+           parameter(HE5T_NATIVE_LONG     = 6)
+           parameter(HE5T_NATIVE_ULONG    = 7)
+           parameter(HE5T_NATIVE_LLONG    = 8)
+           parameter(HE5T_NATIVE_ULLONG   = 9)
+           parameter(HE5T_NATIVE_FLOAT    =10)
+           parameter(HE5T_NATIVE_REAL     =10)
+           parameter(HE5T_NATIVE_DOUBLE   =11)
+           parameter(HE5T_NATIVE_LDOUBLE  =12)
+           parameter(HE5T_NATIVE_INT8     =13)
+           parameter(HE5T_NATIVE_UINT8    =14)
+           parameter(HE5T_NATIVE_INT16    =15)
+           parameter(HE5T_NATIVE_UINT16   =16)
+           parameter(HE5T_NATIVE_INT32    =17)
+           parameter(HE5T_NATIVE_UINT32   =18)
+           parameter(HE5T_NATIVE_INT64    =19)
+           parameter(HE5T_NATIVE_UINT64   =20)
+           parameter(HE5T_NATIVE_B8       =21)
+           parameter(HE5T_NATIVE_B16      =22)
+           parameter(HE5T_NATIVE_B32      =23)
+           parameter(HE5T_NATIVE_B64      =24)
+           parameter(HE5T_NATIVE_HSIZE    =25)
+           parameter(HE5T_NATIVE_HERR     =26)
+           parameter(HE5T_NATIVE_HBOOL    =27)
+
+           parameter(HE5T_STD_I8BE        =28)
+           parameter(HE5T_STD_I8LE        =29)
+           parameter(HE5T_STD_I16BE       =30)
+           parameter(HE5T_STD_I16LE       =31)
+           parameter(HE5T_STD_I32BE       =32)
+           parameter(HE5T_STD_I32LE       =33)
+           parameter(HE5T_STD_I64BE       =34)
+           parameter(HE5T_STD_I64LE       =35)
+           parameter(HE5T_STD_U8BE        =36)
+           parameter(HE5T_STD_U8LE        =37)
+           parameter(HE5T_STD_U16BE       =38)
+           parameter(HE5T_STD_U16LE       =39)
+           parameter(HE5T_STD_U32BE       =40)
+           parameter(HE5T_STD_U32LE       =41)
+           parameter(HE5T_STD_U64BE       =42)
+           parameter(HE5T_STD_U64LE       =43)
+           parameter(HE5T_STD_B8BE        =44)
+           parameter(HE5T_STD_B8LE        =45)
+           parameter(HE5T_STD_B16BE       =46)
+           parameter(HE5T_STD_B16LE       =47)
+           parameter(HE5T_STD_B32BE       =48)
+           parameter(HE5T_STD_B32LE       =49)
+           parameter(HE5T_STD_B64BE       =50)
+           parameter(HE5T_STD_B64LE       =51)
+
+           parameter(HE5T_IEEE_F32BE      =52)                
+           parameter(HE5T_IEEE_F32LE      =53)                
+           parameter(HE5T_IEEE_F64BE      =54)                
+           parameter(HE5T_IEEE_F64LE      =55)                
+
+           parameter(HE5T_NATIVE_CHAR     =56)                
+           parameter(HE5T_CHARSTRING      =57)
+
+           integer   HE5S_UNLIMITED_F
+           parameter(HE5S_UNLIMITED_F = -1)
+
+
+!          HDFEOS5 FILE ACCESS TAGS 
+!          ========================
+ 
+           integer   HE5F_ACC_RDWR
+           integer   HE5F_ACC_RDONLY
+           integer   HE5F_ACC_TRUNC
+
+           parameter(HE5F_ACC_RDWR   = 100)
+           parameter(HE5F_ACC_RDONLY = 101)
+           parameter(HE5F_ACC_TRUNC  = 102)
+
+!          TOOLKIT FILE ACCESS TAGS 
+!          ========================
+ 
+           integer   HDF4_ACC_RDONLY
+           integer   HDF4_ACC_RDWR
+           integer   HDF4_ACC_CREATE
+
+           integer   HDF5_ACC_RDONLY
+           integer   HDF5_ACC_RDWR
+           integer   HDF5_ACC_CREATE
+
+           parameter(HDF4_ACC_RDONLY = 1)
+           parameter(HDF4_ACC_RDWR   = 3)
+           parameter(HDF4_ACC_CREATE = 4)
+
+           parameter(HDF5_ACC_RDONLY = 11)
+           parameter(HDF5_ACC_RDWR   = 13)
+           parameter(HDF5_ACC_CREATE = 14)
+
+
+!          HDFEOS5  MERGE CODES 
+!          ====================
+
+           integer HE5_HDFE_NOMERGE
+           integer HE5_HDFE_AUTOMERGE
+
+           parameter(HE5_HDFE_NOMERGE   =0)
+           parameter(HE5_HDFE_AUTOMERGE =1)
+ 
+!          HDFEOS5 XXentries CODES 
+!          =======================
+
+           integer HE5_HDFE_NENTDIM
+           integer HE5_HDFE_NENTMAP
+           integer HE5_HDFE_NENTIMAP
+           integer HE5_HDFE_NENTGFLD
+           integer HE5_HDFE_NENTDFLD
+
+           parameter(HE5_HDFE_NENTDIM  =0)
+           parameter(HE5_HDFE_NENTMAP  =1)
+           parameter(HE5_HDFE_NENTIMAP =2)
+           parameter(HE5_HDFE_NENTGFLD =3)
+           parameter(HE5_HDFE_NENTDFLD =4)
+
+!          HDFEOS5 ANGLE CONVERSION CODES 
+!          ==============================
+
+           integer HE5_HDFE_RAD_DEG    
+           integer HE5_HDFE_DEG_RAD    
+           integer HE5_HDFE_DMS_DEG    
+           integer HE5_HDFE_DEG_DMS    
+           integer HE5_HDFE_RAD_DMS    
+           integer HE5_HDFE_DMS_RAD    
+
+           parameter(HE5_HDFE_RAD_DEG =0)
+           parameter(HE5_HDFE_DEG_RAD =1)
+           parameter(HE5_HDFE_DMS_DEG =2)
+           parameter(HE5_HDFE_DEG_DMS =3)
+           parameter(HE5_HDFE_RAD_DMS =4)
+           parameter(HE5_HDFE_DMS_RAD =5)
+
+
+!          HDFEOS5 SWATH SUBSET CODES 
+!          ==========================
+ 
+           integer HE5_HDFE_MIDPOINT 
+           integer HE5_HDFE_ENDPOINT 
+           integer HE5_HDFE_ANYPOINT 
+           integer HE5_HDFE_INTERNAL 
+           integer HE5_HDFE_EXTERNAL 
+           integer HE5_HDFE_NOPREVSUB
+
+           parameter(HE5_HDFE_MIDPOINT  =0) 
+           parameter(HE5_HDFE_ENDPOINT  =1) 
+           parameter(HE5_HDFE_ANYPOINT  =2) 
+           parameter(HE5_HDFE_INTERNAL  =0) 
+           parameter(HE5_HDFE_EXTERNAL  =1) 
+           parameter(HE5_HDFE_NOPREVSUB =-1) 
+
+
+!          HDFEOS5 GRID ORIGIN CODES 
+!          =========================
+
+           integer HE5_HDFE_GD_UL    
+           integer HE5_HDFE_GD_UR    
+           integer HE5_HDFE_GD_LL    
+           integer HE5_HDFE_GD_LR    
+ 
+           parameter(HE5_HDFE_GD_UL  =0) 
+           parameter(HE5_HDFE_GD_UR  =1) 
+           parameter(HE5_HDFE_GD_LL  =2) 
+           parameter(HE5_HDFE_GD_LR  =3) 
+
+
+!          HDFEOS5 PIXEL REGISTRATION CODES 
+!          ================================
+
+           integer HE5_HDFE_CENTER     
+           integer HE5_HDFE_CORNER     
+ 
+           parameter(HE5_HDFE_CENTER  =0)
+           parameter(HE5_HDFE_CORNER  =1)
+
+!          HDFEOS5 GCTP PROJECTION CODES 
+!          =============================
+
+           integer HE5_GCTP_GEO      
+           integer HE5_GCTP_UTM      
+           integer HE5_GCTP_SPCS     
+           integer HE5_GCTP_ALBERS   
+           integer HE5_GCTP_LAMCC     
+           integer HE5_GCTP_MERCAT    
+           integer HE5_GCTP_PS        
+           integer HE5_GCTP_POLYC     
+           integer HE5_GCTP_EQUIDC    
+           integer HE5_GCTP_TM        
+           integer HE5_GCTP_STEREO    
+           integer HE5_GCTP_LAMAZ     
+           integer HE5_GCTP_AZMEQD    
+           integer HE5_GCTP_GNOMON    
+           integer HE5_GCTP_ORTHO     
+           integer HE5_GCTP_GVNSP     
+           integer HE5_GCTP_SNSOID    
+           integer HE5_GCTP_EQRECT    
+           integer HE5_GCTP_MILLER    
+           integer HE5_GCTP_VGRINT    
+           integer HE5_GCTP_HOM       
+           integer HE5_GCTP_ROBIN     
+           integer HE5_GCTP_SOM       
+           integer HE5_GCTP_ALASKA    
+           integer HE5_GCTP_GOOD      
+           integer HE5_GCTP_MOLL      
+           integer HE5_GCTP_IMOLL     
+           integer HE5_GCTP_HAMMER    
+           integer HE5_GCTP_WAGIV     
+           integer HE5_GCTP_WAGVII    
+           integer HE5_GCTP_OBLEQA    
+           integer HE5_GCTP_ISINUS    
+
+           parameter(HE5_GCTP_GEO      =0)
+           parameter(HE5_GCTP_UTM      =1)
+           parameter(HE5_GCTP_SPCS     =2)
+           parameter(HE5_GCTP_ALBERS   =3)
+           parameter(HE5_GCTP_LAMCC    =4)
+           parameter(HE5_GCTP_MERCAT   =5)
+           parameter(HE5_GCTP_PS       =6)
+           parameter(HE5_GCTP_POLYC    =7)
+           parameter(HE5_GCTP_EQUIDC   =8)
+           parameter(HE5_GCTP_TM       =9)
+           parameter(HE5_GCTP_STEREO   =10)
+           parameter(HE5_GCTP_LAMAZ    =11)
+           parameter(HE5_GCTP_AZMEQD   =12)
+           parameter(HE5_GCTP_GNOMON   =13)
+           parameter(HE5_GCTP_ORTHO    =14)
+           parameter(HE5_GCTP_GVNSP    =15)
+           parameter(HE5_GCTP_SNSOID   =16)
+           parameter(HE5_GCTP_EQRECT   =17)
+           parameter(HE5_GCTP_MILLER   =18)
+           parameter(HE5_GCTP_VGRINT   =19)
+           parameter(HE5_GCTP_HOM      =20)
+           parameter(HE5_GCTP_ROBIN    =21)
+           parameter(HE5_GCTP_SOM      =22)
+           parameter(HE5_GCTP_ALASKA   =23)
+           parameter(HE5_GCTP_GOOD     =24)
+           parameter(HE5_GCTP_MOLL     =25)
+           parameter(HE5_GCTP_IMOLL    =26)
+           parameter(HE5_GCTP_HAMMER   =27)
+           parameter(HE5_GCTP_WAGIV    =28)
+           parameter(HE5_GCTP_WAGVII   =29)
+           parameter(HE5_GCTP_OBLEQA   =30)
+           parameter(HE5_GCTP_ISINUS   =99)
+ 
+ 
+!          HDFEOS5 TILIND/COMPRESSION CODES 
+!          ================================
+
+           integer HE5_HDFE_NOTILE       
+           integer HE5_HDFE_TILE         
+           integer HE5_HDFE_COMP_NONE    
+           integer HE5_HDFE_COMP_RLE     
+           integer HE5_HDFE_COMP_NBIT    
+           integer HE5_HDFE_COMP_SKPHUFF 
+           integer HE5_HDFE_COMP_DEFLATE 
+           integer HE5_HDFE_COMP_SZIP_CHIP
+           integer HE5_HDFE_COMP_SZIP_K13
+           integer HE5_HDFE_COMP_SZIP_EC
+           integer HE5_HDFE_COMP_SZIP_NN
+           integer HE5_HDFE_COMP_SZIP_K13orEC
+           integer HE5_HDFE_COMP_SZIP_K13orNN
+           integer HE5_HDFE_COMP_SHUF_DEFLATE
+           integer HE5_HDFE_COMP_SHUF_SZIP_CHIP
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13
+           integer HE5_HDFE_COMP_SHUF_SZIP_EC
+           integer HE5_HDFE_COMP_SHUF_SZIP_NN
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13orEC
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13orNN
+
+           parameter(HE5_HDFE_NOTILE                 =0)
+           parameter(HE5_HDFE_TILE                   =1)
+           parameter(HE5_HDFE_COMP_NONE              =0)
+           parameter(HE5_HDFE_COMP_RLE               =1)
+           parameter(HE5_HDFE_COMP_NBIT              =2)
+           parameter(HE5_HDFE_COMP_SKPHUFF           =3)
+           parameter(HE5_HDFE_COMP_DEFLATE           =4)
+           parameter(HE5_HDFE_COMP_SZIP_CHIP         =5)
+           parameter(HE5_HDFE_COMP_SZIP_K13          =6)
+           parameter(HE5_HDFE_COMP_SZIP_EC           =7)
+           parameter(HE5_HDFE_COMP_SZIP_NN           =8)
+           parameter(HE5_HDFE_COMP_SZIP_K13orEC      =9)
+           parameter(HE5_HDFE_COMP_SZIP_K13orNN      =10)
+           parameter(HE5_HDFE_COMP_SHUF_DEFLATE      =11)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_CHIP    =12)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13     =13)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_EC      =14)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_NN      =15)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orEC =16)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orNN =17)
+ 
+!          HDFEOS5 GROUP CODES 
+!          ===================
+
+           integer HE5_HDFE_GEOGROUP        
+           integer HE5_HDFE_DATAGROUP       
+           integer HE5_HDFE_ATTRGROUP       
+           integer HE5_HDFE_GRPATTRGROUP    
+           integer HE5_HDFE_LOCATTRGROUP    
+           integer HE5_HDFE_PROFGROUP       
+           integer HE5_HDFE_PROFGRPATTRGROUP
+           integer HE5_HDFE_GEOGRPATTRGROUP
+
+           parameter(HE5_HDFE_GEOGROUP       =0)
+           parameter(HE5_HDFE_DATAGROUP      =1)
+           parameter(HE5_HDFE_ATTRGROUP      =2)
+           parameter(HE5_HDFE_GRPATTRGROUP   =3)
+           parameter(HE5_HDFE_LOCATTRGROUP   =4)
+           parameter(HE5_HDFE_PROFGROUP      =5)
+           parameter(HE5_HDFE_PROFGRPATTRGROUP =6)
+           parameter(HE5_HDFE_GEOGRPATTRGROUP =7)
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/point/hdfeos5_64.inc b/testdrivers/point/hdfeos5_64.inc
new file mode 100644
index 0000000..cb8be09
--- /dev/null
+++ b/testdrivers/point/hdfeos5_64.inc
@@ -0,0 +1,16 @@
+! * ==========================================================
+! * File:       hdfeos5_64.inc
+! * Author:     A. Muslimov, Emergent Technology Services, Inc.
+! * Date:       March 19, 2002
+! * Purpose:    Fortran header file for HDFEOS5 routines on 64
+! *              bit platforms
+! * ==========================================================
+! * Contents: 
+! *
+! *
+! * ===========================================================
+ 
+
+           integer*8 HE5S_UNLIMITED_F_64
+
+           parameter(HE5S_UNLIMITED_F_64 = -1)
diff --git a/testdrivers/point/simple.txt b/testdrivers/point/simple.txt
new file mode 100755
index 0000000..a05b409
--- /dev/null
+++ b/testdrivers/point/simple.txt
@@ -0,0 +1,15 @@
+   46353400.0  2.98  3.99  2.63  1.41  CO
+   46572420.7  3.99  4.52  2.35  2.52 CO2
+   46853103.3  2.11  3.10  4.81  1.83  CO
+   47485493.4  3.39  3.02  3.09  3.90 CO2
+   48066418.5  2.06  4.49  1.67  1.74  O3
+   48474414.6  1.06  4.63  4.44  3.33 CO2
+   48866282.4  2.18  2.02  1.41  1.00  O3
+   49388188.2  3.73  2.00  2.30  1.46  O3
+   49858070.5  2.97  3.75  2.33  5.02 NOx
+   50370437.1  4.38  3.70  1.96  3.11 NOx
+   50515373.3  0.24  1.91  4.33  1.49  CO
+   51257471.8  3.62  1.40  0.48  2.32 CO2
+   51708197.8  3.53  3.16  2.01  1.56  O3
+   51859454.7  0.62  0.76  2.06  4.01  O3
+   52433289.8  1.68  1.35  1.71  4.06  O3
diff --git a/testdrivers/point/testpoint32.f b/testdrivers/point/testpoint32.f
new file mode 100755
index 0000000..596bb16
--- /dev/null
+++ b/testdrivers/point/testpoint32.f
@@ -0,0 +1,3666 @@
+
+c----------------------------------------------------------------------------
+c       FILE:     testpoint32.f                                               
+c       PURPOSE:  To test HDF-EOS5 Point interface              
+c----------------------------------------------------------------------------
+
+      program       he5_pttestpoint32
+ 
+      implicit      none
+ 
+      include       'hdfeos5.inc'
+
+      integer       status 
+      integer       ptfid 
+      integer       ptid1, ptid2, ptid3
+      integer       ptid
+      integer       rank_1(3)
+      integer       rank_2(5)
+      integer       rank_3(4)
+      integer       rank_4(4)
+      integer       rank_5(6)
+      integer       dtype_1(3)
+      integer       dtype_2(5)
+      integer       dtype_3(4)
+      integer       dtype_4(4)
+      integer       dtype_5(6)
+      integer       array_1(3)
+      integer       array_2(5)
+      integer       array_3(4)
+      integer       array_4(4)
+      integer       array_5(6)
+      integer       i, zero
+      integer       rank
+      integer       datatype
+      integer       attr
+      integer       nflds
+      integer       level
+      integer       arr_rank
+      integer       dtype(3)
+      integer       nrecs
+      integer       nlevels
+      integer       attr1(5)
+      integer       attr2(5)
+      integer       ntype
+      integer       classid
+      integer       order
+      integer       fieldgroup
+
+      integer       he5_ptopen
+      integer       he5_ptcreate
+      integer       he5_ptdetach
+      integer       he5_ptclose
+      integer       he5_ptattach
+      integer       he5_ptdeflevel 
+      integer       he5_ptdeflinkage 
+      integer       he5_ptwritelevel 
+      integer       he5_ptfort2c
+      integer       he5_ptwrbckptr
+      integer       he5_ptwrfwdptr
+      integer       he5_ptwriteattr 
+      integer       he5_ptreadlevel
+      integer       he5_ptlevelinfo 
+      integer       he5_ptnrecs
+      integer       he5_ptnlevels
+      integer       he5_ptnfields
+      integer       he5_ptc2fort
+      integer       he5_ptinqattrs
+      integer       he5_ptreadattr
+      integer       he5_ptupdatelevel 
+      integer       he5_ptwritegrpattr
+      integer       he5_ptwritelocattr
+      integer       he5_ptinqgrpattrs
+      integer       he5_ptinqlocattrs
+      integer       he5_ptattrinfo
+      integer       he5_ptgrpattrinfo
+      integer       he5_ptlocattrinfo
+      integer       he5_ptreadgrpattr
+      integer       he5_ptreadlocattr
+      integer       he5_ptinqdatatype
+
+      integer*4     dims_1(3,1)
+      integer*4     dims_2(5,1)
+      integer*4     dims_3(4,1)
+      integer*4     dims_4(4,1)
+      integer*4     dims_5(6,1)
+      integer*4     n
+      integer*4     count(1)
+      integer*4     dimens(2)
+      integer*4     fortcount(8)
+      integer*4     date_tt
+      integer*4     date(3)
+      integer*4     date4_tt
+      integer*4     date4(3)
+      integer*4     wgt_tt
+      integer*4     wgt(3)
+      integer*4     datasize
+      integer*4     rank_tt(3)
+      integer*4     offset_tt(3)
+      integer*4     dtype_tt(3)
+      integer*4     dim_sizes_tt(3)
+      integer*4     nattr
+      integer*4     strbufsize
+      integer*4     recs(32)
+      integer*4     nrec
+      integer*4     sz
+      integer*4     size
+
+      real*4        flt      
+      real*4        concentration_tt(4)
+      real*4        conc(15,4)
+      real*4        outconc(4,15)
+      real*4        rain_tt
+      real*4        rain(20)
+      real*4        temp_tt
+      real*4        temp(20)
+      real*4        rain5_tt
+      real*4        rain5(25)
+      real*4        temp5_tt
+      real*4        temp5(25)
+      real*4        con(4,15)
+      real*4        outcon(15,4)
+      real*4        conc_tt(4)
+
+      real*8        time_tt
+      real*8        time(15)
+      real*8        lon_tt
+      real*8        lon(3)
+      real*8        lat_tt
+      real*8        lat(3)
+      real*8        time3_tt
+      real*8        time3(20)
+      real*8        time5_tt
+      real*8        time5(25)
+      real*8        lon5_tt
+      real*8        lon5(25)
+      real*8        lat5_tt
+      real*8        lat5(25)
+ 
+      character*240 fieldlist1
+      character*240 fieldlist2
+      character*240 fieldlist3
+      character*240 fieldlist4
+      character*240 fieldlist5
+      character*80  levelname
+      character*20  parent
+      character*20  child
+      character*20  linkfield
+      character*80  fieldname
+      character*80  attrname
+      character*8   spc_tt
+      character*8   spc(15)
+      character*8   desc_tt
+      character*8   desc(3)
+      character*8   id_tt
+      character*8   id(3)
+      character*8   id3_tt
+      character*8   id3(20)
+      character*8   desc4_tt
+      character*8   desc4(3)
+      character*8   id4_tt
+      character*8   id4(3)
+      character*8   id5_tt
+      character*8   id5(25)
+      character*80  fieldname3(3)
+      character*240 fieldlist
+      character*240 attrlist
+      character*8   spec(15)
+      character*1   null_char_0
+
+      open(unit=1, file="testpoint.txt", status = "UNKNOWN")
+
+      write(*,*)' '
+      write(1,*)' '
+      write(*,*)'Testing he5_ptath FORTRAN 77 interface'
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_ptath FORTRAN 77 interface'
+      write(1,*)'======================================'
+      write(*,*)' '
+      write(1,*)' '
+
+      zero=0
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_TRUNC) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_TRUNC)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_TRUNC)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptcreate
+c
+      write(*,*)'Testing he5_ptcreate '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptcreate '
+      write(1,*)'====================='
+      ptid1 = he5_ptcreate(ptfid, "Simple Point")
+      if (ptid1 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid1 = he5_ptcreate(ptfid, "Simple Point")'
+         write(*,*)'	Value returned by he5_ptcreate ', ptid1
+         write(1,*)'	ptid1 = he5_ptcreate(ptfid, "Simple Point")'
+         write(1,*)'	Value returned by he5_ptcreate ', ptid1
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptcreate
+c
+      write(*,*)'Testing he5_ptcreate '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptcreate '
+      write(1,*)'====================='
+      ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point")
+      if (ptid2 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptcreate ', ptid2
+         write(1,*)'	ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptcreate ', ptid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptcreate
+c
+      write(*,*)'Testing he5_ptcreate '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptcreate '
+      write(1,*)'====================='
+      ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point")
+      if (ptid3 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point")'
+         write(*,*)'	Value returned by he5_ptcreate ', ptid3
+         write(1,*)'	ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point")'
+         write(1,*)'	Value returned by he5_ptcreate ', ptid3
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid1)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid1)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid2)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid2)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid3)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid3)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "Simple Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c     Populate input information structure 
+c     ------------------------------------ 
+
+      levelname = 'Sensor'
+
+      rank_1(1)  = 1
+      rank_1(2)  = 1
+      rank_1(3)  = 1
+
+      fieldlist1 = 'Time,Concentration,Species'
+
+      dtype_1(1)     =  HE5T_NATIVE_DOUBLE
+      dtype_1(2)     =  HE5T_NATIVE_FLOAT
+      dtype_1(3)     =  HE5T_NATIVE_CHAR
+
+      array_1(1)     =  0
+      array_1(2)     =  1
+      array_1(3)     =  1
+
+      dims_1(1,1)      =  1
+      dims_1(2,1)      =  4
+      dims_1(3,1)      =  8
+
+c Test Case -- he5_ptdeflevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdeflevel '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdeflevel '
+      write(1,*)'====================='
+      status = he5_ptdeflevel(ptid, levelname, rank_1, fieldlist1,
+     1dims_1, dtype_1, array_1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdeflevel(ptid, levelname, rank_1'
+         write(*,*)'             fieldlist1,dims_1, dtype_1, array_1)'
+         write(*,*)'	Value returned by he5_ptdeflevel ', status
+         write(1,*)'	status = he5_ptdeflevel(ptid, levelname, rank_1'
+         write(1,*)'             fieldlist1,dims_1, dtype_1, array_1)'
+         write(1,*)'	Value returned by he5_ptdeflevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c     Populate input information structure 
+c     ------------------------------------ 
+
+      levelname = 'Desc-Loc'
+
+      rank_2(1)  = 1
+      rank_2(2)  = 1
+      rank_2(3)  = 1
+      rank_2(4)  = 1
+      rank_2(5)  = 1
+
+      fieldlist2 = 'Label,Longitude,Latitude,DeployDate,ID'
+
+      dtype_2(1)     =  HE5T_NATIVE_CHAR
+      dtype_2(2)     =  HE5T_NATIVE_DOUBLE
+      dtype_2(3)     =  HE5T_NATIVE_DOUBLE
+      dtype_2(4)     =  HE5T_NATIVE_INT
+      dtype_2(5)     =  HE5T_NATIVE_CHAR
+
+      array_2(1)  = 1
+      array_2(2)  = 0
+      array_2(3)  = 0
+      array_2(4)  = 0
+      array_2(5)  = 1
+
+      dims_2(1,1)      =  8
+      dims_2(2,1)      =  1
+      dims_2(3,1)      =  1
+      dims_2(4,1)      =  1
+      dims_2(5,1)      =  8
+
+
+c Test Case -- he5_ptdeflevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdeflevel '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdeflevel '
+      write(1,*)'====================='
+      status = he5_ptdeflevel(ptid, levelname, rank_2, fieldlist2,
+     1dims_2, dtype_2, array_2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdeflevel(ptid, levelname, rank_2'
+         write(*,*)'             fieldlist2,dims_2, dtype_2, array_2)'
+         write(*,*)'	Value returned by he5_ptdeflevel ', status
+         write(1,*)'	status = he5_ptdeflevel(ptid, levelname, rank_2'
+         write(1,*)'             fieldlist2,dims_2, dtype_2, array_2)'
+         write(1,*)'	Value returned by he5_ptdeflevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Populate input information structure 
+c     ------------------------------------ 
+
+      levelname = 'Observations'
+
+      rank_3(1)  = 1
+      rank_3(2)  = 1
+      rank_3(3)  = 1
+      rank_3(4)  = 1
+
+      fieldlist3 = 'Time,Rainfall,Temperature,ID'
+
+      dtype_3(1)     =  HE5T_NATIVE_DOUBLE
+      dtype_3(2)     =  HE5T_NATIVE_FLOAT
+      dtype_3(3)     =  HE5T_NATIVE_FLOAT
+      dtype_3(4)     =  HE5T_NATIVE_CHAR
+
+      array_3(1)  = 0
+      array_3(2)  = 0
+      array_3(3)  = 0
+      array_3(4)  = 1
+
+      dims_3(1,1)      =  1
+      dims_3(2,1)      =  1
+      dims_3(3,1)      =  1
+      dims_3(4,1)      =  8
+
+c Test Case -- he5_ptdeflevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdeflevel '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptdeflevel '
+      write(1,*)'======================'
+      status = he5_ptdeflevel(ptid, levelname, rank_3, fieldlist3,
+     1dims_3, dtype_3, array_3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdeflevel(ptid, levelname, rank_3'
+         write(*,*)'             fieldlist3,dims_3, dtype_3, array_3)'
+         write(*,*)'	Value returned by he5_ptdeflevel ', status
+         write(1,*)'	status = he5_ptdeflevel(ptid, levelname, rank_3'
+         write(1,*)'             fieldlist3,dims_3, dtype_3, array_3)'
+         write(1,*)'	Value returned by he5_ptdeflevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      parent    = 'Desc-Loc'
+      child     = 'Observations'
+      linkfield = 'ID'
+
+c Test Case -- he5_ptdeflinkage
+c
+      write(*,*)'Testing he5_ptdeflinkage '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptdeflinkage '
+      write(1,*)'========================'
+      status = he5_ptdeflinkage(ptid, parent, child, linkfield)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdeflinkage(ptid, parent, child,'
+         write(*,*)'	         linkfield)'
+         write(*,*)'	Value returned by he5_ptdeflinkage ', status
+         write(1,*)'	status = he5_ptdeflinkage(ptid, parent, child,'
+         write(1,*)'	         linkfield)'
+         write(1,*)'	Value returned by he5_ptdeflinkage ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FloatBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FloatBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FloatBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      levelname = 'Description'
+
+      rank_4(1)  = 1
+      rank_4(2)  = 1
+      rank_4(3)  = 1
+      rank_4(4)  = 1
+
+      fieldlist4 = 'Label,DeployDate,Weight,ID'
+
+      dtype_4(1)     =  HE5T_NATIVE_CHAR
+      dtype_4(2)     =  HE5T_NATIVE_INT
+      dtype_4(3)     =  HE5T_NATIVE_INT
+      dtype_4(4)     =  HE5T_NATIVE_CHAR
+
+      array_4(1)  = 1
+      array_4(2)  = 0
+      array_4(3)  = 0
+      array_4(4)  = 1
+
+      dims_4(1,1)      =  8
+      dims_4(2,1)      =  1
+      dims_4(3,1)      =  1
+      dims_4(4,1)      =  8
+
+c Test Case -- he5_ptdeflevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdeflevel '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdeflevel '
+      write(1,*)'====================='
+      status = he5_ptdeflevel(ptid, levelname, rank_4, fieldlist4,
+     1dims_4, dtype_4, array_4)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdeflevel(ptid, levelname, rank_4'
+         write(*,*)'             fieldlist4,dims_4, dtype_4, array_4)'
+         write(*,*)'	Value returned by he5_ptdeflevel ', status
+         write(1,*)'	status = he5_ptdeflevel(ptid, levelname, rank_4'
+         write(1,*)'             fieldlist4,dims_4, dtype_4, array_4)'
+         write(1,*)'	Value returned by he5_ptdeflevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      levelname = 'Measurements'
+
+      rank_5(1)  = 1
+      rank_5(2)  = 1
+      rank_5(3)  = 1
+      rank_5(4)  = 1
+      rank_5(5)  = 1
+      rank_5(6)  = 1
+
+      fieldlist5 = 'Time,Longitude,Latitude,Rainfall,Temperature,ID'
+
+      dtype_5(1)     =  HE5T_NATIVE_DOUBLE
+      dtype_5(2)     =  HE5T_NATIVE_DOUBLE
+      dtype_5(3)     =  HE5T_NATIVE_DOUBLE
+      dtype_5(4)     =  HE5T_NATIVE_FLOAT
+      dtype_5(5)     =  HE5T_NATIVE_FLOAT
+      dtype_5(6)     =  HE5T_NATIVE_CHAR
+
+      array_5(1)  = 0
+      array_5(2)  = 0
+      array_5(3)  = 0
+      array_5(4)  = 0
+      array_5(5)  = 0
+      array_5(6)  = 1
+
+      dims_5(1,1)      =  1
+      dims_5(2,1)      =  1
+      dims_5(3,1)      =  1
+      dims_5(4,1)      =  1
+      dims_5(5,1)      =  1
+      dims_5(6,1)      =  8
+
+
+c Test Case -- he5_ptdeflevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdeflevel '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdeflevel '
+      write(1,*)'====================='
+      status = he5_ptdeflevel(ptid, levelname, rank_5, fieldlist5,
+     1dims_5, dtype_5, array_5)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdeflevel(ptid, levelname, rank_5'
+         write(*,*)'             fieldlist5,dims_5, dtype_5, array_5)'
+         write(*,*)'	Value returned by he5_ptdeflevel ', status
+         write(1,*)'	status = he5_ptdeflevel(ptid, levelname, rank_5'
+         write(1,*)'             fieldlist5,dims_5, dtype_5, array_5)'
+         write(1,*)'	Value returned by he5_ptdeflevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      parent    = 'Description'
+      child     = 'Measurements'
+      linkfield = 'ID'
+
+c Test Case -- he5_ptdeflinkage
+c
+      write(*,*)'Testing he5_ptdeflinkage '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdeflinkage '
+      write(1,*)'====================='
+      status = he5_ptdeflinkage(ptid, parent, child, linkfield)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdeflinkage(ptid, parent, child,'
+         write(*,*)'	         linkfield)'
+         write(*,*)'	Value returned by he5_ptdeflinkage ', status
+         write(1,*)'	status = he5_ptdeflinkage(ptid, parent, child,'
+         write(1,*)'	         linkfield)'
+         write(1,*)'	Value returned by he5_ptdeflinkage ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "Simple Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Read Simple Point 
+c     ----------------- 
+      open(unit=10, file='simple.txt', status='OLD')
+
+      n = 0
+      do 10 i=1,1000
+         read(10, 110, end=100) time_tt, concentration_tt(1), 
+     1                                  concentration_tt(2), 
+     2                                  concentration_tt(3),
+     3                                  concentration_tt(4), 
+     4                                  spc_tt
+         time(i)     = time_tt
+         conc(i,1)   = concentration_tt(1)
+         conc(i,2)   = concentration_tt(2)
+         conc(i,3)   = concentration_tt(3)
+         conc(i,4)   = concentration_tt(4)
+         spc(i)      = spc_tt
+
+         n = n + 1
+   10 continue
+
+  100 close(unit=10)
+  110 format(F13.1,F6.2,F6.2,F6.2,F6.2,2X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Time'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, time)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, time)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, time)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+   
+c.....Convert array to 'C' order
+      dimens(1) = 15
+      dimens(2) = 4
+      rank      = 2
+      datatype  = HE5T_NATIVE_FLOAT
+
+c Test Case -- he5_ptfort2c
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptfort2c '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptfort2c '
+      write(1,*)'====================='
+      status    = he5_ptfort2c(dimens, rank, datatype, conc, 
+     1outconc)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptfort2c(dimens,rank,datatype,conc,'
+         write(*,*)'	         outconc)'
+         write(*,*)'	Value returned by he5_ptfort2c ', status
+         write(1,*)'	status = he5_ptfort2c(dimens,rank,datatype,conc,'
+         write(1,*)'	         outconc)'
+         write(1,*)'	Value returned by he5_ptfort2c ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Concentration'
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, outconc)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, outconc)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, outconc)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Species'
+      datatype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, spc)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Read FixedBuoy Point 
+c     -------------------- 
+      open(unit=11, file='fixedBuoy0.txt', status='OLD')
+
+      n = 0
+      do 20 i=1,1000
+         read(11, 210, end=200) desc_tt, lon_tt, lat_tt, date_tt, 
+     1id_tt
+         desc(i)     = desc_tt
+         lon(i)      = lon_tt
+         lat(i)      = lat_tt
+         date(i)     = date_tt
+         id(i)       = id_tt
+
+         n = n + 1
+   20 continue
+
+  200 close(unit=11)
+  210 format(A8,F13.7,F13.7,I7,1X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Label'
+      datatype       = HE5T_NATIVE_CHAR
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, desc)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, desc)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, desc)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Longitude'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, lon)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, lon)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, lon)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Latitude'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, lat)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, lat)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, lat)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'DeployDate'
+      datatype       = HE5T_NATIVE_INT
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype,  date)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype,  date)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype,  date)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'ID'
+      datatype       = HE5T_NATIVE_CHAR
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, id)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, id)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, id)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c     Read FixedBuoy Point - Level 1
+c     ------------------------------ 
+      open(unit=12, file='fixedBuoy1.txt', status='OLD')
+
+      n = 0
+      do 30 i=1,1000
+         read(12, 310, end=300) time3_tt, rain_tt, temp_tt, id3_tt 
+         time3(i)     = time3_tt
+         rain(i)      = rain_tt
+         temp(i)      = temp_tt
+         id3(i)       = id3_tt
+
+         n = n + 1
+   30 continue
+
+  300 close(unit=12)
+  310 format(F13.2,F8.1,F8.2,3X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Time'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, time3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, time3)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, time3)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Rainfall'
+      datatype       = HE5T_NATIVE_FLOAT
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, rain)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, rain)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, rain)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Temperature'
+      datatype       = HE5T_NATIVE_FLOAT
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, temp)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, temp)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, temp)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      fieldname      = 'ID'
+      datatype       = HE5T_NATIVE_CHAR
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, id3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, id3)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, id3)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptwrbckptr
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwrbckptr '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptwrbckptr '
+      write(1,*)'====================='
+      status = he5_ptwrbckptr(ptid,1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptwrbckptr(ptid,1)'
+         write(*,*)'	Value returned by he5_ptwrbckptr ', status
+         write(1,*)'	status = he5_ptwrbckptr(ptid,1)'
+         write(1,*)'	Value returned by he5_ptwrbckptr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptwrfwdptr
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwrfwdptr '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptwrfwdptr '
+      write(1,*)'====================='
+      status = he5_ptwrfwdptr(ptid,1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptwrfwdptr(ptid,1)'
+         write(*,*)'	Value returned by he5_ptwrfwdptr ', status
+         write(1,*)'	status = he5_ptwrfwdptr(ptid,1)'
+         write(1,*)'	Value returned by he5_ptwrfwdptr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Write attributes to "Fixed Buoy Point"
+c     --------------------------------------
+      attrname       = 'GlobalAttribute_int'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 1
+      attr           = 9999 
+
+c Test Case -- he5_ptwriteattr
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwriteattr '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptwriteattr '
+      write(1,*)'====================='
+      status   = he5_ptwriteattr(ptid,attrname,ntype,fortcount,
+     1attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(*,*)'	           ntype,fortcount,attr)'
+         write(*,*)'	Value returned by he5_ptwriteattr ', status
+         write(1,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(1,*)'	           ntype,fortcount,attr)'
+         write(1,*)'	Value returned by he5_ptwriteattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FloatBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FloatBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FloatBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Read FloatBuoy Point - Level 0
+c     ------------------------------ 
+      open(unit=14, file='floatBuoy0.txt', status='OLD')
+
+      n = 0
+      do 40 i=1,1000
+         read(14, 410, end=400) desc4_tt, date4_tt, wgt_tt, id4_tt 
+         desc4(i)     = desc4_tt
+         date4(i)     = date4_tt
+         wgt(i)       = wgt_tt
+         id4(i)       = id4_tt
+
+         n = n + 1
+   40 continue
+
+  400 close(unit=14)
+  410 format(A8,I8,I7,2X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Label'
+      datatype       = HE5T_NATIVE_CHAR
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, desc4)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, desc4)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, desc4)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'DeployDate'
+      datatype       = HE5T_NATIVE_INT
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, date4)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, date4)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, date4)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Weight'
+      datatype       = HE5T_NATIVE_INT
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, wgt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, wgt)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, wgt)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'ID'
+      datatype       = HE5T_NATIVE_CHAR
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, id4)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, id4)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, id4)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c     Read FixedBuoy Point - Level 1
+c     ------------------------------ 
+      open(unit=15, file='floatBuoy1.txt', status='OLD')
+
+      n = 0
+      do 50 i=1,1000
+         read(15, 510, end=500) time5_tt, lon5_tt, lat5_tt,  
+     1rain5_tt,temp5_tt,id5_tt
+         time5(i)     = time5_tt
+         lon5(i)      = lon5_tt
+         lat5(i)      = lat5_tt
+         rain5(i)     = rain5_tt
+         temp5(i)     = temp5_tt
+         id5(i)       = id5_tt
+
+         n = n + 1
+   50 continue
+
+  500 close(unit=15)
+  510 format(F13.1,F13.6,F13.6,F8.1,F8.2,3X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Time'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, time5)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, time5)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, time5)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Longitude'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, lon5)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, lon5)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, lon5)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Latitude'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, lat5)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, lat5)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, lat5)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Rainfall'
+      datatype       = HE5T_NATIVE_FLOAT
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, rain5)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, rain5)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'             fieldname,datatype, rain5)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Temperature'
+      datatype       = HE5T_NATIVE_FLOAT
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, temp5)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, temp5)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, temp5)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'ID'
+      datatype       = HE5T_NATIVE_CHAR
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, id5)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, id5)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, id5)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptwrbckptr
+c
+      write(*,*)'Testing he5_ptwrbckptr '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptwrbckptr '
+      write(1,*)'======================'
+      status = he5_ptwrbckptr(ptid,1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptwrbckptr(ptid,1)'
+         write(*,*)'	Value returned by he5_ptwrbckptr ', status
+         write(1,*)'	status = he5_ptwrbckptr(ptid,1)'
+         write(1,*)'	Value returned by he5_ptwrbckptr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptwrfwdptr
+c
+      write(*,*)'Testing he5_ptwrfwdptr '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptwrfwdptr '
+      write(1,*)'======================'
+      status = he5_ptwrfwdptr(ptid,1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptwrfwdptr(ptid,1)'
+         write(*,*)'	Value returned by he5_ptwrfwdptr ', status
+         write(1,*)'	status = he5_ptwrfwdptr(ptid,1)'
+         write(1,*)'	Value returned by he5_ptwrfwdptr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+
+c     Write attributes to "Float Buoy Point"
+c     --------------------------------------
+      attrname       = 'GlobalAttribute_float'
+      ntype          = HE5T_NATIVE_FLOAT
+      fortcount(1)   = 1
+      flt            = -7.5
+
+c Test Case -- he5_ptwriteattr
+c
+      write(*,*)'Testing he5_ptwriteattr '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptwriteattr '
+      write(1,*)'======================'
+      status   = he5_ptwriteattr(ptid,attrname,
+     1ntype,fortcount,flt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(*,*)'	           ntype,fortcount,flt)'
+         write(*,*)'	Value returned by he5_ptwriteattr ', status
+         write(1,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(1,*)'	           ntype,fortcount,flt)'
+         write(1,*)'	Value returned by he5_ptwriteattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "Simple Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Get level information 
+c     --------------------- 
+      level = 0
+
+c Test Case -- he5_ptlevelinfo
+c
+      write(*,*)'Testing he5_ptlevelinfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptlevelinfo '
+      write(1,*)'====================='
+      status = he5_ptlevelinfo(ptid, level, levelname, rank_tt,
+     1fieldlist, dim_sizes_tt, datasize, offset_tt, dtype_tt)
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status=he5_ptlevelinfo(ptid,level,levelname,'
+         write(*,*)'           rank_tt,fieldlist,dim_sizes_tt,'
+         write(*,*)'           datasize,offset_tt,dtype_tt)'
+         write(*,*)'	Value returned by he5_ptlevelinfo ', status
+         write(1,*)'    status=he5_ptlevelinfo(ptid,level,levelname,'
+         write(1,*)'           rank_tt,fieldlist,dim_sizes_tt,'
+         write(1,*)'           datasize,offset_tt,dtype_tt)'
+         write(1,*)'	Value returned by he5_ptlevelinfo ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Get the number of records in level
+c     ---------------------------------- 
+      level = 0
+
+c Test Case -- he5_ptnrecs
+c
+      write(*,*)'Testing he5_ptnrecs '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptnrecs '
+      write(1,*)'====================='
+      nrecs = he5_ptnrecs(ptid, level)
+      if (nrecs .le. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nrecs = he5_ptnrecs(ptid, level)'
+         write(*,*)'	Value returned by he5_ptnrecs ', nrecs
+         write(1,*)'	nrecs = he5_ptnrecs(ptid, level)'
+         write(1,*)'	Value returned by he5_ptnrecs ', nrecs
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptnlevels
+c
+      write(*,*)'Testing he5_ptnlevels '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptnlevels '
+      write(1,*)'====================='
+      nlevels = he5_ptnlevels(ptid)
+      if (nlevels .le. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nlevels = he5_ptnlevels(ptid)'
+         write(*,*)'	Value returned by he5_ptnlevels ', nlevels
+         write(1,*)'	nlevels = he5_ptnlevels(ptid)'
+         write(1,*)'	Value returned by he5_ptnlevels ', nlevels
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptnfields
+c
+      write(*,*)'Testing he5_ptnfields '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptnfields '
+      write(1,*)'====================='
+      nflds = he5_ptnfields(ptid, level, fieldlist, strbufsize)
+      if (nflds .le. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nflds = he5_ptnfields(ptid, level,'
+         write(*,*)'	        fieldlist, strbufsize)'
+         write(*,*)'	Value returned by he5_ptnfields ', nflds
+         write(1,*)'	nflds = he5_ptnfields(ptid, level,'
+         write(1,*)'	        fieldlist, strbufsize)'
+         write(1,*)'	Value returned by he5_ptnfields ', nflds
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Populate input information structure 
+c     ------------------------------------ 
+      dtype(1)     =  HE5T_NATIVE_DOUBLE
+      dtype(2)     =  HE5T_NATIVE_FLOAT
+      dtype(3)     =  HE5T_NATIVE_CHAR
+
+c     Read the level data and print out
+c     --------------------------------- 
+      fieldname3(1)  = 'Time'
+
+c Test Case -- he5_ptreadlevel
+c
+      write(*,*)'Testing he5_ptreadlevel '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptreadlevel '
+      write(1,*)'====================='
+      status = he5_ptreadlevel(ptid, 0, fieldname3(1), 
+     1dtype(1), time)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptreadlevel(ptid, 0, fieldname3(1),'
+         write(*,*)'	         dtype(1), time)'
+         write(*,*)'	Value returned by he5_ptreadlevel ', status
+         write(1,*)'	status = he5_ptreadlevel(ptid, 0, fieldname3(1),'
+         write(1,*)'	         dtype(1), time)'
+         write(1,*)'	Value returned by he5_ptreadlevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname3(2)  = 'Concentration'
+
+c Test Case -- he5_ptreadlevel
+c
+      write(*,*)'Testing he5_ptreadlevel '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptreadlevel '
+      write(1,*)'====================='
+      status = he5_ptreadlevel(ptid, 0, fieldname3(2), 
+     1dtype(2), con)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptreadlevel(ptid, 0, fieldname3(2),'
+         write(*,*)'	         dtype(2), con)'
+         write(*,*)'	Value returned by he5_ptreadlevel ', status
+         write(1,*)'	status = he5_ptreadlevel(ptid, 0, fieldname3(2),'
+         write(1,*)'	         dtype(2), con)'
+         write(1,*)'	Value returned by he5_ptreadlevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Convert 'C' array to Fortran order
+c     ---------------------------------- 
+      dimens(1) = 15
+      dimens(2) = 4
+      arr_rank  = 2
+      datatype  = HE5T_NATIVE_FLOAT
+
+ccc      status  = he5_ptc2fort(dimens, arr_rank, datatype, con, 
+ccc     1outcon)
+ccc      write(*,*) 'Status returned by he5_ptc2fort():  ',status
+
+c Test Case -- he5_ptc2fort
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptc2fort '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptc2fort '
+      write(1,*)'====================='
+      status  = he5_ptc2fort(dimens, arr_rank, datatype, con, 
+     1outcon)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptc2fort(dimens,arr_rank,'
+         write(*,*)'	         datatype,con,outcon)'
+         write(*,*)'	Value returned by he5_ptc2fort ', status
+         write(1,*)'    status = he5_ptc2fort(dimens,arr_rank,'
+         write(1,*)'	         datatype,con,outcon)'
+         write(1,*)'	Value returned by he5_ptc2fort ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname3(3)  = 'Species'
+
+c Test Case -- he5_ptreadlevel
+c
+      write(*,*)'Testing he5_ptreadlevel '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptreadlevel '
+      write(1,*)'====================='
+      status = he5_ptreadlevel(ptid, 0, fieldname3(3), 
+     1dtype(3), spec)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptreadlevel(ptid, 0, fieldname3(3),'
+         write(*,*)'	         dtype(3), spec)'
+         write(*,*)'	Value returned by he5_ptreadlevel ', status
+         write(1,*)'	status = he5_ptreadlevel(ptid, 0, fieldname3(3),'
+         write(1,*)'	         dtype(3), spec)'
+         write(1,*)'	Value returned by he5_ptreadlevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      attrname       = 'GlobalAttribute_int'
+
+      nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)
+
+c Test Case -- he5_ptinqattrs
+c
+      write(*,*)'Testing he5_ptinqattrs '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptinqattrs '
+      write(1,*)'======================'
+      nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)'
+         write(*,*)'	Value returned by he5_ptinqattrs ', nattr
+         write(1,*)'	nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)'
+         write(1,*)'	Value returned by he5_ptinqattrs ', nattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptreadattr
+c
+      write(*,*)'Testing he5_ptreadattr '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptreadattr '
+      write(1,*)'======================'
+      status   = he5_ptreadattr(ptid,attrname,attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptreadattr(ptid,attrname,attr)'
+         write(*,*)'	Value returned by he5_ptreadattr ', nattr
+         write(1,*)'	status   = he5_ptreadattr(ptid,attrname,attr)'
+         write(1,*)'	Value returned by he5_ptreadattr ', nattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "Simple Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      dtype(1)     =  HE5T_NATIVE_DOUBLE
+      dtype(2)     =  HE5T_NATIVE_FLOAT
+      dtype(3)     =  HE5T_NATIVE_CHAR
+
+      nrec      = 1
+      recs(1)   = 0
+
+      level     = 0
+
+      fieldname = 'Concentration'
+
+      conc_tt(1)   = 1.11
+      conc_tt(2)   = 2.22
+      conc_tt(3)   = 3.33
+      conc_tt(4)   = 4.44
+
+c Test Case -- he5_ptupdatelevel
+c
+      write(*,*)'Testing he5_ptupdatelevel '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptupdatelevel '
+      write(1,*)'========================='
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, dtype(2), conc_tt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptupdatelevel(ptid, level,'
+         write(*,*)'	         fieldname, nrec, recs,'
+         write(*,*)'	         dtype(2), conc_tt)'
+         write(*,*)'	Value returned by he5_ptupdatelevel ', status
+         write(1,*)'	status = he5_ptupdatelevel(ptid, level,'
+         write(1,*)'	         fieldname, nrec, recs,'
+         write(1,*)'	         dtype(2), conc_tt)'
+         write(1,*)'	Value returned by he5_ptupdatelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      fieldname = 'Time'
+
+      time_tt   = 13131313.0
+
+c Test Case -- he5_ptupdatelevel
+c
+      write(*,*)'Testing he5_ptupdatelevel '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptupdatelevel '
+      write(1,*)'========================='
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, dtype(1), time_tt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptupdatelevel(ptid, level,'
+         write(*,*)'	         fieldname, nrec, recs,'
+         write(*,*)'	         dtype(1), time_tt)'
+         write(*,*)'	Value returned by he5_ptupdatelevel ', status
+         write(1,*)'	status = he5_ptupdatelevel(ptid, level,'
+         write(1,*)'	         fieldname, nrec, recs,'
+         write(1,*)'	         dtype(1), time_tt)'
+         write(1,*)'	Value returned by he5_ptupdatelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      fieldname = 'Species'
+
+      spc_tt    = 'AM'
+
+c Test Case -- he5_ptupdatelevel
+c
+      write(*,*)'Testing he5_ptupdatelevel '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptupdatelevel '
+      write(1,*)'========================='
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, dtype(3), spc_tt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptupdatelevel(ptid, level,'
+         write(*,*)'	         fieldname, nrec, recs,'
+         write(*,*)'	         dtype(3), spc_tt)'
+         write(*,*)'	Value returned by he5_ptupdatelevel ', status
+         write(1,*)'	status = he5_ptupdatelevel(ptid, level,'
+         write(1,*)'	         fieldname, nrec, recs,'
+         write(1,*)'	         dtype(3), spc_tt)'
+         write(1,*)'	Value returned by he5_ptupdatelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Write attributes to "Fixed Buoy Point"
+c     --------------------------------------
+      attrname       = 'GlobalAttribute_int'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 1
+      attr           = 9999
+             
+
+c Test Case -- he5_ptwriteattr
+c
+      write(*,*)'Testing he5_ptwriteattr '
+      write(*,*)'======================='
+      write(1,*)'Testing he5_ptwriteattr '
+      write(1,*)'======================='
+      status   = he5_ptwriteattr(ptid,attrname,ntype,fortcount,
+     1attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(*,*)'	           ntype,fortcount,attr)'
+         write(*,*)'	Value returned by he5_ptwriteattr ', status
+         write(1,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(1,*)'	           ntype,fortcount,attr)'
+         write(1,*)'	Value returned by he5_ptwriteattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      attrname       = 'GroupAttribute'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 5
+      attr1(1)       = 1
+      attr1(2)       = 2
+      attr1(3)       = 3
+      attr1(4)       = 4
+      attr1(5)       = 5
+
+c Test Case -- he5_ptwritegrpattr
+c
+      write(*,*)'Testing he5_ptwritegrpattr '
+      write(*,*)'=========================='
+      write(1,*)'Testing he5_ptwritegrpattr '
+      write(1,*)'=========================='
+      status   = he5_ptwritegrpattr(ptid,attrname,ntype,fortcount,
+     1attr1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptwritegrpattr(ptid,attrname,'
+         write(*,*)'	           ntype,fortcount,attr1)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status   = he5_ptwritegrpattr(ptid,attrname,'
+         write(1,*)'	           ntype,fortcount,attr1)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      levelname      = 'Observations'
+      attrname       = 'LocalAttribute'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 5
+      attr2(1)       = 10
+      attr2(2)       = 20
+      attr2(3)       = 30
+      attr2(4)       = 40
+      attr2(5)       = 50
+
+c Test Case -- he5_ptwritelocattr
+c
+      write(*,*)'Testing he5_ptwritelocattr '
+      write(*,*)'=========================='
+      write(1,*)'Testing he5_ptwritelocattr '
+      write(1,*)'=========================='
+      status   = he5_ptwritelocattr(ptid,levelname,attrname,
+     1ntype,fortcount,attr2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptwritelocattr(ptid,'
+         write(*,*)'	           levelname,attrname,ntype,'
+         write(*,*)'	           fortcount,attr2)'
+         write(*,*)'	Value returned by he5_ptwritelocattr ', status
+         write(1,*)'	status   = he5_ptwritelocattr(ptid,'
+         write(1,*)'	           levelname,attrname,ntype,'
+         write(1,*)'	           fortcount,attr2)'
+         write(1,*)'	Value returned by he5_ptwritelocattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      attrname       = 'GlobalAttribute_float'
+      ntype          = HE5T_NATIVE_FLOAT
+      fortcount(1)   = 1
+      flt            = -7.5
+
+c Test Case -- he5_ptwriteattr
+c
+      write(*,*)'Testing he5_ptwriteattr '
+      write(*,*)'======================='
+      write(1,*)'Testing he5_ptwriteattr '
+      write(1,*)'======================='
+      status   = he5_ptwriteattr(ptid,attrname,
+     1ntype,fortcount,flt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(*,*)'	           ntype,fortcount,flt)'
+         write(*,*)'	Value returned by he5_ptwriteattr ', status
+         write(1,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(1,*)'	           ntype,fortcount,flt)'
+         write(1,*)'	Value returned by he5_ptwriteattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      null_char_0  = '0'
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Global Attributes
+c     -----------------
+      attrname       = 'GlobalAttribute_int'
+             
+      print *,'Global Attribute:   '
+
+c Test Case -- he5_ptreadattr
+c
+      write(*,*)'Testing he5_ptreadattr '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptreadattr '
+      write(1,*)'======================'
+      status   = he5_ptreadattr(ptid,attrname,attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptreadattr(ptid,attrname,attr)'
+         write(*,*)'	Value returned by he5_ptreadattr ', status
+         write(1,*)'	status   = he5_ptreadattr(ptid,attrname,attr)'
+         write(1,*)'	Value returned by he5_ptreadattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptinqattrs
+c
+      write(*,*)'Testing he5_ptinqattrs '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptinqattrs '
+      write(1,*)'======================'
+      nattr   = he5_ptinqattrs(ptid,null_char_0,strbufsize)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nattr   = he5_ptinqattrs(ptid,'
+         write(*,*)'	          null_char_0,strbufsize)'
+         write(*,*)'	Value returned by he5_ptinqattrs ', nattr
+         write(1,*)'	nattr   = he5_ptinqattrs(ptid,'
+         write(1,*)'	          null_char_0,strbufsize)'
+         write(1,*)'	Value returned by he5_ptinqattrs ', nattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptinqattrs
+c
+      write(*,*)'Testing he5_ptinqattrs '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptinqattrs '
+      write(1,*)'======================'
+      nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)'
+         write(*,*)'	Value returned by he5_ptinqattrs ', nattr
+         write(1,*)'	nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)'
+         write(1,*)'	Value returned by he5_ptinqattrs ', nattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      attrname       = 'GlobalAttribute_int'
+
+c Test Case -- he5_ptattrinfo
+c
+      write(*,*)'Testing he5_ptattrinfo '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptattrinfo '
+      write(1,*)'======================'
+      status   = he5_ptattrinfo(ptid,attrname,ntype,sz)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptattrinfo(ptid,attrname,ntype,sz)'
+         write(*,*)'	Value returned by he5_ptattrinfo ', status
+         write(1,*)'	status   = he5_ptattrinfo(ptid,attrname,ntype,sz)'
+         write(1,*)'	Value returned by he5_ptattrinfo ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptattrinfo
+c
+      write(*,*)'Testing he5_ptattrinfo '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptattrinfo '
+      write(1,*)'======================'
+      status   = he5_ptattrinfo(ptid,attrname,ntype,sz)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptattrinfo(ptid,attrname,ntype,sz)'
+         write(*,*)'	Value returned by he5_ptattrinfo ', status
+         write(1,*)'	status   = he5_ptattrinfo(ptid,attrname,ntype,sz)'
+         write(1,*)'	Value returned by he5_ptattrinfo ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptreadattr
+c
+      write(*,*)'Testing he5_ptreadattr '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptreadattr '
+      write(1,*)'======================'
+      status   = he5_ptreadattr(ptid,attrname,flt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptreadattr(ptid,attrname,flt)'
+         write(*,*)'	Value returned by he5_ptreadattr ', status
+         write(1,*)'	status   = he5_ptreadattr(ptid,attrname,flt)'
+         write(1,*)'	Value returned by he5_ptreadattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      attrname       = 'GroupAttribute'
+
+c Test Case -- he5_ptreadgrpattr
+c
+      write(*,*)'Testing he5_ptreadgrpattr'
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptreadgrpattr'
+      write(1,*)'========================='
+      status = he5_ptreadgrpattr(ptid,attrname,attr1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptreadgrpattr(ptid,attrname,attr1)'
+         write(*,*)'	Value returned by he5_ptreadgrpattr ', status
+         write(1,*)'	status = he5_ptreadgrpattr(ptid,attrname,attr1)'
+         write(1,*)'	Value returned by he5_ptreadgrpattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptinqgrpattrs
+c
+      write(*,*)'Testing he5_ptinqgrpattrs '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptinqgrpattrs '
+      write(1,*)'========================='
+      nattr = he5_ptinqgrpattrs(ptid,null_char_0,strbufsize)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nattr = he5_ptinqgrpattrs(ptid,'
+         write(*,*)'	        null_char_0,strbufsize)'
+         write(*,*)'	Value returned by he5_ptinqgrpattrs ', nattr
+         write(1,*)'	nattr = he5_ptinqgrpattrs(ptid,'
+         write(1,*)'	        null_char_0,strbufsize)'
+         write(1,*)'	Value returned by he5_ptinqgrpattrs ', nattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptinqgrpattrs
+c
+      write(*,*)'Testing he5_ptinqgrpattrs '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptinqgrpattrs '
+      write(1,*)'========================='
+      nattr = he5_ptinqgrpattrs(ptid,attrlist,strbufsize)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nattr = he5_ptinqgrpattrs(ptid,'
+         write(*,*)'	        attrlist,strbufsize)'
+         write(*,*)'	Value returned by he5_ptinqgrpattrs ', status
+         write(1,*)'	nattr = he5_ptinqgrpattrs(ptid,'
+         write(1,*)'	        attrlist,strbufsize)'
+         write(1,*)'	Value returned by he5_ptinqgrpattrs ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      attrname       = 'GroupAttribute'
+
+c Test Case -- he5_ptgrpattrinfo
+c
+      write(*,*)'Testing he5_ptgrpattrinfo '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptgrpattrinfo '
+      write(1,*)'========================='
+      status   = he5_ptgrpattrinfo(ptid,attrname,ntype,sz)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptgrpattrinfo(ptid,'
+         write(*,*)'	           attrname,ntype,sz)'
+         write(*,*)'	Value returned by he5_ptgrpattrinfo ', status
+         write(1,*)'	status   = he5_ptgrpattrinfo(ptid,'
+         write(1,*)'	           attrname,ntype,sz)'
+         write(1,*)'	Value returned by he5_ptgrpattrinfo ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      attrname       = 'LocalAttribute'
+      levelname      = 'Observations'
+
+c Test Case -- he5_ptreadlocattr
+c
+      write(*,*)'Testing he5_ptreadlocattr '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptreadlocattr '
+      write(1,*)'========================='
+      status = he5_ptreadlocattr(ptid,levelname,attrname,attr2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptreadlocattr(ptid,'
+         write(*,*)'	         levelname,attrname,attr2)'
+         write(*,*)'	Value returned by he5_ptreadlocattr ', status
+         write(1,*)'	status = he5_ptreadlocattr(ptid,'
+         write(1,*)'	         levelname,attrname,attr2)'
+         write(1,*)'	Value returned by he5_ptreadlocattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptinqlocattrs
+c
+      write(*,*)'Testing he5_ptinqlocattrs '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptinqlocattrs '
+      write(1,*)'========================='
+      nattr = he5_ptinqlocattrs(ptid,levelname,null_char_0,strbufsize)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nattr = he5_ptinqlocattrs(ptid,'
+         write(*,*)'	        levelname,null_char_0,strbufsize)'
+         write(*,*)'	Value returned by he5_ptinqlocattrs ', nattr
+         write(1,*)'	nattr = he5_ptinqlocattrs(ptid,'
+         write(1,*)'	        levelname,null_char_0,strbufsize)'
+         write(1,*)'	Value returned by he5_ptinqlocattrs ', nattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptinqlocattrs
+c
+      write(*,*)'Testing he5_ptinqlocattrs '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptinqlocattrs '
+      write(1,*)'====================='
+      nattr = he5_ptinqlocattrs(ptid,levelname,attrlist,strbufsize)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nattr = he5_ptinqlocattrs(ptid,'
+         write(*,*)'	        levelname,attrlist,strbufsize)'
+         write(*,*)'	Value returned by he5_ptinqlocattrs ', nattr
+         write(1,*)'	nattr = he5_ptinqlocattrs(ptid,'
+         write(1,*)'	        levelname,attrlist,strbufsize)'
+         write(1,*)'	Value returned by he5_ptinqlocattrs ', nattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptlocattrinfo
+c
+      write(*,*)'Testing he5_ptlocattrinfo '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptlocattrinfo '
+      write(1,*)'========================='
+      status = he5_ptlocattrinfo(ptid,levelname,attrname,ntype,sz)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptlocattrinfo(ptid,'
+         write(*,*)'	         levelname,attrname,ntype,sz)'
+         write(*,*)'	Value returned by he5_ptlocattrinfo ', status
+         write(1,*)'	status = he5_ptlocattrinfo(ptid,'
+         write(1,*)'	         levelname,attrname,ntype,sz)'
+         write(1,*)'	Value returned by he5_ptlocattrinfo ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      null_char_0  = '0'
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      fieldgroup = HE5_HDFE_DATAGROUP
+      fieldname  = 'Observations'
+
+c Test Case -- he5_ptinqdatatype
+c
+      write(*,*)'Testing he5_ptinqdatatype '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptinqdatatype '
+      write(1,*)'========================='
+      status = he5_ptinqdatatype(ptid,fieldname,null_char_0,fieldgroup,
+     1datatype,classid,order,size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptinqdatatype(ptid,fieldname,'
+         write(*,*)'	         null_char_0,fieldgroup,datatype,classid,'
+         write(*,*)'	         order,size)'
+         write(*,*)'	Value returned by he5_ptinqdatatype ', status
+         write(1,*)'	status = he5_ptinqdatatype(ptid,fieldname,'
+         write(1,*)'	         null_char_0,fieldgroup,datatype,classid,'
+         write(1,*)'	         order,size)'
+         write(1,*)'	Value returned by he5_ptinqdatatype ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      fieldgroup   = HE5_HDFE_ATTRGROUP
+      attrname     = 'GlobalAttribute_int'
+
+c Test Case -- he5_ptinqdatatype
+c
+      write(*,*)'Testing he5_ptinqdatatype '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptinqdatatype '
+      write(1,*)'========================='
+      status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup,
+     1datatype,classid,order,size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptinqdatatype(ptid,null_char_0,'
+         write(*,*)'	         attrname,fieldgroup,datatype,'
+         write(*,*)'	         classid,order,size)'
+         write(*,*)'	Value returned by he5_ptinqdatatype ', status
+         write(1,*)'	status = he5_ptinqdatatype(ptid,null_char_0,'
+         write(1,*)'	         attrname,fieldgroup,datatype,'
+         write(1,*)'	         classid,order,size)'
+         write(1,*)'	Value returned by he5_ptinqdatatype ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      fieldgroup   = HE5_HDFE_GRPATTRGROUP
+      attrname     = 'GroupAttribute'
+
+c Test Case -- he5_ptinqdatatype
+c
+      write(*,*)'Testing he5_ptinqdatatype '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptinqdatatype '
+      write(1,*)'========================='
+      status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup,
+     1datatype,classid,order,size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptinqdatatype(ptid,null_char_0,'
+         write(*,*)'	         attrname,fieldgroup,datatype,'
+         write(*,*)'	         classid,order,size)'
+         write(*,*)'	Value returned by he5_ptinqdatatype ', status
+         write(1,*)'	status = he5_ptinqdatatype(ptid,null_char_0,'
+         write(1,*)'	         attrname,fieldgroup,datatype,'
+         write(1,*)'	         classid,order,size)'
+         write(1,*)'	Value returned by he5_ptinqdatatype ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      fieldname    = 'Observations'
+      fieldgroup   = HE5_HDFE_LOCATTRGROUP
+      attrname     = 'LocalAttribute'
+
+c Test Case -- he5_ptinqdatatype
+c
+      write(*,*)'Testing he5_ptinqdatatype '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptinqdatatype '
+      write(1,*)'========================='
+      status = he5_ptinqdatatype(ptid,fieldname,attrname,fieldgroup,
+     1datatype,classid,order,size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptinqdatatype(ptid,fieldname,'
+         write(*,*)'	         attrname,fieldgroup,datatype,'
+         write(*,*)'	         classid,order,size)'
+         write(*,*)'	Value returned by he5_ptinqdatatype ', status
+         write(1,*)'	status = he5_ptinqdatatype(ptid,fieldname,'
+         write(1,*)'	         attrname,fieldgroup,datatype,'
+         write(1,*)'	         classid,order,size)'
+         write(1,*)'	Value returned by he5_ptinqdatatype ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      close(unit=1)
+
+   27 format(' ')
+  230 format('********Error unexpected**********')
+  240 format('***********Passed Test*********')
+
+      stop
+      end
+
+
diff --git a/testdrivers/point/testpoint64.f b/testdrivers/point/testpoint64.f
new file mode 100755
index 0000000..9839ffc
--- /dev/null
+++ b/testdrivers/point/testpoint64.f
@@ -0,0 +1,3668 @@
+
+c----------------------------------------------------------------------------
+c       FILE:     testpoint64.f                                               
+c       PURPOSE:  To test HDF-EOS5 Point interface              
+c       Author:   C. Praderas, Emergent IT Inc.         
+c       Date:     June 2001                              
+c----------------------------------------------------------------------------
+
+      program       he5_pttestpoint64
+
+      implicit      none
+
+      include       'hdfeos5.inc'
+
+      integer       status 
+      integer       ptfid 
+      integer       ptid1, ptid2, ptid3
+      integer       ptid
+      integer       rank_1(3)
+      integer       rank_2(5)
+      integer       rank_3(4)
+      integer       rank_4(4)
+      integer       rank_5(6)
+      integer       dtype_1(3)
+      integer       dtype_2(5)
+      integer       dtype_3(4)
+      integer       dtype_4(4)
+      integer       dtype_5(6)
+      integer       array_1(3)
+      integer       array_2(5)
+      integer       array_3(4)
+      integer       array_4(4)
+      integer       array_5(6)
+      integer       i, zero
+      integer       rank
+      integer       datatype
+      integer       attr
+      integer       nflds
+      integer       level
+      integer       arr_rank
+      integer       dtype(3)
+      integer       nrecs
+      integer       nlevels
+      integer       attr1(5)
+      integer       attr2(5)
+      integer       ntype
+      integer       classid
+      integer       order
+      integer       fieldgroup
+      integer       rank_tt(3)
+      integer       dtype_tt(3)
+      integer       he5_ptopen
+      integer       he5_ptcreate
+      integer       he5_ptdetach
+      integer       he5_ptclose
+      integer       he5_ptattach
+      integer       he5_ptdeflevel 
+      integer       he5_ptdeflinkage 
+      integer       he5_ptwritelevel 
+      integer       he5_ptfort2c
+      integer       he5_ptwrbckptr
+      integer       he5_ptwrfwdptr
+      integer       he5_ptwriteattr 
+      integer       he5_ptreadlevel
+      integer       he5_ptlevelinfo 
+      integer       he5_ptnrecs
+      integer       he5_ptnlevels
+      integer       he5_ptnfields
+      integer       he5_ptc2fort
+      integer       he5_ptinqattrs
+      integer       he5_ptreadattr
+      integer       he5_ptupdatelevel 
+      integer       he5_ptwritegrpattr
+      integer       he5_ptwritelocattr
+      integer       he5_ptinqgrpattrs
+      integer       he5_ptinqlocattrs
+      integer       he5_ptattrinfo
+      integer       he5_ptgrpattrinfo
+      integer       he5_ptlocattrinfo
+      integer       he5_ptreadgrpattr
+      integer       he5_ptreadlocattr
+      integer       he5_ptinqdatatype
+
+      integer*8     dims_1(3,1)
+      integer*8     dims_2(5,1)
+      integer*8     dims_3(4,1)
+      integer*8     dims_4(4,1)
+      integer*8     dims_5(6,1)
+      integer*8     n
+      integer*8     count(1)
+      integer*8     dimens(2)
+      integer*8     fortcount(8)
+      integer*8     datasize
+      integer*8     offset_tt(3)
+      integer*8     dim_sizes_tt(3)
+      integer*8     nattr
+      integer*8     strbufsize
+      integer*8     recs(32)
+      integer*8     nrec
+      integer*8     sz
+      integer*8     size
+
+      integer*4     date_tt
+      integer*4     date(3)
+      integer*4     date4_tt
+      integer*4     date4(3)
+      integer*4     wgt_tt
+      integer*4     wgt(3)
+
+      real*4        flt      
+      real*4        concentration_tt(4)
+      real*4        conc(15,4)
+      real*4        outconc(4,15)
+      real*4        rain_tt
+      real*4        rain(20)
+      real*4        temp_tt
+      real*4        temp(20)
+      real*4        rain5_tt
+      real*4        rain5(25)
+      real*4        temp5_tt
+      real*4        temp5(25)
+      real*4        con(4,15)
+      real*4        outcon(15,4)
+      real*4        conc_tt(4)
+
+      real*8        time_tt
+      real*8        time(15)
+      real*8        lon_tt
+      real*8        lon(3)
+      real*8        lat_tt
+      real*8        lat(3)
+      real*8        time3_tt
+      real*8        time3(20)
+      real*8        time5_tt
+      real*8        time5(25)
+      real*8        lon5_tt
+      real*8        lon5(25)
+      real*8        lat5_tt
+      real*8        lat5(25)
+ 
+      character*240 fieldlist1
+      character*240 fieldlist2
+      character*240 fieldlist3
+      character*240 fieldlist4
+      character*240 fieldlist5
+      character*80  levelname
+      character*20  parent
+      character*20  child
+      character*20  linkfield
+      character*80  fieldname
+      character*80  attrname
+      character*8   spc_tt
+      character*8   spc(15)
+      character*8   desc_tt
+      character*8   desc(3)
+      character*8   id_tt
+      character*8   id(3)
+      character*8   id3_tt
+      character*8   id3(20)
+      character*8   desc4_tt
+      character*8   desc4(3)
+      character*8   id4_tt
+      character*8   id4(3)
+      character*8   id5_tt
+      character*8   id5(25)
+      character*80  fieldname3(3)
+      character*240 fieldlist
+      character*240 attrlist
+      character*8   spec(15)
+      character*1   null_char_0
+
+      open(unit=1, file="testpoint.txt", status = "UNKNOWN")
+
+      write(*,*)' '
+      write(1,*)' '
+      write(*,*)'Testing he5_ptath FORTRAN 77 interface'
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_ptath FORTRAN 77 interface'
+      write(1,*)'======================================'
+      write(*,*)' '
+      write(1,*)' '
+
+      zero=0
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_TRUNC) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_TRUNC)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_TRUNC)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptcreate
+c
+      write(*,*)'Testing he5_ptcreate '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptcreate '
+      write(1,*)'====================='
+      ptid1 = he5_ptcreate(ptfid, "Simple Point")
+      if (ptid1 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid1 = he5_ptcreate(ptfid, "Simple Point")'
+         write(*,*)'	Value returned by he5_ptcreate ', ptid1
+         write(1,*)'	ptid1 = he5_ptcreate(ptfid, "Simple Point")'
+         write(1,*)'	Value returned by he5_ptcreate ', ptid1
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptcreate
+c
+      write(*,*)'Testing he5_ptcreate '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptcreate '
+      write(1,*)'====================='
+      ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point")
+      if (ptid2 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptcreate ', ptid2
+         write(1,*)'	ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptcreate ', ptid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptcreate
+c
+      write(*,*)'Testing he5_ptcreate '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptcreate '
+      write(1,*)'====================='
+      ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point")
+      if (ptid3 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point")'
+         write(*,*)'	Value returned by he5_ptcreate ', ptid3
+         write(1,*)'	ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point")'
+         write(1,*)'	Value returned by he5_ptcreate ', ptid3
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid1)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid1)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid2)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid2)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid3)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid3)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "Simple Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c     Populate input information structure 
+c     ------------------------------------ 
+
+      levelname = 'Sensor'
+
+      rank_1(1)  = 1
+      rank_1(2)  = 1
+      rank_1(3)  = 1
+
+      fieldlist1 = 'Time,Concentration,Species'
+
+      dtype_1(1)     =  HE5T_NATIVE_DOUBLE
+      dtype_1(2)     =  HE5T_NATIVE_FLOAT
+      dtype_1(3)     =  HE5T_NATIVE_CHAR
+
+      array_1(1)     =  0
+      array_1(2)     =  1
+      array_1(3)     =  1
+
+      dims_1(1,1)      =  1
+      dims_1(2,1)      =  4
+      dims_1(3,1)      =  8
+
+c Test Case -- he5_ptdeflevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdeflevel '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdeflevel '
+      write(1,*)'====================='
+      status = he5_ptdeflevel(ptid, levelname, rank_1, fieldlist1,
+     1dims_1, dtype_1, array_1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdeflevel(ptid, levelname, rank_1'
+         write(*,*)'             fieldlist1,dims_1, dtype_1, array_1)'
+         write(*,*)'	Value returned by he5_ptdeflevel ', status
+         write(1,*)'	status = he5_ptdeflevel(ptid, levelname, rank_1'
+         write(1,*)'             fieldlist1,dims_1, dtype_1, array_1)'
+         write(1,*)'	Value returned by he5_ptdeflevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c     Populate input information structure 
+c     ------------------------------------ 
+
+      levelname = 'Desc-Loc'
+
+      rank_2(1)  = 1
+      rank_2(2)  = 1
+      rank_2(3)  = 1
+      rank_2(4)  = 1
+      rank_2(5)  = 1
+
+      fieldlist2 = 'Label,Longitude,Latitude,DeployDate,ID'
+
+      dtype_2(1)     =  HE5T_NATIVE_CHAR
+      dtype_2(2)     =  HE5T_NATIVE_DOUBLE
+      dtype_2(3)     =  HE5T_NATIVE_DOUBLE
+      dtype_2(4)     =  HE5T_NATIVE_INT
+      dtype_2(5)     =  HE5T_NATIVE_CHAR
+
+      array_2(1)  = 1
+      array_2(2)  = 0
+      array_2(3)  = 0
+      array_2(4)  = 0
+      array_2(5)  = 1
+
+      dims_2(1,1)      =  8
+      dims_2(2,1)      =  1
+      dims_2(3,1)      =  1
+      dims_2(4,1)      =  1
+      dims_2(5,1)      =  8
+
+
+c Test Case -- he5_ptdeflevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdeflevel '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdeflevel '
+      write(1,*)'====================='
+      status = he5_ptdeflevel(ptid, levelname, rank_2, fieldlist2,
+     1dims_2, dtype_2, array_2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdeflevel(ptid, levelname, rank_2'
+         write(*,*)'             fieldlist2,dims_2, dtype_2, array_2)'
+         write(*,*)'	Value returned by he5_ptdeflevel ', status
+         write(1,*)'	status = he5_ptdeflevel(ptid, levelname, rank_2'
+         write(1,*)'             fieldlist2,dims_2, dtype_2, array_2)'
+         write(1,*)'	Value returned by he5_ptdeflevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Populate input information structure 
+c     ------------------------------------ 
+
+      levelname = 'Observations'
+
+      rank_3(1)  = 1
+      rank_3(2)  = 1
+      rank_3(3)  = 1
+      rank_3(4)  = 1
+
+      fieldlist3 = 'Time,Rainfall,Temperature,ID'
+
+      dtype_3(1)     =  HE5T_NATIVE_DOUBLE
+      dtype_3(2)     =  HE5T_NATIVE_FLOAT
+      dtype_3(3)     =  HE5T_NATIVE_FLOAT
+      dtype_3(4)     =  HE5T_NATIVE_CHAR
+
+      array_3(1)  = 0
+      array_3(2)  = 0
+      array_3(3)  = 0
+      array_3(4)  = 1
+
+      dims_3(1,1)      =  1
+      dims_3(2,1)      =  1
+      dims_3(3,1)      =  1
+      dims_3(4,1)      =  8
+
+c Test Case -- he5_ptdeflevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdeflevel '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptdeflevel '
+      write(1,*)'======================'
+      status = he5_ptdeflevel(ptid, levelname, rank_3, fieldlist3,
+     1dims_3, dtype_3, array_3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdeflevel(ptid, levelname, rank_3'
+         write(*,*)'             fieldlist3,dims_3, dtype_3, array_3)'
+         write(*,*)'	Value returned by he5_ptdeflevel ', status
+         write(1,*)'	status = he5_ptdeflevel(ptid, levelname, rank_3'
+         write(1,*)'             fieldlist3,dims_3, dtype_3, array_3)'
+         write(1,*)'	Value returned by he5_ptdeflevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      parent    = 'Desc-Loc'
+      child     = 'Observations'
+      linkfield = 'ID'
+
+c Test Case -- he5_ptdeflinkage
+c
+      write(*,*)'Testing he5_ptdeflinkage '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptdeflinkage '
+      write(1,*)'========================'
+      status = he5_ptdeflinkage(ptid, parent, child, linkfield)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdeflinkage(ptid, parent, child,'
+         write(*,*)'	         linkfield)'
+         write(*,*)'	Value returned by he5_ptdeflinkage ', status
+         write(1,*)'	status = he5_ptdeflinkage(ptid, parent, child,'
+         write(1,*)'	         linkfield)'
+         write(1,*)'	Value returned by he5_ptdeflinkage ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FloatBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FloatBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FloatBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      levelname = 'Description'
+
+      rank_4(1)  = 1
+      rank_4(2)  = 1
+      rank_4(3)  = 1
+      rank_4(4)  = 1
+
+      fieldlist4 = 'Label,DeployDate,Weight,ID'
+
+      dtype_4(1)     =  HE5T_NATIVE_CHAR
+      dtype_4(2)     =  HE5T_NATIVE_INT
+      dtype_4(3)     =  HE5T_NATIVE_INT
+      dtype_4(4)     =  HE5T_NATIVE_CHAR
+
+      array_4(1)  = 1
+      array_4(2)  = 0
+      array_4(3)  = 0
+      array_4(4)  = 1
+
+      dims_4(1,1)      =  8
+      dims_4(2,1)      =  1
+      dims_4(3,1)      =  1
+      dims_4(4,1)      =  8
+
+c Test Case -- he5_ptdeflevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdeflevel '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdeflevel '
+      write(1,*)'====================='
+      status = he5_ptdeflevel(ptid, levelname, rank_4, fieldlist4,
+     1dims_4, dtype_4, array_4)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdeflevel(ptid, levelname, rank_4'
+         write(*,*)'             fieldlist4,dims_4, dtype_4, array_4)'
+         write(*,*)'	Value returned by he5_ptdeflevel ', status
+         write(1,*)'	status = he5_ptdeflevel(ptid, levelname, rank_4'
+         write(1,*)'             fieldlist4,dims_4, dtype_4, array_4)'
+         write(1,*)'	Value returned by he5_ptdeflevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      levelname = 'Measurements'
+
+      rank_5(1)  = 1
+      rank_5(2)  = 1
+      rank_5(3)  = 1
+      rank_5(4)  = 1
+      rank_5(5)  = 1
+      rank_5(6)  = 1
+
+      fieldlist5 = 'Time,Longitude,Latitude,Rainfall,Temperature,ID'
+
+      dtype_5(1)     =  HE5T_NATIVE_DOUBLE
+      dtype_5(2)     =  HE5T_NATIVE_DOUBLE
+      dtype_5(3)     =  HE5T_NATIVE_DOUBLE
+      dtype_5(4)     =  HE5T_NATIVE_FLOAT
+      dtype_5(5)     =  HE5T_NATIVE_FLOAT
+      dtype_5(6)     =  HE5T_NATIVE_CHAR
+
+      array_5(1)  = 0
+      array_5(2)  = 0
+      array_5(3)  = 0
+      array_5(4)  = 0
+      array_5(5)  = 0
+      array_5(6)  = 1
+
+      dims_5(1,1)      =  1
+      dims_5(2,1)      =  1
+      dims_5(3,1)      =  1
+      dims_5(4,1)      =  1
+      dims_5(5,1)      =  1
+      dims_5(6,1)      =  8
+
+
+c Test Case -- he5_ptdeflevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdeflevel '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdeflevel '
+      write(1,*)'====================='
+      status = he5_ptdeflevel(ptid, levelname, rank_5, fieldlist5,
+     1dims_5, dtype_5, array_5)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdeflevel(ptid, levelname, rank_5'
+         write(*,*)'             fieldlist5,dims_5, dtype_5, array_5)'
+         write(*,*)'	Value returned by he5_ptdeflevel ', status
+         write(1,*)'	status = he5_ptdeflevel(ptid, levelname, rank_5'
+         write(1,*)'             fieldlist5,dims_5, dtype_5, array_5)'
+         write(1,*)'	Value returned by he5_ptdeflevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      parent    = 'Description'
+      child     = 'Measurements'
+      linkfield = 'ID'
+
+c Test Case -- he5_ptdeflinkage
+c
+      write(*,*)'Testing he5_ptdeflinkage '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdeflinkage '
+      write(1,*)'====================='
+      status = he5_ptdeflinkage(ptid, parent, child, linkfield)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdeflinkage(ptid, parent, child,'
+         write(*,*)'	         linkfield)'
+         write(*,*)'	Value returned by he5_ptdeflinkage ', status
+         write(1,*)'	status = he5_ptdeflinkage(ptid, parent, child,'
+         write(1,*)'	         linkfield)'
+         write(1,*)'	Value returned by he5_ptdeflinkage ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "Simple Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Read Simple Point 
+c     ----------------- 
+      open(unit=10, file='simple.txt', status='OLD')
+
+      n = 0
+      do 10 i=1,1000
+         read(10, 110, end=100) time_tt, concentration_tt(1), 
+     1                                  concentration_tt(2), 
+     2                                  concentration_tt(3),
+     3                                  concentration_tt(4), 
+     4                                  spc_tt
+         time(i)     = time_tt
+         conc(i,1)   = concentration_tt(1)
+         conc(i,2)   = concentration_tt(2)
+         conc(i,3)   = concentration_tt(3)
+         conc(i,4)   = concentration_tt(4)
+         spc(i)      = spc_tt
+
+         n = n + 1
+   10 continue
+
+  100 close(unit=10)
+  110 format(F13.1,F6.2,F6.2,F6.2,F6.2,2X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Time'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, time)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, time)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, time)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+   
+c.....Convert array to 'C' order
+      dimens(1) = 15
+      dimens(2) = 4
+      rank      = 2
+      datatype  = HE5T_NATIVE_FLOAT
+
+c Test Case -- he5_ptfort2c
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptfort2c '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptfort2c '
+      write(1,*)'====================='
+      status    = he5_ptfort2c(dimens, rank, datatype, conc, 
+     1outconc)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptfort2c(dimens,rank,datatype,conc,'
+         write(*,*)'	         outconc)'
+         write(*,*)'	Value returned by he5_ptfort2c ', status
+         write(1,*)'	status = he5_ptfort2c(dimens,rank,datatype,conc,'
+         write(1,*)'	         outconc)'
+         write(1,*)'	Value returned by he5_ptfort2c ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Concentration'
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, outconc)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, outconc)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, outconc)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Species'
+      datatype       = HE5T_NATIVE_CHAR
+
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, spc)
+      write(*,*) 'Status returned by he5_ptwritelevel():  ',status
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Read FixedBuoy Point 
+c     -------------------- 
+      open(unit=11, file='fixedBuoy0.txt', status='OLD')
+
+      n = 0
+      do 20 i=1,1000
+         read(11, 210, end=200) desc_tt, lon_tt, lat_tt, date_tt, 
+     1id_tt
+         desc(i)     = desc_tt
+         lon(i)      = lon_tt
+         lat(i)      = lat_tt
+         date(i)     = date_tt
+         id(i)       = id_tt
+
+         n = n + 1
+   20 continue
+
+  200 close(unit=11)
+  210 format(A8,F13.7,F13.7,I7,1X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Label'
+      datatype       = HE5T_NATIVE_CHAR
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, desc)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, desc)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, desc)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Longitude'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, lon)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, lon)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, lon)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Latitude'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, lat)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, lat)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, lat)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'DeployDate'
+      datatype       = HE5T_NATIVE_INT
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype,  date)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype,  date)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype,  date)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'ID'
+      datatype       = HE5T_NATIVE_CHAR
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, id)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, id)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, id)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c     Read FixedBuoy Point - Level 1
+c     ------------------------------ 
+      open(unit=12, file='fixedBuoy1.txt', status='OLD')
+
+      n = 0
+      do 30 i=1,1000
+         read(12, 310, end=300) time3_tt, rain_tt, temp_tt, id3_tt 
+         time3(i)     = time3_tt
+         rain(i)      = rain_tt
+         temp(i)      = temp_tt
+         id3(i)       = id3_tt
+
+         n = n + 1
+   30 continue
+
+  300 close(unit=12)
+  310 format(F13.2,F8.1,F8.2,3X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Time'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, time3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, time3)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, time3)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Rainfall'
+      datatype       = HE5T_NATIVE_FLOAT
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, rain)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, rain)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, rain)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Temperature'
+      datatype       = HE5T_NATIVE_FLOAT
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, temp)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, temp)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, temp)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      fieldname      = 'ID'
+      datatype       = HE5T_NATIVE_CHAR
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, id3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, id3)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, id3)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptwrbckptr
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwrbckptr '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptwrbckptr '
+      write(1,*)'====================='
+      status = he5_ptwrbckptr(ptid,1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptwrbckptr(ptid,1)'
+         write(*,*)'	Value returned by he5_ptwrbckptr ', status
+         write(1,*)'	status = he5_ptwrbckptr(ptid,1)'
+         write(1,*)'	Value returned by he5_ptwrbckptr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptwrfwdptr
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwrfwdptr '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptwrfwdptr '
+      write(1,*)'====================='
+      status = he5_ptwrfwdptr(ptid,1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptwrfwdptr(ptid,1)'
+         write(*,*)'	Value returned by he5_ptwrfwdptr ', status
+         write(1,*)'	status = he5_ptwrfwdptr(ptid,1)'
+         write(1,*)'	Value returned by he5_ptwrfwdptr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Write attributes to "Fixed Buoy Point"
+c     --------------------------------------
+      attrname       = 'GlobalAttribute_int'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 1
+      attr           = 9999 
+
+c Test Case -- he5_ptwriteattr
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwriteattr '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptwriteattr '
+      write(1,*)'====================='
+      status   = he5_ptwriteattr(ptid,attrname,ntype,fortcount,
+     1attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(*,*)'	           ntype,fortcount,attr)'
+         write(*,*)'	Value returned by he5_ptwriteattr ', status
+         write(1,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(1,*)'	           ntype,fortcount,attr)'
+         write(1,*)'	Value returned by he5_ptwriteattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FloatBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FloatBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FloatBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Read FloatBuoy Point - Level 0
+c     ------------------------------ 
+      open(unit=14, file='floatBuoy0.txt', status='OLD')
+
+      n = 0
+      do 40 i=1,1000
+         read(14, 410, end=400) desc4_tt, date4_tt, wgt_tt, id4_tt 
+         desc4(i)     = desc4_tt
+         date4(i)     = date4_tt
+         wgt(i)       = wgt_tt
+         id4(i)       = id4_tt
+
+         n = n + 1
+   40 continue
+
+  400 close(unit=14)
+  410 format(A8,I8,I7,2X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Label'
+      datatype       = HE5T_NATIVE_CHAR
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, desc4)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, desc4)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, desc4)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'DeployDate'
+      datatype       = HE5T_NATIVE_INT
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, date4)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, date4)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, date4)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Weight'
+      datatype       = HE5T_NATIVE_INT
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, wgt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, wgt)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, wgt)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'ID'
+      datatype       = HE5T_NATIVE_CHAR
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 0, count, fieldname, 
+     1datatype, id4)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(*,*)'	         fieldname,datatype, id4)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,0,count,'
+         write(1,*)'	         fieldname,datatype, id4)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c     Read FixedBuoy Point - Level 1
+c     ------------------------------ 
+      open(unit=15, file='floatBuoy1.txt', status='OLD')
+
+      n = 0
+      do 50 i=1,1000
+         read(15, 510, end=500) time5_tt, lon5_tt, lat5_tt,  
+     1rain5_tt,temp5_tt,id5_tt
+         time5(i)     = time5_tt
+         lon5(i)      = lon5_tt
+         lat5(i)      = lat5_tt
+         rain5(i)     = rain5_tt
+         temp5(i)     = temp5_tt
+         id5(i)       = id5_tt
+
+         n = n + 1
+   50 continue
+
+  500 close(unit=15)
+  510 format(F13.1,F13.6,F13.6,F8.1,F8.2,3X,A8)
+
+      count(1) = n
+
+      fieldname      = 'Time'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, time5)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, time5)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, time5)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Longitude'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, lon5)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, lon5)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, lon5)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Latitude'
+      datatype       = HE5T_NATIVE_DOUBLE
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, lat5)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, lat5)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, lat5)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Rainfall'
+      datatype       = HE5T_NATIVE_FLOAT
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, rain5)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, rain5)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'             fieldname,datatype, rain5)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'Temperature'
+      datatype       = HE5T_NATIVE_FLOAT
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, temp5)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, temp5)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, temp5)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname      = 'ID'
+      datatype       = HE5T_NATIVE_CHAR
+
+c Test Case -- he5_ptwritelevel
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptwritelevel '
+      write(*,*)'========================'
+      write(1,*)'Testing he5_ptwritelevel '
+      write(1,*)'========================'
+      status = he5_ptwritelevel(ptid, 1, count, fieldname, 
+     1datatype, id5)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(*,*)'	         fieldname,datatype, id5)'
+         write(*,*)'	Value returned by he5_ptwritelevel ', status
+         write(1,*)'    status = he5_ptwritelevel(ptid,1,count,'
+         write(1,*)'	         fieldname,datatype, id5)'
+         write(1,*)'	Value returned by he5_ptwritelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptwrbckptr
+c
+      write(*,*)'Testing he5_ptwrbckptr '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptwrbckptr '
+      write(1,*)'======================'
+      status = he5_ptwrbckptr(ptid,1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptwrbckptr(ptid,1)'
+         write(*,*)'	Value returned by he5_ptwrbckptr ', status
+         write(1,*)'	status = he5_ptwrbckptr(ptid,1)'
+         write(1,*)'	Value returned by he5_ptwrbckptr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptwrfwdptr
+c
+      write(*,*)'Testing he5_ptwrfwdptr '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptwrfwdptr '
+      write(1,*)'======================'
+      status = he5_ptwrfwdptr(ptid,1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptwrfwdptr(ptid,1)'
+         write(*,*)'	Value returned by he5_ptwrfwdptr ', status
+         write(1,*)'	status = he5_ptwrfwdptr(ptid,1)'
+         write(1,*)'	Value returned by he5_ptwrfwdptr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+
+c     Write attributes to "Float Buoy Point"
+c     --------------------------------------
+      attrname       = 'GlobalAttribute_float'
+      ntype          = HE5T_NATIVE_FLOAT
+      fortcount(1)   = 1
+      flt            = -7.5
+
+c Test Case -- he5_ptwriteattr
+c
+      write(*,*)'Testing he5_ptwriteattr '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptwriteattr '
+      write(1,*)'======================'
+      status   = he5_ptwriteattr(ptid,attrname,
+     1ntype,fortcount,flt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(*,*)'	           ntype,fortcount,flt)'
+         write(*,*)'	Value returned by he5_ptwriteattr ', status
+         write(1,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(1,*)'	           ntype,fortcount,flt)'
+         write(1,*)'	Value returned by he5_ptwriteattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "Simple Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Get level information 
+c     --------------------- 
+      level = 0
+
+c Test Case -- he5_ptlevelinfo
+c
+      write(*,*)'Testing he5_ptlevelinfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptlevelinfo '
+      write(1,*)'====================='
+      status = he5_ptlevelinfo(ptid, level, levelname, rank_tt,
+     1fieldlist, dim_sizes_tt, datasize, offset_tt, dtype_tt)
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status=he5_ptlevelinfo(ptid,level,levelname,'
+         write(*,*)'           rank_tt,fieldlist,dim_sizes_tt,'
+         write(*,*)'           datasize,offset_tt,dtype_tt)'
+         write(*,*)'	Value returned by he5_ptlevelinfo ', status
+         write(1,*)'    status=he5_ptlevelinfo(ptid,level,levelname,'
+         write(1,*)'           rank_tt,fieldlist,dim_sizes_tt,'
+         write(1,*)'           datasize,offset_tt,dtype_tt)'
+         write(1,*)'	Value returned by he5_ptlevelinfo ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Get the number of records in level
+c     ---------------------------------- 
+      level = 0
+
+c Test Case -- he5_ptnrecs
+c
+      write(*,*)'Testing he5_ptnrecs '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptnrecs '
+      write(1,*)'====================='
+      nrecs = he5_ptnrecs(ptid, level)
+      if (nrecs .le. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nrecs = he5_ptnrecs(ptid, level)'
+         write(*,*)'	Value returned by he5_ptnrecs ', nrecs
+         write(1,*)'	nrecs = he5_ptnrecs(ptid, level)'
+         write(1,*)'	Value returned by he5_ptnrecs ', nrecs
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptnlevels
+c
+      write(*,*)'Testing he5_ptnlevels '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptnlevels '
+      write(1,*)'====================='
+      nlevels = he5_ptnlevels(ptid)
+      if (nlevels .le. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nlevels = he5_ptnlevels(ptid)'
+         write(*,*)'	Value returned by he5_ptnlevels ', nlevels
+         write(1,*)'	nlevels = he5_ptnlevels(ptid)'
+         write(1,*)'	Value returned by he5_ptnlevels ', nlevels
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptnfields
+c
+      write(*,*)'Testing he5_ptnfields '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptnfields '
+      write(1,*)'====================='
+      nflds = he5_ptnfields(ptid, level, fieldlist, strbufsize)
+      if (nflds .le. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nflds = he5_ptnfields(ptid, level,'
+         write(*,*)'	        fieldlist, strbufsize)'
+         write(*,*)'	Value returned by he5_ptnfields ', nflds
+         write(1,*)'	nflds = he5_ptnfields(ptid, level,'
+         write(1,*)'	        fieldlist, strbufsize)'
+         write(1,*)'	Value returned by he5_ptnfields ', nflds
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Populate input information structure 
+c     ------------------------------------ 
+      dtype(1)     =  HE5T_NATIVE_DOUBLE
+      dtype(2)     =  HE5T_NATIVE_FLOAT
+      dtype(3)     =  HE5T_NATIVE_CHAR
+
+c     Read the level data and print out
+c     --------------------------------- 
+      fieldname3(1)  = 'Time'
+
+c Test Case -- he5_ptreadlevel
+c
+      write(*,*)'Testing he5_ptreadlevel '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptreadlevel '
+      write(1,*)'====================='
+      status = he5_ptreadlevel(ptid, 0, fieldname3(1), 
+     1dtype(1), time)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptreadlevel(ptid, 0, fieldname3(1),'
+         write(*,*)'	         dtype(1), time)'
+         write(*,*)'	Value returned by he5_ptreadlevel ', status
+         write(1,*)'	status = he5_ptreadlevel(ptid, 0, fieldname3(1),'
+         write(1,*)'	         dtype(1), time)'
+         write(1,*)'	Value returned by he5_ptreadlevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname3(2)  = 'Concentration'
+
+c Test Case -- he5_ptreadlevel
+c
+      write(*,*)'Testing he5_ptreadlevel '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptreadlevel '
+      write(1,*)'====================='
+      status = he5_ptreadlevel(ptid, 0, fieldname3(2), 
+     1dtype(2), con)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptreadlevel(ptid, 0, fieldname3(2),'
+         write(*,*)'	         dtype(2), con)'
+         write(*,*)'	Value returned by he5_ptreadlevel ', status
+         write(1,*)'	status = he5_ptreadlevel(ptid, 0, fieldname3(2),'
+         write(1,*)'	         dtype(2), con)'
+         write(1,*)'	Value returned by he5_ptreadlevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Convert 'C' array to Fortran order
+c     ---------------------------------- 
+      dimens(1) = 15
+      dimens(2) = 4
+      arr_rank  = 2
+      datatype  = HE5T_NATIVE_FLOAT
+
+ccc      status  = he5_ptc2fort(dimens, arr_rank, datatype, con, 
+ccc     1outcon)
+ccc      write(*,*) 'Status returned by he5_ptc2fort():  ',status
+
+c Test Case -- he5_ptc2fort
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptc2fort '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptc2fort '
+      write(1,*)'====================='
+      status  = he5_ptc2fort(dimens, arr_rank, datatype, con, 
+     1outcon)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'    status = he5_ptc2fort(dimens,arr_rank,'
+         write(*,*)'	         datatype,con,outcon)'
+         write(*,*)'	Value returned by he5_ptc2fort ', status
+         write(1,*)'    status = he5_ptc2fort(dimens,arr_rank,'
+         write(1,*)'	         datatype,con,outcon)'
+         write(1,*)'	Value returned by he5_ptc2fort ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      fieldname3(3)  = 'Species'
+
+c Test Case -- he5_ptreadlevel
+c
+      write(*,*)'Testing he5_ptreadlevel '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptreadlevel '
+      write(1,*)'====================='
+      status = he5_ptreadlevel(ptid, 0, fieldname3(3), 
+     1dtype(3), spec)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptreadlevel(ptid, 0, fieldname3(3),'
+         write(*,*)'	         dtype(3), spec)'
+         write(*,*)'	Value returned by he5_ptreadlevel ', status
+         write(1,*)'	status = he5_ptreadlevel(ptid, 0, fieldname3(3),'
+         write(1,*)'	         dtype(3), spec)'
+         write(1,*)'	Value returned by he5_ptreadlevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      attrname       = 'GlobalAttribute_int'
+
+      nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)
+
+c Test Case -- he5_ptinqattrs
+c
+      write(*,*)'Testing he5_ptinqattrs '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptinqattrs '
+      write(1,*)'======================'
+      nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)'
+         write(*,*)'	Value returned by he5_ptinqattrs ', nattr
+         write(1,*)'	nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)'
+         write(1,*)'	Value returned by he5_ptinqattrs ', nattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptreadattr
+c
+      write(*,*)'Testing he5_ptreadattr '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptreadattr '
+      write(1,*)'======================'
+      status   = he5_ptreadattr(ptid,attrname,attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptreadattr(ptid,attrname,attr)'
+         write(*,*)'	Value returned by he5_ptreadattr ', nattr
+         write(1,*)'	status   = he5_ptreadattr(ptid,attrname,attr)'
+         write(1,*)'	Value returned by he5_ptreadattr ', nattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "Simple Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "Simple Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      dtype(1)     =  HE5T_NATIVE_DOUBLE
+      dtype(2)     =  HE5T_NATIVE_FLOAT
+      dtype(3)     =  HE5T_NATIVE_CHAR
+
+      nrec      = 1
+      recs(1)   = 0
+
+      level     = 0
+
+      fieldname = 'Concentration'
+
+      conc_tt(1)   = 1.11
+      conc_tt(2)   = 2.22
+      conc_tt(3)   = 3.33
+      conc_tt(4)   = 4.44
+
+c Test Case -- he5_ptupdatelevel
+c
+      write(*,*)'Testing he5_ptupdatelevel '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptupdatelevel '
+      write(1,*)'========================='
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, dtype(2), conc_tt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptupdatelevel(ptid, level,'
+         write(*,*)'	         fieldname, nrec, recs,'
+         write(*,*)'	         dtype(2), conc_tt)'
+         write(*,*)'	Value returned by he5_ptupdatelevel ', status
+         write(1,*)'	status = he5_ptupdatelevel(ptid, level,'
+         write(1,*)'	         fieldname, nrec, recs,'
+         write(1,*)'	         dtype(2), conc_tt)'
+         write(1,*)'	Value returned by he5_ptupdatelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      fieldname = 'Time'
+
+      time_tt   = 13131313.0
+
+c Test Case -- he5_ptupdatelevel
+c
+      write(*,*)'Testing he5_ptupdatelevel '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptupdatelevel '
+      write(1,*)'========================='
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, dtype(1), time_tt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptupdatelevel(ptid, level,'
+         write(*,*)'	         fieldname, nrec, recs,'
+         write(*,*)'	         dtype(1), time_tt)'
+         write(*,*)'	Value returned by he5_ptupdatelevel ', status
+         write(1,*)'	status = he5_ptupdatelevel(ptid, level,'
+         write(1,*)'	         fieldname, nrec, recs,'
+         write(1,*)'	         dtype(1), time_tt)'
+         write(1,*)'	Value returned by he5_ptupdatelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      fieldname = 'Species'
+
+      spc_tt    = 'AM'
+
+c Test Case -- he5_ptupdatelevel
+c
+      write(*,*)'Testing he5_ptupdatelevel '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptupdatelevel '
+      write(1,*)'========================='
+      status = he5_ptupdatelevel(ptid, level, fieldname, nrec,
+     1recs, dtype(3), spc_tt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptupdatelevel(ptid, level,'
+         write(*,*)'	         fieldname, nrec, recs,'
+         write(*,*)'	         dtype(3), spc_tt)'
+         write(*,*)'	Value returned by he5_ptupdatelevel ', status
+         write(1,*)'	status = he5_ptupdatelevel(ptid, level,'
+         write(1,*)'	         fieldname, nrec, recs,'
+         write(1,*)'	         dtype(3), spc_tt)'
+         write(1,*)'	Value returned by he5_ptupdatelevel ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Write attributes to "Fixed Buoy Point"
+c     --------------------------------------
+      attrname       = 'GlobalAttribute_int'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 1
+      attr           = 9999
+             
+
+c Test Case -- he5_ptwriteattr
+c
+      write(*,*)'Testing he5_ptwriteattr '
+      write(*,*)'======================='
+      write(1,*)'Testing he5_ptwriteattr '
+      write(1,*)'======================='
+      status   = he5_ptwriteattr(ptid,attrname,ntype,fortcount,
+     1attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(*,*)'	           ntype,fortcount,attr)'
+         write(*,*)'	Value returned by he5_ptwriteattr ', status
+         write(1,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(1,*)'	           ntype,fortcount,attr)'
+         write(1,*)'	Value returned by he5_ptwriteattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      attrname       = 'GroupAttribute'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 5
+      attr1(1)       = 1
+      attr1(2)       = 2
+      attr1(3)       = 3
+      attr1(4)       = 4
+      attr1(5)       = 5
+
+c Test Case -- he5_ptwritegrpattr
+c
+      write(*,*)'Testing he5_ptwritegrpattr '
+      write(*,*)'=========================='
+      write(1,*)'Testing he5_ptwritegrpattr '
+      write(1,*)'=========================='
+      status   = he5_ptwritegrpattr(ptid,attrname,ntype,fortcount,
+     1attr1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptwritegrpattr(ptid,attrname,'
+         write(*,*)'	           ntype,fortcount,attr1)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status   = he5_ptwritegrpattr(ptid,attrname,'
+         write(1,*)'	           ntype,fortcount,attr1)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      levelname      = 'Observations'
+      attrname       = 'LocalAttribute'
+      ntype          = HE5T_NATIVE_INT
+      fortcount(1)   = 5
+      attr2(1)       = 10
+      attr2(2)       = 20
+      attr2(3)       = 30
+      attr2(4)       = 40
+      attr2(5)       = 50
+
+c Test Case -- he5_ptwritelocattr
+c
+      write(*,*)'Testing he5_ptwritelocattr '
+      write(*,*)'=========================='
+      write(1,*)'Testing he5_ptwritelocattr '
+      write(1,*)'=========================='
+      status   = he5_ptwritelocattr(ptid,levelname,attrname,
+     1ntype,fortcount,attr2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptwritelocattr(ptid,'
+         write(*,*)'	           levelname,attrname,ntype,'
+         write(*,*)'	           fortcount,attr2)'
+         write(*,*)'	Value returned by he5_ptwritelocattr ', status
+         write(1,*)'	status   = he5_ptwritelocattr(ptid,'
+         write(1,*)'	           levelname,attrname,ntype,'
+         write(1,*)'	           fortcount,attr2)'
+         write(1,*)'	Value returned by he5_ptwritelocattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      attrname       = 'GlobalAttribute_float'
+      ntype          = HE5T_NATIVE_FLOAT
+      fortcount(1)   = 1
+      flt            = -7.5
+
+c Test Case -- he5_ptwriteattr
+c
+      write(*,*)'Testing he5_ptwriteattr '
+      write(*,*)'======================='
+      write(1,*)'Testing he5_ptwriteattr '
+      write(1,*)'======================='
+      status   = he5_ptwriteattr(ptid,attrname,
+     1ntype,fortcount,flt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(*,*)'	           ntype,fortcount,flt)'
+         write(*,*)'	Value returned by he5_ptwriteattr ', status
+         write(1,*)'	status   = he5_ptwriteattr(ptid,attrname,'
+         write(1,*)'	           ntype,fortcount,flt)'
+         write(1,*)'	Value returned by he5_ptwriteattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      null_char_0  = '0'
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Global Attributes
+c     -----------------
+      attrname       = 'GlobalAttribute_int'
+             
+      print *,'Global Attribute:   '
+
+c Test Case -- he5_ptreadattr
+c
+      write(*,*)'Testing he5_ptreadattr '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptreadattr '
+      write(1,*)'======================'
+      status   = he5_ptreadattr(ptid,attrname,attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptreadattr(ptid,attrname,attr)'
+         write(*,*)'	Value returned by he5_ptreadattr ', status
+         write(1,*)'	status   = he5_ptreadattr(ptid,attrname,attr)'
+         write(1,*)'	Value returned by he5_ptreadattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptinqattrs
+c
+      write(*,*)'Testing he5_ptinqattrs '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptinqattrs '
+      write(1,*)'======================'
+      nattr   = he5_ptinqattrs(ptid,null_char_0,strbufsize)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nattr   = he5_ptinqattrs(ptid,'
+         write(*,*)'	          null_char_0,strbufsize)'
+         write(*,*)'	Value returned by he5_ptinqattrs ', nattr
+         write(1,*)'	nattr   = he5_ptinqattrs(ptid,'
+         write(1,*)'	          null_char_0,strbufsize)'
+         write(1,*)'	Value returned by he5_ptinqattrs ', nattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptinqattrs
+c
+      write(*,*)'Testing he5_ptinqattrs '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptinqattrs '
+      write(1,*)'======================'
+      nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)'
+         write(*,*)'	Value returned by he5_ptinqattrs ', nattr
+         write(1,*)'	nattr   = he5_ptinqattrs(ptid,attrlist,strbufsize)'
+         write(1,*)'	Value returned by he5_ptinqattrs ', nattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      attrname       = 'GlobalAttribute_int'
+
+c Test Case -- he5_ptattrinfo
+c
+      write(*,*)'Testing he5_ptattrinfo '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptattrinfo '
+      write(1,*)'======================'
+      status   = he5_ptattrinfo(ptid,attrname,ntype,sz)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptattrinfo(ptid,attrname,ntype,sz)'
+         write(*,*)'	Value returned by he5_ptattrinfo ', status
+         write(1,*)'	status   = he5_ptattrinfo(ptid,attrname,ntype,sz)'
+         write(1,*)'	Value returned by he5_ptattrinfo ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptattrinfo
+c
+      write(*,*)'Testing he5_ptattrinfo '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptattrinfo '
+      write(1,*)'======================'
+      status   = he5_ptattrinfo(ptid,attrname,ntype,sz)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptattrinfo(ptid,attrname,ntype,sz)'
+         write(*,*)'	Value returned by he5_ptattrinfo ', status
+         write(1,*)'	status   = he5_ptattrinfo(ptid,attrname,ntype,sz)'
+         write(1,*)'	Value returned by he5_ptattrinfo ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptreadattr
+c
+      write(*,*)'Testing he5_ptreadattr '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_ptreadattr '
+      write(1,*)'======================'
+      status   = he5_ptreadattr(ptid,attrname,flt)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptreadattr(ptid,attrname,flt)'
+         write(*,*)'	Value returned by he5_ptreadattr ', status
+         write(1,*)'	status   = he5_ptreadattr(ptid,attrname,flt)'
+         write(1,*)'	Value returned by he5_ptreadattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      attrname       = 'GroupAttribute'
+
+c Test Case -- he5_ptreadgrpattr
+c
+      write(*,*)'Testing he5_ptreadgrpattr'
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptreadgrpattr'
+      write(1,*)'========================='
+      status = he5_ptreadgrpattr(ptid,attrname,attr1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptreadgrpattr(ptid,attrname,attr1)'
+         write(*,*)'	Value returned by he5_ptreadgrpattr ', status
+         write(1,*)'	status = he5_ptreadgrpattr(ptid,attrname,attr1)'
+         write(1,*)'	Value returned by he5_ptreadgrpattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptinqgrpattrs
+c
+      write(*,*)'Testing he5_ptinqgrpattrs '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptinqgrpattrs '
+      write(1,*)'========================='
+      nattr = he5_ptinqgrpattrs(ptid,null_char_0,strbufsize)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nattr = he5_ptinqgrpattrs(ptid,'
+         write(*,*)'	        null_char_0,strbufsize)'
+         write(*,*)'	Value returned by he5_ptinqgrpattrs ', nattr
+         write(1,*)'	nattr = he5_ptinqgrpattrs(ptid,'
+         write(1,*)'	        null_char_0,strbufsize)'
+         write(1,*)'	Value returned by he5_ptinqgrpattrs ', nattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptinqgrpattrs
+c
+      write(*,*)'Testing he5_ptinqgrpattrs '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptinqgrpattrs '
+      write(1,*)'========================='
+      nattr = he5_ptinqgrpattrs(ptid,attrlist,strbufsize)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nattr = he5_ptinqgrpattrs(ptid,'
+         write(*,*)'	        attrlist,strbufsize)'
+         write(*,*)'	Value returned by he5_ptinqgrpattrs ', status
+         write(1,*)'	nattr = he5_ptinqgrpattrs(ptid,'
+         write(1,*)'	        attrlist,strbufsize)'
+         write(1,*)'	Value returned by he5_ptinqgrpattrs ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      attrname       = 'GroupAttribute'
+
+c Test Case -- he5_ptgrpattrinfo
+c
+      write(*,*)'Testing he5_ptgrpattrinfo '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptgrpattrinfo '
+      write(1,*)'========================='
+      status   = he5_ptgrpattrinfo(ptid,attrname,ntype,sz)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status   = he5_ptgrpattrinfo(ptid,'
+         write(*,*)'	           attrname,ntype,sz)'
+         write(*,*)'	Value returned by he5_ptgrpattrinfo ', status
+         write(1,*)'	status   = he5_ptgrpattrinfo(ptid,'
+         write(1,*)'	           attrname,ntype,sz)'
+         write(1,*)'	Value returned by he5_ptgrpattrinfo ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      attrname       = 'LocalAttribute'
+      levelname      = 'Observations'
+
+c Test Case -- he5_ptreadlocattr
+c
+      write(*,*)'Testing he5_ptreadlocattr '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptreadlocattr '
+      write(1,*)'========================='
+      status = he5_ptreadlocattr(ptid,levelname,attrname,attr2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptreadlocattr(ptid,'
+         write(*,*)'	         levelname,attrname,attr2)'
+         write(*,*)'	Value returned by he5_ptreadlocattr ', status
+         write(1,*)'	status = he5_ptreadlocattr(ptid,'
+         write(1,*)'	         levelname,attrname,attr2)'
+         write(1,*)'	Value returned by he5_ptreadlocattr ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptinqlocattrs
+c
+      write(*,*)'Testing he5_ptinqlocattrs '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptinqlocattrs '
+      write(1,*)'========================='
+      nattr = he5_ptinqlocattrs(ptid,levelname,null_char_0,strbufsize)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nattr = he5_ptinqlocattrs(ptid,'
+         write(*,*)'	        levelname,null_char_0,strbufsize)'
+         write(*,*)'	Value returned by he5_ptinqlocattrs ', nattr
+         write(1,*)'	nattr = he5_ptinqlocattrs(ptid,'
+         write(1,*)'	        levelname,null_char_0,strbufsize)'
+         write(1,*)'	Value returned by he5_ptinqlocattrs ', nattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptinqlocattrs
+c
+      write(*,*)'Testing he5_ptinqlocattrs '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptinqlocattrs '
+      write(1,*)'====================='
+      nattr = he5_ptinqlocattrs(ptid,levelname,attrlist,strbufsize)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	nattr = he5_ptinqlocattrs(ptid,'
+         write(*,*)'	        levelname,attrlist,strbufsize)'
+         write(*,*)'	Value returned by he5_ptinqlocattrs ', nattr
+         write(1,*)'	nattr = he5_ptinqlocattrs(ptid,'
+         write(1,*)'	        levelname,attrlist,strbufsize)'
+         write(1,*)'	Value returned by he5_ptinqlocattrs ', nattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptlocattrinfo
+c
+      write(*,*)'Testing he5_ptlocattrinfo '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptlocattrinfo '
+      write(1,*)'========================='
+      status = he5_ptlocattrinfo(ptid,levelname,attrname,ntype,sz)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptlocattrinfo(ptid,'
+         write(*,*)'	         levelname,attrname,ntype,sz)'
+         write(*,*)'	Value returned by he5_ptlocattrinfo ', status
+         write(1,*)'	status = he5_ptlocattrinfo(ptid,'
+         write(1,*)'	         levelname,attrname,ntype,sz)'
+         write(1,*)'	Value returned by he5_ptlocattrinfo ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      null_char_0  = '0'
+
+c Test Case -- he5_ptopen
+c
+      write(*,*)'Testing he5_ptopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptopen '
+      write(1,*)'====================='
+      ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) 
+      if (ptfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)'
+         write(*,*)'	Value returned by he5_ptopen ', ptfid
+         write(1,*)'	ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)'
+         write(1,*)'	Value returned by he5_ptopen ', ptfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptattach '
+      write(1,*)'====================='
+      ptid = he5_ptattach(ptfid, "FixedBuoy Point")
+      if (ptid .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(*,*)'	Value returned by he5_ptattach ', ptid
+         write(1,*)'	ptid = he5_ptattach(ptfid, "FixedBuoy Point")'
+         write(1,*)'	Value returned by he5_ptattach ', ptid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      fieldgroup = HE5_HDFE_DATAGROUP
+      fieldname  = 'Observations'
+
+c Test Case -- he5_ptinqdatatype
+c
+      write(*,*)'Testing he5_ptinqdatatype '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptinqdatatype '
+      write(1,*)'========================='
+      status = he5_ptinqdatatype(ptid,fieldname,null_char_0,fieldgroup,
+     1datatype,classid,order,size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptinqdatatype(ptid,fieldname,'
+         write(*,*)'	         null_char_0,fieldgroup,datatype,classid,'
+         write(*,*)'	         order,size)'
+         write(*,*)'	Value returned by he5_ptinqdatatype ', status
+         write(1,*)'	status = he5_ptinqdatatype(ptid,fieldname,'
+         write(1,*)'	         null_char_0,fieldgroup,datatype,classid,'
+         write(1,*)'	         order,size)'
+         write(1,*)'	Value returned by he5_ptinqdatatype ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      fieldgroup   = HE5_HDFE_ATTRGROUP
+      attrname     = 'GlobalAttribute_int'
+
+c Test Case -- he5_ptinqdatatype
+c
+      write(*,*)'Testing he5_ptinqdatatype '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptinqdatatype '
+      write(1,*)'========================='
+      status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup,
+     1datatype,classid,order,size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptinqdatatype(ptid,null_char_0,'
+         write(*,*)'	         attrname,fieldgroup,datatype,'
+         write(*,*)'	         classid,order,size)'
+         write(*,*)'	Value returned by he5_ptinqdatatype ', status
+         write(1,*)'	status = he5_ptinqdatatype(ptid,null_char_0,'
+         write(1,*)'	         attrname,fieldgroup,datatype,'
+         write(1,*)'	         classid,order,size)'
+         write(1,*)'	Value returned by he5_ptinqdatatype ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      fieldgroup   = HE5_HDFE_GRPATTRGROUP
+      attrname     = 'GroupAttribute'
+
+c Test Case -- he5_ptinqdatatype
+c
+      write(*,*)'Testing he5_ptinqdatatype '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptinqdatatype '
+      write(1,*)'========================='
+      status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup,
+     1datatype,classid,order,size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptinqdatatype(ptid,null_char_0,'
+         write(*,*)'	         attrname,fieldgroup,datatype,'
+         write(*,*)'	         classid,order,size)'
+         write(*,*)'	Value returned by he5_ptinqdatatype ', status
+         write(1,*)'	status = he5_ptinqdatatype(ptid,null_char_0,'
+         write(1,*)'	         attrname,fieldgroup,datatype,'
+         write(1,*)'	         classid,order,size)'
+         write(1,*)'	Value returned by he5_ptinqdatatype ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      fieldname    = 'Observations'
+      fieldgroup   = HE5_HDFE_LOCATTRGROUP
+      attrname     = 'LocalAttribute'
+
+c Test Case -- he5_ptinqdatatype
+c
+      write(*,*)'Testing he5_ptinqdatatype '
+      write(*,*)'========================='
+      write(1,*)'Testing he5_ptinqdatatype '
+      write(1,*)'========================='
+      status = he5_ptinqdatatype(ptid,fieldname,attrname,fieldgroup,
+     1datatype,classid,order,size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptinqdatatype(ptid,fieldname,'
+         write(*,*)'	         attrname,fieldgroup,datatype,'
+         write(*,*)'	         classid,order,size)'
+         write(*,*)'	Value returned by he5_ptinqdatatype ', status
+         write(1,*)'	status = he5_ptinqdatatype(ptid,fieldname,'
+         write(1,*)'	         attrname,fieldgroup,datatype,'
+         write(1,*)'	         classid,order,size)'
+         write(1,*)'	Value returned by he5_ptinqdatatype ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_ptdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptdetach '
+      write(1,*)'====================='
+      status = he5_ptdetach(ptid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+               else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptdetach(ptid)'
+         write(*,*)'	Value returned by he5_ptdetach ', status
+         write(1,*)'	status = he5_ptdetach(ptid)'
+         write(1,*)'	Value returned by he5_ptdetach ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_ptclose
+c
+      write(*,*)'Testing he5_ptclose '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_ptclose '
+      write(1,*)'====================='
+      status = he5_ptclose(ptfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status = he5_ptclose(ptfid)'
+         write(*,*)'	Value returned by he5_ptclose ', status
+         write(1,*)'	status = he5_ptclose(ptfid)'
+         write(1,*)'	Value returned by he5_ptclose ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      close(unit=1)
+
+   27 format(' ')
+  230 format('********Error unexpected**********')
+  240 format('***********Passed Test*********')
+
+      stop
+      end
+
+
diff --git a/testdrivers/point/tutils.h b/testdrivers/point/tutils.h
new file mode 100755
index 0000000..72e8033
--- /dev/null
+++ b/testdrivers/point/tutils.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+ * NCSA HDF                                                                 *
+ * Software Development Group                                               *
+ * National Center for Supercomputing Applications                          *
+ * University of Illinois at Urbana-Champaign                               *
+ * 605 E. Springfield, Champaign IL 61820                                   *
+ *                                                                          *
+ * For conditions of distribution and use, see the accompanying             *
+ * hdf/COPYING file.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/* tutils.h,v 1.12 1995/10/05 16:17:28 koziol Exp */
+
+#ifndef _TUTILS_H
+#define _TUTILS_H
+
+/* Define these for use in all the tests */
+#ifndef TESTMASTER
+extern
+#endif
+int         num_errs
+#ifdef TESTMASTER
+= 0
+#endif
+,           Verbosity
+#ifdef TESTMASTER
+= 0
+#endif
+           ;
+
+#ifdef TEST_PC
+#define FAR far
+#else
+#ifndef FAR
+#define FAR     /* */
+#endif /* FAR */
+#endif /* TEST_PC */
+
+/* Use %ld to print the value because long could cover most cases. */
+/* Used to make certain a return value _is_not_ a value */
+#define CHECK(ret, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s returned %ld \n",where,(int)__LINE__,__FILE__,(long)ret);\
+if(ret == val) {printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", where, (long)ret, (int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+/* Used to make certain a return value _is_ a value */
+#define VERIFY(x, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s had value %ld \n",where,(int)__LINE__,__FILE__,(long)x);\
+if(x != val) {printf("*** UNEXPECTED VALUE from %s is %ld at line %4d in %s\n", where, (long)x,(int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+#define RESULT(a) \
+do { \
+if (Verbosity>8) printf("   Call to HDF routine: %15s at line %4d in %s returned %ld \n",a,(int)__LINE__,__FILE__,(long)ret); \
+if (Verbosity>9) HEprint(stdout,0); \
+if(ret == FAIL) {printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", a, (long)ret,(int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+#define MESSAGE(v,a) {if (Verbosity>=v) {a}}
+
+#endif /* _TUTILS_H */
diff --git a/testdrivers/swath/CMakeLists.txt b/testdrivers/swath/CMakeLists.txt
new file mode 100644
index 0000000..f8c2d74
--- /dev/null
+++ b/testdrivers/swath/CMakeLists.txt
@@ -0,0 +1,41 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDFEOS5_TESTDRIVERS_SWATH)
+
+ADD_EXECUTABLE (testswath ${PROJECT_SOURCE_DIR}/TestSwath.c)
+TARGET_NAMING (testswath ${LIB_TYPE})
+TARGET_LINK_LIBRARIES (testswath ${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_GCTP_SRC_LIB_TARGET} ${LINK_LIBS})
+
+IF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+  # make test dir
+  FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+
+  IF (F2CFORTRAN_32PTR)
+    ADD_EXECUTABLE (testswath_f ${PROJECT_SOURCE_DIR}/testswath32.f)
+  ELSE (F2CFORTRAN_32PTR)
+    ADD_EXECUTABLE (testswath_f ${PROJECT_SOURCE_DIR}/testswath64.f)
+  ENDIF (F2CFORTRAN_32PTR)
+  TARGET_NAMING (testswath_f ${LIB_TYPE})
+  TARGET_FORTRAN_WIN_PROPERTIES (testswath_f "")
+  SET_TARGET_PROPERTIES (testswath_f PROPERTIES LINKER_LANGUAGE Fortran)
+  TARGET_LINK_LIBRARIES (testswath_f ${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_GCTP_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+  
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+IF (BUILD_TESTING)
+
+  ADD_TEST (NAME SWATH_test_c COMMAND $<TARGET_FILE:testswath>)
+
+  ADD_TEST (NAME SWATH_test_c_verbose COMMAND $<TARGET_FILE:testswath> -v h)
+  SET_TESTS_PROPERTIES (SWATH_test_c_verbose PROPERTIES DEPENDS SWATH_test_c)
+
+  IF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+    ADD_TEST (NAME SWATH_test_f COMMAND $<TARGET_FILE:testswath_f>)
+    SET_TESTS_PROPERTIES (SWATH_test_f PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+    SET_TESTS_PROPERTIES (SWATH_test_f PROPERTIES DEPENDS SWATH_test_c_verbose)
+  ENDIF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+
+ENDIF (BUILD_TESTING)
diff --git a/testdrivers/swath/Makefile.am b/testdrivers/swath/Makefile.am
new file mode 100644
index 0000000..d7e6d33
--- /dev/null
+++ b/testdrivers/swath/Makefile.am
@@ -0,0 +1,49 @@
+# testdrivers/swath Makefile.am
+
+# Boilerplate definitions
+include $(top_srcdir)/config/include.am
+
+# Link against HDF-EOS5 library
+INCLUDES=-I$(top_srcdir)/include
+LDADD=$(LIBHDFEOS5)
+
+# Build TestSwath from TestSwath.c
+check_PROGRAMS = TestSwath
+
+if F2CFORTRAN_CONDITIONAL
+if F2CFORTRAN_32PTR_CONDITIONAL
+check_PROGRAMS += testswath32
+testswath32_SOURCES = testswath32.f
+else
+check_PROGRAMS += testswath64
+testswath64_SOURCES = testswath64.f
+endif
+endif
+
+# Run TestSwath when user types 'make check'
+TEST_SEQUENCES=test_c
+VERBOSE_TEST_SEQUENCES=test_c_verbose
+if F2CFORTRAN_CONDITIONAL
+if F2CFORTRAN_32PTR_CONDITIONAL
+TEST_SEQUENCES+=test_32f
+VERBOSE_TEST_SEQUENCES+=test_32f
+else
+TEST_SEQUENCES+=test_64f
+VERBOSE_TEST_SEQUENCES+=test_64f
+endif
+endif
+
+test_c: $(check_PROGRAMS)
+	./TestSwath
+test_c_verbose: $(check_PROGRAMS)
+	./TestSwath -v h
+test_32f: $(check_PROGRAMS)
+	./testswath32
+test_64f: $(check_PROGRAMS)
+	./testswath64
+
+check-local: $(TEST_SEQUENCES)
+verbose_check: $(VERBOSE_TEST_SEQUENCES)
+
+.PHONY: $(TEST_SEQUENCES)
+
diff --git a/testdrivers/swath/Makefile.in b/testdrivers/swath/Makefile.in
new file mode 100644
index 0000000..57640f0
--- /dev/null
+++ b/testdrivers/swath/Makefile.in
@@ -0,0 +1,518 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+# testdrivers/swath Makefile.am
+SOURCES = TestSwath.c $(testswath32_SOURCES) $(testswath64_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/config/include.am
+check_PROGRAMS = TestSwath$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2)
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_1 = testswath32
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_2 = testswath64
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_3 = test_32f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_4 = test_32f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_5 = test_64f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_6 = test_64f
+subdir = testdrivers/swath
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/HE5_config.h
+CONFIG_CLEAN_FILES =
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__EXEEXT_1 = testswath32$(EXEEXT)
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__EXEEXT_2 = testswath64$(EXEEXT)
+TestSwath_SOURCES = TestSwath.c
+TestSwath_OBJECTS = TestSwath.$(OBJEXT)
+TestSwath_LDADD = $(LDADD)
+am__DEPENDENCIES_1 = $(top_builddir)/src/libhe5_hdfeos.la
+TestSwath_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am__testswath32_SOURCES_DIST = testswath32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_testswath32_OBJECTS = testswath32.$(OBJEXT)
+testswath32_OBJECTS = $(am_testswath32_OBJECTS)
+testswath32_LDADD = $(LDADD)
+testswath32_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am__testswath64_SOURCES_DIST = testswath64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_testswath64_OBJECTS = testswath64.$(OBJEXT)
+testswath64_OBJECTS = $(am_testswath64_OBJECTS)
+testswath64_LDADD = $(LDADD)
+testswath64_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS)
+LTF77COMPILE = $(LIBTOOL) --mode=compile --tag=F77 $(F77) $(AM_FFLAGS) \
+	$(FFLAGS)
+F77LD = $(F77)
+F77LINK = $(LIBTOOL) --mode=link --tag=F77 $(F77LD) $(AM_FFLAGS) \
+	$(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = TestSwath.c $(testswath32_SOURCES) $(testswath64_SOURCES)
+DIST_SOURCES = TestSwath.c $(am__testswath32_SOURCES_DIST) \
+	$(am__testswath64_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F2CFORTRAN_32PTR_CONDITIONAL_FALSE = @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@
+F2CFORTRAN_32PTR_CONDITIONAL_TRUE = @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@
+F2CFORTRAN_90_CONDITIONAL_FALSE = @F2CFORTRAN_90_CONDITIONAL_FALSE@
+F2CFORTRAN_90_CONDITIONAL_TRUE = @F2CFORTRAN_90_CONDITIONAL_TRUE@
+F2CFORTRAN_CONDITIONAL_FALSE = @F2CFORTRAN_CONDITIONAL_FALSE@
+F2CFORTRAN_CONDITIONAL_TRUE = @F2CFORTRAN_CONDITIONAL_TRUE@
+F77 = @F77@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_INCLUDE_CONDITIONAL_FALSE = @INSTALL_INCLUDE_CONDITIONAL_FALSE@
+INSTALL_INCLUDE_CONDITIONAL_TRUE = @INSTALL_INCLUDE_CONDITIONAL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SZIP_ENCODER_CONDITIONAL_FALSE = @SZIP_ENCODER_CONDITIONAL_FALSE@
+SZIP_ENCODER_CONDITIONAL_TRUE = @SZIP_ENCODER_CONDITIONAL_TRUE@
+TESTDRIVERS_CONDITIONAL_FALSE = @TESTDRIVERS_CONDITIONAL_FALSE@
+TESTDRIVERS_CONDITIONAL_TRUE = @TESTDRIVERS_CONDITIONAL_TRUE@
+THREADSAFE_CONDITIONAL_FALSE = @THREADSAFE_CONDITIONAL_FALSE@
+THREADSAFE_CONDITIONAL_TRUE = @THREADSAFE_CONDITIONAL_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la
+LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
+
+# Boilerplate definitions
+
+# Link against HDF-EOS5 library
+INCLUDES = -I$(top_srcdir)/include
+LDADD = $(LIBHDFEOS5)
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at testswath32_SOURCES = testswath32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at testswath64_SOURCES = testswath64.f
+
+# Run TestSwath when user types 'make check'
+TEST_SEQUENCES = test_c $(am__append_3) $(am__append_5)
+VERBOSE_TEST_SEQUENCES = test_c_verbose $(am__append_4) \
+	$(am__append_6)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .f .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  testdrivers/swath/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  testdrivers/swath/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+TestSwath$(EXEEXT): $(TestSwath_OBJECTS) $(TestSwath_DEPENDENCIES) 
+	@rm -f TestSwath$(EXEEXT)
+	$(LINK) $(TestSwath_LDFLAGS) $(TestSwath_OBJECTS) $(TestSwath_LDADD) $(LIBS)
+testswath32$(EXEEXT): $(testswath32_OBJECTS) $(testswath32_DEPENDENCIES) 
+	@rm -f testswath32$(EXEEXT)
+	$(F77LINK) $(testswath32_LDFLAGS) $(testswath32_OBJECTS) $(testswath32_LDADD) $(LIBS)
+testswath64$(EXEEXT): $(testswath64_OBJECTS) $(testswath64_DEPENDENCIES) 
+	@rm -f testswath64$(EXEEXT)
+	$(F77LINK) $(testswath64_LDFLAGS) $(testswath64_OBJECTS) $(testswath64_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TestSwath.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+.f.o:
+	$(F77COMPILE) -c -o $@ $<
+
+.f.obj:
+	$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.f.lo:
+	$(LTF77COMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(mkdir_p) $(distdir)/../../config
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+	$(MAKE) $(AM_MAKEFLAGS) check-local
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \
+	clean-checkPROGRAMS clean-generic clean-libtool ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am
+
+
+test_c: $(check_PROGRAMS)
+	./TestSwath
+test_c_verbose: $(check_PROGRAMS)
+	./TestSwath -v h
+test_32f: $(check_PROGRAMS)
+	./testswath32
+test_64f: $(check_PROGRAMS)
+	./testswath64
+
+check-local: $(TEST_SEQUENCES)
+verbose_check: $(VERBOSE_TEST_SEQUENCES)
+
+.PHONY: $(TEST_SEQUENCES)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/testdrivers/swath/Makefile.sgi32 b/testdrivers/swath/Makefile.sgi32
new file mode 100644
index 0000000..9809abd
--- /dev/null
+++ b/testdrivers/swath/Makefile.sgi32
@@ -0,0 +1,58 @@
+
+COMPILER = cc
+LINKER = cc
+CC = $(COMPILER)
+LD = $(LINKER)
+
+# for SUN
+#CFLAGS =  -g -Xa -DsunFortran -DSUN
+#LFLAGS = -g -Xa -DsunFortran -DSUN
+
+# for sgi32
+CFLAGS =  -g -n32 -xansi -D_POSIX_SOURCE
+LFLAGS = -g -n32 -xansi -D_POSIX_SOURCE
+
+# for sgi64
+#CFLAGS =  -g -64 -xansi -D_POSIX_SOURCE
+#LFLAGS = -g -64 -xansi -D_POSIX_SOURCE
+
+INCLUDE = -I. -I$(HDFEOS5_INC) -I$(HDF5INC) -I$(JPEGINC) -I$(ZLIBINC) -I$(SZIPINC)
+
+
+LIBRARYPATHS = -L$(HDF5LIB) -L$(HDFEOS5_LIB) -L$(JPEGLIB) -L$(ZLIBLIB) -L$(SZIPLIB)
+
+# for SUN
+#LIBRARIES = -lhe5_hdfeos $(HDF5LIB)/libhdf5.a -lGctp -ljpeg -lz -lsz -lpthread -lm -lnsl
+
+# for other platforms
+LIBRARIES = -lhe5_hdfeos $(HDF5LIB)/libhdf5.a -lGctp -ljpeg -lz -lsz -lpthread -lm
+
+OBJECTS = TestSwath.o
+
+
+PROGRAMS = TestSwath
+
+
+all: ${PROGRAMS} cleano
+
+${PROGRAMS}: ${OBJECTS}
+	${CC} ${LFLAGS} -o $@ ${OBJECTS} ${LIBRARYPATHS} ${LIBRARIES}
+#	rm *.o
+
+.c.o: 
+	${CC} ${CFLAGS} -c ${INCLUDE} $<
+
+clean:
+	rm *.o ${PROGRAMS}
+
+cleano:
+	rm *.o
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/swath/TestAlias.c b/testdrivers/swath/TestAlias.c
new file mode 100755
index 0000000..c15cc24
--- /dev/null
+++ b/testdrivers/swath/TestAlias.c
@@ -0,0 +1,304 @@
+/*
+ ******************************************************************
+ * File:        TestAlias.c                                       *
+ *                                                                *
+ * Date:        Oct 02, 2000                                      *
+ * Programmer:  A.Muslimov, Emergent Information Technologies,Inc *
+ * Purpose:     Testing Swath interfacing routines                *        
+ ******************************************************************
+ */
+
+#include        <HE5_HdfEosDef.h>
+
+#define  FILENAME   "Alias.h5"
+#define  RANK       2
+
+main()
+{
+  herr_t       status = FAIL;
+  
+  int          i, j;
+  int          rank       = FAIL;
+  int          length     = 0;
+  int          attr[1]    = {2000};
+  int          fieldgroup = FAIL;
+  int          comp_level[5] = { 0,0,0,0,0 };
+  int          comp_code;
+  int          level[5] = {0,0,0,0,0}, code = 0;
+  int          *fldrank = (int *)NULL;
+
+  H5T_class_t  dtype   = H5T_NO_CLASS; 
+  hid_t        dtype1  = FAIL;
+  H5T_order_t  order   = H5T_ORDER_ERROR;
+  hid_t        ntype[3] = {FAIL,FAIL,FAIL}; 
+
+  long         nattr      = FAIL;
+  long         nfldalias     = FAIL;
+  long         strbufsize = FAIL; 
+  long         nflds = FAIL;
+  long         nalias = FAIL;
+
+  hid_t        SWid = FAIL, swfid = FAIL;
+  hid_t        datatype = FAIL;
+  
+  float        data[ 20 ][ 10 ];
+  float        out_buffer[ 20 ][ 10 ];
+  float        fillvalue = -777.777;
+  float        out_fillvalue = -1.;
+
+  size_t       size    = 0;
+
+  hssize_t     start[ 2 ] = { 0, 0 };
+  hsize_t      count[ 2 ] = { 5, 5};
+  hsize_t      nelem = 0;
+  hsize_t      dims[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+  hsize_t      chunk_dims[ 2 ];
+  
+  char         dimlist[80];
+  char         maxdimlist[80];
+  char         *namebuf, attrlist[80];
+  char         fldlist[80];
+  char         fldalias[80];
+  char         aliaslist[80];
+
+  /* 
+   *****************************************************************************
+   *                 Open/Create the Swath "Test_1"                            *
+   *****************************************************************************
+   */
+  
+  swfid = HE5_SWopen(FILENAME, H5F_ACC_TRUNC);
+  printf("Swath file ID                      = %d\n", swfid);
+  
+  SWid   = HE5_SWcreate(swfid,"Test_1"); 
+  printf("Swath ID                           = %d\n", SWid);
+  
+  /* 
+   *****************************************************************************
+   *                     Define Dimensions                                     *
+   *****************************************************************************
+   */
+  
+  
+  status = HE5_SWdefdim(SWid,"DataTrack", 20);
+  printf("status returned by HE5_SWdefdim        = %d\n", status);
+  
+  status = HE5_SWdefdim(SWid,"DataXtrack", 10);
+  printf("status returned by HE5_SWdefdim        = %d\n", status);
+
+  chunk_dims[ 0 ] = 10;
+  chunk_dims[ 1 ] = 5;
+  comp_code       = 4;
+  comp_level[0]   = 6;
+  
+  status = HE5_SWdefcomchunk(SWid, comp_code, comp_level, RANK, chunk_dims);
+  printf("status returned by HE5_SWdefcomchunk   = %d\n", status);
+
+  status = HE5_SWsetfillvalue(SWid, "Temperature", H5T_NATIVE_FLOAT, &fillvalue);
+  printf("status returned by HE5_SWsetfillvalue  = %d\n", status);
+
+  status = HE5_SWdefdatafield(SWid,"Temperature", "DataTrack,DataXtrack", NULL, H5T_NATIVE_FLOAT, 0);
+  printf("status returned by HE5_SWdefdatafield  = %d\n", status);
+
+  
+  /* 
+   *****************************************************************************
+   *                  Write data to the field "Temperature"                    *
+   *****************************************************************************
+   */
+  for ( i = 0; i < 20; i++ )
+	for( j = 0; j < 10; j++ )
+	  data[ i ][ j ] = 1.e0 + i + 5.e-2 * j ;
+  
+  status  = HE5_SWwritefield(SWid,"Temperature", start, NULL, count, data );
+  printf("status returned by HE5_SWwritefield    = %d\n", status);
+
+  /* Set aliases for field "Temperature" */
+  /* ----------------------------------- */
+  status  = HE5_SWsetalias(SWid,"Temperature","T,Tmp,Temp,L2gpValue,ZZZ");
+  printf("status returned by HE5_SWsetalias      = %d\n", status);
+
+  strcpy(fldalias,"");
+  nfldalias = HE5_SWinqdfldalias(SWid, fldalias, &strbufsize);
+  printf("Number of fields & aliases is: %li\n", nfldalias);
+  printf("Fields & aliases list:            %s \n", fldalias);
+  printf("Length of fields & aliases list:  %li \n", strbufsize);
+
+  strcpy(aliaslist,"");
+  nalias = HE5_SWgetaliaslist(SWid, HE5_HDFE_DATAGROUP, aliaslist, &strbufsize);
+  printf("Number of aliases is: %li\n", nalias);
+  printf("Aliases list:            %s \n", aliaslist);
+  printf("Length of aliases list:  %li \n", strbufsize);
+
+
+  /* Get information about alias "Temp" */
+  /* ---------------------------------- */
+  status = HE5_SWaliasinfo(SWid,  HE5_HDFE_DATAGROUP, "Temp", &length, NULL);
+  if (status == SUCCEED)
+	printf("Name length: %d \n", length);
+  
+  namebuf = (char *)calloc(length+1, sizeof(char));
+
+  /* Get the actual name of the field "Temp" */
+  /* --------------------------------------- */
+  status = HE5_SWaliasinfo(SWid,  HE5_HDFE_DATAGROUP, "Temp", &length, namebuf);
+  if (status == SUCCEED)
+	printf("Original field name: %s \n", namebuf);
+  
+  free(namebuf);
+
+  /* Remove alias "Tmp" from the alias list */
+  /* -------------------------------------- */
+  status  = HE5_SWdropalias(SWid, HE5_HDFE_DATAGROUP, "Tmp");
+  printf("status returned by HE5_SWdropalias     = %d\n", status);
+
+  /* Remove alias "Temp" from the alias list */
+  /* --------------------------------------- */
+  status  = HE5_SWdropalias(SWid, HE5_HDFE_DATAGROUP, "Temp");
+  printf("status returned by HE5_SWdropalias     = %d\n", status);
+
+  /* Get information about alias  "L2gpValue" */
+  /* ---------------------------------------- */  
+  status = HE5_SWaliasinfo(SWid,  HE5_HDFE_DATAGROUP, "L2gpValue", &length, NULL);
+  if (status == SUCCEED)
+	printf("Name length: %d \n", length);
+  
+
+  namebuf = (char *)calloc(length+1, sizeof(char));
+
+  /* Get the actual name of the field "L2gpValue" */
+  /* -------------------------------------------- */  
+  status = HE5_SWaliasinfo(SWid, HE5_HDFE_DATAGROUP, "L2gpValue", &length, namebuf);
+  if (status == SUCCEED)
+	printf("Original field name: %s \n", namebuf);
+  
+  free(namebuf);
+
+  count[0] = 20;  count[1] = 10;
+  
+  /* Read the data from the field calling it by alias */
+  /* ------------------------------------------------ */
+  status  = HE5_SWreadfield(SWid,"L2gpValue", start, NULL, count, out_buffer);
+  printf("status returned by HE5_SWreadfield     = %d\n", status);
+
+  printf("Data from \"L2gpValue\" field: \n");
+  for ( i = 0; i < 20; i++ )
+	for( j = 0; j < 10; j++ )
+	  printf("%f \n", out_buffer[ i ][ j ]);
+
+  /* Write local attribute to "L2gpValue" */
+  /* ------------------------------------ */
+  count[0] = 1;
+  status = HE5_SWwritelocattr(SWid, "L2gpValue", "LocalAttribute", H5T_NATIVE_INT, count, attr);
+  printf("status returned by HE5_SWwritelocattr  = %d\n", status);
+
+
+  status = HE5_SWdetach(SWid);
+  printf("status returned by HE5_SWdetach        = %d\n", status); 
+
+  SWid = HE5_SWattach(swfid,"Test_1");
+  printf("Swath ID returned by HE5_SWattach      = %d\n", SWid); 
+
+  printf("Local Attributes:\n");
+  nattr = HE5_SWinqlocattrs(SWid, "L2gpValue", NULL, &strbufsize);
+  printf("Number of attributes:      %li \n", nattr);
+  printf("Length of attribute list:  %li \n", strbufsize);
+  strcpy(attrlist,"");
+  nattr = HE5_SWinqlocattrs(SWid, "L2gpValue", attrlist, &strbufsize);
+  printf("Attribute list:            %s \n", attrlist);
+
+  printf("Local Attribute:\n");
+  status = HE5_SWlocattrinfo(SWid,"T", "LocalAttribute",&dtype1, &nelem);
+  printf("Data type:                 %d\n", dtype1);
+  printf("Number of elements:        %lu \n", (unsigned long)nelem);    
+
+  status = HE5_SWfieldinfo(SWid, "L2gpValue", &rank, dims, &dtype1, dimlist, maxdimlist);
+  printf("Status returned by HE5_SWfieldinfo	= %d\n", status);
+  if (status != FAIL)
+	{
+	  printf("Field rank:                %d \n", rank);
+	  printf("Dimension Sizes: \n");
+	  for ( i = 0; i < rank; i++)
+		{
+		  printf("                           %lu \n", (unsigned long)dims[i]);
+		}
+  
+	  printf("Number type ID:            %d \n", dtype1);  
+	  printf("DimList string:            %s \n", dimlist);
+	  printf("MaxdimList string:         %s \n", maxdimlist);
+	}
+
+  fieldgroup = HE5_HDFE_DATAGROUP;
+  status = HE5_SWinqdatatype(SWid, "T", NULL, fieldgroup, &datatype, &dtype, &order, &size);
+  printf("status returned by HE5_SWinqdatatype   = %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("Data type ID:              %d \n", datatype);
+	  printf("Data type class ID:        %d \n", dtype);
+	  printf("Byte order:                %d \n", order);
+	  printf("Data size (bytes):         %d \n", (int)size);        
+	}
+
+  status  = HE5_SWcompinfo(SWid,"L2gpValue", &code, level);
+  printf("status returned by HE5_SWcompinfo      = %d\n", status);
+  if (status != FAIL)
+	{
+	  printf("Compression Information: \n");  
+	  printf("Compression code:          %d \n", code);
+	  printf("Compression level:         %d \n", level[0]);
+	}
+
+  status = HE5_SWgetfillvalue(SWid,"L2gpValue",&out_fillvalue);
+  printf("status returned by HE5_SWgetfillvalue  = %d\n", status);
+  printf("The fill value:            %f\n", out_fillvalue);
+
+  status = HE5_SWdetach(SWid);
+  printf("status returned by HE5_SWdetach        = %d\n", status); 
+
+  SWid = HE5_SWattach(swfid,"Test_1");
+  printf("Swath ID returned by HE5_SWattach      = %d\n", SWid); 
+
+  
+  nflds = HE5_SWnentries(SWid,4,&strbufsize);
+  printf("Value returned by HE5_SWnentries       = %li\n", nflds); 
+  if (nflds != FAIL)
+	{
+	  fldrank   = (int *)calloc(nflds, sizeof(int));
+	 
+	  nflds = FAIL;
+	  nflds = HE5_SWinqdatafields(SWid,fldlist,fldrank,ntype);
+	  printf("Value returned by HE5_SWinqdatafields  = %li \n", nflds);
+	  if (nflds != FAIL)
+		{
+		  printf("List of fields:            %s \n", fldlist); 
+		  for (i = 0; i < nflds; i++)
+			printf("Field rank, number type ID:      %d, %d \n",fldrank[i],ntype[i]);
+		}
+	  
+	  free(fldrank);
+	  
+	}
+
+  status = HE5_SWdetach(SWid);
+  printf("status returned by HE5_SWdetach        = %d\n", status); 
+  
+  status = HE5_SWclose(swfid);
+  printf("status returned by HE5_SWclose         = %d\n", status);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/swath/TestProfile.c b/testdrivers/swath/TestProfile.c
new file mode 100755
index 0000000..43cbe4f
--- /dev/null
+++ b/testdrivers/swath/TestProfile.c
@@ -0,0 +1,400 @@
+/*
+ ----------------------------------------------------------------------------
+ |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
+ ----------------------------------------------------------------------------
+*/
+  
+#include  <HE5_HdfEosDef.h> 
+
+#define  XDIM1  50
+#define  XDIM2  70
+#define  XDIM3  90
+
+#define  YDIM1  2000
+#define  YDIM2  2250
+#define  YDIM3  2360
+
+
+int main()
+{
+  herr_t        status = FAIL;
+  
+  int           i, j;
+  int           rank = 1;  
+  int           *rank_out;
+  int           comp_level[5] = { 0,0,0,0,0 };
+  int           comp_code;
+  int           level[ 5 ] = { 0, 0, 0, 0, 0 };
+  int           code  = 0;
+
+  unsigned int  fill_value_1 = 1313,    fill_out_1 = 0;
+  float         fill_value_2 = -1.1111, fill_out_2 = -1.;
+  double        fill_value_3 = -3.3333, fill_out_3 = -1.;
+
+  long          nprof     = FAIL;
+
+  H5T_class_t   aclass     = H5T_NO_CLASS;
+  H5T_class_t   *class_out;
+  H5T_order_t   order     = H5T_ORDER_ERROR;
+  hid_t         *numtype;
+
+  hid_t         swfid     = FAIL;
+  hid_t         SWid      = FAIL;
+  hid_t         ntype     = FAIL;
+
+  hssize_t      start[1];
+
+  hsize_t       stride[1], edge[1];
+  hsize_t       dims[1]        = {XDIM1};  
+  hsize_t       dims_out[XDIM1]    ={0,0,0,0};
+  hsize_t       maxdims_out[XDIM1] ={0,0,0,0};
+  hsize_t       chunk_dims[ 1 ];
+
+  size_t        datasize;
+
+  hvl_t         buffer1[XDIM1];
+  hvl_t         buffer2[XDIM2];
+  hvl_t         buffer3[XDIM3];
+  hvl_t         buffer_out[XDIM1];
+
+  char          profnames[HE5_HDFE_NAMBUFSIZE];
+  char          dimlist[HE5_HDFE_NAMBUFSIZE];
+  char          maxdimlist[HE5_HDFE_NAMBUFSIZE];
+
+
+  swfid = HE5_SWopen("SimpleProfile.h5", H5F_ACC_TRUNC);
+  printf("file ID  ===> %d \n", swfid);
+  
+  SWid = HE5_SWcreate(swfid, "TestSwath_1");
+  printf("Swath ID ===> %d \n", SWid);
+
+  status = HE5_SWdefdim(SWid, "Unlim", H5S_UNLIMITED);
+  printf("status ===> %d\n", status);
+
+  status = HE5_SWdefdim(SWid, "ProfDimOne", 50);
+  printf("status ===> %d\n", status);
+
+  status = HE5_SWdefdim(SWid, "ProfDimTwo", 70);
+  printf("status ===> %d\n", status);
+
+  status = HE5_SWdefdim(SWid, "ProfDimThree", 90);
+  printf("status ===> %d\n", status);
+		  
+  /* Populate data buffer 1 */
+  /* ---------------------- */
+  datasize = 0;
+  for (i = 0; i < XDIM1; i++)
+	{
+	  buffer1[i].p = (hvl_t *)malloc( YDIM1 * sizeof(unsigned int));
+	  buffer1[i].len  = YDIM1;
+	  datasize += (buffer1[i].len * sizeof(unsigned int));
+	  for ( j = 0; j < YDIM1; j++)
+		((unsigned int *)buffer1[i].p)[j] = i;
+	}  
+  
+  chunk_dims[ 0 ] = 10;
+  
+  /* 
+   *****************************************************************************
+   *                     Define Compression/chunking                           *
+   *****************************************************************************
+   */
+  
+  comp_code = 4;
+  /*
+   *---------------------------------------------------------------------------
+   *        the compression schemes (comp_code) currently supported are       *
+   *                                                                          *
+   *                    HE5_HDFE_COMP_NONE     0                              *
+   *                    HE5_HDFE_COMP_RLE      1                              *
+   *                    HE5_HDFE_COMP_NBIT     2                              *
+   *                    HE5_HDFE_COMP_SKPHUFF  3                              *
+   *                    HE5_HDFE_COMP_DEFLATE  4                              *
+   *                    HE5_HDFE_COMP_SZIP_CHIP  5                            *
+   *                    HE5_HDFE_COMP_SZIP_K13   6                            *
+   *                    HE5_HDFE_COMP_SZIP_EC    7                            *
+   *                    HE5_HDFE_COMP_SZIP_NN    8                            *
+   *                    HE5_HDFE_COMP_SZIP_K13orEC   9                        *
+   *                    HE5_HDFE_COMP_SZIP_K13orNN   10                       *
+   *                    HE5_HDFE_COMP_SHUF_DEFLATE   11                       *
+   *                    HE5_HDFE_COMP_SHUF_SZIP_CHIP 12                       *
+   *                    HE5_HDFE_COMP_SHUF_SZIP_K13  13                       *
+   *                    HE5_HDFE_COMP_SHUF_SZIP_EC   14                       *
+   *                    HE5_HDFE_COMP_SHUF_SZIP_NN   15                       *
+   *                    HE5_HDFE_COMP_SHUF_SZIP_K13orEC  16                   *
+   *                    HE5_HDFE_COMP_SHUF_SZIP_K13orNN  17                   *
+   *                                                                          *
+   *---------------------------------------------------------------------------
+   */   
+  
+  comp_level[0] = 6;
+  
+  status = HE5_SWdefcomchunk(SWid, comp_code, comp_level, rank, chunk_dims);
+  printf("status ===> %d\n", status);
+
+  /* Define profile structure "Profile_1" */
+  /* ------------------------------------ */
+  status = HE5_PRdefine(SWid, "Profile_1", "ProfDimOne","Unlim", H5T_NATIVE_UINT);
+  printf("status ===> %d \n", status);
+
+  
+  /* Set fill value */
+  /* -------------- */
+  status = HE5_SWsetfillvalue(SWid,"Profile_1", H5T_NATIVE_UINT, &fill_value_1);
+  printf("status ===> %d \n", status);
+
+
+  /* Write data to profile */
+  /* --------------------- */
+  start[0] = 0;
+  edge[0]  = 50;
+  status   = HE5_PRwrite(SWid, "Profile_1", start, NULL, edge, datasize, buffer1);
+  printf("status ===> %d \n", status);
+
+
+  /* Read data from profile to "buffer_out" */
+  /* -------------------------------------- */
+  start[0] = 0;
+  edge[0]  = 50;
+  status   = HE5_PRread(SWid, "Profile_1", start, NULL, edge, buffer_out);
+  printf("status ===> %d \n", status);
+  
+  /* Display some elements of profile data */
+  /* ------------------------------------- */
+  for (i = 0; i < 10; i++)
+	{
+	  printf("\tThe %d-th element length is %d \n", i, (unsigned int)buffer_out[i].len);
+	  for (j = buffer_out[i].len-10; j < buffer_out[i].len; j++)
+		printf("\t\t %d \n", ((unsigned int *)buffer_out[i].p)[j]);
+	}
+
+  /* Free up memory */
+  /* -------------- */
+  status = HE5_PRreclaimspace(SWid, "Profile_1", buffer_out);		  
+  printf("status ===> %d \n", status);
+
+
+  /* Populate data buffer 2 */
+  /* ---------------------- */
+  datasize = 0;
+  for (i = 0; i < XDIM2; i++)
+	{
+	  buffer2[i].p = (hvl_t *)malloc( YDIM2 * sizeof(float));
+	  buffer2[i].len  =  YDIM2; 
+	  datasize += (YDIM2 * sizeof(float));
+	  for ( j = 0; j < YDIM2; j++)
+		((unsigned int *)buffer2[i].p)[j] = 2.325 * i + 0.01 * j;
+	}
+
+  /* Define profile structure "Profile_2" */
+  /* ------------------------------------ */
+  status = HE5_PRdefine(SWid, "Profile_2", "ProfDimTwo", NULL, H5T_NATIVE_FLOAT);
+  printf("status ===> %d \n", status);
+
+  /* Set fill value */
+  /* -------------- */
+   status = HE5_SWsetfillvalue(SWid,"Profile_2", H5T_NATIVE_FLOAT, &fill_value_2);
+   printf("status ===> %d \n", status);
+
+  
+  /* Write data to profile */
+  /* --------------------- */
+  start[0] = 0;
+  edge[0]  = 70;
+  status = HE5_PRwrite(SWid, "Profile_2", start, NULL, edge, datasize, buffer2);
+  printf("status ===> %d \n", status);
+
+  datasize = 0;
+  for (i = 0; i < XDIM3; i++)
+	{
+	  buffer3[i].p = (hvl_t *)malloc( YDIM3 * sizeof(double));
+	  buffer3[i].len  =  YDIM3;
+	  datasize += (buffer3[i].len * sizeof(double));
+	  for ( j = 0; j < YDIM3; j++)
+		((unsigned int *)buffer3[i].p)[j] = (j+1)/1.e5;
+	}
+
+  /* Define profile structure "Profile_3" */
+  /* ------------------------------------ */
+  status = HE5_PRdefine(SWid, "Profile_3", "ProfDimThree", NULL, H5T_NATIVE_DOUBLE);
+  printf("status ===> %d \n", status);
+  
+  /* Set fill value */
+  /* -------------- */ 
+   status = HE5_SWsetfillvalue(SWid,"Profile_3", H5T_NATIVE_DOUBLE, &fill_value_3);
+   printf("status ===> %d \n", status);
+
+  /* Write data to profile */
+  /* --------------------- */
+  start[0] = 0;
+  edge[0]  = 90;
+  status = HE5_PRwrite(SWid, "Profile_3", start, NULL, edge, datasize, buffer3);
+  printf("status ===> %d \n", status);
+
+
+  /* Detach from a swath */
+  /* ------------------- */
+  status = HE5_SWdetach(SWid);
+  printf("status ===> %d \n", status);
+ 
+  /* Reaattach to the swath */
+  /* ---------------------- */
+  SWid = HE5_SWattach(swfid, "TestSwath_1"); 
+  printf("Swath ID ===> %d \n", SWid);
+
+  /* Inquire about profile structures in a swath */
+  /* ------------------------------------------- */
+  nprof = HE5_PRinquire(SWid, profnames, NULL, NULL);
+  printf("There are %li profiles in swath. \n",  nprof);
+  if(nprof > 0)
+	{
+	  rank_out  = (int *)calloc(nprof, sizeof(int));
+	  class_out = (H5T_class_t *)calloc(nprof, sizeof(H5T_class_t));	  
+	  nprof = HE5_PRinquire(SWid, profnames, rank_out, class_out);
+	  printf("Profile names: \"%s\" \n",  profnames);
+	  for (i = 0; i < nprof; i++)
+		printf("profile #%d   rank: %d   base class: %d\n",  i+1, rank_out[i], class_out[i]);
+	  free(rank_out);
+	  free(class_out);
+	}
+
+  rank_out  = (int *)calloc(1, sizeof(int));
+  numtype = (hid_t *)calloc(1, sizeof(hid_t));
+
+  /* Get information about specified profile */
+  /* --------------------------------------- */
+  status = HE5_PRinfo(SWid, "Profile_1", rank_out, dims_out, maxdims_out, numtype, NULL, NULL);
+  if (status == SUCCEED)
+	{
+	  printf("Profile_1:\n");
+	  printf("rank: %d   number type: %d \n", rank_out[0], numtype[0]);
+	  for (i = 0; i < rank_out[0]; i++)
+		printf("dimension #%d   size: %d   maximum size: %d\n",  i+1, (int)dims_out[i], (int)maxdims_out[i]);
+	}
+
+  status = HE5_PRinfo(SWid, "Profile_1", rank_out, dims_out, maxdims_out, numtype, dimlist, maxdimlist);
+  if (status == SUCCEED)
+	{
+	  printf("Profile_1:\n");
+	  printf("DimList: %s   MaxDimList: %s \n", dimlist, maxdimlist);
+	}
+
+  status = HE5_PRinfo(SWid, "Profile_2", rank_out, dims_out, maxdims_out, numtype, NULL, NULL);
+  if (status == SUCCEED)
+	{
+	  printf("Profile_2:\n");
+	  printf("rank: %d   number type: %d \n", rank_out[0], numtype[0]);
+	  for (i = 0; i < rank_out[0]; i++)
+		printf("dimension #%d   size: %d   maximum size: %d\n",  i+1, (int)dims_out[i], (int)maxdims_out[i]);
+	}
+  
+  strcpy(dimlist,"");
+  strcpy(maxdimlist,"");
+  status = HE5_PRinfo(SWid, "Profile_2", rank_out, dims_out, maxdims_out, numtype, dimlist, maxdimlist);
+  if (status == SUCCEED)
+	{
+	  printf("Profile_2:\n");
+	  printf("DimList: %s   MaxDimList: %s \n", dimlist, maxdimlist);
+	}
+
+  status = HE5_PRinfo(SWid, "Profile_3", rank_out, dims_out, maxdims_out, numtype, NULL, NULL);
+  if (status == SUCCEED)
+	{
+	  printf("Profile_3:\n");
+	  printf("rank: %d   number type: %d \n", rank_out[0], numtype[0]);
+	  for (i = 0; i < rank_out[0]; i++)
+		printf("dimension #%d   size: %d   maximum size: %d\n",  i+1, (int)dims_out[i], (int)maxdims_out[i]);
+	}
+
+  strcpy(dimlist,"");
+  strcpy(maxdimlist,"");
+  status = HE5_PRinfo(SWid, "Profile_3", rank_out, dims_out, maxdims_out, numtype, dimlist, maxdimlist);
+  if (status == SUCCEED)
+	{
+	  printf("Profile_3:\n");
+	  printf("DimList: %s   MaxDimList: %s \n", dimlist, maxdimlist);
+	}
+
+
+  free(rank_out);
+  free(numtype);
+
+  /* Inquire profile data type information */
+  /* ------------------------------------- */
+  status = HE5_SWinqdatatype(SWid, "Profile_1", NULL, HE5_HDFE_PROFGROUP, &ntype, &aclass, &order, &datasize);
+  if (status == SUCCEED)
+	printf("Profile_1: class: %d  order: %d   size: %d (bytes) \n", aclass, order, (int)datasize);
+
+  status = HE5_SWinqdatatype(SWid, "Profile_2", NULL, HE5_HDFE_PROFGROUP, &ntype, &aclass, &order, &datasize);
+  if (status == SUCCEED)
+	printf("Profile_2: class: %d  order: %d   size: %d (bytes) \n", aclass, order, (int)datasize);
+
+  status = HE5_SWinqdatatype(SWid, "Profile_3", NULL, HE5_HDFE_PROFGROUP, &ntype, &aclass, &order, &datasize);
+  if (status == SUCCEED)
+	printf("Profile_3: class: %d  order: %d   size: %d (bytes) \n", aclass, order, (int)datasize);
+
+  /* Retrieve fill values for profiles */
+  /* --------------------------------- */
+  status = HE5_SWgetfillvalue(SWid, "Profile_1", &fill_out_1);
+  if (status == SUCCEED)
+	printf("Profile_1: fill value = %d \n", fill_out_1);  
+
+  status = HE5_SWgetfillvalue(SWid, "Profile_2", &fill_out_2);
+  if (status == SUCCEED)
+	printf("Profile_2: fill value = %f \n", fill_out_2);  
+
+  status = HE5_SWgetfillvalue(SWid, "Profile_3", &fill_out_3);
+  if (status == SUCCEED)
+	printf("Profile_3: fill value = %f \n", fill_out_3);  
+
+  status = HE5_SWcompinfo(SWid,"Profile_1",&code,level); 
+  if (status == SUCCEED)
+	printf("Profile_1: COMPRESSION: code = %d  level = %d \n", code, level[0]);
+
+  code     = FAIL;
+  level[0] = FAIL;
+  status = HE5_SWcompinfo(SWid,"Profile_2",&code,level); 
+  if (status == SUCCEED)
+	printf("Profile_2: COMPRESSION: code = %d  level = %d \n", code, level[0]);
+
+  code     = FAIL;
+  level[0] = FAIL;
+  status = HE5_SWcompinfo(SWid,"Profile_3",&code,level); 
+  if (status == SUCCEED)
+	printf("Profile_3: COMPRESSION: code = %d  level = %d \n", code, level[0]);  
+
+  /* Detach from swath */
+  /* ----------------- */
+  status = HE5_SWdetach(SWid);
+  printf("status ===> %d \n", status);
+
+  /* Close HDF-EOS file */
+  /* ------------------ */
+  status = HE5_SWclose(swfid);
+  printf("status ===> %d \n", status);
+  
+  return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/swath/TestSwath.c b/testdrivers/swath/TestSwath.c
new file mode 100755
index 0000000..b244cde
--- /dev/null
+++ b/testdrivers/swath/TestSwath.c
@@ -0,0 +1,5479 @@
+/*
+ ***********************************************************
+ *       FILENAME: TestSwath.c                             *
+ *                                                         *
+ *       PURPOSE:  To test HDF-EOS v.3 Swath interface     *
+ *                                                         *
+ *       Author:                                           *
+ *           A. Muslimov       /Emergent IT Inc.           *
+ *           Adura Adekunjo    /L3 Comm. EER corp          *
+ *                                                         *
+ *       History:                                          *
+ *        August 1999  AM   Initial version                *
+ *        13-Oct-2000  AM   Updated                        *
+ *        02-Dec-2004  AA   Updated with testdrivers for   *
+ *                          some new functions (NCR 41197) *
+ *                                                         *
+ *                                                         *
+ ***********************************************************
+ */
+
+#include <HE5_HdfEosDef.h>
+#include <tutils.h>
+
+#define BUFSIZE  256
+#define RANK1    1
+#define RANK2    2
+int HE5_szip_can_encode(void );
+
+int main(int argc, char *argv[])
+{
+
+   FILE        *fp;
+
+   herr_t      status          = FAIL;
+
+   int	       i               = 0; 
+   int         j               = 0; 
+   int         attr3[4]        = {100, 200, 300, 400}; 
+   int         attr3Out[4]     = { 0, 0, 0, 0 };
+   int         Verbosity       = 4;
+   int         comp_level[ 5 ] = { 0, 0, 0, 0, 0 };
+   int         level[ 5 ]      = { 0, 0, 0, 0, 0 };
+   int         rank            = 1;
+   int         AttrVal[ 4 ]    = {1,2,3,4};
+   int         GattrVal[ 4 ]     = {4,3,2,1};
+   int         AttrValOut[ 4 ] = {0,0,0,0};
+   int         GattrValOut[ 4 ] = {0,0,0,0};
+   int         errcnt          = 0;
+   int         comp_code       = 0;
+   int         code            = 0;
+   int         chunk_rank;
+   int         rank2           = 0; 
+   int         rank3           = 0;
+   int         *RankPtr        = (int *)NULL;
+   int         inarray[10]     = {1,2,3,4,5,6,7,8,9,10};
+   int         fieldgroup      = FAIL;
+   int         return_val      = FAIL;
+
+   hid_t       SWid_simple     = FAIL; 
+   hid_t       SWid_index      = FAIL;
+   hid_t       swfidc_simple   = FAIL;
+   hid_t       PeriodID        = FAIL;
+   hid_t       RegionID        = FAIL; 
+   hid_t       OldRegionID     = FAIL;
+   
+   hid_t      datatype         = FAIL;
+   hid_t       dtype           = FAIL;
+   hid_t       dtype1          = FAIL;
+   hid_t       ntype[20];
+   H5T_class_t  classid    = H5T_NO_CLASS;
+   H5T_order_t  order          = H5T_ORDER_ERROR;
+   
+   long        number          = FAIL;
+   long        strbufsize      = FAIL;
+   long        *DimListPtr     = (long *)NULL;
+   long        *OffsetPtr      = (long *)NULL;
+   long        *IncremPtr      = (long *)NULL;
+   long        *IndexMap       = (long *)NULL;
+   long        IdxMapSize      = FAIL;
+   long        Indices[2]      = {0L, 0L};
+   long        *UpdateIdx_1    = (long *)NULL;
+
+   size_t      *size           = (size_t *)NULL;
+   size_t      datasize        = 0;
+   size_t      Size            = 0;
+  
+   hssize_t    start[ 1 ]      = { 0 };    
+   hssize_t    tstart[ 2 ]     = { 0, 0 };
+
+   hsize_t     ndims           = 0;
+   hsize_t     nmaps           = 0;
+   hsize_t     *SizePtr;
+   hsize_t     Dims[8]         = {0,0,0,0,0,0,0,0};
+   hsize_t     dims[ 2 ]       = { 2, 2 };
+   hsize_t     chunk_dims[ 2 ] = { 0, 0 };
+   hsize_t     chunk_dim[ 8 ] = { 0,0,0,0,0,0,0,0}; 
+   hsize_t     tedge[ 2 ]      = { 1, 1 };
+   hsize_t     edge[ 1 ]       = { 1 };
+   
+
+   hsize_t     stride[ 2 ]     = { 1, 1 };
+   hssize_t    inq_start[ 2 ]  = { 0, 0 };
+   hsize_t     inq_stride[ 2 ] = { 1, 1 };
+   hsize_t     inq_edge[ 2 ]   = { 1, 1 };
+   hsize_t     *CountPtr       = (hsize_t *)NULL;
+   hsize_t     CurrentSize[1]  = { 4 };
+   hsize_t     count[1];
+   hsize_t     *indices[8];
+   
+   double     TempData[10][4]  = { 
+	                               { 100., 101., 102., 103. },
+				  { 110., 111., 112., 113. },
+				  { 200., 201., 202., 203. }, 
+				  { 210., 211., 212., 213. }, 
+				  { 300., 301., 302., 303. }, 
+				  { 310., 311., 312., 313. }, 
+				  { 400., 401., 402., 403. }, 
+				  { 410., 411., 412., 413. }, 
+				  { 500., 501., 502., 503. }, 
+				  { 510., 511., 512., 513. } 
+                                 } ;
+
+   double     LongData[5][4] =  { 
+                                  { 100., 102., 104., 106. },
+				  { 100., 102., 104., 106. },
+				  { 100., 102., 104., 106. }, 
+				  { 100., 102., 104., 106. }, 
+				  { 100., 102., 104., 106. } 
+                                 } ;
+
+   double     LatData[5][4] =   { 
+                                  { 24., 24., 24., 24. },
+				  { 23., 23., 23., 23. },
+				  { 22., 22., 22., 22. }, 
+				  { 21., 21., 21., 21. }, 
+				  { 20., 20., 20., 20. } 
+                                 } ;
+
+
+   double     CondData[10][4] = { 
+                                  { 10., 20., 30., 40. },
+                                  { 11., 21., 31., 41. },
+                                  { 12., 22., 32., 42. },
+                                  { 13., 23., 33., 43. },
+                                  { 14., 24., 34., 44. },
+                                  { 15., 25., 35., 45. },
+                                  { 16., 26., 36., 46. },
+                                  { 17., 27., 37., 47. },
+                                  { 18., 28., 38., 48. },
+                                  { 19., 29., 39., 49. }
+                                 } ;
+   
+   double      Range[2];
+   double      CornerLon[2]; 
+   double      CornerLat[2]; 
+   double      *BufferPtr;
+   double      StartTime = 0.0;
+   double      StopTime  = 0.0;
+   double      *TimeData;
+   double      *TimeDataOut;
+   double      TempDataOut[10][4];
+   double      fillvalue2          = -1.11111;
+   double      InqDoubleFillValue  = -1.1111;
+
+   float       IndexedData[8][8];
+   float       FakeValue         = 100.;  
+   float       IndexedLatData[6][6];
+   float       FakeLat           = 60.;
+   float       IndexedLonData[6][6];
+   float       FakeLon           = 80.;
+   float       *BufferFloatPtr;
+   float       fillvalue         = -1.11111;
+   float       InqFloatFillValue = -1.111111;
+   float       GfattrVal = 3.14;
+   float       GfattrValOut;
+   
+   hvl_t       buffer[4];    /* Buffer to write data to the profile */
+   hvl_t       buffer_out[4];/* Buffer to read out data from profile */
+
+   char        *FieldListPtr;
+   char        *DimNamePtr; 
+   char        *DimMapListPtr;
+   char        *ObjNamesPtr; 
+   char        DimList[200];
+   char        *dimlist;
+
+
+   /* 
+	********************************************************************************
+	*                 Get comand-line argument (Verbosity)                         *
+	********************************************************************************
+	*/
+   
+   
+   for (i = 1; i < argc; i++)
+	 {
+	   if ((argc > i + 1) && ((HDstrcmp(argv[i], "-verbose") == 0) || (HDstrcmp(argv[i], "-v") == 0)))
+		 {
+		   if (argv[i + 1][0] == 'l')
+			 Verbosity = 4;
+		   else if (argv[i + 1][0] == 'm')
+			 Verbosity = 6;
+		   else if (argv[i + 1][0] == 'h')
+			 Verbosity = 10;
+		   else
+			 Verbosity = atoi(argv[i + 1]);
+		 } 
+	 }
+   
+   
+   /* -----  Generate Data Arrays ----- */
+   
+   i = 0;
+   j = 0;
+   
+   
+   while( i < 8 )
+	 {
+       while( j < 8 )
+		 {
+		   IndexedData[ i ][ j ] = FakeValue;
+		   j++;
+		   FakeValue+=0.1;
+		 }
+       i++;
+       j = 0;
+       
+	 }
+   
+   
+   /* -------------------------------- */
+   
+   i = 0;
+   j = 0;
+   
+   
+   while( i < 6 )
+	 {
+       while( j < 6 )
+		 {
+		   IndexedLatData[ i ][ j ] = FakeLat;
+           IndexedLonData[ i ][ j ] = FakeLon;
+		   FakeLon-=0.1;
+		   j++;
+		 }
+       FakeLat-= 0.1;
+       FakeLon = 80.;
+       i++;
+       j = 0;
+       
+	 }
+   
+   IndexMap = (long *)calloc(6, sizeof(long));
+   
+   IndexMap[0] = 1L;
+   IndexMap[1] = 2L;
+   IndexMap[2] = 3L;   
+   IndexMap[3] = 5L;
+   IndexMap[4] = 6L;
+   IndexMap[5] = 7L;
+   
+
+   /* Allocate memory for and populate data buffer */
+   datasize = 0;
+   for (i = 0; i < 4; i++)
+	 {
+	   buffer[i].p = (hvl_t *)malloc( 25 *(i+1)* sizeof(unsigned int));
+	   buffer[i].len  =  25 * (i+1);
+	   /* calculate the data buffer size (bytes) */
+	   datasize += buffer[i].len * sizeof(unsigned int);
+	   for ( j = 0; j < 25 * (i+1); j++)
+		 ((unsigned int *)buffer[i].p)[j] = (i+1)*1000 + j;
+	 }
+
+   
+   /* --------------------------------- */
+   
+   
+   MESSAGE(11,fp=fopen("TestSwath.txt","w"););
+   MESSAGE(4,printf("Testing Swath C interface \n"););
+   MESSAGE(4,printf("=========================\n\n"););
+   MESSAGE(11,fprintf(fp,"Testing Swath C interface \n"););
+   MESSAGE(11,fprintf(fp,"=========================\n\n"););
+      
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWopen                             *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_SWopen... \n"););
+   MESSAGE(4,printf("\t===================== \n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWopen... \n"););
+   MESSAGE(11,fprintf(fp,"\t===================== \n"););
+   
+   swfidc_simple = HE5_SWopen("SimpleSwath.h5",H5F_ACC_TRUNC);
+   if (swfidc_simple == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;  
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully opened the swath file ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully opened the swath file ****\n"););
+       
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWcreate                           *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_SWcreate... \n"););
+   MESSAGE(4,printf("\t======================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWcreate... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+   
+   MESSAGE(6,printf("\t\tCreating swath SIMPLE \n"););   
+   MESSAGE(11,fprintf(fp,"\t\tCreating swath SIMPLE \n"););
+   
+   SWid_simple = HE5_SWcreate(swfidc_simple,"SIMPLE"); 
+   if (SWid_simple == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;  
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the swath SIMPLE ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the swath SIMPLE ****\n"););
+       
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWcreate                           *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\tTesting HE5_SWcreate... \n"););
+   MESSAGE(4,printf("\t=======================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWcreate... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+   
+   MESSAGE(6,printf("\t\tCreating swath INDEX \n"););   
+   MESSAGE(11,fprintf(fp,"\t\tCreating swath INDEX \n"););
+   
+   SWid_index = HE5_SWcreate(swfidc_simple,"INDEX"); 
+   if (SWid_index == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;  
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the swath INDEX ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the swath INDEX ****\n"););
+       
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWdefdim                           *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\t\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdefdim... \n"););
+   MESSAGE(4,printf("\t=======================\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefdim... \n"););
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+   
+   MESSAGE(4,printf("\t\n"););
+   MESSAGE(6,printf("\t\tSetting up dimensions for swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tSetting up dimensions for swath SIMPLE \n"););   
+   
+   
+   /*                 
+	  ------------------------------------- Swath   SIMPLE  ---------------------------------
+	  
+	  
+	  
+	  --------------------- D e f i n i n g   d i m e n s i o n   DataTrack  ----------------
+    */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension DataTrack in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension DataTrack in swath SIMPLE \n"););
+   
+   status = HE5_SWdefdim(SWid_simple, "DataTrack", 10);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_simple, \"DataTrack\", 10);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_simple, \"DataTrack\", 10);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status););
+	 }
+   
+   
+   /*                 
+	  --------------------- D e f i n i n g   d i m e n s i o n   DataXtrack ----------------
+    */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension DataXtrack in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension DataXtrack in swath SIMPLE \n"););
+   
+   status = HE5_SWdefdim(SWid_simple, "DataXtrack", 4);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;      
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_simple, \"DataXtrack\", 4);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_simple, \"DataXtrack\", 4);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status););
+	 }
+   
+   /*                 
+	  --------------------- D e f i n i n g   d i m e n s i o n   Geotrack ----------------
+    */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension GeoTrack for swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension GeoTrack for swath SIMPLE \n"););
+   status = HE5_SWdefdim(SWid_simple, "GeoTrack", 5);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_simple, \"GeoTrack\", 5);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_simple, \"GeoTrack\", 5);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status););
+	 }
+   
+   /*                 
+	  --------------------- D e f i n i n g   d i m e n s i o n   GeoXtrack ----------------
+    */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension GeoXtrack for swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension GeoXtrack for swath SIMPLE \n"););
+   status = HE5_SWdefdim(SWid_simple, "GeoXtrack", 4);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_simple, \"GeoXtrack\", 4);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_simple, \"GeoXtrack\", 4);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status););
+	 }
+   
+   
+   /*                 
+	  --------------------- D e f i n i n g   d i m e n s i o n  "Unlim" ----------------
+    */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension \"Unlim\" in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"Unlim\" in swath SIMPLE \n"););
+   
+   status = HE5_SWdefdim(SWid_simple, "Unlim", H5S_UNLIMITED);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;      
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_simple, \"Unlim\", H5S_UNLIMITED);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_simple, \"Unlim\", H5S_UNLIMITED);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tSetting up dimensions for swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tSetting up dimensions for swath INDEX \n"););   
+   
+   
+   /*
+	  ---------------------------------- Swath  INDEX  -------------------------------------
+	  
+	  
+	  
+	  --------------------- D e f i n i n g   d i m e n s i o n   TrackDim  ----------------
+    */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension TrackDim for swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension TrackDim for swath INDEX \n"););
+   
+   status = HE5_SWdefdim(SWid_index, "TrackDim", 8);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_index, \"TrackDim\", 8);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_index, \"TrackDim\", 8);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status););
+	 }
+   
+   
+   /*
+	  --------------------- D e f i n i n g   d i m e n s i o n  XtrackDim  ----------------
+    */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension XtrackDim for swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension TrackDim for swath INDEX \n"););
+   
+   status = HE5_SWdefdim(SWid_index, "XtrackDim", 8);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_index, \"XtrackDim\", 8);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_index, \"XtrackDim\", 8);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status););
+	 }
+   
+   
+   /*
+	  --------------------- D e f i n i n g   d i m e n s i o n  GeoDim  -------------------
+	*/
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension GeoDim for swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension GeoDim for swath INDEX \n"););
+   
+   status = HE5_SWdefdim(SWid_index, "GeoDim", 6);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_index, \"GeoDim\", 6);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_index, \"GeoDim\", 6);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status););
+	 }
+   
+   
+   /*
+	  --------------------- D e f i n i n g   d i m e n s i o n  GeoXDim  -------------------
+	*/
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension GeoXDim for swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension GeoXDim for swath INDEX \n"););
+   
+   status = HE5_SWdefdim(SWid_index, "GeoXDim", 6);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_index, \"GeoXDim\", 6);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_index, \"GeoXDim\", 6);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWdefdimmap                        *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\t\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdefdimmap... \n"););
+   MESSAGE(4,printf("\t==========================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefdimmap... \n"););
+   MESSAGE(11,fprintf(fp,"\t==========================\n"););
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension maps for swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension maps for swath SIMPLE \n"););
+   
+   /*                 
+	  ----------  D e f i n i n g  T r a c k   D i m.   M a p p i n g  ----------
+    */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining track dimension mapping\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining track dimension mapping\n"););
+   status = HE5_SWdefdimmap(SWid_simple, "GeoTrack", "DataTrack", 0, 2);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););                 
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefdimmap(SWid_simple, \"GeoTrack\",\"DataTrack\", 0, 2);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdimmap %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdimmap(SWid_simple,\"GeoTrack\", \"DataTrack\", 0, 2);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdimmap %d\n",status););
+	 }
+   
+   
+   /*                 
+	  ----  D e f i n i n g  C r o s s  T r a c k   D i m.   M a p p i n g  ----
+    */
+   
+   MESSAGE(6,printf("\t\n");); 
+   MESSAGE(6,printf("\t\tDefining cross track dimension mapping\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining cross track dimension mapping\n"););
+   status = HE5_SWdefdimmap(SWid_simple, "GeoXtrack", "DataXtrack", 0, 1);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););       
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefdimmap(SWid_simple, \"GeoXtrack\",\"DataXtrack\", 0, 1);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdimmap %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdimmap(SWid_simple,\"GeoXtrack\", \"DataXtrack\", 0, 1);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdimmap %d\n",status););
+	 }
+   
+   
+   /*                 
+	  ----  D e f i n i n g  G e o  T r a c k / G e o  X  t r a c k  D i m.   M a p p i n g  ----
+    */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining GeoTrack / GeoXtrack dimension mapping\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining GeoTrack / GeoXtrack dimension mapping\n"););
+   status = HE5_SWdefdimmap(SWid_simple, "GeoTrack", "GeoXtrack", 0, 1);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););       
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefdimmap(SWid_simple, \"GeoTrack\",\"GeoXtrack\", 0, 1);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdimmap %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdimmap(SWid_simple,\"GeoTrack\", \"GeoXtrack\", 0, 1);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdimmap %d\n",status););
+	 }
+   
+   
+   
+   
+   
+   /*                 
+	  ---------  D e f i n i n g  G e o  T r a c k / G e o T r a c k  D i m.   M a p p i n g  -------
+    */
+   
+   MESSAGE(6,printf("\t\n");); 
+   MESSAGE(6,printf("\t\tDefining Geo track / Geo track dimension mapping\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining Geo track / Geo track dimension mapping\n"););
+   status = HE5_SWdefdimmap(SWid_simple, "GeoTrack", "GeoTrack", 0, 1);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););       
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefdimmap(SWid_simple, \"GeoTrack\",\"GeoTrack\", 0, 1);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdimmap %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdimmap(SWid_simple,\"GeoTrack\", \"GeoTrack\", 0, 1);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdimmap %d\n",status););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWdefidxmap                        *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\t\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdefidxmap... \n"););
+   MESSAGE(4,printf("\t=================\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefidxmap... \n"););
+   MESSAGE(11,fprintf(fp,"\t=================\n"););
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining indexed mapping relationships for swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining indexed mapping relationships for swath INDEX \n"););
+   
+   /*                 
+	  -------  D e f i n i n g  G e o D i m  / T r a c k D i m  M a p p i n g  -------
+    */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining GeoDim/TrackDim mapping\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining GeoDim/TrackDim mapping\n"););
+   status = HE5_SWdefidxmap(SWid_index, "GeoDim", "TrackDim", IndexMap);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefidxmap(SWid_index, \"GeoDim\",\"TrackDim\", IndexMap);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefidxmap %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefidxmap(SWid_index,\"GeoDim\", \"TrackDim\", IndexMap);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefidxmap %d\n",status););
+	 }
+   
+   /*                 
+	  -------  D e f i n i n g  G e o X D i m  / X t r a c k D i m  M a p p i n g  -------
+    */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining GeoXDim/XtrackDim mapping\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining GeoXDim/XtrackDim mapping\n"););
+   status = HE5_SWdefidxmap(SWid_index, "GeoXDim", "XtrackDim", IndexMap);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdefidxmap(SWid_index, \"GeoXDim\",\"XtrackDim\", IndexMap);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefidxmap %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefidxmap(SWid_index,\"GeoXDim\", \"XtrackDim\", IndexMap);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefidxmap %d\n",status););
+	 }
+   
+   free(IndexMap);
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWsetfillvalue                     *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\t\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWsetfillvalue... \n"););
+   MESSAGE(4,printf("\t=============================\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWsetfillvalue... \n"););
+   MESSAGE(11,fprintf(fp,"\t=============================\n"););
+   
+   
+   
+   /*                 
+	  --------- S e t t i n g  F i l l  v a l u e  f o r  T e m p e r a t u r e  --------
+    */
+   
+   fillvalue2 = -777.;
+   
+   MESSAGE(6,printf("\t\n");); 
+   MESSAGE(6,printf("\t\tSetting fill value for field Temperature in swath SIMPLE\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tSetting fill value for field Temperature in swath SIMPLE\n"););
+   status = HE5_SWsetfillvalue(SWid_simple, "Temperature", H5T_NATIVE_DOUBLE, &fillvalue2);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWsetfillvalue(SWid_simple,\"Temperature\", &fillvalue2);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWsetfillvalue for field Temperature %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWsetfillvalue(SWid_simple,\"Temperature\", &fillvalue2);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWsetfillvalue for field Temperature %d\n", status););
+	 }
+   
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWdefdatafield                     *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\t\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdefdatafield... \n"););
+   MESSAGE(4,printf("\t=============================\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefdatafield... \n"););
+   MESSAGE(11,fprintf(fp,"\t=============================\n"););
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining data fields for swath SIMPLE  \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining data fields for swath SIMPLE  \n"););
+   
+   
+   /*
+	  ----------------------------  Swath  SIMPLE ---------------------------
+	  
+	  
+	  
+	  ---------------  D e f i n i n g  T e m p e r a t u r e  --------------
+    */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining data field Temperature\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining data field Temperature\n"););
+   
+   status = HE5_SWdefdatafield(SWid_simple, "Temperature", "DataTrack,DataXtrack", NULL,H5T_NATIVE_DOUBLE , 0); 
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;            
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););       
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");)
+		 MESSAGE(10,printf("\t\tstatus=HE5_SWdefdatafield(SWid_simple,\"Temperature\",NULL, H5T_NATIVE_DOUBLE ,0);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdatafield %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefdatafield(SWid_simple,\"Temperature\",NULL, H5T_NATIVE_DOUBLE ,0);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdatafield %d\n", status););
+	 }
+   
+   
+   
+   /*
+	  ---------------------------------- Defining Appendable field "Count" ---------------------
+    */
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining appendable data field Count\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining appendable data field Count\n"););
+   
+   
+   /*                 
+	  --------------------   D e f i n i n g   c h u n k i n g   ---------------------
+    */
+
+   
+   chunk_dims[ 0 ] = 10;
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining chunking for swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining chunking for swath SIMPLE \n"););  
+   
+   status = HE5_SWdefchunk(SWid_simple,RANK1,chunk_dims);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;          
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWdefchunk(SWid_simple,RANK1,chunk_dims);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefchunk %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefchunk(SWid_simple,RANK1,chunk_dims);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefchunk %d\n",status););
+	 }
+   
+   
+   
+   /*                 
+	  ---------------  D e f i n i n g  c o m p r e s s i o n  s c h e m e  --------------
+	  
+	  ___________________________________________________________________
+	  |                                                                 |
+	  |    HE5_HDFE_COMP_NONE              0                            |
+	  |    HE5_HDFE_COMP_RLE               1                            |
+	  |    HE5_HDFE_COMP_NBIT              2                            |
+	  |    HE5_HDFE_COMP_SKPHUFF           3                            |
+	  |    HE5_HDFE_COMP_DEFLATE           4                            |
+          |    HE5_HDFE_COMP_SZIP_CHIP         5                            |
+          |    HE5_HDFE_COMP_SZIP_K13          6                            |
+          |    HE5_HDFE_COMP_SZIP_EC           7                            |
+          |    HE5_HDFE_COMP_SZIP_NN           8                            |
+          |    HE5_HDFE_COMP_SZIP_K13orEC      9                            |
+          |    HE5_HDFE_COMP_SZIP_K13orNN      10                           | 
+          |    HE5_HDFE_COMP_SHUF_DEFLATE      11                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_CHIP    12                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_K13     13                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_EC      14                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_NN      15                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_K13orEC 16                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_K13orNN 17                           |
+	  |_________________________________________________________________|
+	                                                         
+    */
+   
+   
+   comp_code = 16;
+   
+   /*                 
+	  ---------------  D e f i n i n g  c o m p r e s s i o n  l e v e l   --------------
+    */
+   
+   comp_level[ 0 ] = 8;
+   
+   MESSAGE(6,printf("\t\n"););  
+   MESSAGE(6,printf("\t\tDefining compression parameters for swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining compression parameters for swath SIMPLE \n"););
+
+#ifdef H5_HAVE_FILTER_SZIP
+   if(HE5_szip_can_encode() == 1) {
+   status = HE5_SWdefcomp(SWid_simple,comp_code,comp_level);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWdefcomp(SWid_simple,comp_code, comp_level);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefcomp %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefcomp(SWid_simple,comp_code, comp_level);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefcomp %d\n",status););
+	 }
+      }
+   else printf("No szip encoder provided, the szip compression test is be skipped.\n");
+#else
+   printf("No szip library available, the szip compression test is be skipped.\n");
+#endif
+
+   
+   /*                 
+	  ---------------   D e f i n i n g   C o u n t   --------------
+    */
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDefining data field Count\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining data field Count\n"););
+   status = HE5_SWdefdatafield(SWid_simple, "Count", "DataTrack","Unlim", H5T_NATIVE_INT, 0);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;          
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWdefdatafield(SWid_simple, \"Count\",\"DataTrack\",\"Unlim\",H5T_NATIVE_INT,0);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdatafield %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefdatafield(SWid_simple,\"Count\",\"DataTrack\",\"Unlim\",H5T_NATIVE_INT,0);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdatafield %d\n", status););
+	 }
+   
+
+
+   /*
+	*****************************************************************************
+	*                             Testing    HE5_PRdefine                       *
+	*****************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\t\n"););
+   MESSAGE(4,printf("\tTesting HE5_PRdefine... \n"););
+   MESSAGE(4,printf("\t=======================\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_PRdefine... \n"););
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining profile for swath SIMPLE  \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining profile for swath SIMPLE  \n"););
+   
+   status = HE5_PRdefine(SWid_simple,"Profile-2000", "DataXtrack", NULL, H5T_NATIVE_UINT); 
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;            
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););       
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");)
+	   MESSAGE(10,printf("\t\tstatus=HE5_PRdefine(SWid_simple,\"Profile-2000\", \"DataXtrack\", NULL, H5T_NATIVE_UINT);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_PRdefine %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_PRdefine(SWid_simple,\"Profile-2000\", \"DataXtrack\", NULL, H5T_NATIVE_UINT);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_PRdefine %d\n", status););
+	 }
+
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining data fields for swath INDEX  \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining data fields for swath INDEX  \n"););
+   
+   
+   /*
+	  -------------------------------  Swath  INDEX ---------------------------
+    */
+   
+   
+   
+   /*                 
+	  --------- S e t t i n g  F i l l  v a l u e  f o r  I n d e x e d  D a t a  --------
+    */
+   
+   
+   fillvalue = -555.;
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tSetting fill value for field Indexed_Data in swath INDEX\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tSetting fill value for field Indexed_Data in swath INDEX\n"););
+   status = HE5_SWsetfillvalue(SWid_index, "Indexed_Data", H5T_NATIVE_FLOAT, &fillvalue);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWsetfillvalue(SWid_index,\"Indexed_Data\", &fillvalue);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWsetfillvalue for field Indexed_Data%d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWsetfillvalue(SWid_index,\"Indexed_Data\", &fillvalue);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWsetfillvalue for field Indexed_Data %d\n", status););
+	 }
+   
+   
+   
+   
+   
+   
+   /*                 
+	  ---------------  D e f i n i n g  I n d e x e d _ D a t a  -----------
+    */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining data field Indexed_Data\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining data field Indexed_Data\n"););
+   
+   status = HE5_SWdefdatafield(SWid_index, "Indexed_Data", "TrackDim,XtrackDim", NULL,H5T_NATIVE_FLOAT, 0); 
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););       
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");)
+		 MESSAGE(10,printf("\t\tstatus=HE5_SWdefdatafield(SWid_index,\"Indexed_Data\",NULL, H5T_NATIVE_FLOAT,0);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdatafield %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefdatafield(SWid_index,\"Indexed_Data\",NULL, H5T_NATIVE_FLOAT,0);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdatafield %d\n", status););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWdefcomp                          *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\t\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdefcomp... \n"););
+   MESSAGE(4,printf("\t======================== \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefcomp... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================== \n"););
+   
+   /*                 
+	  --------------------   D e f i n i n g   c h u n k i n g   ---------------------
+    */
+   
+   
+   chunk_dims[ 0 ] = 5 ;
+   chunk_dims[ 1 ] = 2 ;
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining chunking for swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining chunking for swath SIMPLE \n"););  
+   
+   status = HE5_SWdefchunk(SWid_simple,RANK2,chunk_dims);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;          
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWdefchunk(SWid_simple,RANK2,chunk_dims);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefchunk %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefchunk(SWid_simple,RANK2,chunk_dims);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefchunk %d\n",status););
+	 }
+   
+   /*                 
+	  ---------------  D e f i n i n g  c o m p r e s s i o n  s c h e m e  --------------
+	  
+	  
+	  ___________________________________________________________________
+          |                                                                 |
+          |    HE5_HDFE_COMP_NONE              0                            |
+          |    HE5_HDFE_COMP_RLE               1                            |
+          |    HE5_HDFE_COMP_NBIT              2                            |
+          |    HE5_HDFE_COMP_SKPHUFF           3                            |
+          |    HE5_HDFE_COMP_DEFLATE           4                            |
+          |    HE5_HDFE_COMP_SZIP_CHIP         5                            |
+          |    HE5_HDFE_COMP_SZIP_K13          6                            |
+          |    HE5_HDFE_COMP_SZIP_EC           7                            |
+          |    HE5_HDFE_COMP_SZIP_NN           8                            |
+          |    HE5_HDFE_COMP_SZIP_K13orEC      9                            |
+          |    HE5_HDFE_COMP_SZIP_K13orNN      10                           |
+          |    HE5_HDFE_COMP_SHUF_DEFLATE      11                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_CHIP    12                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_K13     13                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_EC      14                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_NN      15                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_K13orEC 16                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_K13orNN 17                           |
+          |_________________________________________________________________| 
+    */
+   
+   
+   comp_code = 16;
+   
+   /*                 
+	  ---------------  D e f i n i n g  c o m p r e s s i o n  l e v e l   --------------
+	*/
+   
+   comp_level[ 0 ] = 2;
+   
+   MESSAGE(6,printf("\t\n"););  
+   MESSAGE(6,printf("\t\tDefining compression parameters for swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining compression parameters for swath SIMPLE \n"););
+
+#ifdef H5_HAVE_FILTER_SZIP
+  if(HE5_szip_can_encode() == 1) {
+   status = HE5_SWdefcomp(SWid_simple,comp_code,comp_level);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test (SZIP) **********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWdefcomp(SWid_simple,comp_code, comp_level);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefcomp %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefcomp(SWid_simple,comp_code, comp_level);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefcomp %d\n",status););
+	 }
+         }
+   else printf("No szip encoder provided, the szip compression test is be skipped.\n");
+#else
+   printf("No szip library available, the szip compression test is be skipped.\n");
+#endif
+
+   
+   /*                 
+	  ---------------   D e f i n i n g   C o n d u c t i o n   --------------
+	*/
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDefining data field Conduction\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining data field Conduction\n"););
+   status = HE5_SWdefdatafield(SWid_simple, "Conduction", "DataTrack,DataXtrack", NULL, H5T_NATIVE_DOUBLE, 0);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;          
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWdefdatafield(SWid_simple, \"Conduction\",\"DataTrack,DataXtrack\",NULL,H5T_NATIVE_DOUBLE,0);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdatafield %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefdatafield(SWid_simple,\"Conduction\",\"DataTrack,DataXtrack\",NULL,H5T_NATIVE_DOUBLE,0);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdatafield %d\n", status););
+	 }
+   
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWdefgeofield                      *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\t\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdefgeofield... \n"););
+   MESSAGE(4,printf("\t============================ \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefgeofield... \n"););
+   MESSAGE(11,fprintf(fp,"\t============================ \n"););
+   
+   /*
+	  --------------------------- Swath  SIMPLE -------------------------------------
+    */
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining geolocation fields for swath SIMPLE\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining geolocation fields for swath SIMPLE\n"););
+   
+   
+   
+   /*
+	  T I M E 
+	*/
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining geolocation field Time\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining geolocation field Time\n"););
+   status = HE5_SWdefgeofield(SWid_simple,"Time","GeoTrack",NULL,H5T_NATIVE_DOUBLE,0);
+   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWdefgeofield(SWid_simple,\"Time\",\"GeoTrack\",NULL,H5T_NATIVE_DOUBLE,0);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefgeofield %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefgeofield(SWid_simple,\"Time\",\"GeoTrack\",NULL,H5T_NATIVE_DOUBLE,0);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefgeofield %d\n",status););
+	 }
+   
+   
+   
+   /*
+	  L A T I T U D E
+	*/
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDefining geolocation field Latitude\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining geolocation field Latitude\n"););
+   
+   status = HE5_SWdefgeofield(SWid_simple, "Latitude", "GeoTrack,GeoXtrack",NULL,H5T_NATIVE_DOUBLE,0);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;          
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWdefgeofield(SWid_simple,\"Latitude\",\"GeoTrack,GeoXtrack\", NULL, H5T_NATIVE_DOUBLE, 0);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefgeofield %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefgeofield(SWid_simple,\"Latitude\",\"GeoTrack,GeoXtrack\", NULL, H5T_NATIVE_DOUBLE, 0 );\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefgeofield %d\n",status););
+	 }
+   
+   
+   /* 
+	  L O N G I T U D E         
+	*/
+   MESSAGE(6,printf("\n");); 
+   MESSAGE(6,printf("\t\tDefining geolocation field Longitude\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining geolocation field Longitude\n"););
+   status = HE5_SWdefgeofield(SWid_simple, "Longitude","GeoTrack,GeoXtrack",NULL,H5T_NATIVE_DOUBLE,0 );
+   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWdefgeofield(SWid_simple,\"Longitude\",\"GeoTrack,GeoXtrack\",NULL,H5T_NATIVE_DOUBLE,0);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefgeofield %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefgeofield(SWid_simple,\"Longitude\",\"GeoTrack,GeoXtrack\",NULL,H5T_NATIVE_DOUBLE,0);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefgeofield %d\n",status););
+	 }
+   
+   
+   
+   /*
+	  -------------------------------- Swath  INDEX -------------------------------------
+	*/
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDefining geolocation fields for swath INDEX\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining geolocation fields for swath INDEX\n"););
+   
+   /*
+	  L A T I T U D E
+	*/
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDefining geolocation field Latitude\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining geolocation field Latitude\n"););
+   status = HE5_SWdefgeofield(SWid_index,"Latitude","GeoDim,GeoXDim",NULL,H5T_NATIVE_FLOAT,0);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWdefgeofield(SWid_index,\"Latitude\",\"GeoDim,GeoXDim\",NULL,H5T_NATIVE_FLOAT,0);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefgeofield %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefgeofield(SWid_index,\"Latitude\",\"GeoDim,GeoXDim\",NULL,H5T_NATIVE_FLOAT,0);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefgeofield %d\n",status););
+	 }
+   
+   
+   /*
+	  L O N G I T U D E
+	*/
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDefining geolocation field Longitude\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining geolocation field Longitude\n"););
+   status = HE5_SWdefgeofield(SWid_index,"Longitude","GeoDim,GeoXDim",NULL,H5T_NATIVE_FLOAT,0);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWdefgeofield(SWid_index,\"Longitude\",\"GeoDim,GeoXDim\",NULL,H5T_NATIVE_FLOAT,0);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWdefgeofield %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefgeofield(SWid_index,\"Longitude\",\"GeoDim,GeoXDim\",NULL,H5T_NATIVE_FLOAT,0);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefgeofield %d\n",status););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_SWwritefield                        *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWwritefield... \n"););
+   MESSAGE(4,printf("\t===========================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWwritefield... \n"););
+   MESSAGE(11,fprintf(fp,"\t===========================\n"););
+   
+   
+   
+   /*
+	  -------------------------------- Swath SIMPLE -------------------------
+	  
+	  
+	  --------- W r i t i n g    T i m e     i n    a    s w a t h   --------
+	*/
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tWriting field Time in swath SIMPLE \n");); 
+   MESSAGE(11,fprintf(fp,"\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tWriting field Time in swath SIMPLE \n"););
+   
+   TimeData = (double *)calloc( 5, sizeof( double));
+   
+   for ( i = 0; i < 5; i++ ) 
+	 {
+	   TimeData[ i ] = 5.e7 + 5.e6 * i ;
+	 }
+   
+   
+   tstart[ 0 ]   = 0;
+   tedge[ 0 ]    = 5;
+   
+   
+   status = HE5_SWwritefield(SWid_simple,"Time", tstart, NULL, tedge, TimeData);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_simple,\"Time\", tstart,NULL, tedge, TimeData);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Time\", tstart,NULL, tedge, TimeData);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield %d\n",status););
+	 }
+   
+   
+   free( TimeData );
+   TimeData = NULL;
+   
+   
+   /*                 
+	  --------- W r i t i n g    T e m p e r a t u r e    i n    a    s w a t h --------
+	*/
+   
+   MESSAGE(6,printf("\n");); 
+   MESSAGE(6,printf("\t\tWriting field Temperature in swath SIMPLE \n"););   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting field Temperature in swath SIMPLE \n"););
+   
+   tstart[ 0 ]   = 0;
+   tstart[ 1 ]   = 0;
+   tedge[ 0 ]    = 10;
+   tedge[ 1 ]    = 4;
+   
+   status = HE5_SWwritefield(SWid_simple, "Temperature", tstart, NULL, tedge, TempData);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_simple,\"Temperature\", tstart,stride, tedge, TempData);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Temperature\", tstart, stride, tedge, TempData);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield %d\n",status););
+	 }
+   
+   
+   
+   /*                 
+	  --------- W r i t i n g    C o n d u c t i o n    i n    a    s w a t h --------
+	*/
+   
+   
+   MESSAGE(6,printf("\n"););  
+   MESSAGE(6,printf("\t\tWriting field Conduction in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting field Conduction in swath SIMPLE \n"););
+   
+   status = HE5_SWwritefield(SWid_simple, "Conduction", tstart, NULL, tedge, CondData);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_simple, \"Conduction\",tstart, stride, tedge, CondData);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield for field Conduction in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Conduction\", tstart, stride, tedge, CondData);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield for field Conduction in swath SIMPLE %d\n",status););
+	 }
+   
+   
+   
+   /*                 
+	  --------- W r i t i n g    L o n g i t u d  e / L a t i t u d e    i n   a    s w a t h --------
+	*/
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tWriting field Longitude in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting field Longitude in swath SIMPLE \n"););
+   
+   tedge[0]  = 5;
+   
+   status = HE5_SWwritefield(SWid_simple, "Longitude", tstart, NULL, tedge, LongData);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;       
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_simple, \"Longitude\",tstart, NULL, tedge, LongData);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield for field Longitude in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Longitude\", tstart, NULL, tedge, LongData);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield for field Conduction in swath SIMPLE %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tWriting field Latitude in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting field Latitude in swath SIMPLE \n"););
+   
+   status = HE5_SWwritefield(SWid_simple, "Latitude", tstart, NULL, tedge, LatData);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;          
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_simple, \"Latitude\",tstart, NULL, tedge, LatData);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield for field Latitude in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Latitude\", tstart, NULL, tedge, LatData);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield for field latitude in swath SIMPLE %d\n",status););
+	 }   
+   
+   
+   /*                 
+	  --------- W r i t i n g    C o u n t    i n    a    s w a t h --------
+	*/
+   tstart[0] = 0; tedge[0] = 10;
+   
+   MESSAGE(6,printf("\n"););  
+   MESSAGE(6,printf("\t\tWriting field Count in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting field Count in swath SIMPLE \n"););
+   
+   status = HE5_SWwritefield(SWid_simple, "Count", tstart, NULL, tedge, inarray);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_simple, \"Count\",tstart, NULL, tedge, inarray);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield for field Count in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Count\", tstart, stride, NULL, inarray);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield for field Conduction in swath SIMPLE %d\n",status););
+	 }
+   
+
+
+   /*
+	**************************************************************************
+	*                             Testing   HE5_PRwrite                      *
+	**************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_PRwrite... \n"););
+   MESSAGE(4,printf("\t======================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_PRwrite... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================\n"););
+   
+
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tWriting profile \"Profile-2000\"  in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting profile \"Profile-2000\" in swath SIMPLE \n"););
+
+ 
+   edge[ 0 ] = 4;
+   status = HE5_PRwrite(SWid_simple, "Profile-2000", start, NULL, edge, datasize, buffer);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;          
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus =  HE5_PRwrite(SWid_simple, \"Profile-2000\", start, NULL, edge, datasize, buffer);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_PRwrite in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PRwrite(SWid_simple,\"Profile-2000\", start, NULL, edge, datasize, buffer);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_PRwrite in swath SIMPLE %d\n",status););
+	 }   
+
+   
+   /*
+	  -------------------------------- Swath INDEX -----------------------------------
+	  
+	  
+	  ------- W r i t i n g   I n d e x e d _ D a t a   i n   a   s w a t h   --------
+	*/
+   
+   
+   tstart[ 0 ]   = 0;
+   tstart[ 1 ]   = 0;
+   tedge[ 0 ]    = 8;
+   tedge[ 1 ]    = 4;
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tWriting field Indexed_Data in swath INDEX \n");); 
+   MESSAGE(11,fprintf(fp,"\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tWriting field Indexed_Data in swath INDEX \n"););
+   
+   status = HE5_SWwritefield(SWid_index, "Indexed_Data", tstart, NULL, tedge, IndexedData);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_index, \"Indexed_Data\",tstart,NULL,tedge,IndexedData);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield for field Indexed_Data in swath INDEX %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Indexed_Data\",tstart,NULL,tedge,IndexedData);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield for field Indexed_Data in swath INDEX %d\n",status););
+	 }
+   
+   
+   /*
+	  ------- W r i t i n g    L a t i t u d e / L o n g i t u d e    i n   a   s w a t h   --------
+    */
+   
+   
+   tstart[ 0 ]   = 0;
+   tstart[ 1 ]   = 0;
+   tedge[ 0 ]    = 6;
+   tedge[ 1 ]    = 6;
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tWriting field Latitude in swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tWriting field Latitude in swath INDEX \n"););
+   
+   status = HE5_SWwritefield(SWid_index, "Latitude", tstart, NULL, tedge, IndexedLatData);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_index, \"Latitude\",tstart,NULL,tedge,IndexedLatData);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield for field Latitude in swath INDEX %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Latitude\",tstart,NULL,tedge,IndexedLatData);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield for field Latitude in swath INDEX %d\n",status););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tWriting field Longitude in swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\n"););   
+   MESSAGE(11,fprintf(fp,"\t\tWriting field Longitude in swath INDEX \n"););
+   
+   status = HE5_SWwritefield(SWid_index, "Longitude", tstart, NULL, tedge, IndexedLonData);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_index, \"Longitude\",tstart,NULL,tedge,IndexedLonData);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield for field Longitude in swath INDEX %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Longitude\",tstart,NULL,tedge,IndexedLonData);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield for field Longitude in swath INDEX %d\n",status););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_SWwriteattr                         *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWwriteattr... \n"););
+   MESSAGE(4,printf("\t==========================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWwriteattr... \n"););
+   MESSAGE(11,fprintf(fp,"\t==========================\n"););
+   
+   /*                 
+	  --------- W r i t i n g   " D r i f t "    i n    a    s w a t h --------
+    */
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tWriting attribute Drift in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););   
+   MESSAGE(11,fprintf(fp,"\t\tWriting attribute Drift in swath SIMPLE \n"););   
+   status = HE5_SWwriteattr(SWid_simple,"Drift",H5T_NATIVE_INT,CurrentSize,AttrVal);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWwriteattr(SWid_simple, \"Drift\",H5T_NATIVE_INT, 4, AttrVal);\n"););
+       MESSAGE(8,printf("\t\tValue returned by SWwriteattr for attribute Drift in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwriteattr(SWid_simple, \"Drift\",H5T_NATIVE_INT, 4, AttrVal);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by SWwriteattr for attribute Drift in swath SIMPLE %d\n",status););
+
+       MESSAGE(11,fprintf(fp,"\t\t Attribute element   Value to write \n"););
+       MESSAGE(11,printf("\t\t Attribute element   Value to write \n"););
+
+	   for( i = 0; i < 4 ; i++ )  
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t    %d                   %d \n",i+1,AttrVal[ i ] ););
+		   MESSAGE(11,printf("\t\t    %d                   %d \n", i+1,AttrVal[ i ] ););
+		 }
+
+
+	 }
+      
+         
+ /*
+        *********************************************************************************
+        *                             Testing   HE5_SWwritegrpattr                         *
+        *********************************************************************************
+        */
+ 
+ 
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWwritegrpattr... \n"););
+   MESSAGE(4,printf("\t==========================\n"););
+ 
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWwritegrpattr... \n"););
+   MESSAGE(11,fprintf(fp,"\t==========================\n"););
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tWriting attribute GroupAttribute in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting attribute GroupAttribute in swath SIMPLE \n");); 
+   status = HE5_SWwritegrpattr(SWid_simple,"GroupAttribute",H5T_NATIVE_INT,CurrentSize,GattrVal);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWwritegrpattr(SWid_simple, \"GroupAttribute\",H5T_NATIVE_INT, 4,GattrVal);\n"););
+       MESSAGE(8,printf("\t\tValue returned by SWwritegrpattr for attribute GroupAttribute in swath SIMPLE %d \n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritegrpattr(SWid_simple, \"GroupAttribute\",H5T_NATIVE_INT, 4, GattrVal);\n"););
+       
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by SWwritegrpattr for attribute GroupAttribute in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\t Attribute element   Value to write \n"););
+       MESSAGE(11,printf("\t\t Attribute element   Value to write \n"););
+       for( i = 0; i < 4 ; i++ )
+                 {
+                   MESSAGE(11,fprintf(fp,"\t\t    %d                   %d \n",i+1,GattrVal[ i ] ););
+                   MESSAGE(11,printf("\t\t    %d                   %d \n", i+1,GattrVal[ i ] ););
+                 }
+
+
+         }
+
+/*
+        *********************************************************************************
+        *                             Testing   HE5_SWwritegeogrpattr                         *
+        *********************************************************************************
+        */
+
+
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWwritegeogrpattr... \n"););
+   MESSAGE(4,printf("\t==========================\n"););
+
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWwritegeogrpattr... \n"););
+   MESSAGE(11,fprintf(fp,"\t==========================\n"););
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tWriting attribute ScalarFloat in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting attribute ScalarFloat in swath SIMPLE \n"););
+
+   count[0] = 1;
+   status = HE5_SWwritegeogrpattr(SWid_simple,"ScalarFloat",H5T_NATIVE_FLOAT,count,&GfattrVal);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+   errcnt++;
+         }
+   else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWwritegeogrpattr(SWid_simple, \"ScalarFloat\",H5T_NATIVE_FLOAT, 4,GfattrVal);\n"););
+       MESSAGE(8,printf("\t\tValue returned by SWwritegeogrpattr for attribute ScalarFloat in swath SIMPLE %d \n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritegeogrpattr(SWid_simple, \"ScalarFloat\",H5T_NATIVE_FLOAT, 4, GfattrVal);\n");)
+;
+
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by SWwritegeogrpattr for attribute ScalarFloat in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\t Attribute element   Value to write \n"););
+       MESSAGE(11,printf("\t\t Attribute element   Value to write \n"););
+       
+   
+   }
+
+
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_SWdefvrtregion                      *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdefvrtregion... \n"););
+   MESSAGE(4,printf("\t=============================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefvrtregion... \n"););
+   MESSAGE(11,fprintf(fp,"\t=============================\n"););
+   
+   Range[ 0 ] = 5.5e7;
+   Range[ 1 ] = 6.5e7;
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDefining vert region Time \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining vert region Time \n"););
+   
+   RegionID = HE5_SWdefvrtregion(SWid_simple,HE5_HDFE_NOPREVSUB,"Time",Range);
+   if (RegionID == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(8,printf("\t\tRegion ID returned by SWdefvrtregion = %d\n",RegionID););
+       MESSAGE(11,fprintf(fp,"\t\tRegion ID returned by SWdefvrtregion = %d\n",RegionID););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_SWreadfield                         *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWreadfield... \n"););
+   MESSAGE(4,printf("\t==========================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWreadfield... \n"););
+   MESSAGE(11,fprintf(fp,"\t==========================\n"););
+   
+   
+   /*                 
+	  --------- R e a d i n g    T i m e     f r o m    a    s w a t h   --------
+    */
+   
+   
+   tstart[ 0 ]   = 0;
+   tedge[ 0 ]    = 5;
+   
+   TimeDataOut = (double *)calloc( 5, sizeof( double ));   
+   
+   MESSAGE(6,printf("\n"););   
+   MESSAGE(6,printf("\t\tReading field Time from  swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tReading field Time from swath SIMPLE \n"););
+   
+   status = HE5_SWreadfield(SWid_simple,"Time",tstart,NULL,tedge,TimeDataOut);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWreadfield(SWid_simple,\"Time\",tstart,NULL,tedge,TimeDataOut);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWreadfield %d\n", status ););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWreadfield(SWid_simple,\"Time\",tstart,NULL,tedge,TimeDataOut);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWreadfield %d\n", status ););
+       MESSAGE(8,printf("\t\tFirst five values of \"Time\" field read\n"););
+       MESSAGE(11,fprintf(fp,"\t\tFirst five values of \"Time\" field read\n"););
+       MESSAGE(8,printf("\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+	   for( i = 0; i < 5 ; i++)
+		 {
+		   MESSAGE(8,printf("\t\t      %lf\n", TimeDataOut[i]););
+		   MESSAGE(11,fprintf(fp,"\t\t       %lf\n", TimeDataOut[i]););
+		 }
+	 }
+   
+   free(TimeDataOut);
+   TimeDataOut = NULL;
+
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_PRread                              *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_PRread... \n"););
+   MESSAGE(4,printf("\t=====================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_PRread... \n"););
+   MESSAGE(11,fprintf(fp,"\t=====================\n"););
+
+   start[0] = 0;
+   edge[0]  = 4;
+   status = HE5_PRread(SWid_simple, "Profile-2000", start, NULL, edge, buffer_out);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_PRread(SWid_simple, \"Profile-2000\", start, NULL, edge, buffer_out);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by HE5_PRread %d\n", status ););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_PRread(SWid_simple,\"Profile-2000\", start, NULL, edge, buffer_out);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by HE5_PRread %d\n", status ););
+       MESSAGE(8,printf("\t\tThe first two elements of \"Profile-2000\" data read\n"););
+       MESSAGE(11,fprintf(fp,"\t\tThe firdt two elements of \"Profile-2000\" data read\n"););
+       MESSAGE(8,printf("\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+
+	 }
+   for (i = 0; i < 4; i++)
+	 {                      
+	   MESSAGE(8,printf("\t\tThe %d-th element length is %d \n", i, (unsigned)buffer_out[i].len););
+	   MESSAGE(11,fprintf(fp,"\t\tThe %d-th element length is %d \n", i, (unsigned)buffer_out[i].len););
+	   for (j = 0; j < 2; j++)
+		 { 
+		   MESSAGE(8,printf("\t\t            %d \n", ((unsigned int *)buffer_out[i].p)[j]););
+		   MESSAGE(11,fprintf(fp,"\t\t            %d \n", ((unsigned int *)buffer_out[i].p)[j]););
+		 }
+	 }
+   
+
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tReclaiming the space ... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tReclaiming the space ... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+
+   status = HE5_PRreclaimspace(SWid_simple, "Profile-2000", buffer_out);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_PRreclaimspace(SWid_simple, \"Profile-2000\", buffer_out);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by HE5_PRreclaimspace %d\n", status ););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_PRreclaimspace(SWid_simple,\"Profile-2000\", buffer_out);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by HE5_PRreclaimspace %d\n", status ););
+	 }
+
+
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_SWreadattr                          *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWreadattr... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWreadattr... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+   
+   
+   /*                 
+	  --------- R e a d i n g   " D r i f t "    a t t r i b u t e  --------
+	*/
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tReading attribute Drift from swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tReading attribute Drift from swath SIMPLE \n"););
+   
+   status = HE5_SWreadattr(SWid_simple,"Drift", AttrValOut);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWreadattr(SWid_simple,\"Drift\", AttrValOut);\n"););
+       MESSAGE(8,printf("\t\tValue returned by SWreadattr for attribute Drift in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWreadattr(SWid_simple,\"Drift\", AttrValOut);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by SWreadattr for attribute Drift in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\t Attribute elements read \n"););
+       MESSAGE(8,printf("\t\t Attribute elements read \n"););      
+       MESSAGE(8,printf("\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+	   for( i = 0; i < 4 ; i++ )  
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t            %d \n", AttrValOut[ i ] ););
+		   MESSAGE(8,printf("\t\t               %d \n", AttrValOut[ i ] ););       
+		 }
+	 }
+  
+
+    /*
+        *********************************************************************************
+        *                             Testing   HE5_SWreadgrpattr                       *
+        *********************************************************************************
+        */
+  
+  
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWreadgrpattr... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWreadgrpattr... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tReading attribute GroupAttribute from swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tReading attribute GroupAttribute from swath SIMPLE \n"););
+  
+   status = HE5_SWreadgrpattr(SWid_simple,"GroupAttribute", GattrValOut);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+   {  
+       MESSAGE(4,printf("\n"););  
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+ /*    MESSAGE(4,printf("Group attribute values:\n"););
+       for (i = 0; i < 4; i++)
+       MESSAGE(4,printf("\t\t %d \n", GattrValOut[ i ] );); */
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWreadgrpattr(SWid_simple,\"GroupAttribute\", GattrValOut);\n"););
+       MESSAGE(8,printf("\t\tValue returned by SWreadgrpattr for attribute GroupAttribute in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWreadgrpattr(SWid_simple,\"GroupAttribute\", GattrValOut);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by SWreadgrpattr for attribute GroupAttribute in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\t Attribute elements read \n"););
+       MESSAGE(8,printf("\t\t Attribute elements read \n"););
+       MESSAGE(8,printf("\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+           for( i = 0; i < 4 ; i++ ) 
+                 {
+                   MESSAGE(11,fprintf(fp,"\t\t            %d \n", GattrValOut[ i ] ););
+                   MESSAGE(8,printf("\t\t               %d \n", GattrValOut[ i ] ););
+                 }
+         }
+
+
+   /*
+     
+      *********************************************************************************
+      *                             Testing   HE5_SWreadgeogrpattr                    *
+      *********************************************************************************
+        */
+ 
+ 
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWreadgeogrpattr... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWreadgeogrpattr... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tReading attribute ScalarFloat from swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tReading attribute ScalarFloat from swath SIMPLE \n"););
+ 
+   status = HE5_SWreadgeogrpattr(SWid_simple,"ScalarFloat", &GfattrValOut);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+   { 
+       MESSAGE(4,printf("\n");); 
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+   /*  MESSAGE(4,printf("Geolocation fields group attribute values:\n"););
+       MESSAGE(4,printf("\t\t %f \n", GfattrValOut );); */
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWreadgeogrpattr(SWid_simple,\"GroupAttribute\", GattrValOut);\n"););
+       MESSAGE(8,printf("\t\tValue returned by SWreadgeogrpattr for attribute GroupAttribute in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWreadgeogrpattr(SWid_simple,\"GroupAttribute\", GattrValOut);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by SWreadgeogrpattr for attribute GroupAttribute in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\t Attribute elements read \n"););
+       MESSAGE(8,printf("\t\t Attribute elements read \n"););
+       MESSAGE(8,printf("\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(8,printf("\t\t               %f \n", GfattrValOut););
+         }
+
+
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_SWnentries                          *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWnentries... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWnentries... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+   
+   
+   /*                 
+	  -----  R e t r i e v e   #  o f   d i m e n s i o n s   i n   a   s w a t h -----
+	*/
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve number of dimensions in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve number of dimensions in swath SIMPLE \n"););
+   
+   number = HE5_SWnentries(SWid_simple,0,&strbufsize);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWnentries(SWid_simple,0,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tNumber of dimensions  %li\n",number););
+       MESSAGE(8,printf("\t\tString size of dimension entries:        %li (bytes)\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWnentries(SWid_simple,0,&strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of dimensions  %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tString size of dimension entries:        %li (bytes)\n",strbufsize););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_SWinqdims                           *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWinqdims... \n"););
+   MESSAGE(4,printf("\t======================== \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqdims... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================== \n"););
+   
+   DimNamePtr      = (char  *)calloc( 1, strbufsize+1);
+   
+   
+   /*                 
+	  -----  R e t r i e v e   d i m e n s i o n   l i s t  f o r   a   s w a t h -----
+    */   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve the dimension information for swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve the dimension information for swath SIMPLE \n"););
+   
+   
+   number = HE5_SWinqdims(SWid_simple,DimNamePtr,Dims);   
+   if (number == FAIL)
+	 {       
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(8,printf("\t\tnumber=HE5_SWinqdims(SWid_simple,DimNamePtr,DimListPtr);\n"););
+       MESSAGE(8,printf("\t\tDimension list: \n"););
+       MESSAGE(8,printf("\t\t                %s\n",DimNamePtr););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqdims(SWid_simple,DimNamePtr,DimListPtr);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tDimension list: \n"););
+       MESSAGE(11,fprintf(fp,"\t\t                %s\n",DimNamePtr););
+       MESSAGE(8,printf("\t\tDimension sizes: \n"););
+       MESSAGE(11,fprintf(fp,"\t\tDimension sizes: \n"););
+       for (i = 0; i < number; i++)
+		 {
+		   MESSAGE(8,printf("\t\t                %lu\n",(unsigned long)Dims[i]););
+		   MESSAGE(11,fprintf(fp,"\t\t                %lu\n",(unsigned long)Dims[i]););
+		 }
+	 }
+   
+   
+   free(DimNamePtr);
+   DimNamePtr = NULL;
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_SWinqmaps                           *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWinqmaps... \n"););
+   MESSAGE(4,printf("\t======================== \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqmaps... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================== \n"););
+   
+   /*                 
+	  -- R e t r i e v e   d i m e n s i o n   m a p p i n g s   i n   a   s w a t h --
+    */ 
+   
+   MESSAGE(6,printf("\n");); 
+   MESSAGE(6,printf("\t\tRetrieve dimension mappings for swath SIMPLE\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve dimension mappings for swath SIMPLE\n"););
+   number = HE5_SWnentries(SWid_simple,1,&strbufsize);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;          
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWnentries(SWid_simple,1,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tNumber of dimension mappings %li\n",number););
+       MESSAGE(8,printf("\t\tSize of dimension mapping entries %li (bytes)\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWnentries(SWid_simple,1,&strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of dimension mappings %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tSize of dimension mapping entries %li (bytes)\n",strbufsize););
+	 }
+   
+   
+   /*                 
+	  -- R e t r i e v e   g e o l o c a t i o n   r e l a t i o n s  f o r  a  s w a t h --
+	*/   
+   
+   
+   OffsetPtr       = (long *)calloc(number, sizeof(long));   
+   IncremPtr       = (long *)calloc(number, sizeof(long));
+   DimMapListPtr   = (char *)calloc( BUFSIZE, sizeof(char));
+   
+   MESSAGE(6,printf("\n");); 
+   MESSAGE(6,printf("\t\tRetrieve geolocation relations for swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve geolocation relations for swath SIMPLE \n"););
+   
+   number = HE5_SWinqmaps(SWid_simple,DimMapListPtr,OffsetPtr,IncremPtr);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWinqmaps(SWid_simple,DimMapListPtr,OffsetPtr,IncremPtr);\n"););
+       MESSAGE(8,printf("\t\tNumber of maps %li\n", number););
+       MESSAGE(6,printf("\t\tGeolocation relations: \n"););
+       MESSAGE(6,printf("\t\t  %s\n",DimMapListPtr););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqmaps(SWid_simple,DimMapListPtr,OffsetPtr,IncremPtr);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of maps %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tGeolocation relations: \n"););
+       MESSAGE(11,fprintf(fp,"\t\t  %s\n",DimMapListPtr););
+
+       MESSAGE(6,printf("\t\t  Offset     Increment \n"););
+       MESSAGE(11,fprintf(fp,"\t\t  Offset     Increment \n"););
+       for (i = 0; i < number; i++)
+		 {
+		   MESSAGE(6,printf("\t\t      %li          %li \n",OffsetPtr[i], IncremPtr[i]););
+		   MESSAGE(11,fprintf(fp,"\t\t      %li          %li \n",OffsetPtr[i], IncremPtr[i]););
+		 }
+       
+	 }
+   
+   
+   free(OffsetPtr);
+   free(IncremPtr);
+   free(DimMapListPtr);
+   OffsetPtr = NULL;
+   IncremPtr = NULL;
+   DimMapListPtr = NULL;
+   
+   
+   
+   /*                 
+	  -- R e t r i e v e   t h e   I n d e x   d i m e n s i o n   m a p p i n g s   --
+    */   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve the Index dimension mappings for swath SIMPLE\n"););
+   MESSAGE(11,fprintf(fp,"\n"); );
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve the Index dimension mappings for swath SIMPLE\n"); );
+   
+   number = HE5_SWnentries(SWid_simple,2,&strbufsize);
+   if ( number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););         
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWnentries(SWid_simple,2,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tNumber of Indexed mappings %li\n",number););
+       MESSAGE(8,printf("\t\tSize of index mapping entries:  %li (bytes)\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWnentries(SWid_simple,2,&strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of Indexed mappings %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tSize of index mapping entries:  %li (bytes)\n",strbufsize););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_SWinqgeofields                      *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWinqgeofields... \n"););
+   MESSAGE(4,printf("\t============================= \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqgeofields... \n"););
+   MESSAGE(11,fprintf(fp,"\t============================= \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about Geolocation fields in swath SIMPLE \n"););   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about Geolocation fields in swath SIMPLE \n"););
+   
+   number = HE5_SWnentries(SWid_simple,3,&strbufsize);
+   if ( number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWnentries(SWid_simple,3,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tValue (number of geo fields) returned by SWnentries %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWnentries(SWid_simple,3,&strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue (number of geo fields) returned by SWnentries %li\n",number););
+	 }
+   
+   
+   /*                 
+	  -- R e t r i e v e   g e o l o c a t i o n   f i e l d s   i n   a   s w a t h   --
+    */   
+   
+   
+   RankPtr         = (int *)calloc( number, sizeof(int));
+   FieldListPtr    = (char  *)calloc( BUFSIZE, sizeof(char));
+   
+   MESSAGE(6,printf("\n"););  
+   MESSAGE(6,printf("\t\tRetrieve more information about  Geolocation fields\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve more information about Geolocation fields\n"););
+   
+   number = HE5_SWinqgeofields(SWid_simple,FieldListPtr,RankPtr,ntype);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWinqgeofields(SWid_simple,FieldListPtr,RankPtr,ntype);\n"););
+       MESSAGE(8,printf("\t\tList of Geolocation fields:\n"););
+       MESSAGE(8,printf("\t\t %s\n",FieldListPtr););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqgeofields(SWid_simple,FieldListPtr,RankPtr,ntype);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tList of Geolocation fields:\n"););
+       MESSAGE(11,fprintf(fp,"\t\t %s\n",FieldListPtr);); 
+       MESSAGE(8,printf("\t\tRanks:       Data types:\n"););
+       MESSAGE(11,fprintf(fp,"\t\tRanks:        Data types:\n"););
+
+	   for (i = 0; i < number; i++)
+		 {
+           MESSAGE(8,printf("\t\t %d             %d\n", RankPtr[i], ntype[i]););
+           MESSAGE(11,fprintf(fp,"\t\t %d             %d\n", RankPtr[i], ntype[i]););
+		 }
+    
+	 }
+   
+   free(RankPtr);
+   RankPtr = NULL;
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_SWinqdatafields                     *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWinqdatafields... \n"););
+   MESSAGE(4,printf("\t============================== \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqdatafields... \n"););
+   MESSAGE(11,fprintf(fp,"\t============================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about Data fields in swath SIMPLE\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about Data fields in swath SIMPLE\n"););
+   
+   number = HE5_SWnentries(SWid_simple,4,&strbufsize);   
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWnentries(SWid_simple,4,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tValue (number of data fields) returned by SWnentries %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWnentries(SWid_simple,4,&strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue (number of data fields) returned by SWnentries %li\n",number););
+	 }
+   
+   RankPtr         = (int *)calloc(number, sizeof(int));
+   
+   MESSAGE(6,printf("\t\tRetrieve the Data fields in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve the Data fields in swath SIMPLE \n"););
+	 
+   number = HE5_SWinqdatafields(SWid_simple,FieldListPtr,RankPtr,ntype);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWinqdatafields(SWid_simple,FieldListPtr,RankPtr,ntype);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqdatafields(SWid_simple,FieldListPtr,RankPtr,ntype);\n"););
+       MESSAGE(8,printf("\t\tList of Data fields:\n"););
+       MESSAGE(8,printf("\t\t  %s\n",FieldListPtr););
+       MESSAGE(11,fprintf(fp,"\t\tList of Data fields:\n"););
+       MESSAGE(11,fprintf(fp,"\t\t   %s\n",FieldListPtr););
+       MESSAGE(8,printf("\t\tRanks:       Data types:\n"););
+       MESSAGE(11,fprintf(fp,"\t\tRanks:        Data types:\n"););
+
+	   for (i = 0; i < number; i++)
+		 {
+           MESSAGE(8,printf("\t\t %d             %d\n", RankPtr[i], ntype[i]););
+           MESSAGE(11,fprintf(fp,"\t\t %d             %d\n", RankPtr[i], ntype[i]););
+		 }
+	 }
+   
+   free(RankPtr);
+   free(FieldListPtr);
+
+
+       /*
+        *********************************************************************************
+        *                             Testing   HE5_SWwritelocattr                      *
+        *********************************************************************************
+*/
+       MESSAGE(4,printf("\tTesting HE5_SWwritelocattr... \n"););
+       MESSAGE(4,printf("\t========================== \n"););
+
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\tTesting HE5_SWwritelocattr... \n"););
+       MESSAGE(11,fprintf(fp,"\t========================== \n"););
+   
+       MESSAGE(6,printf("\n"););
+       MESSAGE(6,printf("\t\tWriting attribute \"LocaAttribute\" to the field \"Count\"  \n"););
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\t\tWriting attribute \"LocalAttribute\" to the \"Count\" \n"););
+
+
+      count[0] = 4;
+      status = HE5_SWwritelocattr(SWid_simple, "Count", "LocalAttribute",H5T_NATIVE_INT, count, attr3);
+      if (status == FAIL)
+       {
+         MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+         MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+         errcnt++;
+       }
+      else
+      {
+        MESSAGE(4,printf("\n"););
+        MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+        MESSAGE(11,fprintf(fp,"\n"););
+        MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+        MESSAGE(10,printf("\t\tstatus =HE5_SWwritelocattr(SWid_simple, \"Count\", \"LocalAttribute\",H5T_NATIVE_INT, count, attr3); \n");
+);
+        MESSAGE(8,printf("\t\tStatus returned by HE5_GDwritelocattr()         %d\n",status););
+        MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritelocattr(SWid_simple, \"Count\", \"LocalAttribute\",H5T_NATIVE_INT, count, attr3);\
+n");)
+        MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_SWwritelocattr()         %d\n",status););
+
+      }
+
+      /*
+        *********************************************************************************
+        *                             Testing   HE5_SWreadlocattr                       *
+        *********************************************************************************
+        */
+
+
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWreadlocattr... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWreadlocattr... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tReading attribute LocalAttribute from Count field \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tReading attribute LocalAttribute from Count field \n"););
+
+   status = HE5_SWreadlocattr(SWid_simple, "Count", "LocalAttribute", attr3Out);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+   {
+   MESSAGE(4,printf("\n"););
+      MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+      MESSAGE(11,fprintf(fp,"\n"););
+      MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+      MESSAGE(10,printf("\t\tstatus = HE5_SWreadlocattr(SWid_simple,\"Count\", \"LocalAttribute\", attr3Out);\n"););
+      MESSAGE(8,printf("\t\tValue returned by SWreadlocattr for attribute LocalAttribute in field Count %d\n",status););
+      MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWreadlocattr(SWid_simple,\"Count\", \"LocalAttribute\", attr3Out);\n"););
+      MESSAGE(11,fprintf(fp,"\t\tValue returned by SWreadlocattr for attribute LocalAttribute in field Count %d\n",status););
+      MESSAGE(11,fprintf(fp,"\t\t Attribute elements read \n"););
+      MESSAGE(8,printf("\t\t Attribute elements read \n"););
+      MESSAGE(8,printf("\n"););
+      MESSAGE(11,fprintf(fp,"\n"););
+           for( i = 0; i < 4 ; i++ )
+                 {
+                   MESSAGE(11,fprintf(fp,"\t\t            %d \n", attr3Out[ i ] ););
+                    MESSAGE(8,printf("\t\t               %d \n", attr3Out[ i ] ););
+                 }
+         }
+
+
+  
+/*
+           *********************************************************************************
+           *                             Testing   HE5_SWinqdatatype                       *
+           *********************************************************************************
+        */
+           MESSAGE(4,printf("\tTesting HE5_SWinqdatatype... \n"););
+           MESSAGE(4,printf("\t======================== \n"););
+           MESSAGE(11,fprintf(fp,"\t\n"););
+           MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqdatatype... \n"););
+           MESSAGE(11,fprintf(fp,"\t======================== \n"););
+         
+           MESSAGE(6,printf("\n"););
+           MESSAGE(6,printf("\t\tRetrieving information about field data in a grid\n"););
+           MESSAGE(11,fprintf(fp,"\t\n"););
+           MESSAGE(11,fprintf(fp,"\t\t Retrieving information about field data in a grid\n"););
+           
+           fieldgroup = HE5_HDFE_ATTRGROUP;
+           status = HE5_SWinqdatatype(SWid_simple, NULL, "Drift", fieldgroup, &datatype, &classid, &order, &Size);
+           if (status == FAIL)
+           {
+           MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+           MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+           errcnt++;
+           }
+       else
+           {
+           MESSAGE(4,printf("\n"););
+           MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       /*  MESSAGE(4,printf("\tdatatype:    %d \n", (int)datatype););
+           MESSAGE(4,printf("\tclass ID:    %d \n", (int)classid););
+           MESSAGE(4,printf("\torder:       %d \n", (int)order););
+           MESSAGE(4,printf("\tsize:        %d \n", (int)Size);); */
+           }
+
+           
+           fieldgroup = HE5_HDFE_GRPATTRGROUP;
+           status = HE5_SWinqdatatype(SWid_simple, NULL, "GroupAttribute", fieldgroup, &datatype, &classid, &order, &Size);
+           if (status == FAIL)
+             {
+            MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+            MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+             errcnt++;
+             }
+         else
+            {
+             MESSAGE(4,printf("\n"););
+             MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+         /*  MESSAGE(4,printf("\tdatatype:    %d \n", (int)datatype););
+             MESSAGE(4,printf("\tclass ID:    %d \n", (int)classid););
+             MESSAGE(4,printf("\torder:       %d \n", (int)order););
+             MESSAGE(4,printf("\tsize:        %d \n", (int)Size);); */
+             }
+
+          fieldgroup = HE5_HDFE_LOCATTRGROUP;
+          status = HE5_SWinqdatatype(SWid_simple, "Count", "LocalAttribute", fieldgroup, &datatype, &classid, &order, &Size);
+          if (status == FAIL)
+             {
+            MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+            MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+             errcnt++;
+             }
+         else
+            {
+             MESSAGE(4,printf("\n"););
+             MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       /*    MESSAGE(4,printf("\tdatatype:    %d \n", (int)datatype););
+             MESSAGE(4,printf("\tclass ID:    %d \n", (int)classid););
+             MESSAGE(4,printf("\torder:       %d \n", (int)order););
+             MESSAGE(4,printf("\tsize:        %d \n", (int)Size);); */
+             }
+
+           
+ 
+
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_SWdiminfo...                        *
+	*********************************************************************************
+	*/
+   
+   
+           MESSAGE(4,printf("\n"););
+           MESSAGE(4,printf("\tTesting HE5_SWdiminfo... \n"););
+           MESSAGE(4,printf("\t======================== \n"););
+   
+           MESSAGE(11,fprintf(fp,"\t\n"););
+           MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdiminfo... \n"););
+           MESSAGE(11,fprintf(fp,"\t======================== \n"););
+   
+           MESSAGE(6,printf("\n"););
+           MESSAGE(6,printf("\t\tRetrieve information about DataXtrack dimension in swath SIMPLE \n"););
+           MESSAGE(11,fprintf(fp,"\n"););
+           MESSAGE(11,fprintf(fp,"\t\tRetrieve information about DataXtrack dimension in swath SIMPLE \n"););
+   
+   
+          ndims = HE5_SWdiminfo(SWid_simple,"DataXtrack");   
+          if ( ndims == 0)
+	  {
+            MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+            MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+            errcnt++;
+	  }
+        else
+	 {   
+            MESSAGE(4,printf("\n"););   
+            MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+            MESSAGE(11,fprintf(fp,"\n"););
+            MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+            MESSAGE(10,printf("\t\tndims=HE5_SWdiminfo(SWid_simple,\"DataXtrack\");\n"););
+            MESSAGE(8,printf("\t\tSize of dimension DataXtrack:    %lu \n",(unsigned long)ndims););
+            MESSAGE(11,fprintf(fp,"\t\tndims=HE5_SWdiminfo(SWid_simple,\"DataXtrack\");\n"););
+            MESSAGE(11,fprintf(fp,"\t\tSize of dimension DataXtrack:      %lu \n",(unsigned long)ndims););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWreadfield                        *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWreadfield... \n"););
+   MESSAGE(4,printf("\t========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWreadfield... \n"););
+   MESSAGE(11,fprintf(fp,"\t========================== \n"););
+   
+   inq_start[0]  = 0;
+   inq_start[1]  = 0;
+   inq_stride[0] = 1;
+   inq_stride[1] = 1;
+   inq_edge[0]   = 10;
+   inq_edge[1]   = 4;
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tReading data from field \"Temperature\" in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tReading data from field \"Temperature\" in swath SIMPLE\n"););
+   
+   number = HE5_SWreadfield(SWid_simple,"Temperature",inq_start,inq_stride,inq_edge,TempDataOut);   
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;       
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWreadfield(SWid_simple,\"Temperature\",inq_start,inq_stride,inq_edge,TempDataOut);\n"););
+       MESSAGE(8,printf("\t\tstatus return from call to SWreadfield %li\n", number ););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWreadfield(SWid_simple,\"Temperature\",inq_start,inq_stride,inq_edge,TempDataOut);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus return from call to SWreadfield %li\n", number ););
+       MESSAGE(8,printf("\t\tThe values of data field \"Temperature\":\n"););
+       MESSAGE(11,fprintf(fp,"\t\tThe values of data field \"Temperature\":\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(8,printf("\n"););
+       for (i = 0; i < 10; i++)
+		 {
+		   MESSAGE(8,printf("\t\t    %lf  %lf  %lf  %lf \n",TempDataOut[i][0],TempDataOut[i][1],TempDataOut[i][2],TempDataOut[i][3] ););
+		   MESSAGE(11,fprintf(fp,"\t\t    %lf  %lf  %lf  %lf \n",TempDataOut[i][0],TempDataOut[i][1],TempDataOut[i][2],TempDataOut[i][3] ););
+		 }
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWfieldinfo                        *
+	*********************************************************************************
+	*/
+      
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWfieldinfo... \n"););
+   MESSAGE(4,printf("\t========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););   
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWfieldinfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t========================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about field \"Temperature\" in swath SIMPLE e\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about field \"Temperature\" in swath SIMPLE \n"););
+   
+   status = HE5_SWfieldinfo(SWid_simple,"Temperature",&rank,dims,&dtype1,DimList,NULL);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWfieldinfo(SWid_simple,\"Temperature\",&rank,dims,&dtype1,DimList,NULL);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWfieldinfo %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWfieldinfo(SWid_simple,\"Temperature\",&rank,dims,&dtype1,DimList,NULL);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWfieldinfo %d\n",status););
+       MESSAGE(8,printf("\t\tRank:   %d      Data type:     %d\n",rank, dtype1););
+       MESSAGE(8,printf("\t\tDimension list:           %s\n",DimList););
+       MESSAGE(11,fprintf(fp,"\t\tRank:    %d      Data type:    %d\n",rank, dtype1););
+       MESSAGE(11,fprintf(fp,"\t\tDimension list:          %s\n",DimList););
+       MESSAGE(8,printf("\t\tDimension sizes:\n"););
+       MESSAGE(11,fprintf(fp,"\t\tDimension sizes:\n"););
+       for (i = 0; i < rank; i++)
+		 {
+		   MESSAGE(8,printf("\t\t  %lu\n",(unsigned long)dims[i]););
+		   MESSAGE(11,fprintf(fp,"\t\t  %lu\n",(unsigned long)dims[i]););
+		 }
+       
+	 }
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWinqmaps                          *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWinqmaps... \n"););
+   MESSAGE(4,printf("\t======================== \n"););
+   
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqmaps... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================== \n"););
+   
+   MESSAGE(6,printf("\n"););  
+   MESSAGE(6,printf("\t\tRetrieve information about dimension mapping from swath SIMPLE\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about dimension mapping from swath SIMPLE\n"););
+   
+   number = HE5_SWnentries(SWid_simple,1,&strbufsize);   
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWnentries(SWid_simple,1,&strbufsize);\n"););       
+       MESSAGE(8,printf("\t\tNumber of dimension mappings %li\n",number););
+       MESSAGE(8,printf("\t\tSize of dimension mapping entries: %li (bytes)\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWnentries(SWid_simple,1,&strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of dimension mappings %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tSize of dimension mapping entries: %li (bytes)\n",strbufsize););
+	 }
+   
+   OffsetPtr       = (long *)calloc(number, sizeof(long));   
+   IncremPtr       = (long *)calloc(number, sizeof(long));
+   DimMapListPtr   = (char *)calloc( BUFSIZE, sizeof(char));
+   
+   
+   MESSAGE(6,printf("\t\tRetrieve the geolocation relations for swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve the geolocation relations for swath SIMPLE \n"););
+   
+   number=HE5_SWinqmaps(SWid_simple,DimMapListPtr,OffsetPtr,IncremPtr);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWinqmaps(SWid_simple,DimMapListPtr,OffsetPtr,IncremPtr);\n"););
+       MESSAGE(8,printf("\t\tNumber of mappings in swath SIMPLE     %li\n",number););
+       MESSAGE(6,printf("\t\tGeolocation relations: \n"););
+       MESSAGE(6,printf("\t\t  %s\n",DimMapListPtr););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqmaps(SWid_simple,DimMapListPtr,OffsetPtr,IncremPtr);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of mappings in swath SIMPLE      %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tGeolocation relations: \n"););
+       MESSAGE(11,fprintf(fp,"\t\t  %s\n",DimMapListPtr););
+       
+       MESSAGE(6,printf("\t\t  Offset     Increment \n"););
+       MESSAGE(11,fprintf(fp,"\t\t  Offset     Increment \n"););
+       for (i = 0; i < number; i++)
+		 {
+		   MESSAGE(6,printf("\t\t      %li          %li \n",OffsetPtr[i], IncremPtr[i]););
+		   MESSAGE(11,fprintf(fp,"\t\t      %li          %li \n",OffsetPtr[i], IncremPtr[i]););
+		 }
+
+
+	 }
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWmapinfo                          *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWmapinfo... \n"););
+   MESSAGE(4,printf("\t======================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWmapinfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================== \n");); 
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve offset and increment for geolocation mapping\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve offset and increment for geolocation mapping\n"););
+   
+   status = HE5_SWmapinfo(SWid_simple,"GeoTrack","DataTrack",OffsetPtr,IncremPtr);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););             
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWmapinfo(SWid_simple,\"GeoTrack\",\"DataTrack\",OffsetPtr,IncremPtr);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWmapinfo %d\n",status););
+       MESSAGE(8,printf("\t\tOffset %li, Increment %li\n",*OffsetPtr,*IncremPtr););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWmapinfo(SWid_simple,\"GeoTrack\",\"DataTrack\",OffsetPtr,IncremPtr);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWmapinfo %d\n",status););   
+       MESSAGE(11,fprintf(fp,"\t\tOffset %li, Increment %li\n",*OffsetPtr,*IncremPtr););       
+	 }
+   
+   free(OffsetPtr);
+   free(IncremPtr);
+   free(DimMapListPtr);
+   OffsetPtr = NULL;
+   IncremPtr = NULL;
+   DimMapListPtr = NULL;
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWgeomapinfo                       *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWgeomapinfo... \n"););
+   MESSAGE(4,printf("\t=========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWgeomapinfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================== \n");); 
+   
+   
+   /* Swath SIMPLE */
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieving type of dimension mapping for dimension \"GeoTrack\"\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieving type of dimension mapping for dimension \"GeoTrack\"\n"););
+   MESSAGE(8,printf("\n"););
+   MESSAGE(8,printf("\t\t(NOTE: 2 - indexed mapping, 1 - regular mapping)\n"););
+   MESSAGE(11,fprintf(fp,"\n");); 
+   MESSAGE(11,fprintf(fp,"\t\t(NOTE: 2 - indexed mapping, 1 - regular mapping)\n");); 
+   
+   
+   status = HE5_SWgeomapinfo(SWid_simple,"GeoTrack");   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWgeomapinfo(SWid_simple,\"GeoTrack\",\"DataTrack\");\n"););
+       MESSAGE(8,printf("\t\tValue returned by SWgeomapinfo %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWgeomapinfo(SWid_simple,\"GeoTrack\",\"DataTrack\");\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by SWgeomapinfo %d\n",status););
+	 }
+   
+   
+   /* Swath INDEX */
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieving type of dimension mapping for dimension \"GeoDim\"\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieving type of dimension mapping for dimension \"GeoDim\"\n"););
+   status = HE5_SWgeomapinfo(SWid_index,"GeoDim");   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWgeomapinfo(SWid_index,\"GeoDim\");\n"););
+       MESSAGE(8,printf("\t\tValue returned by SWgeomapinfo %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWmapinfo(SWid_index,\"GeoDim\");\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by SWgeomapinfo %d\n",status);); 
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWgetfillvalue                     *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););      
+   MESSAGE(4,printf("\tTesting HE5_SWgetfillvalue... \n"););
+   MESSAGE(4,printf("\t============================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWgetfillvalue... \n"););
+   MESSAGE(11,fprintf(fp,"\t============================= \n"););
+   
+   MESSAGE(6,printf("\n");); 
+   MESSAGE(6,printf("\t\tGet fill value for the field \"Indexed_Data\" \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tGet fill value for the field \"Indexed_Data\" \n"););
+   status = HE5_SWgetfillvalue(SWid_index,"Indexed_Data",&InqFloatFillValue);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWgetfillvalue(SWid_index,\"Indexed_Data\",&InqFloatFillValue);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWgetfillvalue %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWgetfillvalue(SWid_index,\"Indexed_Data\", &InqFloatFillValue)\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWgetfillvalue %d\n",status););
+       MESSAGE(8,printf("\t\tFill value for field \"Indexed_Data\":\n"););
+       MESSAGE(8,printf("\n"););
+       MESSAGE(8,printf("\t\t     \"%f\" \n", InqFloatFillValue););
+       MESSAGE(11,fprintf(fp,"\t\tFill value for field \"Indexed_Data\":\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t      \"%f\" \n",InqFloatFillValue););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWdetach                           *
+	*********************************************************************************
+	*/
+
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdetach... \n"););
+   MESSAGE(4,printf("\t======================= \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdetach... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDetaching from swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from swath INDEX \n"););
+
+   status = HE5_SWdetach(SWid_index);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdetach(SWid_index);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWdetach for swath INDEX %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdetach(SWid_index);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWdetach for swath INDEX%d\n",status););
+	 }
+   
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWinqattrs                         *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWinqattrs... \n"););
+   MESSAGE(4,printf("\t========================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqattrs... \n"););
+   MESSAGE(11,fprintf(fp,"\t========================= \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about attributes defined in swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attributes defined in swath INDEX \n"););
+   
+   number = HE5_SWinqattrs(SWid_simple, NULL, &strbufsize);   
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Testst**********\n"););
+  /*   MESSAGE(4,printf("\t\tNumber of attributes:             %li \n", number);); */
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWinqattrs(SWid_simple, NULL, &strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqattrs(SWid_simple, NULL, &strbufsize);\n"););
+       MESSAGE(8,printf("\t\tValue (number of attributes) returned by SWinqattrs %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tValue (number of attributes) returned by SWinqattrs %li\n",number););
+       MESSAGE(8,printf("\t\tString length of attribute list:     %li\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tString length of attribute list:    %li\n",strbufsize););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve more information about attributes defined in swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve more information about attributes defined in swath INDEX \n"););
+   
+   ObjNamesPtr     = (char  *)calloc( BUFSIZE, sizeof(char));
+   
+   number = HE5_SWinqattrs(SWid_simple, ObjNamesPtr, &strbufsize);   
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+   /*  MESSAGE(4,printf("\t\t Attribute list:    %s \n", ObjNamesPtr);); */
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWinqattrs(SWid_simple, ObjNamesPtr, &strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqattrs(SWid_simple, ObjNamesPtr,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tNumber of attributes returned by SWinqattr    %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of attributes returned by SWinqattr    %li\n",number););
+       MESSAGE(8,printf("\t\tAttribute list:\n"););
+       MESSAGE(8,printf("\t\t    %s\n", ObjNamesPtr););
+       MESSAGE(11,fprintf(fp,"\t\tAttribute list: \n"););
+       MESSAGE(11,fprintf(fp,"\t\t    %s\n", ObjNamesPtr););
+       MESSAGE(8,printf("\t\tString length of attribute list:     %li\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tString length of attribute list:      %li\n",strbufsize););
+	 }
+   
+   free(ObjNamesPtr);
+   ObjNamesPtr = NULL;
+
+     /* 
+        *********************************************************************************
+        *                             Testing    HE5_SWinqgrpattrs                      *
+        *********************************************************************************
+        */
+ 
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWinqgrpattrs... \n"););
+   MESSAGE(4,printf("\t========================= \n"););
+ 
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqgrpattrs... \n"););
+   MESSAGE(11,fprintf(fp,"\t========================= \n"););
+ 
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about group attributes defined in swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about group attributes defined in swath INDEX \n");)
+;
+ 
+   number = HE5_SWinqgrpattrs(SWid_simple, NULL, &strbufsize);
+   if (number == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+{
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Testst**********\n"););
+  /*   MESSAGE(4,printf("\t\tNumber of group attributes:             %li \n", number);); */
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWinqgrpattrs(SWid_simple, NULL, &strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqgrpattrs(SWid_simple, NULL, &strbufsize);\n"););
+       MESSAGE(8,printf("\t\tValue (number of group attributes) returned by SWingrpqattrs %li\n",number);)
+;
+       MESSAGE(11,fprintf(fp,"\t\tValue (number of group attributes) returned by SWinqgrpattrs %li\n",number);)
+       MESSAGE(8,printf("\t\tString length of group attribute list:     %li\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tString length of group attribute list:    %li\n",strbufsize););
+         }
+
+
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve more information about group attributes defined in swath INDEX \n");)
+;
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve more information about group attributes defined in swath INDEX \
+n"););
+
+   ObjNamesPtr     = (char  *)calloc( BUFSIZE, sizeof(char));
+number = HE5_SWinqgrpattrs(SWid_simple, ObjNamesPtr, &strbufsize);
+   if (number == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+/*     MESSAGE(4,printf("\t\t Group Attribute list:    %s \n", ObjNamesPtr);); */
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWinqgrpattrs(SWid_simple, ObjNamesPtr, &strbufsize);\n");)
+;
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqgrpattrs(SWid_simple, ObjNamesPtr,&strbufsize);\n"
+););
+       MESSAGE(8,printf("\t\tNumber of attributes returned by SWinqgrpattr    %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of attributes returned by SWinqgrpattr    %li\n",number););
+       MESSAGE(8,printf("\t\tGroup Attribute list:\n"););
+       MESSAGE(8,printf("\t\t    %s\n", ObjNamesPtr););
+       MESSAGE(11,fprintf(fp,"\t\tGroup Attribute list: \n"););
+       MESSAGE(11,fprintf(fp,"\t\t    %s\n", ObjNamesPtr););
+       MESSAGE(8,printf("\t\tString length of Group attribute list:     %li\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tString length of Group attribute list:      %li\n",strbufsize););
+         }
+
+   free(ObjNamesPtr);
+   ObjNamesPtr = NULL;
+
+
+         /*
+        *********************************************************************************
+        *                             Testing    HE5_SWinqgeogrpattrs                   *
+        *********************************************************************************
+        */
+
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWinqgeogrpattrs... \n"););
+   MESSAGE(4,printf("\t========================= \n"););
+
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqgeogrpattrs... \n"););
+   MESSAGE(11,fprintf(fp,"\t========================= \n"););
+
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about group attributes defined in swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about group attributes defined in swath INDEX \n"););
+
+   number = HE5_SWinqgeogrpattrs(SWid_simple, NULL, &strbufsize);
+   if (number == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+{
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Testst**********\n"););
+   /*  MESSAGE(4,printf("\t\tNumber of Geolocation fields group attributes:             %li \n", number);); */
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWinqgeogrpattrs(SWid_simple, NULL, &strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqgeogrpattrs(SWid_simple, NULL, &strbufsize);\n"););
+       MESSAGE(8,printf("\t\tValue (number of group attributes) returned by SWingeogrpqattrs %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tValue (number of group attributes) returned by SWinqgeogrpattrs %li\n",number););
+       MESSAGE(8,printf("\t\tString length of group attribute list:     %li\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tString length of group attribute list:    %li\n",strbufsize););
+         }
+
+
+      MESSAGE(6,printf("\n"););
+      MESSAGE(6,printf("\t\tRetrieve more information about group attributes defined in swath INDEX \n"););
+      MESSAGE(11,fprintf(fp,"\n"););
+      MESSAGE(11,fprintf(fp,"\t\tRetrieve more information about group attributes defined in swath INDEX \n"););
+
+      ObjNamesPtr     = (char  *)calloc( BUFSIZE, sizeof(char));
+      number = HE5_SWinqgeogrpattrs(SWid_simple, ObjNamesPtr, &strbufsize);
+      if (number == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+      else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+  /*   MESSAGE(4,printf("\t\t Geolocation field group Attribute list:    %s \n", ObjNamesPtr);); */
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWinqgeogrpattrs(SWid_simple, ObjNamesPtr, &strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqgeogrpattrs(SWid_simple, ObjNamesPtr,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tNumber of attributes returned by SWinqgeogrpattr    %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of attributes returned by SWinqgeogrpattr    %li\n",number););
+       MESSAGE(8,printf("\t\tGroup Attribute list:\n"););
+       MESSAGE(8,printf("\t\t    %s\n", ObjNamesPtr););
+       MESSAGE(11,fprintf(fp,"\t\tGroup Attribute list: \n"););
+       MESSAGE(11,fprintf(fp,"\t\t    %s\n", ObjNamesPtr););
+       MESSAGE(8,printf("\t\tString length of Group attribute list:     %li\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tString length of Group attribute list:      %li\n",strbufsize););
+         }
+
+       free(ObjNamesPtr);
+       ObjNamesPtr = NULL;
+
+
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWattrinfo                         *
+	*********************************************************************************
+	*/
+   
+      MESSAGE(4,printf("\n"););
+      MESSAGE(4,printf("\tTesting HE5_SWattrinfo... \n"););
+      MESSAGE(4,printf("\t=========================\n"););
+   
+      MESSAGE(11,fprintf(fp,"\n"););
+      MESSAGE(11,fprintf(fp,"\tTesting HE5_SWattrinfo... \n"););
+      MESSAGE(11,fprintf(fp,"\t=========================\n"););
+   
+      CountPtr        = (hsize_t *)calloc(1, sizeof(hsize_t));
+   
+      MESSAGE(6,printf("\n"););
+      MESSAGE(6,printf("\t\tRetrieve information about attribute \"Drift\" \n"););
+      MESSAGE(11,fprintf(fp,"\n"););
+      MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attribute \"Drift\" \n"););
+   
+      status=HE5_SWattrinfo(SWid_simple,"Drift",&dtype,CountPtr);   
+      if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+      else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+   /*  MESSAGE(4,printf("\t\tData type:          %d\n", dtype););
+       MESSAGE(4,printf("\t\t Number of elements:  %d \n", (int)*CountPtr);); */
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWattrinfo(SWid_simple,\"Drift\",&dtype,CountPtr);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWattrinfo %d\n",status););
+       MESSAGE(6,printf("\t\tData type   Number of attribute elements:\n"););
+       MESSAGE(6,printf("\t\t   %d            %d\n", dtype,(int)*CountPtr););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWattrinfo(SWid_simple,\"Drift\",&dtype,CountPtr);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tStaus returned by SWattrinfo %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tData type   Number of attribute elements:\n"););
+       MESSAGE(11,fprintf(fp,"\t\t   %d            %d\n", dtype,(int)*CountPtr););
+	 }
+   
+   
+   free(CountPtr);
+      
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWcompinfo                         *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWcompinfo... \n"););
+   MESSAGE(4,printf("\t========================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWcompinfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t========================= \n"););
+   MESSAGE(6,printf("\n");); 
+   MESSAGE(6,printf("\t\tRetrieve Compression information for field \"Temperature\"\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve Compression information for field \"Temperature\"\n"););
+   
+   status = HE5_SWcompinfo(SWid_simple,"Temperature",&code,level);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {       
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+  /*   MESSAGE(4,printf("\t\t Compression scheme        Compression level\n"););
+       MESSAGE(4,printf("\t\t %d,                      %d\n", code, level[0]);); */
+
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(8,printf("\t\tCompression scheme       Compression level\n"););
+       MESSAGE(8,printf("\t\t    %d,                      %d\n", code, level[0]););
+       MESSAGE(11,fprintf(fp,"\t\tCompression scheme       Compression level\n"););
+       MESSAGE(11,fprintf(fp,"\t\t    %d,                      %d\n", code, level[0]););
+	 }
+   
+   
+   code       = - 8;
+   level[ 0 ] = - 8;
+   
+   MESSAGE(4,printf("\n"););   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(6,printf("\t\tRetrieve Compression information for field \"Conduction\"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve Compression information for field \"Conduction\"\n"););
+   
+   status = HE5_SWcompinfo(SWid_simple,"Conduction",&code,level);
+   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {       
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(8,printf("\t\tCompression scheme       Compression level\n"););
+       MESSAGE(8,printf("\t\t    %d,                      %d\n", code, level[0]););
+       MESSAGE(11,fprintf(fp,"\t\tCompression scheme       Compression level\n"););
+       MESSAGE(11,fprintf(fp,"\t\t    %d,                      %d\n", code, level[0]););
+	 }
+/*
+        *********************************************************************************
+        *                           Testing   HE5_SWchunkinfo                           *
+        *********************************************************************************
+        */
+        
+        MESSAGE(4,printf("\n"););
+        MESSAGE(4,printf("\tTesting HE5_SWchunkinfo.... \n"););
+        MESSAGE(4,printf("\t============================= \n"););
+        MESSAGE(11,fprintf(fp,"\t\n"););
+        MESSAGE(11,fprintf(fp,"\tTesting HE5_SWchunkinfo... \n"););
+        MESSAGE(11,fprintf(fp,"\t========================= \n"););
+        MESSAGE(6,printf("\n"););
+        MESSAGE(6,printf("\t\tRetrieve Chunking information for field \"Count\"\n"););
+        MESSAGE(11,fprintf(fp,"\n"););
+        MESSAGE(11,fprintf(fp,"\t\tRetrieve Compression information for field \"Count\"\n"););
+ 
+        status = HE5_SWchunkinfo(SWid_simple,"Count",&chunk_rank,chunk_dim);
+        if (status == FAIL)
+         {
+        MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+        MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+        errcnt++;
+         }
+        else
+         {
+        MESSAGE(4,printf("\n"););
+        MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+     /* MESSAGE(4,printf("\t\t Count chunk rank: %d\n", chunk_rank);); */
+
+        MESSAGE(11,fprintf(fp,"\n"););
+        MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+        MESSAGE(8,printf("\t\t Count chunk rank: %d\n", chunk_rank););
+        MESSAGE(11,fprintf(fp,"\t\t Count chunk rank: %d\n", chunk_rank ););
+
+        } 
+
+        /*
+        *********************************************************************************
+        *                             Testing    HE5_SWgrpattrinfo                         *
+        *********************************************************************************
+        */
+  
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWgrpattrinfo... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+  
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWgrpattrinfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+  
+   CountPtr        = (hsize_t *)calloc(1, sizeof(hsize_t));
+  
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about attribute \"GroupAttribute\" \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attribute \"GroupAttribute\" \n"););
+  
+   status=HE5_SWgrpattrinfo(SWid_simple,"GroupAttribute",&dtype,CountPtr);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+   {  
+       MESSAGE(4,printf("\n"););  
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+  /*   MESSAGE(4,printf("\t\tData type:          %d\n", dtype););
+       MESSAGE(4,printf("\t\t Number of elements: %d \n", (int)*CountPtr);); */
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWgrpattrinfo(SWid_simple,\"GroupAttribute\",&dtype,CountPtr);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWgrpattrinfo %d\n",status););
+       MESSAGE(6,printf("\t\tData type   Number of attribute elements:\n"););
+       MESSAGE(6,printf("\t\t   %d            %d\n", dtype,(int)*CountPtr););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWgrpattrinfo(SWid_simple,\"GroupAttribute\",&dtype,CountPtr);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tStaus returned by SWgrpattrinfo %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tData type   Number of attribute elements:\n"););
+       MESSAGE(11,fprintf(fp,"\t\t   %d            %d\n", dtype,(int)*CountPtr););
+         }
+  
+
+   free(CountPtr);
+    
+
+    /*
+        ********************************************************************************
+        *                             Testing    HE5_SWgeogrpattrinfo                  *
+        ********************************************************************************
+        */
+ 
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWgeogrpattrinfo... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+ 
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWgeogrpattrinfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+ 
+   CountPtr        = (hsize_t *)calloc(1, sizeof(hsize_t));
+ 
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about attribute \"ScalarFloat\" \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attribute \"ScalarFloat\" \n"););
+ 
+   status=HE5_SWgeogrpattrinfo(SWid_simple,"ScalarFloat",&dtype,CountPtr);
+   if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+   { 
+       MESSAGE(4,printf("\n");); 
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+  /*   MESSAGE(4,printf("\t\tData type:          %d\n", dtype););
+       MESSAGE(4,printf("\t\t Number of elements: %d \n", (int)*CountPtr);); */
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWgeogrpattrinfo(SWid_simple,\"ScalarFloat\",&dtype,CountPtr);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWgeogrpattrinfo %d\n",status););
+       MESSAGE(6,printf("\t\tData type   Number of attribute elements:\n"););
+       MESSAGE(6,printf("\t\t   %d            %d\n", dtype,(int)*CountPtr););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWgeogrpattrinfo(SWid_simple,\"ScalarFloat\",&dtype,CountPtr);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tStaus returned by SWgeogrpattrinfo %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tData type   Number of attribute elements:\n"););
+       MESSAGE(11,fprintf(fp,"\t\t   %d            %d\n", dtype,(int)*CountPtr););
+         }
+ 
+
+   free(CountPtr);
+
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWgetfillvalue                     *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););    
+   MESSAGE(4,printf("\tTesting HE5_SWgetfillvalue... \n"););
+   MESSAGE(4,printf("\t============================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWgetfillvalue... \n"););
+   MESSAGE(11,fprintf(fp,"\t============================= \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tGet fill value for field \"Temperature\"\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tGet fill value for field \"Temperature\"\n"););
+   status = HE5_SWgetfillvalue(SWid_simple,"Temperature",&InqDoubleFillValue);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWgetfillvalue(SWid_simple,\"Temperature\",&InqDoubleFillValue);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWgetfillvalue %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWgetfillvalue(SWid_simple,\"Temperature\", &InqDoubleFillValue)\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWgetfillvalue %d\n",status););
+       MESSAGE(8,printf("\t\tFill value for field \"Temperature\":\n"););
+       MESSAGE(8,printf("\n"););
+       MESSAGE(8,printf("\t\t     \"%lf\" \n", InqDoubleFillValue););
+       MESSAGE(11,fprintf(fp,"\t\tFill value for field \"Temperature\":\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t      \"%lf\" \n",InqDoubleFillValue););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWdetach                           *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdetach... \n"););
+   MESSAGE(4,printf("\t======================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdetach... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDetaching from swath SIMPLE \n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from swath SIMPLE \n"););
+   
+
+   status = HE5_SWdetach(SWid_simple);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdetach(SWid_simple);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWdetach()   %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdetach(SWid_simple);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWdetach()    %d\n",status););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWattach                           *
+	*********************************************************************************
+	*/
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWattach... \n"););
+   MESSAGE(4,printf("\t=======================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWattach... \n"););
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+  
+   SWid_simple = HE5_SWattach(swfidc_simple,"SIMPLE");
+   if (SWid_simple == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully attached to the swath SIMPLE ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully attached to the swath SIMPLE ****\n"););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                  Testing  Appending data to the field                         *
+	*********************************************************************************
+	*/
+   
+   tstart[0] = 30; tedge[0] = 10;
+   
+   MESSAGE(6,printf("\n"););  
+   MESSAGE(6,printf("\t\tWriting extended data to the field Count in swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting extended data to the field Count in swath SIMPLE \n"););
+   
+   status = HE5_SWwritefield(SWid_simple, "Count", tstart, NULL, tedge, inarray);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_simple, \"Count\",tstart, NULL, tedge, inarray);\n"););
+       MESSAGE(8,printf("\t\tValue returned by SWwritefield for field Count in swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Count\", tstart, stride, NULL, inarray);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by SWwritefield for field Conduction in swath SIMPLE %d\n",status););
+	 }
+   
+  
+
+ 
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWdeftimeperiod                    *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdeftimeperiod... \n"););
+   MESSAGE(4,printf("\t============================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdeftimeperiod... \n"););
+   MESSAGE(11,fprintf(fp,"\t============================== \n"););
+   
+   StartTime = 55000000.;  
+   StopTime  = 65000000.;
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDefining time period for extraction\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining time period for extraction\n"););
+   
+   PeriodID = HE5_SWdeftimeperiod(SWid_simple,StartTime,StopTime,HE5_HDFE_MIDPOINT);   
+   if (PeriodID == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););                 
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tPeriodID=HE5_SWdeftimeperiod(SWid_simple,StartTime,StopTime,HE5_HDFE_MIDPOINT);\n");); 
+       MESSAGE(8,printf("\t\tPeriod ID returned by SWdeftimeperiod()    %d\n",PeriodID););
+       MESSAGE(11,fprintf(fp,"\t\tPeriodID=HE5_SWdeftimeperiod(SWid_simple,StartTime,StopTime,HE5_HDFE_MIDPOINT);\n"););     
+       MESSAGE(11,fprintf(fp,"\t\tPeriod ID returned by SWdeftimeperiod()     %d\n",PeriodID););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWperiodinfo                       *
+	*********************************************************************************
+	*/
+   
+   RankPtr         = (int *)calloc(1, sizeof(int));
+   size            = (size_t *)calloc(1, sizeof(size_t));
+      
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWperiodinfo... \n"););
+   MESSAGE(4,printf("\t=========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWperiodinfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about the subsetted period\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about the subsetted period\n"););
+   
+   status = HE5_SWperiodinfo(SWid_simple,PeriodID,"Time",&dtype1,RankPtr,dims,size);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); 
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWperiodinfo(SWid_simple,PeriodID,\"Time\",&dtype1,RankPtr,dims,size);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWperiodinfo %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWperiodinfo(SWid_simple,PeriodID,\"Time\",&dtype1,RankPtr,dims,size);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWperiodinfo %d\n",status););
+       MESSAGE(6,printf("\t\tData type       Rank \n"););
+       MESSAGE(6,printf("\t\t   %d            %d \n", dtype1,*RankPtr););
+       MESSAGE(11,fprintf(fp,"\t\tData type     Rank \n"););
+       MESSAGE(11,fprintf(fp,"\t\t   %d          %d \n",dtype1,*RankPtr););
+       MESSAGE(6,printf("\t\tSize of subset period:      %lu (bytes)\n",(unsigned long)*size););
+       MESSAGE(11,fprintf(fp,"\t\tSize of subset period:     %lu (bytes)\n",(unsigned long)*size););
+       MESSAGE(6,printf("\t\tDimensions of subset period:\n"););
+       MESSAGE(11,fprintf(fp,"\t\tDimensions of subset period:\n"););
+
+	   for (i = 0; i < *RankPtr; i++)
+		 {
+		   MESSAGE(6,printf("\t\t     %d\n",(int)dims[i]););
+		   MESSAGE(11,fprintf(fp,"\t\t    %d\n",(int)dims[i]););
+		 }
+	 }
+      
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWextractperiod                    *
+	*********************************************************************************
+	*/
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWextractperiod... \n"););
+   MESSAGE(4,printf("\t============================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWextractperiod... \n"););
+   MESSAGE(11,fprintf(fp,"\t============================== \n"););
+   
+   
+   BufferPtr = ( double *)malloc( *size );
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRead data from the subsetted time period\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRead data from the subsetted time period\n"););
+   
+   status = HE5_SWextractperiod(SWid_simple,PeriodID,"Time",HE5_HDFE_INTERNAL,BufferPtr);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWextractperiod(SWid_simple,PeriodID,\"Time\",HE5_HDFE_INTERNAL,BufferPtr);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWextractperiod %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWextractperiod(SWid_simple,PeriodID,\"Time\",HE5_HDFE_INTERNAL,BufferPtr);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWextractperiod %d\n", status););
+       MESSAGE(8,printf("\t\n"););
+       MESSAGE(8,printf("\t\tThe extracted values of \"Time\" field are: \n"););
+       MESSAGE(11,fprintf(fp,"\t\n"););
+       MESSAGE(11,fprintf(fp,"\t\tThe extracted values of \"Time\" field are: \n"););
+
+       for( i = 0; i < ( *size / sizeof(double) ); i++ )
+		 { 
+           MESSAGE(8,printf("\t\t\t        %lf\n", BufferPtr[i]););
+           MESSAGE(11,fprintf(fp,"\t\t\t      %lf\n", BufferPtr[i]););
+		 }
+	 }
+   
+   free(RankPtr);
+   free(BufferPtr);
+   RankPtr   = NULL;
+   BufferPtr = NULL;
+   free(size);
+   
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWattach                           *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWattach... \n"););
+   MESSAGE(4,printf("\t=======================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWattach... \n"););
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+  
+   SWid_index = HE5_SWattach(swfidc_simple,"INDEX");
+   if (SWid_index == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully attached to the swath INDEX ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully attached to the swath INDEX ****\n"););
+	 }
+   
+   /*
+        *********************************************************************************
+        *                             Testing    HE5_SWlocattrinfo                      *
+        *********************************************************************************
+        */
+        MESSAGE(4,printf("\n"););
+        MESSAGE(4,printf("\tTesting HE5_SWlocattrinfo... \n"););
+        MESSAGE(4,printf("\t=========================\n"););
+
+        MESSAGE(11,fprintf(fp,"\n"););
+        MESSAGE(11,fprintf(fp,"\tTesting HE5_SWlocattrinfo... \n"););
+        MESSAGE(11,fprintf(fp,"\t=========================\n"););
+
+        CountPtr        = (hsize_t *)calloc(1, sizeof(hsize_t));
+
+        MESSAGE(6,printf("\n"););
+        MESSAGE(6,printf("\t\tRetrieve information about attribute \"LocalAttribute\" \n"););
+        MESSAGE(11,fprintf(fp,"\n"););
+        MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attribute \"LocalAttribute\" \n"););
+
+        status=HE5_SWlocattrinfo(SWid_simple,"Count", "LocalAttribute",&dtype,CountPtr);
+        if (status == FAIL)
+         {
+        MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+        MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+        errcnt++;
+         }
+   else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWlocattrinfo(SWid_Simple, \"Count\", \"LocalAttribute\", &dtype,CountPtr);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by GDlocattrinfo %d\n",status););
+       MESSAGE(6,printf("\t\tData type   Number of attribute elements:\n"););
+       MESSAGE(6,printf("\t\t   %d            %d\n", dtype,(int)*CountPtr););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWlocattrinfo(SWid_simple, \"Count\", \"LocalAttribute\",&dtype,CountPtr);\n"););
+
+       MESSAGE(11,fprintf(fp,"\t\tStatus returned by SWlocattrinfo %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tData type   Number of attribute elements:\n"););
+       MESSAGE(11,fprintf(fp,"\t\t   %d            %d\n", dtype,(int)*CountPtr););
+         }
+
+
+   free(CountPtr);
+
+
+ 
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_SWnentries                          *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWnentries... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWnentries... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+   
+   /*                 
+	  -- R e t r i e v e   t h e   I n d e x   d i m e n s i o n   m a p p i n g s   --
+	*/   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about index dimension mapping in swath INDEX\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"); );
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about index dimension mapping in swath INDEX\n"); );
+   
+   number = HE5_SWnentries(SWid_index,2,&strbufsize);
+   if ( number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););                 
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWnentries(SWid_index,2,&strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWnentries(SWid_index,2,&strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of index mappings:   %li\n",number););
+       MESSAGE(8,printf("\t\tNumber of index mappings:   %li\n",number););
+       MESSAGE(8,printf("\t\tString length of mapping list:   %li\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tString length of mapping list:   %li\n",strbufsize););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_SWinqidxmaps...                     *
+	*********************************************************************************
+	*/
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWinqidxmaps... \n"););
+   MESSAGE(4,printf("\t===========================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqidxmaps... \n"););
+   MESSAGE(11,fprintf(fp,"\t===========================\n"););
+   
+   SizePtr         = (hsize_t *)calloc(number, sizeof(hsize_t));   
+   DimMapListPtr   = (char *)calloc( BUFSIZE, sizeof(char));
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve indexed mapping relations for swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve indexed mapping relations for swath INDEX \n"););
+   number = HE5_SWinqidxmaps(SWid_index,DimMapListPtr,SizePtr);   
+   if (number  == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););                 
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWinqidxmaps(SWid_index,DimMapListPtr,SizePtr);\n"););
+       MESSAGE(8,printf("\t\tNumber of maps:  %li\n", number););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqidxmaps(SWid_index,DimMapListPtr,SizePtr);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of maps:   %li\n",number););
+       MESSAGE(6,printf("\t\tIndexed mapping list: \n"););
+       MESSAGE(6,printf("\t\t  %s\n",DimMapListPtr););
+       MESSAGE(11,fprintf(fp,"\t\tIndexed mapping list: \n"););
+       MESSAGE(11,fprintf(fp,"\t\t   %s\n",DimMapListPtr););
+	 }
+   
+   free(SizePtr);
+   free(DimMapListPtr);
+
+   /*
+        *********************************************************************************
+        *                             Testing    HE5_SWinqlocattrs                      *
+        *********************************************************************************
+        */
+        MESSAGE(4,printf("\n"););
+        MESSAGE(4,printf("\tTesting HE5_SWinqlocattrs... \n"););
+        MESSAGE(4,printf("\t========================= \n"););
+
+        MESSAGE(11,fprintf(fp,"\t\n"););
+        MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqlocattrs... \n"););
+        MESSAGE(11,fprintf(fp,"\t========================= \n"););
+
+        MESSAGE(6,printf("\n"););
+        MESSAGE(6,printf("\t\tRetrieve information about attributes defined in Count field \n"););
+        MESSAGE(11,fprintf(fp,"\n"););
+        MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attributes defined in Count \n"););
+
+        number = HE5_SWinqlocattrs(SWid_simple, "Count", NULL, &strbufsize);
+        if (number == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+   else
+        {
+        MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWinqlocattrs(SWid_simple, \"Count\", NULL, &strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqlocattrs(SWid_simple, \"Count\", NULL, &strbufsize);\n"););
+       MESSAGE(8,printf("\t\tValue (number of attributes) returned by SWinqlocattrs %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tValue (number of attributes) returned by SWinqlocattrs %li\n",number););
+       MESSAGE(8,printf("\t\tString length of attribute list:     %li\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tString length of attribute list:    %li\n",strbufsize););
+        }
+
+       MESSAGE(6,printf("\n"););
+       MESSAGE(6,printf("\t\tRetrieve more information about attributes defined in Count field \n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\tRetrieve more information about attributes defined in Count field \n"););
+
+       ObjNamesPtr     = (char  *)calloc( BUFSIZE, sizeof(char));
+       number = HE5_SWinqlocattrs(SWid_simple, "Count", ObjNamesPtr, &strbufsize);
+       if (number == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+      else
+         {
+       MESSAGE(4,printf("\n"););
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_SWinqlocattrs(SWid_simple, Count, ObjNamesPtr, &strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqlocattrs(SWid_simple, Count, ObjNamesPtr,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tNumber of attributes returned by SWinqlocattrs   %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of attributes returned by SWinqlocattr   %li\n",number););
+       MESSAGE(8,printf("\t\tAttribute list:\n"););
+       MESSAGE(8,printf("\t\t    %s\n", ObjNamesPtr););
+       MESSAGE(11,fprintf(fp,"\t\tAttribute list: \n"););
+       MESSAGE(11,fprintf(fp,"\t\t    %s\n", ObjNamesPtr););
+       MESSAGE(8,printf("\t\tString length of attribute list:     %li\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tString length of attribute list:      %li\n",strbufsize););
+         }
+ 
+   free(ObjNamesPtr);
+   ObjNamesPtr = NULL;
+
+   
+   /*
+	*********************************************************************************
+	*                             Testing   HE5_SWdiminfo...                        *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdiminfo... \n"););
+   MESSAGE(4,printf("\t======================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdiminfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve size of dimension \"GeoDim\" in swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve size of dimension \"GeoDim\" in swath INDEX \n"););
+   
+   ndims = HE5_SWdiminfo(SWid_index,"GeoDim");   
+   if ( ndims == 0)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tndims=HE5_SWdiminfo(SWid_index,\"GeoDim\");\n"););
+       MESSAGE(8,printf("\t\tSize of dimension \"GeoDim\":     %lu \n",(unsigned long)ndims););
+       MESSAGE(11,fprintf(fp,"\t\tndims=HE5_SWdiminfo(SWid_index,\"GeoDim\");\n"););
+       MESSAGE(11,fprintf(fp,"\t\tSize of dimension \"GeoDim\":       %lu\n",(unsigned long)ndims););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWidxmapinfo                       *
+	*********************************************************************************
+	*/
+
+
+   OffsetPtr = (long  *)calloc(100, sizeof(long));
+
+   MESSAGE(4,printf("\n"););   
+   MESSAGE(4,printf("\tTesting HE5_SWidxmapinfo... \n"););
+   MESSAGE(4,printf("\t=========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWidxmapinfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================== \n");); 
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve indexed array of \"GeoDim/TrackDim\"  mapping\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve indexed array of \"GeoDim/TrackDim\"  mapping\n"););
+   nmaps = HE5_SWidxmapinfo(SWid_index,"GeoDim","TrackDim",OffsetPtr);   
+   if (nmaps == 0)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnmaps=HE5_SWidxmapinfo(SWid_index,\"GeoDim\",\"TrackDim\",OffsetPtr);\n"););
+       MESSAGE(8,printf("\t\tSize of indexed array:   %lu \n",(unsigned long)nmaps););
+       MESSAGE(11,fprintf(fp,"\t\tnmaps=HE5_SWidxmapinfo(SWid_index,\"GeoDim\",\"TrackDim\",OffsetPtr);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tSize of indexed array:   %lu \n",(unsigned long)nmaps););
+       MESSAGE(8,printf("\t\tEntry #          Mapping offset\n"););   
+       MESSAGE(11,fprintf(fp,"\t\tEntry #          Mapping offset\n"););   
+       for ( i = 0; i < nmaps; i++) 
+		 {
+		   MESSAGE(8,printf("\t\t  %d        %li \n", i+1, OffsetPtr[i]););   
+		   MESSAGE(11,fprintf(fp,"\t\t  %d        %li \n", i+1, OffsetPtr[i]););   
+		 }       
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve indexed array of \"GeoDim/XtrackDim\"  mapping\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve indexed array of \"GeoDim/XtrackDim\"  mapping\n"););
+   
+   nmaps = HE5_SWidxmapinfo(SWid_index,"GeoXDim","XtrackDim",OffsetPtr);   
+   if (nmaps == 0)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnmaps=HE5_SWidxmapinfo(SWid_index,\"GeoXDim\",\"XtrackDim\",OffsetPtr);\n"););
+       MESSAGE(8,printf("\t\tSize of indexed array:    %lu \n",(unsigned long)nmaps););
+       MESSAGE(11,fprintf(fp,"\t\tnmaps=HE5_SWidxmapinfo(SWid_index,\"GeoXDim\",\"XtrackDim\",OffsetPtr);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tSize of indexed array:   %lu\n",(unsigned long)nmaps););
+       MESSAGE(8,printf("\t\tEntry #          Mapping offset\n"););   
+       MESSAGE(11,fprintf(fp,"\t\tEntry #          Mapping offset\n"););   
+       for ( i = 0; i < nmaps; i++) 
+		 {
+		   MESSAGE(8,printf("\t\t  %d                     %li \n", i+1, OffsetPtr[i]););   
+		   MESSAGE(11,fprintf(fp,"\t\t  %d                     %li \n", i+1, OffsetPtr[i]););   
+		 }
+	 }
+   
+  
+
+   /*
+        *********************************************************************************
+        *                             Testing    HE5_SWindexinfo                       *
+        *********************************************************************************
+        */
+
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWindexinfo... \n"););
+   MESSAGE(4,printf("\t=========================== \n"););
+  
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWindexinfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+  
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve indices information about \"Longitude\" field\n"););
+  
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve indicesinformation about \"Longitude\"  field\n"););
+        dimlist = (char  *)calloc( BUFSIZE, sizeof(char));
+         for ( i = 0; i < 8; i++)
+                  {
+                      indices[i] = (hsize_t *) malloc(2*sizeof(hsize_t));
+                  }
+
+        status = HE5_SWindexinfo(RegionID, "Longitude", &rank3, dimlist, indices);
+     if (status == FAIL)
+         {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+         }
+else
+         { 
+       MESSAGE(4,printf("\t\t********Passed Test**********\n");); 
+       MESSAGE(4,printf("\n");); 
+   /*    MESSAGE(4,printf("rank = %d\n", rank););
+       MESSAGE(4,printf("dimlist = %s\n", dimlist););
+       for ( i = 0; i < rank; i++)
+                  {
+                      for ( j = 0; j < 2; j++)
+                      {
+                        MESSAGE(4,printf("i = %d, j = %d, indices[i][j] = %lu\n", i, j, (unsigned long)indices[i][j]););
+                      }
+                  } */
+        MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWindexinfo(RegionID, \"Longitude\", &rank3, dimlist, indices);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWindexinfo  %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWindexinfo(RegionID, \"Longitude\", &rank3, dimlist, indices);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWindexinfo  %d\n",status););
+       MESSAGE(8,printf("rank = %d\n", rank););
+       MESSAGE(8,printf("dimlist = %s\n", dimlist););
+       MESSAGE(11,fprintf(fp,"\t\tRank: %d\n", rank););
+       MESSAGE(11,fprintf(fp,"\t\tDimension list:          %s\n",dimlist););
+       for ( i = 0; i < rank; i++)
+                  {
+                      for ( j = 0; j < 2; j++)
+                      {
+                        MESSAGE(8,printf("i = %d, j = %d, indices[i][j] = %lu\n", i, j, (unsigned long)indices[i][j]););
+                        MESSAGE(11,fprintf(fp,"\t\ti = %d, j = %d, indices[i][j] = %lu\n", i, j, (unsigned long)indices[i][j]););
+                      }
+                 }
+        }
+        
+        free(dimlist);
+        dimlist = NULL;
+        for (i = 0; i < 8; i++)
+                 {
+                   free(indices[i]);
+                   indices[i] = NULL;
+                 } 
+
+ 
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWdetach                           *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdetach... \n"););
+   MESSAGE(4,printf("\t======================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdetach... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDetaching from swath SIMPLE \n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from swath SIMPLE \n"););
+
+   status = HE5_SWdetach(SWid_simple);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdetach(SWid_simple);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWdetach for swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdetach(SWid_simple);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWdetach for swath SIMPLE %d\n",status););
+	 }
+   
+   /*
+	*********************************************************************************
+	*                  Testing REGION SUBSETTING for swath INDEX                    *
+	*********************************************************************************
+	*/
+   
+   
+   CornerLon[ 0 ] = 79.7e0;
+   CornerLat[ 0 ] = 59.5e0;
+   CornerLon[ 1 ] = 80.e0;
+   CornerLat[ 1 ] = 60.e0;
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdefboxregion... \n"););
+   MESSAGE(4,printf("\t============================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefboxregion... \n"););
+   MESSAGE(11,fprintf(fp,"\t============================= \n"););
+   
+   MESSAGE(6,printf("\n");); 
+   MESSAGE(6,printf("\t\tDefining region to extract\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining region to extract\n"););
+   
+   
+   RegionID = HE5_SWdefboxregion(SWid_index,CornerLon,CornerLat,HE5_HDFE_MIDPOINT);
+   if (RegionID == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+	   errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\n"););
+	   MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	   MESSAGE(10,printf("\t\tRegionID=HE5_SWdefboxregion(SWid_index,CornerLon,CornerLat,mode);\n"););
+	   MESSAGE(8,printf("\t\tRegion ID returned by SWdefboxregion %d\n",RegionID););
+	   MESSAGE(11,fprintf(fp,"\t\tRegionID=HE5_SWdefboxregion(SWid_index,CornerLon,CornerLat,mode);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tRegion ID returned by SWdefboxregion %d\n",RegionID););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*               Testing  HE5_SWregioninfo  for swath  INDEX                     *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWregioninfo... \n"););
+   MESSAGE(4,printf("\t=========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWregioninfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+   
+   size     = (size_t *)calloc(1, sizeof(size_t));
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieving information about defined region\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieving information about defined region\n"););
+   status = HE5_SWregioninfo(SWid_index,RegionID,"Indexed_Data",&dtype1,&rank2,dims,size);
+   if (status == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+	   errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\n"););
+	   MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	   MESSAGE(10,printf("\t\tstatus=HE5_SWregioninfo(SWid_index,RegionID,\"Indexed_Data\",&dtype1,RankPtr,dims,size);\n"););
+	   MESSAGE(8,printf("\t\tstatus returned by SWregioninfo %d\n",status););
+	   MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWregioninfo(SWid_index,RegionID,\"Indexed_Data\",&dtype1,RankPtr,dims,size);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWregioninfo %d\n",status););
+	   MESSAGE(6,printf("\t\tData type:     Rank:\n"););
+	   MESSAGE(6,printf("\t\t    %d          %d\n",dtype1, rank2););
+	   MESSAGE(11,fprintf(fp,"\t\tData type:     Rank:\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t    %d          %d\n",dtype1, rank2););
+	   MESSAGE(6,printf("\t\tSize of region:   %lu (bytes)\n",(unsigned long)*size););
+	   MESSAGE(11,fprintf(fp,"\t\tSize of region:     %lu (bytes)\n",(unsigned long)*size););
+	   MESSAGE(6,printf("\t\tDimensions of subset region:\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tDimensions of subset region:\n"););
+	   for (i = 0; i < rank2; i++)
+		 {
+		   MESSAGE(6,printf("\t\t      %d\n",(int)dims[i]););
+		   MESSAGE(11,fprintf(fp,"\t\t      %d\n",(int)dims[i]););
+		 }
+      
+	 }
+   
+   /*
+	*********************************************************************************
+	*                    Testing  HE5_SWextractregion  for  swath INDEX             *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWextractregion... \n"););
+   MESSAGE(4,printf("\t============================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWextractregion... \n"););
+   MESSAGE(11,fprintf(fp,"\t============================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tExtracting data from subset region\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tExtracting data from subset region\n"););
+ 
+   BufferFloatPtr = (float *)malloc( *size );
+   
+   status = HE5_SWextractregion(SWid_index,RegionID,"Indexed_Data",HE5_HDFE_INTERNAL,BufferFloatPtr);
+   if (status == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+	   errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\n"););
+	   MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	   MESSAGE(10,printf("\t\tstatus=HE5_SWextractregion(SWid_index,RegionID,\"Indexed_Data\",HE5_HDFE_INTERNAL,BufferFloatPtr);\n"););
+	   MESSAGE(8,printf("\t\tstatus returned by SWextractregion %d\n",status););
+	   MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWextractregion(SWid_simple,OldRegionID,\"Indexed_Data\",HE5_HDFE_INTERNAL,BufferFloatPtr);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWextractregion %d\n",status););
+
+	   MESSAGE(10,printf("\t\t Extracted first 5 values:\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t Extracted first 5 values:\n"););
+   
+	   for (i = 0; i < 5; i++) 
+		 {
+		   MESSAGE(10,printf("\t\t\t          %f\n", BufferFloatPtr[i]););
+		   MESSAGE(11,fprintf(fp,"\t\t\t         %f\n", BufferFloatPtr[i]););
+		 }
+
+	 }   
+   
+   free(BufferFloatPtr);
+   free(size);
+   
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWupdateidxmap                     *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\n"););  
+   MESSAGE(4,printf("\tTesting HE5_SWupdateidxmap... \n"););
+   MESSAGE(4,printf("\t============================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWupdateidxmap... \n"););
+   MESSAGE(11,fprintf(fp,"\t============================= \n");); 
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieving indexed array for a specified region\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieving indexed array for a specified region\n"););
+   
+   IdxMapSize = HE5_SWupdateidxmap(SWid_index,RegionID,OffsetPtr,NULL,Indices);
+   if (IdxMapSize == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tIdxMapSize=HE5_SWupdateidxmap(SWid_index,RegionID,OffsetPtr,NULL,Indices);\n"););
+       MESSAGE(8,printf("\t\tSize of updated indexed array:     %li\n",IdxMapSize););
+       MESSAGE(11,fprintf(fp,"\t\tIdxMapSize=HE5_SWupdateidxmap(SWid_index,RegionID,OffsetPtr,NULL,Indices);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tSize of updated indexed array:      %li\n",IdxMapSize););
+       
+	 }
+   
+   UpdateIdx_1 = (long *)calloc(IdxMapSize, sizeof(long));
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tContinue ...\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tContinue ...\n"););
+
+   IdxMapSize = HE5_SWupdateidxmap(SWid_index,RegionID,OffsetPtr,UpdateIdx_1,Indices);   
+   if (IdxMapSize == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););       
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tIdxMapSize=HE5_SWupdateidxmap(SWid_index,RegionID,OffsetPtr,UpdateIdx_1,Indices);\n"););
+       MESSAGE(8,printf("\t\tSize of updated indexed array:     %li\n",IdxMapSize););
+       MESSAGE(11,fprintf(fp,"\t\tIdxMapSize=HE5_SWupdateidxmap(SWid_index,RegionID,OffsetPtr,UpdateIdx_1,Indices);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tSize of updated indexed array:     %li\n",IdxMapSize););
+       MESSAGE(8,printf("\t\tArray of indices of the data dimension to which each geolocation corresponds:\n"););
+       MESSAGE(11,fprintf(fp,"\t\tArray of indices of the data dimension to which each geolocation corresponds:\n"););
+	   for (i = 0; i < IdxMapSize; i++)
+		 {
+           MESSAGE(8,printf("\t\t    %li\n", OffsetPtr[i]););
+           MESSAGE(11,fprintf(fp,"\t\t    %li\n", OffsetPtr[i]););
+		 }
+
+       MESSAGE(8,printf("\t\t Array of indices of the data dimension to which each geolocation corresponds: \n"););
+       MESSAGE(11,fprintf(fp,"\t\t Array of indices of the data dimension to which each geolocation corresponds: \n"););
+	   for (i = 0; i < IdxMapSize; i++)
+		 {
+           MESSAGE(8,printf("\t\t    %li \n", UpdateIdx_1[i]););
+           MESSAGE(11,fprintf(fp,"\t\t    %li \n", UpdateIdx_1[i]););
+		 }
+	 }
+
+   free(OffsetPtr);
+
+   free(UpdateIdx_1);
+
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWdetach                           *
+	*********************************************************************************
+	*/
+
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdetach... \n"););
+   MESSAGE(4,printf("\t======================= \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdetach... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDetaching from swath INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from swath INDEX \n"););
+
+   status = HE5_SWdetach(SWid_index);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdetach(SWid_index);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWdetach for swath INDEX %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdetach(SWid_index);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWdetach for swath INDEX %d\n",status););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWattach                           *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWattach... \n"););
+   MESSAGE(4,printf("\t=======================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWattach... \n"););
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+   
+   SWid_simple = HE5_SWattach(swfidc_simple,"SIMPLE");
+   if (SWid_simple == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully attached to the swath SIMPLE ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully attached to the swath SIMPLE ****\n"););
+       
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                  Testing REGION SUBSETTING for swath SIMPLE                   *
+	*********************************************************************************
+	*/
+   
+   
+   CornerLon[ 0 ] = 100.e0;
+   CornerLat[ 0 ] = 20.e0;
+   CornerLon[ 1 ] = 106.e0;
+   CornerLat[ 1 ] = 24.e0;
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdefboxregion... \n"););
+   MESSAGE(4,printf("\t============================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefboxregion... \n"););
+   MESSAGE(11,fprintf(fp,"\t============================= \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDefining region to extract\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining region to extract\n"););
+   
+   
+   OldRegionID = HE5_SWdefboxregion(SWid_simple,CornerLon,CornerLat,HE5_HDFE_MIDPOINT);
+   if (OldRegionID == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+	   errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\n"););
+	   MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	   MESSAGE(10,printf("\t\tOldRegionID=HE5_SWdefboxregion(SWid_simple,CornerLon,CornerLat,mode);\n"););
+	   MESSAGE(8,printf("\t\tRegion ID returned by SWdefboxregion() %d\n",OldRegionID););
+	   MESSAGE(11,fprintf(fp,"\t\tOldRegionID=HE5_SWdefboxregion(SWid_simple,CornerLon,CornerLat,mode);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tRegion ID returned by SWdefboxregion() %d\n",OldRegionID););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                Testing  HE5_SWregioninfo  for  swath  SIMPLE                  *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWregioninfo... \n"););
+   MESSAGE(4,printf("\t=========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWregioninfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================== \n"););
+   
+   RankPtr   = (int *)calloc(1, sizeof(int));
+   size      = (size_t *)calloc(1, sizeof(size_t));
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieving information about defined region\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieving information about defined region\n"););
+   status = HE5_SWregioninfo(SWid_simple,OldRegionID,"Temperature",&dtype1,RankPtr,dims,size);
+   if (status == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+	   errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\n"););
+	   MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	   MESSAGE(10,printf("\t\tstatus=HE5_SWregioninfo(SWid_simple,OldRegionID,\"Temperature\", &dtype1, RankPtr,dims,size);\n"););
+	   MESSAGE(8,printf("\t\tstatus returned by SWregioninfo %d\n",status););
+	   MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWregioninfo(SWid_simple,OldRegionID,\"Temperature\", &dtype1,RankPtr,dims,size);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWregioninfo %d\n",status););
+	   MESSAGE(6,printf("\t\tData type      Rank\n"););
+	   MESSAGE(6,printf("\t\t   %d           %d \n", dtype1, *RankPtr););
+	   MESSAGE(6,printf("\t\tSize of region:   %lu (bytes)\n", (unsigned long)*size););
+	   MESSAGE(11,fprintf(fp,"\t\tSize of region:     %lu (bytes)\n", (unsigned long)*size););
+	   MESSAGE(6,printf("\t\tDimensions of subset region:\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tDimensions of subset region:\n"););
+	   for (i = 0; i < *RankPtr; i++)
+		 {
+		   MESSAGE(6,printf("\t\t      %d\n",(int)dims[i]););
+		   MESSAGE(11,fprintf(fp,"\t\t      %d\n",(int)dims[i]););
+		 }
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                    Testing  HE5_SWextractregion  for  swath SIMPLE            *
+	*********************************************************************************
+	*/
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWextractregion... \n"););
+   MESSAGE(4,printf("\t============================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWextractregion... \n"););
+   MESSAGE(11,fprintf(fp,"\t============================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tExtracting data from subset region\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tExtracting data from subset region\n"););
+   
+   BufferPtr = (double *)malloc( *size );
+   
+   status = HE5_SWextractregion(SWid_simple,OldRegionID,"Temperature",HE5_HDFE_INTERNAL,BufferPtr);
+   if (status == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+	   errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\n"););
+	   MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	   MESSAGE(10,printf("\t\tstatus=HE5_SWextractregion(SWid_simple,OldRegionID,\"Temperature\",HE5_HDFE_INTERNAL,BufferPtr);\n"););
+	   MESSAGE(8,printf("\t\tstatus returned by SWextractregion() %d\n",status););
+	   MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWextractregion(SWid_simple,OldRegionID,\"Temperature\",HE5_HDFE_INTERNAL,BufferPtr);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWextractregion() %d\n",status););
+	
+	   MESSAGE(10,printf("\t\t Extracted values:\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t Extracted values:\n"););
+   
+	   for (i = 0; i < *size/ sizeof(double); i++) 
+		 {
+		   MESSAGE(10,printf("\t\t\t          %lf\n", BufferPtr[i]););
+		   MESSAGE(11,fprintf(fp,"\t\t\t         %lf\n", BufferPtr[i]););
+		 }
+  
+	 }
+   free(RankPtr);
+   free(BufferPtr);
+   free(size);
+   
+   
+   RankPtr   = NULL;
+   BufferPtr = NULL;
+   
+   /*
+	*********************************************************************************
+	*               Testing HE5_SWdupregion  for swath  SIMPLE                      *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdupregion... \n"););
+   MESSAGE(4,printf("\t========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdupregion... \n"););
+   MESSAGE(11,fprintf(fp,"\t========================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDuplicate region id %d\n", OldRegionID););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDuplicate region id %d\n", OldRegionID););
+   RegionID = HE5_SWdupregion(OldRegionID);
+   if (RegionID == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+	   errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\n"););
+	   MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+	   MESSAGE(10,printf("\t\tRegionID = HE5_SWdupregion(OldRegionID);\n"););
+	   MESSAGE(8,printf("\t\tRegion ID returned from call to SWdupregion %d\n",RegionID););
+	   MESSAGE(11,fprintf(fp,"\t\tRegionID = HE5_SWdupregion(OldRegionID);\n"););
+	   MESSAGE(11,fprintf(fp,"\t\tRegion ID returned from call to SWdupregion %d\n",RegionID););
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWfieldinfo                        *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWfieldinfo... \n"););
+   MESSAGE(4,printf("\t========================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););   
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWfieldinfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t========================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about field \"Count\" in swath SIMPLE e\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about field \"Count\" in swath SIMPLE \n"););
+   
+   status = HE5_SWfieldinfo(SWid_simple,"Count",&rank,dims, &dtype1,NULL,DimList);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_SWfieldinfo(SWid_simple,\"Count\",&rank,dims,&dtype1,NULL,DimList);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWfieldinfo %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWfieldinfo(SWid_simple,\"Count\",&rank,dims, &dtype1,NULL,DimList);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWfieldinfo %d\n",status););
+       MESSAGE(8,printf("\t\tRank:   %d      Data type:     %d\n",rank, dtype1););
+       MESSAGE(8,printf("\t\tMaximum Dimension list:           %s\n",DimList););
+       MESSAGE(11,fprintf(fp,"\t\tRank:    %d      Data type:    %d\n",rank, dtype1););
+       MESSAGE(11,fprintf(fp,"\t\tMaximum Dimension list:          %s\n",DimList););
+       MESSAGE(8,printf("\t\tDimension sizes:\n"););
+       MESSAGE(11,fprintf(fp,"\t\tDimension sizes:\n"););
+       for (i = 0; i < rank; i++)
+		 {
+		   MESSAGE(8,printf("\t\t  %lu\n",(unsigned long)dims[i]););
+		   MESSAGE(11,fprintf(fp,"\t\t  %lu\n",(unsigned long)dims[i]););
+		 }
+       
+	 }
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWdetach                           *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWdetach... \n"););
+   MESSAGE(4,printf("\t======================= \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdetach... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDetaching from swath SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from swath SIMPLE \n"););
+
+   status = HE5_SWdetach(SWid_simple);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_SWdetach(SWid_simple);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by SWdetach for swath SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdetach(SWid_simple);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWdetach for swath SIMPLE%d\n",status););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    HE5_SWclose                            *
+	*********************************************************************************
+	*/
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_SWclose... \n"););
+   MESSAGE(4,printf("\t====================== \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_SWclose... \n"););
+   MESSAGE(11,fprintf(fp,"\t====================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tClosing the file SimpleSwath.h5\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tClosing the file SimpleSwath.h5\n"););
+   
+   status = HE5_SWclose(swfidc_simple);
+   if (status == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+	   errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\t\t*** Successfully clossed the SimpleSwath.h5 file ****\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t*** Successfully clossed the SimpleSwath.h5 file ****\n"););
+	 }
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    SWopen                                 *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting SWopen... \n"););
+   MESSAGE(4,printf("\t=================\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting SWopen... \n"););
+   MESSAGE(11,fprintf(fp,"\t=================\n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tOpening the file SimpleSwath.h5\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tOpening the file SimpleSwath.h5\n"););
+   
+   swfidc_simple = HE5_SWopen("SimpleSwath.h5",H5F_ACC_RDWR);
+   if (swfidc_simple == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully opened the swath file ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully opened the swath file ****\n"););
+       
+	 }
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    SWinqswath                             *
+	*********************************************************************************
+	*/
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting SWinqswath... \n"););
+   MESSAGE(4,printf("\t=================\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting SWinqswath... \n"););
+   MESSAGE(11,fprintf(fp,"\t=================\n"););
+   
+   MESSAGE(6,printf("\n"););  
+   MESSAGE(6,printf("\t\tRetrieving general information about objects within the file\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieving general information about objects within the file\n"););
+   number = HE5_SWinqswath("SimpleSwath.h5",NULL,&strbufsize);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber = HE5_SWinqswath(\"SimpleSwath.h5\",NULL,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tValue returned by SWinqswath %li\n", number););
+       MESSAGE(8,printf("\t\tString length returned by SWinqswath %li\n", strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tnumber = HE5_SWinqswath(\"SimpleSwath.h5\",NULL,&strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by SWinqswath %li\n", number););
+       MESSAGE(11,fprintf(fp,"\t\tStringlength returned by SWinqswath %li\n", strbufsize););
+	 }
+   
+   
+   
+   MESSAGE(6,printf("\n"););  
+   MESSAGE(6,printf("\t\tContinue ...\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tContinue ...\n"););
+   ObjNamesPtr = (char *)calloc(strbufsize+1, sizeof(char ) );
+   number = HE5_SWinqswath("SimpleSwath.h5",ObjNamesPtr,&strbufsize);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber = HE5_SWinqswath(\"SimpleSwath.h5\",ObjNamesPtr,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tNumber of swath objects:        %li\n", number););
+       MESSAGE(8,printf("\t\tList of swath objects:      %s\n", ObjNamesPtr););
+       MESSAGE(11,fprintf(fp,"\t\tnumber = HE5_SWinqswath(\"SimpleSwath.h5\",ObjNamesPtr,&strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of swath objecys:       %li\n", number););
+       MESSAGE(11,fprintf(fp,"\t\tList of swath objects:      %s\n", ObjNamesPtr););
+
+	 }
+   
+   
+   free(ObjNamesPtr);
+   
+   
+   
+   
+   /*
+	*********************************************************************************
+	*                             Testing    SWclose                                *
+	*********************************************************************************
+	*/
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting SWclose... \n"););
+   MESSAGE(4,printf("\t====================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting SWclose... \n"););
+   MESSAGE(11,fprintf(fp,"\t====================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tClosing the file SimpleSwath.h5\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tClosing the file SimpleSwath.h5\n"););
+   
+   status = HE5_SWclose(swfidc_simple);
+   if (status == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+	   errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\t\tSuccessfully clossed the SimpleSwath.h5 file \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tSuccessfully clossed the SimpleSwath.h5 file \n"););
+	   MESSAGE(4,printf("\n"););
+	   MESSAGE(4,printf("\t ........... End of Testing. \n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t ............. End of Testing. \n"););
+	 }
+   
+   if (errcnt == 0)
+	 {
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\t\t A L L    T E S T S     P A S S E D \n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t A L L    T E S T S     P A S S E D \n"););
+           return_val = 0;
+	 }
+   else
+	 {
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\t\t%d    T E S T S     F A I L E D \n",errcnt););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t%d    T E S T S     F A I L E D \n",errcnt););
+           return_val = 1;
+	 }
+      
+   MESSAGE(11,fclose(fp););
+   return return_val;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/swath/hdfeos5.inc b/testdrivers/swath/hdfeos5.inc
new file mode 100644
index 0000000..a6af5e8
--- /dev/null
+++ b/testdrivers/swath/hdfeos5.inc
@@ -0,0 +1,411 @@
+! * ==========================================================
+! * File:       hdfeos5.inc
+! * Author:     A. Muslimov, Emergent Technology Services, Inc.
+! * Date:       March 11, 2002
+! * Purpose:    Fortran header file for HDFEOS5 routines
+! * ==========================================================
+! * Contents: 
+! *     HDFEOS5 data type tags
+! *     HDFEOS5 logical constants
+! *     HDFEOS5 file access tags
+! *     HDFEOS5/GCTP library codes   
+! *
+! * ===========================================================
+ 
+!          HDFEOS5  DATA TYPE TAGS 
+!          =======================
+
+           integer   HE5T_NATIVE_INT
+           integer   HE5T_NATIVE_UINT
+           integer   HE5T_NATIVE_SHORT
+           integer   HE5T_NATIVE_USHORT
+           integer   HE5T_NATIVE_SCHAR
+           integer   HE5T_NATIVE_UCHAR
+           integer   HE5T_NATIVE_LONG
+           integer   HE5T_NATIVE_ULONG
+           integer   HE5T_NATIVE_LLONG
+           integer   HE5T_NATIVE_ULLONG
+           integer   HE5T_NATIVE_FLOAT
+           integer   HE5T_NATIVE_REAL
+           integer   HE5T_NATIVE_DOUBLE
+           integer   HE5T_NATIVE_LDOUBLE
+           integer   HE5T_NATIVE_INT8
+           integer   HE5T_NATIVE_UINT8
+           integer   HE5T_NATIVE_INT16
+           integer   HE5T_NATIVE_UINT16
+           integer   HE5T_NATIVE_INT32
+           integer   HE5T_NATIVE_UINT32
+           integer   HE5T_NATIVE_INT64
+           integer   HE5T_NATIVE_UINT64
+           integer   HE5T_NATIVE_B8
+           integer   HE5T_NATIVE_B16
+           integer   HE5T_NATIVE_B32
+           integer   HE5T_NATIVE_B64
+           integer   HE5T_NATIVE_HSIZE
+           integer   HE5T_NATIVE_HERR
+           integer   HE5T_NATIVE_HBOOL
+
+           integer   HE5T_STD_I8BE
+           integer   HE5T_STD_I8LE
+           integer   HE5T_STD_I16BE
+           integer   HE5T_STD_I16LE
+           integer   HE5T_STD_I32BE
+           integer   HE5T_STD_I32LE
+           integer   HE5T_STD_I64BE
+           integer   HE5T_STD_I64LE
+           integer   HE5T_STD_U8BE
+           integer   HE5T_STD_U8LE
+           integer   HE5T_STD_U16BE
+           integer   HE5T_STD_U16LE
+           integer   HE5T_STD_U32BE
+           integer   HE5T_STD_U32LE
+           integer   HE5T_STD_U64BE
+           integer   HE5T_STD_U64LE
+           integer   HE5T_STD_B8BE
+           integer   HE5T_STD_B8LE
+           integer   HE5T_STD_B16BE
+           integer   HE5T_STD_B16LE
+           integer   HE5T_STD_B32BE
+           integer   HE5T_STD_B32LE
+           integer   HE5T_STD_B64BE
+           integer   HE5T_STD_B64LE
+
+           integer   HE5T_IEEE_F32BE                      
+           integer   HE5T_IEEE_F32LE                      
+           integer   HE5T_IEEE_F64BE                      
+           integer   HE5T_IEEE_F64LE                      
+           integer   HE5T_NATIVE_CHAR
+           integer   HE5T_CHARSTRING
+
+           parameter(HE5T_NATIVE_INT      = 0)
+           parameter(HE5T_NATIVE_UINT     = 1)
+           parameter(HE5T_NATIVE_SHORT    = 2)
+           parameter(HE5T_NATIVE_USHORT   = 3)
+           parameter(HE5T_NATIVE_SCHAR    = 4)
+           parameter(HE5T_NATIVE_UCHAR    = 5)
+           parameter(HE5T_NATIVE_LONG     = 6)
+           parameter(HE5T_NATIVE_ULONG    = 7)
+           parameter(HE5T_NATIVE_LLONG    = 8)
+           parameter(HE5T_NATIVE_ULLONG   = 9)
+           parameter(HE5T_NATIVE_FLOAT    =10)
+           parameter(HE5T_NATIVE_REAL     =10)
+           parameter(HE5T_NATIVE_DOUBLE   =11)
+           parameter(HE5T_NATIVE_LDOUBLE  =12)
+           parameter(HE5T_NATIVE_INT8     =13)
+           parameter(HE5T_NATIVE_UINT8    =14)
+           parameter(HE5T_NATIVE_INT16    =15)
+           parameter(HE5T_NATIVE_UINT16   =16)
+           parameter(HE5T_NATIVE_INT32    =17)
+           parameter(HE5T_NATIVE_UINT32   =18)
+           parameter(HE5T_NATIVE_INT64    =19)
+           parameter(HE5T_NATIVE_UINT64   =20)
+           parameter(HE5T_NATIVE_B8       =21)
+           parameter(HE5T_NATIVE_B16      =22)
+           parameter(HE5T_NATIVE_B32      =23)
+           parameter(HE5T_NATIVE_B64      =24)
+           parameter(HE5T_NATIVE_HSIZE    =25)
+           parameter(HE5T_NATIVE_HERR     =26)
+           parameter(HE5T_NATIVE_HBOOL    =27)
+
+           parameter(HE5T_STD_I8BE        =28)
+           parameter(HE5T_STD_I8LE        =29)
+           parameter(HE5T_STD_I16BE       =30)
+           parameter(HE5T_STD_I16LE       =31)
+           parameter(HE5T_STD_I32BE       =32)
+           parameter(HE5T_STD_I32LE       =33)
+           parameter(HE5T_STD_I64BE       =34)
+           parameter(HE5T_STD_I64LE       =35)
+           parameter(HE5T_STD_U8BE        =36)
+           parameter(HE5T_STD_U8LE        =37)
+           parameter(HE5T_STD_U16BE       =38)
+           parameter(HE5T_STD_U16LE       =39)
+           parameter(HE5T_STD_U32BE       =40)
+           parameter(HE5T_STD_U32LE       =41)
+           parameter(HE5T_STD_U64BE       =42)
+           parameter(HE5T_STD_U64LE       =43)
+           parameter(HE5T_STD_B8BE        =44)
+           parameter(HE5T_STD_B8LE        =45)
+           parameter(HE5T_STD_B16BE       =46)
+           parameter(HE5T_STD_B16LE       =47)
+           parameter(HE5T_STD_B32BE       =48)
+           parameter(HE5T_STD_B32LE       =49)
+           parameter(HE5T_STD_B64BE       =50)
+           parameter(HE5T_STD_B64LE       =51)
+
+           parameter(HE5T_IEEE_F32BE      =52)                
+           parameter(HE5T_IEEE_F32LE      =53)                
+           parameter(HE5T_IEEE_F64BE      =54)                
+           parameter(HE5T_IEEE_F64LE      =55)                
+
+           parameter(HE5T_NATIVE_CHAR     =56)                
+           parameter(HE5T_CHARSTRING      =57)
+
+           integer   HE5S_UNLIMITED_F
+           parameter(HE5S_UNLIMITED_F = -1)
+
+
+!          HDFEOS5 FILE ACCESS TAGS 
+!          ========================
+ 
+           integer   HE5F_ACC_RDWR
+           integer   HE5F_ACC_RDONLY
+           integer   HE5F_ACC_TRUNC
+
+           parameter(HE5F_ACC_RDWR   = 100)
+           parameter(HE5F_ACC_RDONLY = 101)
+           parameter(HE5F_ACC_TRUNC  = 102)
+
+!          TOOLKIT FILE ACCESS TAGS 
+!          ========================
+ 
+           integer   HDF4_ACC_RDONLY
+           integer   HDF4_ACC_RDWR
+           integer   HDF4_ACC_CREATE
+
+           integer   HDF5_ACC_RDONLY
+           integer   HDF5_ACC_RDWR
+           integer   HDF5_ACC_CREATE
+
+           parameter(HDF4_ACC_RDONLY = 1)
+           parameter(HDF4_ACC_RDWR   = 3)
+           parameter(HDF4_ACC_CREATE = 4)
+
+           parameter(HDF5_ACC_RDONLY = 11)
+           parameter(HDF5_ACC_RDWR   = 13)
+           parameter(HDF5_ACC_CREATE = 14)
+
+
+!          HDFEOS5  MERGE CODES 
+!          ====================
+
+           integer HE5_HDFE_NOMERGE
+           integer HE5_HDFE_AUTOMERGE
+
+           parameter(HE5_HDFE_NOMERGE   =0)
+           parameter(HE5_HDFE_AUTOMERGE =1)
+ 
+!          HDFEOS5 XXentries CODES 
+!          =======================
+
+           integer HE5_HDFE_NENTDIM
+           integer HE5_HDFE_NENTMAP
+           integer HE5_HDFE_NENTIMAP
+           integer HE5_HDFE_NENTGFLD
+           integer HE5_HDFE_NENTDFLD
+
+           parameter(HE5_HDFE_NENTDIM  =0)
+           parameter(HE5_HDFE_NENTMAP  =1)
+           parameter(HE5_HDFE_NENTIMAP =2)
+           parameter(HE5_HDFE_NENTGFLD =3)
+           parameter(HE5_HDFE_NENTDFLD =4)
+
+!          HDFEOS5 ANGLE CONVERSION CODES 
+!          ==============================
+
+           integer HE5_HDFE_RAD_DEG    
+           integer HE5_HDFE_DEG_RAD    
+           integer HE5_HDFE_DMS_DEG    
+           integer HE5_HDFE_DEG_DMS    
+           integer HE5_HDFE_RAD_DMS    
+           integer HE5_HDFE_DMS_RAD    
+
+           parameter(HE5_HDFE_RAD_DEG =0)
+           parameter(HE5_HDFE_DEG_RAD =1)
+           parameter(HE5_HDFE_DMS_DEG =2)
+           parameter(HE5_HDFE_DEG_DMS =3)
+           parameter(HE5_HDFE_RAD_DMS =4)
+           parameter(HE5_HDFE_DMS_RAD =5)
+
+
+!          HDFEOS5 SWATH SUBSET CODES 
+!          ==========================
+ 
+           integer HE5_HDFE_MIDPOINT 
+           integer HE5_HDFE_ENDPOINT 
+           integer HE5_HDFE_ANYPOINT 
+           integer HE5_HDFE_INTERNAL 
+           integer HE5_HDFE_EXTERNAL 
+           integer HE5_HDFE_NOPREVSUB
+
+           parameter(HE5_HDFE_MIDPOINT  =0) 
+           parameter(HE5_HDFE_ENDPOINT  =1) 
+           parameter(HE5_HDFE_ANYPOINT  =2) 
+           parameter(HE5_HDFE_INTERNAL  =0) 
+           parameter(HE5_HDFE_EXTERNAL  =1) 
+           parameter(HE5_HDFE_NOPREVSUB =-1) 
+
+
+!          HDFEOS5 GRID ORIGIN CODES 
+!          =========================
+
+           integer HE5_HDFE_GD_UL    
+           integer HE5_HDFE_GD_UR    
+           integer HE5_HDFE_GD_LL    
+           integer HE5_HDFE_GD_LR    
+ 
+           parameter(HE5_HDFE_GD_UL  =0) 
+           parameter(HE5_HDFE_GD_UR  =1) 
+           parameter(HE5_HDFE_GD_LL  =2) 
+           parameter(HE5_HDFE_GD_LR  =3) 
+
+
+!          HDFEOS5 PIXEL REGISTRATION CODES 
+!          ================================
+
+           integer HE5_HDFE_CENTER     
+           integer HE5_HDFE_CORNER     
+ 
+           parameter(HE5_HDFE_CENTER  =0)
+           parameter(HE5_HDFE_CORNER  =1)
+
+!          HDFEOS5 GCTP PROJECTION CODES 
+!          =============================
+
+           integer HE5_GCTP_GEO      
+           integer HE5_GCTP_UTM      
+           integer HE5_GCTP_SPCS     
+           integer HE5_GCTP_ALBERS   
+           integer HE5_GCTP_LAMCC     
+           integer HE5_GCTP_MERCAT    
+           integer HE5_GCTP_PS        
+           integer HE5_GCTP_POLYC     
+           integer HE5_GCTP_EQUIDC    
+           integer HE5_GCTP_TM        
+           integer HE5_GCTP_STEREO    
+           integer HE5_GCTP_LAMAZ     
+           integer HE5_GCTP_AZMEQD    
+           integer HE5_GCTP_GNOMON    
+           integer HE5_GCTP_ORTHO     
+           integer HE5_GCTP_GVNSP     
+           integer HE5_GCTP_SNSOID    
+           integer HE5_GCTP_EQRECT    
+           integer HE5_GCTP_MILLER    
+           integer HE5_GCTP_VGRINT    
+           integer HE5_GCTP_HOM       
+           integer HE5_GCTP_ROBIN     
+           integer HE5_GCTP_SOM       
+           integer HE5_GCTP_ALASKA    
+           integer HE5_GCTP_GOOD      
+           integer HE5_GCTP_MOLL      
+           integer HE5_GCTP_IMOLL     
+           integer HE5_GCTP_HAMMER    
+           integer HE5_GCTP_WAGIV     
+           integer HE5_GCTP_WAGVII    
+           integer HE5_GCTP_OBLEQA    
+           integer HE5_GCTP_ISINUS    
+
+           parameter(HE5_GCTP_GEO      =0)
+           parameter(HE5_GCTP_UTM      =1)
+           parameter(HE5_GCTP_SPCS     =2)
+           parameter(HE5_GCTP_ALBERS   =3)
+           parameter(HE5_GCTP_LAMCC    =4)
+           parameter(HE5_GCTP_MERCAT   =5)
+           parameter(HE5_GCTP_PS       =6)
+           parameter(HE5_GCTP_POLYC    =7)
+           parameter(HE5_GCTP_EQUIDC   =8)
+           parameter(HE5_GCTP_TM       =9)
+           parameter(HE5_GCTP_STEREO   =10)
+           parameter(HE5_GCTP_LAMAZ    =11)
+           parameter(HE5_GCTP_AZMEQD   =12)
+           parameter(HE5_GCTP_GNOMON   =13)
+           parameter(HE5_GCTP_ORTHO    =14)
+           parameter(HE5_GCTP_GVNSP    =15)
+           parameter(HE5_GCTP_SNSOID   =16)
+           parameter(HE5_GCTP_EQRECT   =17)
+           parameter(HE5_GCTP_MILLER   =18)
+           parameter(HE5_GCTP_VGRINT   =19)
+           parameter(HE5_GCTP_HOM      =20)
+           parameter(HE5_GCTP_ROBIN    =21)
+           parameter(HE5_GCTP_SOM      =22)
+           parameter(HE5_GCTP_ALASKA   =23)
+           parameter(HE5_GCTP_GOOD     =24)
+           parameter(HE5_GCTP_MOLL     =25)
+           parameter(HE5_GCTP_IMOLL    =26)
+           parameter(HE5_GCTP_HAMMER   =27)
+           parameter(HE5_GCTP_WAGIV    =28)
+           parameter(HE5_GCTP_WAGVII   =29)
+           parameter(HE5_GCTP_OBLEQA   =30)
+           parameter(HE5_GCTP_ISINUS   =99)
+ 
+ 
+!          HDFEOS5 TILIND/COMPRESSION CODES 
+!          ================================
+
+           integer HE5_HDFE_NOTILE       
+           integer HE5_HDFE_TILE         
+           integer HE5_HDFE_COMP_NONE    
+           integer HE5_HDFE_COMP_RLE     
+           integer HE5_HDFE_COMP_NBIT    
+           integer HE5_HDFE_COMP_SKPHUFF 
+           integer HE5_HDFE_COMP_DEFLATE 
+           integer HE5_HDFE_COMP_SZIP_CHIP
+           integer HE5_HDFE_COMP_SZIP_K13
+           integer HE5_HDFE_COMP_SZIP_EC
+           integer HE5_HDFE_COMP_SZIP_NN
+           integer HE5_HDFE_COMP_SZIP_K13orEC
+           integer HE5_HDFE_COMP_SZIP_K13orNN
+           integer HE5_HDFE_COMP_SHUF_DEFLATE
+           integer HE5_HDFE_COMP_SHUF_SZIP_CHIP
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13
+           integer HE5_HDFE_COMP_SHUF_SZIP_EC
+           integer HE5_HDFE_COMP_SHUF_SZIP_NN
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13orEC
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13orNN
+
+           parameter(HE5_HDFE_NOTILE                 =0)
+           parameter(HE5_HDFE_TILE                   =1)
+           parameter(HE5_HDFE_COMP_NONE              =0)
+           parameter(HE5_HDFE_COMP_RLE               =1)
+           parameter(HE5_HDFE_COMP_NBIT              =2)
+           parameter(HE5_HDFE_COMP_SKPHUFF           =3)
+           parameter(HE5_HDFE_COMP_DEFLATE           =4)
+           parameter(HE5_HDFE_COMP_SZIP_CHIP         =5)
+           parameter(HE5_HDFE_COMP_SZIP_K13          =6)
+           parameter(HE5_HDFE_COMP_SZIP_EC           =7)
+           parameter(HE5_HDFE_COMP_SZIP_NN           =8)
+           parameter(HE5_HDFE_COMP_SZIP_K13orEC      =9)
+           parameter(HE5_HDFE_COMP_SZIP_K13orNN      =10)
+           parameter(HE5_HDFE_COMP_SHUF_DEFLATE      =11)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_CHIP    =12)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13     =13)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_EC      =14)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_NN      =15)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orEC =16)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orNN =17)
+ 
+!          HDFEOS5 GROUP CODES 
+!          ===================
+
+           integer HE5_HDFE_GEOGROUP        
+           integer HE5_HDFE_DATAGROUP       
+           integer HE5_HDFE_ATTRGROUP       
+           integer HE5_HDFE_GRPATTRGROUP    
+           integer HE5_HDFE_LOCATTRGROUP    
+           integer HE5_HDFE_PROFGROUP       
+           integer HE5_HDFE_PROFGRPATTRGROUP
+           integer HE5_HDFE_GEOGRPATTRGROUP
+
+           parameter(HE5_HDFE_GEOGROUP       =0)
+           parameter(HE5_HDFE_DATAGROUP      =1)
+           parameter(HE5_HDFE_ATTRGROUP      =2)
+           parameter(HE5_HDFE_GRPATTRGROUP   =3)
+           parameter(HE5_HDFE_LOCATTRGROUP   =4)
+           parameter(HE5_HDFE_PROFGROUP      =5)
+           parameter(HE5_HDFE_PROFGRPATTRGROUP =6)
+           parameter(HE5_HDFE_GEOGRPATTRGROUP =7)
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/swath/hdfeos5_64.inc b/testdrivers/swath/hdfeos5_64.inc
new file mode 100644
index 0000000..cb8be09
--- /dev/null
+++ b/testdrivers/swath/hdfeos5_64.inc
@@ -0,0 +1,16 @@
+! * ==========================================================
+! * File:       hdfeos5_64.inc
+! * Author:     A. Muslimov, Emergent Technology Services, Inc.
+! * Date:       March 19, 2002
+! * Purpose:    Fortran header file for HDFEOS5 routines on 64
+! *              bit platforms
+! * ==========================================================
+! * Contents: 
+! *
+! *
+! * ===========================================================
+ 
+
+           integer*8 HE5S_UNLIMITED_F_64
+
+           parameter(HE5S_UNLIMITED_F_64 = -1)
diff --git a/testdrivers/swath/testswath32.f b/testdrivers/swath/testswath32.f
new file mode 100755
index 0000000..d426325
--- /dev/null
+++ b/testdrivers/swath/testswath32.f
@@ -0,0 +1,2675 @@
+c----------------------------------------------------------------------------
+c     Copyright (C) 2000   Emergent IT Inc. and Raytheon Systems Company    |
+c----------------------------------------------------------------------------
+c testswath32.f                                                             |
+c In this program we create, define and write a simple swath hdfeos file    |
+c using the swath interface                                                 |
+c----------------------------------------------------------------------------
+
+      program   testswath32
+
+      implicit  none
+ 
+      include   'hdfeos5.inc'
+
+      integer   index1, index2, status
+      integer   rank, n, dtype, classid, order
+      integer   rdattr(4), global_attr(4)
+      integer   compparm(5), cnkrank
+      integer   rdcompparm(5), compcode
+      integer   he5_swopen, he5_swcreate
+      integer   swfid, swid, swid2
+      integer   he5_swdefdim, he5_swdetach
+      integer   he5_swdefgfld, he5_swdefdfld
+      integer   he5_swdefmap, he5_swclose, he5_swdefimap
+      integer   he5_swsetfill, he5_swwrlattr, he5_swwrattr
+      integer   he5_swwrfld, he5_swwrgattr, he5_swdefvrtreg
+      integer   he5_swgmapinfo, he5_swrdfld, he5_swfldinfo 
+      integer   he5_swmapinfo, he5_swattrinfo, he5_swrdattr
+      integer   he5_swgattrinfo, he5_swrdgattr, he5_swrdlattr
+      integer   he5_swreginfo, he5_swextreg, he5_swregidx
+      integer   he5_swperinfo, he5_swextper
+      integer   he5_swlattrinfo, he5_swgetfill, he5_swidtype
+      integer   he5_swdefchunk, he5_swdefcomp, he5_swcompinfo
+      integer   regionid, regionid2, regionid3, he5_swupimap
+      integer   rnkd(4), ntyped(4), rnk(3), ntype(3), nt
+      integer   he5_swattach
+      integer   he5_swdefboxreg, he5_swdeftmeper, he5_swdupreg
+
+      integer*4 he5_swinqswath, he5_swnentries, he5_swinqmaps
+      integer*4 he5_swinqimaps, he5_swinqdims, he5_swdiminfo
+      integer*4 he5_swimapinfo, he5_swinqattrs, he5_swinqgattrs
+      integer*4 he5_swinqlattrs, he5_swinqgflds, he5_swinqdflds
+      integer*4 size, strbufsize, ndims, chunkdims(1)
+      integer*4 start(2), stride(2), dataedge(2), geoedge(2)
+      integer*4 geostart(2),istart(2),iedge(2),dedge(2)
+      integer*4 sd_start(2), sd_stride(2), sd_edge(2)
+      integer*4 rd_start(2), rd_stride(2), rd_edge(2)
+      integer*4 indexmap(30), dimsize
+      integer*4 nattr, nswath, idxsz, nmaps
+      integer*4 tstart(1),tstride(1),tedge(1)
+      integer*4 strbufsz2, nflds, idxrange(2)
+      integer*4 count(1), offset, inc, zero, status4
+      integer*4 ndxmap(2), dims(5),latdims(2)
+      integer*4 idxmap(50), upidxmap(50)
+      integer*4 dim1, dim2, dim3, dim4
+
+      real      grpattr(3), locattr(3), rdgnlattr(3)
+      real      ray1(100,40), ray2(40,100)
+      real      lat(40,50), lon(40,50), ray4(40,100)
+      real      ray3(40,40), temp(40,100)
+      real      idxlat(30,30), idxlon(30,30)
+      real      latcnt, loncnt, raycnt, idxlatcnt, idxloncnt	
+      real      fillvalue, rdfilval, tempbuf(4200)
+
+      real*8    cornerlon(2),cornerlat(2)
+      real*8    twodtime(40,50)
+      real*8    onedtime(40)
+      real*8    range(2)
+      real*8    tmcnt, starttime, endtime
+
+      character*(256)  geodim
+      character*(256)  idxdimmap
+      character*(256)  dimmap, dimname, fieldlist
+      character*(256)  attrlist, swathlist
+      character*(256)  dimens, maxdims
+
+      dim1          = 30
+      dim2          = 40
+      dim3          = 50
+      dim4          = 100
+      count(1)      = 3
+      compparm(1)   = 6
+      compparm(2)   = 0
+      compparm(3)   = 0
+      compparm(4)   = 0
+      compparm(5)   = 0
+
+      cnkrank       = 1
+      chunkdims(1)  = 10
+
+      rdcompparm(1) = 1
+      rdcompparm(2) = 1
+      rdcompparm(3) = 1
+      rdcompparm(4) = 1
+      rdcompparm(5) = 1
+      compcode      = -1
+      raycnt        = -799.0
+      tmcnt         = 46353400.0d0
+      starttime     = 46353450.0d0
+      endtime       = 46500000.0d0
+      range(1)      = 46353450.0d0
+      range(2)      = 46500000.0d0
+      latcnt        = 39.8
+      loncnt        = 78.0
+      global_attr(1)= 11
+      global_attr(2)= 33
+      global_attr(3)= 66
+      global_attr(4)= 99
+      grpattr(1)    = 21.7
+      grpattr(2)    = 24.3
+      grpattr(3)    = 26.3
+      locattr(3)    = 21.7
+      locattr(2)    = 24.3
+      locattr(1)    = 26.3
+      start(1)      = 10
+      start(2)      = 10
+      tstart(1)     = 0
+      tstride(1)    = 1
+      tedge(1)      = 40
+      geostart(1)   = 0
+      geostart(2)   = 0 
+      stride(1)     = 1
+      stride(2)     = 1
+      sd_start(1)   = 0
+      sd_start(2)   = 0
+      sd_stride(1)  = 1
+      sd_stride(2)  = 1
+      sd_edge(1)    = 100
+      sd_edge(2)    = 40
+      rd_start(1)   = 0
+      rd_start(2)   = 0
+      rd_stride(1)  = 1
+      rd_stride(2)  = 1
+      rd_edge(1)    = 40
+      rd_edge(2)    = 100
+      dataedge(1)   = 20
+      dataedge(2)   = 50
+      geoedge(1)    = 40
+      geoedge(2)    = 50
+      idxlatcnt     = 39.8
+      idxloncnt     = 78.0
+      istart(1)     = 0
+      istart(2)     = 0
+      iedge(1)      = 30
+      iedge(2)      = 30
+      dedge(1)      = 40
+      dedge(2)      = 40
+      rank          = 2
+      fillvalue     = 16.0
+      cornerlon(1)  = 75.0
+      cornerlon(2)  = 78.0
+      cornerlat(1)  = 38.0
+      cornerlat(2)  = 39.8
+      indexmap(1)   = 1
+      indexmap(2)   = 2
+      indexmap(3)   = 3
+      indexmap(4)   = 4
+      indexmap(5)   = 6
+      indexmap(6)   = 7
+      indexmap(7)   = 8
+      indexmap(8)   = 9
+      indexmap(9)   = 11
+      indexmap(10)  = 12
+      indexmap(11)  = 13
+      indexmap(12)  = 14
+      indexmap(13)  = 16
+      indexmap(14)  = 17
+      indexmap(15)  = 18
+      indexmap(16)  = 19
+      indexmap(17)  = 21
+      indexmap(18)  = 22
+      indexmap(19)  = 23
+      indexmap(20)  = 24
+      indexmap(21)  = 26
+      indexmap(22)  = 27
+      indexmap(23)  = 28
+      indexmap(24)  = 29
+      indexmap(25)  = 31
+      indexmap(26)  = 32
+      indexmap(27)  = 33
+      indexmap(28)  = 34
+      indexmap(29)  = 36
+      indexmap(30)  = 37
+      zero          = 0
+
+c
+c This section of the program just fills some arrays with data that will be
+c used later in the program
+c
+      do 110 index1=1,100
+         do 100 index2=1,40
+            ray1(index1, index2)=raycnt
+            ray2(index2, index1)=raycnt + 1.0
+            ray4(index2,index1) = raycnt
+            raycnt = raycnt +1.
+  100    continue
+  110 continue
+
+      do 130 index1=1,40
+         do 120 index2=1,50
+            lat(index1, index2)=latcnt
+            lon(index1, index2)=loncnt
+            twodtime(index1,index2)=tmcnt
+            loncnt=loncnt-.1
+            tmcnt=tmcnt+5.0
+  120    continue
+         onedtime(index1)=tmcnt
+         latcnt=latcnt-0.1
+         loncnt = 78.0
+  130 continue
+
+      do 150 index1=1,30
+         do 140 index2=1,30
+            idxlat(index1, index2)=idxlatcnt
+            idxlon(index1, index2)=idxloncnt
+            idxloncnt=idxloncnt-.1
+  140    continue
+         idxlatcnt=idxlatcnt-.1
+         idxloncnt=78.0
+  150 continue
+
+
+      do 170 index1=1,40
+         do 160 index2=1,40
+            ray3(index1, index2)=raycnt
+            raycnt = raycnt+1.25
+  160    continue
+  170 continue
+
+      do 987 index1=1,50
+         idxmap(index1)=zero
+         upidxmap(index1)=zero
+  987 continue
+
+  230 format('********Error unexpected**********')
+  240 format('***********Passed Test*********')
+
+      open(unit=1, file="testswath.txt", status = "UNKNOWN")
+
+      write(*,*)'Testing he5_swath FORTRAN 77 interface'
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_swath FORTRAN 77 interface'
+      write(1,*)'======================================'
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swopen
+c
+      write(*,*)'Testing he5_swopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swopen '
+      write(1,*)'====================='
+      swfid=he5_swopen('swath.he5',HE5F_ACC_TRUNC)
+      if (swfid .lt. 0) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_TRUNC)'
+         write(*,*)'Value returned by he5_swopen ', swfid
+         write(1,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_TRUNC)'
+         write(1,*)'Value returned by he5_swopen ', swfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swcreate
+c
+      write(1,27)
+      write(*,*)'Testing he5_swcreate '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swcreate '
+      write(1,*)'====================='
+      swid=he5_swcreate(swfid,'Simplef')
+      if (swid .lt. 0) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid=he5_swcreate(swfid, "Simplef")'
+         write(*,*)'Value returned by he5_swcreate ', swid
+         write(1,*)'swid= he5_swcreate(swfid, "Simplef")'
+         write(1,*)'Value returned by he5_swcreate ', swid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      swid2=he5_swcreate(swfid,'Indexedf')
+      if (swid2 .lt. 0) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	swid2= he5_swcreate(swfid, "Indexedf")'
+         write(*,*)'	Value returned by he5_swcreate ', swid2
+         write(1,*)'	swid2= he5_swcreate(swfid, "Indexedf")'
+         write(1,*)'	Value returned by he5_swcreate ', swid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swdefdim
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefdim '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdefdim '
+      write(1,*)'====================='
+      status=he5_swdefdim(swid,'DataTrack',dim4)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid, "DataTrack", 100)'
+         write(*,*)'	Value returned by he5_swdefdim ',status
+         write(1,*)'	status= he5_swdefdim(swid, "DataTrack", 100)'
+         write(1,*)'	Value returned by he5_swdefdim ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid,'DataXtrack',dim2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid, "DataXtrack", 40)'
+         write(*,*)'	Value returned by he5_swdefdim ',status
+         write(1,*)'	status= he5_swdefdim(swid, "DataXtrack", 40)'
+         write(1,*)'	Value returned by he5_swdefdim ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid,'GeoTrack',dim3) 
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid, "GeoTrack", 50)'
+         write(*,*)'	Value returned by he5_swdefdim ',status
+         write(1,*)'	status= he5_swdefdim(swid, "GeoTrack", 50)'
+         write(1,*)'	Value returned by he5_swdefdim ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid,'GeoXtrack',dim2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid, "GeoXtrack", 40)'
+         write(*,*)'	Value returned by he5_swdefdim ',status
+         write(1,*)'	status= he5_swdefdim(swid, "GeoXtrack", 40)'
+         write(1,*)'	Value returned by he5_swdefdim ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid2,'DataTrack',dim2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid2, "DataTrack", 40)'
+         write(*,*)'	Value returned by he5_swdefdim ', status
+         write(1,*)'	status= he5_swdefdim(swid2, "DataTrack", 40)'
+         write(1,*)'	Value returned by he5_swdefdim ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid2,'DataXtrack',dim2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid2, "DataXtrack", 40)'
+         write(*,*)'	Value returned by he5_swdefdim ', status
+         write(1,*)'	status= he5_swdefdim(swid2, "DataXtrack", 40)'
+         write(1,*)'	Value returned by he5_swdefdim ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid2,'GeoTrack',dim1)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid2, "GeoTrack", 30)'
+         write(*,*)'	Value returned by he5_swdefdim ', status
+         write(1,*)'	status= he5_swdefdim(swid2, "GeoTrack", 30)'
+         write(1,*)'	Value returned by he5_swdefdim ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid2,'GeoXtrack',dim1)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid2, "GeoXtrack", 30)'
+         write(*,*)'	Value returned by he5_swdefdim ', status
+         write(1,*)'	status= he5_swdefdim(swid2, "GeoXtrack", 30)'
+         write(1,*)'	Value returned by he5_swdefdim ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid2,'Timedim',dim2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define dimension Timedim '
+         write(*,*)'	Value returned by he5_swdefdim ', status
+         write(1,*)'Define dimension Timedim '
+         write(1,*)'	Value returned by he5_swdefdim ', status
+      endif
+
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdefgfld
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefgfld '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdefgfld '
+      write(1,*)'====================='
+      status=he5_swdefgfld(swid,'Latitude','GeoXtrack,GeoTrack',
+     1' ',HE5T_NATIVE_FLOAT,0)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdefgfld(swid,"Latitude",
+     1"GeoXtrack,GeoTrack"," ", HE5T_NATIVE_FLOAT, 0)'
+         write(1,*)'status= he5_swdefgfld(swid,"Latitude",
+     1"GeoXtrack,GeoTrack"," ", HE5T_NATIVE_FLOAT, 0)'
+         write(1,*)'Value returned by he5_swdefgfld ',status
+         write(*,*)'Value returned by he5_swdefgfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefgfld(swid,'Longitude','GeoXtrack,GeoTrack',
+     1' ',HE5T_NATIVE_FLOAT, 0)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Value returned by he5_swdefgfld ',status
+         write(1,*)'Value returned by he5_swdefgfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefgfld(swid2,'Latitude','GeoXtrack,GeoTrack',
+     1' ',HE5T_NATIVE_FLOAT, 0)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Value returned by he5_swdefgfld ', status
+         write(1,*)'Value returned by he5_swdefgfld ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefgfld(swid2,'Longitude','GeoXtrack,GeoTrack',
+     1' ',HE5T_NATIVE_FLOAT, 0)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Value returned by he5_swdefgfld ', status
+         write(1,*)'Value returned by he5_swdefgfld ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefgfld(swid2,'Time','Timedim',' ',
+     1HE5T_NATIVE_DOUBLE, 0)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define field Time for swath Indexedf '
+         write(*,*)'Status returned from call to he5_swdefgfld ',status
+         write(1,*)'Define field Time for swath Indexedf '
+         write(1,*)'Status returned from call to he5_swdefgfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefgfld(swid,'Time','GeoXtrack,GeoTrack',
+     1' ', HE5T_NATIVE_DOUBLE, 0)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdefgfld(swid, "Time","GeoXtrack,GeoTrack",
+     1"",HE5T_NATIVE_DOUBLE, 0)'
+         write(*,*)'Value returned by he5_swdefgfld ',status
+         write(1,*)'status= he5_swdefgfld(swid, "Time","GeoXtrack,GeoTrack",
+     1"",HE5T_NATIVE_DOUBLE, 0)'
+         write(1,*)'Value returned by he5_swdefgfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdefdfld
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefdfld '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdefdfld '
+      write(1,*)'====================='
+
+      status=he5_swdefdfld(swid,'SideA','DataXtrack,DataTrack',
+     1' ', HE5T_NATIVE_FLOAT, 0)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+        
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define data field SideA '
+         write(*,*)'Value returned by he5_swdefdfld ',status
+         write(1,*)'Define data field SideA '
+         write(1,*)'Value returned by he5_swdefdfld ',status
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+c Test Case  -- he5_swsetfill
+c
+      write(1,27)
+      write(*,*)'Testing he5_swsetfill '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swsetfill '
+      write(1,*)'====================='
+      status= he5_swsetfill(swid,'Temperature',
+     1HE5T_NATIVE_FLOAT, fillvalue)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swsetfill(swid,"Temperature",
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(*,*)'Value returned by he5_swsetfill ',status
+         write(1,*)'status=he5_swsetfill(swid,"Temperature",
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(1,*)'Value returned by he5_swsetfill ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdfld(swid,'Temperature',
+     1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT, 0)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define data field Temperature '
+         write(*,*)'Value returned by he5_swdefdfld ',status
+         write(1,*)'Define data field Temperature '
+         write(1,*)'Value returned by he5_swdefdfld ',status
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+      status= he5_swsetfill(swid,'Conduction',
+     1HE5T_NATIVE_FLOAT,fillvalue)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swsetfill(swid,"Conduction",
+     1HE5T_NATIVE_FLOAT,fillvalue)'
+         write(*,*)'Value returned by he5_swsetfill ',status
+         write(1,*)'status=he5_swsetfill(swid,"Conduction",
+     1HE5T_NATIVE_FLOAT,fillvalue)'
+         write(1,*)'Value returned by he5_swsetfill ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdfld(swid,'Conduction',
+     1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT,0)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdefdfld(swid,"Conduction",
+     1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT, 0)'
+         write(*,*)'Value returned by he5_swdefdfld ',status
+         write(1,*)'status= he5_swdefdfld(swid,"Conduction",
+     1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT, 0)'
+         write(1,*)'Value returned by he5_swdefdfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdfld(swid2,'Sensor1',
+     1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT, 0)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swdefdfld(swid2, "Sensor1",
+     1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT, 0)'
+         write(*,*)'Value returned by he5_swdefdfld ',status
+         write(1,*)'status= he5_swdefdfld(swid2, "Sensor1",
+     1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT, 0)'
+         write(1,*)'Value returned by he5_swdefdfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdefchunk
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefchunk'
+      write(*,*)'======================'
+      write(1,*)'Testing he5_swdefchunk'
+      write(1,*)'======================'
+      status=he5_swdefchunk(swid,cnkrank,chunkdims)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdefchunk(swid, cnkrank, chunkdims)'
+         write(*,*)'Value returned by he5_swdefchunk ',status
+         write(1,*)'status= he5_swdefchunk(swid, cnkrank, chunkdims)'
+         write(1,*)'Value returned by he5_swdefchunk ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+    
+c Test Case -- he5_swdefcomp
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefcomp'
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdefcomp'
+      write(1,*)'====================='
+      status=he5_swdefcomp(swid,HE5_HDFE_COMP_DEFLATE,compparm)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdefcomp(swid,HE5_HDFE_COMP_DEFLATE,
+     1compparm)'
+         write(*,*)'Value returned by he5_swdefcomp ',status
+         write(1,*)'status= he5_swdefcomp(swid,HE5_HDFE_COMP_DEFLATE,
+     1compparm)'
+         write(1,*)'Value returned by he5_swdefcomp ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      status=he5_swdefdfld(swid,'CompChunk','GeoTrack',
+     1' ',HE5T_NATIVE_FLOAT, 0)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230) 
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define data field CompChunk '
+         write(*,*)'Value returned by he5_swdefdfld ',status
+         write(1,*)'Define data field CompChunk '
+         write(1,*)'Value returned by he5_swdefdfld ',status
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+c Test Case -- he5_swdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdetach '
+      write(1,*)'====================='
+      status=he5_swdetach(swid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdetach(swid2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid2)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid2)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      swid=he5_swattach(swfid,'Simplef')
+      if (swid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(*,*)'Value returned by he5_swattach ',swid
+         write(1,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(1,*)'Value returned by he5_swattach ',swid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      swid2=he5_swattach(swfid,'Indexedf')
+      if (swid2 .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid2= he5_swattach(swfid, "Indexedf")'
+         write(*,*)'Value returned by he5_swattach ',swid2
+         write(1,*)'swid2= he5_swattach(swfid, "Indexedf")'
+         write(1,*)'Value returned by he5_swattach ',swid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdefmap
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefmap '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdefmap '
+      write(1,*)'====================='
+
+      offset = 0
+      inc    = 2
+      status=he5_swdefmap(swid,'GeoTrack','DataTrack',offset,inc)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdefmap(swid,"GeoTrack",
+     1"DataTrack", offset, inc)'
+         write(*,*)'Value returned by he5_swdefmap ',status
+         write(1,*)'status= he5_swdefmap(swid,"GeoTrack",
+     1"DataTrack", offset, inc)'
+         write(1,*)'Value returned by he5_swdefmap ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdefimap
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefimap '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdefimap '
+      write(1,*)'====================='
+      status=he5_swdefimap(swid2,'GeoTrack','DataTrack',indexmap)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdefimap(swid2, "GeoTrack", 
+     1"DataTrack",indexmap)'
+         write(*,*)'Value returned by he5_swdefimap ',status
+         write(1,*)'status= he5_swdefimap(swid2, "GeoTrack",
+     1"DataTrack",indexmap)'
+         write(1,*)'Value returned by he5_swdefimap ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefimap(swid2,'GeoXtrack','DataXtrack',
+     1indexmap)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swdefimap(swid2, "GeoXtrack",
+     1"DataXtrack",indexmap)'
+         write(*,*)'Value returned by he5_swdefimap ',status
+         write(1,*)'status=he5_swdefimap(swid2, "GeoXtrack",
+     1"DataXtrack",indexmap)'
+         write(1,*)'Value returned by he5_swdefimap ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdetach '
+      write(1,*)'====================='
+      status= he5_swdetach(swid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swdetach(swid2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid2)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid2)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swclose(swfid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)       
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swclose(swfid)'
+         write(*,*)'Value returned by he5_swclose ',status
+         write(1,*)'status= he5_swclose(swfid)'
+         write(1,*)'Value returned by he5_swclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      swfid=he5_swopen('swath.he5',HE5F_ACC_RDWR)
+      if (swfid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swfid=he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_swopen ',swfid
+         write(1,*)'swfid=he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_swopen ',swfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_swattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swattach '
+      write(1,*)'====================='
+
+      swid=he5_swattach(swfid,'Simplef')
+      if (swid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(*,*)'Value returned by he5_swattach ',swid
+         write(1,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(1,*)'Value returned by he5_swattach ',swid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      swid2=he5_swattach(swfid,'Indexedf')
+      if (swid2 .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid2= he5_swattach(swfid, "Indexedf")'
+         write(*,*)'Value returned by he5_swattach ',swid2
+         write(1,*)'swid2= he5_swattach(swfid, "Indexedf")'
+         write(1,*)'Value returned by he5_swattach ',swid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swwrfld
+c
+      write(1,27)
+      write(*,*)'Testing he5_swwrfld '
+      write(*,*)'==================='
+      write(1,*)'Testing he5_swwrfld '
+      write(1,*)'==================='
+
+      status=he5_swwrfld(swid,'SideA',sd_start,stride, 
+     1rd_edge, ray4)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Write data field SideA '
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'Write data field SideA '
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid,'Temperature',start,stride, 
+     1dataedge, ray4)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swwrfld(swid,"Temperature",start, 
+     1stride,dataedge, ray1)'
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'status=he5_swwrfld(swid,"Temperature",start, 
+     1stride,dataedge, ray1)'
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid,'Conduction',start,stride, 
+     1dataedge, ray2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swwrfld(swid,"Conduction",start, 
+     1stride,dataedge, ray2)'
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'status=he5_swwrfld(swid,"Conduction",start, 
+     1stride,dataedge, ray2)'
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid,'Latitude',geostart,stride,
+     1geoedge,lat)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swwrfld(swid, "Latitude", geostart, 
+     1stride, geoedge, lat)'
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'status= he5_swwrfld(swid, "Latitude", geostart, 
+     1stride, geoedge, lat)'
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid,'Longitude',geostart,stride, 
+     1geoedge,lon)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swwrfld(swid,"Longitude",geostart,
+     1stride,geoedge, lon)'
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'status= he5_swwrfld(swid,"Longitude",geostart,
+     1stride,geoedge, lon)'
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid,'Time',geostart,stride,geoedge,
+     1twodtime)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swwrfld(swid,"Time",geostart,stride, 
+     1geoedge, twodtime)'
+         write(*,*)'Value returned by he5_swwrfld for Time ',status
+         write(1,*)'status= he5_swwrfld(swid, "Time", geostart, stride, 
+     1geoedge, twodtime)'
+         write(1,*)'Value returned by he5_swwrfld for Time ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid2,'Latitude',istart,stride,
+     1iedge,idxlat)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)       
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swwrfld(swid2,"Latitude", 
+     1istart,stride,iedge,idxlat)'
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'status= he5_swwrfld(swid2,"Latitude",
+     1istart,stride,iedge,lat)'
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid2,'Longitude',istart,stride, 
+     1iedge,idxlon)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swwrfld(swid2,"Longitude", 
+     1istart,stride,iedge,idxlon)'
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'status= he5_swwrfld(swid2,"Longitude",
+     1istart,stride,iedge,idxlon)'
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid2,'Time',tstart,tstride,
+     1tedge,onedtime)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Write field Time '
+         write(*,*)'Status returned by he5_swwrfld ',status
+         write(1,*)'Write field Time '
+         write(1,*)'Status returned by he5_swwrfld ',status
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+      iedge(1)=40
+      iedge(2)=40
+      status=he5_swwrfld(swid2,'Sensor1',istart,stride, 
+     1iedge,ray3)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swwrfld(swid2, "Sensor1", 
+     1istart, stride, iedge, ray3)'
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'status= he5_swwrfld(swid2, "Sensor1", 
+     1istart, stride, iedge, ray3)'
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swwrlattr
+c
+      write(1,27)
+      write(*,*)'Testing he5_swwrlattr, Local Attribute '
+      write(*,*)'================================== '
+      write(1,*)'Testing he5_swwrlattr, Local Attribute '
+      write(1,*)'================================== '
+      status=he5_swwrlattr(swid2,'Sensor1','local',
+     1HE5T_NATIVE_FLOAT,count,locattr)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swwrlattr(swid2,"Sensor1","local",
+     1HE5T_NATIVE_FLOAT,count,locattr)'
+         write(*,*)'Value returned by he5_swwrlattr ',status
+         write(1,*)'status=he5_swwrlattr(swid2,"Sensor1", "local", 
+     1HE5T_NATIVE_FLOAT,count,locattr)'
+         write(1,*)'Value returned by he5_swwrlattr ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swwrattr
+c
+      count(1) = 4
+
+      write(1,27)
+      write(*,*)'Testing he5_swwrattr, Global Attribute '
+      write(*,*)'====================================== '
+      write(1,*)'Testing he5_swwrattr, Global Attribute '
+      write(1,*)'======================================= '
+      status=he5_swwrattr(swid,'Drift',HE5T_NATIVE_INT,count, 
+     1global_attr)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swwrattr(swid, "Drift", 
+     1HE5T_NATIVE_INT, count, global_attr)'
+         write(*,*)'Value returned by he5_swwrattr ',status
+         write(1,*)'status=he5_swwrattr(swid, "Drift", 
+     1HE5T_NATIVE_INT, count, global_attr)'
+         write(1,*)'Value returned by he5_swwrattr ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swwrgattr
+c
+      count(1) = 3
+     
+      write(1,27)
+      write(*,*)'Testing he5_swwrgattr, Group Attribute '
+      write(*,*)'====================================== '
+      write(1,*)'Testing he5_swwrgattr, Group Attribute '
+      write(1,*)'====================================== '
+      status=he5_swwrgattr(swid,'group',HE5T_NATIVE_FLOAT, 
+     1count,grpattr)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swwrgattr(swid, "group", 
+     1HE5T_NATIVE_FLOAT,count,grpgattr)'
+         write(*,*)'Value returned by he5_swwrgattr ',status
+         write(1,*)'status=he5_swwrgattr(swid, "group", 
+     1HE5T_NATIVE_FLOAT,count,grpattr)'
+         write(1,*)'Value returned by he5_swwrgattr ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swdetach(swid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+      write(*,*)'status= he5_swdetach(swid)'
+      write(*,*)'Value returned by he5_swdetach ',status
+      write(1,*)'status= he5_swdetach(swid)'
+      write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swdetach(swid2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid2)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid2)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swclose
+c
+      write(1,27)
+      write(*,*)'Testing he5_swclose '
+      write(*,*)'==================='
+      write(1,*)'Testing he5_swclose '
+      write(1,*)'==================='
+      status= he5_swclose(swfid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Value returned by he5_swclose ',status
+         write(1,*)'status= he5_swclose(swfid)'
+         write(1,*)'Value returned by he5_swclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      swfid= he5_swopen('swath.he5',HE5F_ACC_RDWR)
+      if (swfid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_swopen ', swfid
+         write(1,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_swopen ', swfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      swid= he5_swattach(swfid,'Simplef')
+      if (swid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(*,*)'Value returned by he5_swattach ',swid
+         write(1,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(1,*)'Value returned by he5_swattach ',swid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swdetach(swid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swclose(swfid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swclose(swfid)'
+         write(*,*)'Value returned by he5_swclose ',status
+         write(1,*)'status= he5_swclose(swfid)'
+         write(1,*)'Value returned by he5_swclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      swfid= he5_swopen('swath.he5',HE5F_ACC_RDWR)
+      if (swfid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_swopen ',swfid
+         write(1,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_swopen ',swfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      swid=he5_swattach(swfid,'Simplef')
+      if (swid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(*,*)'Value returned by he5_swattach ',swid
+         write(1,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(1,*)'Value returned by he5_swattach ',swid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      swid2=he5_swattach(swfid,'Indexedf')
+      if (swid2 .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid2= he5_swattach(swfid, "Indexedf")'
+         write(*,*)'Value returned by he5_swattach ',swid2
+         write(1,*)'swid2= he5_swattach(swfid, "Indexedf")'
+         write(1,*)'Value returned by he5_swattach ',swid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdefvrtreg
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefvrtreg'
+      write(*,*)'======================='
+      write(1,*)'Testing he5_swdefvrtreg'
+      write(1,*)'======================='
+
+      regionid=he5_swdefvrtreg(swid2,HE5_HDFE_NOPREVSUB,'Time',range)
+      if (regionid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define region id for field Time '
+         write(*,*)'Region id returned by he5_swdefvrtreg ',
+     1regionid
+         write(1,*)'Define region id for field Time '
+         write(1,*)'Region id returned by he5_swdefvrtreg ',
+     1regionid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swnentries
+c
+      write(1,27)
+      write(*,*)'Testing he5_swnentries '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swnentries '
+      write(1,*)'====================='
+
+      nmaps=he5_swnentries(swid,1,strbufsize)
+      if (nmaps .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'nmaps= he5_swnentries(swid, 1, strbufsize)'
+         write(*,*)'Number of dimension mappings ',nmaps
+         write(*,*)'Size of strbufsize ',strbufsize
+         write(1,*)'nmaps= he5_swnentries(swid, 1, strbufsize)'
+         write(1,*)'Number of dimension mappings ',nmaps
+         write(1,*)'Size of strbufsize ',strbufsize
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swinqmaps
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqmaps '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swinqmaps '
+      write(1,*)'====================='
+      nmaps=he5_swinqmaps(swid, dimmap, offset, inc)
+      if (nmaps .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'nmaps=he5_swinqmaps(swid,dimmap,offset,inc)'
+         write(*,*)'Dimension mappings ',dimmap
+         write(*,*)'offset ',offset
+         write(*,*)'increment ',inc
+         write(1,*)'nmaps=he5_swinqmaps(swid,dimmap,offset,inc)'
+         write(1,*)'Dimension mappings ',dimmap
+         write(1,*)'offset ',offset
+         write(1,*)'increment ',inc
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swgmapinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swgmapinfo '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_swgmapinfo '
+      write(1,*)'======================'
+      status = he5_swgmapinfo(swid2,'GeoTrack')
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status = he5_swgmapinfo(swid2, "GeoTrack")'
+         write(1,*)'status = he5_swgmapinfo(swid2, "GeoTrack")'
+         write(*,*)'Status returned by he5_swgmapinfo ',status
+         write(1,*)'Status returned by he5_swgmapinfo ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swinqimaps
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqimaps '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swinqimaps '
+      write(1,*)'====================='
+      nmaps=he5_swinqimaps(swid2, idxdimmap, ndxmap)
+      if (nmaps .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'nmaps=he5_swinqimaps(swid2,idxdimmap,ndxmap)'
+         write(*,*)'Number of indexed mappings ',nmaps
+         write(*,*)'Indexed Dimension mappings ',idxdimmap
+         write(*,*)'Index size ',ndxmap
+         write(1,*)'nmaps=he5_swinqimaps(swid2,idxdimmap,ndxmap)'
+         write(1,*)'Number of indexed mappings ',nmaps
+         write(1,*)'Indexed Dimension mappings ',idxdimmap
+         write(1,*)'Index size ',ndxmap
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swinqdims
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqdims '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swinqdims '
+      write(1,*)'====================='
+      ndims=he5_swinqdims(swid,dimname,dims)
+      if (ndims .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'ndims= he5_swinqdims(swid, dimname, dims)'
+         write(*,*)'Number of dimesions ',ndims
+         write(*,*)'Names of dimensions ',dimname
+         write(*,*)'Size of dimensions ',dims
+         write(1,*)'ndims= he5_swinqdims(swid, dimname, dims)'
+         write(1,*)'Number of dimesions ',ndims
+         write(1,*)'Names of dimensions ',dimname
+         write(1,*)'Size of dimensions ',dims
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      ndims= he5_swinqdims(swid2, dimname, dims)
+      if (ndims .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'ndims=he5_swinqdims(swid2,dimname,dims)'
+         write(*,*)'Number of dimesions ',ndims
+         write(*,*)'Names of dimensions ',dimname
+         write(*,*)'Size of dimensions ',dims
+         write(1,*)'ndims=he5_swinqdims(swid2,dimname,dims)'
+         write(1,*)'Number of dimesions ',ndims
+         write(1,*)'Names of dimensions ',dimname
+         write(1,*)'Size of dimensions ',dims
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swinqgflds
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqgflds '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_swinqgflds '
+      write(1,*)'======================'
+
+      nflds= he5_swinqgflds(swid,fieldlist,rnk,ntype)
+      if (nflds .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'nflds=he5_swinqgflds(swid,fieldlist,rnk,ntype)'
+         write(*,*)'Number of geolocation fields in swath ',nflds
+         write(*,*)'Names of geolocation fields ',fieldlist
+         write(*,*)'Rank of fields ',rnk
+         write(*,*)'Number type of fields ',ntype
+         write(1,*)'nflds=he5_swinqgflds(swid,fieldlist,rnk,ntype)'
+         write(1,*)'Number of geolocation fields in swath ',nflds
+         write(1,*)'Names of geolocation fields ',fieldlist
+         write(1,*)'Rank of fields ',rnk
+         write(1,*)'Number type of fields ',ntype
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swinqdflds
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqdflds '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_swinqdflds '
+      write(1,*)'======================'
+      nflds=he5_swinqdflds(swid,fieldlist,rnkd,ntyped)
+      if (nflds .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'nflds=he5_swinqdflds(swid,fieldlist,rnkd,ntyped)'
+         write(*,*)'Number of data fields in swath ',nflds
+         write(*,*)'Names of data fields ',fieldlist
+         write(*,*)'Rank of fields ',rnkd
+         write(*,*)'Number type of fields ',ntyped
+         write(1,*)'nflds=he5_swinqdflds(swid,fieldlist,rnkd,ntyped)'
+         write(1,*)'Number of data fields in swath ',nflds
+         write(1,*)'Names of data fields ',fieldlist
+         write(1,*)'Rank of fields ',rnkd
+         write(1,*)'Number type of fields ',ntyped
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdiminfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdiminfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdiminfo '
+      write(1,*)'====================='
+      dimsize= he5_swdiminfo(swid,'DataTrack')
+      if (dimsize .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'dimsize= he5_swdiminfo(swid, "DataTrack")'
+         write(*,*)'Size of dimension DataTrack ',dimsize
+         write(1,*)'dimsize= he5_swdiminfo(swid, "DataTrack")'
+         write(1,*)'Size of dimension DataTrack ',dimsize
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+c Test Case -- he5_swrdfld
+c
+      write(1,27)
+      write(*,*)'Testing he5_swrdfld '
+      write(*,*)'==================='
+      write(1,*)'Testing he5_swrdfld '
+      write(1,*)'==================='
+
+      rd_start(1)=0
+      rd_start(2)=0
+      rd_stride(1)=1
+      rd_stride(2)=1
+      rd_edge(1)=40
+      rd_edge(2)=100
+      status= he5_swrdfld(swid,'Conduction',rd_start,
+     1rd_stride,rd_edge,temp)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Value returned by he5_swrdfld ',status
+         write(*,*)'status= he5_swrdfld(swid, "Conduction", 
+     1rd_start,rd_stride, rd_edge, temp)'
+         write(1,*)'status= he5_swrdfld(swid, "Conduction", 
+     1rd_start,rd_stride, rd_edge, temp)'
+         write(1,*)'Value returned by he5_swrdfld ',status
+         do 190 index1=10,15
+            do 180 index2=10,15
+               write(*,*)'value of conduction ',temp(index1,index2)
+               write(1,*)'value of conduction ',temp(index1,index2)
+  180       continue
+  190    continue
+      endif
+
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swfldinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swfldinfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swfldinfo '
+      write(1,*)'====================='
+      status=he5_swfldinfo(swid,'Latitude',rank,latdims,nt,
+     1dimens,maxdims)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swfldinfo(swid, "Latitude", 
+     1rank, latdims, nt, dimens, maxdims)'
+         write(*,*)'Value returned by he5_swfldinfo ',status
+         write(*,*)'Rank of field latitude ',rank
+         write(*,*)'dimension list of field latitude ',dimens
+         write(*,*)'Size of latitude dimensions ',latdims
+         write(*,*)'number type of field latitude ',nt
+         write(1,*)'status= he5_swfldinfo(swid, "Latitude", 
+     1rank, latdims, nt, dimens, maxdims)'
+         write(1,*)'Value returned by he5_swfldinfo ',status
+         write(1,*)'Rank of field latitude ',rank
+         write(1,*)'dimension list of field latitude ',dimens
+         write(1,*)'Size of latitude dimensions ',latdims
+         write(1,*)'number type of field latitude ',nt
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swmapinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swmapinfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swmapinfo '
+      write(1,*)'====================='
+      status=he5_swmapinfo(swid,'GeoTrack','DataTrack',offset,inc)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swmapinfo(swid,"GeoTrack","DataTrack", 
+     1offset,inc)'
+         write(*,*)'Value returned by he5_swmapinfo ',status
+         write(*,*)'Offset ',offset,' Increment ',inc
+         write(1,*)'status=he5_swmapinfo(swid,"GeoTrack","DataTrack", 
+     1offset,inc)'
+         write(1,*)'Value returned by he5_swmapinfo ',status
+         write(1,*)'Offset ',offset,' Increment ',inc
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swimapinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swimapinfo '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_swimapinfo '
+      write(1,*)'======================'
+      status4=he5_swimapinfo(swid2,'GeoXtrack','DataXtrack',idxmap)
+      if (status4 .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status4= he5_swimapinfo(swid2,"GeoXtrack",
+     1"DataXtrack", idxmap)'
+         write(*,*)'Value returned by he5_swimapinfo ',status4
+         do 980 index1=1,30
+            write(*,*)' Value of index array ',idxmap(index1)
+            write(1,*)' Value of index array ',idxmap(index1)
+  980    continue
+         write(1,*)'status4= he5_swimapinfo(swid2, "GeoXtrack", 
+     1"DataXtrack",idxmap)'
+         write(1,*)'Value returned by he5_swimapinfo ',status4
+         write(1,*)'Indexed map values ',idxmap
+      endif
+      write(*,*)' '
+      write(1,*)' '
+ 
+c Test Case -- he5_swinqattrs
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqattrs Global attributes '
+      write(*,*)'==================================== '
+      write(1,*)'Testing he5_swinqattrs Global attributes '
+      write(1,*)'==================================== '
+
+      nattr = he5_swinqattrs(swid,attrlist,strbufsz2)
+      if (nattr .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Number of global attributes in swath ',nattr
+         write(*,*)'Attribute list of swath ',attrlist
+         write(1,*)'Number of global attributes in swath ',nattr
+         write(1,*)'Attribute list of swath ',attrlist
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+c Test Case -- he5_swattrinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swattrinfo Global attribute'
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_swattrinfo Global attribute'
+      write(1,*)'======================================='
+      status= he5_swattrinfo(swid, attrlist, n, size)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swattrinfo(swid,attrlist,n,size)'
+         write(*,*)'Value returned by he5_swattrinfo ',status
+         write(*,*)'Number type of attributes ',n,' Size ',size
+         write(1,*)'status=he5_swattrinfo(swid,attrlist,n,size)'
+         write(1,*)'Value returned by he5_swattrinfo ',status
+         write(1,*)'Number type of attributes ',n,' Size ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swrdattr
+c
+      write(1,27)
+      write(*,*)'Testing he5_swrdattr, Global attribute '
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_swrdattr, Global attribute '
+      write(1,*)'======================================'
+
+      status= he5_swrdattr(swid, attrlist, rdattr)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swrdattr(swid,attrlist,rdattr)'
+         write(*,*)'Value returned by he5_swrdattr ',status
+         write(*,*)'attribute ',rdattr
+         write(1,*)'status=he5_swrdattr(swid,attrlist,rdattr)'
+         write(1,*)'Value returned by he5_swrdattr ',status
+         write(1,*)'attribute ',rdattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Test Case -- he5_swinqgattrs
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqgattrs Group attributes '
+      write(*,*)'==================================== '
+      write(1,*)'Testing he5_swinqgattrs Group attributes '
+      write(1,*)'==================================== '
+
+      nattr = he5_swinqgattrs(swid,attrlist,strbufsz2)
+      if (nattr .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Number of group attributes in swath ',nattr
+         write(*,*)'Attribute list of swath ',attrlist
+         write(1,*)'Number of group attributes in swath ',nattr
+         write(1,*)'Attribute list of swath ',attrlist
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+c Test Case -- he5_swgattrinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swgattrinfo Group attribute'
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_swgattrinfo Group attribute'
+      write(1,*)'======================================='
+      status= he5_swgattrinfo(swid, attrlist, n, size)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swgattrinfo(swid,attrlist,n,size)'
+         write(*,*)'Value returned by he5_swgattrinfo ',status
+         write(*,*)'Number type of attributes ',n,' Size ',size
+         write(1,*)'status=he5_swgattrinfo(swid,attrlist,n,size)'
+         write(1,*)'Value returned by he5_swgattrinfo ',status
+         write(1,*)'Number type of attributes ',n,' Size ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swrdgattr
+c
+      write(1,27)
+      write(*,*)'Testing he5_swrdgattr, Group attribute '
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_swrdgattr, Group attribute '
+      write(1,*)'======================================'
+
+       status= he5_swrdgattr(swid,'group',rdgnlattr)
+       if (status .lt. 0) then
+          write(*,230)
+          write(1,230)
+       else
+          write(*,*)'  '
+          write(*,240)
+          write(1,*)'  '
+          write(1,240)
+          write(*,*)'status=he5_swrdgattr(swid,attrlist,rdgnlattr)'
+          write(*,*)'Value returned by he5_swrdgattr ',status
+          write(*,*)'attribute ',rdgnlattr
+          write(1,*)'status=he5_swrdgattr(swid,attrlist,rdgnlattr)'
+          write(1,*)'Value returned by he5_swrdgattr ',status
+          write(1,*)'attribute ',rdgnlattr
+       endif
+       write(*,*)' '
+       write(1,*)' '
+
+c Test Case -- he5_swinqlattrs
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqlattrs Local attributes '
+      write(*,*)'==================================== '
+      write(1,*)'Testing he5_swinqlattrs Local attributes '
+      write(1,*)'==================================== '
+
+      nattr=he5_swinqlattrs(swid2,'Sensor1',attrlist,strbufsz2)
+      if (nattr .lt. 0) then
+         write(*,230)
+         write(1,230)         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swinqlattrs(... "Sensor1" ...)'
+         write(*,*)'Number of local attributes in field',nattr
+         write(*,*)'Attribute list of field ',attrlist
+         write(1,*)'swinqlattrs(... "Sensor1" ...)'
+         write(1,*)'Number of local attributes in field',nattr
+         write(1,*)'Attribute list of field ',attrlist
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+c Test Case -- he5_swlattrinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swlattrinfo Local attribute'
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_swlattrinfo Local attribute'
+      write(1,*)'======================================='
+      status=he5_swlattrinfo(swid2,'Sensor1','local',n,size)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swlattrinfo(... "Sensor1" ...)'
+         write(*,*)'Value returned by he5_swlattrinfo ',status
+         write(*,*)'Number type of attributes ',n,' Size ',size
+         write(1,*)'swlattrinfo(... "Sensor1" ...)'
+         write(1,*)'Value returned by he5_swlattrinfo ',status
+         write(1,*)'Number type of attributes ',n,' Size ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swidtype
+c
+      write(1,27)
+      write(*,*)'Testing he5_swidtype, Inquire Datatype '
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_swidtype, Inquire Datatype '
+      write(1,*)'======================================='
+
+      status= he5_swidtype(swid2,'Sensor1','local', 
+     1HE5_HDFE_LOCATTRGROUP,dtype,classid, order, size)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swidtype(swid2,"Sensor1","local", 
+     1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)'
+         write(*,*)'Value returned by he5_swidtype ',status
+         write(*,*)'Datatype of local attribute ',dtype
+         write(*,*)'Class id and order ',classid, order
+         write(*,*)'Size of attribute ',size
+         write(1,*)'status= he5_swidtype(swid2,"Sensor1","local", 
+     1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)'
+         write(1,*)'Value returned by he5_swidtype ',status
+         write(1,*)'Datatype of local attribute ',dtype
+         write(1,*)'Class id and order ',classid, order
+         write(1,*)'Size of attribute ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swrdlattr
+c
+      write(1,27)
+      write(*,*)'Testing he5_swrdlattr, Local attribute '
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_swrdlattr, Local attribute '
+      write(1,*)'======================================'
+
+      status=he5_swrdlattr(swid2,'Sensor1','local',rdgnlattr)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swrdlattr(swid2,"Sensor1","local", 
+     1rdgnlattr)'
+         write(*,*)'Value returned by he5_swrdlattr ',status
+         write(*,*)'attribute ',rdgnlattr
+         write(1,*)'status=he5_swrdlattr(swid2,"Sensor1","local", 
+     1rdgnlattr)'
+         write(1,*)'Value returned by he5_swrdlattr ',status
+         write(1,*)'attribute ',rdgnlattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swgetfill
+c
+      write(1,27)
+      write(*,*)'Testing he5_swgetfill '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swgetfill '
+      write(1,*)'====================='
+      status= he5_swgetfill(swid,'Conduction', rdfilval)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swgetfill(swid,"Conduction",rdfilval)'
+         write(*,*)'Value returned by he5_swgetfill ',status
+         write(*,*)'Value of fill ',rdfilval
+         write(1,*)'status=he5_swgetfill(swid,"Conduction",rdfilval)'
+         write(1,*)'Value returned by he5_swgetfill ',status
+         write(1,*)'Value of fill ',rdfilval
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdefboxreg
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefboxreg '
+      write(*,*)'======================='
+      write(1,*)'Testing he5_swdefboxreg '
+      write(1,*)'======================='
+
+      regionid= he5_swdefboxreg(swid, cornerlon, cornerlat, 
+     1HE5_HDFE_ENDPOINT)
+      if (regionid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'regionid= he5_swdefboxreg(swid,cornerlon,
+     1cornerlat, HE5_HDFE_ENDPOINT)'
+         write(*,*)'Value returned by he5_swdefboxreg ',regionid
+         write(1,*)'regionid= he5_swdefboxreg(swid, cornerlon, 
+     1cornerlat, HE5_HDFE_ENDPOINT)'
+         write(1,*)'Value returned by he5_swdefboxreg ',regionid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swregidx
+c
+      write(1,27)
+      write(*,*)'Testing he5_swregidx '
+      write(*,*)'===================='
+      write(1,*)'Testing he5_swregidx '
+      write(1,*)'===================='
+
+      idxrange(1)=0
+      idxrange(2)=0
+      regionid3=he5_swregidx(swid,cornerlon,cornerlat, 
+     1HE5_HDFE_ENDPOINT,geodim,idxrange)
+      if (regionid3 .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'regionid3=he5_swregidx(swid,cornerlon, 
+     1cornerlat,HE5_HDFE_ENDPOINT,geodim,idxrange)'
+         write(*,*)'Region ID returned by he5_swregdex ',regionid3
+         write(*,*)'Geodim of region ',geodim
+         write(*,*)'indicies of region ',idxrange(1),idxrange(2)
+         write(1,*)'regionid3=he5_swregidx(swid, cornerlon, 
+     1cornerlat, HE5_HDFE_ENDPOINT, geodim, idxrange)'
+         write(1,*)'Region ID returned by he5_swregdex ',regionid3
+         write(1,*)'Geodim of region ',geodim
+         write(1,*)'indicies of region ',idxrange(1),idxrange(2)
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swdupreg
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdupreg '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdupreg '
+      write(1,*)'====================='
+
+      regionid2= he5_swdupreg(regionid)
+      if (regionid2 .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Duplicate region id information '
+         write(*,*)'Region ID returned by he5_swdupreg ',regionid2
+         write(1,*)'Duplicate region id information '
+         write(1,*)'Region ID returned by he5_swdupreg ',regionid2
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+c Test Case -- he5_swreginfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swreginfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swreginfo '
+      write(1,*)'====================='
+      status=he5_swreginfo(swid,regionid,'Temperature',nt,rank, 
+     1dims,size)      
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swreginfo(swid,regionid,"Temperature", 
+     1nt, rank, dims, size)'
+         write(*,*)'Value returned by he5_swreginfo ',status
+         write(*,*)'Number type of region ',nt,' Rank of region ',rank
+         write(*,*)'Dimensions of region ',dims(1),' ',dims(2)
+         write(*,*)'Value of size ',size
+         write(1,*)'status=he5_swreginfo(swid,regionid,"Temperature", 
+     1nt, rank, dims, size)'
+         write(1,*)'Value returned by he5_swreginfo ',status
+         write(1,*)'Number type of region ',nt,' Rank of region ',rank
+         write(1,*)'Value of size ',size
+         write(1,*)'Dimensions of region ',dims(1),' ',dims(2)
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swextreg
+c
+      write(1,27)
+      write(*,*)'Testing he5_swextreg '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swextreg '
+      write(1,*)'====================='
+      status=he5_swextreg(swid,regionid,'Temperature', 
+     1HE5_HDFE_INTERNAL, tempbuf) 
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status = he5_swextreg(swid, regionid, 
+     1"Temperature", HE5_HDFE_INTERNAL, tempbuf)'
+         write(*,*)'Value returned by he5_swextreg ', status
+         write(1,*)'status = he5_swextreg(swid, regionid, 
+     1"Temperature", HE5_HDFE_INTERNAL,tempbuf)'
+         write(1,*)'Value returned by he5_swextreg ', status
+         do 210 index1=100,115
+            write(*,*)'region value at position ',tempbuf(index1)
+            write(1,*)'region value at position ',tempbuf(index1)
+  210    continue
+      endif
+
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdeftmeper
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdeftmeper '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdeftmeper '
+      write(1,*)'====================='
+      regionid = he5_swdeftmeper(swid, starttime, endtime, 
+     1HE5_HDFE_ENDPOINT)
+      if (regionid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'regionid= he5_swdeftmeper(swid, starttime, 
+     1endtime, HE5_HDFE_ENDPOINT)'
+         write(*,*)'Value returned by he5_swdeftmeper ',regionid
+         write(1,*)'regionid= he5_swdeftmeper(swid, starttime, 
+     1endtime, HE5_HDFE_ENDPOINT)'
+         write(1,*)'Value returned by he5_swdeftmeper ',regionid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swperinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swperinfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swperinfo '
+      write(1,*)'====================='
+      status = he5_swperinfo(swid,regionid,'Temperature',nt,rank,
+     1dims,size)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status = he5_swperinfo(swid, regionid,
+     1"Temperature",nt, rank, dims, size)'
+         write(*,*)'Value returned by he5_swperinfo ',status
+         write(*,*)'Rank of field ',rank,' Number type of region ',nt
+         write(*,*)'Dimensions of region ',dims(1),' ',dims(2)
+         write(*,*)'Value of size ',size
+         write(1,*)'status = he5_swperinfo(swid, regionid,
+     1"Temperature",nt, rank, dims, size)'
+         write(1,*)'Value returned by he5_swperinfo ',status
+         write(1,*)'Rank of field ',rank,' Number type of region ',nt
+         write(1,*)'Dimensions of region ',dims(1),' ',dims(2)
+         write(1,*)'Value of size ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swextper
+c
+      write(1,27)
+      write(*,*)'Testing he5_swextper '
+      write(*,*)'===================='
+      write(1,*)'Testing he5_swextper '
+      write(1,*)'===================='
+      status= he5_swextper(swid,regionid,'Temperature', 
+     1HE5_HDFE_INTERNAL,tempbuf)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swextper(swid, regionid, 
+     1"Temperature", HE5_HDFE_INTERNAL, tempbuf)'
+         write(*,*)'Value returned by he5_swextper swath ',status
+         write(1,*)'status= he5_swextper(swid, regionid, 
+     1"Temperature", HE5_HDFE_INTERNAL, tempbuf) '
+         write(1,*)'Value returned by he5_swextper swath ',status
+         do 220 index1=1000,1015
+            write(*,*)'region value at position ',tempbuf(index1)
+            write(1,*)'region value at position ',tempbuf(index1)
+  220    continue
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swupimap
+c
+      write(1,27)
+      write(*,*)'Testing he5_swupimap '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swupimap '
+      write(1,*)'====================='
+      idxsz=he5_swupimap(swid2,regionid,idxmap,upidxmap,ndxmap)
+      if (idxsz .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Size of index array in region ',idxsz
+         write(1,*)'Size of index array in region ',idxsz
+         write(*,*)'Indicies of updated index ',ndxmap(1),ndxmap(2)
+         write(1,*)'Indicies of updated index ',ndxmap(1),ndxmap(2)
+         do 380 index1=1,idxsz
+            write(*,*)' Value of index array ',upidxmap(index1)
+            write(1,*)' Value of index array ',upidxmap(index1)
+  380    continue
+      endif
+
+
+
+c Test Case -- he5_swcompinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swcompinfo '
+      write(*,*)'======================='
+      write(1,*)'Testing he5_swcompinfo '
+      write(1,*)'======================='
+      status=he5_swcompinfo(swid,'CompChunk',compcode,rdcompparm)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swcompinfo(swid,"CompChunk",compcode, 
+     1rdcompparm)'
+         write(*,*)'Status returned by he5_swcompinfo ',status
+         write(*,*)'Compression code ',compcode
+         write(*,*)'Compression parameter ',rdcompparm(1)
+         write(1,*)'status=he5_swcompinfo(swid,"CompChunk",compcode, 
+     1rdcompparm)'
+         write(1,*)'Status returned by he5_swcompinfo ',status
+         write(1,*)'Compression code ',compcode
+         write(1,*)'Compression parameter ',rdcompparm(1)
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+
+      status= he5_swdetach(swid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swdetach(swid2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid2)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid2)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swclose(swfid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swclose(swfid)'
+         write(*,*)'Value returned by he5_swclose ',status
+         write(1,*)'status= he5_swclose(swfid)'
+         write(1,*)'Value returned by he5_swclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      swfid=he5_swopen('swath.he5',HE5F_ACC_RDWR)
+      if (swfid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swfid=he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_swopen ',swfid
+         write(1,*)'swfid=he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_swopen ',swfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swinqswath
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqswath '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_swinqswath '
+      write(1,*)'======================'
+
+      nswath=he5_swinqswath('swath.he5',swathlist,strbufsz2)
+      if (nswath .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Retrieve information on swaths in 
+     1file swath.he5'
+         write(*,*)'Number of swaths in file ', nswath
+         write(*,*)'List of swaths ',swathlist
+         write(1,*)'Retrieve information on swaths in 
+     1file swath.he5'
+         write(1,*)'Number of swaths in file ', nswath
+         write(1,*)'List of swaths ',swathlist
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swclose(swfid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)       
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swclose(swfid)'
+         write(*,*)'Value returned by he5_swclose ',status
+         write(1,*)'status= he5_swclose(swfid)'
+         write(1,*)'Value returned by he5_swclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      close(unit=1)
+   27 format(' ')
+      stop
+      end
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/swath/testswath64.f b/testdrivers/swath/testswath64.f
new file mode 100755
index 0000000..ee6c12f
--- /dev/null
+++ b/testdrivers/swath/testswath64.f
@@ -0,0 +1,2771 @@
+c----------------------------------------------------------------------------
+c     Copyright (C) 2000   Emergent IT Inc. and Raytheon Systems Company    |
+c----------------------------------------------------------------------------
+c testswath64.f                                                             |
+c In this program we create, define and write a simple swath hdfeos file    |
+c using the swath interface                                                 |
+c----------------------------------------------------------------------------
+
+      program   testswath64
+ 
+      implicit  none
+ 
+      include   'hdfeos5.inc'
+ 
+      integer   status
+      integer   index1
+      integer   index2
+      integer   swfid
+      integer   swid
+      integer   swid2
+      integer   rank
+      integer   n, nt
+      integer   dtype
+      integer   classid
+      integer   order
+      integer   rdattr(4)
+      integer   global_attr(4)
+      integer   compparm(5)
+      integer   cnkrank
+      integer   rdcompparm(5)
+      integer   compcode
+      integer   regionid
+      integer   regionid2
+      integer   regionid3
+      integer   ntype(5)
+      integer   rnk(5)
+      integer   ntyped(5)
+      integer   rnkd(5)
+
+      integer   he5_swopen
+      integer   he5_swcreate
+      integer   he5_swattach
+      integer   he5_swdefdim
+      integer   he5_swdefgfld
+      integer   he5_swdefdfld
+      integer   he5_swdefmap
+      integer   he5_swdefchunk
+      integer   he5_swdefcomp
+      integer   he5_swsetfill
+      integer   he5_swwrattr
+      integer   he5_swdefimap
+      integer   he5_swwrlattr
+      integer   he5_swwrfld
+      integer   he5_swrdfld
+      integer   he5_swwrgattr
+      integer   he5_swrdattr
+      integer   he5_swrdgattr
+      integer   he5_swrdlattr
+      integer   he5_swdefvrtreg
+      integer   he5_swdefboxreg
+      integer   he5_swdeftmeper
+      integer   he5_swgmapinfo
+      integer   he5_swfldinfo 
+      integer   he5_swcompinfo
+      integer   he5_swmapinfo
+      integer   he5_swattrinfo
+      integer   he5_swgattrinfo
+      integer   he5_swreginfo
+      integer   he5_swextreg
+      integer   he5_swregidx
+      integer   he5_swperinfo
+      integer   he5_swextper
+      integer   he5_swlattrinfo
+      integer   he5_swgetfill
+      integer   he5_swidtype
+      integer   he5_swdupreg
+      integer   he5_swdetach
+      integer   he5_swclose 
+
+      integer*8 he5_swupimap
+      integer*8 he5_swinqswath
+      integer*8 he5_swnentries
+      integer*8 he5_swinqmaps
+      integer*8 he5_swinqimaps
+      integer*8 he5_swinqdims
+      integer*8 he5_swdiminfo
+      integer*8 he5_swimapinfo
+      integer*8 he5_swinqattrs
+      integer*8 he5_swinqgattrs
+      integer*8 he5_swinqlattrs
+      integer*8 he5_swinqgflds
+      integer*8 he5_swinqdflds
+      integer*8 size
+      integer*8 strbufsize
+      integer*8 ndims
+      integer*8 chunkdims(1)
+      integer*8 start(2)
+      integer*8 stride(2)
+      integer*8 dataedge(2)
+      integer*8 geoedge(2)
+      integer*8 geostart(2)
+      integer*8 istart(2)
+      integer*8 iedge(2)
+      integer*8 dedge(2)
+      integer*8 sd_start(2)
+      integer*8 sd_stride(2)
+      integer*8 sd_edge(2)
+      integer*8 rd_start(2)
+      integer*8 rd_stride(2)
+      integer*8 rd_edge(2)
+      integer*8 indexmap(30)
+      integer*8 dimsize
+      integer*8 nattr
+      integer*8 nswath
+      integer*8 idxsz
+      integer*8 nmaps
+      integer*8 tstart(1)
+      integer*8 tstride(1)
+      integer*8 tedge(1)
+      integer*8 strbufsz2
+      integer*8 nflds
+      integer*8 idxrange(2)
+      integer*8 count(1)
+      integer*8 offset
+      integer*8 inc
+      integer*8 status4
+      integer*8 zero
+      integer*8 ndxmap(2)
+      integer*8 dims(5)
+      integer*8 latdims(2)
+      integer*8 upidxmap(50)
+      integer*8 idxmap(50)
+      integer*8 dim1
+      integer*8 dim2
+      integer*8 dim3
+      integer*8 dim4
+
+      real      grpattr(3)
+      real      locattr(3)
+      real      rdgnlattr(3)
+      real      ray1(100,40)
+      real      ray2(40,100)
+      real      lat(40,50)
+      real      lon(40,50)
+      real      ray4(40,100)
+      real      ray3(40,40)
+      real      temp(40,100)
+      real      idxlat(30,30)
+      real      idxlon(30,30)
+      real      latcnt
+      real      loncnt
+      real      raycnt
+      real      idxlatcnt
+      real      idxloncnt	
+      real      fillvalue
+      real      rdfilval
+      real      tempbuf(4200)
+
+      real*8    cornerlon(2)
+      real*8    cornerlat(2)
+      real*8    twodtime(40,50)
+      real*8    onedtime(40)
+      real*8    range(2)
+      real*8    tmcnt
+      real*8    starttime
+      real*8    endtime
+
+      character*(256)  geodim
+      character*(256)  idxdimmap
+      character*(256)  dimmap
+      character*(256)  dimname
+      character*(256)  fieldlist
+      character*(256)  attrlist
+      character*(256)  swathlist
+      character*(256)  dimens
+      character*(256)  maxdims
+
+      dim1          = 30
+      dim2          = 40
+      dim3          = 50
+      dim4          = 100
+      count(1)      = 3
+      compparm(1)   = 6
+      compparm(2)   = 0
+      compparm(3)   = 0
+      compparm(4)   = 0
+      compparm(5)   = 0
+      cnkrank       = 1
+      chunkdims(1)  = 10
+      rdcompparm(1) = 1
+      rdcompparm(2) = 1
+      rdcompparm(3) = 1
+      rdcompparm(4) = 1
+      rdcompparm(5) = 1
+      compcode      = -1
+      raycnt        = -799.0
+      tmcnt         = 46353400.0d0
+      starttime     = 46353450.0d0
+      endtime       = 46500000.0d0
+      range(1)      = 46353450.0d0
+      range(2)      = 46500000.0d0
+      latcnt        = 39.8
+      loncnt        = 78.0
+      global_attr(1)= 11
+      global_attr(2)= 33
+      global_attr(3)= 66
+      global_attr(4)= 99
+      grpattr(1)    = 21.7
+      grpattr(2)    = 24.3
+      grpattr(3)    = 26.3
+      locattr(3)    = 21.7
+      locattr(2)    = 24.3
+      locattr(1)    = 26.3
+      start(1)      = 10
+      start(2)      = 10
+      tstart(1)     = 0
+      tstride(1)    = 1
+      tedge(1)      = 40
+      geostart(1)   = 0
+      geostart(2)   = 0 
+      stride(1)     = 1
+      stride(2)     = 1
+      sd_start(1)   = 0
+      sd_start(2)   = 0
+      sd_stride(1)  = 1
+      sd_stride(2)  = 1
+      sd_edge(1)    = 100
+      sd_edge(2)    = 40
+      rd_start(1)   = 0
+      rd_start(2)   = 0
+      rd_stride(1)  = 1
+      rd_stride(2)  = 1
+      rd_edge(1)    = 40
+      rd_edge(2)    = 100
+      dataedge(1)   = 20
+      dataedge(2)   = 50
+      geoedge(1)    = 40
+      geoedge(2)    = 50
+      idxlatcnt     = 39.8
+      idxloncnt     = 78.0
+      istart(1)     = 0
+      istart(2)     = 0
+      iedge(1)      = 30
+      iedge(2)      = 30
+      dedge(1)      = 40
+      dedge(2)      = 40
+      rank          = 2
+      fillvalue     = 16.0
+      cornerlon(1)  = 75.0
+      cornerlon(2)  = 78.0
+      cornerlat(1)  = 38.0
+      cornerlat(2)  = 39.8
+      indexmap(1)   = 1
+      indexmap(2)   = 2
+      indexmap(3)   = 3
+      indexmap(4)   = 4
+      indexmap(5)   = 6
+      indexmap(6)   = 7
+      indexmap(7)   = 8
+      indexmap(8)   = 9
+      indexmap(9)   = 11
+      indexmap(10)  = 12
+      indexmap(11)  = 13
+      indexmap(12)  = 14
+      indexmap(13)  = 16
+      indexmap(14)  = 17
+      indexmap(15)  = 18
+      indexmap(16)  = 19
+      indexmap(17)  = 21
+      indexmap(18)  = 22
+      indexmap(19)  = 23
+      indexmap(20)  = 24
+      indexmap(21)  = 26
+      indexmap(22)  = 27
+      indexmap(23)  = 28
+      indexmap(24)  = 29
+      indexmap(25)  = 31
+      indexmap(26)  = 32
+      indexmap(27)  = 33
+      indexmap(28)  = 34
+      indexmap(29)  = 36
+      indexmap(30)  = 37
+      zero          = 0
+
+c
+c This section of the program just fills some arrays with data that will be
+c used later in the program
+c
+      do 110 index1=1,100
+         do 100 index2=1,40
+            ray1(index1, index2)=raycnt
+            ray2(index2, index1)=raycnt + 1.0
+            ray4(index2,index1) = raycnt
+            raycnt = raycnt +1.
+  100    continue
+  110 continue
+
+      do 130 index1=1,40
+         do 120 index2=1,50
+            lat(index1, index2)=latcnt
+            lon(index1, index2)=loncnt
+            twodtime(index1,index2)=tmcnt
+            loncnt=loncnt-.1
+            tmcnt=tmcnt+5.0
+  120    continue
+         onedtime(index1)=tmcnt
+         latcnt=latcnt-0.1
+         loncnt = 78.0
+  130 continue
+
+      do 150 index1=1,30
+         do 140 index2=1,30
+            idxlat(index1, index2)=idxlatcnt
+            idxlon(index1, index2)=idxloncnt
+            idxloncnt=idxloncnt-.1
+  140    continue
+         idxlatcnt=idxlatcnt-.1
+         idxloncnt=78.0
+  150 continue
+
+
+      do 170 index1=1,40
+         do 160 index2=1,40
+            ray3(index1, index2)=raycnt
+            raycnt = raycnt+1.25
+  160    continue
+  170 continue
+
+      do 987 index1=1,50
+         idxmap(index1)=zero
+         upidxmap(index1)=zero
+  987 continue
+
+  230 format('********Error unexpected**********')
+  240 format('***********Passed Test*********')
+
+      open(unit=1, file="testswath.txt", status = "UNKNOWN")
+
+      write(*,*)'Testing he5_swath FORTRAN 77 interface'
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_swath FORTRAN 77 interface'
+      write(1,*)'======================================'
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swopen
+c
+      write(*,*)'Testing he5_swopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swopen '
+      write(1,*)'====================='
+      swfid=he5_swopen('swath.he5',HE5F_ACC_TRUNC)
+      if (swfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	swfid= he5_swopen("swath.he5",HE5F_ACC_TRUNC)'
+         write(*,*)'	Value returned by he5_swopen ', swfid
+         write(1,*)'	swfid= he5_swopen("swath.he5",HE5F_ACC_TRUNC)'
+         write(1,*)'	Value returned by he5_swopen ', swfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swcreate
+c
+      write(1,27)
+      write(*,*)'Testing he5_swcreate '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swcreate '
+      write(1,*)'====================='
+      swid=he5_swcreate(swfid,'Simplef')
+      if (swid .lt. zero) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid=he5_swcreate(swfid, "Simplef")'
+         write(*,*)'Value returned by he5_swcreate ', swid
+         write(1,*)'swid= he5_swcreate(swfid, "Simplef")'
+         write(1,*)'Value returned by he5_swcreate ', swid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      swid2=he5_swcreate(swfid,'Indexedf')
+      if (swid2 .lt. zero) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid2= he5_swcreate(swfid, "Indexedf")'
+         write(*,*)'Value returned by he5_swcreate ', swid2
+         write(1,*)'swid2= he5_swcreate(swfid, "Indexedf")'
+         write(1,*)'Value returned by he5_swcreate ', swid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swdefdim
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefdim '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdefdim '
+      write(1,*)'====================='
+      status=he5_swdefdim(swid,'DataTrack',dim4)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid, "DataTrack", 100)'
+         write(*,*)'	Value returned by he5_swdefdim ',status
+         write(1,*)'	status= he5_swdefdim(swid, "DataTrack", 100)'
+         write(1,*)'	Value returned by he5_swdefdim ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid,'DataXtrack',dim2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid, "DataXtrack", 40)'
+         write(*,*)'	Value returned by he5_swdefdim ',status
+         write(1,*)'	status= he5_swdefdim(swid, "DataXtrack", 40)'
+         write(1,*)'	Value returned by he5_swdefdim ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid,'GeoTrack',dim3) 
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid, "GeoTrack", 50)'
+         write(*,*)'	Value returned by he5_swdefdim ',status
+         write(1,*)'	status= he5_swdefdim(swid, "GeoTrack", 50)'
+         write(1,*)'	Value returned by he5_swdefdim ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid,'GeoXtrack',dim2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid, "GeoXtrack", 40)'
+         write(*,*)'	Value returned by he5_swdefdim ',status
+         write(1,*)'	status= he5_swdefdim(swid, "GeoXtrack", 40)'
+         write(1,*)'	Value returned by he5_swdefdim ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid2,'DataTrack',dim2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid2, "DataTrack", 40)'
+         write(*,*)'	Value returned by he5_swdefdim ', status
+         write(1,*)'	status= he5_swdefdim(swid2, "DataTrack", 40)'
+         write(1,*)'	Value returned by he5_swdefdim ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid2,'DataXtrack',dim2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid2, "DataXtrack", 40)'
+         write(*,*)'	Value returned by he5_swdefdim ', status
+         write(1,*)'	status= he5_swdefdim(swid2, "DataXtrack", 40)'
+         write(1,*)'	Value returned by he5_swdefdim ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid2,'GeoTrack',dim1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid2, "GeoTrack", 30)'
+         write(*,*)'	Value returned by he5_swdefdim ', status
+         write(1,*)'	status= he5_swdefdim(swid2, "GeoTrack", 30)'
+         write(1,*)'	Value returned by he5_swdefdim ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid2,'GeoXtrack',dim1)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_swdefdim(swid2, "GeoXtrack", 30)'
+         write(*,*)'	Value returned by he5_swdefdim ', status
+         write(1,*)'	status= he5_swdefdim(swid2, "GeoXtrack", 30)'
+         write(1,*)'	Value returned by he5_swdefdim ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdim(swid2,'Timedim',dim2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define dimension Timedim '
+         write(*,*)'	Value returned by he5_swdefdim ', status
+         write(1,*)'Define dimension Timedim '
+         write(1,*)'	Value returned by he5_swdefdim ', status
+      endif
+
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdefgfld
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefgfld '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdefgfld '
+      write(1,*)'====================='
+      status=he5_swdefgfld(swid,'Latitude','GeoXtrack,GeoTrack',
+     1' ',HE5T_NATIVE_FLOAT,0)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdefgfld(swid,"Latitude",
+     1"GeoXtrack,GeoTrack"," ", HE5T_NATIVE_FLOAT, 0)'
+         write(1,*)'status= he5_swdefgfld(swid,"Latitude",
+     1"GeoXtrack,GeoTrack"," ", HE5T_NATIVE_FLOAT, 0)'
+         write(1,*)'Value returned by he5_swdefgfld ',status
+         write(*,*)'Value returned by he5_swdefgfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefgfld(swid,'Longitude','GeoXtrack,GeoTrack',
+     1' ',HE5T_NATIVE_FLOAT, 0)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Value returned by he5_swdefgfld ',status
+         write(1,*)'Value returned by he5_swdefgfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefgfld(swid2,'Latitude','GeoXtrack,GeoTrack',
+     1' ',HE5T_NATIVE_FLOAT, 0)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Value returned by he5_swdefgfld ', status
+         write(1,*)'Value returned by he5_swdefgfld ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefgfld(swid2,'Longitude','GeoXtrack,GeoTrack',
+     1' ',HE5T_NATIVE_FLOAT, 0)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Value returned by he5_swdefgfld ', status
+         write(1,*)'Value returned by he5_swdefgfld ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefgfld(swid2,'Time','Timedim',' ',
+     1HE5T_NATIVE_DOUBLE, 0)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define field Time for swath Indexedf '
+         write(*,*)'Status returned from call to he5_swdefgfld ',status
+         write(1,*)'Define field Time for swath Indexedf '
+         write(1,*)'Status returned from call to he5_swdefgfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefgfld(swid,'Time','GeoXtrack,GeoTrack',
+     1' ', HE5T_NATIVE_DOUBLE, 0)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdefgfld(swid, "Time","GeoXtrack,GeoTrack",
+     1"",HE5T_NATIVE_DOUBLE, 0)'
+         write(*,*)'Value returned by he5_swdefgfld ',status
+         write(1,*)'status= he5_swdefgfld(swid, "Time","GeoXtrack,GeoTrack",
+     1"",HE5T_NATIVE_DOUBLE, 0)'
+         write(1,*)'Value returned by he5_swdefgfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdefdfld
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefdfld '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdefdfld '
+      write(1,*)'====================='
+
+      status=he5_swdefdfld(swid,'SideA','DataXtrack,DataTrack',
+     1' ', HE5T_NATIVE_FLOAT, 0)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+        
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define data field SideA '
+         write(*,*)'Value returned by he5_swdefdfld ',status
+         write(1,*)'Define data field SideA '
+         write(1,*)'Value returned by he5_swdefdfld ',status
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+c Test Case  -- he5_swsetfill
+c
+      write(1,27)
+      write(*,*)'Testing he5_swsetfill '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swsetfill '
+      write(1,*)'====================='
+      status= he5_swsetfill(swid,'Temperature',
+     1HE5T_NATIVE_FLOAT, fillvalue)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swsetfill(swid,"Temperature",
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(*,*)'Value returned by he5_swsetfill ',status
+         write(1,*)'status=he5_swsetfill(swid,"Temperature",
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(1,*)'Value returned by he5_swsetfill ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdfld(swid,'Temperature',
+     1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT, 0)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define data field Temperature '
+         write(*,*)'Value returned by he5_swdefdfld ',status
+         write(1,*)'Define data field Temperature '
+         write(1,*)'Value returned by he5_swdefdfld ',status
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+      status= he5_swsetfill(swid,'Conduction',
+     1HE5T_NATIVE_FLOAT,fillvalue)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swsetfill(swid,"Conduction",
+     1HE5T_NATIVE_FLOAT,fillvalue)'
+         write(*,*)'Value returned by he5_swsetfill ',status
+         write(1,*)'status=he5_swsetfill(swid,"Conduction",
+     1HE5T_NATIVE_FLOAT,fillvalue)'
+         write(1,*)'Value returned by he5_swsetfill ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdfld(swid,'Conduction',
+     1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT,0)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdefdfld(swid,"Conduction",
+     1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT, 0)'
+         write(*,*)'Value returned by he5_swdefdfld ',status
+         write(1,*)'status= he5_swdefdfld(swid,"Conduction",
+     1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT, 0)'
+         write(1,*)'Value returned by he5_swdefdfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefdfld(swid2,'Sensor1',
+     1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT, 0)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swdefdfld(swid2, "Sensor1",
+     1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT, 0)'
+         write(*,*)'Value returned by he5_swdefdfld ',status
+         write(1,*)'status= he5_swdefdfld(swid2, "Sensor1",
+     1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT, 0)'
+         write(1,*)'Value returned by he5_swdefdfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdefchunk
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefchunk'
+      write(*,*)'======================'
+      write(1,*)'Testing he5_swdefchunk'
+      write(1,*)'======================'
+      status=he5_swdefchunk(swid,cnkrank,chunkdims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdefchunk(swid, cnkrank, chunkdims)'
+         write(*,*)'Value returned by he5_swdefchunk ',status
+         write(1,*)'status= he5_swdefchunk(swid, cnkrank, chunkdims)'
+         write(1,*)'Value returned by he5_swdefchunk ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+    
+c Test Case -- he5_swdefcomp
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefcomp'
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdefcomp'
+      write(1,*)'====================='
+      status=he5_swdefcomp(swid,HE5_HDFE_COMP_DEFLATE,compparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdefcomp(swid,HE5_HDFE_COMP_DEFLATE,
+     1compparm)'
+         write(*,*)'Value returned by he5_swdefcomp ',status
+         write(1,*)'status= he5_swdefcomp(swid,HE5_HDFE_COMP_DEFLATE,
+     1compparm)'
+         write(1,*)'Value returned by he5_swdefcomp ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      status=he5_swdefdfld(swid,'CompChunk','GeoTrack',
+     1' ',HE5T_NATIVE_FLOAT, 0)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230) 
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define data field CompChunk '
+         write(*,*)'Value returned by he5_swdefdfld ',status
+         write(1,*)'Define data field CompChunk '
+         write(1,*)'Value returned by he5_swdefdfld ',status
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+c Test Case -- he5_swdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdetach '
+      write(1,*)'====================='
+      status=he5_swdetach(swid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdetach(swid2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid2)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid2)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      swid=he5_swattach(swfid,'Simplef')
+      if (swid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(*,*)'Value returned by he5_swattach ',swid
+         write(1,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(1,*)'Value returned by he5_swattach ',swid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      swid2=he5_swattach(swfid,'Indexedf')
+      if (swid2 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid2= he5_swattach(swfid, "Indexedf")'
+         write(*,*)'Value returned by he5_swattach ',swid2
+         write(1,*)'swid2= he5_swattach(swfid, "Indexedf")'
+         write(1,*)'Value returned by he5_swattach ',swid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdefmap
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefmap '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdefmap '
+      write(1,*)'====================='
+      offset = 0
+      inc    = 2
+      status=he5_swdefmap(swid,'GeoTrack','DataTrack',
+     1offset,inc)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdefmap(swid,"GeoTrack",
+     1"DataTrack", offset, inc)'
+         write(*,*)'Value returned by he5_swdefmap ',status
+         write(1,*)'status= he5_swdefmap(swid,"GeoTrack",
+     1"DataTrack", offset, inc)'
+         write(1,*)'Value returned by he5_swdefmap ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdefimap
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefimap '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdefimap '
+      write(1,*)'====================='
+      status=he5_swdefimap(swid2,'GeoTrack','DataTrack',indexmap)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdefimap(swid2, "GeoTrack", 
+     1"DataTrack",indexmap)'
+         write(*,*)'Value returned by he5_swdefimap ',status
+         write(1,*)'status= he5_swdefimap(swid2, "GeoTrack",
+     1"DataTrack",indexmap)'
+         write(1,*)'Value returned by he5_swdefimap ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swdefimap(swid2,'GeoXtrack','DataXtrack',
+     1indexmap)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swdefimap(swid2, "GeoXtrack",
+     1"DataXtrack",indexmap)'
+         write(*,*)'Value returned by he5_swdefimap ',status
+         write(1,*)'status=he5_swdefimap(swid2, "GeoXtrack",
+     1"DataXtrack",indexmap)'
+         write(1,*)'Value returned by he5_swdefimap ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swdetach
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdetach '
+      write(1,*)'====================='
+      status= he5_swdetach(swid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swdetach(swid2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid2)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid2)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swclose(swfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)       
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swclose(swfid)'
+         write(*,*)'Value returned by he5_swclose ',status
+         write(1,*)'status= he5_swclose(swfid)'
+         write(1,*)'Value returned by he5_swclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      swfid=he5_swopen('swath.he5',HE5F_ACC_RDWR)
+      if (swfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swfid=he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_swopen ',swfid
+         write(1,*)'swfid=he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_swopen ',swfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+ 
+c Test Case -- he5_swattach
+c
+      write(1,27)
+      write(*,*)'Testing he5_swattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swattach '
+      write(1,*)'====================='
+
+      swid=he5_swattach(swfid,'Simplef')
+      if (swid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(*,*)'Value returned by he5_swattach ',swid
+         write(1,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(1,*)'Value returned by he5_swattach ',swid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      swid2=he5_swattach(swfid,'Indexedf')
+      if (swid2 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid2= he5_swattach(swfid, "Indexedf")'
+         write(*,*)'Value returned by he5_swattach ',swid2
+         write(1,*)'swid2= he5_swattach(swfid, "Indexedf")'
+         write(1,*)'Value returned by he5_swattach ',swid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swwrfld
+c
+      write(1,27)
+      write(*,*)'Testing he5_swwrfld '
+      write(*,*)'==================='
+      write(1,*)'Testing he5_swwrfld '
+      write(1,*)'==================='
+
+      status=he5_swwrfld(swid,'SideA',sd_start,stride, 
+     1rd_edge, ray4)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Write data field SideA '
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'Write data field SideA '
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid,'Temperature',start,stride, 
+     1dataedge, ray4)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swwrfld(swid,"Temperature",start, 
+     1stride,dataedge, ray1)'
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'status=he5_swwrfld(swid,"Temperature",start, 
+     1stride,dataedge, ray1)'
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid,'Conduction',start,stride, 
+     1dataedge, ray2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swwrfld(swid,"Conduction",start, 
+     1stride,dataedge, ray2)'
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'status=he5_swwrfld(swid,"Conduction",start, 
+     1stride,dataedge, ray2)'
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid,'Latitude',geostart,stride,
+     1geoedge,lat)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swwrfld(swid, "Latitude", geostart, 
+     1stride, geoedge, lat)'
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'status= he5_swwrfld(swid, "Latitude", geostart, 
+     1stride, geoedge, lat)'
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid,'Longitude',geostart,stride, 
+     1geoedge,lon)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swwrfld(swid,"Longitude",geostart,
+     1stride,geoedge, lon)'
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'status= he5_swwrfld(swid,"Longitude",geostart,
+     1stride,geoedge, lon)'
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid,'Time',geostart,stride,geoedge,
+     1twodtime)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swwrfld(swid,"Time",geostart,stride, 
+     1geoedge, twodtime)'
+         write(*,*)'Value returned by he5_swwrfld for Time ',status
+         write(1,*)'status= he5_swwrfld(swid, "Time", geostart, stride, 
+     1geoedge, twodtime)'
+         write(1,*)'Value returned by he5_swwrfld for Time ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid2,'Latitude',istart,stride,
+     1iedge,idxlat)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)       
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swwrfld(swid2,"Latitude", 
+     1istart,stride,iedge,idxlat)'
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'status= he5_swwrfld(swid2,"Latitude",
+     1istart,stride,iedge,lat)'
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid2,'Longitude',istart,stride, 
+     1iedge,idxlon)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swwrfld(swid2,"Longitude", 
+     1istart,stride,iedge,idxlon)'
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'status= he5_swwrfld(swid2,"Longitude",
+     1istart,stride,iedge,idxlon)'
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_swwrfld(swid2,'Time',tstart,tstride,
+     1tedge,onedtime)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Write field Time '
+         write(*,*)'Status returned by he5_swwrfld ',status
+         write(1,*)'Write field Time '
+         write(1,*)'Status returned by he5_swwrfld ',status
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+      iedge(1)=40
+      iedge(2)=40
+      status=he5_swwrfld(swid2,'Sensor1',istart,stride, 
+     1iedge,ray3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swwrfld(swid2, "Sensor1", 
+     1istart, stride, iedge, ray3)'
+         write(*,*)'Value returned by he5_swwrfld ',status
+         write(1,*)'status= he5_swwrfld(swid2, "Sensor1", 
+     1istart, stride, iedge, ray3)'
+         write(1,*)'Value returned by he5_swwrfld ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swwrlattr
+c
+      write(1,27)
+      write(*,*)'Testing he5_swwrlattr, Local Attribute '
+      write(*,*)'================================== '
+      write(1,*)'Testing he5_swwrlattr, Local Attribute '
+      write(1,*)'================================== '
+      status=he5_swwrlattr(swid2,'Sensor1','local',
+     1HE5T_NATIVE_FLOAT,count,locattr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swwrlattr(swid2,"Sensor1","local",
+     1HE5T_NATIVE_FLOAT,count,locattr)'
+         write(*,*)'Value returned by he5_swwrlattr ',status
+         write(1,*)'status=he5_swwrlattr(swid2,"Sensor1", "local", 
+     1HE5T_NATIVE_FLOAT,count,locattr)'
+         write(1,*)'Value returned by he5_swwrlattr ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swwrattr
+c
+      count(1) = 4
+
+      write(1,27)
+      write(*,*)'Testing he5_swwrattr, Global Attribute '
+      write(*,*)'====================================== '
+      write(1,*)'Testing he5_swwrattr, Global Attribute '
+      write(1,*)'======================================= '
+      status=he5_swwrattr(swid,'Drift',HE5T_NATIVE_INT,count, 
+     1global_attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swwrattr(swid, "Drift", 
+     1HE5T_NATIVE_INT, count, global_attr)'
+         write(*,*)'Value returned by he5_swwrattr ',status
+         write(1,*)'status=he5_swwrattr(swid, "Drift", 
+     1HE5T_NATIVE_INT, count, global_attr)'
+         write(1,*)'Value returned by he5_swwrattr ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swwrgattr
+c
+      count(1) = 3
+     
+      write(1,27)
+      write(*,*)'Testing he5_swwrgattr, Group Attribute '
+      write(*,*)'====================================== '
+      write(1,*)'Testing he5_swwrgattr, Group Attribute '
+      write(1,*)'====================================== '
+      status=he5_swwrgattr(swid,'group',HE5T_NATIVE_FLOAT, 
+     1count,grpattr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swwrgattr(swid, "group", 
+     1HE5T_NATIVE_FLOAT,count,grpgattr)'
+         write(*,*)'Value returned by he5_swwrgattr ',status
+         write(1,*)'status=he5_swwrgattr(swid, "group", 
+     1HE5T_NATIVE_FLOAT,count,grpattr)'
+         write(1,*)'Value returned by he5_swwrgattr ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swdetach(swid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+      write(*,*)'status= he5_swdetach(swid)'
+      write(*,*)'Value returned by he5_swdetach ',status
+      write(1,*)'status= he5_swdetach(swid)'
+      write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swdetach(swid2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid2)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid2)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swclose
+c
+      write(1,27)
+      write(*,*)'Testing he5_swclose '
+      write(*,*)'==================='
+      write(1,*)'Testing he5_swclose '
+      write(1,*)'==================='
+      status= he5_swclose(swfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Value returned by he5_swclose ',status
+         write(1,*)'status= he5_swclose(swfid)'
+         write(1,*)'Value returned by he5_swclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      swfid= he5_swopen('swath.he5',HE5F_ACC_RDWR)
+      if (swfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_swopen ', swfid
+         write(1,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_swopen ', swfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      swid= he5_swattach(swfid,'Simplef')
+      if (swid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(*,*)'Value returned by he5_swattach ',swid
+         write(1,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(1,*)'Value returned by he5_swattach ',swid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swdetach(swid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swclose(swfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swclose(swfid)'
+         write(*,*)'Value returned by he5_swclose ',status
+         write(1,*)'status= he5_swclose(swfid)'
+         write(1,*)'Value returned by he5_swclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      swfid= he5_swopen('swath.he5',HE5F_ACC_RDWR)
+      if (swfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_swopen ',swfid
+         write(1,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_swopen ',swfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      swid=he5_swattach(swfid,'Simplef')
+      if (swid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(*,*)'Value returned by he5_swattach ',swid
+         write(1,*)'swid= he5_swattach(swfid, "Simplef")'
+         write(1,*)'Value returned by he5_swattach ',swid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      swid2=he5_swattach(swfid,'Indexedf')
+      if (swid2 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swid2= he5_swattach(swfid, "Indexedf")'
+         write(*,*)'Value returned by he5_swattach ',swid2
+         write(1,*)'swid2= he5_swattach(swfid, "Indexedf")'
+         write(1,*)'Value returned by he5_swattach ',swid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdefvrtreg
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefvrtreg'
+      write(*,*)'======================='
+      write(1,*)'Testing he5_swdefvrtreg'
+      write(1,*)'======================='
+
+      regionid=he5_swdefvrtreg(swid2,HE5_HDFE_NOPREVSUB,'Time',range)
+      if (regionid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define region id for field Time '
+         write(*,*)'Region id returned by he5_swdefvrtreg ',
+     1regionid
+         write(1,*)'Define region id for field Time '
+         write(1,*)'Region id returned by he5_swdefvrtreg ',
+     1regionid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swnentries
+c
+      write(1,27)
+      write(*,*)'Testing he5_swnentries '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swnentries '
+      write(1,*)'====================='
+
+      nmaps=he5_swnentries(swid,1,strbufsize)
+      if (nmaps .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'nmaps= he5_swnentries(swid, 1, strbufsize)'
+         write(*,*)'Number of dimension mappings ',nmaps
+         write(*,*)'Size of strbufsize ',strbufsize
+         write(1,*)'nmaps= he5_swnentries(swid, 1, strbufsize)'
+         write(1,*)'Number of dimension mappings ',nmaps
+         write(1,*)'Size of strbufsize ',strbufsize
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swinqmaps
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqmaps '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swinqmaps '
+      write(1,*)'====================='
+      offset = -1
+      inc    = -1
+      nmaps=he5_swinqmaps(swid, dimmap, offset, inc)
+      if (nmaps .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'nmaps=he5_swinqmaps(swid,dimmap,offset,inc)'
+         write(*,*)'Dimension mappings ',dimmap
+         write(*,*)'offset ',offset
+         write(*,*)'increment ',inc
+         write(1,*)'nmaps=he5_swinqmaps(swid,dimmap,offset,inc)'
+         write(1,*)'Dimension mappings ',dimmap
+         write(1,*)'offset ',offset
+         write(1,*)'increment ',inc
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swgmapinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swgmapinfo '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_swgmapinfo '
+      write(1,*)'======================'
+      status = he5_swgmapinfo(swid2,'GeoTrack')
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status = he5_swgmapinfo(swid2, "GeoTrack")'
+         write(1,*)'status = he5_swgmapinfo(swid2, "GeoTrack")'
+         write(*,*)'Status returned by he5_swgmapinfo ',status
+         write(1,*)'Status returned by he5_swgmapinfo ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swinqimaps
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqimaps '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swinqimaps '
+      write(1,*)'====================='
+      nmaps=he5_swinqimaps(swid2, idxdimmap, ndxmap)
+      if (nmaps .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'nmaps=he5_swinqimaps(swid2,idxdimmap,ndxmap)'
+         write(*,*)'Number of indexed mappings ',nmaps
+         write(*,*)'Indexed Dimension mappings ',idxdimmap
+         write(*,*)'Index size ',ndxmap
+         write(1,*)'nmaps=he5_swinqimaps(swid2,idxdimmap,ndxmap)'
+         write(1,*)'Number of indexed mappings ',nmaps
+         write(1,*)'Indexed Dimension mappings ',idxdimmap
+         write(1,*)'Index size ',ndxmap
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swinqdims
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqdims '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swinqdims '
+      write(1,*)'====================='
+      ndims=he5_swinqdims(swid,dimname,dims)
+      if (ndims .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'ndims= he5_swinqdims(swid, dimname, dims)'
+         write(*,*)'Number of dimesions ',ndims
+         write(*,*)'Names of dimensions ',dimname
+         write(*,*)'Size of dimensions ',dims
+         write(1,*)'ndims= he5_swinqdims(swid, dimname, dims)'
+         write(1,*)'Number of dimesions ',ndims
+         write(1,*)'Names of dimensions ',dimname
+         write(1,*)'Size of dimensions ',dims
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      ndims= he5_swinqdims(swid2, dimname, dims)
+      if (ndims .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'ndims=he5_swinqdims(swid2,dimname,dims)'
+         write(*,*)'Number of dimesions ',ndims
+         write(*,*)'Names of dimensions ',dimname
+         write(*,*)'Size of dimensions ',dims
+         write(1,*)'ndims=he5_swinqdims(swid2,dimname,dims)'
+         write(1,*)'Number of dimesions ',ndims
+         write(1,*)'Names of dimensions ',dimname
+         write(1,*)'Size of dimensions ',dims
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swinqgflds
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqgflds '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_swinqgflds '
+      write(1,*)'======================'
+
+      nflds= he5_swinqgflds(swid,fieldlist,rnk,ntype)
+      if (nflds .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'nflds=he5_swinqgflds(swid,fieldlist,rnk,ntype)'
+         write(*,*)'Number of geolocation fields in swath ',nflds
+         write(*,*)'Names of geolocation fields ',fieldlist
+         write(*,*)'Rank of fields ',rnk
+         write(*,*)'Number type of fields ',ntype
+         write(1,*)'nflds=he5_swinqgflds(swid,fieldlist,rnk,ntype)'
+         write(1,*)'Number of geolocation fields in swath ',nflds
+         write(1,*)'Names of geolocation fields ',fieldlist
+         write(1,*)'Rank of fields ',rnk
+         write(1,*)'Number type of fields ',ntype
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swinqdflds
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqdflds '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_swinqdflds '
+      write(1,*)'======================'
+      nflds=he5_swinqdflds(swid,fieldlist,rnkd,ntyped)
+      if (nflds .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'nflds=he5_swinqdflds(swid,fieldlist,rnkd,ntyped)'
+         write(*,*)'Number of data fields in swath ',nflds
+         write(*,*)'Names of data fields ',fieldlist
+         write(*,*)'Rank of fields ',rnkd
+         write(*,*)'Number type of fields ',ntyped
+         write(1,*)'nflds=he5_swinqdflds(swid,fieldlist,rnkd,ntyped)'
+         write(1,*)'Number of data fields in swath ',nflds
+         write(1,*)'Names of data fields ',fieldlist
+         write(1,*)'Rank of fields ',rnkd
+         write(1,*)'Number type of fields ',ntyped
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdiminfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdiminfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdiminfo '
+      write(1,*)'====================='
+      dimsize= he5_swdiminfo(swid,'DataTrack')
+      if (dimsize .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'dimsize= he5_swdiminfo(swid, "DataTrack")'
+         write(*,*)'Size of dimension DataTrack ',dimsize
+         write(1,*)'dimsize= he5_swdiminfo(swid, "DataTrack")'
+         write(1,*)'Size of dimension DataTrack ',dimsize
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+c Test Case -- he5_swrdfld
+c
+      write(1,27)
+      write(*,*)'Testing he5_swrdfld '
+      write(*,*)'==================='
+      write(1,*)'Testing he5_swrdfld '
+      write(1,*)'==================='
+
+      rd_start(1)=0
+      rd_start(2)=0
+      rd_stride(1)=1
+      rd_stride(2)=1
+      rd_edge(1)=40
+      rd_edge(2)=100
+      status= he5_swrdfld(swid,'Conduction',rd_start,
+     1rd_stride,rd_edge,temp)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Value returned by he5_swrdfld ',status
+         write(*,*)'status= he5_swrdfld(swid, "Conduction", 
+     1rd_start,rd_stride, rd_edge, temp)'
+         write(1,*)'status= he5_swrdfld(swid, "Conduction", 
+     1rd_start,rd_stride, rd_edge, temp)'
+         write(1,*)'Value returned by he5_swrdfld ',status
+         do 190 index1=10,15
+            do 180 index2=10,15
+               write(*,*)'value of conduction ',temp(index1,index2)
+               write(1,*)'value of conduction ',temp(index1,index2)
+  180       continue
+  190    continue
+      endif
+
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swfldinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swfldinfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swfldinfo '
+      write(1,*)'====================='
+      status=he5_swfldinfo(swid,'Latitude',rank,latdims,nt,
+     1dimens,maxdims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swfldinfo(swid, "Latitude", 
+     1rank, latdims, nt, dimens, maxdims)'
+         write(*,*)'Value returned by he5_swfldinfo ',status
+         write(*,*)'Rank of field latitude ',rank
+         write(*,*)'dimension list of field latitude ',dimens
+         write(*,*)'Size of latitude dimensions ',latdims
+         write(*,*)'number type of field latitude ',nt
+         write(1,*)'status= he5_swfldinfo(swid, "Latitude", 
+     1rank, latdims, nt, dimens, maxdims)'
+         write(1,*)'Value returned by he5_swfldinfo ',status
+         write(1,*)'Rank of field latitude ',rank
+         write(1,*)'dimension list of field latitude ',dimens
+         write(1,*)'Size of latitude dimensions ',latdims
+         write(1,*)'number type of field latitude ',nt
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swmapinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swmapinfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swmapinfo '
+      write(1,*)'====================='
+      status=he5_swmapinfo(swid,'GeoTrack','DataTrack',offset,inc)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swmapinfo(swid,"GeoTrack","DataTrack", 
+     1offset,inc)'
+         write(*,*)'Value returned by he5_swmapinfo ',status
+         write(*,*)'Offset ',offset,' Increment ',inc
+         write(1,*)'status=he5_swmapinfo(swid,"GeoTrack","DataTrack", 
+     1offset,inc)'
+         write(1,*)'Value returned by he5_swmapinfo ',status
+         write(1,*)'Offset ',offset,' Increment ',inc
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swimapinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swimapinfo '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_swimapinfo '
+      write(1,*)'======================'
+      status4=he5_swimapinfo(swid2,'GeoXtrack','DataXtrack',idxmap)
+      if (status4 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status4= he5_swimapinfo(swid2,"GeoXtrack",
+     1"DataXtrack", idxmap)'
+         write(*,*)'Value returned by he5_swimapinfo ',status4
+         do 980 index1=1,30
+            write(*,*)' Value of index array ',idxmap(index1)
+            write(1,*)' Value of index array ',idxmap(index1)
+  980    continue
+         write(1,*)'status4= he5_swimapinfo(swid2, "GeoXtrack", 
+     1"DataXtrack",idxmap)'
+         write(1,*)'Value returned by he5_swimapinfo ',status4
+         write(1,*)'Indexed map values ',idxmap
+      endif
+      write(*,*)' '
+      write(1,*)' '
+ 
+c Test Case -- he5_swinqattrs
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqattrs Global attributes '
+      write(*,*)'==================================== '
+      write(1,*)'Testing he5_swinqattrs Global attributes '
+      write(1,*)'==================================== '
+
+      nattr = he5_swinqattrs(swid,attrlist,strbufsz2)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Number of global attributes in swath ',nattr
+         write(*,*)'Attribute list of swath ',attrlist
+         write(1,*)'Number of global attributes in swath ',nattr
+         write(1,*)'Attribute list of swath ',attrlist
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+c Test Case -- he5_swattrinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swattrinfo Global attribute'
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_swattrinfo Global attribute'
+      write(1,*)'======================================='
+      status= he5_swattrinfo(swid, attrlist, n, size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swattrinfo(swid,attrlist,n,size)'
+         write(*,*)'Value returned by he5_swattrinfo ',status
+         write(*,*)'Number type of attributes ',n,' Size ',size
+         write(1,*)'status=he5_swattrinfo(swid,attrlist,n,size)'
+         write(1,*)'Value returned by he5_swattrinfo ',status
+         write(1,*)'Number type of attributes ',n,' Size ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swrdattr
+c
+      write(1,27)
+      write(*,*)'Testing he5_swrdattr, Global attribute '
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_swrdattr, Global attribute '
+      write(1,*)'======================================'
+
+      status= he5_swrdattr(swid, attrlist, rdattr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swrdattr(swid,attrlist,rdattr)'
+         write(*,*)'Value returned by he5_swrdattr ',status
+         write(*,*)'attribute ',rdattr
+         write(1,*)'status=he5_swrdattr(swid,attrlist,rdattr)'
+         write(1,*)'Value returned by he5_swrdattr ',status
+         write(1,*)'attribute ',rdattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c     Test Case -- he5_swinqgattrs
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqgattrs Group attributes '
+      write(*,*)'==================================== '
+      write(1,*)'Testing he5_swinqgattrs Group attributes '
+      write(1,*)'==================================== '
+
+      nattr = he5_swinqgattrs(swid,attrlist,strbufsz2)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Number of group attributes in swath ',nattr
+         write(*,*)'Attribute list of swath ',attrlist
+         write(1,*)'Number of group attributes in swath ',nattr
+         write(1,*)'Attribute list of swath ',attrlist
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+c Test Case -- he5_swgattrinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swgattrinfo Group attribute'
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_swgattrinfo Group attribute'
+      write(1,*)'======================================='
+      status= he5_swgattrinfo(swid, attrlist, n, size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swgattrinfo(swid,attrlist,n,size)'
+         write(*,*)'Value returned by he5_swgattrinfo ',status
+         write(*,*)'Number type of attributes ',n,' Size ',size
+         write(1,*)'status=he5_swgattrinfo(swid,attrlist,n,size)'
+         write(1,*)'Value returned by he5_swgattrinfo ',status
+         write(1,*)'Number type of attributes ',n,' Size ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swrdgattr
+c
+      write(1,27)
+      write(*,*)'Testing he5_swrdgattr, Group attribute '
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_swrdgattr, Group attribute '
+      write(1,*)'======================================'
+
+       status= he5_swrdgattr(swid,'group',rdgnlattr)
+       if (status .lt. zero) then
+          write(*,230)
+          write(1,230)
+       else
+          write(*,*)'  '
+          write(*,240)
+          write(1,*)'  '
+          write(1,240)
+          write(*,*)'status=he5_swrdgattr(swid,attrlist,rdgnlattr)'
+          write(*,*)'Value returned by he5_swrdgattr ',status
+          write(*,*)'attribute ',rdgnlattr
+          write(1,*)'status=he5_swrdgattr(swid,attrlist,rdgnlattr)'
+          write(1,*)'Value returned by he5_swrdgattr ',status
+          write(1,*)'attribute ',rdgnlattr
+       endif
+       write(*,*)' '
+       write(1,*)' '
+
+c Test Case -- he5_swinqlattrs
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqlattrs Local attributes '
+      write(*,*)'==================================== '
+      write(1,*)'Testing he5_swinqlattrs Local attributes '
+      write(1,*)'==================================== '
+
+      nattr=he5_swinqlattrs(swid2,'Sensor1',attrlist,strbufsz2)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swinqlattrs(... "Sensor1" ...)'
+         write(*,*)'Number of local attributes in field',nattr
+         write(*,*)'Attribute list of field ',attrlist
+         write(1,*)'swinqlattrs(... "Sensor1" ...)'
+         write(1,*)'Number of local attributes in field',nattr
+         write(1,*)'Attribute list of field ',attrlist
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+c Test Case -- he5_swlattrinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swlattrinfo Local attribute'
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_swlattrinfo Local attribute'
+      write(1,*)'======================================='
+      status=he5_swlattrinfo(swid2,'Sensor1','local',n,size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swlattrinfo(... "Sensor1" ...)'
+         write(*,*)'Value returned by he5_swlattrinfo ',status
+         write(*,*)'Number type of attributes ',n,' Size ',size
+         write(1,*)'swlattrinfo(... "Sensor1" ...)'
+         write(1,*)'Value returned by he5_swlattrinfo ',status
+         write(1,*)'Number type of attributes ',n,' Size ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swidtype
+c
+      write(1,27)
+      write(*,*)'Testing he5_swidtype, Inquire Datatype '
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_swidtype, Inquire Datatype '
+      write(1,*)'======================================='
+
+      status= he5_swidtype(swid2,'Sensor1','local', 
+     1HE5_HDFE_LOCATTRGROUP,dtype,classid, order, size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swidtype(swid2,"Sensor1","local", 
+     1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)'
+         write(*,*)'Value returned by he5_swidtype ',status
+         write(*,*)'Datatype of local attribute ',dtype
+         write(*,*)'Class id and order ',classid, order
+         write(*,*)'Size of attribute ',size
+         write(1,*)'status= he5_swidtype(swid2,"Sensor1","local", 
+     1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)'
+         write(1,*)'Value returned by he5_swidtype ',status
+         write(1,*)'Datatype of local attribute ',dtype
+         write(1,*)'Class id and order ',classid, order
+         write(1,*)'Size of attribute ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swrdlattr
+c
+      write(1,27)
+      write(*,*)'Testing he5_swrdlattr, Local attribute '
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_swrdlattr, Local attribute '
+      write(1,*)'======================================'
+
+      status=he5_swrdlattr(swid2,'Sensor1','local',rdgnlattr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swrdlattr(swid2,"Sensor1","local", 
+     1rdgnlattr)'
+         write(*,*)'Value returned by he5_swrdlattr ',status
+         write(*,*)'attribute ',rdgnlattr
+         write(1,*)'status=he5_swrdlattr(swid2,"Sensor1","local", 
+     1rdgnlattr)'
+         write(1,*)'Value returned by he5_swrdlattr ',status
+         write(1,*)'attribute ',rdgnlattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swgetfill
+c
+      write(1,27)
+      write(*,*)'Testing he5_swgetfill '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swgetfill '
+      write(1,*)'====================='
+      status= he5_swgetfill(swid,'Conduction', rdfilval)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swgetfill(swid,"Conduction",rdfilval)'
+         write(*,*)'Value returned by he5_swgetfill ',status
+         write(*,*)'Value of fill ',rdfilval
+         write(1,*)'status=he5_swgetfill(swid,"Conduction",rdfilval)'
+         write(1,*)'Value returned by he5_swgetfill ',status
+         write(1,*)'Value of fill ',rdfilval
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdefboxreg
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdefboxreg '
+      write(*,*)'======================='
+      write(1,*)'Testing he5_swdefboxreg '
+      write(1,*)'======================='
+
+      regionid= he5_swdefboxreg(swid, cornerlon, cornerlat, 
+     1HE5_HDFE_ENDPOINT)
+      if (regionid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'regionid= he5_swdefboxreg(swid,cornerlon,
+     1cornerlat, HE5_HDFE_ENDPOINT)'
+         write(*,*)'Value returned by he5_swdefboxreg ',regionid
+         write(1,*)'regionid= he5_swdefboxreg(swid, cornerlon, 
+     1cornerlat, HE5_HDFE_ENDPOINT)'
+         write(1,*)'Value returned by he5_swdefboxreg ',regionid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swregidx
+c
+      write(1,27)
+      write(*,*)'Testing he5_swregidx '
+      write(*,*)'===================='
+      write(1,*)'Testing he5_swregidx '
+      write(1,*)'===================='
+
+      regionid3=he5_swregidx(swid, cornerlon, cornerlat, 
+     1HE5_HDFE_ENDPOINT, geodim, idxrange)
+      if (regionid3 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'regionid3= he5_swregidx(swid, cornerlon, 
+     1cornerlat, HE5_HDFE_ENDPOINT, geodim, idxrange)'
+         write(*,*)'Region ID returned by he5_swregdex ',regionid3
+         write(*,*)'Geodim of region ',geodim
+         write(*,*)'indicies of region ',idxrange(1),idxrange(2)
+         write(1,*)'regionid3= he5_swregidx(swid, cornerlon, 
+     1cornerlat, HE5_HDFE_ENDPOINT, geodim, idxrange)'
+         write(1,*)'Region ID returned by he5_swregdex ',regionid3
+         write(1,*)'Geodim of region ',geodim
+         write(1,*)'indicies of region ',idxrange(1),idxrange(2)
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swdupreg
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdupreg '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdupreg '
+      write(1,*)'====================='
+
+      regionid2= he5_swdupreg(regionid)
+      if (regionid2 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Duplicate region id information '
+         write(*,*)'Region ID returned by he5_swdupreg ',regionid2
+         write(1,*)'Duplicate region id information '
+         write(1,*)'Region ID returned by he5_swdupreg ',regionid2
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+c Test Case -- he5_swreginfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swreginfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swreginfo '
+      write(1,*)'====================='
+      status=he5_swreginfo(swid,regionid,'Temperature',nt,rank, 
+     1dims,size)      
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swreginfo(swid,regionid,"Temperature", 
+     1nt, rank, dims, size)'
+         write(*,*)'Value returned by he5_swreginfo ',status
+         write(*,*)'Number type of region ',nt,' Rank of region ',rank
+         write(*,*)'Dimensions of region ',dims(1),' ',dims(2)
+         write(*,*)'Value of size ',size
+         write(1,*)'status=he5_swreginfo(swid,regionid,"Temperature", 
+     1nt, rank, dims, size)'
+         write(1,*)'Value returned by he5_swreginfo ',status
+         write(1,*)'Number type of region ',nt,' Rank of region ',rank
+         write(1,*)'Value of size ',size
+         write(1,*)'Dimensions of region ',dims(1),' ',dims(2)
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swextreg
+c
+      write(1,27)
+      write(*,*)'Testing he5_swextreg '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swextreg '
+      write(1,*)'====================='
+      status=he5_swextreg(swid,regionid,'Temperature', 
+     1HE5_HDFE_INTERNAL, tempbuf) 
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status = he5_swextreg(swid, regionid, 
+     1"Temperature", HE5_HDFE_INTERNAL, tempbuf)'
+         write(*,*)'Value returned by he5_swextreg ', status
+         write(1,*)'status = he5_swextreg(swid, regionid, 
+     1"Temperature", HE5_HDFE_INTERNAL,tempbuf)'
+         write(1,*)'Value returned by he5_swextreg ', status
+         do 210 index1=100,115
+            write(*,*)'region value at position ',tempbuf(index1)
+            write(1,*)'region value at position ',tempbuf(index1)
+  210    continue
+      endif
+
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swdeftmeper
+c
+      write(1,27)
+      write(*,*)'Testing he5_swdeftmeper '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swdeftmeper '
+      write(1,*)'====================='
+      regionid = he5_swdeftmeper(swid, starttime, endtime, 
+     1HE5_HDFE_ENDPOINT)
+      if (regionid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'regionid= he5_swdeftmeper(swid, starttime, 
+     1endtime, HE5_HDFE_ENDPOINT)'
+         write(*,*)'Value returned by he5_swdeftmeper ',regionid
+         write(1,*)'regionid= he5_swdeftmeper(swid, starttime, 
+     1endtime, HE5_HDFE_ENDPOINT)'
+         write(1,*)'Value returned by he5_swdeftmeper ',regionid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swperinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swperinfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swperinfo '
+      write(1,*)'====================='
+      status = he5_swperinfo(swid,regionid,'Temperature',nt,rank,
+     1dims,size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status = he5_swperinfo(swid, regionid,
+     1"Temperature",nt, rank, dims, size)'
+         write(*,*)'Value returned by he5_swperinfo ',status
+         write(*,*)'Rank of field ',rank,' Number type of region ',nt
+         write(*,*)'Dimensions of region ',dims(1),' ',dims(2)
+         write(*,*)'Value of size ',size
+         write(1,*)'status = he5_swperinfo(swid, regionid,
+     1"Temperature",nt, rank, dims, size)'
+         write(1,*)'Value returned by he5_swperinfo ',status
+         write(1,*)'Rank of field ',rank,' Number type of region ',nt
+         write(1,*)'Dimensions of region ',dims(1),' ',dims(2)
+         write(1,*)'Value of size ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swextper
+c
+      write(1,27)
+      write(*,*)'Testing he5_swextper '
+      write(*,*)'===================='
+      write(1,*)'Testing he5_swextper '
+      write(1,*)'===================='
+      status= he5_swextper(swid,regionid,'Temperature', 
+     1HE5_HDFE_INTERNAL,tempbuf)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swextper(swid, regionid, 
+     1"Temperature", HE5_HDFE_INTERNAL, tempbuf)'
+         write(*,*)'Value returned by he5_swextper swath ',status
+         write(1,*)'status= he5_swextper(swid, regionid, 
+     1"Temperature", HE5_HDFE_INTERNAL, tempbuf) '
+         write(1,*)'Value returned by he5_swextper swath ',status
+         do 220 index1=1000,1015
+            write(*,*)'region value at position ',tempbuf(index1)
+            write(1,*)'region value at position ',tempbuf(index1)
+  220    continue
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+c Test Case -- he5_swupimap
+c
+      write(1,27)
+      write(*,*)'Testing he5_swupimap '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_swupimap '
+      write(1,*)'====================='
+      idxsz=he5_swupimap(swid2,regionid,idxmap,upidxmap,ndxmap)
+      if (idxsz .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Size of index array in region ',idxsz
+         write(1,*)'Size of index array in region ',idxsz
+         write(*,*)'Indicies of updated index ',ndxmap(1),ndxmap(2)
+         write(1,*)'Indicies of updated index ',ndxmap(1),ndxmap(2)
+         do 380 index1=1,idxsz
+            write(*,*)' Value of index array ',upidxmap(index1)
+            write(1,*)' Value of index array ',upidxmap(index1)
+  380    continue
+      endif
+
+
+
+c Test Case -- he5_swcompinfo
+c
+      write(1,27)
+      write(*,*)'Testing he5_swcompinfo '
+      write(*,*)'======================='
+      write(1,*)'Testing he5_swcompinfo '
+      write(1,*)'======================='
+      status=he5_swcompinfo(swid,'CompChunk',compcode,rdcompparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_swcompinfo(swid,"CompChunk",compcode, 
+     1rdcompparm)'
+         write(*,*)'Status returned by he5_swcompinfo ',status
+         write(*,*)'Compression code ',compcode
+         write(*,*)'Compression parameter ',rdcompparm(1)
+         write(1,*)'status=he5_swcompinfo(swid,"CompChunk",compcode, 
+     1rdcompparm)'
+         write(1,*)'Status returned by he5_swcompinfo ',status
+         write(1,*)'Compression code ',compcode
+         write(1,*)'Compression parameter ',rdcompparm(1)
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swdetach(swid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swdetach(swid2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swdetach(swid2)'
+         write(*,*)'Value returned by he5_swdetach ',status
+         write(1,*)'status= he5_swdetach(swid2)'
+         write(1,*)'Value returned by he5_swdetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swclose(swfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swclose(swfid)'
+         write(*,*)'Value returned by he5_swclose ',status
+         write(1,*)'status= he5_swclose(swfid)'
+         write(1,*)'Value returned by he5_swclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      swfid= he5_swopen('swath.he5',HE5F_ACC_RDWR)
+      if (swfid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_swopen ',swfid
+         write(1,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_swopen ',swfid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+c Test Case -- he5_swinqswath
+c
+      write(1,27)
+      write(*,*)'Testing he5_swinqswath '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_swinqswath '
+      write(1,*)'======================'
+
+      nswath=he5_swinqswath('swath.he5',swathlist,strbufsz2)
+      if (nswath .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Retrieve information on swaths in 
+     1file swath.he5'
+         write(*,*)'Number of swaths in file ', nswath
+         write(*,*)'List of swaths ',swathlist
+         write(1,*)'Retrieve information on swaths in 
+     1file swath.he5'
+         write(1,*)'Number of swaths in file ', nswath
+         write(1,*)'List of swaths ',swathlist
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_swclose(swfid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_swclose(swfid)'
+         write(*,*)'Value returned by he5_swclose ',status
+         write(1,*)'status= he5_swclose(swfid)'
+         write(1,*)'Value returned by he5_swclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      close(unit=1)
+   27 format(' ')
+      stop
+      end
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/swath/tutils.h b/testdrivers/swath/tutils.h
new file mode 100755
index 0000000..72e8033
--- /dev/null
+++ b/testdrivers/swath/tutils.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+ * NCSA HDF                                                                 *
+ * Software Development Group                                               *
+ * National Center for Supercomputing Applications                          *
+ * University of Illinois at Urbana-Champaign                               *
+ * 605 E. Springfield, Champaign IL 61820                                   *
+ *                                                                          *
+ * For conditions of distribution and use, see the accompanying             *
+ * hdf/COPYING file.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+/* tutils.h,v 1.12 1995/10/05 16:17:28 koziol Exp */
+
+#ifndef _TUTILS_H
+#define _TUTILS_H
+
+/* Define these for use in all the tests */
+#ifndef TESTMASTER
+extern
+#endif
+int         num_errs
+#ifdef TESTMASTER
+= 0
+#endif
+,           Verbosity
+#ifdef TESTMASTER
+= 0
+#endif
+           ;
+
+#ifdef TEST_PC
+#define FAR far
+#else
+#ifndef FAR
+#define FAR     /* */
+#endif /* FAR */
+#endif /* TEST_PC */
+
+/* Use %ld to print the value because long could cover most cases. */
+/* Used to make certain a return value _is_not_ a value */
+#define CHECK(ret, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s returned %ld \n",where,(int)__LINE__,__FILE__,(long)ret);\
+if(ret == val) {printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", where, (long)ret, (int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+/* Used to make certain a return value _is_ a value */
+#define VERIFY(x, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s had value %ld \n",where,(int)__LINE__,__FILE__,(long)x);\
+if(x != val) {printf("*** UNEXPECTED VALUE from %s is %ld at line %4d in %s\n", where, (long)x,(int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+#define RESULT(a) \
+do { \
+if (Verbosity>8) printf("   Call to HDF routine: %15s at line %4d in %s returned %ld \n",a,(int)__LINE__,__FILE__,(long)ret); \
+if (Verbosity>9) HEprint(stdout,0); \
+if(ret == FAIL) {printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", a, (long)ret,(int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+#define MESSAGE(v,a) {if (Verbosity>=v) {a}}
+
+#endif /* _TUTILS_H */
diff --git a/testdrivers/threads/CMakeLists.txt b/testdrivers/threads/CMakeLists.txt
new file mode 100644
index 0000000..3ce1328
--- /dev/null
+++ b/testdrivers/threads/CMakeLists.txt
@@ -0,0 +1,30 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDFEOS5_TESTDRIVERS_THREADS)
+
+SET (threads_testdrivers
+    he5_gd_threads-1
+    he5_gd_threads-2
+    he5_pt_threads-1
+    he5_pt_threads-2
+    he5_sw_threads-1
+    he5_sw_threads-2
+)
+
+FOREACH (testdriver ${threads_testdrivers})
+  ADD_EXECUTABLE (${testdriver} ${PROJECT_SOURCE_DIR}/${testdriver}.c)
+  TARGET_NAMING (${testdriver} ${LIB_TYPE})
+  TARGET_LINK_LIBRARIES (${testdriver} ${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_GCTP_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDFOREACH (testdriver ${threads_testdrivers})
+  
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+IF (BUILD_TESTING)
+
+  FOREACH (testdriver ${threads_testdrivers})
+    ADD_TEST (NAME THREADS_${testdriver} COMMAND $<TARGET_FILE:${testdriver}>)
+  ENDFOREACH (testdriver ${threads_testdrivers})
+
+ENDIF (BUILD_TESTING)
diff --git a/testdrivers/threads/Makefile.am b/testdrivers/threads/Makefile.am
new file mode 100644
index 0000000..5cc15b6
--- /dev/null
+++ b/testdrivers/threads/Makefile.am
@@ -0,0 +1,19 @@
+# testdrivers/threads Makefile.am
+
+# Boilerplate definitions
+include $(top_srcdir)/config/include.am
+
+# Link against HDF-EOS5, libGCTP, and the pthread library.
+## This directory shouldn't be built unless configure detects that the
+## pthread library is present. 
+INCLUDES=-I$(top_srcdir)/include
+LDADD=$(LIBHDFEOS5) $(LIBGCTP) pthread
+
+# Programs to build when user types 'make check'.
+# Each of these is build from a single *.c file.
+check_PROGRAMS = he5_gd_threads-1 he5_gd_threads-2 he5_pt_threads-1 \
+                 he5_pt_threads-2 he5_sw_threads-1 he5_sw_threads-2
+
+# Run all programs above as tests when the user types 'make check'
+TESTS = $(check_PROGRAMS)
+
diff --git a/testdrivers/threads/Makefile.in b/testdrivers/threads/Makefile.in
new file mode 100644
index 0000000..ae6b428
--- /dev/null
+++ b/testdrivers/threads/Makefile.in
@@ -0,0 +1,585 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+# testdrivers/threads Makefile.am
+SOURCES = he5_gd_threads-1.c he5_gd_threads-2.c he5_pt_threads-1.c he5_pt_threads-2.c he5_sw_threads-1.c he5_sw_threads-2.c
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/config/include.am
+check_PROGRAMS = he5_gd_threads-1$(EXEEXT) he5_gd_threads-2$(EXEEXT) \
+	he5_pt_threads-1$(EXEEXT) he5_pt_threads-2$(EXEEXT) \
+	he5_sw_threads-1$(EXEEXT) he5_sw_threads-2$(EXEEXT)
+subdir = testdrivers/threads
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/HE5_config.h
+CONFIG_CLEAN_FILES =
+he5_gd_threads_1_SOURCES = he5_gd_threads-1.c
+he5_gd_threads_1_OBJECTS = he5_gd_threads-1.$(OBJEXT)
+he5_gd_threads_1_LDADD = $(LDADD)
+am__DEPENDENCIES_1 = $(top_builddir)/src/libhe5_hdfeos.la
+am__DEPENDENCIES_2 = $(top_builddir)/gctp/src/libGctp.la
+he5_gd_threads_1_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2) pthread
+he5_gd_threads_2_SOURCES = he5_gd_threads-2.c
+he5_gd_threads_2_OBJECTS = he5_gd_threads-2.$(OBJEXT)
+he5_gd_threads_2_LDADD = $(LDADD)
+he5_gd_threads_2_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2) pthread
+he5_pt_threads_1_SOURCES = he5_pt_threads-1.c
+he5_pt_threads_1_OBJECTS = he5_pt_threads-1.$(OBJEXT)
+he5_pt_threads_1_LDADD = $(LDADD)
+he5_pt_threads_1_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2) pthread
+he5_pt_threads_2_SOURCES = he5_pt_threads-2.c
+he5_pt_threads_2_OBJECTS = he5_pt_threads-2.$(OBJEXT)
+he5_pt_threads_2_LDADD = $(LDADD)
+he5_pt_threads_2_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2) pthread
+he5_sw_threads_1_SOURCES = he5_sw_threads-1.c
+he5_sw_threads_1_OBJECTS = he5_sw_threads-1.$(OBJEXT)
+he5_sw_threads_1_LDADD = $(LDADD)
+he5_sw_threads_1_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2) pthread
+he5_sw_threads_2_SOURCES = he5_sw_threads-2.c
+he5_sw_threads_2_OBJECTS = he5_sw_threads-2.$(OBJEXT)
+he5_sw_threads_2_LDADD = $(LDADD)
+he5_sw_threads_2_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2) pthread
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = he5_gd_threads-1.c he5_gd_threads-2.c he5_pt_threads-1.c \
+	he5_pt_threads-2.c he5_sw_threads-1.c he5_sw_threads-2.c
+DIST_SOURCES = he5_gd_threads-1.c he5_gd_threads-2.c \
+	he5_pt_threads-1.c he5_pt_threads-2.c he5_sw_threads-1.c \
+	he5_sw_threads-2.c
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F2CFORTRAN_32PTR_CONDITIONAL_FALSE = @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@
+F2CFORTRAN_32PTR_CONDITIONAL_TRUE = @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@
+F2CFORTRAN_90_CONDITIONAL_FALSE = @F2CFORTRAN_90_CONDITIONAL_FALSE@
+F2CFORTRAN_90_CONDITIONAL_TRUE = @F2CFORTRAN_90_CONDITIONAL_TRUE@
+F2CFORTRAN_CONDITIONAL_FALSE = @F2CFORTRAN_CONDITIONAL_FALSE@
+F2CFORTRAN_CONDITIONAL_TRUE = @F2CFORTRAN_CONDITIONAL_TRUE@
+F77 = @F77@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_INCLUDE_CONDITIONAL_FALSE = @INSTALL_INCLUDE_CONDITIONAL_FALSE@
+INSTALL_INCLUDE_CONDITIONAL_TRUE = @INSTALL_INCLUDE_CONDITIONAL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SZIP_ENCODER_CONDITIONAL_FALSE = @SZIP_ENCODER_CONDITIONAL_FALSE@
+SZIP_ENCODER_CONDITIONAL_TRUE = @SZIP_ENCODER_CONDITIONAL_TRUE@
+TESTDRIVERS_CONDITIONAL_FALSE = @TESTDRIVERS_CONDITIONAL_FALSE@
+TESTDRIVERS_CONDITIONAL_TRUE = @TESTDRIVERS_CONDITIONAL_TRUE@
+THREADSAFE_CONDITIONAL_FALSE = @THREADSAFE_CONDITIONAL_FALSE@
+THREADSAFE_CONDITIONAL_TRUE = @THREADSAFE_CONDITIONAL_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la
+LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
+
+# Boilerplate definitions
+
+# Link against HDF-EOS5, libGCTP, and the pthread library.
+INCLUDES = -I$(top_srcdir)/include
+LDADD = $(LIBHDFEOS5) $(LIBGCTP) pthread
+
+# Run all programs above as tests when the user types 'make check'
+TESTS = $(check_PROGRAMS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  testdrivers/threads/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  testdrivers/threads/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+he5_gd_threads-1$(EXEEXT): $(he5_gd_threads_1_OBJECTS) $(he5_gd_threads_1_DEPENDENCIES) 
+	@rm -f he5_gd_threads-1$(EXEEXT)
+	$(LINK) $(he5_gd_threads_1_LDFLAGS) $(he5_gd_threads_1_OBJECTS) $(he5_gd_threads_1_LDADD) $(LIBS)
+he5_gd_threads-2$(EXEEXT): $(he5_gd_threads_2_OBJECTS) $(he5_gd_threads_2_DEPENDENCIES) 
+	@rm -f he5_gd_threads-2$(EXEEXT)
+	$(LINK) $(he5_gd_threads_2_LDFLAGS) $(he5_gd_threads_2_OBJECTS) $(he5_gd_threads_2_LDADD) $(LIBS)
+he5_pt_threads-1$(EXEEXT): $(he5_pt_threads_1_OBJECTS) $(he5_pt_threads_1_DEPENDENCIES) 
+	@rm -f he5_pt_threads-1$(EXEEXT)
+	$(LINK) $(he5_pt_threads_1_LDFLAGS) $(he5_pt_threads_1_OBJECTS) $(he5_pt_threads_1_LDADD) $(LIBS)
+he5_pt_threads-2$(EXEEXT): $(he5_pt_threads_2_OBJECTS) $(he5_pt_threads_2_DEPENDENCIES) 
+	@rm -f he5_pt_threads-2$(EXEEXT)
+	$(LINK) $(he5_pt_threads_2_LDFLAGS) $(he5_pt_threads_2_OBJECTS) $(he5_pt_threads_2_LDADD) $(LIBS)
+he5_sw_threads-1$(EXEEXT): $(he5_sw_threads_1_OBJECTS) $(he5_sw_threads_1_DEPENDENCIES) 
+	@rm -f he5_sw_threads-1$(EXEEXT)
+	$(LINK) $(he5_sw_threads_1_LDFLAGS) $(he5_sw_threads_1_OBJECTS) $(he5_sw_threads_1_LDADD) $(LIBS)
+he5_sw_threads-2$(EXEEXT): $(he5_sw_threads_2_OBJECTS) $(he5_sw_threads_2_DEPENDENCIES) 
+	@rm -f he5_sw_threads-2$(EXEEXT)
+	$(LINK) $(he5_sw_threads_2_LDFLAGS) $(he5_sw_threads_2_OBJECTS) $(he5_sw_threads_2_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_gd_threads-1.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_gd_threads-2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_pt_threads-1.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_pt_threads-2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_threads-1.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he5_sw_threads-2.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+	@failed=0; all=0; xfail=0; xpass=0; skip=0; \
+	srcdir=$(srcdir); export srcdir; \
+	list='$(TESTS)'; \
+	if test -n "$$list"; then \
+	  for tst in $$list; do \
+	    if test -f ./$$tst; then dir=./; \
+	    elif test -f $$tst; then dir=; \
+	    else dir="$(srcdir)/"; fi; \
+	    if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+	      all=`expr $$all + 1`; \
+	      case " $(XFAIL_TESTS) " in \
+	      *" $$tst "*) \
+		xpass=`expr $$xpass + 1`; \
+		failed=`expr $$failed + 1`; \
+		echo "XPASS: $$tst"; \
+	      ;; \
+	      *) \
+		echo "PASS: $$tst"; \
+	      ;; \
+	      esac; \
+	    elif test $$? -ne 77; then \
+	      all=`expr $$all + 1`; \
+	      case " $(XFAIL_TESTS) " in \
+	      *" $$tst "*) \
+		xfail=`expr $$xfail + 1`; \
+		echo "XFAIL: $$tst"; \
+	      ;; \
+	      *) \
+		failed=`expr $$failed + 1`; \
+		echo "FAIL: $$tst"; \
+	      ;; \
+	      esac; \
+	    else \
+	      skip=`expr $$skip + 1`; \
+	      echo "SKIP: $$tst"; \
+	    fi; \
+	  done; \
+	  if test "$$failed" -eq 0; then \
+	    if test "$$xfail" -eq 0; then \
+	      banner="All $$all tests passed"; \
+	    else \
+	      banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+	    fi; \
+	  else \
+	    if test "$$xpass" -eq 0; then \
+	      banner="$$failed of $$all tests failed"; \
+	    else \
+	      banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+	    fi; \
+	  fi; \
+	  dashes="$$banner"; \
+	  skipped=""; \
+	  if test "$$skip" -ne 0; then \
+	    skipped="($$skip tests were not run)"; \
+	    test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+	      dashes="$$skipped"; \
+	  fi; \
+	  report=""; \
+	  if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+	    report="Please report to $(PACKAGE_BUGREPORT)"; \
+	    test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+	      dashes="$$report"; \
+	  fi; \
+	  dashes=`echo "$$dashes" | sed s/./=/g`; \
+	  echo "$$dashes"; \
+	  echo "$$banner"; \
+	  test -z "$$skipped" || echo "$$skipped"; \
+	  test -z "$$report" || echo "$$report"; \
+	  echo "$$dashes"; \
+	  test "$$failed" -eq 0; \
+	else :; fi
+
+distdir: $(DISTFILES)
+	$(mkdir_p) $(distdir)/../../config
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+	clean-checkPROGRAMS clean-generic clean-libtool ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/testdrivers/threads/Makefile.sgi32 b/testdrivers/threads/Makefile.sgi32
new file mode 100644
index 0000000..800b2e0
--- /dev/null
+++ b/testdrivers/threads/Makefile.sgi32
@@ -0,0 +1,58 @@
+
+COMPILER = cc
+LINKER = cc
+CC = $(COMPILER)
+LD = $(LINKER)
+
+# for SUN
+#CFLAGS =  -g -Xa -DsunFortran -DSUN -D_HDFEOS5_THREADSAFE
+#LFLAGS = -g -Xa -DsunFortran -DSUN -D_HDFEOS5_THREADSAFE
+
+# for sgi32
+CFLAGS =  -g -n32 -xansi -D_POSIX_SOURCE -D_HDFEOS5_THREADSAFE
+LFLAGS = -g -n32 -xansi -D_POSIX_SOURCE -D_HDFEOS5_THREADSAFE
+
+# for sgi64
+#CFLAGS =  -g -64 -xansi -D_POSIX_SOURCE -D_HDFEOS5_THREADSAFE
+#LFLAGS = -g -64 -xansi -D_POSIX_SOURCE -D_HDFEOS5_THREADSAFE
+
+INCLUDE = -I. -I$(HDFEOS5_INC) -I$(HDF5INC) -I$(JPEGINC) -I$(ZLIBINC) -I$(SZIPINC)
+
+
+LIBRARYPATHS = -L$(HDF5LIB) -L$(HDFEOS5_LIB) -L$(JPEGLIB) -L$(ZLIBLIB) -L$(SZIPLIB)
+
+# for SUN
+#LIBRARIES = -lhe5_hdfeos $(HDF5LIB)/libhdf5.a -lGctp -ljpeg -lz -lsz -lpthread -lm -lnsl
+
+# for other platforms
+LIBRARIES = -lhe5_hdfeos -lhdf5 -lGctp -ljpeg -lz -lsz -lpthread -lm
+
+OBJECTS = he5_gd_threads-1.o he5_gd_threads-2.o he5_pt_threads-1.o he5_pt_threads-2.o he5_sw_threads-1.o he5_sw_threads-2.o
+
+
+PROGRAMS = he5_gd_threads-1 he5_gd_threads-2 he5_pt_threads-1 he5_pt_threads-2 he5_sw_threads-1 he5_sw_threads-2
+
+
+all: ${PROGRAMS} cleano
+
+${PROGRAMS}: ${OBJECTS}
+	${CC} ${LFLAGS} -o $@ ${OBJECTS} ${LIBRARYPATHS} ${LIBRARIES}
+
+.c.o: 
+	${CC} ${CFLAGS} -c ${INCLUDE} $<
+
+clean:
+	rm *.o ${PROGRAMS}
+
+cleano:
+	rm *.o
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/threads/he5_gd_threads-1.c b/testdrivers/threads/he5_gd_threads-1.c
new file mode 100755
index 0000000..ac10506
--- /dev/null
+++ b/testdrivers/threads/he5_gd_threads-1.c
@@ -0,0 +1,212 @@
+/*
+ *********************************************************
+ *       FILE:     he5_gd_threads-1.c                    *                     
+ *       PURPOSE:  To test thread-safe version of        *
+ *                 HDF-EOS5 Grid library                 *              
+ *       Author:   A. Muslimov, Emergent IT Inc.         * 
+ *       Date:     Sep, 2001                             *  
+ *       Updated:  Nov, 2001                             *              
+ *********************************************************  
+ */
+
+#include <HE5_HdfEosDef.h>
+
+#define NUM_THREADS   30
+
+typedef struct ThreadInfo_tag
+{
+    int      threadNum;
+	hid_t    fid;
+	hid_t    gdid;
+    char     gridName[81];
+    int      zonecode;
+    int      projcode;
+    int      spherecode;
+    long     xdim;
+    long     ydim;
+    double   uplft[2];
+    double   lowrgt[2];
+	double   projparm[16];
+} ThreadInfo_t;
+
+
+void *HE5_GridTest(void *arg);
+
+int main()
+{
+  herr_t           ret       = SUCCEED;
+  hid_t            fid       = FAIL;
+  int              loopCount;
+  int              status    = FAIL;    
+  ThreadInfo_t     threadInfo[NUM_THREADS];
+  pthread_t        threadArray[NUM_THREADS];
+  pthread_attr_t   threadAttr;
+
+  /* Open HDF-EOS Grid file */
+  /* ---------------------- */
+  fid = HE5_GDopen("grid.h5",H5F_ACC_TRUNC); 
+  if (fid == FAIL)
+    {
+	  printf( "*ERROR:  unable to open \"grid.h5\"  file. \n");
+	  return (FAIL);
+    }
+  
+  /* Execute the loop to the NUM_THREADS times        */
+  /* to assign one function to each thread afterwards */
+  /* ------------------------------------------------ */
+  for (loopCount = 0; loopCount < NUM_THREADS; loopCount++)
+    {
+	  threadInfo[loopCount].threadNum   = loopCount+1;
+	  threadInfo[loopCount].fid         = fid;
+	  threadInfo[loopCount].gdid        = FAIL;
+	  sprintf(threadInfo[loopCount].gridName,"UTMGrid_%d",loopCount);
+	  threadInfo[loopCount].zonecode    = 40;
+	  threadInfo[loopCount].spherecode  = 0;
+	  threadInfo[loopCount].uplft[0]    = 210584.50041;   
+	  threadInfo[loopCount].uplft[1]    = 3322395.95445;
+	  threadInfo[loopCount].lowrgt[0]   = 813931.10959;
+	  threadInfo[loopCount].lowrgt[1]   = 2214162.53278;
+	  threadInfo[loopCount].xdim        = 120;
+	  threadInfo[loopCount].ydim        = 200;
+
+	  sleep(1);
+	  pthread_attr_init(&threadAttr);
+	  pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM);
+	  status = pthread_create(&threadArray[loopCount],&threadAttr,HE5_GridTest,&threadInfo[loopCount]);
+	  if (status != 0)
+        {
+		  printf("\nERROR:  problem starting thread %d, error val: %d\n",loopCount,status);
+		  ret = FAIL;
+        }	  
+	  pthread_join(threadArray[loopCount],NULL); 
+    }
+  
+  ret = HE5_GDclose(fid);
+  if (ret == FAIL)
+    {
+	  printf( "*ERROR:  unable to close file. \n");
+	  return (FAIL);
+    }
+
+  printf( "... successfully created %d grids within \"grid.h5\" file. \n",loopCount);
+  
+  return(ret);
+}
+
+void *HE5_GridTest(void *arg)
+{
+  herr_t      status = FAIL;
+  int         i;
+  float       *veg;
+  float       *veg_out;
+  hssize_t    start[3];  
+  hsize_t     edge[3];
+
+  ThreadInfo_t *tag = (ThreadInfo_t *) arg;
+
+  veg = (float *)calloc(24000,sizeof(float));
+  if (veg == NULL)
+	{
+	  printf( "*ERROR:  unable to allocate memory. \n");
+	  return (void *)NULL;
+	}
+
+  for (i = 0; i < 24000; i++)
+	veg[i] = (float)i;
+  
+  tag->gdid = HE5_GDcreate(tag->fid,tag->gridName,tag->xdim,tag->ydim,tag->uplft,tag->lowrgt); 
+  if (tag->gdid == FAIL)
+	{
+	  printf( "*ERROR:  unable to create %s grid. \n",tag->gridName);
+	  return (void *)NULL;
+	}
+
+  status = HE5_GDdefproj(tag->gdid, HE5_GCTP_UTM, tag->zonecode, tag->spherecode, tag->projparm);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR calling HE5_GDdefproj(). \n");
+	  return (void *)NULL;
+	}
+
+  status = HE5_GDdefdim(tag->gdid, "Time", 10);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR calling HE5_GDdefdim(). \n");
+	  return (void *)NULL;
+	}
+
+  status = HE5_GDdefdim(tag->gdid, "Unlim", H5S_UNLIMITED);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR calling HE5_GDdefdim(). \n");
+	  return (void *)NULL;
+	}
+ 
+  status = HE5_GDdeffield(tag->gdid, "Vegetation", "YDim,XDim", NULL, H5T_NATIVE_FLOAT, 0);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR calling HE5_GDdeffield(\"Vegetation\"). \n");
+	  return (void *)NULL;
+	}          
+	  
+  start[0] = 0;     start[1] = 0;
+  edge[0]  = 200;   edge[1]  = 120;
+  status = HE5_GDwritefield(tag->gdid, "Vegetation", start, NULL, edge, veg);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR calling HE5_GDwritefield(\"Vegetation\"). \n");
+	  return (void *)NULL;
+	}
+
+  free(veg);
+
+  status = HE5_GDdetach(tag->gdid);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to detach from %s grid. \n",tag->gridName);
+	  return (void *)NULL;
+	}
+  
+  tag->gdid = HE5_GDattach(tag->fid,tag->gridName);
+  if (tag->gdid == FAIL)
+	{
+	  printf( "*ERROR:  unable to attach to %s grid. \n",tag->gridName);
+	  return (void *)NULL;
+	}
+
+  veg_out = (float *)calloc(24000,sizeof(float));
+  if (veg_out == NULL)
+	{
+	  printf( "*ERROR:  unable to allocate memory. \n");
+	  return (void *)NULL;
+	}
+
+  start[0] = 0;     start[1] = 0;
+  edge[0]  = 200;   edge[1]  = 100;
+  status = HE5_GDreadfield(tag->gdid,"Vegetation",start,NULL,edge,veg_out);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR calling HE5_GDreadfield(\"Vegetation\"). \n");
+	  return (void *)NULL;
+	}
+
+  free(veg_out);
+
+  status = HE5_GDdetach(tag->gdid);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to detach from %s grid. \n",tag->gridName);
+	  return (void *)NULL;
+	}
+
+  return 0;
+}
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/threads/he5_gd_threads-2.c b/testdrivers/threads/he5_gd_threads-2.c
new file mode 100755
index 0000000..5c19c3c
--- /dev/null
+++ b/testdrivers/threads/he5_gd_threads-2.c
@@ -0,0 +1,171 @@
+/*
+ *********************************************************
+ *       FILE:     he5_gd_threads-2.c                    *                     
+ *       PURPOSE:  To test thread-safe version of        *
+ *                 HDF-EOS5 Grid library                 *              
+ *       Author:   A. Muslimov, Emergent IT Inc.         * 
+ *       Date:     Sep, 2001                             *  
+ *       Updated:  Nov, 2001                             *              
+ *********************************************************  
+ */
+
+#include <HE5_HdfEosDef.h>
+
+#define NUM_THREADS   30
+
+typedef struct ThreadInfo_tag
+{
+    int      threadNum;
+	hid_t    fid;
+	hid_t    gdid;
+    char     gridName[81];
+} ThreadInfo_t;
+
+
+void *HE5_GridTest(void *arg);
+
+int main()
+{
+  herr_t           ret       = SUCCEED;
+  hid_t            fid       = FAIL;
+  int              loopCount;
+  int              status    = FAIL;    
+  ThreadInfo_t     threadInfo[NUM_THREADS];
+  pthread_t        threadArray[NUM_THREADS];
+  pthread_attr_t   threadAttr;
+
+
+  /* Open HDF-EOS Grid file */
+  /* ---------------------- */
+  fid = HE5_GDopen("grid.h5",H5F_ACC_RDWR); 
+  if (fid == FAIL)
+    {
+	  printf( "*ERROR:  unable to open \"grid.h5\"  file. \n");
+	  return (FAIL);
+    }
+  
+  /* Execute the loop to the NUM_THREADS times        */
+  /* to assign one function to each thread afterwards */
+  /* ------------------------------------------------ */
+  for (loopCount = 0; loopCount < NUM_THREADS; loopCount++)
+    {
+	  threadInfo[loopCount].threadNum = loopCount+1;
+	  threadInfo[loopCount].fid       = fid;
+	  threadInfo[loopCount].gdid      = FAIL;
+	  sprintf(threadInfo[loopCount].gridName,"UTMGrid_%d",loopCount);
+
+	  sleep(1);
+	  pthread_attr_init(&threadAttr);
+	  pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM);
+	  status = pthread_create(&threadArray[loopCount],&threadAttr,HE5_GridTest,&threadInfo[loopCount]);
+	  if (status != 0)
+        {
+		  printf("\nERROR:  problem starting thread %d, error val: %d\n",loopCount,status);
+		  ret = FAIL;
+        }
+	  pthread_join(threadArray[loopCount],NULL); 
+    }
+ 
+  ret = HE5_GDclose(fid);
+  if (ret == FAIL)
+    {
+	  printf( "*ERROR:  unable to close file. \n");
+	  return (FAIL);
+    }
+  
+  return(ret);
+}
+
+void *HE5_GridTest(void *arg)
+{
+  herr_t      status = FAIL;
+  int         i;
+  float       *veg;
+  float       *veg_out;
+  hssize_t    start[3];  
+  hsize_t     edge[3];
+
+  ThreadInfo_t *tag = (ThreadInfo_t *) arg;
+
+  veg = (float *)calloc(24000,sizeof(float));
+  if (veg == NULL)
+	{
+	  printf( "*ERROR:  unable to allocate memory. \n");
+	  return (void *)NULL;
+	}
+
+  for (i = 0; i < 24000; i++)
+	veg[i] = (float)i;
+
+  printf(" \n");
+  printf("Starting thread  %d\n",tag->threadNum);
+  printf(" \n");
+
+  tag->gdid = HE5_GDattach(tag->fid,tag->gridName);
+  if (tag->gdid == FAIL)
+	{
+	  printf( "*ERROR:  unable to attach to %s grid. \n",tag->gridName);
+	  return (void *)NULL;
+	}
+	  
+  start[0] = 0;     start[1] = 0;
+  edge[0]  = 200;   edge[1]  = 120;
+  status = HE5_GDwritefield(tag->gdid, "Vegetation", start, NULL, edge, veg);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR calling HE5_GDwritefield(\"Vegetation\"). \n");
+	  return (void *)NULL;
+	}
+
+  free(veg);
+
+  status = HE5_GDdetach(tag->gdid);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to detach from %s grid. \n",tag->gridName);
+	  return (void *)NULL;
+	}
+  
+  tag->gdid = HE5_GDattach(tag->fid,tag->gridName);
+  if (tag->gdid == FAIL)
+	{
+	  printf( "*ERROR:  unable to attach to %s grid. \n",tag->gridName);
+	  return (void *)NULL;
+	}
+
+  veg_out = (float *)calloc(24000,sizeof(float));
+  if (veg_out == NULL)
+	{
+	  printf( "*ERROR:  unable to allocate memory. \n");
+	  return (void *)NULL;
+	}
+
+  start[0] = 0;     start[1] = 0;
+  edge[0]  = 200;   edge[1]  = 100;
+  status = HE5_GDreadfield(tag->gdid,"Vegetation",start,NULL,edge,veg_out);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR calling HE5_GDreadfield(\"Vegetation\"). \n");
+	  return (void *)NULL;
+	}
+
+  free(veg_out);
+
+  status = HE5_GDdetach(tag->gdid);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to detach from %s grid. \n",tag->gridName);
+	  return (void *)NULL;
+	}
+  
+  return 0;
+}
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/threads/he5_pt_threads-1.c b/testdrivers/threads/he5_pt_threads-1.c
new file mode 100755
index 0000000..e2b47db
--- /dev/null
+++ b/testdrivers/threads/he5_pt_threads-1.c
@@ -0,0 +1,214 @@
+/*
+ *********************************************************
+ *       FILE:     he5_pt_threads-1.c                    *                     
+ *       PURPOSE:  To test thread-safe version of        *
+ *                 HDF-EOS5 Point library                *              
+ *       Author:   A. Muslimov, Emergent IT Inc.         * 
+ *       Date:     Sep, 2001                             *  
+ *       Updated:  Nov, 2001                             *              
+ *********************************************************  
+ */
+
+#include <HE5_HdfEosDef.h>
+
+#define NUM_THREADS   30
+
+typedef struct ThreadInfo_tag
+{
+    int      threadNum;
+	hid_t    fid;
+	hid_t    ptid;
+    char     pointName[81];
+} ThreadInfo_t;
+
+
+void *HE5_PointTest(void *arg);
+
+int main()
+{
+  herr_t           ret       = SUCCEED;
+  hid_t            fid       = FAIL;
+  int              loopCount;
+  int              status    = FAIL;
+  ThreadInfo_t     threadInfo[NUM_THREADS];
+  pthread_t        threadArray[NUM_THREADS];
+  pthread_attr_t   threadAttr;
+  
+  /* Open HDF-EOS Point file */
+  /* ----------------------- */
+  fid = HE5_PTopen("point.h5",H5F_ACC_TRUNC); 
+  if (fid == FAIL)
+    {
+	  printf( "*ERROR:  unable to open \"point.h5\"  file. \n");
+	  return (FAIL);
+    }
+  
+  /* Execute the loop to the NUM_THREADS times        */
+  /* to assign one function to each thread afterwards */
+  /* ------------------------------------------------ */
+  for (loopCount = 0; loopCount < NUM_THREADS; loopCount++)
+    {
+	  threadInfo[loopCount].threadNum = loopCount+1;
+	  threadInfo[loopCount].fid       = fid;
+	  threadInfo[loopCount].ptid      = FAIL;
+	  sprintf(threadInfo[loopCount].pointName,"POINT_%d",loopCount);
+	  sleep(1);
+	  pthread_attr_init(&threadAttr);
+	  pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM);
+	  status = pthread_create(&threadArray[loopCount],&threadAttr,HE5_PointTest,&threadInfo[loopCount]);
+	  if (status != 0)
+        {
+		  printf("\nERROR:  problem starting thread %d, error val: %d\n",loopCount,status);
+		  ret = FAIL;
+        }	  
+	  pthread_join(threadArray[loopCount],NULL); 
+    }
+ 
+   ret = HE5_PTclose(fid);
+  if (ret == FAIL)
+    {
+	  printf( "*ERROR:  unable to close file. \n");
+	  return (FAIL);
+    }
+  printf( "... successfully created %d points within \"point.h5\" file. \n",loopCount);
+   
+  return(ret);
+}
+
+
+void *HE5_PointTest(void *arg)
+{
+  herr_t      status = FAIL;
+  FILE        *fp;
+  int         i;
+  int         n;
+  hsize_t     count[1];
+  size_t      datasize = 0;
+  double      time;
+  float       conc[4];
+  char        spc[8];
+ 
+  HE5_CmpDTSinfo    *dtsinfo;
+  typedef struct
+	{
+	  double          time;
+	  float           concentr[4];
+	  char            spec[8];
+	  
+	} InputData1;
+
+  typedef struct 
+	{
+	  double    Time;
+	  float     Conc[4];
+	  char      Spc[8];
+	} CmpData_1;
+
+  CmpData_1 datbuf_1[20];
+
+  ThreadInfo_t *tag = (ThreadInfo_t *) arg;
+  
+  tag->ptid = HE5_PTcreate(tag->fid,tag->pointName); 
+  if (tag->ptid == FAIL)
+	{
+	  printf( "*ERROR:  unable to create %s point. \n",tag->pointName);
+	  return (void *)NULL;
+	}
+
+  dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo));
+  
+  dtsinfo->nfields   = 3;  
+  dtsinfo->rank[0]   = 1;
+  dtsinfo->rank[1]   = 1;
+  dtsinfo->rank[2]   = 1;
+  dtsinfo->offset[0] = HOFFSET(InputData1, time);
+  dtsinfo->offset[1] = HOFFSET(InputData1, concentr);
+  dtsinfo->offset[2] = HOFFSET(InputData1, spec);
+  dtsinfo->dtype[0]  = H5T_NATIVE_DOUBLE;
+  dtsinfo->dtype[1]  = H5T_NATIVE_FLOAT;
+  dtsinfo->dtype[2]  = H5T_NATIVE_CHAR;
+  dtsinfo->array[0]  = 0;
+  dtsinfo->array[1]  = 1;
+  dtsinfo->array[2]  = 1;
+  
+  for (i = 0; i < 3; i++)
+	dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char));
+  
+  strcpy(dtsinfo->fieldname[0],"Time");
+  strcpy(dtsinfo->fieldname[1],"Concentration");
+  strcpy(dtsinfo->fieldname[2],"Species");
+  dtsinfo->dims[0][0] = 1;
+  dtsinfo->dims[1][0] = 4;
+  dtsinfo->dims[2][0] = 8;
+  
+  dtsinfo->datasize = (size_t)sizeof(InputData1);
+  
+  status = HE5_PTdeflevel(tag->ptid, "Sensor", dtsinfo);
+  
+  for (i = 0; i < 3; i++)
+	{
+	  free(dtsinfo->fieldname[i]);
+	  dtsinfo->fieldname[i] = NULL;
+	}
+  
+  free(dtsinfo);
+  
+  fp = fopen("simple.txt", "r");
+  
+  n = 0;
+  while(fscanf(fp, "%lf %f %f %f %f %s", &time, &conc[0], &conc[1], &conc[2], &conc[3], spc) != -1)
+    {
+	  datbuf_1[n].Time    = time;
+	  datbuf_1[n].Conc[0] = conc[0];
+	  datbuf_1[n].Conc[1] = conc[1];
+	  datbuf_1[n].Conc[2] = conc[2];
+	  datbuf_1[n].Conc[3] = conc[3];
+	  memmove(datbuf_1[n].Spc, spc, sizeof(char)*strlen(spc));
+	  datbuf_1[n].Spc[strlen(spc)] = 0;
+	  n++;
+    }
+ 
+  fclose(fp);
+  
+  datasize = (size_t)sizeof(CmpData_1);
+  count[0] = n;
+  
+  status = HE5_PTwritelevel(tag->ptid, 0, count, &datasize, datbuf_1);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to write data to level. \n");
+	  return (void *)NULL;
+	}  
+  
+  status = HE5_PTdetach(tag->ptid);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to detach from %s point. \n",tag->pointName);
+	  return (void *)NULL;
+	}
+  
+  tag->ptid = HE5_PTattach(tag->fid,tag->pointName);
+  if (tag->ptid == FAIL)
+	{
+	  printf( "*ERROR:  unable to attach to %s point. \n",tag->pointName);
+	  return (void *)NULL;
+	}
+  
+  status = HE5_PTdetach(tag->ptid);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to detach from %s point. \n",tag->pointName);
+	  return (void *)NULL;
+	}
+  
+  return 0;
+}
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/threads/he5_pt_threads-2.c b/testdrivers/threads/he5_pt_threads-2.c
new file mode 100755
index 0000000..1c3fdd3
--- /dev/null
+++ b/testdrivers/threads/he5_pt_threads-2.c
@@ -0,0 +1,234 @@
+/*
+ *********************************************************
+ *       FILE:     he5_pt_threads-2.c                    *                     
+ *       PURPOSE:  To test thread-safe version of        *
+ *                 HDF-EOS5 Point library                *              
+ *       Author:   A. Muslimov, Emergent IT Inc.         * 
+ *       Date:     Sep, 2001                             *  
+ *       Updated:  Nov, 2001                             *              
+ *********************************************************  
+ */
+
+#include <HE5_HdfEosDef.h>
+
+#define NUM_THREADS   30
+
+typedef struct ThreadInfo_tag
+{
+    int      threadNum;
+	hid_t    fid;
+	hid_t    ptid;
+    char     pointName[81];
+} ThreadInfo_t;
+
+
+void *HE5_PointTest(void *arg);
+
+int main()
+{
+  herr_t           ret       = SUCCEED;
+  hid_t            fid       = FAIL;
+  int              loopCount;
+  int              status    = FAIL;
+  ThreadInfo_t     threadInfo[NUM_THREADS];
+  pthread_t        threadArray[NUM_THREADS];
+  pthread_attr_t   threadAttr;
+  
+
+  /* Open HDF-EOS Point file */
+  /* ----------------------- */
+  fid = HE5_PTopen("point.h5",H5F_ACC_RDWR); 
+  if (fid == FAIL)
+    {
+	  printf( "*ERROR:  unable to open \"point.h5\"  file. \n");
+	  return (FAIL);
+    }
+  
+  /* Execute the loop to the NUM_THREADS times        */
+  /* to assign one function to each thread afterwards */
+  /* ------------------------------------------------ */
+  for (loopCount = 0; loopCount < NUM_THREADS; loopCount++)
+    {
+	  threadInfo[loopCount].threadNum = loopCount+1;
+	  threadInfo[loopCount].fid       = fid;
+	  threadInfo[loopCount].ptid      = FAIL;
+	  sprintf(threadInfo[loopCount].pointName,"POINT_%d",loopCount);
+	  sleep(1);	  
+	  pthread_attr_init(&threadAttr);
+	  pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM);
+	  status = pthread_create(&threadArray[loopCount],&threadAttr,HE5_PointTest,&threadInfo[loopCount]);
+	  if (status != 0)
+        {
+		  printf("\nERROR:  problem starting thread %d, error val: %d\n",loopCount,status);
+		  ret = FAIL;
+        }
+	  pthread_join(threadArray[loopCount],NULL); 
+    }
+  
+  ret = HE5_PTclose(fid);
+  if (ret == FAIL)
+    {
+	  printf( "*ERROR:  unable to close file. \n");
+	  return (FAIL);
+    }
+  return(ret);
+}
+
+
+void *HE5_PointTest(void *arg)
+{
+  herr_t      status = FAIL;
+
+  FILE        *fp;
+
+  int         i;
+  int         n;
+  int         nflds = FAIL;
+
+  hsize_t     count[1];
+
+  size_t      datasize = 0;
+
+  double      time;
+
+  float       conc[4];
+
+  char        spc[8];
+ 
+  typedef struct 
+	{
+	  double    Time;
+	  float     Conc[4];
+	  char      Spc[8];
+	} CmpData_1;
+
+ typedef struct {
+          double   time;
+          float    con[4];
+          char     spec[8];
+        } Sensor;
+ 
+  Sensor   s[50];
+
+  HE5_CmpDTSinfo  level;
+  HE5_CmpDTSinfo  inInfo;
+  CmpData_1       datbuf_1[20];
+
+  ThreadInfo_t *tag = (ThreadInfo_t *) arg;
+
+  printf(" \n");
+  printf("Starting thread  %d\n",tag->threadNum);
+  printf(" \n");
+  
+  tag->ptid = HE5_PTattach(tag->fid,tag->pointName);
+  if (tag->ptid == FAIL)
+	{
+	  printf( "*ERROR:  unable to attach to %s point. \n",tag->pointName);
+	  return (void *)NULL;
+	}
+  
+  fp = fopen("simple.txt", "r");
+  
+  n = 0;
+  while(fscanf(fp, "%lf %f %f %f %f %s", &time, &conc[0], &conc[1], &conc[2], &conc[3], spc) != -1)
+    {
+	  datbuf_1[n].Time    = time;
+	  datbuf_1[n].Conc[0] = conc[0];
+	  datbuf_1[n].Conc[1] = conc[1];
+	  datbuf_1[n].Conc[2] = conc[2];
+	  datbuf_1[n].Conc[3] = conc[3];
+	  memmove(datbuf_1[n].Spc, spc, sizeof(char)*strlen(spc));
+	  datbuf_1[n].Spc[strlen(spc)] = 0;
+	  n++;
+    }
+ 
+  fclose(fp);
+  
+  datasize = (size_t)sizeof(CmpData_1);
+  count[0] = n;
+  
+  status = HE5_PTwritelevel(tag->ptid, 0, count, &datasize, datbuf_1);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to write data to level. \n");
+	  return (void *)NULL;
+	}  
+  
+  status = HE5_PTdetach(tag->ptid);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to detach from %s point. \n",tag->pointName);
+	  return (void *)NULL;
+	}
+  
+  tag->ptid = HE5_PTattach(tag->fid,tag->pointName);
+  if (tag->ptid == FAIL)
+	{
+	  printf( "*ERROR:  unable to attach to %s point. \n",tag->pointName);
+	  return (void *)NULL;
+	}
+  
+  status = HE5_PTlevelinfo(tag->ptid, 0, &level);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to get level info. \n");
+	  return (void *)NULL;
+	}
+
+  nflds    = level.nfields;
+  datasize = (size_t)sizeof(Sensor);
+  
+  inInfo.nfields    = nflds;
+  inInfo.datasize   = (size_t)sizeof(Sensor);
+  inInfo.rank[0]    = 1;
+  inInfo.rank[1]    = 1;
+  inInfo.rank[2]    = 1;
+  inInfo.offset[0]  = HOFFSET(Sensor, time);
+  inInfo.offset[1]  = HOFFSET(Sensor, con);
+  inInfo.offset[2]  = HOFFSET(Sensor, spec); 
+  inInfo.dtype[0]   = H5T_NATIVE_DOUBLE;
+  inInfo.dtype[1]   = H5T_NATIVE_FLOAT;
+  inInfo.dtype[2]   = H5T_NATIVE_CHAR;
+  inInfo.dclass[0]  = H5T_NO_CLASS;
+  inInfo.dclass[1]  = H5T_NO_CLASS;
+  inInfo.dclass[2]  = H5T_NO_CLASS;
+  inInfo.dims[0][0] = 1;
+  inInfo.dims[1][0] = 4;
+  inInfo.dims[2][0] = 8;
+  inInfo.array[0]   = 0;
+  inInfo.array[1]   = 1;
+  inInfo.array[2]   = 1;
+
+  for( i = 0; i < nflds; i++)
+	{
+	  inInfo.fieldname[i] = (char *)calloc(64, sizeof(char));
+	  strcpy(inInfo.fieldname[i], level.fieldname[i]);
+	}
+  
+  status = HE5_PTreadlevel(tag->ptid, 0, &inInfo, &datasize, s);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to read data from level. \n");
+	  return (void *)NULL;
+	}
+  
+  for (i = 0; i < nflds; i++)
+	if (inInfo.fieldname[i] != NULL) free(inInfo.fieldname[i]);
+    
+  status = HE5_PTdetach(tag->ptid);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to detach from %s point. \n",tag->pointName);
+	  return (void *)NULL;
+	}
+
+  return 0;
+}
+
+
+
+
+
+
+
+
diff --git a/testdrivers/threads/he5_sw_threads-1.c b/testdrivers/threads/he5_sw_threads-1.c
new file mode 100755
index 0000000..2fd95fc
--- /dev/null
+++ b/testdrivers/threads/he5_sw_threads-1.c
@@ -0,0 +1,215 @@
+/*
+ *********************************************************
+ *       FILE:     he5_sw_threads-1.c                    *                     
+ *       PURPOSE:  To test thread-safe version of        *
+ *                 HDF-EOS5 Swath library                *              
+ *       Author:   A. Muslimov, Emergent IT Inc.         * 
+ *       Date:     Sep, 2001                             *  
+ *       Updated:  Nov, 2001                             *              
+ *********************************************************  
+ */
+
+#include <HE5_HdfEosDef.h>
+
+#define NUM_THREADS   30
+
+typedef struct ThreadInfo_tag
+{
+    int      threadNum;
+	hid_t    fid;
+	hid_t    swid;
+    char     swathName[81];
+} ThreadInfo_t;
+
+
+void *HE5_SwathTest(void *arg);
+
+int main()
+{
+  herr_t           ret       = SUCCEED;
+  hid_t            fid       = FAIL;
+  int              loopCount;
+  int              status    = FAIL;
+  ThreadInfo_t     threadInfo[NUM_THREADS];
+  pthread_t        threadArray[NUM_THREADS];
+  pthread_attr_t   threadAttr;
+
+  /* Open HDF-EOS Swath file */
+  /* ----------------------- */
+  fid = HE5_SWopen("swath.h5",H5F_ACC_TRUNC); 
+  if (fid == FAIL)
+    {
+	  printf( "*ERROR:  unable to open \"swath.h5\"  file. \n");
+	  return (FAIL);
+    }
+  
+  /* Execute the loop to the NUM_THREADS times        */
+  /* to assign one function to each thread afterwards */
+  /* ------------------------------------------------ */
+  for (loopCount = 0; loopCount < NUM_THREADS; loopCount++)
+    {
+	  threadInfo[loopCount].threadNum = loopCount+1;
+	  threadInfo[loopCount].fid = fid;
+	  threadInfo[loopCount].swid  = FAIL;
+	  sprintf(threadInfo[loopCount].swathName,"SWATH_%d",loopCount);
+	  sleep(1);
+	  pthread_attr_init(&threadAttr);
+	  pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM);
+	  status = pthread_create(&threadArray[loopCount],&threadAttr,HE5_SwathTest,&threadInfo[loopCount]);
+	  if (status != 0)
+        {
+		  printf("\nERROR:  problem starting thread %d, error val: %d\n",loopCount,status);
+		  ret = FAIL;
+        }
+	  pthread_join(threadArray[loopCount],NULL); 
+    }
+ 
+  ret = HE5_SWclose(fid);
+  if (ret == FAIL)
+    {
+	  printf( "*ERROR:  unable to close file. \n");
+	  return (FAIL);
+    }
+
+  printf( "... successfully created %d swaths within \"swath.h5\" file. \n",loopCount);
+  
+  return(ret);
+}
+
+
+void *HE5_SwathTest(void *arg)
+{
+  int         j;
+  herr_t      status = FAIL;
+  hssize_t    start[3];   
+  hsize_t     count[3];
+  double      *plane;
+  double      *outbuf;
+
+  ThreadInfo_t *tag = (ThreadInfo_t *) arg;
+
+  tag->swid = HE5_SWcreate(tag->fid,tag->swathName); 
+  if (tag->swid == FAIL)
+	{
+	  printf( "*ERROR:  unable to create %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+
+  status = HE5_SWdefdim(tag->swid, "GeoTrack", 20);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to define dimension for %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+ 
+  status = HE5_SWdefdim(tag->swid, "GeoXtrack", 10);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to define dimension for %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+
+  status = HE5_SWdefdim(tag->swid, "Res2tr", 40);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to define dimension for %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+  
+  status = HE5_SWdefdim(tag->swid, "Res2xtr", 20);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to define dimension for %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+
+  status = HE5_SWdefdim(tag->swid, "Bands", 15);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to define dimension for %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+  
+  status = HE5_SWdefdatafield(tag->swid, "Spectra", "Bands,Res2tr,Res2xtr", NULL, H5T_NATIVE_DOUBLE, 0);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to define data field for %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+
+  plane = (double *)calloc(12000,sizeof(double));
+  if (plane == NULL)
+	{
+	  printf( "*ERROR:  unable to allocate memory. \n");
+	  return (void *)NULL;
+	}
+  
+  for (j = 0; j < 12000; j++)
+	plane[j] = (double)j;
+
+  start[0] = 0;      count[0] = 15;
+  start[1] = 0;      count[1] = 40;
+  start[2] = 0;      count[2] = 20;
+
+  status = HE5_SWwritefield(tag->swid, "Spectra", start, NULL, count, plane);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to write data for \"Spectra\" field in  %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+ 	  
+  free(plane);
+
+  status = HE5_SWdetach(tag->swid);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to detach from %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+  
+
+  tag->swid = HE5_SWattach(tag->fid,tag->swathName);
+  if (tag->swid == FAIL)
+	{
+	  printf( "*ERROR:  unable to attach to %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+  
+  start[0] = 0;      count[0] = 15;
+  start[1] = 0;      count[1] = 40;
+  start[2] = 0;      count[2] = 20;
+
+  outbuf = (double *)calloc(12000, sizeof(double));
+  if (outbuf == NULL)
+	{
+	  printf( "*ERROR:  unable to allocate memory. \n");
+	  return (void *)NULL;
+	}
+
+  status = HE5_SWreadfield(tag->swid, "Spectra", start, NULL, count, outbuf);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to read data from \"Spectra\" field in  %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+
+  free(outbuf);
+  
+  status = HE5_SWdetach(tag->swid);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to detach from %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+  
+  return 0;
+}
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/threads/he5_sw_threads-2.c b/testdrivers/threads/he5_sw_threads-2.c
new file mode 100755
index 0000000..e644e90
--- /dev/null
+++ b/testdrivers/threads/he5_sw_threads-2.c
@@ -0,0 +1,171 @@
+/*
+ *********************************************************
+ *       FILE:     he5_sw_threads-2.c                    *                     
+ *       PURPOSE:  To test thread-safe version of        *
+ *                 HDF-EOS5 Swath library                *              
+ *       Author:   A. Muslimov, Emergent IT Inc.         * 
+ *       Date:     Sep, 2001                             *  
+ *       Updated:  Nov, 2001                             *              
+ *********************************************************  
+ */
+
+#include <HE5_HdfEosDef.h>
+
+#define NUM_THREADS   30
+
+typedef struct ThreadInfo_tag
+{
+    int      threadNum;
+	hid_t    fid;
+	hid_t    swid;
+    char     swathName[81];
+} ThreadInfo_t;
+
+
+void *HE5_SwathTest(void *arg);
+
+int main()
+{
+  herr_t           ret       = SUCCEED;
+  hid_t            fid       = FAIL;
+  int              loopCount;
+  int              status    = FAIL;
+  ThreadInfo_t     threadInfo[NUM_THREADS];
+  pthread_t        threadArray[NUM_THREADS];
+  pthread_attr_t   threadAttr;
+  
+  /* Open HDF-EOS Swath file */
+  /* ----------------------- */
+  fid = HE5_SWopen("swath.h5",H5F_ACC_RDWR); 
+  if (fid == FAIL)
+    {
+	  printf( "*ERROR:  unable to open \"swath.h5\"  file. \n");
+	  return (FAIL);
+    }
+  
+  /* Execute the loop to the NUM_THREADS times        */
+  /* to assign one function to each thread afterwards */
+  /* ------------------------------------------------ */
+  for (loopCount = 0; loopCount < NUM_THREADS; loopCount++)
+    {
+	  threadInfo[loopCount].threadNum = loopCount+1;
+	  threadInfo[loopCount].fid       = fid;
+	  threadInfo[loopCount].swid      = FAIL;
+	  sprintf(threadInfo[loopCount].swathName,"SWATH_%d",loopCount);
+	  sleep(1);
+	  pthread_attr_init(&threadAttr);
+	  pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM);
+	  status = pthread_create(&threadArray[loopCount],&threadAttr,HE5_SwathTest,&threadInfo[loopCount]);
+	  if (status != 0)
+        {
+		  printf("\nERROR:  problem starting thread %d, error val: %d\n",loopCount,status);
+		  ret = FAIL;
+        }
+	  pthread_join(threadArray[loopCount],NULL); 
+    }
+  
+  ret = HE5_SWclose(fid);
+  if (ret == FAIL)
+    {
+	  printf( "*ERROR:  unable to close file. \n");
+	  return (FAIL);
+    }
+  return(ret);
+}
+
+
+void *HE5_SwathTest(void *arg)
+{
+  int         j;
+  herr_t      status = FAIL;
+  hssize_t    start[3];   
+  hsize_t     count[3];
+  double      *plane;
+  double      *outbuf;
+
+  ThreadInfo_t *tag = (ThreadInfo_t *) arg;
+
+  printf("Starting thread  %d\n",tag->threadNum);
+  
+  tag->swid = HE5_SWattach(tag->fid,tag->swathName);
+  if (tag->swid == FAIL)
+	{
+	  printf( "*ERROR:  unable to attach to %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+	 
+  plane = (double *)calloc(12000, sizeof(double));
+  if (plane == NULL)
+	{
+	  printf( "*ERROR:  unable to allocate memory. \n");
+	  return (void *)NULL;
+	}
+ 
+  for (j = 0; j < 12000; j++)
+	plane[j] = (double)j;
+	  
+  start[0] = 0;      count[0] = 15;
+  start[1] = 0;      count[1] = 40;
+  start[2] = 0;      count[2] = 20;
+  
+  status = HE5_SWwritefield(tag->swid, "Spectra", start, NULL, count, plane);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to write data for \"Spectra\" field in  %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+
+  free(plane);
+ 	  
+  status = HE5_SWdetach(tag->swid);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to detach from %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+  
+  tag->swid = HE5_SWattach(tag->fid,tag->swathName);
+  if (tag->swid == FAIL)
+	{
+	  printf( "*ERROR:  unable to attach to %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+
+  outbuf = (double *)calloc(12000, sizeof(double));
+  if (outbuf == NULL)
+	{
+	  printf( "*ERROR:  unable to allocate memory. \n");
+	  return (void *)NULL;
+	}
+  
+  start[0] = 0;      count[0] = 15;
+  start[1] = 0;      count[1] = 40;
+  start[2] = 0;      count[2] = 20;
+  
+  status = HE5_SWreadfield(tag->swid, "Spectra", start, NULL, count, outbuf);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to read data from \"Spectra\" field in  %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+  
+  free(outbuf);
+  
+  status = HE5_SWdetach(tag->swid);
+  if (status == FAIL)
+	{
+	  printf( "*ERROR:  unable to detach from %s swath. \n",tag->swathName);
+	  return (void *)NULL;
+	}
+  
+  return 0;
+}
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/za/CMakeLists.txt b/testdrivers/za/CMakeLists.txt
new file mode 100644
index 0000000..36a5b6c
--- /dev/null
+++ b/testdrivers/za/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDFEOS5_TESTDRIVERS_ZA)
+
+ADD_EXECUTABLE (testza ${PROJECT_SOURCE_DIR}/TestZa.c)
+TARGET_NAMING (testza ${LIB_TYPE})
+TARGET_LINK_LIBRARIES (testza ${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_GCTP_SRC_LIB_TARGET} ${LINK_LIBS})
+
+ADD_EXECUTABLE (testalias ${PROJECT_SOURCE_DIR}/TestAlias.c)
+TARGET_NAMING (testalias ${LIB_TYPE})
+TARGET_LINK_LIBRARIES (testalias ${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_GCTP_SRC_LIB_TARGET} ${LINK_LIBS})
+
+IF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+  # make test dir
+  FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+
+  IF (F2CFORTRAN_32PTR)
+    ADD_EXECUTABLE (testza_f ${PROJECT_SOURCE_DIR}/testza32.f)
+  ELSE (F2CFORTRAN_32PTR)
+    ADD_EXECUTABLE (testza_f ${PROJECT_SOURCE_DIR}/testza64.f)
+  ENDIF (F2CFORTRAN_32PTR)
+  TARGET_NAMING (testza_f ${LIB_TYPE})
+  TARGET_FORTRAN_WIN_PROPERTIES (testza_f "")
+  SET_TARGET_PROPERTIES (testza_f PROPERTIES LINKER_LANGUAGE Fortran)
+  TARGET_LINK_LIBRARIES (testza_f ${HDFEOS_SRC_LIB_TARGET} ${HDFEOS_GCTP_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+  
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+IF (BUILD_TESTING)
+
+  ADD_TEST (NAME ZA_test_c COMMAND $<TARGET_FILE:testza>)
+
+  ADD_TEST (NAME ZA_test_c_alias COMMAND $<TARGET_FILE:testalias>)
+  SET_TESTS_PROPERTIES (ZA_test_c_alias PROPERTIES DEPENDS ZA_test_c)
+
+  IF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+    ADD_TEST (NAME ZA_test_f COMMAND $<TARGET_FILE:testza_f>)
+    SET_TESTS_PROPERTIES (ZA_test_f PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/fortran")
+    SET_TESTS_PROPERTIES (ZA_test_f PROPERTIES DEPENDS ZA_test_c_alias)
+  ENDIF (HDFEOS_BUILD_FORTRAN AND HAVE_F2CFORTRAN_MACRO)
+
+ENDIF (BUILD_TESTING)
diff --git a/testdrivers/za/Makefile.am b/testdrivers/za/Makefile.am
new file mode 100644
index 0000000..dce6ce4
--- /dev/null
+++ b/testdrivers/za/Makefile.am
@@ -0,0 +1,44 @@
+# testdrivers/za Makefile.am
+
+# Boilerplate definitions
+include $(top_srcdir)/config/include.am
+
+# Link against HDF-EOS5 and libGCTP libraries
+INCLUDES=-I$(top_srcdir)/include
+LDADD=$(LIBHDFEOS5) $(LIBGCTP)
+
+# Programs to build when user types 'make check'
+check_PROGRAMS = TestZa TestAlias
+
+if F2CFORTRAN_CONDITIONAL
+if F2CFORTRAN_32PTR_CONDITIONAL
+check_PROGRAMS += testza32
+testza32_SOURCES = testza32.f
+else
+check_PROGRAMS += testza64
+testza64_SOURCES = testza64.f
+endif
+endif
+
+# When user types 'make check', run programs above as tests.
+TEST_SEQUENCES=test_c
+if F2CFORTRAN_CONDITIONAL
+if F2CFORTRAN_32PTR_CONDITIONAL
+TEST_SEQUENCES+=test_32f
+else
+TEST_SEQUENCES+=test_64f
+endif
+endif
+
+test_c: $(check_PROGRAMS)
+	./TestZa
+	./TestAlias
+test_32f: $(check_PROGRAMS)
+	./testza32
+test_64f: $(check_PROGRAMS)
+	./testza64
+
+check-local: $(TEST_SEQUENCES)
+
+.PHONY: $(TEST_SEQUENCES)
+
diff --git a/testdrivers/za/Makefile.in b/testdrivers/za/Makefile.in
new file mode 100644
index 0000000..268a5e8
--- /dev/null
+++ b/testdrivers/za/Makefile.in
@@ -0,0 +1,522 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+# testdrivers/za Makefile.am
+SOURCES = TestAlias.c TestZa.c $(testza32_SOURCES) $(testza64_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/config/include.am
+check_PROGRAMS = TestZa$(EXEEXT) TestAlias$(EXEEXT) $(am__EXEEXT_1) \
+	$(am__EXEEXT_2)
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_1 = testza32
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_2 = testza64
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_3 = test_32f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__append_4 = test_64f
+subdir = testdrivers/za
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/HE5_config.h
+CONFIG_CLEAN_FILES =
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am__EXEEXT_1 = testza32$(EXEEXT)
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am__EXEEXT_2 = testza64$(EXEEXT)
+TestAlias_SOURCES = TestAlias.c
+TestAlias_OBJECTS = TestAlias.$(OBJEXT)
+TestAlias_LDADD = $(LDADD)
+am__DEPENDENCIES_1 = $(top_builddir)/src/libhe5_hdfeos.la
+am__DEPENDENCIES_2 = $(top_builddir)/gctp/src/libGctp.la
+TestAlias_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+TestZa_SOURCES = TestZa.c
+TestZa_OBJECTS = TestZa.$(OBJEXT)
+TestZa_LDADD = $(LDADD)
+TestZa_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am__testza32_SOURCES_DIST = testza32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at am_testza32_OBJECTS = testza32.$(OBJEXT)
+testza32_OBJECTS = $(am_testza32_OBJECTS)
+testza32_LDADD = $(LDADD)
+testza32_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+am__testza64_SOURCES_DIST = testza64.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at am_testza64_OBJECTS = testza64.$(OBJEXT)
+testza64_OBJECTS = $(am_testza64_OBJECTS)
+testza64_LDADD = $(LDADD)
+testza64_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS)
+LTF77COMPILE = $(LIBTOOL) --mode=compile --tag=F77 $(F77) $(AM_FFLAGS) \
+	$(FFLAGS)
+F77LD = $(F77)
+F77LINK = $(LIBTOOL) --mode=link --tag=F77 $(F77LD) $(AM_FFLAGS) \
+	$(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = TestAlias.c TestZa.c $(testza32_SOURCES) $(testza64_SOURCES)
+DIST_SOURCES = TestAlias.c TestZa.c $(am__testza32_SOURCES_DIST) \
+	$(am__testza64_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F2CFORTRAN_32PTR_CONDITIONAL_FALSE = @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@
+F2CFORTRAN_32PTR_CONDITIONAL_TRUE = @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@
+F2CFORTRAN_90_CONDITIONAL_FALSE = @F2CFORTRAN_90_CONDITIONAL_FALSE@
+F2CFORTRAN_90_CONDITIONAL_TRUE = @F2CFORTRAN_90_CONDITIONAL_TRUE@
+F2CFORTRAN_CONDITIONAL_FALSE = @F2CFORTRAN_CONDITIONAL_FALSE@
+F2CFORTRAN_CONDITIONAL_TRUE = @F2CFORTRAN_CONDITIONAL_TRUE@
+F77 = @F77@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_INCLUDE_CONDITIONAL_FALSE = @INSTALL_INCLUDE_CONDITIONAL_FALSE@
+INSTALL_INCLUDE_CONDITIONAL_TRUE = @INSTALL_INCLUDE_CONDITIONAL_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SZIP_ENCODER_CONDITIONAL_FALSE = @SZIP_ENCODER_CONDITIONAL_FALSE@
+SZIP_ENCODER_CONDITIONAL_TRUE = @SZIP_ENCODER_CONDITIONAL_TRUE@
+TESTDRIVERS_CONDITIONAL_FALSE = @TESTDRIVERS_CONDITIONAL_FALSE@
+TESTDRIVERS_CONDITIONAL_TRUE = @TESTDRIVERS_CONDITIONAL_TRUE@
+THREADSAFE_CONDITIONAL_FALSE = @THREADSAFE_CONDITIONAL_FALSE@
+THREADSAFE_CONDITIONAL_TRUE = @THREADSAFE_CONDITIONAL_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la
+LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
+
+# Boilerplate definitions
+
+# Link against HDF-EOS5 and libGCTP libraries
+INCLUDES = -I$(top_srcdir)/include
+LDADD = $(LIBHDFEOS5) $(LIBGCTP)
+ at F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE at testza32_SOURCES = testza32.f
+ at F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE at testza64_SOURCES = testza64.f
+
+# When user types 'make check', run programs above as tests.
+TEST_SEQUENCES = test_c $(am__append_3) $(am__append_4)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .f .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  testdrivers/za/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  testdrivers/za/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+TestAlias$(EXEEXT): $(TestAlias_OBJECTS) $(TestAlias_DEPENDENCIES) 
+	@rm -f TestAlias$(EXEEXT)
+	$(LINK) $(TestAlias_LDFLAGS) $(TestAlias_OBJECTS) $(TestAlias_LDADD) $(LIBS)
+TestZa$(EXEEXT): $(TestZa_OBJECTS) $(TestZa_DEPENDENCIES) 
+	@rm -f TestZa$(EXEEXT)
+	$(LINK) $(TestZa_LDFLAGS) $(TestZa_OBJECTS) $(TestZa_LDADD) $(LIBS)
+testza32$(EXEEXT): $(testza32_OBJECTS) $(testza32_DEPENDENCIES) 
+	@rm -f testza32$(EXEEXT)
+	$(F77LINK) $(testza32_LDFLAGS) $(testza32_OBJECTS) $(testza32_LDADD) $(LIBS)
+testza64$(EXEEXT): $(testza64_OBJECTS) $(testza64_DEPENDENCIES) 
+	@rm -f testza64$(EXEEXT)
+	$(F77LINK) $(testza64_LDFLAGS) $(testza64_OBJECTS) $(testza64_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TestAlias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TestZa.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+.f.o:
+	$(F77COMPILE) -c -o $@ $<
+
+.f.obj:
+	$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.f.lo:
+	$(LTF77COMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(mkdir_p) $(distdir)/../../config
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+	$(MAKE) $(AM_MAKEFLAGS) check-local
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \
+	clean-checkPROGRAMS clean-generic clean-libtool ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am
+
+
+test_c: $(check_PROGRAMS)
+	./TestZa
+	./TestAlias
+test_32f: $(check_PROGRAMS)
+	./testza32
+test_64f: $(check_PROGRAMS)
+	./testza64
+
+check-local: $(TEST_SEQUENCES)
+
+.PHONY: $(TEST_SEQUENCES)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/testdrivers/za/Makefile.sgi32 b/testdrivers/za/Makefile.sgi32
new file mode 100644
index 0000000..16566f8
--- /dev/null
+++ b/testdrivers/za/Makefile.sgi32
@@ -0,0 +1,59 @@
+
+COMPILER = cc
+LINKER = cc
+CC = $(COMPILER)
+LD = $(LINKER)
+
+# for SUN
+#CFLAGS =  -g -Xa -DsunFortran -DSUN
+#LFLAGS = -g -Xa -DsunFortran -DSUN
+
+# for sgi32
+CFLAGS =  -g -n32 -xansi -D_POSIX_SOURCE
+LFLAGS = -g -n32 -xansi -D_POSIX_SOURCE
+
+# for sgi64
+#CFLAGS =  -g -64 -xansi -D_POSIX_SOURCE
+#LFLAGS = -g -64 -xansi -D_POSIX_SOURCE
+
+INCLUDE = -I. -I$(HDFEOS5_INC) -I$(HDF5INC) -I$(JPEGINC) -I$(ZLIBINC) -I$(SZIPINC)
+
+
+LIBRARYPATHS = -L$(HDF5LIB) -L$(HDFEOS5_LIB) -L$(JPEGLIB) -L$(ZLIBLIB) -L$(SZIPLIB)
+
+# for SUN
+#LIBRARIES = -lhe5_hdfeos $(HDF5LIB)/libhdf5.a -lGctp -ljpeg -lz -lsz -lpthread -lm -lnsl
+
+# for other platforms
+LIBRARIES = -lhe5_hdfeos $(HDF5LIB)/libhdf5.a -lGctp -ljpeg -lz -lsz -lpthread -lm
+
+OBJECTS = TestZa.o TestAlias.o
+
+
+PROGRAMS = TestZa TestAlias
+
+
+all: ${PROGRAMS} cleano
+
+${PROGRAMS}: ${OBJECTS}
+	${CC} ${LFLAGS} -o $@ ${OBJECTS} ${LIBRARYPATHS} ${LIBRARIES}
+
+.c.o: 
+	${CC} ${CFLAGS} -c ${INCLUDE} $<
+
+clean:
+	rm *.o ${PROGRAMS}
+
+cleano:
+	rm *.o
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/za/TestAlias.c b/testdrivers/za/TestAlias.c
new file mode 100755
index 0000000..59e1d4f
--- /dev/null
+++ b/testdrivers/za/TestAlias.c
@@ -0,0 +1,305 @@
+/*
+ ******************************************************************
+ * File:        TestAlias.c                                       *
+ *                                                                *
+ * Date:        Aug 2002                                          *
+ * Purpose:     Testing ZA interfacing routines                   *        
+ ******************************************************************
+ */
+
+#include        <HE5_HdfEosDef.h>
+
+#define  FILENAME   "Alias.he5"
+#define  RANK       2
+
+int main()
+{
+  herr_t       status = FAIL;
+  
+  int          i, j;
+  int          rank       = FAIL;
+  int          length     = 0;
+  int          attr[1]    = {2000};
+  int          fieldgroup = FAIL;
+  int          comp_level[5] = { 0,0,0,0,0 };
+  int          comp_code;
+  int          level[5] = {0,0,0,00}, code = 0;
+  int          *fldrank = (int *)NULL;
+  int          return_val = FAIL;
+
+  H5T_class_t  dtype   = H5T_NO_CLASS; 
+  hid_t        dtype1  = FAIL;
+  H5T_order_t  order   = H5T_ORDER_ERROR;
+  hid_t        ntype[3] = {FAIL, FAIL, FAIL}; 
+
+  long         nattr      = FAIL;
+  long         nfldalias     = FAIL;
+  long         strbufsize = FAIL; 
+  long         nflds = FAIL;
+  long         nalias = FAIL;
+
+  hid_t        ZAid = FAIL, zafid = FAIL;
+  hid_t        datatype = FAIL;
+  
+  float        data[ 20 ][ 10 ];
+  float        out_buffer[ 20 ][ 10 ];
+  float        fillvalue = -777.777;
+  float        out_fillvalue = -1.;
+
+  size_t       size    = 0;
+
+  hssize_t     start[ 2 ] = { 0, 0 };
+  hsize_t      count[ 2 ] = { 5, 5};
+  hsize_t      nelem = 0;
+  hsize_t      dims[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+  hsize_t      chunk_dims[ 2 ];
+  
+  char         dimlist[80];
+  char         maxdimlist[80];
+  char         *namebuf, attrlist[80];
+  char         fldlist[80];
+  char         fldalias[80];
+  char         aliaslist[80];
+
+  /* 
+   *****************************************************************************
+   *                 Open/Create the ZA "Test_1"                               *
+   *****************************************************************************
+   */
+  
+  zafid = HE5_ZAopen(FILENAME, H5F_ACC_TRUNC);
+  printf("ZA file ID                      = %d\n", zafid);
+  
+  ZAid   = HE5_ZAcreate(zafid,"Test_1"); 
+  printf("ZA ID                           = %d\n", ZAid);
+  
+  /* 
+   *****************************************************************************
+   *                     Define Dimensions                                     *
+   *****************************************************************************
+   */
+  
+  
+  status = HE5_ZAdefdim(ZAid,"DataTrack", 20);
+  printf("status returned by HE5_ZAdefdim        = %d\n", status);
+  
+  status = HE5_ZAdefdim(ZAid,"DataXtrack", 10);
+  printf("status returned by HE5_ZAdefdim        = %d\n", status);
+
+  chunk_dims[ 0 ] = 10;
+  chunk_dims[ 1 ] = 5;
+  comp_code       = 4;
+  comp_level[0]   = 6;
+  
+  status = HE5_ZAdefcomchunk(ZAid, comp_code, comp_level, RANK, chunk_dims);
+  printf("status returned by HE5_ZAdefcomchunk   = %d\n", status);
+
+  status = HE5_ZAsetfillvalue(ZAid, "Temperature", H5T_NATIVE_FLOAT, &fillvalue);
+  printf("status returned by HE5_ZAsetfillvalue  = %d\n", status);
+
+  status = HE5_ZAdefine(ZAid,"Temperature", "DataTrack,DataXtrack", NULL, H5T_NATIVE_FLOAT);
+  printf("status returned by HE5_ZAdefine  = %d\n", status);
+  
+  
+  /* 
+   *****************************************************************************
+   *                  Write data to the field "Temperature"                    *
+   *****************************************************************************
+   */
+  for ( i = 0; i < 20; i++ )
+	for( j = 0; j < 10; j++ )
+	  data[ i ][ j ] = 1.e0 + i + 5.e-2 * j ;
+  
+  status  = HE5_ZAwrite(ZAid,"Temperature", start, NULL, count, data );
+  printf("status returned by HE5_ZAwrite    = %d\n", status);
+  
+
+  /* Set aliases for field "Temperature" */
+  /* ----------------------------------- */
+  status  = HE5_ZAsetalias(ZAid,"Temperature","T,Tmp,Temp,L2gpValue");
+  printf("status returned by HE5_ZAsetalias      = %d\n", status);
+
+  strcpy(fldalias,"");
+  nfldalias = HE5_ZAinqfldalias(ZAid, fldalias, &strbufsize);
+  printf("Number of fields & aliases is: %li\n", nfldalias);
+  printf("Fields & aliases list:            %s \n", fldalias);
+  printf("Length of fields & aliases list:  %li \n", strbufsize);
+
+  strcpy(aliaslist,"");
+  nalias = HE5_ZAgetaliaslist(ZAid, HE5_HDFE_DATAGROUP, aliaslist, &strbufsize);
+  printf("Number of aliases is: %li\n", nalias);
+  printf("Aliases list:            %s \n", aliaslist);
+  printf("Length of aliases list:  %li \n", strbufsize);
+
+  /* Get information about alias "Temp" */
+  /* ---------------------------------- */
+  status = HE5_ZAaliasinfo(ZAid,  HE5_HDFE_DATAGROUP, "Temp", &length, NULL);
+  if (status == SUCCEED)
+	printf("Name length: %d \n", length);
+  
+  namebuf = (char *)calloc(length, sizeof(char));
+
+  /* Get the actual name of the field "Temp" */
+  /* --------------------------------------- */
+  status = HE5_ZAaliasinfo(ZAid,  HE5_HDFE_DATAGROUP, "Temp", &length, namebuf);
+  if (status == SUCCEED)
+	printf("Original field name: %s \n", namebuf);
+  
+  free(namebuf);
+  
+  /* Remove alias "Tmp" from the alias list */
+  /* -------------------------------------- */
+  status  = HE5_ZAdropalias(ZAid, HE5_HDFE_DATAGROUP, "Tmp");
+  printf("status returned by HE5_ZAdropalias     = %d\n", status);
+
+  /* Remove alias "Temp" from the alias list */
+  /* --------------------------------------- */
+  status  = HE5_ZAdropalias(ZAid, HE5_HDFE_DATAGROUP, "Temp");
+  printf("status returned by HE5_ZAdropalias     = %d\n", status);
+
+  /* Get information about alias  "L2gpValue" */
+  /* ---------------------------------------- */  
+  status = HE5_ZAaliasinfo(ZAid,  HE5_HDFE_DATAGROUP, "L2gpValue", &length, NULL);
+  if (status == SUCCEED)
+	printf("Name length: %d \n", length);
+  
+
+  namebuf = (char *)calloc(length, sizeof(char));
+
+  /* Get the actual name of the field "L2gpValue" */
+  /* -------------------------------------------- */  
+  status = HE5_ZAaliasinfo(ZAid, HE5_HDFE_DATAGROUP, "L2gpValue", &length, namebuf);
+  if (status == SUCCEED)
+	printf("Original field name: %s \n", namebuf);
+  
+  free(namebuf);
+
+  count[0] = 20;  count[1] = 10;
+  
+  /* Read the data from the field calling it by alias */
+  /* ------------------------------------------------ */
+  status  = HE5_ZAread(ZAid,"L2gpValue", start, NULL, count, out_buffer);
+  printf("status returned by HE5_ZAread     = %d\n", status);
+
+  printf("Data from \"L2gpValue\" field: \n");
+  for ( i = 0; i < 20; i++ )
+	for( j = 0; j < 10; j++ )
+	  printf("%f \n", out_buffer[ i ][ j ]);
+
+  /* Write local attribute to "L2gpValue" */
+  /* ------------------------------------ */
+  count[0] = 1;
+  status = HE5_ZAwritelocattr(ZAid, "L2gpValue", "LocalAttribute", H5T_NATIVE_INT, count, attr);
+  printf("status returned by HE5_ZAwritelocattr  = %d\n", status);
+
+
+  status = HE5_ZAdetach(ZAid);
+  printf("status returned by HE5_ZAdetach        = %d\n", status); 
+
+  ZAid = HE5_ZAattach(zafid,"Test_1");
+  printf("ZA ID returned by HE5_ZAattach      = %d\n", ZAid); 
+
+  printf("Local Attributes:\n");
+  nattr = HE5_ZAinqlocattrs(ZAid, "L2gpValue", NULL, &strbufsize);
+  printf("Number of attributes:      %li \n", nattr);
+  printf("Length of attribute list:  %li \n", strbufsize);
+  strcpy(attrlist,"");
+  nattr = HE5_ZAinqlocattrs(ZAid, "L2gpValue", attrlist, &strbufsize);
+  printf("Attribute list:            %s \n", attrlist);
+
+  printf("Local Attribute:\n");
+  status = HE5_ZAlocattrinfo(ZAid,"T", "LocalAttribute",&dtype1, &nelem);
+  printf("Data type:                 %d\n", dtype1);
+  printf("Number of elements:        %lu \n", (unsigned long)nelem);    
+
+  status = HE5_ZAinfo(ZAid, "L2gpValue", &rank, dims, &dtype1, dimlist, maxdimlist);
+  if (status != FAIL)
+	{
+	  printf("Field rank:                %d \n", rank);
+	  printf("Dimension Sizes: \n");
+	  for ( i = 0; i < rank; i++)
+		{
+		  printf("                           %lu \n", (unsigned long)dims[i]);
+		}
+  
+	  printf("Data type ID:              %d \n", dtype1);  
+	  printf("DimList string:            %s \n", dimlist);
+	  printf("MaxdimList string:         %s \n", maxdimlist);
+	}
+
+  fieldgroup = HE5_HDFE_DATAGROUP;
+  status = HE5_ZAinqdatatype(ZAid, "T", NULL, fieldgroup, &datatype, &dtype, &order, &size);
+  printf("status returned by HE5_ZAinqdatatype   = %d \n", status);
+  if (status != FAIL)
+	{
+	  printf("Data type ID:              %d \n", datatype);
+	  printf("Data type class ID:        %d \n", dtype);
+	  printf("Byte order:                %d \n", order);
+	  printf("Data size (bytes):         %d \n", (int)size);        
+	}
+
+  status  = HE5_ZAcompinfo(ZAid,"L2gpValue", &code, level);
+  printf("status returned by HE5_ZAcompinfo      = %d\n", status);
+  if (status != FAIL)
+	{
+	  printf("Compression Information: \n");  
+	  printf("Compression code:          %d \n", code);
+	  printf("Compression level:         %d \n", level[0]);
+	}
+
+  status = HE5_ZAgetfillvalue(ZAid,"L2gpValue",&out_fillvalue);
+  printf("status returned by HE5_ZAgetfillvalue  = %d\n", status);
+  printf("The fill value:            %f\n", out_fillvalue);
+
+  status = HE5_ZAdetach(ZAid);
+  printf("status returned by HE5_ZAdetach        = %d\n", status); 
+
+  ZAid = HE5_ZAattach(zafid,"Test_1");
+  printf("ZA ID returned by HE5_ZAattach      = %d\n", ZAid); 
+
+  
+  nflds = HE5_ZAnentries(ZAid,4,&strbufsize);
+  printf("Value returned by HE5_ZAnentries       = %li\n", nflds); 
+  if (nflds != FAIL)
+	{
+	  fldrank   = (int *)calloc(nflds, sizeof(int));
+	 
+	  nflds = FAIL;
+	  nflds = HE5_ZAinquire(ZAid,fldlist,fldrank,ntype);
+	  printf("Value returned by HE5_ZAinquire  = %li \n", nflds);
+	  if (nflds != FAIL)
+		{
+		  printf("List of fields:            %s \n", fldlist); 
+		  for (i = 0; i < nflds; i++)
+			printf("Field rank, class ID:      %d, %d \n",fldrank[i],ntype[i]);
+		}
+	  
+	  free(fldrank);
+	  
+	}
+
+  status = HE5_ZAdetach(ZAid);
+  printf("status returned by HE5_ZAdetach        = %d\n", status); 
+  
+  status = HE5_ZAclose(zafid);
+  printf("status returned by HE5_ZAclose         = %d\n", status);
+
+  return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/za/TestZa.c b/testdrivers/za/TestZa.c
new file mode 100755
index 0000000..ed75fc0
--- /dev/null
+++ b/testdrivers/za/TestZa.c
@@ -0,0 +1,1953 @@
+#include <HE5_HdfEosDef.h>
+#include <tutils.h>
+
+#define BUFSIZE  256
+#define RANK1    1
+#define RANK2    2
+
+int main(int argc, char *argv[])
+{
+
+   FILE        *fp;
+
+   herr_t      status          = FAIL;
+
+   int	       i               = 0; 
+
+   int         Verbosity       = 4;
+   int         comp_level[ 5 ] = { 0, 0, 0, 0, 0 };
+   int         level[ 5 ]      = { 0, 0, 0, 0, 0 };
+   int         rank            = 1;
+   int         AttrVal[ 4 ]    = {1,2,3,4};
+   int         AttrValOut[ 4 ] = {0,0,0,0};
+   int         errcnt          = 0;
+   int         comp_code       = 0;
+   int         code            = 0;
+   int         *RankPtr        = (int *)NULL;
+   int         inarray[10]     = {1,2,3,4,5,6,7,8,9,10};
+   int         return_val      = FAIL;
+
+   hid_t       ZAid_simple     = FAIL; 
+   hid_t       ZAid_index      = FAIL;
+   hid_t       zafidc_simple   = FAIL;
+
+   hid_t       dtype           = FAIL;
+   hid_t       ntype[20];
+   
+   long        number          = FAIL;
+   long        strbufsize      = FAIL;
+   long        *DimListPtr     = (long *)NULL;
+
+   hssize_t    tstart[ 2 ]     = { 0, 0 };
+
+   hsize_t     ndims           = 0;
+   hsize_t     Dims[8]         = {0,0,0,0,0,0,0,0};
+   hsize_t     dims[ 2 ]       = { 2, 2 };
+   hsize_t     chunk_dims[ 2 ] = { 0, 0 };
+   hsize_t     tedge[ 2 ]      = { 1, 1 };
+   
+
+   hsize_t     stride[ 2 ]     = { 1, 1 };
+   hssize_t    inq_start[ 2 ]  = { 0, 0 };
+   hsize_t     inq_stride[ 2 ] = { 1, 1 };
+   hsize_t     inq_edge[ 2 ]   = { 1, 1 };
+   hsize_t     *CountPtr       = (hsize_t *)NULL;
+   hsize_t     CurrentSize[1]  = { 4 };
+   
+   double     TempData[10][4]  = { 
+	                          { 100., 101., 102., 103. },
+				  { 110., 111., 112., 113. },
+				  { 200., 201., 202., 203. }, 
+				  { 210., 211., 212., 213. }, 
+				  { 300., 301., 302., 303. }, 
+				  { 310., 311., 312., 313. }, 
+				  { 400., 401., 402., 403. }, 
+				  { 410., 411., 412., 413. }, 
+				  { 500., 501., 502., 503. }, 
+				  { 510., 511., 512., 513. } 
+                                 } ;
+
+
+   double     CondData[10][4] = { 
+                                  { 10., 20., 30., 40. },
+                                  { 11., 21., 31., 41. },
+                                  { 12., 22., 32., 42. },
+                                  { 13., 23., 33., 43. },
+                                  { 14., 24., 34., 44. },
+                                  { 15., 25., 35., 45. },
+                                  { 16., 26., 36., 46. },
+                                  { 17., 27., 37., 47. },
+                                  { 18., 28., 38., 48. },
+                                  { 19., 29., 39., 49. }
+                                 } ;
+   
+   double      TempDataOut[10][4];
+   double      fillvalue2          = -1.11111;
+   double      InqDoubleFillValue  = -1.1111;
+
+
+   char        *FieldListPtr;
+   char        *DimNamePtr; 
+   char        *ObjNamesPtr; 
+   char        DimList[200];
+
+
+   /* 
+   ********************************************************************************
+   *                 Get comand-line argument (Verbosity)                         *
+   ********************************************************************************
+   */
+   
+   
+   for (i = 1; i < argc; i++)
+	 {
+	   if ((argc > i + 1) && ((HDstrcmp(argv[i], "-verbose") == 0) || (HDstrcmp(argv[i], "-v") == 0)))
+		 {
+		   if (argv[i + 1][0] == 'l')
+			 Verbosity = 4;
+		   else if (argv[i + 1][0] == 'm')
+			 Verbosity = 6;
+		   else if (argv[i + 1][0] == 'h')
+			 Verbosity = 10;
+		   else
+			 Verbosity = atoi(argv[i + 1]);
+		 } 
+	 }
+   
+   
+   /* --------------------------------- */
+   
+   
+   MESSAGE(11,fp=fopen("TestZa.txt","w"););
+   MESSAGE(4,printf("Testing ZA C interface \n"););
+   MESSAGE(4,printf("=========================\n\n"););
+   MESSAGE(11,fprintf(fp,"Testing ZA C interface \n"););
+   MESSAGE(11,fprintf(fp,"=========================\n\n"););
+      
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAopen                             *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\tTesting HE5_ZAopen... \n"););
+   MESSAGE(4,printf("\t===================== \n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAopen... \n"););
+   MESSAGE(11,fprintf(fp,"\t===================== \n"););
+   
+   zafidc_simple = HE5_ZAopen("SimpleZa.he5",H5F_ACC_TRUNC);
+   if (zafidc_simple == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;  
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully opened the za file ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully opened the za file ****\n"););
+       
+	 }
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAcreate                           *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\tTesting HE5_ZAcreate... \n"););
+   MESSAGE(4,printf("\t======================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAcreate... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+   
+   MESSAGE(6,printf("\t\tCreating za SIMPLE \n"););   
+   MESSAGE(11,fprintf(fp,"\t\tCreating za SIMPLE \n"););
+   
+   ZAid_simple = HE5_ZAcreate(zafidc_simple,"SIMPLE"); 
+   if (ZAid_simple == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;  
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the za SIMPLE ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the za SIMPLE ****\n"););
+       
+	 }
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAcreate                           *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\tTesting HE5_ZAcreate... \n"););
+   MESSAGE(4,printf("\t=======================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAcreate... \n"););   
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+   
+   MESSAGE(6,printf("\t\tCreating za INDEX \n"););   
+   MESSAGE(11,fprintf(fp,"\t\tCreating za INDEX \n"););
+   
+   ZAid_index = HE5_ZAcreate(zafidc_simple,"INDEX"); 
+   if (ZAid_index == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;  
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully created the za INDEX ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the za INDEX ****\n"););
+       
+	 }
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAdefdim                           *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\t\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAdefdim... \n"););
+   MESSAGE(4,printf("\t=======================\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAdefdim... \n"););
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+   
+   MESSAGE(4,printf("\t\n"););
+   MESSAGE(6,printf("\t\tSetting up dimensions for za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tSetting up dimensions for za SIMPLE \n"););   
+   
+   
+   /*                 
+   ------------------------------------- ZA   SIMPLE  ---------------------------------
+	  
+	  
+	  
+   --------------------- D e f i n i n g   d i m e n s i o n   DataTrack  ----------------
+   */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension DataTrack in za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension DataTrack in za SIMPLE \n"););
+   
+   status = HE5_ZAdefdim(ZAid_simple, "DataTrack", 10);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_ZAdefdim(ZAid_simple, \"DataTrack\", 10);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefdim %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAdefdim(ZAid_simple, \"DataTrack\", 10);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefdim %d\n", status););
+	 }
+   
+   
+   /*                 
+   --------------------- D e f i n i n g   d i m e n s i o n   DataXtrack ----------------
+   */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension DataXtrack in za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension DataXtrack in za SIMPLE \n"););
+   
+   status = HE5_ZAdefdim(ZAid_simple, "DataXtrack", 4);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;      
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_ZAdefdim(ZAid_simple, \"DataXtrack\", 4);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefdim %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAdefdim(ZAid_simple, \"DataXtrack\", 4);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefdim %d\n", status););
+	 }
+   
+   
+   /*                 
+   --------------------- D e f i n i n g   d i m e n s i o n  "Unlim" ----------------
+   */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension \"Unlim\" in za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"Unlim\" in za SIMPLE \n"););
+   
+   status = HE5_ZAdefdim(ZAid_simple, "Unlim", H5S_UNLIMITED);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;      
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_ZAdefdim(ZAid_simple, \"Unlim\", H5S_UNLIMITED);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefdim %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAdefdim(ZAid_simple, \"Unlim\", H5S_UNLIMITED);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefdim %d\n", status););
+	 }
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tSetting up dimensions for za INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tSetting up dimensions for za INDEX \n"););   
+   
+   
+   /*
+   ---------------------------------- ZA  INDEX  -------------------------------------
+	  
+	  
+	  
+   --------------------- D e f i n i n g   d i m e n s i o n   TrackDim  ----------------
+   */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension TrackDim for za INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension TrackDim for za INDEX \n"););
+   
+   status = HE5_ZAdefdim(ZAid_index, "TrackDim", 8);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_ZAdefdim(ZAid_index, \"TrackDim\", 8);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefdim %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAdefdim(ZAid_index, \"TrackDim\", 8);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefdim %d\n", status););
+	 }
+   
+   
+   /*
+   --------------------- D e f i n i n g   d i m e n s i o n  XtrackDim  ----------------
+   */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining dimension XtrackDim for za INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining dimension TrackDim for za INDEX \n"););
+   
+   status = HE5_ZAdefdim(ZAid_index, "XtrackDim", 8);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_ZAdefdim(ZAid_index, \"XtrackDim\", 8);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefdim %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAdefdim(ZAid_index, \"XtrackDim\", 8);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefdim %d\n", status););
+	 }
+   
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAsetfillvalue                     *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\t\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAsetfillvalue... \n"););
+   MESSAGE(4,printf("\t=============================\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAsetfillvalue... \n"););
+   MESSAGE(11,fprintf(fp,"\t=============================\n"););
+   
+   
+   
+   /*                 
+   --------- S e t t i n g  F i l l  v a l u e  f o r  T e m p e r a t u r e  --------
+   */
+   
+   fillvalue2 = -777.;
+   
+   MESSAGE(6,printf("\t\n");); 
+   MESSAGE(6,printf("\t\tSetting fill value for field Temperature in za SIMPLE\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tSetting fill value for field Temperature in za SIMPLE\n"););
+   status = HE5_ZAsetfillvalue(ZAid_simple, "Temperature", H5T_NATIVE_DOUBLE, &fillvalue2);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;  
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_ZAsetfillvalue(ZAid_simple,\"Temperature\", &fillvalue2);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAsetfillvalue for field Temperature %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAsetfillvalue(ZAid_simple,\"Temperature\", &fillvalue2);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAsetfillvalue for field Temperature %d\n", status););
+	 }
+   
+   
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAdefine                           *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\t\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAdefine... \n"););
+   MESSAGE(4,printf("\t======================= \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAdefine... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining data fields for za SIMPLE  \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining data fields for za SIMPLE  \n"););
+   
+   
+   /*
+   ----------------------------  ZA  SIMPLE ---------------------------
+	  
+	  
+	  
+   ---------------  D e f i n i n g  T e m p e r a t u r e  --------------
+   */
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining data field Temperature\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining data field Temperature\n"););
+   
+   status = HE5_ZAdefine(ZAid_simple, "Temperature", "DataTrack,DataXtrack", NULL,H5T_NATIVE_DOUBLE); 
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;            
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););       
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");)
+		 MESSAGE(10,printf("\t\tstatus=HE5_ZAdefine(ZAid_simple,\"Temperature\",NULL, H5T_NATIVE_DOUBLE ,0);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefine %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAdefine(ZAid_simple,\"Temperature\",NULL, H5T_NATIVE_DOUBLE ,0);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefine %d\n", status););
+	 }
+   
+   
+   
+   /*
+   ---------------------------------- Defining Appendable field "Count" ---------------------
+   */
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining appendable data field Count\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining appendable data field Count\n"););
+   
+   
+   /*                 
+   --------------------   D e f i n i n g   c h u n k i n g   ---------------------
+   */
+
+   
+   chunk_dims[ 0 ] = 10;
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining chunking for za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining chunking for za SIMPLE \n"););  
+   
+   status = HE5_ZAdefchunk(ZAid_simple,RANK1,chunk_dims);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;          
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_ZAdefchunk(ZAid_simple,RANK1,chunk_dims);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefchunk %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAdefchunk(ZAid_simple,RANK1,chunk_dims);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefchunk %d\n",status););
+	 }
+   
+   
+   
+   /*                 
+   ---------------  D e f i n i n g  c o m p r e s s i o n  s c h e m e  --------------
+	  
+	  ___________________________________________________________________
+          |                                                                 |
+          |    HE5_HDFE_COMP_NONE              0                            |
+          |    HE5_HDFE_COMP_RLE               1                            |
+          |    HE5_HDFE_COMP_NBIT              2                            |
+          |    HE5_HDFE_COMP_SKPHUFF           3                            |
+          |    HE5_HDFE_COMP_DEFLATE           4                            |
+          |    HE5_HDFE_COMP_SZIP_CHIP         5                            |
+          |    HE5_HDFE_COMP_SZIP_K13          6                            |
+          |    HE5_HDFE_COMP_SZIP_EC           7                            |
+          |    HE5_HDFE_COMP_SZIP_NN           8                            |
+          |    HE5_HDFE_COMP_SZIP_K13orEC      9                            |
+          |    HE5_HDFE_COMP_SZIP_K13orNN      10                           |
+          |    HE5_HDFE_COMP_SHUF_DEFLATE      11                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_CHIP    12                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_K13     13                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_EC      14                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_NN      15                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_K13orEC 16                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_K13orNN 17                           |
+          |_________________________________________________________________| 
+   */
+   
+   
+   comp_code = 4;
+   
+   /*                 
+   ---------------  D e f i n i n g  c o m p r e s s i o n  l e v e l   --------------
+   */
+   
+   comp_level[ 0 ] = 6;
+   
+   MESSAGE(6,printf("\t\n"););  
+   MESSAGE(6,printf("\t\tDefining compression parameters for za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining compression parameters for za SIMPLE \n"););
+   
+   status = HE5_ZAdefcomp(ZAid_simple,comp_code,comp_level);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_ZAdefcomp(ZAid_simple,comp_code, comp_level);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefcomp %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAdefcomp(ZAid_simple,comp_code, comp_level);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefcomp %d\n",status););
+	 }
+   
+   
+   /*                 
+   ---------------   D e f i n i n g   C o u n t   --------------
+   */
+
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDefining data field Count\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining data field Count\n"););
+   status = HE5_ZAdefine(ZAid_simple, "Count", "DataTrack","Unlim", H5T_NATIVE_INT);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;          
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_ZAdefine(ZAid_simple, \"Count\",\"DataTrack\",\"Unlim\",H5T_NATIVE_INT,0);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefine %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAdefine(ZAid_simple,\"Count\",\"DataTrack\",\"Unlim\",H5T_NATIVE_INT,0);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefine %d\n", status););
+	 }
+   
+
+
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAdefcomp                          *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\t\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAdefcomp... \n"););
+   MESSAGE(4,printf("\t======================== \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAdefcomp... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================== \n"););
+   
+   /*                 
+   --------------------   D e f i n i n g   c h u n k i n g   ---------------------
+   */
+   
+   
+   chunk_dims[ 0 ] = 5 ;
+   chunk_dims[ 1 ] = 2 ;
+   
+   
+   MESSAGE(6,printf("\t\n"););
+   MESSAGE(6,printf("\t\tDefining chunking for za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining chunking for za SIMPLE \n"););  
+   
+   status = HE5_ZAdefchunk(ZAid_simple,RANK2,chunk_dims);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;          
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_ZAdefchunk(ZAid_simple,RANK2,chunk_dims);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefchunk %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAdefchunk(ZAid_simple,RANK2,chunk_dims);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefchunk %d\n",status););
+	 }
+   
+   /*                 
+   ---------------  D e f i n i n g  c o m p r e s s i o n  s c h e m e  --------------
+	  
+	  
+	  ___________________________________________________________________
+          |                                                                 |
+          |    HE5_HDFE_COMP_NONE              0                            |
+          |    HE5_HDFE_COMP_RLE               1                            |
+          |    HE5_HDFE_COMP_NBIT              2                            |
+          |    HE5_HDFE_COMP_SKPHUFF           3                            |
+          |    HE5_HDFE_COMP_DEFLATE           4                            |
+          |    HE5_HDFE_COMP_SZIP_CHIP         5                            |
+          |    HE5_HDFE_COMP_SZIP_K13          6                            |
+          |    HE5_HDFE_COMP_SZIP_EC           7                            |
+          |    HE5_HDFE_COMP_SZIP_NN           8                            |
+          |    HE5_HDFE_COMP_SZIP_K13orEC      9                            |
+          |    HE5_HDFE_COMP_SZIP_K13orNN      10                           |
+          |    HE5_HDFE_COMP_SHUF_DEFLATE      11                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_CHIP    12                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_K13     13                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_EC      14                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_NN      15                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_K13orEC 16                           |
+          |    HE5_HDFE_COMP_SHUF_SZIP_K13orNN 17                           |
+          |_________________________________________________________________| 
+   */
+   
+   
+   comp_code = 4;
+   
+   /*                 
+   ---------------  D e f i n i n g  c o m p r e s s i o n  l e v e l   --------------
+   */
+   
+   comp_level[ 0 ] = 6;
+   
+   MESSAGE(6,printf("\t\n"););  
+   MESSAGE(6,printf("\t\tDefining compression parameters for za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tDefining compression parameters for za SIMPLE \n"););
+   
+   status = HE5_ZAdefcomp(ZAid_simple,comp_code,comp_level);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_ZAdefcomp(ZAid_simple,comp_code, comp_level);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefcomp %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAdefcomp(ZAid_simple,comp_code, comp_level);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefcomp %d\n",status););
+	 }
+   
+   
+   /*                 
+   ---------------   D e f i n i n g   C o n d u c t i o n   --------------
+   */
+
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDefining data field Conduction\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDefining data field Conduction\n"););
+   status = HE5_ZAdefine(ZAid_simple, "Conduction", "DataTrack,DataXtrack", NULL, H5T_NATIVE_DOUBLE);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;          
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_ZAdefine(ZAid_simple, \"Conduction\",\"DataTrack,DataXtrack\",NULL,H5T_NATIVE_DOUBLE,0);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefine %d\n", status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAdefine(ZAid_simple,\"Conduction\",\"DataTrack,DataXtrack\",NULL,H5T_NATIVE_DOUBLE,0);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefine %d\n", status););
+	 }
+   
+   
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing   HE5_ZAwrite                             *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAwrite... \n"););
+   MESSAGE(4,printf("\t====================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAwrite... \n"););
+   MESSAGE(11,fprintf(fp,"\t====================== \n"););
+   
+   
+   
+   /*
+   -------------------------------- ZA SIMPLE -------------------------
+	  
+
+   --------- W r i t i n g    T e m p e r a t u r e    i n    a    z a  --------
+   */
+   
+   MESSAGE(6,printf("\n");); 
+   MESSAGE(6,printf("\t\tWriting field Temperature in za SIMPLE \n"););   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting field Temperature in za SIMPLE \n"););
+   
+   tstart[ 0 ]   = 0;
+   tstart[ 1 ]   = 0;
+   tedge[ 0 ]    = 10;
+   tedge[ 1 ]    = 4;
+   
+   status = HE5_ZAwrite(ZAid_simple, "Temperature", tstart, NULL, tedge, TempData);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_ZAwrite(ZAid_simple,\"Temperature\", tstart,stride, tedge, TempData);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAwrite %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAwrite(ZAid_simple,\"Temperature\", tstart, stride, tedge, TempData);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAwrite %d\n",status););
+	 }
+   
+   
+   
+   /*                 
+   --------- W r i t i n g    C o n d u c t i o n    i n    a    z a  --------
+   */
+   
+   
+   MESSAGE(6,printf("\n"););  
+   MESSAGE(6,printf("\t\tWriting field Conduction in za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting field Conduction in za SIMPLE \n"););
+   
+   status = HE5_ZAwrite(ZAid_simple, "Conduction", tstart, NULL, tedge, CondData);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_ZAwrite(ZAid_simple, \"Conduction\",tstart, stride, tedge, CondData);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAwrite for field Conduction in za SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAwrite(ZAid_simple,\"Conduction\", tstart, stride, tedge, CondData);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAwrite for field Conduction in za SIMPLE %d\n",status););
+	 }
+   
+   
+   
+   /*                 
+   --------- W r i t i n g    C o u n t    i n    a    z a  --------
+   */
+
+   tstart[0] = 0; tedge[0] = 40;
+   
+   MESSAGE(6,printf("\n"););  
+   MESSAGE(6,printf("\t\tWriting field Count in za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting field Count in za SIMPLE \n"););
+   
+   status = HE5_ZAwrite(ZAid_simple, "Count", tstart, NULL, tedge, inarray);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_ZAwrite(ZAid_simple, \"Count\",tstart, NULL, tedge, inarray);\n"););
+       MESSAGE(8,printf("\t\tValue returned by HE5_ZAwrite for field Count in za SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAwrite(ZAid_simple,\"Count\", tstart, stride, NULL, inarray);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAwrite for field Conduction in za SIMPLE %d\n",status););
+	 }
+   
+
+
+   /*
+   *********************************************************************************
+   *                             Testing   HE5_ZAwriteattr                         *
+   *********************************************************************************
+   */
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAwriteattr... \n"););
+   MESSAGE(4,printf("\t==========================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAwriteattr... \n"););
+   MESSAGE(11,fprintf(fp,"\t==========================\n"););
+   
+   /*                 
+   --------- W r i t i n g   " D r i f t "    i n    a    z a  --------
+   */
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tWriting attribute Drift in za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););   
+   MESSAGE(11,fprintf(fp,"\t\tWriting attribute Drift in za SIMPLE \n"););   
+   status = HE5_ZAwriteattr(ZAid_simple,"Drift",H5T_NATIVE_INT,CurrentSize,AttrVal);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_ZAwriteattr(ZAid_simple, \"Drift\",H5T_NATIVE_INT, 4, AttrVal);\n"););
+       MESSAGE(8,printf("\t\tValue returned by ZAwriteattr for attribute Drift in za SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAwriteattr(ZAid_simple, \"Drift\",H5T_NATIVE_INT, 4, AttrVal);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by ZAwriteattr for attribute Drift in za SIMPLE %d\n",status););
+
+       MESSAGE(11,fprintf(fp,"\t\t Attribute element   Value to write \n"););
+       MESSAGE(11,printf("\t\t Attribute element   Value to write \n"););
+
+	   for( i = 0; i < 4 ; i++ )  
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t    %d                   %d \n",i+1,AttrVal[ i ] ););
+		   MESSAGE(11,printf("\t\t    %d                   %d \n", i+1,AttrVal[ i ] ););
+		 }
+
+
+	 }
+      
+         
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing   HE5_ZAreadattr                          *
+   *********************************************************************************
+   */
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAreadattr... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAreadattr... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+   
+   
+   /*                 
+   --------- R e a d i n g   " D r i f t "    a t t r i b u t e  --------
+   */
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tReading attribute Drift from za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tReading attribute Drift from za SIMPLE \n"););
+   
+   status = HE5_ZAreadattr(ZAid_simple,"Drift", AttrValOut);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_ZAreadattr(ZAid_simple,\"Drift\", AttrValOut);\n"););
+       MESSAGE(8,printf("\t\tValue returned by ZAreadattr for attribute Drift in za SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAreadattr(ZAid_simple,\"Drift\", AttrValOut);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by ZAreadattr for attribute Drift in za SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\t Attribute elements read \n"););
+       MESSAGE(8,printf("\t\t Attribute elements read \n"););      
+       MESSAGE(8,printf("\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+	   for( i = 0; i < 4 ; i++ )  
+		 {
+		   MESSAGE(11,fprintf(fp,"\t\t            %d \n", AttrValOut[ i ] ););
+		   MESSAGE(8,printf("\t\t               %d \n", AttrValOut[ i ] ););       
+		 }
+	 }
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing   HE5_ZAnentries                          *
+   *********************************************************************************
+   */
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAnentries... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAnentries... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+   
+   
+   /*                 
+   -----  R e t r i e v e   #  o f   d i m e n s i o n s   i n   a   z a  -----
+   */
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve number of dimensions in za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve number of dimensions in za SIMPLE \n"););
+   
+   number = HE5_ZAnentries(ZAid_simple,0,&strbufsize);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_ZAnentries(ZAid_simple,0,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tNumber of dimensions  %li\n",number););
+       MESSAGE(8,printf("\t\tString size of dimension entries:        %li (bytes)\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_ZAnentries(ZAid_simple,0,&strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of dimensions  %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tString size of dimension entries:        %li (bytes)\n",strbufsize););
+	 }
+   
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing   HE5_ZAinqdims                           *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAinqdims... \n"););
+   MESSAGE(4,printf("\t======================== \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAinqdims... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================== \n"););
+   
+   DimNamePtr      = (char  *)calloc( 1, strbufsize+1);
+   
+   
+   /*                 
+   -----  R e t r i e v e   d i m e n s i o n   l i s t  f o r   a   z a  -----
+   */   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve the dimension information for za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve the dimension information for za SIMPLE \n"););
+   
+   
+   number = HE5_ZAinqdims(ZAid_simple,DimNamePtr,Dims);   
+   if (number == FAIL)
+	 {       
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(8,printf("\t\tnumber=HE5_ZAinqdims(ZAid_simple,DimNamePtr,DimListPtr);\n"););
+       MESSAGE(8,printf("\t\tDimension list: \n"););
+       MESSAGE(8,printf("\t\t                %s\n",DimNamePtr););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_ZAinqdims(ZAid_simple,DimNamePtr,DimListPtr);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tDimension list: \n"););
+       MESSAGE(11,fprintf(fp,"\t\t                %s\n",DimNamePtr););
+       MESSAGE(8,printf("\t\tDimension sizes: \n"););
+       MESSAGE(11,fprintf(fp,"\t\tDimension sizes: \n"););
+       for (i = 0; i < number; i++)
+		 {
+		   MESSAGE(8,printf("\t\t                %lu\n",(unsigned long)Dims[i]););
+		   MESSAGE(11,fprintf(fp,"\t\t                %lu\n",(unsigned long)Dims[i]););
+		 }
+	 }
+   
+   
+   free(DimNamePtr);
+   DimNamePtr = NULL;
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing   HE5_ZAinquire                           *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAinquire... \n"););
+   MESSAGE(4,printf("\t======================== \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAinquire... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about Data fields in za SIMPLE\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about Data fields in za SIMPLE\n"););
+   
+   number = HE5_ZAnentries(ZAid_simple,4,&strbufsize);   
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_ZAnentries(ZAid_simple,4,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tValue (number of data fields) returned by ZAnentries %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_ZAnentries(ZAid_simple,4,&strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue (number of data fields) returned by ZAnentries %li\n",number););
+	 }
+   
+   RankPtr         = (int *)calloc(number, sizeof(int));
+   FieldListPtr    = (char  *)calloc( BUFSIZE, sizeof(char));
+
+   
+   MESSAGE(6,printf("\t\tRetrieve the Data fields in za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve the Data fields in za SIMPLE \n"););
+	 
+   number = HE5_ZAinquire(ZAid_simple,FieldListPtr,RankPtr,ntype);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_ZAinquire(ZAid_simple,FieldListPtr,RankPtr,ntype);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_ZAinquire(ZAid_simple,FieldListPtr,RankPtr,ntype);\n"););
+       MESSAGE(8,printf("\t\tList of Data fields:\n"););
+       MESSAGE(8,printf("\t\t  %s\n",FieldListPtr););
+       MESSAGE(11,fprintf(fp,"\t\tList of Data fields:\n"););
+       MESSAGE(11,fprintf(fp,"\t\t   %s\n",FieldListPtr););
+       MESSAGE(8,printf("\t\tRanks:       Data types:\n"););
+       MESSAGE(11,fprintf(fp,"\t\tRanks:        Data types:\n"););
+
+	   for (i = 0; i < number; i++)
+		 {
+           MESSAGE(8,printf("\t\t %d             %d\n", RankPtr[i], ntype[i]););
+           MESSAGE(11,fprintf(fp,"\t\t %d             %d\n", RankPtr[i], ntype[i]););
+		 }
+	 }
+   
+   free(RankPtr);
+   free(FieldListPtr);
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing   HE5_ZAdiminfo...                        *
+   *********************************************************************************
+   */
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAdiminfo... \n"););
+   MESSAGE(4,printf("\t======================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAdiminfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about DataXtrack dimension in za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about DataXtrack dimension in za SIMPLE \n"););
+   
+   
+   ndims = HE5_ZAdiminfo(ZAid_simple,"DataXtrack");   
+   if ( ndims == 0)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tndims=HE5_ZAdiminfo(ZAid_simple,\"DataXtrack\");\n"););
+       MESSAGE(8,printf("\t\tSize of dimension DataXtrack:    %lu \n",(unsigned long)ndims););
+       MESSAGE(11,fprintf(fp,"\t\tndims=HE5_ZAdiminfo(ZAid_simple,\"DataXtrack\");\n"););
+       MESSAGE(11,fprintf(fp,"\t\tSize of dimension DataXtrack:      %lu \n",(unsigned long)ndims););
+	 }
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAread                             *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAread... \n"););
+   MESSAGE(4,printf("\t===================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAread... \n"););
+   MESSAGE(11,fprintf(fp,"\t===================== \n"););
+   
+   inq_start[0]  = 0;
+   inq_start[1]  = 0;
+   inq_stride[0] = 1;
+   inq_stride[1] = 1;
+   inq_edge[0]   = 10;
+   inq_edge[1]   = 4;
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tReading data from field \"Temperature\" in za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tReading data from field \"Temperature\" in za SIMPLE\n"););
+   
+   number = HE5_ZAread(ZAid_simple,"Temperature",inq_start,inq_stride,inq_edge,TempDataOut);   
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;       
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_ZAread(ZAid_simple,\"Temperature\",inq_start,inq_stride,inq_edge,TempDataOut);\n"););
+       MESSAGE(8,printf("\t\tstatus return from call to ZAread %li\n", number ););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_ZAread(ZAid_simple,\"Temperature\",inq_start,inq_stride,inq_edge,TempDataOut);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus return from call to ZAread %li\n", number ););
+       MESSAGE(8,printf("\t\tThe values of data field \"Temperature\":\n"););
+       MESSAGE(11,fprintf(fp,"\t\tThe values of data field \"Temperature\":\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(8,printf("\n"););
+       for (i = 0; i < 10; i++)
+		 {
+		   MESSAGE(8,printf("\t\t    %lf  %lf  %lf  %lf \n",TempDataOut[i][0],TempDataOut[i][1],TempDataOut[i][2],TempDataOut[i][3] ););
+		   MESSAGE(11,fprintf(fp,"\t\t    %lf  %lf  %lf  %lf \n",TempDataOut[i][0],TempDataOut[i][1],TempDataOut[i][2],TempDataOut[i][3] ););
+		 }
+	 }
+   
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAinfo                             *
+   *********************************************************************************
+   */
+      
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAinfo... \n"););
+   MESSAGE(4,printf("\t===================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););   
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAinfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t===================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about field \"Temperature\" in za SIMPLE e\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about field \"Temperature\" in za SIMPLE \n"););
+   
+   status = HE5_ZAinfo(ZAid_simple,"Temperature",&rank,dims,&dtype,DimList,NULL);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_ZAinfo(ZAid_simple,\"Temperature\",&rank,dims,&dtype,DimList,NULL);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by ZAfieldinfo %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAinfo(ZAid_simple,\"Temperature\",&rank,dims,&dtype,DimList,NULL);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by ZAfieldinfo %d\n",status););
+       MESSAGE(8,printf("\t\tRank:   %d      Data type:     %d\n",rank, dtype););
+       MESSAGE(8,printf("\t\tDimension list:           %s\n",DimList););
+       MESSAGE(11,fprintf(fp,"\t\tRank:    %d      Data type:    %d\n",rank, dtype););
+       MESSAGE(11,fprintf(fp,"\t\tDimension list:          %s\n",DimList););
+       MESSAGE(8,printf("\t\tDimension sizes:\n"););
+       MESSAGE(11,fprintf(fp,"\t\tDimension sizes:\n"););
+       for (i = 0; i < rank; i++)
+		 {
+		   MESSAGE(8,printf("\t\t  %lu\n",(unsigned long)dims[i]););
+		   MESSAGE(11,fprintf(fp,"\t\t  %lu\n",(unsigned long)dims[i]););
+		 }
+       
+	 }
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAinqattrs                         *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAinqattrs... \n"););
+   MESSAGE(4,printf("\t========================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAinqattrs... \n"););
+   MESSAGE(11,fprintf(fp,"\t========================= \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about attributes defined in za INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attributes defined in za INDEX \n"););
+   
+   number = HE5_ZAinqattrs(ZAid_simple, NULL, &strbufsize);   
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_ZAinqattrs(ZAid_simple, NULL, &strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_ZAinqattrs(ZAid_simple, NULL, &strbufsize);\n"););
+       MESSAGE(8,printf("\t\tValue (number of attributes) returned by ZAinqattrs %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tValue (number of attributes) returned by ZAinqattrs %li\n",number););
+       MESSAGE(8,printf("\t\tString length of attribute list:     %li\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tString length of attribute list:    %li\n",strbufsize););
+	 }
+   
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve more information about attributes defined in za INDEX \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve more information about attributes defined in za INDEX \n"););
+   
+   ObjNamesPtr     = (char  *)calloc( BUFSIZE, sizeof(char));
+   
+   number = HE5_ZAinqattrs(ZAid_simple, ObjNamesPtr, &strbufsize);   
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber=HE5_ZAinqattrs(ZAid_simple, ObjNamesPtr, &strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_ZAinqattrs(ZAid_simple, ObjNamesPtr,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tNumber of attributes returned by ZAinqattr    %li\n",number););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of attributes returned by ZAinqattr    %li\n",number););
+       MESSAGE(8,printf("\t\tAttribute list:\n"););
+       MESSAGE(8,printf("\t\t    %s\n", ObjNamesPtr););
+       MESSAGE(11,fprintf(fp,"\t\tAttribute list: \n"););
+       MESSAGE(11,fprintf(fp,"\t\t    %s\n", ObjNamesPtr););
+       MESSAGE(8,printf("\t\tString length of attribute list:     %li\n",strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tString length of attribute list:      %li\n",strbufsize););
+	 }
+   
+   free(ObjNamesPtr);
+   ObjNamesPtr = NULL;
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAattrinfo                         *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAattrinfo... \n"););
+   MESSAGE(4,printf("\t=========================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAattrinfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t=========================\n"););
+   
+   CountPtr        = (hsize_t *)calloc(1, sizeof(hsize_t));
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about attribute \"Drift\" \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attribute \"Drift\" \n"););
+   
+   status=HE5_ZAattrinfo(ZAid_simple,"Drift",&dtype,CountPtr);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_ZAattrinfo(ZAid_simple,\"Drift\",&dtype,CountPtr);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by ZAattrinfo %d\n",status););
+       MESSAGE(6,printf("\t\tData type   Number of attribute elements:\n"););
+       MESSAGE(6,printf("\t\t   %d            %d\n", dtype,(int)*CountPtr););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAattrinfo(ZAid_simple,\"Drift\",&dtype,CountPtr);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tStaus returned by ZAattrinfo %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tData type   Number of attribute elements:\n"););
+       MESSAGE(11,fprintf(fp,"\t\t   %d            %d\n", dtype,(int)*CountPtr););
+	 }
+   
+   
+   free(CountPtr);
+      
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAcompinfo                         *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAcompinfo... \n"););
+   MESSAGE(4,printf("\t========================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAcompinfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t========================= \n"););
+   MESSAGE(6,printf("\n");); 
+   MESSAGE(6,printf("\t\tRetrieve Compression information for field \"Temperature\"\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve Compression information for field \"Temperature\"\n"););
+   
+   status = HE5_ZAcompinfo(ZAid_simple,"Temperature",&code,level);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {       
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(8,printf("\t\tCompression scheme       Compression level\n"););
+       MESSAGE(8,printf("\t\t    %d,                      %d\n", code, level[0]););
+       MESSAGE(11,fprintf(fp,"\t\tCompression scheme       Compression level\n"););
+       MESSAGE(11,fprintf(fp,"\t\t    %d,                      %d\n", code, level[0]););
+	 }
+   
+   
+   code       = - 8;
+   level[ 0 ] = - 8;
+   
+   MESSAGE(4,printf("\n"););   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(6,printf("\t\tRetrieve Compression information for field \"Conduction\"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve Compression information for field \"Conduction\"\n"););
+   
+   status = HE5_ZAcompinfo(ZAid_simple,"Conduction",&code,level);
+   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {       
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(8,printf("\t\tCompression scheme       Compression level\n"););
+       MESSAGE(8,printf("\t\t    %d,                      %d\n", code, level[0]););
+       MESSAGE(11,fprintf(fp,"\t\tCompression scheme       Compression level\n"););
+       MESSAGE(11,fprintf(fp,"\t\t    %d,                      %d\n", code, level[0]););
+	 }
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAgetfillvalue                     *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\n"););    
+   MESSAGE(4,printf("\tTesting HE5_ZAgetfillvalue... \n"););
+   MESSAGE(4,printf("\t============================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAgetfillvalue... \n"););
+   MESSAGE(11,fprintf(fp,"\t============================= \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tGet fill value for field \"Temperature\"\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tGet fill value for field \"Temperature\"\n"););
+   status = HE5_ZAgetfillvalue(ZAid_simple,"Temperature",&InqDoubleFillValue);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_ZAgetfillvalue(ZAid_simple,\"Temperature\",&InqDoubleFillValue);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by ZAgetfillvalue %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAgetfillvalue(ZAid_simple,\"Temperature\", &InqDoubleFillValue)\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by ZAgetfillvalue %d\n",status););
+       MESSAGE(8,printf("\t\tFill value for field \"Temperature\":\n"););
+       MESSAGE(8,printf("\n"););
+       MESSAGE(8,printf("\t\t     \"%lf\" \n", InqDoubleFillValue););
+       MESSAGE(11,fprintf(fp,"\t\tFill value for field \"Temperature\":\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t      \"%lf\" \n",InqDoubleFillValue););
+	 }
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAdetach                           *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAdetach... \n"););
+   MESSAGE(4,printf("\t======================= \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAdetach... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDetaching from za SIMPLE \n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from za SIMPLE \n"););
+   
+
+   status = HE5_ZAdetach(ZAid_simple);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_ZAdetach(ZAid_simple);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by ZAdetach()   %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAdetach(ZAid_simple);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by ZAdetach()    %d\n",status););
+	 }
+   
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAattach                           *
+   *********************************************************************************
+   */
+
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAattach... \n"););
+   MESSAGE(4,printf("\t=======================\n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAattach... \n"););
+   MESSAGE(11,fprintf(fp,"\t=======================\n"););
+  
+   ZAid_simple = HE5_ZAattach(zafidc_simple,"SIMPLE");
+   if (ZAid_simple == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully attached to the za SIMPLE ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully attached to the za SIMPLE ****\n"););
+	 }
+   
+   
+   /*
+   *********************************************************************************
+   *                  Testing  Appending data to the field                         *
+   *********************************************************************************
+   */
+   
+   tstart[0] = 30; tedge[0] = 10;
+   
+   MESSAGE(6,printf("\n"););  
+   MESSAGE(6,printf("\t\tWriting extended data to the field Count in za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tWriting extended data to the field Count in za SIMPLE \n"););
+   
+   status = HE5_ZAwrite(ZAid_simple, "Count", tstart, NULL, tedge, inarray);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););          
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_ZAwrite(ZAid_simple, \"Count\",tstart, NULL, tedge, inarray);\n"););
+       MESSAGE(8,printf("\t\tValue returned by ZAwrite for field Count in za SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAwrite(ZAid_simple,\"Count\", tstart, stride, NULL, inarray);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by ZAwrite for field Conduction in za SIMPLE %d\n",status););
+	 }
+   
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAinfo                             *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAinfo... \n"););
+   MESSAGE(4,printf("\t===================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\t\n"););   
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAinfo... \n"););
+   MESSAGE(11,fprintf(fp,"\t===================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tRetrieve information about field \"Count\" in za SIMPLE e\n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););  
+   MESSAGE(11,fprintf(fp,"\t\tRetrieve information about field \"Count\" in za SIMPLE \n"););
+   
+   status = HE5_ZAinfo(ZAid_simple,"Count",&rank,dims, &dtype,NULL,DimList);   
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus=HE5_ZAinfo(ZAid_simple,\"Count\",&rank,dims,&dtype,NULL,DimList);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by ZAfieldinfo %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAinfo(ZAid_simple,\"Count\",&rank,dims, &dtype,NULL,DimList);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by ZAfieldinfo %d\n",status););
+       MESSAGE(8,printf("\t\tRank:   %d      Data type:     %d\n",rank, dtype););
+       MESSAGE(8,printf("\t\tMaximum Dimension list:           %s\n",DimList););
+       MESSAGE(11,fprintf(fp,"\t\tRank:    %d      Data type:    %d\n",rank, dtype););
+       MESSAGE(11,fprintf(fp,"\t\tMaximum Dimension list:          %s\n",DimList););
+       MESSAGE(8,printf("\t\tDimension sizes:\n"););
+       MESSAGE(11,fprintf(fp,"\t\tDimension sizes:\n"););
+       for (i = 0; i < rank; i++)
+		 {
+		   MESSAGE(8,printf("\t\t  %lu\n",(unsigned long)dims[i]););
+		   MESSAGE(11,fprintf(fp,"\t\t  %lu\n",(unsigned long)dims[i]););
+		 }
+       
+	 }
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAdetach                           *
+   *********************************************************************************
+   */
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAdetach... \n"););
+   MESSAGE(4,printf("\t======================= \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAdetach... \n"););
+   MESSAGE(11,fprintf(fp,"\t======================= \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tDetaching from za SIMPLE \n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tDetaching from za SIMPLE \n"););
+
+   status = HE5_ZAdetach(ZAid_simple);
+   if (status == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););   
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+       errcnt++;
+	 }
+   else
+	 {   
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tstatus = HE5_ZAdetach(ZAid_simple);\n"););
+       MESSAGE(8,printf("\t\tstatus returned by ZAdetach for za SIMPLE %d\n",status););
+       MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAdetach(ZAid_simple);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tstatus returned by ZAdetach for za SIMPLE%d\n",status););
+	 }
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    HE5_ZAclose                            *
+   *********************************************************************************
+   */
+   
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting HE5_ZAclose... \n"););
+   MESSAGE(4,printf("\t====================== \n"););
+   MESSAGE(11,fprintf(fp,"\t\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAclose... \n"););
+   MESSAGE(11,fprintf(fp,"\t====================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tClosing the file SimpleZa.he5\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tClosing the file SimpleZa.he5\n"););
+   
+   status = HE5_ZAclose(zafidc_simple);
+   if (status == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+	   errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\t\t*** Successfully clossed the SimpleZa.he5 file ****\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t*** Successfully clossed the SimpleZa.he5 file ****\n"););
+	 }
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    ZAopen                                 *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting ZAopen... \n"););
+   MESSAGE(4,printf("\t=================\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting ZAopen... \n"););
+   MESSAGE(11,fprintf(fp,"\t=================\n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tOpening the file SimpleZa.he5\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tOpening the file SimpleZa.he5\n"););
+   
+   zafidc_simple = HE5_ZAopen("SimpleZa.he5",H5F_ACC_RDWR);
+   if (zafidc_simple == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\t\t*** Successfully opened the za file ****\n"););
+       MESSAGE(11,fprintf(fp,"\t\t*** Successfully opened the za file ****\n"););
+       
+	 }
+   
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    ZAinqza                                *
+   *********************************************************************************
+   */
+   
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting ZAinqza... \n"););
+   MESSAGE(4,printf("\t=================\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting ZAinqza... \n"););
+   MESSAGE(11,fprintf(fp,"\t=================\n"););
+   
+   MESSAGE(6,printf("\n"););  
+   MESSAGE(6,printf("\t\tRetrieving general information about objects within the file\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tRetrieving general information about objects within the file\n"););
+   number = HE5_ZAinqza("SimpleZa.he5",NULL,&strbufsize);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););   
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber = HE5_ZAinqza(\"SimpleZa.he5\",NULL,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tValue returned by ZAinqza %li\n", number););
+       MESSAGE(8,printf("\t\tString length returned by ZAinqza %li\n", strbufsize););
+       MESSAGE(11,fprintf(fp,"\t\tnumber = HE5_ZAinqza(\"SimpleZa.he5\",NULL,&strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tValue returned by ZAinqza %li\n", number););
+       MESSAGE(11,fprintf(fp,"\t\tStringlength returned by ZAinqza %li\n", strbufsize););
+	 }
+   
+   
+   
+   MESSAGE(6,printf("\n"););  
+   MESSAGE(6,printf("\t\tContinue ...\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tContinue ...\n"););
+   ObjNamesPtr = (char *)calloc(strbufsize+1, sizeof(char ) );
+   number = HE5_ZAinqza("SimpleZa.he5",ObjNamesPtr,&strbufsize);
+   if (number == FAIL)
+	 {
+       MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););  
+       errcnt++;
+	 }
+   else
+	 {
+       MESSAGE(4,printf("\n"););   
+       MESSAGE(4,printf("\t\t********Passed Test**********\n"););
+       MESSAGE(11,fprintf(fp,"\n"););
+       MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n"););
+       MESSAGE(10,printf("\t\tnumber = HE5_ZAinqza(\"SimpleZa.he5\",ObjNamesPtr,&strbufsize);\n"););
+       MESSAGE(8,printf("\t\tNumber of za objects:        %li\n", number););
+       MESSAGE(8,printf("\t\tList of za objects:      %s\n", ObjNamesPtr););
+       MESSAGE(11,fprintf(fp,"\t\tnumber = HE5_ZAinqza(\"SimpleZa.he5\",ObjNamesPtr,&strbufsize);\n"););
+       MESSAGE(11,fprintf(fp,"\t\tNumber of za objecys:       %li\n", number););
+       MESSAGE(11,fprintf(fp,"\t\tList of za objects:      %s\n", ObjNamesPtr););
+
+	 }
+   
+   
+   free(ObjNamesPtr);
+   
+   
+   
+   
+   /*
+   *********************************************************************************
+   *                             Testing    ZAclose                                *
+   *********************************************************************************
+   */
+
+   MESSAGE(4,printf("\n"););
+   MESSAGE(4,printf("\tTesting ZAclose... \n"););
+   MESSAGE(4,printf("\t====================== \n"););
+   
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\tTesting ZAclose... \n"););
+   MESSAGE(11,fprintf(fp,"\t====================== \n"););
+   
+   MESSAGE(6,printf("\n"););
+   MESSAGE(6,printf("\t\tClosing the file SimpleZa.he5\n"););
+   MESSAGE(11,fprintf(fp,"\n"););
+   MESSAGE(11,fprintf(fp,"\t\tClosing the file SimpleZa.he5\n"););
+   
+   status = HE5_ZAclose(zafidc_simple);
+   if (status == FAIL)
+	 {
+	   MESSAGE(4,printf("\t\t********Error unexpected**********\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n"););
+	   errcnt++;
+	 }
+   else
+	 {
+	   MESSAGE(4,printf("\t\tSuccessfully clossed the SimpleZa.he5 file \n"););
+	   MESSAGE(11,fprintf(fp,"\t\tSuccessfully clossed the SimpleZa.he5 file \n"););
+	   MESSAGE(4,printf("\n"););
+	   MESSAGE(4,printf("\t ........... End of Testing. \n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t ............. End of Testing. \n"););
+	 }
+   
+   if (errcnt == 0)
+	 {
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\t\t A L L    T E S T S     P A S S E D \n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t A L L    T E S T S     P A S S E D \n"););
+           return_val = 0;
+	 }
+   else
+	 {
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\n"););
+	   MESSAGE(11,printf("\t\t%d    T E S T S     F A I L E D \n",errcnt););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\n"););
+	   MESSAGE(11,fprintf(fp,"\t\t%d    T E S T S     F A I L E D \n",errcnt););
+           return_val = 1;
+	 }
+      
+   MESSAGE(11,fclose(fp););
+   return return_val;
+}
+
+
diff --git a/testdrivers/za/hdfeos5.inc b/testdrivers/za/hdfeos5.inc
new file mode 100644
index 0000000..a6af5e8
--- /dev/null
+++ b/testdrivers/za/hdfeos5.inc
@@ -0,0 +1,411 @@
+! * ==========================================================
+! * File:       hdfeos5.inc
+! * Author:     A. Muslimov, Emergent Technology Services, Inc.
+! * Date:       March 11, 2002
+! * Purpose:    Fortran header file for HDFEOS5 routines
+! * ==========================================================
+! * Contents: 
+! *     HDFEOS5 data type tags
+! *     HDFEOS5 logical constants
+! *     HDFEOS5 file access tags
+! *     HDFEOS5/GCTP library codes   
+! *
+! * ===========================================================
+ 
+!          HDFEOS5  DATA TYPE TAGS 
+!          =======================
+
+           integer   HE5T_NATIVE_INT
+           integer   HE5T_NATIVE_UINT
+           integer   HE5T_NATIVE_SHORT
+           integer   HE5T_NATIVE_USHORT
+           integer   HE5T_NATIVE_SCHAR
+           integer   HE5T_NATIVE_UCHAR
+           integer   HE5T_NATIVE_LONG
+           integer   HE5T_NATIVE_ULONG
+           integer   HE5T_NATIVE_LLONG
+           integer   HE5T_NATIVE_ULLONG
+           integer   HE5T_NATIVE_FLOAT
+           integer   HE5T_NATIVE_REAL
+           integer   HE5T_NATIVE_DOUBLE
+           integer   HE5T_NATIVE_LDOUBLE
+           integer   HE5T_NATIVE_INT8
+           integer   HE5T_NATIVE_UINT8
+           integer   HE5T_NATIVE_INT16
+           integer   HE5T_NATIVE_UINT16
+           integer   HE5T_NATIVE_INT32
+           integer   HE5T_NATIVE_UINT32
+           integer   HE5T_NATIVE_INT64
+           integer   HE5T_NATIVE_UINT64
+           integer   HE5T_NATIVE_B8
+           integer   HE5T_NATIVE_B16
+           integer   HE5T_NATIVE_B32
+           integer   HE5T_NATIVE_B64
+           integer   HE5T_NATIVE_HSIZE
+           integer   HE5T_NATIVE_HERR
+           integer   HE5T_NATIVE_HBOOL
+
+           integer   HE5T_STD_I8BE
+           integer   HE5T_STD_I8LE
+           integer   HE5T_STD_I16BE
+           integer   HE5T_STD_I16LE
+           integer   HE5T_STD_I32BE
+           integer   HE5T_STD_I32LE
+           integer   HE5T_STD_I64BE
+           integer   HE5T_STD_I64LE
+           integer   HE5T_STD_U8BE
+           integer   HE5T_STD_U8LE
+           integer   HE5T_STD_U16BE
+           integer   HE5T_STD_U16LE
+           integer   HE5T_STD_U32BE
+           integer   HE5T_STD_U32LE
+           integer   HE5T_STD_U64BE
+           integer   HE5T_STD_U64LE
+           integer   HE5T_STD_B8BE
+           integer   HE5T_STD_B8LE
+           integer   HE5T_STD_B16BE
+           integer   HE5T_STD_B16LE
+           integer   HE5T_STD_B32BE
+           integer   HE5T_STD_B32LE
+           integer   HE5T_STD_B64BE
+           integer   HE5T_STD_B64LE
+
+           integer   HE5T_IEEE_F32BE                      
+           integer   HE5T_IEEE_F32LE                      
+           integer   HE5T_IEEE_F64BE                      
+           integer   HE5T_IEEE_F64LE                      
+           integer   HE5T_NATIVE_CHAR
+           integer   HE5T_CHARSTRING
+
+           parameter(HE5T_NATIVE_INT      = 0)
+           parameter(HE5T_NATIVE_UINT     = 1)
+           parameter(HE5T_NATIVE_SHORT    = 2)
+           parameter(HE5T_NATIVE_USHORT   = 3)
+           parameter(HE5T_NATIVE_SCHAR    = 4)
+           parameter(HE5T_NATIVE_UCHAR    = 5)
+           parameter(HE5T_NATIVE_LONG     = 6)
+           parameter(HE5T_NATIVE_ULONG    = 7)
+           parameter(HE5T_NATIVE_LLONG    = 8)
+           parameter(HE5T_NATIVE_ULLONG   = 9)
+           parameter(HE5T_NATIVE_FLOAT    =10)
+           parameter(HE5T_NATIVE_REAL     =10)
+           parameter(HE5T_NATIVE_DOUBLE   =11)
+           parameter(HE5T_NATIVE_LDOUBLE  =12)
+           parameter(HE5T_NATIVE_INT8     =13)
+           parameter(HE5T_NATIVE_UINT8    =14)
+           parameter(HE5T_NATIVE_INT16    =15)
+           parameter(HE5T_NATIVE_UINT16   =16)
+           parameter(HE5T_NATIVE_INT32    =17)
+           parameter(HE5T_NATIVE_UINT32   =18)
+           parameter(HE5T_NATIVE_INT64    =19)
+           parameter(HE5T_NATIVE_UINT64   =20)
+           parameter(HE5T_NATIVE_B8       =21)
+           parameter(HE5T_NATIVE_B16      =22)
+           parameter(HE5T_NATIVE_B32      =23)
+           parameter(HE5T_NATIVE_B64      =24)
+           parameter(HE5T_NATIVE_HSIZE    =25)
+           parameter(HE5T_NATIVE_HERR     =26)
+           parameter(HE5T_NATIVE_HBOOL    =27)
+
+           parameter(HE5T_STD_I8BE        =28)
+           parameter(HE5T_STD_I8LE        =29)
+           parameter(HE5T_STD_I16BE       =30)
+           parameter(HE5T_STD_I16LE       =31)
+           parameter(HE5T_STD_I32BE       =32)
+           parameter(HE5T_STD_I32LE       =33)
+           parameter(HE5T_STD_I64BE       =34)
+           parameter(HE5T_STD_I64LE       =35)
+           parameter(HE5T_STD_U8BE        =36)
+           parameter(HE5T_STD_U8LE        =37)
+           parameter(HE5T_STD_U16BE       =38)
+           parameter(HE5T_STD_U16LE       =39)
+           parameter(HE5T_STD_U32BE       =40)
+           parameter(HE5T_STD_U32LE       =41)
+           parameter(HE5T_STD_U64BE       =42)
+           parameter(HE5T_STD_U64LE       =43)
+           parameter(HE5T_STD_B8BE        =44)
+           parameter(HE5T_STD_B8LE        =45)
+           parameter(HE5T_STD_B16BE       =46)
+           parameter(HE5T_STD_B16LE       =47)
+           parameter(HE5T_STD_B32BE       =48)
+           parameter(HE5T_STD_B32LE       =49)
+           parameter(HE5T_STD_B64BE       =50)
+           parameter(HE5T_STD_B64LE       =51)
+
+           parameter(HE5T_IEEE_F32BE      =52)                
+           parameter(HE5T_IEEE_F32LE      =53)                
+           parameter(HE5T_IEEE_F64BE      =54)                
+           parameter(HE5T_IEEE_F64LE      =55)                
+
+           parameter(HE5T_NATIVE_CHAR     =56)                
+           parameter(HE5T_CHARSTRING      =57)
+
+           integer   HE5S_UNLIMITED_F
+           parameter(HE5S_UNLIMITED_F = -1)
+
+
+!          HDFEOS5 FILE ACCESS TAGS 
+!          ========================
+ 
+           integer   HE5F_ACC_RDWR
+           integer   HE5F_ACC_RDONLY
+           integer   HE5F_ACC_TRUNC
+
+           parameter(HE5F_ACC_RDWR   = 100)
+           parameter(HE5F_ACC_RDONLY = 101)
+           parameter(HE5F_ACC_TRUNC  = 102)
+
+!          TOOLKIT FILE ACCESS TAGS 
+!          ========================
+ 
+           integer   HDF4_ACC_RDONLY
+           integer   HDF4_ACC_RDWR
+           integer   HDF4_ACC_CREATE
+
+           integer   HDF5_ACC_RDONLY
+           integer   HDF5_ACC_RDWR
+           integer   HDF5_ACC_CREATE
+
+           parameter(HDF4_ACC_RDONLY = 1)
+           parameter(HDF4_ACC_RDWR   = 3)
+           parameter(HDF4_ACC_CREATE = 4)
+
+           parameter(HDF5_ACC_RDONLY = 11)
+           parameter(HDF5_ACC_RDWR   = 13)
+           parameter(HDF5_ACC_CREATE = 14)
+
+
+!          HDFEOS5  MERGE CODES 
+!          ====================
+
+           integer HE5_HDFE_NOMERGE
+           integer HE5_HDFE_AUTOMERGE
+
+           parameter(HE5_HDFE_NOMERGE   =0)
+           parameter(HE5_HDFE_AUTOMERGE =1)
+ 
+!          HDFEOS5 XXentries CODES 
+!          =======================
+
+           integer HE5_HDFE_NENTDIM
+           integer HE5_HDFE_NENTMAP
+           integer HE5_HDFE_NENTIMAP
+           integer HE5_HDFE_NENTGFLD
+           integer HE5_HDFE_NENTDFLD
+
+           parameter(HE5_HDFE_NENTDIM  =0)
+           parameter(HE5_HDFE_NENTMAP  =1)
+           parameter(HE5_HDFE_NENTIMAP =2)
+           parameter(HE5_HDFE_NENTGFLD =3)
+           parameter(HE5_HDFE_NENTDFLD =4)
+
+!          HDFEOS5 ANGLE CONVERSION CODES 
+!          ==============================
+
+           integer HE5_HDFE_RAD_DEG    
+           integer HE5_HDFE_DEG_RAD    
+           integer HE5_HDFE_DMS_DEG    
+           integer HE5_HDFE_DEG_DMS    
+           integer HE5_HDFE_RAD_DMS    
+           integer HE5_HDFE_DMS_RAD    
+
+           parameter(HE5_HDFE_RAD_DEG =0)
+           parameter(HE5_HDFE_DEG_RAD =1)
+           parameter(HE5_HDFE_DMS_DEG =2)
+           parameter(HE5_HDFE_DEG_DMS =3)
+           parameter(HE5_HDFE_RAD_DMS =4)
+           parameter(HE5_HDFE_DMS_RAD =5)
+
+
+!          HDFEOS5 SWATH SUBSET CODES 
+!          ==========================
+ 
+           integer HE5_HDFE_MIDPOINT 
+           integer HE5_HDFE_ENDPOINT 
+           integer HE5_HDFE_ANYPOINT 
+           integer HE5_HDFE_INTERNAL 
+           integer HE5_HDFE_EXTERNAL 
+           integer HE5_HDFE_NOPREVSUB
+
+           parameter(HE5_HDFE_MIDPOINT  =0) 
+           parameter(HE5_HDFE_ENDPOINT  =1) 
+           parameter(HE5_HDFE_ANYPOINT  =2) 
+           parameter(HE5_HDFE_INTERNAL  =0) 
+           parameter(HE5_HDFE_EXTERNAL  =1) 
+           parameter(HE5_HDFE_NOPREVSUB =-1) 
+
+
+!          HDFEOS5 GRID ORIGIN CODES 
+!          =========================
+
+           integer HE5_HDFE_GD_UL    
+           integer HE5_HDFE_GD_UR    
+           integer HE5_HDFE_GD_LL    
+           integer HE5_HDFE_GD_LR    
+ 
+           parameter(HE5_HDFE_GD_UL  =0) 
+           parameter(HE5_HDFE_GD_UR  =1) 
+           parameter(HE5_HDFE_GD_LL  =2) 
+           parameter(HE5_HDFE_GD_LR  =3) 
+
+
+!          HDFEOS5 PIXEL REGISTRATION CODES 
+!          ================================
+
+           integer HE5_HDFE_CENTER     
+           integer HE5_HDFE_CORNER     
+ 
+           parameter(HE5_HDFE_CENTER  =0)
+           parameter(HE5_HDFE_CORNER  =1)
+
+!          HDFEOS5 GCTP PROJECTION CODES 
+!          =============================
+
+           integer HE5_GCTP_GEO      
+           integer HE5_GCTP_UTM      
+           integer HE5_GCTP_SPCS     
+           integer HE5_GCTP_ALBERS   
+           integer HE5_GCTP_LAMCC     
+           integer HE5_GCTP_MERCAT    
+           integer HE5_GCTP_PS        
+           integer HE5_GCTP_POLYC     
+           integer HE5_GCTP_EQUIDC    
+           integer HE5_GCTP_TM        
+           integer HE5_GCTP_STEREO    
+           integer HE5_GCTP_LAMAZ     
+           integer HE5_GCTP_AZMEQD    
+           integer HE5_GCTP_GNOMON    
+           integer HE5_GCTP_ORTHO     
+           integer HE5_GCTP_GVNSP     
+           integer HE5_GCTP_SNSOID    
+           integer HE5_GCTP_EQRECT    
+           integer HE5_GCTP_MILLER    
+           integer HE5_GCTP_VGRINT    
+           integer HE5_GCTP_HOM       
+           integer HE5_GCTP_ROBIN     
+           integer HE5_GCTP_SOM       
+           integer HE5_GCTP_ALASKA    
+           integer HE5_GCTP_GOOD      
+           integer HE5_GCTP_MOLL      
+           integer HE5_GCTP_IMOLL     
+           integer HE5_GCTP_HAMMER    
+           integer HE5_GCTP_WAGIV     
+           integer HE5_GCTP_WAGVII    
+           integer HE5_GCTP_OBLEQA    
+           integer HE5_GCTP_ISINUS    
+
+           parameter(HE5_GCTP_GEO      =0)
+           parameter(HE5_GCTP_UTM      =1)
+           parameter(HE5_GCTP_SPCS     =2)
+           parameter(HE5_GCTP_ALBERS   =3)
+           parameter(HE5_GCTP_LAMCC    =4)
+           parameter(HE5_GCTP_MERCAT   =5)
+           parameter(HE5_GCTP_PS       =6)
+           parameter(HE5_GCTP_POLYC    =7)
+           parameter(HE5_GCTP_EQUIDC   =8)
+           parameter(HE5_GCTP_TM       =9)
+           parameter(HE5_GCTP_STEREO   =10)
+           parameter(HE5_GCTP_LAMAZ    =11)
+           parameter(HE5_GCTP_AZMEQD   =12)
+           parameter(HE5_GCTP_GNOMON   =13)
+           parameter(HE5_GCTP_ORTHO    =14)
+           parameter(HE5_GCTP_GVNSP    =15)
+           parameter(HE5_GCTP_SNSOID   =16)
+           parameter(HE5_GCTP_EQRECT   =17)
+           parameter(HE5_GCTP_MILLER   =18)
+           parameter(HE5_GCTP_VGRINT   =19)
+           parameter(HE5_GCTP_HOM      =20)
+           parameter(HE5_GCTP_ROBIN    =21)
+           parameter(HE5_GCTP_SOM      =22)
+           parameter(HE5_GCTP_ALASKA   =23)
+           parameter(HE5_GCTP_GOOD     =24)
+           parameter(HE5_GCTP_MOLL     =25)
+           parameter(HE5_GCTP_IMOLL    =26)
+           parameter(HE5_GCTP_HAMMER   =27)
+           parameter(HE5_GCTP_WAGIV    =28)
+           parameter(HE5_GCTP_WAGVII   =29)
+           parameter(HE5_GCTP_OBLEQA   =30)
+           parameter(HE5_GCTP_ISINUS   =99)
+ 
+ 
+!          HDFEOS5 TILIND/COMPRESSION CODES 
+!          ================================
+
+           integer HE5_HDFE_NOTILE       
+           integer HE5_HDFE_TILE         
+           integer HE5_HDFE_COMP_NONE    
+           integer HE5_HDFE_COMP_RLE     
+           integer HE5_HDFE_COMP_NBIT    
+           integer HE5_HDFE_COMP_SKPHUFF 
+           integer HE5_HDFE_COMP_DEFLATE 
+           integer HE5_HDFE_COMP_SZIP_CHIP
+           integer HE5_HDFE_COMP_SZIP_K13
+           integer HE5_HDFE_COMP_SZIP_EC
+           integer HE5_HDFE_COMP_SZIP_NN
+           integer HE5_HDFE_COMP_SZIP_K13orEC
+           integer HE5_HDFE_COMP_SZIP_K13orNN
+           integer HE5_HDFE_COMP_SHUF_DEFLATE
+           integer HE5_HDFE_COMP_SHUF_SZIP_CHIP
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13
+           integer HE5_HDFE_COMP_SHUF_SZIP_EC
+           integer HE5_HDFE_COMP_SHUF_SZIP_NN
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13orEC
+           integer HE5_HDFE_COMP_SHUF_SZIP_K13orNN
+
+           parameter(HE5_HDFE_NOTILE                 =0)
+           parameter(HE5_HDFE_TILE                   =1)
+           parameter(HE5_HDFE_COMP_NONE              =0)
+           parameter(HE5_HDFE_COMP_RLE               =1)
+           parameter(HE5_HDFE_COMP_NBIT              =2)
+           parameter(HE5_HDFE_COMP_SKPHUFF           =3)
+           parameter(HE5_HDFE_COMP_DEFLATE           =4)
+           parameter(HE5_HDFE_COMP_SZIP_CHIP         =5)
+           parameter(HE5_HDFE_COMP_SZIP_K13          =6)
+           parameter(HE5_HDFE_COMP_SZIP_EC           =7)
+           parameter(HE5_HDFE_COMP_SZIP_NN           =8)
+           parameter(HE5_HDFE_COMP_SZIP_K13orEC      =9)
+           parameter(HE5_HDFE_COMP_SZIP_K13orNN      =10)
+           parameter(HE5_HDFE_COMP_SHUF_DEFLATE      =11)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_CHIP    =12)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13     =13)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_EC      =14)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_NN      =15)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orEC =16)
+           parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orNN =17)
+ 
+!          HDFEOS5 GROUP CODES 
+!          ===================
+
+           integer HE5_HDFE_GEOGROUP        
+           integer HE5_HDFE_DATAGROUP       
+           integer HE5_HDFE_ATTRGROUP       
+           integer HE5_HDFE_GRPATTRGROUP    
+           integer HE5_HDFE_LOCATTRGROUP    
+           integer HE5_HDFE_PROFGROUP       
+           integer HE5_HDFE_PROFGRPATTRGROUP
+           integer HE5_HDFE_GEOGRPATTRGROUP
+
+           parameter(HE5_HDFE_GEOGROUP       =0)
+           parameter(HE5_HDFE_DATAGROUP      =1)
+           parameter(HE5_HDFE_ATTRGROUP      =2)
+           parameter(HE5_HDFE_GRPATTRGROUP   =3)
+           parameter(HE5_HDFE_LOCATTRGROUP   =4)
+           parameter(HE5_HDFE_PROFGROUP      =5)
+           parameter(HE5_HDFE_PROFGRPATTRGROUP =6)
+           parameter(HE5_HDFE_GEOGRPATTRGROUP =7)
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/za/hdfeos5_64.inc b/testdrivers/za/hdfeos5_64.inc
new file mode 100644
index 0000000..cb8be09
--- /dev/null
+++ b/testdrivers/za/hdfeos5_64.inc
@@ -0,0 +1,16 @@
+! * ==========================================================
+! * File:       hdfeos5_64.inc
+! * Author:     A. Muslimov, Emergent Technology Services, Inc.
+! * Date:       March 19, 2002
+! * Purpose:    Fortran header file for HDFEOS5 routines on 64
+! *              bit platforms
+! * ==========================================================
+! * Contents: 
+! *
+! *
+! * ===========================================================
+ 
+
+           integer*8 HE5S_UNLIMITED_F_64
+
+           parameter(HE5S_UNLIMITED_F_64 = -1)
diff --git a/testdrivers/za/testza32.f b/testdrivers/za/testza32.f
new file mode 100755
index 0000000..fec2b32
--- /dev/null
+++ b/testdrivers/za/testza32.f
@@ -0,0 +1,1743 @@
+!----------------------------------------------------------------------------
+!     Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |
+!----------------------------------------------------------------------------
+! testza32.f                                                                |
+! In this program we create, define and write a simple za hdfeos file       |
+! using the za interface                                                    |
+!----------------------------------------------------------------------------
+
+      program   testza32
+
+      implicit  none
+ 
+      include   'hdfeos5.inc'
+
+      integer   index1, index2, status
+      integer   rank, n, dtype, classid, order
+      integer   rdattr(4), global_attr(4)
+      integer   compparm(5), cnkrank
+      integer   rdcompparm(5), compcode
+      integer   he5_zaopen, he5_zacreate
+      integer   zafid, zaid, zaid2
+      integer   he5_zadefdim, he5_zadetach
+      integer   he5_zadefine
+      integer   he5_zaclose
+      integer   he5_zasetfill, he5_zawrlattr, he5_zawrattr
+      integer   he5_zawrite, he5_zawrgattr
+      integer   he5_zaread, he5_zainfo 
+      integer   he5_zaattrinfo, he5_zardattr
+      integer   he5_zagattrinfo, he5_zardgattr, he5_zardlattr
+      integer   he5_zalattrinfo, he5_zagetfill, he5_zaidtype
+      integer   he5_zadefchunk, he5_zadefcomp, he5_zacompinfo
+      integer   rnkd(4), ntyped(4), nt
+      integer   he5_zaattach
+
+      integer*4 he5_zainqza, he5_zanentries
+      integer*4 he5_zainqdims, he5_zadiminfo
+      integer*4 he5_zainqattrs, he5_zainqgattrs
+      integer*4 he5_zainqlattrs, he5_zainquire
+      integer*4 size, strbufsize, ndims, chunkdims(1)
+      integer*4 start(2), stride(2), dataedge(2)
+      integer*4 istart(2),iedge(2),dedge(2)
+      integer*4 sd_start(2), sd_stride(2), sd_edge(2)
+      integer*4 rd_start(2), rd_stride(2), rd_edge(2)
+      integer*4 dimsize
+      integer*4 nattr, nza, nmaps
+      integer*4 strbufsz2, nflds
+      integer*4 count(1)
+      integer*4 dims(2),dims2(3),sddims(2)
+      integer*4 dim1, dim2, dim3, dim4
+
+      real      grpattr(3), locattr(3), rdgnlattr(3)
+      real      ray1(100,40), ray2(40,100)
+      real      ray4(40,100)
+      real      ray3(40,40), temp(40,100)
+      real      raycnt	
+      real      fillvalue, rdfilval
+
+
+      character*(256)  dimname, fieldlist
+      character*(256)  attrlist, zalist
+      character*(256)  dimens, maxdims
+
+      dim1          = 30
+      dim2          = 40
+      dim3          = 50
+      dim4          = 100
+      count(1)      = 3
+      compparm(1)   = 6
+      compparm(2)   = 0
+      compparm(3)   = 0
+      compparm(4)   = 0
+      compparm(5)   = 0
+
+      cnkrank       = 1
+      chunkdims(1)  = 10
+
+      rdcompparm(1) = 1
+      rdcompparm(2) = 1
+      rdcompparm(3) = 1
+      rdcompparm(4) = 1
+      rdcompparm(5) = 1
+      compcode      = -1
+      raycnt        = -799.0
+      global_attr(1)= 11
+      global_attr(2)= 33
+      global_attr(3)= 66
+      global_attr(4)= 99
+      grpattr(1)    = 21.7
+      grpattr(2)    = 24.3
+      grpattr(3)    = 26.3
+      locattr(3)    = 21.7
+      locattr(2)    = 24.3
+      locattr(1)    = 26.3
+      start(1)      = 10
+      start(2)      = 10
+      stride(1)     = 1
+      stride(2)     = 1
+      sd_start(1)   = 0
+      sd_start(2)   = 0
+      sd_stride(1)  = 1
+      sd_stride(2)  = 1
+      sd_edge(1)    = 100
+      sd_edge(2)    = 40
+      rd_start(1)   = 0
+      rd_start(2)   = 0
+      rd_stride(1)  = 1
+      rd_stride(2)  = 1
+      rd_edge(1)    = 40
+      rd_edge(2)    = 100
+      dataedge(1)   = 20
+      dataedge(2)   = 50
+      istart(1)     = 0
+      istart(2)     = 0
+      iedge(1)      = 30
+      iedge(2)      = 30
+      dedge(1)      = 40
+      dedge(2)      = 40
+      rank          = 2
+      fillvalue     = 16.0
+
+!
+! This section of the program just fills some arrays with data that will be
+! used later in the program
+!
+      do 110 index1=1,100
+         do 100 index2=1,40
+            ray1(index1, index2)=raycnt
+            ray2(index2, index1)=raycnt + 1.0
+            ray4(index2,index1) = raycnt
+            raycnt = raycnt +1.
+  100    continue
+  110 continue
+
+      do 170 index1=1,40
+         do 160 index2=1,40
+            ray3(index1, index2)=raycnt
+            raycnt = raycnt+1.25
+  160    continue
+  170 continue
+
+
+  230 format('********Error unexpected**********')
+  240 format('***********Passed Test*********')
+
+      open(unit=1, file="testza.txt", status = "UNKNOWN")
+
+      write(*,*)'Testing he5_za FORTRAN 77 interface'
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_za FORTRAN 77 interface'
+      write(1,*)'======================================'
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zaopen
+!
+      write(*,*)'Testing he5_zaopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zaopen '
+      write(1,*)'====================='
+      zafid=he5_zaopen('za.he5',HE5F_ACC_TRUNC)
+      if (zafid .lt. 0) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_TRUNC)'
+         write(*,*)'Value returned by he5_zaopen ', zafid
+         write(1,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_TRUNC)'
+         write(1,*)'Value returned by he5_zaopen ', zafid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zacreate
+!
+      write(1,27)
+      write(*,*)'Testing he5_zacreate '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zacreate '
+      write(1,*)'====================='
+      zaid=he5_zacreate(zafid,'Simplef')
+      if (zaid .lt. 0) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid=he5_zacreate(zafid, "Simplef")'
+         write(*,*)'Value returned by he5_zacreate ', zaid
+         write(1,*)'zaid= he5_zacreate(zafid, "Simplef")'
+         write(1,*)'Value returned by he5_zacreate ', zaid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      zaid2=he5_zacreate(zafid,'Indexedf')
+      if (zaid2 .lt. 0) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	zaid2= he5_zacreate(zafid, "Indexedf")'
+         write(*,*)'	Value returned by he5_zacreate ', zaid2
+         write(1,*)'	zaid2= he5_zacreate(zafid, "Indexedf")'
+         write(1,*)'	Value returned by he5_zacreate ', zaid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zadefdim
+!
+      write(1,27)
+      write(*,*)'Testing he5_zadefdim '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zadefdim '
+      write(1,*)'====================='
+      status=he5_zadefdim(zaid,'DataTrack',dim4)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_zadefdim(zaid, "DataTrack", 100)'
+         write(*,*)'	Value returned by he5_zadefdim ',status
+         write(1,*)'	status= he5_zadefdim(zaid, "DataTrack", 100)'
+         write(1,*)'	Value returned by he5_zadefdim ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zadefdim(zaid,'DataXtrack',dim2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_zadefdim(zaid, "DataXtrack", 40)'
+         write(*,*)'	Value returned by he5_zadefdim ',status
+         write(1,*)'	status= he5_zadefdim(zaid, "DataXtrack", 40)'
+         write(1,*)'	Value returned by he5_zadefdim ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      status=he5_zadefdim(zaid2,'DataTrack',dim2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_zadefdim(zaid2, "DataTrack", 40)'
+         write(*,*)'	Value returned by he5_zadefdim ', status
+         write(1,*)'	status= he5_zadefdim(zaid2, "DataTrack", 40)'
+         write(1,*)'	Value returned by he5_zadefdim ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zadefdim(zaid2,'DataXtrack',dim2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_zadefdim(zaid2, "DataXtrack", 40)'
+         write(*,*)'	Value returned by he5_zadefdim ', status
+         write(1,*)'	status= he5_zadefdim(zaid2, "DataXtrack", 40)'
+         write(1,*)'	Value returned by he5_zadefdim ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      status=he5_zadefdim(zaid2,'Timedim',dim2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define dimension Timedim '
+         write(*,*)'	Value returned by he5_zadefdim ', status
+         write(1,*)'Define dimension Timedim '
+         write(1,*)'	Value returned by he5_zadefdim ', status
+      endif
+
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zadefine
+!
+      write(1,27)
+      write(*,*)'Testing he5_zadefine '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zadefine '
+      write(1,*)'====================='
+
+      status=he5_zadefine(zaid,'SideA','DataXtrack,DataTrack',
+     1' ', HE5T_NATIVE_FLOAT)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+        
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define data field SideA '
+         write(*,*)'Value returned by he5_zadefine ',status
+         write(1,*)'Define data field SideA '
+         write(1,*)'Value returned by he5_zadefine ',status
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+! Test Case  -- he5_zasetfill
+!
+      write(1,27)
+      write(*,*)'Testing he5_zasetfill '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zasetfill '
+      write(1,*)'====================='
+      status= he5_zasetfill(zaid,'Temperature',
+     1HE5T_NATIVE_FLOAT, fillvalue)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zasetfill(zaid,"Temperature",
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(*,*)'Value returned by he5_zasetfill ',status
+         write(1,*)'status=he5_zasetfill(zaid,"Temperature",
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(1,*)'Value returned by he5_zasetfill ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zadefine(zaid,'Temperature',
+     1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define data field Temperature '
+         write(*,*)'Value returned by he5_zadefine ',status
+         write(1,*)'Define data field Temperature '
+         write(1,*)'Value returned by he5_zadefine ',status
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+      status= he5_zasetfill(zaid,'Conduction',
+     1HE5T_NATIVE_FLOAT,fillvalue)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zasetfill(zaid,"Conduction",
+     1HE5T_NATIVE_FLOAT,fillvalue)'
+         write(*,*)'Value returned by he5_zasetfill ',status
+         write(1,*)'status=he5_zasetfill(zaid,"Conduction",
+     1HE5T_NATIVE_FLOAT,fillvalue)'
+         write(1,*)'Value returned by he5_zasetfill ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zadefine(zaid,'Conduction',
+     1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadefine(zaid,"Conduction",
+     1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT)'
+         write(*,*)'Value returned by he5_zadefine ',status
+         write(1,*)'status= he5_zadefine(zaid,"Conduction",
+     1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT)'
+         write(1,*)'Value returned by he5_zadefine ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zadefine(zaid2,'Sensor1',
+     1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zadefine(zaid2, "Sensor1",
+     1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT)'
+         write(*,*)'Value returned by he5_zadefine ',status
+         write(1,*)'status= he5_zadefine(zaid2, "Sensor1",
+     1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT)'
+         write(1,*)'Value returned by he5_zadefine ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zadefchunk
+!
+      write(1,27)
+      write(*,*)'Testing he5_zadefchunk'
+      write(*,*)'======================'
+      write(1,*)'Testing he5_zadefchunk'
+      write(1,*)'======================'
+      status=he5_zadefchunk(zaid,cnkrank,chunkdims)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadefchunk(zaid, cnkrank, chunkdims)'
+         write(*,*)'Value returned by he5_zadefchunk ',status
+         write(1,*)'status= he5_zadefchunk(zaid, cnkrank, chunkdims)'
+         write(1,*)'Value returned by he5_zadefchunk ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+    
+! Test Case -- he5_zadefcomp
+!
+      write(1,27)
+      write(*,*)'Testing he5_zadefcomp'
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zadefcomp'
+      write(1,*)'====================='
+      status=he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE,compparm)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE,
+     1compparm)'
+         write(*,*)'Value returned by he5_zadefcomp ',status
+         write(1,*)'status= he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE,
+     1compparm)'
+         write(1,*)'Value returned by he5_zadefcomp ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      status=he5_zadefine(zaid,'CompChunk','DataTrack',
+     1' ',HE5T_NATIVE_FLOAT)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230) 
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define data field CompChunk '
+         write(*,*)'Value returned by he5_zadefine ',status
+         write(1,*)'Define data field CompChunk '
+         write(1,*)'Value returned by he5_zadefine ',status
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+! Test Case -- he5_zadetach
+!
+      write(1,27)
+      write(*,*)'Testing he5_zadetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zadetach '
+      write(1,*)'====================='
+      status=he5_zadetach(zaid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zadetach(zaid2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid2)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid2)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      zaid=he5_zaattach(zafid,'Simplef')
+      if (zaid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(*,*)'Value returned by he5_zaattach ',zaid
+         write(1,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(1,*)'Value returned by he5_zaattach ',zaid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      zaid2=he5_zaattach(zafid,'Indexedf')
+      if (zaid2 .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid2= he5_zaattach(zafid, "Indexedf")'
+         write(*,*)'Value returned by he5_zaattach ',zaid2
+         write(1,*)'zaid2= he5_zaattach(zafid, "Indexedf")'
+         write(1,*)'Value returned by he5_zaattach ',zaid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zadetach
+!
+      write(1,27)
+      write(*,*)'Testing he5_zadetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zadetach '
+      write(1,*)'====================='
+      status= he5_zadetach(zaid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zadetach(zaid2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid2)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid2)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zaclose(zafid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)       
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zaclose(zafid)'
+         write(*,*)'Value returned by he5_zaclose ',status
+         write(1,*)'status= he5_zaclose(zafid)'
+         write(1,*)'Value returned by he5_zaclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      zafid=he5_zaopen('za.he5',HE5F_ACC_RDWR)
+      if (zafid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zafid=he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_zaopen ',zafid
+         write(1,*)'zafid=he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_zaopen ',zafid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zaattach
+!
+      write(1,27)
+      write(*,*)'Testing he5_zaattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zaattach '
+      write(1,*)'====================='
+
+      zaid=he5_zaattach(zafid,'Simplef')
+      if (zaid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(*,*)'Value returned by he5_zaattach ',zaid
+         write(1,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(1,*)'Value returned by he5_zaattach ',zaid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      zaid2=he5_zaattach(zafid,'Indexedf')
+      if (zaid2 .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid2= he5_zaattach(zafid, "Indexedf")'
+         write(*,*)'Value returned by he5_zaattach ',zaid2
+         write(1,*)'zaid2= he5_zaattach(zafid, "Indexedf")'
+         write(1,*)'Value returned by he5_zaattach ',zaid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zawrite
+!
+      write(1,27)
+      write(*,*)'Testing he5_zawrite '
+      write(*,*)'==================='
+      write(1,*)'Testing he5_zawrite '
+      write(1,*)'==================='
+
+      status=he5_zawrite(zaid,'SideA',sd_start,stride, 
+     1rd_edge, ray4)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Write data field SideA '
+         write(*,*)'Value returned by he5_zawrite ',status
+         write(1,*)'Write data field SideA '
+         write(1,*)'Value returned by he5_zawrite ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zawrite(zaid,'Temperature',start,stride, 
+     1dataedge, ray4)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zawrite(zaid,"Temperature",start, 
+     1stride,dataedge, ray1)'
+         write(*,*)'Value returned by he5_zawrite ',status
+         write(1,*)'status=he5_zawrite(zaid,"Temperature",start, 
+     1stride,dataedge, ray1)'
+         write(1,*)'Value returned by he5_zawrite ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zawrite(zaid,'Conduction',start,stride, 
+     1dataedge, ray2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zawrite(zaid,"Conduction",start, 
+     1stride,dataedge, ray2)'
+         write(*,*)'Value returned by he5_zawrite ',status
+         write(1,*)'status=he5_zawrite(zaid,"Conduction",start, 
+     1stride,dataedge, ray2)'
+         write(1,*)'Value returned by he5_zawrite ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      iedge(1)=40
+      iedge(2)=40
+      status=he5_zawrite(zaid2,'Sensor1',istart,stride, 
+     1iedge,ray3)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zawrite(zaid2, "Sensor1", 
+     1istart, stride, iedge, ray3)'
+         write(*,*)'Value returned by he5_zawrite ',status
+         write(1,*)'status= he5_zawrite(zaid2, "Sensor1", 
+     1istart, stride, iedge, ray3)'
+         write(1,*)'Value returned by he5_zawrite ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zawrlattr
+!
+      write(1,27)
+      write(*,*)'Testing he5_zawrlattr, Local Attribute '
+      write(*,*)'================================== '
+      write(1,*)'Testing he5_zawrlattr, Local Attribute '
+      write(1,*)'================================== '
+      status=he5_zawrlattr(zaid2,'Sensor1','local',
+     1HE5T_NATIVE_FLOAT,count,locattr)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zawrlattr(zaid2,"Sensor1","local",
+     1HE5T_NATIVE_FLOAT,count,locattr)'
+         write(*,*)'Value returned by he5_zawrlattr ',status
+         write(1,*)'status=he5_zawrlattr(zaid2,"Sensor1", "local", 
+     1HE5T_NATIVE_FLOAT,count,locattr)'
+         write(1,*)'Value returned by he5_zawrlattr ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zawrattr
+!
+      count(1) = 4
+
+      write(1,27)
+      write(*,*)'Testing he5_zawrattr, Global Attribute '
+      write(*,*)'====================================== '
+      write(1,*)'Testing he5_zawrattr, Global Attribute '
+      write(1,*)'======================================= '
+      status=he5_zawrattr(zaid,'Drift',HE5T_NATIVE_INT,count, 
+     1global_attr)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zawrattr(zaid, "Drift", 
+     1HE5T_NATIVE_INT, count, global_attr)'
+         write(*,*)'Value returned by he5_zawrattr ',status
+         write(1,*)'status=he5_zawrattr(zaid, "Drift", 
+     1HE5T_NATIVE_INT, count, global_attr)'
+         write(1,*)'Value returned by he5_zawrattr ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zawrgattr
+!
+      count(1) = 3
+     
+      write(1,27)
+      write(*,*)'Testing he5_zawrgattr, Group Attribute '
+      write(*,*)'====================================== '
+      write(1,*)'Testing he5_zawrgattr, Group Attribute '
+      write(1,*)'====================================== '
+      status=he5_zawrgattr(zaid,'group',HE5T_NATIVE_FLOAT, 
+     1count,grpattr)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zawrgattr(zaid, "group", 
+     1HE5T_NATIVE_FLOAT,count,grpgattr)'
+         write(*,*)'Value returned by he5_zawrgattr ',status
+         write(1,*)'status=he5_zawrgattr(zaid, "group", 
+     1HE5T_NATIVE_FLOAT,count,grpattr)'
+         write(1,*)'Value returned by he5_zawrgattr ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zadetach(zaid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+      write(*,*)'status= he5_zadetach(zaid)'
+      write(*,*)'Value returned by he5_zadetach ',status
+      write(1,*)'status= he5_zadetach(zaid)'
+      write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zadetach(zaid2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid2)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid2)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zaclose
+!
+      write(1,27)
+      write(*,*)'Testing he5_zaclose '
+      write(*,*)'==================='
+      write(1,*)'Testing he5_zaclose '
+      write(1,*)'==================='
+      status= he5_zaclose(zafid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Value returned by he5_zaclose ',status
+         write(1,*)'status= he5_zaclose(zafid)'
+         write(1,*)'Value returned by he5_zaclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      zafid= he5_zaopen('za.he5',HE5F_ACC_RDWR)
+      if (zafid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_zaopen ', zafid
+         write(1,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_zaopen ', zafid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      zaid= he5_zaattach(zafid,'Simplef')
+      if (zaid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(*,*)'Value returned by he5_zaattach ',zaid
+         write(1,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(1,*)'Value returned by he5_zaattach ',zaid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zadetach(zaid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zaclose(zafid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zaclose(zafid)'
+         write(*,*)'Value returned by he5_zaclose ',status
+         write(1,*)'status= he5_zaclose(zafid)'
+         write(1,*)'Value returned by he5_zaclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      zafid= he5_zaopen('za.he5',HE5F_ACC_RDWR)
+      if (zafid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_zaopen ',zafid
+         write(1,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_zaopen ',zafid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      zaid=he5_zaattach(zafid,'Simplef')
+      if (zaid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(*,*)'Value returned by he5_zaattach ',zaid
+         write(1,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(1,*)'Value returned by he5_zaattach ',zaid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      zaid2=he5_zaattach(zafid,'Indexedf')
+      if (zaid2 .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid2= he5_zaattach(zafid, "Indexedf")'
+         write(*,*)'Value returned by he5_zaattach ',zaid2
+         write(1,*)'zaid2= he5_zaattach(zafid, "Indexedf")'
+         write(1,*)'Value returned by he5_zaattach ',zaid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zanentries
+!
+      write(1,27)
+      write(*,*)'Testing he5_zanentries '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zanentries '
+      write(1,*)'====================='
+
+      nmaps=he5_zanentries(zaid,1,strbufsize)
+      if (nmaps .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'nmaps= he5_zanentries(zaid, 1, strbufsize)'
+         write(*,*)'Number of dimension mappings ',nmaps
+         write(*,*)'Size of strbufsize ',strbufsize
+         write(1,*)'nmaps= he5_zanentries(zaid, 1, strbufsize)'
+         write(1,*)'Number of dimension mappings ',nmaps
+         write(1,*)'Size of strbufsize ',strbufsize
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zainqdims
+!
+      write(1,27)
+      write(*,*)'Testing he5_zainqdims '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zainqdims '
+      write(1,*)'====================='
+      ndims=he5_zainqdims(zaid,dimname,dims)
+      if (ndims .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'ndims= he5_zainqdims(zaid, dimname, dims)'
+         write(*,*)'Number of dimesions ',ndims
+         write(*,*)'Names of dimensions ',dimname
+         write(*,*)'Size of dimensions ',dims
+         write(1,*)'ndims= he5_zainqdims(zaid, dimname, dims)'
+         write(1,*)'Number of dimesions ',ndims
+         write(1,*)'Names of dimensions ',dimname
+         write(1,*)'Size of dimensions ',dims
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      ndims= he5_zainqdims(zaid2, dimname, dims2)
+      if (ndims .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'ndims=he5_zainqdims(zaid2,dimname,dims2)'
+         write(*,*)'Number of dimesions ',ndims
+         write(*,*)'Names of dimensions ',dimname
+         write(*,*)'Size of dimensions ',dims2
+         write(1,*)'ndims=he5_zainqdims(zaid2,dimname,dims2)'
+         write(1,*)'Number of dimesions ',ndims
+         write(1,*)'Names of dimensions ',dimname
+         write(1,*)'Size of dimensions ',dims2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zainquire
+!
+      write(1,27)
+      write(*,*)'Testing he5_zainquire '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_zainquire '
+      write(1,*)'======================'
+      nflds=he5_zainquire(zaid,fieldlist,rnkd,ntyped)
+      if (nflds .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'nflds=he5_zainquire(zaid,fieldlist,rnkd,ntyped)'
+         write(*,*)'Number of data fields in za ',nflds
+         write(*,*)'Names of data fields ',fieldlist
+         write(*,*)'Rank of fields ',rnkd
+         write(*,*)'Number type of fields ',ntyped
+         write(1,*)'nflds=he5_zainquire(zaid,fieldlist,rnkd,ntyped)'
+         write(1,*)'Number of data fields in za ',nflds
+         write(1,*)'Names of data fields ',fieldlist
+         write(1,*)'Rank of fields ',rnkd
+         write(1,*)'Number type of fields ',ntyped
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zadiminfo
+!
+      write(1,27)
+      write(*,*)'Testing he5_zadiminfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zadiminfo '
+      write(1,*)'====================='
+      dimsize= he5_zadiminfo(zaid,'DataTrack')
+      if (dimsize .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'dimsize= he5_zadiminfo(zaid, "DataTrack")'
+         write(*,*)'Size of dimension DataTrack ',dimsize
+         write(1,*)'dimsize= he5_zadiminfo(zaid, "DataTrack")'
+         write(1,*)'Size of dimension DataTrack ',dimsize
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+! Test Case -- he5_zaread
+!
+      write(1,27)
+      write(*,*)'Testing he5_zaread '
+      write(*,*)'==================='
+      write(1,*)'Testing he5_zaread '
+      write(1,*)'==================='
+
+      rd_start(1)=0
+      rd_start(2)=0
+      rd_stride(1)=1
+      rd_stride(2)=1
+      rd_edge(1)=40
+      rd_edge(2)=100
+      status= he5_zaread(zaid,'Conduction',rd_start,
+     1rd_stride,rd_edge,temp)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Value returned by he5_zaread ',status
+         write(*,*)'status= he5_zaread(zaid, "Conduction", 
+     1rd_start,rd_stride, rd_edge, temp)'
+         write(1,*)'status= he5_zaread(zaid, "Conduction", 
+     1rd_start,rd_stride, rd_edge, temp)'
+         write(1,*)'Value returned by he5_zaread ',status
+         do 190 index1=10,15
+            do 180 index2=10,15
+               write(*,*)'value of conduction ',temp(index1,index2)
+               write(1,*)'value of conduction ',temp(index1,index2)
+  180       continue
+  190    continue
+      endif
+
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zainfo
+!
+      write(1,27)
+      write(*,*)'Testing he5_zainfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zainfo '
+      write(1,*)'====================='
+      status=he5_zainfo(zaid,'SideA',rank,sddims,nt,
+     1dimens,maxdims)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zainfo(zaid, "SideA", 
+     1rank, sddims, nt, dimens, maxdims)'
+         write(*,*)'Value returned by he5_zainfo ',status
+         write(*,*)'Rank of field sideA ',rank
+         write(*,*)'dimension list of field sideA ',dimens
+         write(*,*)'Size of sideA dimensions ',sddims
+         write(*,*)'number type of field sideA ',nt
+         write(1,*)'status= he5_zainfo(zaid, "SideA", 
+     1rank, sddims, nt, dimens, maxdims)'
+         write(1,*)'Value returned by he5_zainfo ',status
+         write(1,*)'Rank of field sideA ',rank
+         write(1,*)'dimension list of field sideA ',dimens
+         write(1,*)'Size of sideA dimensions ',sddims
+         write(1,*)'number type of field sideA ',nt
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+ 
+! Test Case -- he5_zainqattrs
+!
+      write(1,27)
+      write(*,*)'Testing he5_zainqattrs Global attributes '
+      write(*,*)'==================================== '
+      write(1,*)'Testing he5_zainqattrs Global attributes '
+      write(1,*)'==================================== '
+
+      nattr = he5_zainqattrs(zaid,attrlist,strbufsz2)
+      if (nattr .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Number of global attributes in za ',nattr
+         write(*,*)'Attribute list of za ',attrlist
+         write(1,*)'Number of global attributes in za ',nattr
+         write(1,*)'Attribute list of za ',attrlist
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+! Test Case -- he5_zaattrinfo
+!
+      write(1,27)
+      write(*,*)'Testing he5_zaattrinfo Global attribute'
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_zaattrinfo Global attribute'
+      write(1,*)'======================================='
+      status= he5_zaattrinfo(zaid, attrlist, n, size)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zaattrinfo(zaid,attrlist,n,size)'
+         write(*,*)'Value returned by he5_zaattrinfo ',status
+         write(*,*)'Number type of attributes ',n,' Size ',size
+         write(1,*)'status=he5_zaattrinfo(zaid,attrlist,n,size)'
+         write(1,*)'Value returned by he5_zaattrinfo ',status
+         write(1,*)'Number type of attributes ',n,' Size ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zardattr
+!
+      write(1,27)
+      write(*,*)'Testing he5_zardattr, Global attribute '
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_zardattr, Global attribute '
+      write(1,*)'======================================'
+
+      status= he5_zardattr(zaid, attrlist, rdattr)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zardattr(zaid,attrlist,rdattr)'
+         write(*,*)'Value returned by he5_zardattr ',status
+         write(*,*)'attribute ',rdattr
+         write(1,*)'status=he5_zardattr(zaid,attrlist,rdattr)'
+         write(1,*)'Value returned by he5_zardattr ',status
+         write(1,*)'attribute ',rdattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+!     Test Case -- he5_zainqgattrs
+!
+      write(1,27)
+      write(*,*)'Testing he5_zainqgattrs Group attributes '
+      write(*,*)'==================================== '
+      write(1,*)'Testing he5_zainqgattrs Group attributes '
+      write(1,*)'==================================== '
+
+      nattr = he5_zainqgattrs(zaid,attrlist,strbufsz2)
+      if (nattr .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Number of group attributes in za ',nattr
+         write(*,*)'Attribute list of za ',attrlist
+         write(1,*)'Number of group attributes in za ',nattr
+         write(1,*)'Attribute list of za ',attrlist
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+! Test Case -- he5_zagattrinfo
+!
+      write(1,27)
+      write(*,*)'Testing he5_zagattrinfo Group attribute'
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_zagattrinfo Group attribute'
+      write(1,*)'======================================='
+      status= he5_zagattrinfo(zaid, attrlist, n, size)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zagattrinfo(zaid,attrlist,n,size)'
+         write(*,*)'Value returned by he5_zagattrinfo ',status
+         write(*,*)'Number type of attributes ',n,' Size ',size
+         write(1,*)'status=he5_zagattrinfo(zaid,attrlist,n,size)'
+         write(1,*)'Value returned by he5_zagattrinfo ',status
+         write(1,*)'Number type of attributes ',n,' Size ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zardgattr
+!
+      write(1,27)
+      write(*,*)'Testing he5_zardgattr, Group attribute '
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_zardgattr, Group attribute '
+      write(1,*)'======================================'
+
+       status= he5_zardgattr(zaid,'group',rdgnlattr)
+       if (status .lt. 0) then
+          write(*,230)
+          write(1,230)
+       else
+          write(*,*)'  '
+          write(*,240)
+          write(1,*)'  '
+          write(1,240)
+          write(*,*)'status=he5_zardgattr(zaid,attrlist,rdgnlattr)'
+          write(*,*)'Value returned by he5_zardgattr ',status
+          write(*,*)'attribute ',rdgnlattr
+          write(1,*)'status=he5_zardgattr(zaid,attrlist,rdgnlattr)'
+          write(1,*)'Value returned by he5_zardgattr ',status
+          write(1,*)'attribute ',rdgnlattr
+       endif
+       write(*,*)' '
+       write(1,*)' '
+
+! Test Case -- he5_zainqlattrs
+!
+      write(1,27)
+      write(*,*)'Testing he5_zainqlattrs Local attributes '
+      write(*,*)'==================================== '
+      write(1,*)'Testing he5_zainqlattrs Local attributes '
+      write(1,*)'==================================== '
+
+      nattr=he5_zainqlattrs(zaid2,'Sensor1',attrlist,strbufsz2)
+      if (nattr .lt. 0) then
+         write(*,230)
+         write(1,230)         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zainqlattrs(... "Sensor1" ...)'
+         write(*,*)'Number of local attributes in field ',nattr
+         write(*,*)'Attribute list of field ',attrlist
+         write(1,*)'zainqlattrs(... "Sensor1" ...)'
+         write(1,*)'Number of local attributes in field ',nattr
+         write(1,*)'Attribute list of field ',attrlist
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+! Test Case -- he5_zalattrinfo
+!
+      write(1,27)
+      write(*,*)'Testing he5_zalattrinfo Local attribute'
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_zalattrinfo Local attribute'
+      write(1,*)'======================================='
+      status=he5_zalattrinfo(zaid2,'Sensor1','local',n,size)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zalattrinfo(... "Sensor1" ...)'
+         write(*,*)'Value returned by he5_zalattrinfo ',status
+         write(*,*)'Number type of attributes ',n,' Size ',size
+         write(1,*)'zalattrinfo(... "Sensor1" ...)'
+         write(1,*)'Value returned by he5_zalattrinfo ',status
+         write(1,*)'Number type of attributes ',n,' Size ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zaidtype
+!
+      write(1,27)
+      write(*,*)'Testing he5_zaidtype, Inquire Datatype '
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_zaidtype, Inquire Datatype '
+      write(1,*)'======================================='
+
+      status= he5_zaidtype(zaid2,'Sensor1','local', 
+     1HE5_HDFE_LOCATTRGROUP,dtype,classid, order, size)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zaidtype(zaid2,"Sensor1","local", 
+     1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)'
+         write(*,*)'Value returned by he5_zaidtype ',status
+         write(*,*)'Datatype of local attribute ',dtype
+         write(*,*)'Class id and order ',classid, order
+         write(*,*)'Size of attribute ',size
+         write(1,*)'status= he5_zaidtype(zaid2,"Sensor1","local", 
+     1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)'
+         write(1,*)'Value returned by he5_zaidtype ',status
+         write(1,*)'Datatype of local attribute ',dtype
+         write(1,*)'Class id and order ',classid, order
+         write(1,*)'Size of attribute ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zardlattr
+!
+      write(1,27)
+      write(*,*)'Testing he5_zardlattr, Local attribute '
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_zardlattr, Local attribute '
+      write(1,*)'======================================'
+
+      status=he5_zardlattr(zaid2,'Sensor1','local',rdgnlattr)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zardlattr(zaid2,"Sensor1","local", 
+     1rdgnlattr)'
+         write(*,*)'Value returned by he5_zardlattr ',status
+         write(*,*)'attribute ',rdgnlattr
+         write(1,*)'status=he5_zardlattr(zaid2,"Sensor1","local", 
+     1rdgnlattr)'
+         write(1,*)'Value returned by he5_zardlattr ',status
+         write(1,*)'attribute ',rdgnlattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zagetfill
+!
+      write(1,27)
+      write(*,*)'Testing he5_zagetfill '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zagetfill '
+      write(1,*)'====================='
+      status= he5_zagetfill(zaid,'Conduction', rdfilval)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zagetfill(zaid,"Conduction",rdfilval)'
+         write(*,*)'Value returned by he5_zagetfill ',status
+         write(*,*)'Value of fill ',rdfilval
+         write(1,*)'status=he5_zagetfill(zaid,"Conduction",rdfilval)'
+         write(1,*)'Value returned by he5_zagetfill ',status
+         write(1,*)'Value of fill ',rdfilval
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+
+! Test Case -- he5_zacompinfo
+!
+      write(1,27)
+      write(*,*)'Testing he5_zacompinfo '
+      write(*,*)'======================='
+      write(1,*)'Testing he5_zacompinfo '
+      write(1,*)'======================='
+      status=he5_zacompinfo(zaid,'CompChunk',compcode,rdcompparm)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zacompinfo(zaid,"CompChunk",compcode, 
+     1rdcompparm)'
+         write(*,*)'Status returned by he5_zacompinfo ',status
+         write(*,*)'Compression code ',compcode
+         write(*,*)'Compression parameter ',rdcompparm(1)
+         write(1,*)'status=he5_zacompinfo(zaid,"CompChunk",compcode, 
+     1rdcompparm)'
+         write(1,*)'Status returned by he5_zacompinfo ',status
+         write(1,*)'Compression code ',compcode
+         write(1,*)'Compression parameter ',rdcompparm(1)
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+
+      status= he5_zadetach(zaid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zadetach(zaid2)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid2)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid2)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zaclose(zafid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zaclose(zafid)'
+         write(*,*)'Value returned by he5_zaclose ',status
+         write(1,*)'status= he5_zaclose(zafid)'
+         write(1,*)'Value returned by he5_zaclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      zafid=he5_zaopen('za.he5',HE5F_ACC_RDWR)
+      if (zafid .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zafid=he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_zaopen ',zafid
+         write(1,*)'zafid=he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_zaopen ',zafid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zainqza
+!
+      write(1,27)
+      write(*,*)'Testing he5_zainqza '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_zainqza '
+      write(1,*)'======================'
+
+      nza=he5_zainqza('za.he5',zalist,strbufsz2)
+      if (nza .lt. 0) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Retrieve information on zas in 
+     1file za.he5'
+         write(*,*)'Number of zas in file ', nza
+         write(*,*)'List of zas ',zalist
+         write(1,*)'Retrieve information on zas in 
+     1file za.he5'
+         write(1,*)'Number of zas in file ', nza
+         write(1,*)'List of zas ',zalist
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zaclose(zafid)
+      if (status .lt. 0) then
+         write(*,230)
+         write(1,230)       
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zaclose(zafid)'
+         write(*,*)'Value returned by he5_zaclose ',status
+         write(1,*)'status= he5_zaclose(zafid)'
+         write(1,*)'Value returned by he5_zaclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      close(unit=1)
+   27 format(' ')
+      stop
+      end
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testdrivers/za/testza64.f b/testdrivers/za/testza64.f
new file mode 100755
index 0000000..25fdbf2
--- /dev/null
+++ b/testdrivers/za/testza64.f
@@ -0,0 +1,1793 @@
+!----------------------------------------------------------------------------
+!     Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |
+!----------------------------------------------------------------------------
+! testza64.f                                                                |
+! In this program we create, define and write a simple za hdfeos file       |
+! using the za interface                                                    |
+!----------------------------------------------------------------------------
+
+      program   testza64
+ 
+      implicit  none
+ 
+      include   'hdfeos5.inc'
+ 
+      integer   status
+      integer   index1
+      integer   index2
+      integer   zafid
+      integer   zaid
+      integer   zaid2
+      integer   rank
+      integer   n, nt
+      integer   dtype
+      integer   classid
+      integer   order
+      integer   rdattr(4)
+      integer   global_attr(4)
+      integer   compparm(5)
+      integer   cnkrank
+      integer   rdcompparm(5)
+      integer   compcode
+      integer   ntyped(4)
+      integer   rnkd(4)
+
+      integer   he5_zaopen
+      integer   he5_zacreate
+      integer   he5_zaattach
+      integer   he5_zadefdim
+      integer   he5_zadefine
+      integer   he5_zadefchunk
+      integer   he5_zadefcomp
+      integer   he5_zasetfill
+      integer   he5_zawrattr
+      integer   he5_zawrlattr
+      integer   he5_zawrite
+      integer   he5_zaread
+      integer   he5_zawrgattr
+      integer   he5_zardattr
+      integer   he5_zardgattr
+      integer   he5_zardlattr
+      integer   he5_zainfo 
+      integer   he5_zacompinfo
+      integer   he5_zaattrinfo
+      integer   he5_zagattrinfo
+      integer   he5_zalattrinfo
+      integer   he5_zagetfill
+      integer   he5_zaidtype
+      integer   he5_zadetach
+      integer   he5_zaclose 
+
+      integer*8 he5_zainqza
+      integer*8 he5_zanentries
+      integer*8 he5_zainqdims
+      integer*8 he5_zadiminfo
+      integer*8 he5_zainqattrs
+      integer*8 he5_zainqgattrs
+      integer*8 he5_zainqlattrs
+      integer*8 he5_zainquire
+      integer*8 size
+      integer*8 strbufsize
+      integer*8 ndims
+      integer*8 chunkdims(1)
+      integer*8 start(2)
+      integer*8 stride(2)
+      integer*8 dataedge(2)
+      integer*8 istart(2)
+      integer*8 iedge(2)
+      integer*8 dedge(2)
+      integer*8 sd_start(2)
+      integer*8 sd_stride(2)
+      integer*8 sd_edge(2)
+      integer*8 rd_start(2)
+      integer*8 rd_stride(2)
+      integer*8 rd_edge(2)
+      integer*8 dimsize
+      integer*8 nattr
+      integer*8 nza
+      integer*8 nmaps
+      integer*8 strbufsz2
+      integer*8 nflds
+      integer*8 count(1)
+      integer*8 zero
+      integer*8 dims(2)
+      integer*8 dims2(3)
+      integer*8 sddims(2)
+      integer*8 dim1
+      integer*8 dim2
+      integer*8 dim3
+      integer*8 dim4
+
+      real      grpattr(3)
+      real      locattr(3)
+      real      rdgnlattr(3)
+      real      ray1(100,40)
+      real      ray2(40,100)
+      real      ray4(40,100)
+      real      ray3(40,40)
+      real      temp(40,100)
+      real      raycnt
+      real      fillvalue
+      real      rdfilval
+      real      tempbuf(4200)
+
+
+      character*(256)  dimname
+      character*(256)  fieldlist
+      character*(256)  attrlist
+      character*(256)  zalist
+      character*(256)  dimens
+      character*(256)  maxdims
+
+      dim1          = 30
+      dim2          = 40
+      dim3          = 50
+      dim4          = 100
+      count(1)      = 3
+      compparm(1)   = 6
+      compparm(2)   = 0
+      compparm(3)   = 0
+      compparm(4)   = 0
+      compparm(5)   = 0
+      cnkrank       = 1
+      chunkdims(1)  = 10
+      rdcompparm(1) = 1
+      rdcompparm(2) = 1
+      rdcompparm(3) = 1
+      rdcompparm(4) = 1
+      rdcompparm(5) = 1
+      compcode      = -1
+      raycnt        = -799.0
+      global_attr(1)= 11
+      global_attr(2)= 33
+      global_attr(3)= 66
+      global_attr(4)= 99
+      grpattr(1)    = 21.7
+      grpattr(2)    = 24.3
+      grpattr(3)    = 26.3
+      locattr(3)    = 21.7
+      locattr(2)    = 24.3
+      locattr(1)    = 26.3
+      start(1)      = 10
+      start(2)      = 10
+      stride(1)     = 1
+      stride(2)     = 1
+      sd_start(1)   = 0
+      sd_start(2)   = 0
+      sd_stride(1)  = 1
+      sd_stride(2)  = 1
+      sd_edge(1)    = 100
+      sd_edge(2)    = 40
+      rd_start(1)   = 0
+      rd_start(2)   = 0
+      rd_stride(1)  = 1
+      rd_stride(2)  = 1
+      rd_edge(1)    = 40
+      rd_edge(2)    = 100
+      dataedge(1)   = 20
+      dataedge(2)   = 50
+      istart(1)     = 0
+      istart(2)     = 0
+      iedge(1)      = 30
+      iedge(2)      = 30
+      dedge(1)      = 40
+      dedge(2)      = 40
+      rank          = 2
+      fillvalue     = 16.0
+      zero          = 0
+
+!
+! This section of the program just fills some arrays with data that will be
+! used later in the program
+!
+      do 110 index1=1,100
+         do 100 index2=1,40
+            ray1(index1, index2)=raycnt
+            ray2(index2, index1)=raycnt + 1.0
+            ray4(index2,index1) = raycnt
+            raycnt = raycnt +1.
+  100    continue
+  110 continue
+
+      do 170 index1=1,40
+         do 160 index2=1,40
+            ray3(index1, index2)=raycnt
+            raycnt = raycnt+1.25
+  160    continue
+  170 continue
+
+
+  230 format('********Error unexpected**********')
+  240 format('***********Passed Test*********')
+
+      open(unit=1, file="testza.txt", status = "UNKNOWN")
+
+      write(*,*)'Testing he5_za FORTRAN 77 interface'
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_za FORTRAN 77 interface'
+      write(1,*)'======================================'
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zaopen
+!
+      write(*,*)'Testing he5_zaopen '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zaopen '
+      write(1,*)'====================='
+      zafid=he5_zaopen('za.he5',HE5F_ACC_TRUNC)
+      if (zafid .lt. zero) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	zafid= he5_zaopen("za.he5",HE5F_ACC_TRUNC)'
+         write(*,*)'	Value returned by he5_zaopen ', zafid
+         write(1,*)'	zafid= he5_zaopen("za.he5",HE5F_ACC_TRUNC)'
+         write(1,*)'	Value returned by he5_zaopen ', zafid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zacreate
+!
+      write(1,27)
+      write(*,*)'Testing he5_zacreate '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zacreate '
+      write(1,*)'====================='
+      zaid=he5_zacreate(zafid,'Simplef')
+      if (zaid .lt. zero) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid=he5_zacreate(zafid, "Simplef")'
+         write(*,*)'Value returned by he5_zacreate ', zaid
+         write(1,*)'zaid= he5_zacreate(zafid, "Simplef")'
+         write(1,*)'Value returned by he5_zacreate ', zaid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      zaid2=he5_zacreate(zafid,'Indexedf')
+      if (zaid2 .lt. zero) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid2= he5_zacreate(zafid, "Indexedf")'
+         write(*,*)'Value returned by he5_zacreate ', zaid2
+         write(1,*)'zaid2= he5_zacreate(zafid, "Indexedf")'
+         write(1,*)'Value returned by he5_zacreate ', zaid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zadefdim
+!
+      write(1,27)
+      write(*,*)'Testing he5_zadefdim '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zadefdim '
+      write(1,*)'====================='
+      status=he5_zadefdim(zaid,'DataTrack',dim4)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_zadefdim(zaid, "DataTrack", 100)'
+         write(*,*)'	Value returned by he5_zadefdim ',status
+         write(1,*)'	status= he5_zadefdim(zaid, "DataTrack", 100)'
+         write(1,*)'	Value returned by he5_zadefdim ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zadefdim(zaid,'DataXtrack',dim2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_zadefdim(zaid, "DataXtrack", 40)'
+         write(*,*)'	Value returned by he5_zadefdim ',status
+         write(1,*)'	status= he5_zadefdim(zaid, "DataXtrack", 40)'
+         write(1,*)'	Value returned by he5_zadefdim ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zadefdim(zaid2,'DataTrack',dim2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_zadefdim(zaid2, "DataTrack", 40)'
+         write(*,*)'	Value returned by he5_zadefdim ', status
+         write(1,*)'	status= he5_zadefdim(zaid2, "DataTrack", 40)'
+         write(1,*)'	Value returned by he5_zadefdim ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zadefdim(zaid2,'DataXtrack',dim2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'	status= he5_zadefdim(zaid2, "DataXtrack", 40)'
+         write(*,*)'	Value returned by he5_zadefdim ', status
+         write(1,*)'	status= he5_zadefdim(zaid2, "DataXtrack", 40)'
+         write(1,*)'	Value returned by he5_zadefdim ', status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zadefdim(zaid2,'Timedim',dim2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define dimension Timedim '
+         write(*,*)'	Value returned by he5_zadefdim ', status
+         write(1,*)'Define dimension Timedim '
+         write(1,*)'	Value returned by he5_zadefdim ', status
+      endif
+
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zadefine
+!
+      write(1,27)
+      write(*,*)'Testing he5_zadefine '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zadefine '
+      write(1,*)'====================='
+
+      status=he5_zadefine(zaid,'SideA','DataXtrack,DataTrack',
+     1' ', HE5T_NATIVE_FLOAT)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+        
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define data field SideA '
+         write(*,*)'Value returned by he5_zadefine ',status
+         write(1,*)'Define data field SideA '
+         write(1,*)'Value returned by he5_zadefine ',status
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+! Test Case  -- he5_zasetfill
+!
+      write(1,27)
+      write(*,*)'Testing he5_zasetfill '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zasetfill '
+      write(1,*)'====================='
+      status= he5_zasetfill(zaid,'Temperature',
+     1HE5T_NATIVE_FLOAT, fillvalue)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zasetfill(zaid,"Temperature",
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(*,*)'Value returned by he5_zasetfill ',status
+         write(1,*)'status=he5_zasetfill(zaid,"Temperature",
+     1HE5T_NATIVE_FLOAT, fillvalue)'
+         write(1,*)'Value returned by he5_zasetfill ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zadefine(zaid,'Temperature',
+     1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define data field Temperature '
+         write(*,*)'Value returned by he5_zadefine ',status
+         write(1,*)'Define data field Temperature '
+         write(1,*)'Value returned by he5_zadefine ',status
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+      status= he5_zasetfill(zaid,'Conduction',
+     1HE5T_NATIVE_FLOAT,fillvalue)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zasetfill(zaid,"Conduction",
+     1HE5T_NATIVE_FLOAT,fillvalue)'
+         write(*,*)'Value returned by he5_zasetfill ',status
+         write(1,*)'status=he5_zasetfill(zaid,"Conduction",
+     1HE5T_NATIVE_FLOAT,fillvalue)'
+         write(1,*)'Value returned by he5_zasetfill ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zadefine(zaid,'Conduction',
+     1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadefine(zaid,"Conduction",
+     1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT)'
+         write(*,*)'Value returned by he5_zadefine ',status
+         write(1,*)'status= he5_zadefine(zaid,"Conduction",
+     1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT)'
+         write(1,*)'Value returned by he5_zadefine ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zadefine(zaid2,'Sensor1',
+     1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zadefine(zaid2, "Sensor1",
+     1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT)'
+         write(*,*)'Value returned by he5_zadefine ',status
+         write(1,*)'status= he5_zadefine(zaid2, "Sensor1",
+     1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT)'
+         write(1,*)'Value returned by he5_zadefine ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zadefchunk
+!
+      write(1,27)
+      write(*,*)'Testing he5_zadefchunk'
+      write(*,*)'======================'
+      write(1,*)'Testing he5_zadefchunk'
+      write(1,*)'======================'
+      status=he5_zadefchunk(zaid,cnkrank,chunkdims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadefchunk(zaid, cnkrank, chunkdims)'
+         write(*,*)'Value returned by he5_zadefchunk ',status
+         write(1,*)'status= he5_zadefchunk(zaid, cnkrank, chunkdims)'
+         write(1,*)'Value returned by he5_zadefchunk ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+    
+! Test Case -- he5_zadefcomp
+!
+      write(1,27)
+      write(*,*)'Testing he5_zadefcomp'
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zadefcomp'
+      write(1,*)'====================='
+      status=he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE,compparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE,
+     1compparm)'
+         write(*,*)'Value returned by he5_zadefcomp ',status
+         write(1,*)'status= he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE,
+     1compparm)'
+         write(1,*)'Value returned by he5_zadefcomp ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      status=he5_zadefine(zaid,'CompChunk','DataTrack',
+     1' ',HE5T_NATIVE_FLOAT)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230) 
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Define data field CompChunk '
+         write(*,*)'Value returned by he5_zadefine ',status
+         write(1,*)'Define data field CompChunk '
+         write(1,*)'Value returned by he5_zadefine ',status
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+! Test Case -- he5_zadetach
+!
+      write(1,27)
+      write(*,*)'Testing he5_zadetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zadetach '
+      write(1,*)'====================='
+      status=he5_zadetach(zaid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zadetach(zaid2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid2)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid2)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      zaid=he5_zaattach(zafid,'Simplef')
+      if (zaid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(*,*)'Value returned by he5_zaattach ',zaid
+         write(1,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(1,*)'Value returned by he5_zaattach ',zaid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      zaid2=he5_zaattach(zafid,'Indexedf')
+      if (zaid2 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid2= he5_zaattach(zafid, "Indexedf")'
+         write(*,*)'Value returned by he5_zaattach ',zaid2
+         write(1,*)'zaid2= he5_zaattach(zafid, "Indexedf")'
+         write(1,*)'Value returned by he5_zaattach ',zaid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zadetach
+!
+      write(1,27)
+      write(*,*)'Testing he5_zadetach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zadetach '
+      write(1,*)'====================='
+      status= he5_zadetach(zaid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zadetach(zaid2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid2)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid2)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zaclose(zafid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)       
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zaclose(zafid)'
+         write(*,*)'Value returned by he5_zaclose ',status
+         write(1,*)'status= he5_zaclose(zafid)'
+         write(1,*)'Value returned by he5_zaclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      zafid=he5_zaopen('za.he5',HE5F_ACC_RDWR)
+      if (zafid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zafid=he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_zaopen ',zafid
+         write(1,*)'zafid=he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_zaopen ',zafid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+ 
+! Test Case -- he5_zaattach
+!
+      write(1,27)
+      write(*,*)'Testing he5_zaattach '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zaattach '
+      write(1,*)'====================='
+
+      zaid=he5_zaattach(zafid,'Simplef')
+      if (zaid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(*,*)'Value returned by he5_zaattach ',zaid
+         write(1,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(1,*)'Value returned by he5_zaattach ',zaid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      zaid2=he5_zaattach(zafid,'Indexedf')
+      if (zaid2 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid2= he5_zaattach(zafid, "Indexedf")'
+         write(*,*)'Value returned by he5_zaattach ',zaid2
+         write(1,*)'zaid2= he5_zaattach(zafid, "Indexedf")'
+         write(1,*)'Value returned by he5_zaattach ',zaid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zawrite
+!
+      write(1,27)
+      write(*,*)'Testing he5_zawrite '
+      write(*,*)'==================='
+      write(1,*)'Testing he5_zawrite '
+      write(1,*)'==================='
+
+      status=he5_zawrite(zaid,'SideA',sd_start,stride, 
+     1rd_edge, ray4)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Write data field SideA '
+         write(*,*)'Value returned by he5_zawrite ',status
+         write(1,*)'Write data field SideA '
+         write(1,*)'Value returned by he5_zawrite ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zawrite(zaid,'Temperature',start,stride, 
+     1dataedge, ray4)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zawrite(zaid,"Temperature",start, 
+     1stride,dataedge, ray1)'
+         write(*,*)'Value returned by he5_zawrite ',status
+         write(1,*)'status=he5_zawrite(zaid,"Temperature",start, 
+     1stride,dataedge, ray1)'
+         write(1,*)'Value returned by he5_zawrite ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status=he5_zawrite(zaid,'Conduction',start,stride, 
+     1dataedge, ray2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zawrite(zaid,"Conduction",start, 
+     1stride,dataedge, ray2)'
+         write(*,*)'Value returned by he5_zawrite ',status
+         write(1,*)'status=he5_zawrite(zaid,"Conduction",start, 
+     1stride,dataedge, ray2)'
+         write(1,*)'Value returned by he5_zawrite ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      iedge(1)=40
+      iedge(2)=40
+      status=he5_zawrite(zaid2,'Sensor1',istart,stride, 
+     1iedge,ray3)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zawrite(zaid2, "Sensor1", 
+     1istart, stride, iedge, ray3)'
+         write(*,*)'Value returned by he5_zawrite ',status
+         write(1,*)'status= he5_zawrite(zaid2, "Sensor1", 
+     1istart, stride, iedge, ray3)'
+         write(1,*)'Value returned by he5_zawrite ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zawrlattr
+!
+      write(1,27)
+      write(*,*)'Testing he5_zawrlattr, Local Attribute '
+      write(*,*)'================================== '
+      write(1,*)'Testing he5_zawrlattr, Local Attribute '
+      write(1,*)'================================== '
+      status=he5_zawrlattr(zaid2,'Sensor1','local',
+     1HE5T_NATIVE_FLOAT,count,locattr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zawrlattr(zaid2,"Sensor1","local",
+     1HE5T_NATIVE_FLOAT,count,locattr)'
+         write(*,*)'Value returned by he5_zawrlattr ',status
+         write(1,*)'status=he5_zawrlattr(zaid2,"Sensor1", "local", 
+     1HE5T_NATIVE_FLOAT,count,locattr)'
+         write(1,*)'Value returned by he5_zawrlattr ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zawrattr
+!
+      count(1) = 4
+
+      write(1,27)
+      write(*,*)'Testing he5_zawrattr, Global Attribute '
+      write(*,*)'====================================== '
+      write(1,*)'Testing he5_zawrattr, Global Attribute '
+      write(1,*)'======================================= '
+      status=he5_zawrattr(zaid,'Drift',HE5T_NATIVE_INT,count, 
+     1global_attr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zawrattr(zaid, "Drift", 
+     1HE5T_NATIVE_INT, count, global_attr)'
+         write(*,*)'Value returned by he5_zawrattr ',status
+         write(1,*)'status=he5_zawrattr(zaid, "Drift", 
+     1HE5T_NATIVE_INT, count, global_attr)'
+         write(1,*)'Value returned by he5_zawrattr ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zawrgattr
+!
+      count(1) = 3
+     
+      write(1,27)
+      write(*,*)'Testing he5_zawrgattr, Group Attribute '
+      write(*,*)'====================================== '
+      write(1,*)'Testing he5_zawrgattr, Group Attribute '
+      write(1,*)'====================================== '
+      status=he5_zawrgattr(zaid,'group',HE5T_NATIVE_FLOAT, 
+     1count,grpattr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zawrgattr(zaid, "group", 
+     1HE5T_NATIVE_FLOAT,count,grpgattr)'
+         write(*,*)'Value returned by he5_zawrgattr ',status
+         write(1,*)'status=he5_zawrgattr(zaid, "group", 
+     1HE5T_NATIVE_FLOAT,count,grpattr)'
+         write(1,*)'Value returned by he5_zawrgattr ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zadetach(zaid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+      write(*,*)'status= he5_zadetach(zaid)'
+      write(*,*)'Value returned by he5_zadetach ',status
+      write(1,*)'status= he5_zadetach(zaid)'
+      write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zadetach(zaid2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid2)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid2)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zaclose
+!
+      write(1,27)
+      write(*,*)'Testing he5_zaclose '
+      write(*,*)'==================='
+      write(1,*)'Testing he5_zaclose '
+      write(1,*)'==================='
+      status= he5_zaclose(zafid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Value returned by he5_zaclose ',status
+         write(1,*)'status= he5_zaclose(zafid)'
+         write(1,*)'Value returned by he5_zaclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      zafid= he5_zaopen('za.he5',HE5F_ACC_RDWR)
+      if (zafid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_zaopen ', zafid
+         write(1,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_zaopen ', zafid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      zaid= he5_zaattach(zafid,'Simplef')
+      if (zaid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(*,*)'Value returned by he5_zaattach ',zaid
+         write(1,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(1,*)'Value returned by he5_zaattach ',zaid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zadetach(zaid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zaclose(zafid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zaclose(zafid)'
+         write(*,*)'Value returned by he5_zaclose ',status
+         write(1,*)'status= he5_zaclose(zafid)'
+         write(1,*)'Value returned by he5_zaclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      zafid= he5_zaopen('za.he5',HE5F_ACC_RDWR)
+      if (zafid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_zaopen ',zafid
+         write(1,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_zaopen ',zafid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      zaid=he5_zaattach(zafid,'Simplef')
+      if (zaid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(*,*)'Value returned by he5_zaattach ',zaid
+         write(1,*)'zaid= he5_zaattach(zafid, "Simplef")'
+         write(1,*)'Value returned by he5_zaattach ',zaid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      zaid2=he5_zaattach(zafid,'Indexedf')
+      if (zaid2 .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zaid2= he5_zaattach(zafid, "Indexedf")'
+         write(*,*)'Value returned by he5_zaattach ',zaid2
+         write(1,*)'zaid2= he5_zaattach(zafid, "Indexedf")'
+         write(1,*)'Value returned by he5_zaattach ',zaid2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zanentries
+!
+      write(1,27)
+      write(*,*)'Testing he5_zanentries '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zanentries '
+      write(1,*)'====================='
+
+      nmaps=he5_zanentries(zaid,1,strbufsize)
+      if (nmaps .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'nmaps= he5_zanentries(zaid, 1, strbufsize)'
+         write(*,*)'Number of dimension mappings ',nmaps
+         write(*,*)'Size of strbufsize ',strbufsize
+         write(1,*)'nmaps= he5_zanentries(zaid, 1, strbufsize)'
+         write(1,*)'Number of dimension mappings ',nmaps
+         write(1,*)'Size of strbufsize ',strbufsize
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zainqdims
+!
+      write(1,27)
+      write(*,*)'Testing he5_zainqdims '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zainqdims '
+      write(1,*)'====================='
+      ndims=he5_zainqdims(zaid,dimname,dims)
+      if (ndims .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'ndims= he5_zainqdims(zaid, dimname, dims)'
+         write(*,*)'Number of dimesions ',ndims
+         write(*,*)'Names of dimensions ',dimname
+         write(*,*)'Size of dimensions ',dims
+         write(1,*)'ndims= he5_zainqdims(zaid, dimname, dims)'
+         write(1,*)'Number of dimesions ',ndims
+         write(1,*)'Names of dimensions ',dimname
+         write(1,*)'Size of dimensions ',dims
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      ndims= he5_zainqdims(zaid2, dimname, dims2)
+      if (ndims .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'ndims=he5_zainqdims(zaid2,dimname,dims2)'
+         write(*,*)'Number of dimesions ',ndims
+         write(*,*)'Names of dimensions ',dimname
+         write(*,*)'Size of dimensions ',dims2
+         write(1,*)'ndims=he5_zainqdims(zaid2,dimname,dims2)'
+         write(1,*)'Number of dimesions ',ndims
+         write(1,*)'Names of dimensions ',dimname
+         write(1,*)'Size of dimensions ',dims2
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zainquire
+!
+      write(1,27)
+      write(*,*)'Testing he5_zainquire '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_zainquire '
+      write(1,*)'======================'
+      nflds=he5_zainquire(zaid,fieldlist,rnkd,ntyped)
+      if (nflds .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'nflds=he5_zainquire(zaid,fieldlist,rnkd,ntyped)'
+         write(*,*)'Number of data fields in za ',nflds
+         write(*,*)'Names of data fields ',fieldlist
+         write(*,*)'Rank of fields ',rnkd
+         write(*,*)'Number type of fields ',ntyped
+         write(1,*)'nflds=he5_zainquire(zaid,fieldlist,rnkd,ntyped)'
+         write(1,*)'Number of data fields in za ',nflds
+         write(1,*)'Names of data fields ',fieldlist
+         write(1,*)'Rank of fields ',rnkd
+         write(1,*)'Number type of fields ',ntyped
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zadiminfo
+!
+      write(1,27)
+      write(*,*)'Testing he5_zadiminfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zadiminfo '
+      write(1,*)'====================='
+      dimsize= he5_zadiminfo(zaid,'DataTrack')
+      if (dimsize .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'dimsize= he5_zadiminfo(zaid, "DataTrack")'
+         write(*,*)'Size of dimension DataTrack ',dimsize
+         write(1,*)'dimsize= he5_zadiminfo(zaid, "DataTrack")'
+         write(1,*)'Size of dimension DataTrack ',dimsize
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+! Test Case -- he5_zaread
+!
+      write(1,27)
+      write(*,*)'Testing he5_zaread '
+      write(*,*)'==================='
+      write(1,*)'Testing he5_zaread '
+      write(1,*)'==================='
+
+      rd_start(1)=0
+      rd_start(2)=0
+      rd_stride(1)=1
+      rd_stride(2)=1
+      rd_edge(1)=40
+      rd_edge(2)=100
+      status= he5_zaread(zaid,'Conduction',rd_start,
+     1rd_stride,rd_edge,temp)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Value returned by he5_zaread ',status
+         write(*,*)'status= he5_zaread(zaid, "Conduction", 
+     1rd_start,rd_stride, rd_edge, temp)'
+         write(1,*)'status= he5_zaread(zaid, "Conduction", 
+     1rd_start,rd_stride, rd_edge, temp)'
+         write(1,*)'Value returned by he5_zaread ',status
+         do 190 index1=10,15
+            do 180 index2=10,15
+               write(*,*)'value of conduction ',temp(index1,index2)
+               write(1,*)'value of conduction ',temp(index1,index2)
+  180       continue
+  190    continue
+      endif
+
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zainfo
+!
+      write(1,27)
+      write(*,*)'Testing he5_zainfo '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zainfo '
+      write(1,*)'====================='
+      status=he5_zainfo(zaid,'SideA',rank,sddims,nt,
+     1dimens,maxdims)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zainfo(zaid, "SideA", 
+     1rank, sddims, nt, dimens, maxdims)'
+         write(*,*)'Value returned by he5_zainfo ',status
+         write(*,*)'Rank of field sideA ',rank
+         write(*,*)'dimension list of field sideA ',dimens
+         write(*,*)'Size of sideA dimensions ',sddims
+         write(*,*)'number type of field sideA ',nt
+         write(1,*)'status= he5_zainfo(zaid, "SideA", 
+     1rank, sddims, nt, dimens, maxdims)'
+         write(1,*)'Value returned by he5_zainfo ',status
+         write(1,*)'Rank of field sideA ',rank
+         write(1,*)'dimension list of field sideA ',dimens
+         write(1,*)'Size of sideA dimensions ',sddims
+         write(1,*)'number type of field sideA ',nt
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zainqattrs
+!
+      write(1,27)
+      write(*,*)'Testing he5_zainqattrs Global attributes '
+      write(*,*)'==================================== '
+      write(1,*)'Testing he5_zainqattrs Global attributes '
+      write(1,*)'==================================== '
+
+      nattr = he5_zainqattrs(zaid,attrlist,strbufsz2)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Number of global attributes in za ',nattr
+         write(*,*)'Attribute list of za ',attrlist
+         write(1,*)'Number of global attributes in za ',nattr
+         write(1,*)'Attribute list of za ',attrlist
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+! Test Case -- he5_zaattrinfo
+!
+      write(1,27)
+      write(*,*)'Testing he5_zaattrinfo Global attribute'
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_zaattrinfo Global attribute'
+      write(1,*)'======================================='
+      status= he5_zaattrinfo(zaid, attrlist, n, size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zaattrinfo(zaid,attrlist,n,size)'
+         write(*,*)'Value returned by he5_zaattrinfo ',status
+         write(*,*)'Number type of attributes ',n,' Size ',size
+         write(1,*)'status=he5_zaattrinfo(zaid,attrlist,n,size)'
+         write(1,*)'Value returned by he5_zaattrinfo ',status
+         write(1,*)'Number type of attributes ',n,' Size ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zardattr
+!
+      write(1,27)
+      write(*,*)'Testing he5_zardattr, Global attribute '
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_zardattr, Global attribute '
+      write(1,*)'======================================'
+
+      status= he5_zardattr(zaid, attrlist, rdattr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zardattr(zaid,attrlist,rdattr)'
+         write(*,*)'Value returned by he5_zardattr ',status
+         write(*,*)'attribute ',rdattr
+         write(1,*)'status=he5_zardattr(zaid,attrlist,rdattr)'
+         write(1,*)'Value returned by he5_zardattr ',status
+         write(1,*)'attribute ',rdattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+!     Test Case -- he5_zainqgattrs
+!
+      write(1,27)
+      write(*,*)'Testing he5_zainqgattrs Group attributes '
+      write(*,*)'==================================== '
+      write(1,*)'Testing he5_zainqgattrs Group attributes '
+      write(1,*)'==================================== '
+
+      nattr = he5_zainqgattrs(zaid,attrlist,strbufsz2)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Number of group attributes in za ',nattr
+         write(*,*)'Attribute list of za ',attrlist
+         write(1,*)'Number of group attributes in za ',nattr
+         write(1,*)'Attribute list of za ',attrlist
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+! Test Case -- he5_zagattrinfo
+!
+      write(1,27)
+      write(*,*)'Testing he5_zagattrinfo Group attribute'
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_zagattrinfo Group attribute'
+      write(1,*)'======================================='
+      status= he5_zagattrinfo(zaid, attrlist, n, size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zagattrinfo(zaid,attrlist,n,size)'
+         write(*,*)'Value returned by he5_zagattrinfo ',status
+         write(*,*)'Number type of attributes ',n,' Size ',size
+         write(1,*)'status=he5_zagattrinfo(zaid,attrlist,n,size)'
+         write(1,*)'Value returned by he5_zagattrinfo ',status
+         write(1,*)'Number type of attributes ',n,' Size ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zardgattr
+!
+      write(1,27)
+      write(*,*)'Testing he5_zardgattr, Group attribute '
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_zardgattr, Group attribute '
+      write(1,*)'======================================'
+
+       status= he5_zardgattr(zaid,'group',rdgnlattr)
+       if (status .lt. zero) then
+          write(*,230)
+          write(1,230)
+       else
+          write(*,*)'  '
+          write(*,240)
+          write(1,*)'  '
+          write(1,240)
+          write(*,*)'status=he5_zardgattr(zaid,attrlist,rdgnlattr)'
+          write(*,*)'Value returned by he5_zardgattr ',status
+          write(*,*)'attribute ',rdgnlattr
+          write(1,*)'status=he5_zardgattr(zaid,attrlist,rdgnlattr)'
+          write(1,*)'Value returned by he5_zardgattr ',status
+          write(1,*)'attribute ',rdgnlattr
+       endif
+       write(*,*)' '
+       write(1,*)' '
+
+! Test Case -- he5_zainqlattrs
+!
+      write(1,27)
+      write(*,*)'Testing he5_zainqlattrs Local attributes '
+      write(*,*)'==================================== '
+      write(1,*)'Testing he5_zainqlattrs Local attributes '
+      write(1,*)'==================================== '
+
+      nattr=he5_zainqlattrs(zaid2,'Sensor1',attrlist,strbufsz2)
+      if (nattr .lt. zero) then
+         write(*,230)
+         write(1,230)         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zainqlattrs(... "Sensor1" ...)'
+         write(*,*)'Number of local attributes in field ',nattr
+         write(*,*)'Attribute list of field ',attrlist
+         write(1,*)'zainqlattrs(... "Sensor1" ...)'
+         write(1,*)'Number of local attributes in field ',nattr
+         write(1,*)'Attribute list of field ',attrlist
+         write(*,*)' '
+         write(1,*)' '
+      endif
+
+! Test Case -- he5_zalattrinfo
+!
+      write(1,27)
+      write(*,*)'Testing he5_zalattrinfo Local attribute'
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_zalattrinfo Local attribute'
+      write(1,*)'======================================='
+      status=he5_zalattrinfo(zaid2,'Sensor1','local',n,size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zalattrinfo(... "Sensor1" ...)'
+         write(*,*)'Value returned by he5_zalattrinfo ',status
+         write(*,*)'Number type of attributes ',n,' Size ',size
+         write(1,*)'zalattrinfo(... "Sensor1" ...)'
+         write(1,*)'Value returned by he5_zalattrinfo ',status
+         write(1,*)'Number type of attributes ',n,' Size ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zaidtype
+!
+      write(1,27)
+      write(*,*)'Testing he5_zaidtype, Inquire Datatype '
+      write(*,*)'======================================='
+      write(1,*)'Testing he5_zaidtype, Inquire Datatype '
+      write(1,*)'======================================='
+
+      status= he5_zaidtype(zaid2,'Sensor1','local', 
+     1HE5_HDFE_LOCATTRGROUP,dtype,classid, order, size)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zaidtype(zaid2,"Sensor1","local", 
+     1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)'
+         write(*,*)'Value returned by he5_zaidtype ',status
+         write(*,*)'Datatype of local attribute ',dtype
+         write(*,*)'Class id and order ',classid, order
+         write(*,*)'Size of attribute ',size
+         write(1,*)'status= he5_zaidtype(zaid2,"Sensor1","local", 
+     1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)'
+         write(1,*)'Value returned by he5_zaidtype ',status
+         write(1,*)'Datatype of local attribute ',dtype
+         write(1,*)'Class id and order ',classid, order
+         write(1,*)'Size of attribute ',size
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zardlattr
+!
+      write(1,27)
+      write(*,*)'Testing he5_zardlattr, Local attribute '
+      write(*,*)'======================================'
+      write(1,*)'Testing he5_zardlattr, Local attribute '
+      write(1,*)'======================================'
+
+      status=he5_zardlattr(zaid2,'Sensor1','local',rdgnlattr)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zardlattr(zaid2,"Sensor1","local", 
+     1rdgnlattr)'
+         write(*,*)'Value returned by he5_zardlattr ',status
+         write(*,*)'attribute ',rdgnlattr
+         write(1,*)'status=he5_zardlattr(zaid2,"Sensor1","local", 
+     1rdgnlattr)'
+         write(1,*)'Value returned by he5_zardlattr ',status
+         write(1,*)'attribute ',rdgnlattr
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+! Test Case -- he5_zagetfill
+!
+      write(1,27)
+      write(*,*)'Testing he5_zagetfill '
+      write(*,*)'====================='
+      write(1,*)'Testing he5_zagetfill '
+      write(1,*)'====================='
+      status= he5_zagetfill(zaid,'Conduction', rdfilval)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zagetfill(zaid,"Conduction",rdfilval)'
+         write(*,*)'Value returned by he5_zagetfill ',status
+         write(*,*)'Value of fill ',rdfilval
+         write(1,*)'status=he5_zagetfill(zaid,"Conduction",rdfilval)'
+         write(1,*)'Value returned by he5_zagetfill ',status
+         write(1,*)'Value of fill ',rdfilval
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+
+! Test Case -- he5_zacompinfo
+!
+      write(1,27)
+      write(*,*)'Testing he5_zacompinfo '
+      write(*,*)'======================='
+      write(1,*)'Testing he5_zacompinfo '
+      write(1,*)'======================='
+      status=he5_zacompinfo(zaid,'CompChunk',compcode,rdcompparm)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status=he5_zacompinfo(zaid,"CompChunk",compcode, 
+     1rdcompparm)'
+         write(*,*)'Status returned by he5_zacompinfo ',status
+         write(*,*)'Compression code ',compcode
+         write(*,*)'Compression parameter ',rdcompparm(1)
+         write(1,*)'status=he5_zacompinfo(zaid,"CompChunk",compcode, 
+     1rdcompparm)'
+         write(1,*)'Status returned by he5_zacompinfo ',status
+         write(1,*)'Compression code ',compcode
+         write(1,*)'Compression parameter ',rdcompparm(1)
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zadetach(zaid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zadetach(zaid2)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)         
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zadetach(zaid2)'
+         write(*,*)'Value returned by he5_zadetach ',status
+         write(1,*)'status= he5_zadetach(zaid2)'
+         write(1,*)'Value returned by he5_zadetach ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zaclose(zafid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zaclose(zafid)'
+         write(*,*)'Value returned by he5_zaclose ',status
+         write(1,*)'status= he5_zaclose(zafid)'
+         write(1,*)'Value returned by he5_zaclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+      zafid= he5_zaopen('za.he5',HE5F_ACC_RDWR)
+      if (zafid .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(*,*)'Value returned by he5_zaopen ',zafid
+         write(1,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)'
+         write(1,*)'Value returned by he5_zaopen ',zafid
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+
+! Test Case -- he5_zainqza
+!
+      write(1,27)
+      write(*,*)'Testing he5_zainqza '
+      write(*,*)'======================'
+      write(1,*)'Testing he5_zainqza '
+      write(1,*)'======================'
+
+      nza=he5_zainqza('za.he5',zalist,strbufsz2)
+      if (nza .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'Retrieve information on zas in 
+     1file za.he5'
+         write(*,*)'Number of zas in file ', nza
+         write(*,*)'List of zas ',zalist
+         write(1,*)'Retrieve information on zas in 
+     1file za.he5'
+         write(1,*)'Number of zas in file ', nza
+         write(1,*)'List of zas ',zalist
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      status= he5_zaclose(zafid)
+      if (status .lt. zero) then
+         write(*,230)
+         write(1,230)
+      else
+         write(*,*)'  '
+         write(*,240)
+         write(1,*)'  '
+         write(1,240)
+         write(*,*)'status= he5_zaclose(zafid)'
+         write(*,*)'Value returned by he5_zaclose ',status
+         write(1,*)'status= he5_zaclose(zafid)'
+         write(1,*)'Value returned by he5_zaclose ',status
+      endif
+      write(*,*)' '
+      write(1,*)' '
+
+      close(unit=1)
+   27 format(' ')
+      stop
+      end
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/util/HE5_GDconvert_ij2ll.c b/util/HE5_GDconvert_ij2ll.c
new file mode 100644
index 0000000..2c26076
--- /dev/null
+++ b/util/HE5_GDconvert_ij2ll.c
@@ -0,0 +1,883 @@
+/*********************************************************
+HE5_GDconver_ij2ll.c--
+
+This function converts pixel coordinates i,j into lat/lon for a grid in 
+an hdf-eos5 file. Once installed executable will be in hdfeos5/bin/<brand> 
+directory. Followings are how to run the executible, and the outcome:
+
+a) ./HE5_GDconver_ij2ll <input_hdf_file_name> <input_grid_name>
+
+   will write ASCII output for i,j,lat,lon onto STDOUT for whole grid.
+
+b) ./HE5_GDconvert_ij2ll <input_hdf_file_name> <input_grid_name> <output_file_name_template> <-a>
+   will write ASCII output for i,j,lat,lon into a file.
+
+c) ./HE5_GDconvert_ij2ll <input_hdf_file_name> <input_grid_name> <output_file_name_template> <-b>
+   will write 3 output files with names constructed using output_file_name_template:
+       1. An ascii file containing info for input file and grid.
+       2. A binary file containing latitudes (64bit flaot data), 
+          a row follows another row for the grid
+       3. A binary file containing longitudes (64bit flaot data), 
+          a row follows another row for the grid
+
+d) ./HE5_GDconvert_ij2ll <input_hdf_file_name> <input_grid_name> STDOUT <-a> <i j>
+   will write ASCII output for i,j,lat,lon onto STDOUT for a single pair.
+
+User may type ./HE5_GDconvert_ij2ll to see what the usage is. Also typing a
+dummy grid name will return error, specifying what the valid grid names 
+are in the hdf file.
+
+Author--
+Abe Taaheri, Raytheon IIS
+
+Dates--
+2/20/2007   AT  First Programming 
+
+*********************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <math.h>
+#include "HE5_HdfEosDef.h" 
+#include "cproj.h"
+#include "proj.h"
+
+#define COMMAND_STRING      1024
+
+typedef struct
+{
+  char inputFile[COMMAND_STRING];
+  char gridName[COMMAND_STRING];
+  char outputFile_nxny[COMMAND_STRING];
+  char outputFile_lat[COMMAND_STRING];
+  char outputFile_lon[COMMAND_STRING];
+  char outFileFlag[COMMAND_STRING];
+  long RowCol[2];
+}
+CommandArgument;
+
+CommandArgument Com;
+
+void strip_quote(char *gridname)
+{
+  char outstr[128];
+  int lenstr=0;
+  if(gridname[0] =='"')
+    {
+      gridname++;/*strip first quote */
+      strcpy(outstr, gridname);
+      lenstr = strlen(gridname);
+      outstr[lenstr-1]='\0'; /*strip last quote */
+      strcpy(gridname, outstr);
+    }
+}
+
+
+void CommandLineUsage()
+{
+    fprintf( stderr, "\tUsage (ASCII output onto STDOUT):\n\t./HE5_GDconvert_ij2ll <input_hdf_file_name> <input_grid_name>\n" );
+
+    fprintf( stderr, " OR\n");
+    fprintf( stderr, "\tUsage (ASCII output into a file):\n\t./HE5_GDconvert_ij2ll <input_hdf_file_name> <input_grid_name> <output_file_name_template> <-a>\n" );
+ 
+    fprintf( stderr, " OR\n");
+    fprintf( stderr, "\tUsage (for Binary output into a file):\n\t./HE5_GDconvert_ij2ll <input_hdf_file_name> <input_grid_name> <output_file_name_template> <-b>\n" );
+
+    fprintf( stderr, " OR\n");
+    fprintf( stderr, "\tUsage (lat/lon for a given (row col)):\n\t./HE5_GDconvert_ij2ll <input_hdf_file_name> <input_grid_name> STDOUT <-a> <i j>\n" );
+    fprintf( stderr, " \n");
+    fprintf( stderr, "\tNote: You should put gridname inside double quotes (\") if there is a blank space in it. \n" );
+ }
+/* get: 
+   input hdf file
+   Grid name to process
+   Output ASCII filename
+*/
+herr_t commandLineReader(int argc, char *argv[], CommandArgument *Com )
+{
+  char      *errbuf = NULL;/* Error message buffer */
+
+  printf( "\tNote: You should put gridname inside double quotes (\") if there is a blank space in it. \n" );
+  printf( "\t      Otherwise the conversion may fail or produce unexpected results. \n" );
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "commandLineReader", __LINE__, H5E_RESOURCE, 
+	      H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory to error buffer, occured", 
+		  __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+  if ( argc < 3 || argc > 7 || argc == 6) /* display usage in case of no or 
+					  insufficient arguments */
+    {
+      /* user need help read the command line option, it is not error */
+      CommandLineUsage();
+      exit(-1); 
+    }
+  
+  /* read command line parameters */
+  if(argc ==  7)
+    {/* will write a lat/lon pair ASCII output to stdout */ 
+      strcpy(Com->inputFile, argv[1]);
+      strcpy(Com->gridName, argv[2]);
+      strip_quote(Com->gridName);
+      strcpy(Com->outputFile_nxny, "");
+      strcpy(Com->outputFile_lat, "");
+      strcpy(Com->outputFile_lon, "");
+      strcpy(Com->outFileFlag, argv[4]);
+      Com->RowCol[0] = atol(argv[5]);
+      Com->RowCol[1] = atol(argv[6]);
+      if( Com->RowCol[0] < 0 || Com->RowCol[1] < 0)
+	{
+	  sprintf(errbuf, "Row or Column numbers cannot be negative.\n");
+	  H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_ARGS, 
+		  H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  return (-1);
+	}
+      free(errbuf);
+      return 0;
+    }
+  else if (argc ==  5)
+    {/* will write (rows X cols) ASCII or BINARY output to output file */ 
+      strcpy(Com->inputFile, argv[1]);
+      strcpy(Com->gridName, argv[2]);
+      strip_quote(Com->gridName);
+      strcpy(Com->outputFile_nxny, argv[3]);
+      strcpy(Com->outputFile_lat, argv[3]);
+      strcpy(Com->outputFile_lon, argv[3]);
+      strcat(Com->outputFile_nxny,"_ASCII");
+      strcat(Com->outputFile_lat,"_lat");
+      strcat(Com->outputFile_lon,"_lon");
+      strcpy(Com->outFileFlag, argv[4]);
+      Com->RowCol[0] = -1;
+      Com->RowCol[1] = -1;
+      free(errbuf);
+      return 0;
+    }
+  else if(argc ==  4)
+    {/* will write (rows X cols) ASCII output to output file */ 
+      strcpy(Com->inputFile, argv[1]);
+      strcpy(Com->gridName, argv[2]);
+      strip_quote(Com->gridName);
+      strcpy(Com->outputFile_nxny, argv[3]);
+      strcpy(Com->outputFile_lat, argv[3]);
+      strcpy(Com->outputFile_lon, argv[3]);
+      strcat(Com->outputFile_nxny,"_ASCII");
+      strcat(Com->outputFile_lat,"_lat");
+      strcat(Com->outputFile_lon,"_lon");
+      strcpy(Com->outFileFlag, "-a");
+      Com->RowCol[0] = -1;
+      Com->RowCol[1] = -1;
+      free(errbuf);
+      return 0;
+    }
+  else if (argc ==  3)
+    { /* will write (rows X cols) ASCII output to stdout */ 
+      strcpy(Com->inputFile, argv[1]);
+      strcpy(Com->gridName, argv[2]);
+      strip_quote(Com->gridName);
+      strcpy(Com->outputFile_nxny, "");
+      strcpy(Com->outputFile_lat, "");
+      strcpy(Com->outputFile_lon, "");
+      strcpy(Com->outFileFlag, "-a");
+      Com->RowCol[0] = -1;
+      Com->RowCol[1] = -1;
+      free(errbuf);
+      return 0;
+    }
+  free(errbuf);
+  return 0;
+}     
+
+
+/* Separating string */
+
+void separating_String(char *stringlist, long *nstring, char *strings[], 
+		       char strs[])
+{
+  char  *astring = NULL;
+    
+  *nstring=0;
+  astring=strtok(stringlist, strs);
+  while (astring!=NULL)
+  {
+    strings[*nstring]=astring;  
+    astring=strtok(NULL, strs);
+    *nstring=*nstring+1;
+  } 
+}
+
+
+
+herr_t main(int argc, char *argv[])
+{
+  herr_t     status = 0;
+  int        i, j, jx, jy,k, is;
+  int        Singl_latlon = 0; /* get the lat/lon for whole grid */
+  hid_t      gdfid, gdid[10];
+  long       xdimsize, ydimsize;
+  long       ngrid;
+  int        grid_not_found;
+  char       gridlist[1000], tmp_gridlist[1000],*grids[20];
+  int        projcode=0; 
+  int        zonecode=0;
+  double     projparam[16]={0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
+		            0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
+			    0.0, 0.0, 0.0, 0.0};
+  int        spherecode =0;
+  long       strsize;
+  int        pixregcode, origincode;
+  double     upleft[2], lowright[2];
+  double     lowleft[2], upright[2];
+  long       npnts;
+  double    *lats = NULL; 
+  double    *lons = NULL;
+  long      *rows = NULL; 
+  long      *cols = NULL;
+  int        v1;
+
+  FILE *outfile_nxny = NULL;  /* Pointer for ASCII outfile file for rows,cols*/
+  FILE *outfile_lat = NULL;   /* Pointer for outfile file for lats*/
+  FILE *outfile_lon = NULL;   /* Pointer for outfile file for lons */
+  char      *errbuf = NULL;   /* Error message buffer */
+  char projection[64];
+
+  /* Allocate memory for error buffer */
+  /* -------------------------------- */
+  errbuf  = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char));
+  if(errbuf == NULL)
+    {
+      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_RESOURCE, 
+	      H5E_NOSPACE, "Cannot allocate memory to error buffer.");
+      HE5_EHprint("Error: Cannot allocate memory to error buffer, occured", 
+		  __FILE__, __LINE__);
+      return(FAIL);
+    }
+
+ /* process command-line arguments (to get parameter filename) */
+  status = commandLineReader(argc, argv, &Com);
+    if (status == -1)
+    {
+      status = -1;
+      sprintf(errbuf, "Problem with command line entries.\n");
+      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_ARGS, 
+	      H5E_BADVALUE,errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+  gdfid=HE5_GDopen((&Com)->inputFile, H5F_ACC_RDONLY);
+  
+  if (gdfid == -1)
+    {
+      status = -1;
+      sprintf(errbuf, "The file %s cannot be opened.\n",(&Com)->inputFile);
+      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FILE, 
+	      H5E_CANTOPENFILE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+  
+	  
+  /*
+    Inquire grid
+  */
+  
+  ngrid=HE5_GDinqgrid((&Com)->inputFile, gridlist, &strsize);
+  if (ngrid<1)
+    {
+      HE5_GDclose(gdfid);
+      status = -1;
+      sprintf(errbuf, "No grid exists in the file %s.\n",(&Com)->inputFile);
+      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FUNC, 
+	      H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      free(errbuf);
+      return(status);
+    }
+  strcpy(tmp_gridlist, gridlist);
+  separating_String(tmp_gridlist, &ngrid, grids, ",");
+
+  /* check for  the desired grid */
+  grid_not_found = 0;
+  for (i=0; i<ngrid; i++)
+    {
+      if(strcmp((&Com)->gridName,grids[i]) !=0)
+	{
+	  if(i == (ngrid -1))
+	    {
+	      grid_not_found = 1;
+	      break;
+	    }
+	  else
+	    {
+	      continue;
+	    }
+	}
+      else
+	{
+	  is =i;
+	  break;
+	}
+    }
+  
+  if(grid_not_found == 1)
+    {
+      status = -1;
+      sprintf(errbuf, "The file %s does not contain grid %s. The grids in this file are: %s\n",(&Com)->inputFile, (&Com)->gridName,gridlist);
+      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FUNC, 
+	      H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      HE5_GDclose(gdfid);
+      free(errbuf);
+      return(status);
+    }
+  
+  gdid[is]=HE5_GDattach(gdfid, grids[is]);
+  
+  status=HE5_GDprojinfo(gdid[is], &projcode, &zonecode, &spherecode, 
+			projparam);
+  
+  if (status==-1)
+    {
+      sprintf(errbuf, "No projection information for grid %s.\n",gdid[is]);
+      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FUNC, 
+	      H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      HE5_GDdetach(gdid[is]);
+      HE5_GDclose(gdfid);
+      free(errbuf);
+      return(status);
+    }
+
+    /* set grid INFO */
+
+    switch (projcode)
+      {
+      case HE5_GCTP_GEO:
+	strcpy(projection,"GEOGRAPHIC");
+	break;
+      case HE5_GCTP_UTM:
+	strcpy(projection,"UNIVERSAL TRANSVERSE MERCATOR");
+	break;
+      case HE5_GCTP_LAMCC:
+ 	strcpy(projection,"LAMBERT CONFORMAL CONIC");
+	break;
+      case HE5_GCTP_PS:
+	strcpy(projection,"POLAR STREOGRAPHIC");
+	break;
+      case HE5_GCTP_POLYC:
+	strcpy(projection,"POLYCONIC");
+	break;
+      case HE5_GCTP_TM:
+	strcpy(projection,"TRANSVERSE MERCATOR");
+	break;
+      case HE5_GCTP_LAMAZ:
+	strcpy(projection,"LAMBERT AZIMUTHAL");
+	break;
+      case HE5_GCTP_HOM:
+	strcpy(projection,"HOTIN OBLIQUE MERCATOR");
+	break;
+      case HE5_GCTP_SOM:
+	strcpy(projection,"SPACE OBLIQUE MERCATOR");
+	break;
+      case HE5_GCTP_GOOD:
+	strcpy(projection,"INTERRPTED GOODE");
+	break;
+      case HE5_GCTP_SPCS:
+	strcpy(projection,"STATE PLANE");	
+	break;
+      case 99:
+	strcpy(projection,"INTEGERIZED SINUSOIDAL");
+	break;
+      case HE5_GCTP_SNSOID:
+	strcpy(projection,"SINUSOIDAL");
+	break;
+      case HE5_GCTP_MERCAT:
+	strcpy(projection,"MERCATOR");
+	break;
+      case HE5_GCTP_ALBERS:
+	strcpy(projection,"ALBERS CONICAL EQUAL AREA");
+	break;
+	
+      default:
+ 	strcpy(projection,"NOT SUPPORTED");
+	fprintf(stdout,"Projection type does not exist.");
+      }
+
+  status=HE5_GDpixreginfo(gdid[is], &pixregcode);
+  if (status==-1)
+    {
+      sprintf(errbuf, "No pixel rgistration code information for grid %s, assuming the default HE5_HDFE_CENTER.\n",gdid[is]);
+      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FUNC, 
+	      H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      pixregcode = HE5_HDFE_CENTER;
+    }
+  else
+    {
+      if(pixregcode == HE5_HDFE_CORNER)
+	{
+	  status=HE5_GDorigininfo(gdid[is], &origincode);
+	  if (status==-1)
+	    {
+	      sprintf(errbuf, "No origin information for grid %s, assuming the default HE5_HDFE_GD_UL.\n",gdid[is]);
+	      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FUNC, 
+		      H5E_CANTINIT, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      origincode = HE5_HDFE_GD_UL;
+	    }
+	}
+    }
+
+  status=HE5_GDgridinfo(gdid[is], &xdimsize, &ydimsize, upleft, lowright);
+  if (status==-1)
+    {
+      sprintf(errbuf, "No grid information for grid %s.\n",gdid[is]);
+      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FUNC, 
+	      H5E_CANTINIT, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      HE5_GDdetach(gdid[is]);
+      HE5_GDclose(gdfid);
+      free(errbuf);
+      return(status);
+    }
+
+
+
+  /* lat/lon for other two corners UR and LL */
+  /* these lat/los are in DMS format for GEO projection, and
+     meters for others.
+  */
+
+  upright[0] = lowright[0];
+  upright[1] = upleft[1];
+  lowleft[0] = upleft[0];
+  lowleft[1] = lowright[1];
+
+  /* we now have upper left, Lower right corners, xdim, and ydim  
+     lets get now the lat/lon for every i/j */
+
+  if((&Com)->RowCol[0] >= 0 && (&Com)->RowCol[1] >= 0)
+    {/* check to see if they are valid numbers */
+      if((&Com)->RowCol[0] > (ydimsize-1))
+	{
+	  status = -1;
+	  sprintf(errbuf, "Requestrd Row number %ld invalid. Should be less than %d.\n",(&Com)->RowCol[0], ydimsize);
+	  H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_ARGS, 
+		  H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  HE5_GDdetach(gdid[is]);
+	  HE5_GDclose(gdfid);
+	  free(errbuf);
+	  return(status);
+	}
+
+      if((&Com)->RowCol[1] > (xdimsize-1))
+	{
+	  status = -1;
+	  sprintf(errbuf, "Requestrd Column number %ld invalid. Should be less than %d.\n",(&Com)->RowCol[1],xdimsize);
+	  H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_ARGS, 
+		  H5E_BADVALUE, errbuf);
+	  HE5_EHprint(errbuf, __FILE__, __LINE__);
+	  HE5_GDdetach(gdid[is]);
+	  HE5_GDclose(gdfid);
+	  free(errbuf);
+	  return(status);
+	}
+      Singl_latlon = 1;/* get the lat/lon for a single pixel in the grid */
+    }
+  /* testing
+  printf("Rows: ydimsize=%d\n",ydimsize);
+  printf("cols: xdimsize=%d\n",xdimsize);
+  printf("Row#: %d\n",(&Com)->RowCol[0]);
+  printf("col#: %d\n",(&Com)->RowCol[1]);
+  */
+  if(Singl_latlon == 1)
+    {
+      npnts = 1;
+    }
+  else
+    {
+      npnts = xdimsize * ydimsize;
+    }
+      
+  lons = (double *) malloc(npnts*sizeof(double));
+  if(lons == NULL) 
+    {
+      sprintf(errbuf, "memory problem allocating space to lons....\n");
+      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FILE, 
+	      H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      HE5_GDdetach(gdid[is]);
+      HE5_GDclose(gdfid);
+      free(errbuf);
+      return(status);
+    }
+  
+  lats = (double *) malloc(npnts*sizeof(double));
+  if(lats == NULL) 
+    {
+      sprintf(errbuf, "memory problem allocating space to lats....\n");
+      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FILE, 
+	      H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      HE5_GDdetach(gdid[is]);
+      HE5_GDclose(gdfid);
+      free(errbuf);
+      return(status);
+    }
+  
+  rows = (long *) malloc(npnts*sizeof(long));
+  if(rows == NULL) 
+    {
+      sprintf(errbuf, "memory problem allocating space to rows....\n");
+      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FILE, 
+	      H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      HE5_GDdetach(gdid[is]);
+      HE5_GDclose(gdfid);
+      free(errbuf);
+      return(status);
+    }
+  
+  cols = (long *) malloc(npnts*sizeof(long));
+  if(cols == NULL) 
+    {
+      sprintf(errbuf, "memory problem allocating space to cols....\n");
+      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FILE, 
+	      H5E_NOSPACE, errbuf);
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      HE5_GDdetach(gdid[is]);
+      HE5_GDclose(gdfid);
+      free(errbuf);
+      return(status);
+    }
+  
+  if(Singl_latlon == 1)
+    {
+      rows[0] = (long) (&Com)->RowCol[0];
+      cols[0] = (long) (&Com)->RowCol[1];
+    }
+  else
+    {
+      /* LOAD UP row and col arrays for use by HE5_GDconvert_ij2ll */
+      /* ----------------------------------------------*/
+      k = 0;   /*  used for counting */
+      
+      for( jy = 0; jy < ydimsize; jy++ )   /* LOOP for each row     */
+	{
+	  for( jx = 0; jx < xdimsize; jx++ )   /* LOOP for each column  */
+	    {  
+	      rows[k] = jy;
+	      cols[k] = jx;
+	      k++;
+	    }
+	}
+    }
+
+  fprintf(stdout,"\n...calculating lat/lon values for grid...please wait... \n");
+
+  /* Get lat/lon values of grid for given i,j values*/
+  /* ---------------------------------------------- */
+  status  =  HE5_GDij2ll(projcode, zonecode, projparam,
+		     spherecode, xdimsize, ydimsize,
+		     upleft, lowright,
+		     npnts, rows, cols,
+		     lons, lats, pixregcode, origincode);
+
+  if(status == -1)
+    {
+      free(rows);
+      rows = NULL;
+      free(cols);
+      cols = NULL;
+      free(lons);
+      lons = NULL;
+      free(lats);
+      lats = NULL;
+
+      sprintf(errbuf, "Problem converting i,j to lat,lon in grid %s.\n",(&Com)->gridName);
+      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FUNC, 
+	      H5E_CANTINIT, errbuf);
+
+      HE5_EHprint(errbuf, __FILE__, __LINE__);
+      HE5_GDdetach(gdid[is]);
+      HE5_GDclose(gdfid);
+      free(errbuf);
+      return(status);
+    }
+  else
+    {
+      /* open output ASCII/Binary file and print results to it */
+      /* Or just print it stdout                               */
+
+      if(strcmp((&Com)->outputFile_nxny, "") != 0) /* Put output into a file */
+	{
+	  if(strcmp((&Com)->outFileFlag,"-b") == 0) /*open in binary mode*/
+	    {
+	      outfile_nxny=fopen((&Com)->outputFile_nxny, "w" );
+	      outfile_lat=fopen((&Com)->outputFile_lat, "wb" );
+	      outfile_lon=fopen((&Com)->outputFile_lon, "wb" );
+	    }
+	  else if(strcmp((&Com)->outFileFlag,"-a") == 0) /*open in ascii mode*/
+	    {
+	      outfile_nxny=fopen((&Com)->outputFile_nxny, "w" );
+	    }
+	  else /*open in ascii mode*/
+	    {
+	      sprintf(errbuf, "The flag for creating ASCII/Binary output file %s is -a or -b. \nAssuming -a : ASCII output file will be created.\n");
+	      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_ARGS, 
+		      H5E_BADVALUE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      outfile_nxny=fopen((&Com)->outputFile_nxny, "w" );
+	    }
+
+	  if(outfile_nxny == NULL)
+	    {
+	      free(rows);
+	      rows = NULL;
+	      free(cols);
+	      cols = NULL;
+	      free(lons);
+	      lons = NULL;
+	      free(lats);
+	      lats = NULL;
+	      status = -1;
+	      sprintf(errbuf, "The file %s cannot be opened.\n",(&Com)->outputFile_nxny);
+	      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FILE, 
+		      H5E_CANTOPENFILE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      HE5_GDdetach(gdid[is]);
+	      HE5_GDclose(gdfid);
+	      free(errbuf);
+	      if(outfile_lat == NULL ) fclose(outfile_lat);
+	      if(outfile_lon == NULL ) fclose(outfile_lon);
+	      return(status);
+	    }
+	  else if(outfile_lat == NULL && 
+		  (strcmp((&Com)->outFileFlag,"-b") == 0))
+	    {
+	      free(rows);
+	      rows = NULL;
+	      free(cols);
+	      cols = NULL;
+	      free(lons);
+	      lons = NULL;
+	      free(lats);
+	      lats = NULL;
+	      status = -1;
+	      sprintf(errbuf, "The file %s cannot be opened.\n",
+		      (&Com)->outputFile_lat);
+	      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FILE, 
+		      H5E_CANTOPENFILE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      HE5_GDdetach(gdid[is]);
+	      HE5_GDclose(gdfid);
+	      free(errbuf);
+	      fclose(outfile_nxny);
+	      if(outfile_lon == NULL ) fclose(outfile_lon);
+	      return(status);
+	    }
+	  else if(outfile_lon == NULL && 
+		  (strcmp((&Com)->outFileFlag,"-b") == 0))
+	    {
+	      free(rows);
+	      rows = NULL;
+	      free(cols);
+	      cols = NULL;
+	      free(lons);
+	      lons = NULL;
+	      free(lats);
+	      lats = NULL;
+	      status = -1;
+	      sprintf(errbuf, "The file %s cannot be opened.\n",
+		      (&Com)->outputFile_lon);
+	      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, H5E_FILE, 
+		      H5E_CANTOPENFILE, errbuf);
+	      HE5_EHprint(errbuf, __FILE__, __LINE__);
+	      HE5_GDdetach(gdid[is]);
+	      HE5_GDclose(gdfid);
+	      free(errbuf);
+	      fclose(outfile_nxny);
+	      fclose(outfile_lat);
+	      return(status);
+	    }
+	  else
+	    {
+	      if(strcmp((&Com)->outFileFlag,"-b") == 0) /* binary data */
+		{
+		  fprintf(stdout,"The output binary file contains 64bit float data for Latitude and  Longitude of the desired grid: {n=(%d * %d) 64bit float data; First row at the beginning, Last row at the end}\n\n", ydimsize,xdimsize);
+
+		  /* 
+		     write lat/lon to binary file in dataset format:
+		     (ydimsize Rows) X (xdimsize cloums)
+		  */
+		  status = 0;
+		  fprintf(outfile_nxny,"Input file: %s\nGrid: %s\nNumber of rows in the grid = %d\nNumber of columns in the grid = %d\nThe output binary files containing latitudes and longitudes:\n\t%s\n\t%s\n\n Each file contains %d X %d of 64bit float data; First row at the beginning, Last row at the end of the file.\nProjection:  %s\nProjection Parameters: ( ", (&Com)->inputFile, (&Com)->gridName, ydimsize, xdimsize, (&Com)->outputFile_lat, (&Com)->outputFile_lon, ydimsize, xdimsize, projection);
+		  for( v1=0; v1<13; v1++) 
+		    {
+		      fprintf(outfile_nxny,"  %lf",projparam[v1]);
+		    }
+		  fprintf(outfile_nxny," )");
+		  if(projcode == HE5_GCTP_UTM)
+		    {
+		      fprintf(outfile_nxny,"Zonecode: %d\n\n", zonecode);
+		    }
+		  else
+		    {
+		      fprintf(outfile_nxny,"\n\n");
+		    }
+
+		  if(status != -1 && 
+		     fwrite(lats, sizeof lats[0], npnts, outfile_lat) != npnts)
+		    {
+		      status = -1;
+		      sprintf(errbuf, "Error writing latitudes to binary output.\n");
+		      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, 
+			      H5E_DATASET, H5E_WRITEERROR, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		  if(status != -1 && 
+		     fwrite(lons, sizeof lons[0], npnts, outfile_lon) != npnts)
+		    {
+		      status = -1;
+		      sprintf(errbuf, "Error writing longitudes to binary output.\n");
+		      H5Epush(__FILE__, "HE5_GDconvert_ij2ll", __LINE__, 
+			      H5E_DATASET, H5E_WRITEERROR, errbuf);
+		      HE5_EHprint(errbuf, __FILE__, __LINE__);
+		    }
+		  if(status == -1)
+		    {
+		      fflush(outfile_nxny);
+		      if(strcmp((&Com)->outFileFlag,"-b") == 0) 
+			fflush(outfile_lat);
+		      if(strcmp((&Com)->outFileFlag,"-b") == 0) 
+			fflush(outfile_lon);
+		      free(rows);
+		      rows = NULL;
+		      free(cols);
+		      cols = NULL;
+		      free(lons);
+		      lons = NULL;
+		      free(lats);
+		      lats = NULL;
+		      HE5_GDdetach(gdid[is]);
+		      HE5_GDclose(gdfid);
+		      free(errbuf);
+		      if(outfile_nxny == NULL) fclose(outfile_nxny);
+		      if(outfile_lat == NULL && 
+			 (strcmp((&Com)->outFileFlag,"-b") == 0)) 
+			fclose(outfile_lat);
+		      if(outfile_lon == NULL && 
+			 (strcmp((&Com)->outFileFlag,"-b") == 0)) 
+			fclose(outfile_lon);
+		      return(-1);
+		    }
+		}
+	      else/* ascii data to output file */
+		{
+		  fprintf(stdout,"Number of rows =%d\n",ydimsize);
+ 		  fprintf(stdout,"Number of cols =%d\n",xdimsize);
+ 		  fprintf(stdout,"Projection: %s\nProjection Parameters: ( ",projection);
+		  for( v1=0; v1<13; v1++) 
+		    {
+		      fprintf(stdout,"  %lf",projparam[v1]);
+		    }
+		  fprintf(stdout," )");
+		  if(projcode == HE5_GCTP_UTM)
+		    {
+		      fprintf(stdout,"Zonecode: %d\n", zonecode);
+		    }
+		  else
+		    {
+		      fprintf(stdout,"\n");
+		    }
+
+		  fprintf(stdout,"\n");
+		  fprintf(stdout,"Order of paramters written to output file:\n");
+		  fprintf(stdout,"row column Latitude Longitude\n");
+		  fprintf(outfile_nxny,"Input file: %s\n",(&Com)->inputFile);
+		  fprintf(outfile_nxny,"Grid: %s\n",(&Com)->gridName);
+		  fprintf(outfile_nxny,"Number of rows =%d\n",ydimsize);
+ 		  fprintf(outfile_nxny,"Number of cols =%d\n",xdimsize);
+ 		  fprintf(outfile_nxny,"Projection: %s\nProjection Parameters: ( ",projection);
+		  for( v1=0; v1<13; v1++) 
+		    {
+		      fprintf(outfile_nxny,"  %lf",projparam[v1]);
+		    }
+		  fprintf(outfile_nxny," )");
+		  if(projcode == HE5_GCTP_UTM)
+		    {
+		      fprintf(outfile_nxny,"Zonecode: %d\n\n", zonecode);
+		    }
+		  else
+		    {
+		      fprintf(outfile_nxny,"\n\n");
+		    }
+
+		  for (k=0; k<npnts; k++)
+		    {
+		      fprintf(outfile_nxny,"%d %d %lf %lf\n",
+			      rows[k], cols[k], lats[k], lons[k]);
+		    }
+		}
+	    }
+
+	  fflush(outfile_nxny);
+	  if(strcmp((&Com)->outFileFlag,"-b") == 0) fflush(outfile_lat);
+	  if(strcmp((&Com)->outFileFlag,"-b") == 0) fflush(outfile_lon);
+	  free(rows);
+	  rows = NULL;
+	  free(cols);
+	  cols = NULL;
+	  free(lons);
+	  lons = NULL;
+	  free(lats);
+	  lats = NULL;
+	  HE5_GDdetach(gdid[is]);
+	  HE5_GDclose(gdfid);
+	  free(errbuf);
+	  if(outfile_nxny == NULL) fclose(outfile_nxny);
+	  if(outfile_lat == NULL  && 
+	     (strcmp((&Com)->outFileFlag,"-b") == 0)) fclose(outfile_lat);
+	  if(outfile_lon == NULL  && 
+	     (strcmp((&Com)->outFileFlag,"-b") == 0)) fclose(outfile_lon);
+	  return(0);
+	}
+      else
+	{
+	  /* write output to STDOUT */
+	  fprintf(stdout,"row column Latitude Longitude\n");
+	  for (k=0; k<npnts; k++)
+	    {
+	      fprintf(stdout,"%d %d %lf %lf\n",rows[k], cols[k], 
+		      lats[k], lons[k]);
+	    }
+	  
+	  fflush(stdout);
+	  free(rows);
+	  rows = NULL;
+	  free(cols);
+	  cols = NULL;
+	  free(lons);
+	  lons = NULL;
+	  free(lats);
+	  lats = NULL;
+	  HE5_GDdetach(gdid[is]);
+	  HE5_GDclose(gdfid);
+	  free(errbuf);
+	  return(0);
+	}
+    }
+}
+
diff --git a/util/make.com b/util/make.com
new file mode 100644
index 0000000..395eb50
--- /dev/null
+++ b/util/make.com
@@ -0,0 +1,20 @@
+INCDIR = -I$(HDF5INC) -I$(HDFEOS5_INC) -I$(SZIPINC) -I$(JPEGINC) -I$(ZLIBINC)
+LIBDIR = -L$(HDF5LIB) -L$(HDFEOS5_LIB) -L$(JPEGLIB) -L$(ZLIBLIB) -lhe5_hdfeos -lGctp $(HDF5LIB)/libhdf5_hl.a $(HDF5LIB)/libhdf5.a -ljpeg -lz $(SZIPLIB)/libsz.a -lm -ldl
+#LIBDIR = -L$(HDFEOS5_LIB)  -L$(JPEGLIB) -L$(ZLIBLIB) -lhe5_hdfeos -lGctp $(HDF5LIB)/libhdf5.a -ljpeg -lz $(SZIPLIB)/libsz.a -lm /usr/lib/librpc.a
+default all:
+	@echo " "; echo " "; \
+	if [ "$(HDFINC)" = "" ] || [ "$(HDF5INC)" = "" ] || [ "$(HDFEOS5_INC)" = "" ] || [ "$(SZIPINC)" = "" ] || [ "$(HDFLIB)" = "" ] || [ "$(HDF5LIB)" = "" ] || [ "$(HDFEOS5_LIB)" = "" ] || [ "$(SZIPLIB)" = "" ] ; then \
+		echo " --- ERROR: One or more of the environment variables HDFINC,"; \
+		echo " --- HDF5INC, HDFEOS5_INC, SZIPINC, HDFLIB, HDF5LIB, HDFEOS5_LIB,"; \
+		echo " --- SZIPLIB has not been set. Failed building utility executable."; \
+	else \
+		echo " ---- Making executable for HE5_GDconvert_ij2ll grid convertor ----"; \
+		echo "$(CC) $(CFLAGS) -o HE5_GDconvert_ij2ll.o $(INCDIR) -c HE5_GDconvert_ij2ll.c"; \
+		$(CC) $(CFLAGS) -o HE5_GDconvert_ij2ll.o $(INCDIR) -c HE5_GDconvert_ij2ll.c; \
+		echo "$(CC) $(CFLAGS) -o $(HDFEOS5_BIN)/HE5_GDconvert_ij2ll HE5_GDconvert_ij2ll.o $(LIBDIR) $(CEXTRAL)"; \
+		$(CC) $(CFLAGS) -o $(HDFEOS5_BIN)/HE5_GDconvert_ij2ll HE5_GDconvert_ij2ll.o $(LIBDIR) $(CEXTRAL); \
+		$(RM) $(RMFLAGS) *.o;  \
+	fi; \
+	echo " ";
+
+
diff --git a/util/makefile b/util/makefile
new file mode 100644
index 0000000..b989216
--- /dev/null
+++ b/util/makefile
@@ -0,0 +1,183 @@
+#-------------------------------------------------------------------------#
+#                                                                         #
+#  COPYRIGHT[copyright mark] 2000, Raytheon System Company, its vendors,  #
+#  and suppliers.  ALL RIGHTS RESERVED.                                   #
+#                                                                         #
+#-------------------------------------------------------------------------#
+#----------------------------------------------------------------------------
+# file:		makefile for HDF-EOS testdrivers
+# 	
+# 
+# author:  Abe Taaheri 
+#
+# history:
+#	04 Jan-2006 AT Initial version
+#----------------------------------------------------------------------------
+
+# force make to use the 'sh' shell
+SHELL = /bin/ksh
+
+# name of remove utility
+MAKE=$(MAKECMD)
+RM= /bin/rm
+RMFLAGS= -f 
+CFLAGS_SUN= -DSUN5 -DH5_USE_16_API
+FFLAGS_SUN= -DSUN5 -DH5_USE_16_API
+CFLAGS_HP11= -Aa -Ae -DHP9000 -Dunix -DH5_USE_16_API
+FFLAGS_HP11= -Aa -Ae -DHP9000 -Dunix -DH5_USE_16_API
+CFLAGS_HP10= -Aa -Ae -DHP9000 -Dunix -DH5_USE_16_API
+FFLAGS_HP10= -Aa -Ae -DHP9000 -Dunix -DH5_USE_16_API
+CFLAGS_DEC= -DDEC_ALPHA -Dunix -DH5_USE_16_API
+FFLAGS_DEC= -DDEC_ALPHA -Dunix -DH5_USE_16_API
+CFLAGS_IBM= -DIBM6000 -Dunix -DH5_USE_16_API
+FFLAGS_IBM= -DIBM6000 -Dunix -DH5_USE_16_API
+CFLAGS_ALL= -D$(HDFSYS) -DH5_USE_16_API
+FFLAGS_ALL= -D$(HDFSYS) -DH5_USE_16_API
+CFLAGS_SGIn32= -n32 -mips3 -DIRIX -Dunix -DH5_USE_16_API
+FFLAGS_SGIn32= -n32 -mips3 -DIRIX -Dunix -DH5_USE_16_API
+CFLAGS_SGI64= -64 -mips4 -DSGI64 -Dunix  -DH5_USE_16_API
+FFLAGS_SGI64= -64 -mips4 -DSGI64 -Dunix  -DH5_USE_16_API
+CFLAGS_IRX65= -64 -mips4 -DSGI64 -Dunix -DH5_USE_16_API
+FFLAGS_IRX65= -64 -mips4 -DSGI64 -Dunix -DH5_USE_16_API
+
+
+CSUNLIB= -lnsl -lsocket
+FSUNLIB= -lnsl -lsocket
+CHP10LIB=
+FHP10LIB=
+CHP11LIB= -lnsl
+FHP11LIB= -lnsl
+CALLLIB= -lpthread
+FALLLIB= -lpthread
+
+all: select_brand
+
+select_brand:
+	@if [ $(BRAND) = "sun5.8" ] ; then \
+		F77="f77"; \
+		CFLAGS="-g $(CFLAGS_SUN)"; \
+		FFLAGS="$(FFLAGS_SUN)"; \
+		CEXTRAL="$(CSUNLIB)"; \
+		FEXTRAL="$(FSUNLIB)"; \
+	elif [ $(BRAND) = "sun5.9" ] ; then \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_SUN)"; \
+		FFLAGS="$(FFLAGS_SUN)"; \
+		CEXTRAL="$(CSUNLIB)"; \
+		FEXTRAL="$(FSUNLIB)"; \
+	elif [ $(BRAND) = "sun5.10" ] ; then \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_SUN)"; \
+		FFLAGS="$(FFLAGS_SUN)"; \
+		CEXTRAL="$(CSUNLIB)"; \
+		FEXTRAL="$(FSUNLIB)"; \
+	elif [ $(BRAND) = "hp" ] ; then \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_HP10)"; \
+		FFLAGS="$(FFLAGS_HP10)"; \
+		CEXTRAL="$(CHP10LIB)"; \
+		FEXTRAL="$(FHP10LIB)"; \
+	elif [ $(BRAND) = "hp11" ] ; then \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_HP11)"; \
+		FFLAGS="$(FFLAGS_HP11)"; \
+		CEXTRAL="$(CHP11LIB)"; \
+		FEXTRAL="$(FHP11LIB)"; \
+	elif [ $(BRAND) = "dec" ] ; then \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_ALL)"; \
+		FFLAGS="$(FFLAGS_ALL)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "ibm" ] ; then \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_ALL)"; \
+		FFLAGS="$(FFLAGS_ALL)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "irix65" ] ; then \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_SGI65)"; \
+		FFLAGS="$(FFLAGS_SGI65)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "linux" ] ; then \
+		CC="gcc $(LNX_COMP_FLAG)"; \
+		F77="g77 $(LNX_COMP_FLAG)"; \
+		CFLAGS="$(CFLAGS_ALL)"; \
+		FFLAGS="$(FFLAGS_ALL)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "linux32" ] ; then \
+		CC="gcc $(LNX_COMP_FLAG)"; \
+		F77="g77 $(LNX_COMP_FLAG)"; \
+		CFLAGS="$(CFLAGS_ALL)"; \
+		FFLAGS="$(FFLAGS_ALL)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "linux64" ] ; then \
+		CC="gcc $(LNX_COMP_FLAG)"; \
+		F77="g77 $(LNX_COMP_FLAG)"; \
+		CFLAGS="$(CFLAGS_ALL)"; \
+		FFLAGS="$(FFLAGS_ALL)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "sgi32" ] ; then \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_SGIn32)"; \
+		FFLAGS="$(FFLAGS_SGIn32)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "sgi64" ] ; then \
+		F77="f77"; \
+		CFLAGS="$(CFLAGS_SGI64)"; \
+		FFLAGS="$(FFLAGS_SGI64)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "macintosh" ] ; then \
+		CC="gcc"; \
+		F77="$(F77)"; \
+		CFLAGS="$(CFLAGS_ALL)"; \
+		FFLAGS="$(FFLAGS_ALL)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "macintel" ] ; then \
+		CC="gcc"; \
+		F77="$(F77)"; \
+		CFLAGS="$(CFLAGS_ALL)"; \
+		FFLAGS="$(FFLAGS_ALL)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "macintel32" ] ; then \
+		CC="gcc -m32 -fPIC"; \
+		F77="$(F77) -m32 -fPIC"; \
+		CFLAGS="$(CFLAGS_ALL)"; \
+		FFLAGS="$(FFLAGS_ALL)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "macintel64" ] ; then \
+		CC="gcc -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk -fPIC"; \
+		F77="$(F77) -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk -fPIC"; \
+		CFLAGS="$(CFLAGS_ALL)"; \
+		FFLAGS="$(FFLAGS_ALL)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	elif [ $(BRAND) = "wint98" ] ; then \
+		CC="gcc"; \
+		F77="$(F77)"; \
+		CFLAGS="$(CFLAGS_ALL)"; \
+		FFLAGS="$(FFLAGS_ALL)"; \
+		CEXTRAL="$(CALLLIB)"; \
+		FEXTRAL="$(FALLLIB)"; \
+	else \
+		echo " The brand $(BRAND) is not supported. " ; \
+		echo " Set the env. vriable BRAND to a supported one then make this makefile"; \
+	fi ; \
+	RM="$(RM)";\
+	RMFLAGS="$(RMFLAGS)";\
+	export CC F77 CFLAGS FFLAGS FEXTRAL;\
+	export CEXTRAL RMFLAGS RM;\
+	make -f make.com;
+
+
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/hdf-eos5.git



More information about the debian-science-commits mailing list